redrust/
module.rs

1extern crate c2rust_bitfields;
2extern crate libc;
3extern crate core;
4extern "C" {
5    pub type _IO_wide_data;
6    pub type _IO_codecvt;
7    pub type _IO_marker;
8    pub type CallReply;
9    fn snprintf(
10        _: *mut libc::c_char,
11        _: libc::c_ulong,
12        _: *const libc::c_char,
13        _: ...
14    ) -> libc::c_int;
15    fn vsnprintf(
16        _: *mut libc::c_char,
17        _: libc::c_ulong,
18        _: *const libc::c_char,
19        _: core::ffi::VaList,
20    ) -> libc::c_int;
21    fn sdsnewlen(init: *const libc::c_void, initlen: size_t) -> sds;
22    fn sdsnew(init: *const libc::c_char) -> sds;
23    fn sdsempty() -> sds;
24    fn sdsdup(s: sds) -> sds;
25    fn sdsfree(s: sds);
26    fn sdsgrowzero(s: sds, len: size_t) -> sds;
27    fn sdscatlen(s: sds, t: *const libc::c_void, len: size_t) -> sds;
28    fn sdscat(s: sds, t: *const libc::c_char) -> sds;
29    fn sdscatvprintf(s: sds, fmt: *const libc::c_char, ap: core::ffi::VaList) -> sds;
30    fn sdscatprintf(s: sds, fmt: *const libc::c_char, _: ...) -> sds;
31    fn sdscatfmt(s: sds, fmt: *const libc::c_char, _: ...) -> sds;
32    fn sdstrim(s: sds, cset: *const libc::c_char) -> sds;
33    fn sdssubstr(s: sds, start: size_t, len: size_t);
34    fn sdssplitlen(
35        s: *const libc::c_char,
36        len: ssize_t,
37        sep: *const libc::c_char,
38        seplen: libc::c_int,
39        count: *mut libc::c_int,
40    ) -> *mut sds;
41    fn sdsfreesplitres(tokens: *mut sds, count: libc::c_int);
42    fn sdsfromlonglong(value: libc::c_longlong) -> sds;
43    fn sdssplitargs(line: *const libc::c_char, argc: *mut libc::c_int) -> *mut sds;
44    fn sdsIncrLen(s: sds, incr: ssize_t);
45    fn sdsRemoveFreeSpace(s: sds) -> sds;
46    fn __errno_location() -> *mut libc::c_int;
47    fn connPeerToString(
48        conn: *mut connection,
49        ip: *mut libc::c_char,
50        ip_len: size_t,
51        port: *mut libc::c_int,
52    ) -> libc::c_int;
53    fn connTLSGetPeerCert(conn: *mut connection) -> sds;
54    fn rioInitWithBuffer(r: *mut rio, s: sds);
55    fn rioWriteBulkCount(
56        r: *mut rio,
57        prefix: libc::c_char,
58        count: libc::c_long,
59    ) -> size_t;
60    fn rioWriteBulkObject(r: *mut rio, obj: *mut redisObject) -> libc::c_int;
61    fn pthread_mutex_trylock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
62    fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
63    fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
64    fn _serverAssert(
65        estr: *const libc::c_char,
66        file: *const libc::c_char,
67        line: libc::c_int,
68    );
69    fn memcpy(
70        _: *mut libc::c_void,
71        _: *const libc::c_void,
72        _: libc::c_ulong,
73    ) -> *mut libc::c_void;
74    fn memset(
75        _: *mut libc::c_void,
76        _: libc::c_int,
77        _: libc::c_ulong,
78    ) -> *mut libc::c_void;
79    fn memcmp(
80        _: *const libc::c_void,
81        _: *const libc::c_void,
82        _: libc::c_ulong,
83    ) -> libc::c_int;
84    fn strncpy(
85        _: *mut libc::c_char,
86        _: *const libc::c_char,
87        _: libc::c_ulong,
88    ) -> *mut libc::c_char;
89    fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
90    fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char;
91    fn strlen(_: *const libc::c_char) -> libc::c_ulong;
92    fn strerror(_: libc::c_int) -> *mut libc::c_char;
93    fn strcasecmp(__s1: *const libc::c_char, __s2: *const libc::c_char) -> libc::c_int;
94    fn read(__fd: libc::c_int, __buf: *mut libc::c_void, __nbytes: size_t) -> ssize_t;
95    fn write(__fd: libc::c_int, __buf: *const libc::c_void, __n: size_t) -> ssize_t;
96    fn kill(__pid: __pid_t, __sig: libc::c_int) -> libc::c_int;
97    fn hdr_close(h: *mut hdr_histogram);
98    static mut getMonotonicUs: Option::<unsafe extern "C" fn() -> monotime>;
99    fn aeCreateFileEvent(
100        eventLoop: *mut aeEventLoop,
101        fd: libc::c_int,
102        mask: libc::c_int,
103        proc_0: Option::<aeFileProc>,
104        clientData: *mut libc::c_void,
105    ) -> libc::c_int;
106    fn aeDeleteFileEvent(
107        eventLoop: *mut aeEventLoop,
108        fd: libc::c_int,
109        mask: libc::c_int,
110    );
111    fn aeGetFileEvents(eventLoop: *mut aeEventLoop, fd: libc::c_int) -> libc::c_int;
112    fn aeGetFileClientData(
113        eventLoop: *mut aeEventLoop,
114        fd: libc::c_int,
115    ) -> *mut libc::c_void;
116    fn aeCreateTimeEvent(
117        eventLoop: *mut aeEventLoop,
118        milliseconds: libc::c_longlong,
119        proc_0: Option::<aeTimeProc>,
120        clientData: *mut libc::c_void,
121        finalizerProc: Option::<aeEventFinalizerProc>,
122    ) -> libc::c_longlong;
123    fn aeDeleteTimeEvent(
124        eventLoop: *mut aeEventLoop,
125        id: libc::c_longlong,
126    ) -> libc::c_int;
127    fn aeGetSetSize(eventLoop: *mut aeEventLoop) -> libc::c_int;
128    fn dictCreate(type_0: *mut dictType) -> *mut dict;
129    fn dictAdd(
130        d: *mut dict,
131        key: *mut libc::c_void,
132        val: *mut libc::c_void,
133    ) -> libc::c_int;
134    fn dictReplace(
135        d: *mut dict,
136        key: *mut libc::c_void,
137        val: *mut libc::c_void,
138    ) -> libc::c_int;
139    fn dictDelete(d: *mut dict, key: *const libc::c_void) -> libc::c_int;
140    fn dictRelease(d: *mut dict);
141    fn dictFind(d: *mut dict, key: *const libc::c_void) -> *mut dictEntry;
142    fn dictFetchValue(d: *mut dict, key: *const libc::c_void) -> *mut libc::c_void;
143    fn dictGetIterator(d: *mut dict) -> *mut dictIterator;
144    fn dictGetSafeIterator(d: *mut dict) -> *mut dictIterator;
145    fn dictNext(iter: *mut dictIterator) -> *mut dictEntry;
146    fn dictReleaseIterator(iter: *mut dictIterator);
147    fn dictGenHashFunction(key: *const libc::c_void, len: size_t) -> uint64_t;
148    fn dictEmpty(
149        d: *mut dict,
150        callback: Option::<unsafe extern "C" fn(*mut dict) -> ()>,
151    );
152    fn dictScan(
153        d: *mut dict,
154        v: libc::c_ulong,
155        fn_0: Option::<dictScanFunction>,
156        bucketfn: Option::<dictScanBucketFunction>,
157        privdata: *mut libc::c_void,
158    ) -> libc::c_ulong;
159    fn listCreate() -> *mut list;
160    fn listRelease(list: *mut list);
161    fn listEmpty(list: *mut list);
162    fn listAddNodeHead(list: *mut list, value: *mut libc::c_void) -> *mut list;
163    fn listAddNodeTail(list: *mut list, value: *mut libc::c_void) -> *mut list;
164    fn listDelNode(list: *mut list, node: *mut listNode);
165    fn listNext(iter: *mut listIter) -> *mut listNode;
166    fn listSearchKey(list: *mut list, key: *mut libc::c_void) -> *mut listNode;
167    fn listRewind(list: *mut list, li: *mut listIter);
168    fn je_malloc_usable_size(ptr: *mut libc::c_void) -> size_t;
169    fn zmalloc(size: size_t) -> *mut libc::c_void;
170    fn zcalloc(size: size_t) -> *mut libc::c_void;
171    fn zrealloc(ptr: *mut libc::c_void, size: size_t) -> *mut libc::c_void;
172    fn ztrymalloc(size: size_t) -> *mut libc::c_void;
173    fn zfree(ptr: *mut libc::c_void);
174    fn zstrdup(s: *const libc::c_char) -> *mut libc::c_char;
175    fn anetPipe(
176        fds: *mut libc::c_int,
177        read_flags: libc::c_int,
178        write_flags: libc::c_int,
179    ) -> libc::c_int;
180    fn intsetGet(is: *mut intset, pos: uint32_t, value: *mut int64_t) -> uint8_t;
181    fn ll2string(
182        s: *mut libc::c_char,
183        len: size_t,
184        value: libc::c_longlong,
185    ) -> libc::c_int;
186    fn ull2string(
187        s: *mut libc::c_char,
188        len: size_t,
189        value: libc::c_ulonglong,
190    ) -> libc::c_int;
191    fn string2ll(
192        s: *const libc::c_char,
193        slen: size_t,
194        value: *mut libc::c_longlong,
195    ) -> libc::c_int;
196    fn string2ull(s: *const libc::c_char, value: *mut libc::c_ulonglong) -> libc::c_int;
197    fn string2ld(
198        s: *const libc::c_char,
199        slen: size_t,
200        dp: *mut f64,
201    ) -> libc::c_int;
202    fn string2d(
203        s: *const libc::c_char,
204        slen: size_t,
205        dp: *mut libc::c_double,
206    ) -> libc::c_int;
207    fn d2string(
208        buf: *mut libc::c_char,
209        len: size_t,
210        value: libc::c_double,
211    ) -> libc::c_int;
212    fn ld2string(
213        buf: *mut libc::c_char,
214        len: size_t,
215        value: f64,
216        mode: ld2string_mode,
217    ) -> libc::c_int;
218    fn latencyAddSample(event: *const libc::c_char, latency: mstime_t);
219    fn quicklistSetOptions(
220        quicklist: *mut quicklist,
221        fill: libc::c_int,
222        depth: libc::c_int,
223    );
224    static mut raxNotFound: *mut libc::c_void;
225    fn raxNew() -> *mut rax;
226    fn raxInsert(
227        rax: *mut rax,
228        s: *mut libc::c_uchar,
229        len: size_t,
230        data: *mut libc::c_void,
231        old: *mut *mut libc::c_void,
232    ) -> libc::c_int;
233    fn raxTryInsert(
234        rax: *mut rax,
235        s: *mut libc::c_uchar,
236        len: size_t,
237        data: *mut libc::c_void,
238        old: *mut *mut libc::c_void,
239    ) -> libc::c_int;
240    fn raxRemove(
241        rax: *mut rax,
242        s: *mut libc::c_uchar,
243        len: size_t,
244        old: *mut *mut libc::c_void,
245    ) -> libc::c_int;
246    fn raxFind(rax: *mut rax, s: *mut libc::c_uchar, len: size_t) -> *mut libc::c_void;
247    fn raxFree(rax: *mut rax);
248    fn raxFreeWithCallback(
249        rax: *mut rax,
250        free_callback: Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>,
251    );
252    fn raxStart(it: *mut raxIterator, rt: *mut rax);
253    fn raxSeek(
254        it: *mut raxIterator,
255        op: *const libc::c_char,
256        ele: *mut libc::c_uchar,
257        len: size_t,
258    ) -> libc::c_int;
259    fn raxNext(it: *mut raxIterator) -> libc::c_int;
260    fn raxPrev(it: *mut raxIterator) -> libc::c_int;
261    fn raxCompare(
262        iter: *mut raxIterator,
263        op: *const libc::c_char,
264        key: *mut libc::c_uchar,
265        key_len: size_t,
266    ) -> libc::c_int;
267    fn raxStop(it: *mut raxIterator);
268    fn raxEOF(it: *mut raxIterator) -> libc::c_int;
269    fn raxSize(rax: *mut rax) -> uint64_t;
270    fn intrev64(v: uint64_t) -> uint64_t;
271    fn lpGet(
272        p: *mut libc::c_uchar,
273        count: *mut int64_t,
274        intbuf: *mut libc::c_uchar,
275    ) -> *mut libc::c_uchar;
276    fn lpGetValue(
277        p: *mut libc::c_uchar,
278        slen: *mut libc::c_uint,
279        lval: *mut libc::c_longlong,
280    ) -> *mut libc::c_uchar;
281    fn lpFirst(lp: *mut libc::c_uchar) -> *mut libc::c_uchar;
282    fn lpNext(lp: *mut libc::c_uchar, p: *mut libc::c_uchar) -> *mut libc::c_uchar;
283    fn lpPrev(lp: *mut libc::c_uchar, p: *mut libc::c_uchar) -> *mut libc::c_uchar;
284    fn lpSeek(lp: *mut libc::c_uchar, index: libc::c_long) -> *mut libc::c_uchar;
285    fn streamLength(subject: *const robj) -> libc::c_ulong;
286    fn streamIteratorStart(
287        si: *mut streamIterator,
288        s: *mut stream,
289        start: *mut streamID,
290        end: *mut streamID,
291        rev: libc::c_int,
292    );
293    fn streamIteratorGetID(
294        si: *mut streamIterator,
295        id: *mut streamID,
296        numfields: *mut int64_t,
297    ) -> libc::c_int;
298    fn streamIteratorGetField(
299        si: *mut streamIterator,
300        fieldptr: *mut *mut libc::c_uchar,
301        valueptr: *mut *mut libc::c_uchar,
302        fieldlen: *mut int64_t,
303        valuelen: *mut int64_t,
304    );
305    fn streamIteratorRemoveEntry(si: *mut streamIterator, current: *mut streamID);
306    fn streamIteratorStop(si: *mut streamIterator);
307    fn streamIncrID(id: *mut streamID) -> libc::c_int;
308    fn streamDecrID(id: *mut streamID) -> libc::c_int;
309    fn streamParseID(o: *const robj, id: *mut streamID) -> libc::c_int;
310    fn createObjectFromStreamID(id: *mut streamID) -> *mut robj;
311    fn streamAppendItem(
312        s: *mut stream,
313        argv: *mut *mut robj,
314        numfields: int64_t,
315        added_id: *mut streamID,
316        use_id: *mut streamID,
317        seq_given: libc::c_int,
318    ) -> libc::c_int;
319    fn streamDeleteItem(s: *mut stream, id: *mut streamID) -> libc::c_int;
320    fn streamTrimByLength(
321        s: *mut stream,
322        maxlen: libc::c_longlong,
323        approx: libc::c_int,
324    ) -> int64_t;
325    fn streamTrimByID(s: *mut stream, minid: streamID, approx: libc::c_int) -> int64_t;
326    static mut server: redisServer;
327    static mut shared: sharedObjectsStruct;
328    static mut modulesDictType: dictType;
329    fn populateCommandLegacyRangeSpec(c: *mut redisCommand);
330    fn populateArgsStructure(args: *mut redisCommandArg) -> libc::c_int;
331    fn _serverLog(level: libc::c_int, fmt: *const libc::c_char, _: ...);
332    fn performModuleConfigSetDefaultFromName(
333        name: sds,
334        err: *mut *const libc::c_char,
335    ) -> libc::c_int;
336    fn performModuleConfigSetFromName(
337        name: sds,
338        value: sds,
339        err: *mut *const libc::c_char,
340    ) -> libc::c_int;
341    fn addModuleEnumConfig(
342        module_name: *const libc::c_char,
343        name: *const libc::c_char,
344        flags: libc::c_int,
345        privdata: *mut libc::c_void,
346        default_val: libc::c_int,
347        enum_vals: *mut configEnum,
348    );
349    fn serverLogRaw(level: libc::c_int, msg: *const libc::c_char);
350    fn addModuleStringConfig(
351        module_name: *const libc::c_char,
352        name: *const libc::c_char,
353        flags: libc::c_int,
354        privdata: *mut libc::c_void,
355        default_val: sds,
356    );
357    fn addModuleNumericConfig(
358        module_name: *const libc::c_char,
359        name: *const libc::c_char,
360        flags: libc::c_int,
361        privdata: *mut libc::c_void,
362        default_val: libc::c_longlong,
363        conf_flags: libc::c_int,
364        lower: libc::c_longlong,
365        upper: libc::c_longlong,
366    );
367    fn addModuleBoolConfig(
368        module_name: *const libc::c_char,
369        name: *const libc::c_char,
370        flags: libc::c_int,
371        privdata: *mut libc::c_void,
372        default_val: libc::c_int,
373    );
374    fn processEventsWhileBlocked();
375    fn protectClient(c: *mut client);
376    fn blockingOperationStarts();
377    fn ustime() -> libc::c_longlong;
378    fn activeDefragStringOb(ob: *mut robj, defragged: *mut libc::c_long) -> *mut robj;
379    fn activeDefragAlloc(ptr: *mut libc::c_void) -> *mut libc::c_void;
380    fn getKeysFreeResult(result: *mut getKeysResult);
381    fn getKeysFromCommand(
382        cmd: *mut redisCommand,
383        argv: *mut *mut robj,
384        argc: libc::c_int,
385        result: *mut getKeysResult,
386    ) -> libc::c_int;
387    fn doesCommandHaveKeys(cmd: *mut redisCommand) -> libc::c_int;
388    fn lookupCommand(argv: *mut *mut robj, argc: libc::c_int) -> *mut redisCommand;
389    fn redactClientCommandArgument(c: *mut client, argc: libc::c_int);
390    fn lookupClientByID(id: uint64_t) -> *mut client;
391    fn createObject(type_0: libc::c_int, ptr: *mut libc::c_void) -> *mut robj;
392    fn ACLGetUserByName(name: *const libc::c_char, namelen: size_t) -> *mut user;
393    fn freeClientAsync(c: *mut client);
394    static mut DefaultUser: *mut user;
395    fn ACLFreeUserAndKillClients(u: *mut user);
396    fn addACLLogEntry(
397        c: *mut client,
398        reason: libc::c_int,
399        context: libc::c_int,
400        argpos: libc::c_int,
401        username: sds,
402        object: sds,
403    );
404    fn ACLUserCheckChannelPerm(
405        u: *mut user,
406        channel: sds,
407        literal: libc::c_int,
408    ) -> libc::c_int;
409    fn ACLUserCheckKeyPerm(
410        u: *mut user,
411        key: *const libc::c_char,
412        keylen: libc::c_int,
413        flags: libc::c_int,
414    ) -> libc::c_int;
415    fn ACLCheckAllUserCommandPerm(
416        u: *mut user,
417        cmd: *mut redisCommand,
418        argv: *mut *mut robj,
419        argc: libc::c_int,
420        idxptr: *mut libc::c_int,
421    ) -> libc::c_int;
422    fn createStringObject(ptr: *const libc::c_char, len: size_t) -> *mut robj;
423    fn ACLDescribeUser(u: *mut user) -> *mut robj;
424    fn ACLStringSetUser(
425        u: *mut user,
426        username: sds,
427        argv: *mut sds,
428        argc: libc::c_int,
429    ) -> sds;
430    fn ACLSetUser(u: *mut user, op: *const libc::c_char, oplen: ssize_t) -> libc::c_int;
431    fn ACLCreateUnlinkedUser() -> *mut user;
432    fn decrRefCount(o: *mut robj);
433    fn createStringObjectFromLongDouble(
434        value: f64,
435        humanfriendly: libc::c_int,
436    ) -> *mut robj;
437    fn signalKeyAsReady(db: *mut redisDb, key: *mut robj, type_0: libc::c_int);
438    fn zslFreeLexRange(spec: *mut zlexrangespec);
439    fn listTypeReleaseIterator(li: *mut listTypeIterator);
440    fn signalModifiedKey(c: *mut client, db: *mut redisDb, key: *mut robj);
441    fn incrRefCount(o: *mut robj);
442    fn getStringObjectSdsUsedMemory(o: *mut robj) -> size_t;
443    fn getMaxmemoryState(
444        total: *mut size_t,
445        logical: *mut size_t,
446        tofree: *mut size_t,
447        level: *mut libc::c_float,
448    ) -> libc::c_int;
449    fn blockClient(c: *mut client, btype: libc::c_int);
450    fn mstime() -> libc::c_longlong;
451    fn blockForKeys(
452        c: *mut client,
453        btype: libc::c_int,
454        keys: *mut *mut robj,
455        numkeys: libc::c_int,
456        count: libc::c_long,
457        timeout: mstime_t,
458        target: *mut robj,
459        blockpos: *mut blockPos,
460        ids: *mut streamID,
461    );
462    fn addReplyError(c: *mut client, err: *const libc::c_char);
463    fn createClient(conn: *mut connection) -> *mut client;
464    fn LFUDecrAndReturn(o: *mut robj) -> libc::c_ulong;
465    fn objectSetLRUOrLFU(
466        val: *mut robj,
467        lfu_freq: libc::c_longlong,
468        lru_idle: libc::c_longlong,
469        lru_clock: libc::c_longlong,
470        lru_multiplier: libc::c_int,
471    ) -> libc::c_int;
472    fn estimateObjectIdleTime(o: *mut robj) -> libc::c_ulonglong;
473    fn LRU_CLOCK() -> libc::c_uint;
474    fn pubsubPublishMessageAndPropagateToCluster(
475        channel: *mut robj,
476        message: *mut robj,
477        sharded: libc::c_int,
478    ) -> libc::c_int;
479    fn clientSetName(c: *mut client, name: *mut robj) -> libc::c_int;
480    fn genInfoSectionDict(
481        argv: *mut *mut robj,
482        argc: libc::c_int,
483        defaults: *mut *mut libc::c_char,
484        out_all: *mut libc::c_int,
485        out_everything: *mut libc::c_int,
486    ) -> *mut dict;
487    fn releaseInfoSectionDict(sec: *mut dict);
488    fn genRedisInfoString(
489        section_dict: *mut dict,
490        all_sections: libc::c_int,
491        everything: libc::c_int,
492    ) -> sds;
493    fn getSafeInfoString(
494        s: *const libc::c_char,
495        len: size_t,
496        tmp: *mut *mut libc::c_char,
497    ) -> *const libc::c_char;
498    fn resetChildState();
499    fn exitFromChild(retcode: libc::c_int);
500    fn sendChildCowInfo(info_type: childInfoType, pname: *mut libc::c_char);
501    fn sendChildInfoGeneric(
502        info_type: childInfoType,
503        keys: size_t,
504        progress: libc::c_double,
505        pname: *mut libc::c_char,
506    );
507    fn redisSetProcTitle(title: *mut libc::c_char) -> libc::c_int;
508    fn redisFork(purpose: libc::c_int) -> libc::c_int;
509    fn getRandomHexChars(p: *mut libc::c_char, len: size_t);
510    fn getRandomBytes(p: *mut libc::c_uchar, len: size_t);
511    fn freeClient(c: *mut client);
512    fn resetClient(c: *mut client);
513    fn clearClientConnectionState(c: *mut client);
514    fn unblockPostponedClients();
515    fn unprotectClient(c: *mut client);
516    fn blockingOperationEnds();
517    fn propagatePendingCommands();
518    fn selectDb(c: *mut client, id: libc::c_int) -> libc::c_int;
519    fn notifyKeyspaceEvent(
520        type_0: libc::c_int,
521        event: *mut libc::c_char,
522        key: *mut robj,
523        dbid: libc::c_int,
524    );
525    fn xorDigest(digest: *mut libc::c_uchar, ptr: *const libc::c_void, len: size_t);
526    fn mixDigest(digest: *mut libc::c_uchar, ptr: *const libc::c_void, len: size_t);
527    fn updateStatsOnUnblock(
528        c: *mut client,
529        blocked_us: libc::c_long,
530        reply_us: libc::c_long,
531        had_errors: libc::c_int,
532    );
533    fn compareStringObjects(a: *mut robj, b: *mut robj) -> libc::c_int;
534    fn dupStringObject(o: *const robj) -> *mut robj;
535    fn trimStringObjectIfNeeded(o: *mut robj);
536    fn lookupCommandByCString(s: *const libc::c_char) -> *mut redisCommand;
537    fn _serverPanic(
538        file: *const libc::c_char,
539        line: libc::c_int,
540        msg: *const libc::c_char,
541        _: ...
542    );
543    fn rdbGenericLoadStringObject(
544        rdb: *mut rio,
545        flags: libc::c_int,
546        lenptr: *mut size_t,
547    ) -> *mut libc::c_void;
548    fn rdbLoadLen(rdb: *mut rio, isencoded: *mut libc::c_int) -> uint64_t;
549    fn rdbSaveLen(rdb: *mut rio, len: uint64_t) -> libc::c_int;
550    fn rdbSaveRawString(rdb: *mut rio, s: *mut libc::c_uchar, len: size_t) -> ssize_t;
551    fn rdbLoadBinaryFloatValue(rdb: *mut rio, val: *mut libc::c_float) -> libc::c_int;
552    fn rdbSaveBinaryFloatValue(rdb: *mut rio, val: libc::c_float) -> libc::c_int;
553    fn rdbLoadBinaryDoubleValue(rdb: *mut rio, val: *mut libc::c_double) -> libc::c_int;
554    fn rdbSaveBinaryDoubleValue(rdb: *mut rio, val: libc::c_double) -> libc::c_int;
555    fn rdbSaveStringObject(rdb: *mut rio, obj: *mut robj) -> ssize_t;
556    fn rdbLoadLenByRef(
557        rdb: *mut rio,
558        isencoded: *mut libc::c_int,
559        lenptr: *mut uint64_t,
560    ) -> libc::c_int;
561    fn createModuleObject(mt: *mut moduleType, value: *mut libc::c_void) -> *mut robj;
562    fn setKey(
563        c: *mut client,
564        db: *mut redisDb,
565        key: *mut robj,
566        val: *mut robj,
567        flags: libc::c_int,
568    );
569    fn dbDelete(db: *mut redisDb, key: *mut robj) -> libc::c_int;
570    fn checkClientPauseTimeoutAndReturnIfPaused() -> libc::c_int;
571    fn hasActiveChildProcess() -> libc::c_int;
572    fn getKeysPrepareResult(
573        result: *mut getKeysResult,
574        numkeys: libc::c_int,
575    ) -> *mut keyReference;
576    fn createRawStringObject(ptr: *const libc::c_char, len: size_t) -> *mut robj;
577    fn dbAdd(db: *mut redisDb, key: *mut robj, val: *mut robj);
578    fn createStreamObject() -> *mut robj;
579    fn createHashObject() -> *mut robj;
580    fn createZsetListpackObject() -> *mut robj;
581    fn createQuicklistObject() -> *mut robj;
582    fn getDecodedObject(o: *mut robj) -> *mut robj;
583    fn hashTypeGetValueObject(o: *mut robj, field: sds) -> *mut robj;
584    fn hashTypeExists(o: *mut robj, key: sds) -> libc::c_int;
585    fn hashTypeLength(o: *const robj) -> libc::c_ulong;
586    fn zsetLength(zobj: *const robj) -> libc::c_ulong;
587    fn setTypeSize(subject: *const robj) -> libc::c_ulong;
588    fn listTypeLength(subject: *const robj) -> libc::c_ulong;
589    fn hashTypeSet(
590        o: *mut robj,
591        field: sds,
592        value: sds,
593        flags: libc::c_int,
594    ) -> libc::c_int;
595    fn hashTypeTryConversion(
596        subject: *mut robj,
597        argv: *mut *mut robj,
598        start: libc::c_int,
599        end: libc::c_int,
600    );
601    fn hashTypeDelete(o: *mut robj, key: sds) -> libc::c_int;
602    fn zslLexValueGteMin(value: sds, spec: *mut zlexrangespec) -> libc::c_int;
603    fn zslValueGteMin(value: libc::c_double, spec: *mut zrangespec) -> libc::c_int;
604    fn zzlLexValueGteMin(p: *mut libc::c_uchar, spec: *mut zlexrangespec) -> libc::c_int;
605    fn zzlGetScore(sptr: *mut libc::c_uchar) -> libc::c_double;
606    fn zslLexValueLteMax(value: sds, spec: *mut zlexrangespec) -> libc::c_int;
607    fn zslValueLteMax(value: libc::c_double, spec: *mut zrangespec) -> libc::c_int;
608    fn zzlLexValueLteMax(p: *mut libc::c_uchar, spec: *mut zlexrangespec) -> libc::c_int;
609    fn lpGetObject(sptr: *mut libc::c_uchar) -> sds;
610    fn zslLastInLexRange(
611        zsl: *mut zskiplist,
612        range: *mut zlexrangespec,
613    ) -> *mut zskiplistNode;
614    fn zslFirstInLexRange(
615        zsl: *mut zskiplist,
616        range: *mut zlexrangespec,
617    ) -> *mut zskiplistNode;
618    fn zzlLastInLexRange(
619        zl: *mut libc::c_uchar,
620        range: *mut zlexrangespec,
621    ) -> *mut libc::c_uchar;
622    fn zzlFirstInLexRange(
623        zl: *mut libc::c_uchar,
624        range: *mut zlexrangespec,
625    ) -> *mut libc::c_uchar;
626    fn zslParseLexRange(
627        min: *mut robj,
628        max: *mut robj,
629        spec: *mut zlexrangespec,
630    ) -> libc::c_int;
631    fn zslLastInRange(zsl: *mut zskiplist, range: *mut zrangespec) -> *mut zskiplistNode;
632    fn zslFirstInRange(
633        zsl: *mut zskiplist,
634        range: *mut zrangespec,
635    ) -> *mut zskiplistNode;
636    fn zzlLastInRange(
637        zl: *mut libc::c_uchar,
638        range: *mut zrangespec,
639    ) -> *mut libc::c_uchar;
640    fn zzlFirstInRange(
641        zl: *mut libc::c_uchar,
642        range: *mut zrangespec,
643    ) -> *mut libc::c_uchar;
644    fn zsetDel(zobj: *mut robj, ele: sds) -> libc::c_int;
645    fn zsetScore(
646        zobj: *mut robj,
647        member: sds,
648        score: *mut libc::c_double,
649    ) -> libc::c_int;
650    fn zsetAdd(
651        zobj: *mut robj,
652        score: libc::c_double,
653        ele: sds,
654        in_flags: libc::c_int,
655        out_flags: *mut libc::c_int,
656        newscore: *mut libc::c_double,
657    ) -> libc::c_int;
658    fn dbRandomKey(db: *mut redisDb) -> *mut robj;
659    fn restartAOFAfterSYNC();
660    fn flushAllDataAndResetRDB(flags: libc::c_int);
661    fn stopAppendOnly();
662    fn getExpire(db: *mut redisDb, key: *mut robj) -> libc::c_longlong;
663    fn removeExpire(db: *mut redisDb, key: *mut robj) -> libc::c_int;
664    fn setExpire(
665        c: *mut client,
666        db: *mut redisDb,
667        key: *mut robj,
668        when: libc::c_longlong,
669    );
670    fn dbUnshareStringValue(db: *mut redisDb, key: *mut robj, o: *mut robj) -> *mut robj;
671    fn dbAsyncDelete(db: *mut redisDb, key: *mut robj) -> libc::c_int;
672    fn alsoPropagate(
673        dbid: libc::c_int,
674        argv: *mut *mut robj,
675        argc: libc::c_int,
676        target: libc::c_int,
677    );
678    fn call(c: *mut client, flags: libc::c_int);
679    fn mustObeyClient(c: *mut client) -> libc::c_int;
680    fn getAclErrorMessage(acl_res: libc::c_int) -> *const libc::c_char;
681    fn writeCommandsDeniedByDiskError() -> libc::c_int;
682    fn writeCommandsGetDiskErrorMessage(_: libc::c_int) -> sds;
683    fn checkGoodReplicasStatus() -> libc::c_int;
684    fn getCommandFlags(c: *mut client) -> uint64_t;
685    fn commandCheckArity(c: *mut client, err: *mut sds) -> libc::c_int;
686    fn commandCheckExistence(c: *mut client, err: *mut sds) -> libc::c_int;
687    fn getDoubleFromObject(o: *const robj, target: *mut libc::c_double) -> libc::c_int;
688    fn listTypeNext(li: *mut listTypeIterator, entry: *mut listTypeEntry) -> libc::c_int;
689    fn listTypeDelete(iter: *mut listTypeIterator, entry: *mut listTypeEntry);
690    fn listTypeSetIteratorDirection(li: *mut listTypeIterator, direction: libc::c_uchar);
691    fn listTypeInitIterator(
692        subject: *mut robj,
693        index: libc::c_long,
694        direction: libc::c_uchar,
695    ) -> *mut listTypeIterator;
696    fn listTypeInsert(entry: *mut listTypeEntry, value: *mut robj, where_0: libc::c_int);
697    fn listTypePush(subject: *mut robj, value: *mut robj, where_0: libc::c_int);
698    fn listTypeReplace(entry: *mut listTypeEntry, value: *mut robj);
699    fn listTypeGet(entry: *mut listTypeEntry) -> *mut robj;
700    fn listTypePop(subject: *mut robj, where_0: libc::c_int) -> *mut robj;
701    fn stringObjectLen(o: *mut robj) -> size_t;
702    fn lookupKeyReadWithFlags(
703        db: *mut redisDb,
704        key: *mut robj,
705        flags: libc::c_int,
706    ) -> *mut robj;
707    fn lookupKeyWriteWithFlags(
708        db: *mut redisDb,
709        key: *mut robj,
710        flags: libc::c_int,
711    ) -> *mut robj;
712    fn addReplyHumanLongDouble(c: *mut client, d: f64);
713    fn addReplyBigNum(c: *mut client, num: *const libc::c_char, len: size_t);
714    fn addReplyDouble(c: *mut client, d: libc::c_double);
715    fn deferredAfterErrorReply(c: *mut client, errors: *mut list);
716    fn addReplyProto(c: *mut client, s: *const libc::c_char, len: size_t);
717    fn addReplyBool(c: *mut client, b: libc::c_int);
718    fn addReplyNull(c: *mut client);
719    fn addReplyBulkCString(c: *mut client, s: *const libc::c_char);
720    fn addReplyBulkCBuffer(c: *mut client, p: *const libc::c_void, len: size_t);
721    fn addReplyVerbatim(
722        c: *mut client,
723        s: *const libc::c_char,
724        len: size_t,
725        ext: *const libc::c_char,
726    );
727    fn addReply(c: *mut client, obj: *mut robj);
728    fn addReplyBulk(c: *mut client, obj: *mut robj);
729    fn setDeferredAttributeLen(
730        c: *mut client,
731        node: *mut libc::c_void,
732        length: libc::c_long,
733    );
734    fn setDeferredSetLen(c: *mut client, node: *mut libc::c_void, length: libc::c_long);
735    fn setDeferredMapLen(c: *mut client, node: *mut libc::c_void, length: libc::c_long);
736    fn setDeferredArrayLen(
737        c: *mut client,
738        node: *mut libc::c_void,
739        length: libc::c_long,
740    );
741    fn addReplyNullArray(c: *mut client);
742    fn addReplyAttributeLen(c: *mut client, length: libc::c_long);
743    fn addReplySetLen(c: *mut client, length: libc::c_long);
744    fn addReplyMapLen(c: *mut client, length: libc::c_long);
745    fn addReplyArrayLen(c: *mut client, length: libc::c_long);
746    fn addReplyDeferredLen(c: *mut client) -> *mut libc::c_void;
747    fn addReplyErrorFormat(c: *mut client, fmt: *const libc::c_char, _: ...);
748    fn addReplyLongLong(c: *mut client, ll: libc::c_longlong);
749    fn addReplyErrorArity(c: *mut client);
750    fn catSubCommandFullname(
751        parent_name: *const libc::c_char,
752        sub_name: *const libc::c_char,
753    ) -> sds;
754    fn commandAddSubcommand(
755        parent: *mut redisCommand,
756        subcommand: *mut redisCommand,
757        declared_name: *const libc::c_char,
758    );
759    fn lookupSubcommand(
760        container: *mut redisCommand,
761        sub_name: sds,
762    ) -> *mut redisCommand;
763    fn ACLGetCommandID(cmdname: sds) -> libc::c_ulong;
764    fn dictSdsDestructor(d: *mut dict, val: *mut libc::c_void);
765    fn dictSdsKeyCaseCompare(
766        d: *mut dict,
767        key1: *const libc::c_void,
768        key2: *const libc::c_void,
769    ) -> libc::c_int;
770    fn dictSdsCaseHash(key: *const libc::c_void) -> uint64_t;
771    fn removeConfig(name: sds);
772    fn addReplySubcommandSyntaxError(c: *mut client);
773    fn addReplyHelp(c: *mut client, help: *mut *const libc::c_char);
774    fn clientHasPendingReplies(c: *mut client) -> libc::c_int;
775    fn unblockClient(c: *mut client);
776    fn AddReplyFromClient(c: *mut client, src: *mut client);
777    fn rdbSaveSingleModuleAux(
778        rdb: *mut rio,
779        when: libc::c_int,
780        mt: *mut moduleType,
781    ) -> ssize_t;
782    fn exit(_: libc::c_int) -> !;
783    fn getNodeByQuery(
784        c: *mut client,
785        cmd: *mut redisCommand,
786        argv: *mut *mut robj,
787        argc: libc::c_int,
788        hashslot: *mut libc::c_int,
789        ask: *mut libc::c_int,
790    ) -> *mut clusterNode;
791    fn clusterLookupNode(
792        name: *const libc::c_char,
793        length: libc::c_int,
794    ) -> *mut clusterNode;
795    fn clusterSendModuleMessageToTarget(
796        target: *const libc::c_char,
797        module_id: uint64_t,
798        type_0: uint8_t,
799        payload: *const libc::c_char,
800        len: uint32_t,
801    ) -> libc::c_int;
802    fn scriptIsRunning() -> libc::c_int;
803    fn callReplyCreate(
804        reply: sds,
805        deferred_error_list: *mut list,
806        private_data: *mut libc::c_void,
807    ) -> *mut CallReply;
808    fn callReplyCreateError(
809        reply: sds,
810        private_data: *mut libc::c_void,
811    ) -> *mut CallReply;
812    fn callReplyType(rep: *mut CallReply) -> libc::c_int;
813    fn callReplyGetString(rep: *mut CallReply, len: *mut size_t) -> *const libc::c_char;
814    fn callReplyGetLongLong(rep: *mut CallReply) -> libc::c_longlong;
815    fn callReplyGetDouble(rep: *mut CallReply) -> libc::c_double;
816    fn callReplyGetBool(rep: *mut CallReply) -> libc::c_int;
817    fn callReplyGetLen(rep: *mut CallReply) -> size_t;
818    fn callReplyGetArrayElement(rep: *mut CallReply, idx: size_t) -> *mut CallReply;
819    fn callReplyGetSetElement(rep: *mut CallReply, idx: size_t) -> *mut CallReply;
820    fn callReplyGetMapElement(
821        rep: *mut CallReply,
822        idx: size_t,
823        key: *mut *mut CallReply,
824        val: *mut *mut CallReply,
825    ) -> libc::c_int;
826    fn callReplyGetAttribute(rep: *mut CallReply) -> *mut CallReply;
827    fn callReplyGetAttributeElement(
828        rep: *mut CallReply,
829        idx: size_t,
830        key: *mut *mut CallReply,
831        val: *mut *mut CallReply,
832    ) -> libc::c_int;
833    fn callReplyGetBigNumber(
834        rep: *mut CallReply,
835        len: *mut size_t,
836    ) -> *const libc::c_char;
837    fn callReplyGetVerbatim(
838        rep: *mut CallReply,
839        len: *mut size_t,
840        format: *mut *const libc::c_char,
841    ) -> *const libc::c_char;
842    fn callReplyGetPrivateData(rep: *mut CallReply) -> *mut libc::c_void;
843    fn callReplyIsResp3(rep: *mut CallReply) -> libc::c_int;
844    fn callReplyDeferredErrorList(rep: *mut CallReply) -> *mut list;
845    fn freeCallReply(rep: *mut CallReply);
846    fn callReplyGetProto(rep: *mut CallReply, len: *mut size_t) -> *const libc::c_char;
847    fn dlerror() -> *mut libc::c_char;
848    fn dlclose(__handle: *mut libc::c_void) -> libc::c_int;
849    fn dlsym(
850        __handle: *mut libc::c_void,
851        __name: *const libc::c_char,
852    ) -> *mut libc::c_void;
853    fn dlopen(__file: *const libc::c_char, __mode: libc::c_int) -> *mut libc::c_void;
854    fn __xstat(
855        __ver: libc::c_int,
856        __filename: *const libc::c_char,
857        __stat_buf: *mut stat,
858    ) -> libc::c_int;
859    fn waitpid(
860        __pid: __pid_t,
861        __stat_loc: *mut libc::c_int,
862        __options: libc::c_int,
863    ) -> __pid_t;
864}
865pub type __builtin_va_list = __va_list;
866#[derive(Copy, Clone)]
867#[repr(C)]
868pub struct __va_list {
869    pub __stack: *mut libc::c_void,
870    pub __gr_top: *mut libc::c_void,
871    pub __vr_top: *mut libc::c_void,
872    pub __gr_offs: libc::c_int,
873    pub __vr_offs: libc::c_int,
874}
875pub type __int8_t = libc::c_schar;
876pub type __uint8_t = libc::c_uchar;
877pub type __int16_t = libc::c_short;
878pub type __uint16_t = libc::c_ushort;
879pub type __int32_t = libc::c_int;
880pub type __uint32_t = libc::c_uint;
881pub type __int64_t = libc::c_long;
882pub type __uint64_t = libc::c_ulong;
883pub type __uint_least64_t = __uint64_t;
884pub type __dev_t = libc::c_ulong;
885pub type __uid_t = libc::c_uint;
886pub type __gid_t = libc::c_uint;
887pub type __ino64_t = libc::c_ulong;
888pub type __mode_t = libc::c_uint;
889pub type __nlink_t = libc::c_uint;
890pub type __off_t = libc::c_long;
891pub type __off64_t = libc::c_long;
892pub type __pid_t = libc::c_int;
893pub type __time_t = libc::c_long;
894pub type __blksize_t = libc::c_int;
895pub type __blkcnt64_t = libc::c_long;
896pub type __ssize_t = libc::c_long;
897pub type __syscall_slong_t = libc::c_long;
898pub type __sig_atomic_t = libc::c_int;
899pub type size_t = libc::c_ulong;
900#[derive(Copy, Clone)]
901#[repr(C)]
902pub struct iovec {
903    pub iov_base: *mut libc::c_void,
904    pub iov_len: size_t,
905}
906pub type mode_t = __mode_t;
907pub type off_t = __off64_t;
908pub type pid_t = __pid_t;
909#[derive(Copy, Clone)]
910#[repr(C)]
911pub struct timespec {
912    pub tv_sec: __time_t,
913    pub tv_nsec: __syscall_slong_t,
914}
915#[derive(Copy, Clone)]
916#[repr(C)]
917pub struct stat {
918    pub st_dev: __dev_t,
919    pub st_ino: __ino64_t,
920    pub st_mode: __mode_t,
921    pub st_nlink: __nlink_t,
922    pub st_uid: __uid_t,
923    pub st_gid: __gid_t,
924    pub st_rdev: __dev_t,
925    pub __pad1: __dev_t,
926    pub st_size: __off64_t,
927    pub st_blksize: __blksize_t,
928    pub __pad2: libc::c_int,
929    pub st_blocks: __blkcnt64_t,
930    pub st_atim: timespec,
931    pub st_mtim: timespec,
932    pub st_ctim: timespec,
933    pub __glibc_reserved: [libc::c_int; 2],
934}
935pub type ssize_t = __ssize_t;
936pub type time_t = __time_t;
937pub type int8_t = __int8_t;
938pub type int16_t = __int16_t;
939pub type int32_t = __int32_t;
940pub type int64_t = __int64_t;
941#[derive(Copy, Clone)]
942#[repr(C)]
943pub struct __pthread_internal_list {
944    pub __prev: *mut __pthread_internal_list,
945    pub __next: *mut __pthread_internal_list,
946}
947pub type __pthread_list_t = __pthread_internal_list;
948#[derive(Copy, Clone)]
949#[repr(C)]
950pub struct __pthread_mutex_s {
951    pub __lock: libc::c_int,
952    pub __count: libc::c_uint,
953    pub __owner: libc::c_int,
954    pub __nusers: libc::c_uint,
955    pub __kind: libc::c_int,
956    pub __spins: libc::c_int,
957    pub __list: __pthread_list_t,
958}
959pub type pthread_t = libc::c_ulong;
960#[derive(Copy, Clone)]
961#[repr(C)]
962pub union pthread_mutex_t {
963    pub __data: __pthread_mutex_s,
964    pub __size: [libc::c_char; 48],
965    pub __align: libc::c_long,
966}
967pub type va_list = __builtin_va_list;
968#[derive(Copy, Clone)]
969#[repr(C)]
970pub struct _IO_FILE {
971    pub _flags: libc::c_int,
972    pub _IO_read_ptr: *mut libc::c_char,
973    pub _IO_read_end: *mut libc::c_char,
974    pub _IO_read_base: *mut libc::c_char,
975    pub _IO_write_base: *mut libc::c_char,
976    pub _IO_write_ptr: *mut libc::c_char,
977    pub _IO_write_end: *mut libc::c_char,
978    pub _IO_buf_base: *mut libc::c_char,
979    pub _IO_buf_end: *mut libc::c_char,
980    pub _IO_save_base: *mut libc::c_char,
981    pub _IO_backup_base: *mut libc::c_char,
982    pub _IO_save_end: *mut libc::c_char,
983    pub _markers: *mut _IO_marker,
984    pub _chain: *mut _IO_FILE,
985    pub _fileno: libc::c_int,
986    pub _flags2: libc::c_int,
987    pub _old_offset: __off_t,
988    pub _cur_column: libc::c_ushort,
989    pub _vtable_offset: libc::c_schar,
990    pub _shortbuf: [libc::c_char; 1],
991    pub _lock: *mut libc::c_void,
992    pub _offset: __off64_t,
993    pub _codecvt: *mut _IO_codecvt,
994    pub _wide_data: *mut _IO_wide_data,
995    pub _freeres_list: *mut _IO_FILE,
996    pub _freeres_buf: *mut libc::c_void,
997    pub __pad5: size_t,
998    pub _mode: libc::c_int,
999    pub _unused2: [libc::c_char; 20],
1000}
1001pub type _IO_lock_t = ();
1002pub type FILE = _IO_FILE;
1003pub type uint8_t = __uint8_t;
1004pub type uint16_t = __uint16_t;
1005pub type uint32_t = __uint32_t;
1006pub type uint64_t = __uint64_t;
1007pub type uint_least64_t = __uint_least64_t;
1008pub type intptr_t = libc::c_long;
1009pub type sds = *mut libc::c_char;
1010#[derive(Copy, Clone)]
1011#[repr(C, packed)]
1012pub struct sdshdr8 {
1013    pub len: uint8_t,
1014    pub alloc: uint8_t,
1015    pub flags: libc::c_uchar,
1016    pub buf: [libc::c_char; 0],
1017}
1018#[derive(Copy, Clone)]
1019#[repr(C, packed)]
1020pub struct sdshdr16 {
1021    pub len: uint16_t,
1022    pub alloc: uint16_t,
1023    pub flags: libc::c_uchar,
1024    pub buf: [libc::c_char; 0],
1025}
1026#[derive(Copy, Clone)]
1027#[repr(C, packed)]
1028pub struct sdshdr32 {
1029    pub len: uint32_t,
1030    pub alloc: uint32_t,
1031    pub flags: libc::c_uchar,
1032    pub buf: [libc::c_char; 0],
1033}
1034#[derive(Copy, Clone)]
1035#[repr(C, packed)]
1036pub struct sdshdr64 {
1037    pub len: uint64_t,
1038    pub alloc: uint64_t,
1039    pub flags: libc::c_uchar,
1040    pub buf: [libc::c_char; 0],
1041}
1042#[derive(Copy, Clone)]
1043#[repr(C)]
1044pub struct aeEventLoop {
1045    pub maxfd: libc::c_int,
1046    pub setsize: libc::c_int,
1047    pub timeEventNextId: libc::c_longlong,
1048    pub events: *mut aeFileEvent,
1049    pub fired: *mut aeFiredEvent,
1050    pub timeEventHead: *mut aeTimeEvent,
1051    pub stop: libc::c_int,
1052    pub apidata: *mut libc::c_void,
1053    pub beforesleep: Option::<aeBeforeSleepProc>,
1054    pub aftersleep: Option::<aeBeforeSleepProc>,
1055    pub flags: libc::c_int,
1056}
1057pub type aeBeforeSleepProc = unsafe extern "C" fn(*mut aeEventLoop) -> ();
1058#[derive(Copy, Clone)]
1059#[repr(C)]
1060pub struct aeTimeEvent {
1061    pub id: libc::c_longlong,
1062    pub when: monotime,
1063    pub timeProc: Option::<aeTimeProc>,
1064    pub finalizerProc: Option::<aeEventFinalizerProc>,
1065    pub clientData: *mut libc::c_void,
1066    pub prev: *mut aeTimeEvent,
1067    pub next: *mut aeTimeEvent,
1068    pub refcount: libc::c_int,
1069}
1070pub type aeEventFinalizerProc = unsafe extern "C" fn(
1071    *mut aeEventLoop,
1072    *mut libc::c_void,
1073) -> ();
1074pub type aeTimeProc = unsafe extern "C" fn(
1075    *mut aeEventLoop,
1076    libc::c_longlong,
1077    *mut libc::c_void,
1078) -> libc::c_int;
1079pub type monotime = uint64_t;
1080#[derive(Copy, Clone)]
1081#[repr(C)]
1082pub struct aeFiredEvent {
1083    pub fd: libc::c_int,
1084    pub mask: libc::c_int,
1085}
1086#[derive(Copy, Clone)]
1087#[repr(C)]
1088pub struct aeFileEvent {
1089    pub mask: libc::c_int,
1090    pub rfileProc: Option::<aeFileProc>,
1091    pub wfileProc: Option::<aeFileProc>,
1092    pub clientData: *mut libc::c_void,
1093}
1094pub type aeFileProc = unsafe extern "C" fn(
1095    *mut aeEventLoop,
1096    libc::c_int,
1097    *mut libc::c_void,
1098    libc::c_int,
1099) -> ();
1100#[derive(Copy, Clone)]
1101#[repr(C)]
1102pub struct connection {
1103    pub type_0: *mut ConnectionType,
1104    pub state: ConnectionState,
1105    pub flags: libc::c_short,
1106    pub refs: libc::c_short,
1107    pub last_errno: libc::c_int,
1108    pub private_data: *mut libc::c_void,
1109    pub conn_handler: ConnectionCallbackFunc,
1110    pub write_handler: ConnectionCallbackFunc,
1111    pub read_handler: ConnectionCallbackFunc,
1112    pub fd: libc::c_int,
1113}
1114pub type ConnectionCallbackFunc = Option::<unsafe extern "C" fn(*mut connection) -> ()>;
1115pub type ConnectionState = libc::c_uint;
1116pub const CONN_STATE_ERROR: ConnectionState = 5;
1117pub const CONN_STATE_CLOSED: ConnectionState = 4;
1118pub const CONN_STATE_CONNECTED: ConnectionState = 3;
1119pub const CONN_STATE_ACCEPTING: ConnectionState = 2;
1120pub const CONN_STATE_CONNECTING: ConnectionState = 1;
1121pub const CONN_STATE_NONE: ConnectionState = 0;
1122#[derive(Copy, Clone)]
1123#[repr(C)]
1124pub struct ConnectionType {
1125    pub ae_handler: Option::<
1126        unsafe extern "C" fn(
1127            *mut aeEventLoop,
1128            libc::c_int,
1129            *mut libc::c_void,
1130            libc::c_int,
1131        ) -> (),
1132    >,
1133    pub connect: Option::<
1134        unsafe extern "C" fn(
1135            *mut connection,
1136            *const libc::c_char,
1137            libc::c_int,
1138            *const libc::c_char,
1139            ConnectionCallbackFunc,
1140        ) -> libc::c_int,
1141    >,
1142    pub write: Option::<
1143        unsafe extern "C" fn(*mut connection, *const libc::c_void, size_t) -> libc::c_int,
1144    >,
1145    pub writev: Option::<
1146        unsafe extern "C" fn(*mut connection, *const iovec, libc::c_int) -> libc::c_int,
1147    >,
1148    pub read: Option::<
1149        unsafe extern "C" fn(*mut connection, *mut libc::c_void, size_t) -> libc::c_int,
1150    >,
1151    pub close: Option::<unsafe extern "C" fn(*mut connection) -> ()>,
1152    pub accept: Option::<
1153        unsafe extern "C" fn(*mut connection, ConnectionCallbackFunc) -> libc::c_int,
1154    >,
1155    pub set_write_handler: Option::<
1156        unsafe extern "C" fn(
1157            *mut connection,
1158            ConnectionCallbackFunc,
1159            libc::c_int,
1160        ) -> libc::c_int,
1161    >,
1162    pub set_read_handler: Option::<
1163        unsafe extern "C" fn(*mut connection, ConnectionCallbackFunc) -> libc::c_int,
1164    >,
1165    pub get_last_error: Option::<
1166        unsafe extern "C" fn(*mut connection) -> *const libc::c_char,
1167    >,
1168    pub blocking_connect: Option::<
1169        unsafe extern "C" fn(
1170            *mut connection,
1171            *const libc::c_char,
1172            libc::c_int,
1173            libc::c_longlong,
1174        ) -> libc::c_int,
1175    >,
1176    pub sync_write: Option::<
1177        unsafe extern "C" fn(
1178            *mut connection,
1179            *mut libc::c_char,
1180            ssize_t,
1181            libc::c_longlong,
1182        ) -> ssize_t,
1183    >,
1184    pub sync_read: Option::<
1185        unsafe extern "C" fn(
1186            *mut connection,
1187            *mut libc::c_char,
1188            ssize_t,
1189            libc::c_longlong,
1190        ) -> ssize_t,
1191    >,
1192    pub sync_readline: Option::<
1193        unsafe extern "C" fn(
1194            *mut connection,
1195            *mut libc::c_char,
1196            ssize_t,
1197            libc::c_longlong,
1198        ) -> ssize_t,
1199    >,
1200    pub get_type: Option::<unsafe extern "C" fn(*mut connection) -> libc::c_int>,
1201}
1202#[derive(Copy, Clone)]
1203#[repr(C)]
1204pub struct _rio {
1205    pub read: Option::<
1206        unsafe extern "C" fn(*mut _rio, *mut libc::c_void, size_t) -> size_t,
1207    >,
1208    pub write: Option::<
1209        unsafe extern "C" fn(*mut _rio, *const libc::c_void, size_t) -> size_t,
1210    >,
1211    pub tell: Option::<unsafe extern "C" fn(*mut _rio) -> off_t>,
1212    pub flush: Option::<unsafe extern "C" fn(*mut _rio) -> libc::c_int>,
1213    pub update_cksum: Option::<
1214        unsafe extern "C" fn(*mut _rio, *const libc::c_void, size_t) -> (),
1215    >,
1216    pub cksum: uint64_t,
1217    pub flags: uint64_t,
1218    pub processed_bytes: size_t,
1219    pub max_processing_chunk: size_t,
1220    pub io: C2RustUnnamed,
1221}
1222#[derive(Copy, Clone)]
1223#[repr(C)]
1224pub union C2RustUnnamed {
1225    pub buffer: C2RustUnnamed_3,
1226    pub file: C2RustUnnamed_2,
1227    pub conn: C2RustUnnamed_1,
1228    pub fd: C2RustUnnamed_0,
1229}
1230#[derive(Copy, Clone)]
1231#[repr(C)]
1232pub struct C2RustUnnamed_0 {
1233    pub fd: libc::c_int,
1234    pub pos: off_t,
1235    pub buf: sds,
1236}
1237#[derive(Copy, Clone)]
1238#[repr(C)]
1239pub struct C2RustUnnamed_1 {
1240    pub conn: *mut connection,
1241    pub pos: off_t,
1242    pub buf: sds,
1243    pub read_limit: size_t,
1244    pub read_so_far: size_t,
1245}
1246#[derive(Copy, Clone)]
1247#[repr(C)]
1248pub struct C2RustUnnamed_2 {
1249    pub fp: *mut FILE,
1250    pub buffered: off_t,
1251    pub autosync: off_t,
1252}
1253#[derive(Copy, Clone)]
1254#[repr(C)]
1255pub struct C2RustUnnamed_3 {
1256    pub ptr: sds,
1257    pub pos: off_t,
1258}
1259pub type rio = _rio;
1260#[derive(Copy, Clone,c2rust_bitfields::BitfieldStruct)]
1261#[repr(C)]
1262pub struct redisObject {
1263    #[bitfield(name = "type_0", ty = "libc::c_uint", bits = "0..=3")]
1264    #[bitfield(name = "encoding", ty = "libc::c_uint", bits = "4..=7")]
1265    #[bitfield(name = "lru", ty = "libc::c_uint", bits = "8..=31")]
1266    pub type_0_encoding_lru: [u8; 4],
1267    pub refcount: libc::c_int,
1268    pub ptr: *mut libc::c_void,
1269}
1270pub type C2RustUnnamed_4 = libc::c_uint;
1271pub const PTHREAD_MUTEX_FAST_NP: C2RustUnnamed_4 = 0;
1272pub const PTHREAD_MUTEX_DEFAULT: C2RustUnnamed_4 = 0;
1273pub const PTHREAD_MUTEX_ERRORCHECK: C2RustUnnamed_4 = 2;
1274pub const PTHREAD_MUTEX_RECURSIVE: C2RustUnnamed_4 = 1;
1275pub const PTHREAD_MUTEX_NORMAL: C2RustUnnamed_4 = 0;
1276pub const PTHREAD_MUTEX_ADAPTIVE_NP: C2RustUnnamed_4 = 3;
1277pub const PTHREAD_MUTEX_ERRORCHECK_NP: C2RustUnnamed_4 = 2;
1278pub const PTHREAD_MUTEX_RECURSIVE_NP: C2RustUnnamed_4 = 1;
1279pub const PTHREAD_MUTEX_TIMED_NP: C2RustUnnamed_4 = 0;
1280pub type atomic_int = libc::c_int;
1281pub type atomic_uint = libc::c_uint;
1282pub type atomic_llong = libc::c_longlong;
1283pub type sig_atomic_t = __sig_atomic_t;
1284#[derive(Copy, Clone)]
1285#[repr(C)]
1286pub struct hdr_histogram {
1287    pub lowest_discernible_value: int64_t,
1288    pub highest_trackable_value: int64_t,
1289    pub unit_magnitude: int32_t,
1290    pub significant_figures: int32_t,
1291    pub sub_bucket_half_count_magnitude: int32_t,
1292    pub sub_bucket_half_count: int32_t,
1293    pub sub_bucket_mask: int64_t,
1294    pub sub_bucket_count: int32_t,
1295    pub bucket_count: int32_t,
1296    pub min_value: int64_t,
1297    pub max_value: int64_t,
1298    pub normalizing_index_offset: int32_t,
1299    pub conversion_ratio: libc::c_double,
1300    pub counts_len: int32_t,
1301    pub total_count: int64_t,
1302    pub counts: *mut int64_t,
1303}
1304pub type mstime_t = libc::c_longlong;
1305pub type ustime_t = libc::c_longlong;
1306#[derive(Copy, Clone)]
1307#[repr(C)]
1308pub struct dictEntry {
1309    pub key: *mut libc::c_void,
1310    pub v: C2RustUnnamed_5,
1311    pub next: *mut dictEntry,
1312    pub metadata: [*mut libc::c_void; 0],
1313}
1314#[derive(Copy, Clone)]
1315#[repr(C)]
1316pub union C2RustUnnamed_5 {
1317    pub val: *mut libc::c_void,
1318    pub u64_0: uint64_t,
1319    pub s64: int64_t,
1320    pub d: libc::c_double,
1321}
1322#[derive(Copy, Clone)]
1323#[repr(C)]
1324pub struct dict {
1325    pub type_0: *mut dictType,
1326    pub ht_table: [*mut *mut dictEntry; 2],
1327    pub ht_used: [libc::c_ulong; 2],
1328    pub rehashidx: libc::c_long,
1329    pub pauserehash: int16_t,
1330    pub ht_size_exp: [libc::c_schar; 2],
1331}
1332#[derive(Copy, Clone)]
1333#[repr(C)]
1334pub struct dictType {
1335    pub hashFunction: Option::<unsafe extern "C" fn(*const libc::c_void) -> uint64_t>,
1336    pub keyDup: Option::<
1337        unsafe extern "C" fn(*mut dict, *const libc::c_void) -> *mut libc::c_void,
1338    >,
1339    pub valDup: Option::<
1340        unsafe extern "C" fn(*mut dict, *const libc::c_void) -> *mut libc::c_void,
1341    >,
1342    pub keyCompare: Option::<
1343        unsafe extern "C" fn(
1344            *mut dict,
1345            *const libc::c_void,
1346            *const libc::c_void,
1347        ) -> libc::c_int,
1348    >,
1349    pub keyDestructor: Option::<
1350        unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
1351    >,
1352    pub valDestructor: Option::<
1353        unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
1354    >,
1355    pub expandAllowed: Option::<
1356        unsafe extern "C" fn(size_t, libc::c_double) -> libc::c_int,
1357    >,
1358    pub dictEntryMetadataBytes: Option::<unsafe extern "C" fn(*mut dict) -> size_t>,
1359}
1360#[derive(Copy, Clone)]
1361#[repr(C)]
1362pub struct dictIterator {
1363    pub d: *mut dict,
1364    pub index: libc::c_long,
1365    pub table: libc::c_int,
1366    pub safe: libc::c_int,
1367    pub entry: *mut dictEntry,
1368    pub nextEntry: *mut dictEntry,
1369    pub fingerprint: libc::c_ulonglong,
1370}
1371pub type dictScanFunction = unsafe extern "C" fn(
1372    *mut libc::c_void,
1373    *const dictEntry,
1374) -> ();
1375pub type dictScanBucketFunction = unsafe extern "C" fn(
1376    *mut dict,
1377    *mut *mut dictEntry,
1378) -> ();
1379#[derive(Copy, Clone)]
1380#[repr(C)]
1381pub struct listNode {
1382    pub prev: *mut listNode,
1383    pub next: *mut listNode,
1384    pub value: *mut libc::c_void,
1385}
1386#[derive(Copy, Clone)]
1387#[repr(C)]
1388pub struct listIter {
1389    pub next: *mut listNode,
1390    pub direction: libc::c_int,
1391}
1392#[derive(Copy, Clone)]
1393#[repr(C)]
1394pub struct list {
1395    pub head: *mut listNode,
1396    pub tail: *mut listNode,
1397    pub dup: Option::<unsafe extern "C" fn(*mut libc::c_void) -> *mut libc::c_void>,
1398    pub free: Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>,
1399    pub match_0: Option::<
1400        unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> libc::c_int,
1401    >,
1402    pub len: libc::c_ulong,
1403}
1404#[derive(Copy, Clone)]
1405#[repr(C)]
1406pub struct intset {
1407    pub encoding: uint32_t,
1408    pub length: uint32_t,
1409    pub contents: [int8_t; 0],
1410}
1411pub type ld2string_mode = libc::c_uint;
1412pub const LD_STR_HEX: ld2string_mode = 2;
1413pub const LD_STR_HUMAN: ld2string_mode = 1;
1414pub const LD_STR_AUTO: ld2string_mode = 0;
1415#[derive(Copy, Clone,c2rust_bitfields::BitfieldStruct)]
1416#[repr(C)]
1417pub struct quicklistNode {
1418    pub prev: *mut quicklistNode,
1419    pub next: *mut quicklistNode,
1420    pub entry: *mut libc::c_uchar,
1421    pub sz: size_t,
1422    #[bitfield(name = "count", ty = "libc::c_uint", bits = "0..=15")]
1423    #[bitfield(name = "encoding", ty = "libc::c_uint", bits = "16..=17")]
1424    #[bitfield(name = "container", ty = "libc::c_uint", bits = "18..=19")]
1425    #[bitfield(name = "recompress", ty = "libc::c_uint", bits = "20..=20")]
1426    #[bitfield(name = "attempted_compress", ty = "libc::c_uint", bits = "21..=21")]
1427    #[bitfield(name = "dont_compress", ty = "libc::c_uint", bits = "22..=22")]
1428    #[bitfield(name = "extra", ty = "libc::c_uint", bits = "23..=31")]
1429    pub count_encoding_container_recompress_attempted_compress_dont_compress_extra: [u8; 4],
1430    #[bitfield(padding)]
1431    pub c2rust_padding: [u8; 4],
1432}
1433#[derive(Copy, Clone)]
1434#[repr(C)]
1435pub struct quicklistBookmark {
1436    pub node: *mut quicklistNode,
1437    pub name: *mut libc::c_char,
1438}
1439#[derive(Copy, Clone,c2rust_bitfields::BitfieldStruct)]
1440#[repr(C)]
1441pub struct quicklist {
1442    pub head: *mut quicklistNode,
1443    pub tail: *mut quicklistNode,
1444    pub count: libc::c_ulong,
1445    pub len: libc::c_ulong,
1446    #[bitfield(name = "fill", ty = "libc::c_int", bits = "0..=15")]
1447    #[bitfield(name = "compress", ty = "libc::c_uint", bits = "16..=31")]
1448    #[bitfield(name = "bookmark_count", ty = "libc::c_uint", bits = "32..=35")]
1449    pub fill_compress_bookmark_count: [u8; 5],
1450    #[bitfield(padding)]
1451    pub c2rust_padding: [u8; 3],
1452    pub bookmarks: [quicklistBookmark; 0],
1453}
1454#[derive(Copy, Clone)]
1455#[repr(C)]
1456pub struct quicklistIter {
1457    pub quicklist: *mut quicklist,
1458    pub current: *mut quicklistNode,
1459    pub zi: *mut libc::c_uchar,
1460    pub offset: libc::c_long,
1461    pub direction: libc::c_int,
1462}
1463#[derive(Copy, Clone)]
1464#[repr(C)]
1465pub struct quicklistEntry {
1466    pub quicklist: *const quicklist,
1467    pub node: *mut quicklistNode,
1468    pub zi: *mut libc::c_uchar,
1469    pub value: *mut libc::c_uchar,
1470    pub longval: libc::c_longlong,
1471    pub sz: size_t,
1472    pub offset: libc::c_int,
1473}
1474#[derive(Copy, Clone,c2rust_bitfields::BitfieldStruct)]
1475#[repr(C)]
1476pub struct raxNode {
1477    #[bitfield(name = "iskey", ty = "uint32_t", bits = "0..=0")]
1478    #[bitfield(name = "isnull", ty = "uint32_t", bits = "1..=1")]
1479    #[bitfield(name = "iscompr", ty = "uint32_t", bits = "2..=2")]
1480    #[bitfield(name = "size", ty = "uint32_t", bits = "3..=31")]
1481    pub iskey_isnull_iscompr_size: [u8; 4],
1482    pub data: [libc::c_uchar; 0],
1483}
1484#[derive(Copy, Clone)]
1485#[repr(C)]
1486pub struct rax {
1487    pub head: *mut raxNode,
1488    pub numele: uint64_t,
1489    pub numnodes: uint64_t,
1490}
1491#[derive(Copy, Clone)]
1492#[repr(C)]
1493pub struct raxStack {
1494    pub stack: *mut *mut libc::c_void,
1495    pub items: size_t,
1496    pub maxitems: size_t,
1497    pub static_items: [*mut libc::c_void; 32],
1498    pub oom: libc::c_int,
1499}
1500pub type raxNodeCallback = Option::<
1501    unsafe extern "C" fn(*mut *mut raxNode) -> libc::c_int,
1502>;
1503#[derive(Copy, Clone)]
1504#[repr(C)]
1505pub struct raxIterator {
1506    pub flags: libc::c_int,
1507    pub rt: *mut rax,
1508    pub key: *mut libc::c_uchar,
1509    pub data: *mut libc::c_void,
1510    pub key_len: size_t,
1511    pub key_max: size_t,
1512    pub key_static_string: [libc::c_uchar; 128],
1513    pub node: *mut raxNode,
1514    pub stack: raxStack,
1515    pub node_cb: raxNodeCallback,
1516}
1517#[derive(Copy, Clone)]
1518#[repr(C)]
1519pub struct RedisModuleStreamID {
1520    pub ms: uint64_t,
1521    pub seq: uint64_t,
1522}
1523pub type RedisModuleTimerID = uint64_t;
1524pub type RedisModuleCommandArgType = libc::c_uint;
1525pub const REDISMODULE_ARG_TYPE_BLOCK: RedisModuleCommandArgType = 8;
1526pub const REDISMODULE_ARG_TYPE_ONEOF: RedisModuleCommandArgType = 7;
1527pub const REDISMODULE_ARG_TYPE_PURE_TOKEN: RedisModuleCommandArgType = 6;
1528pub const REDISMODULE_ARG_TYPE_UNIX_TIME: RedisModuleCommandArgType = 5;
1529pub const REDISMODULE_ARG_TYPE_PATTERN: RedisModuleCommandArgType = 4;
1530pub const REDISMODULE_ARG_TYPE_KEY: RedisModuleCommandArgType = 3;
1531pub const REDISMODULE_ARG_TYPE_DOUBLE: RedisModuleCommandArgType = 2;
1532pub const REDISMODULE_ARG_TYPE_INTEGER: RedisModuleCommandArgType = 1;
1533pub const REDISMODULE_ARG_TYPE_STRING: RedisModuleCommandArgType = 0;
1534pub type RedisModuleKeySpecBeginSearchType = libc::c_uint;
1535pub const REDISMODULE_KSPEC_BS_KEYWORD: RedisModuleKeySpecBeginSearchType = 3;
1536pub const REDISMODULE_KSPEC_BS_INDEX: RedisModuleKeySpecBeginSearchType = 2;
1537pub const REDISMODULE_KSPEC_BS_UNKNOWN: RedisModuleKeySpecBeginSearchType = 1;
1538pub const REDISMODULE_KSPEC_BS_INVALID: RedisModuleKeySpecBeginSearchType = 0;
1539pub type RedisModuleKeySpecFindKeysType = libc::c_uint;
1540pub const REDISMODULE_KSPEC_FK_KEYNUM: RedisModuleKeySpecFindKeysType = 3;
1541pub const REDISMODULE_KSPEC_FK_RANGE: RedisModuleKeySpecFindKeysType = 2;
1542pub const REDISMODULE_KSPEC_FK_UNKNOWN: RedisModuleKeySpecFindKeysType = 1;
1543pub const REDISMODULE_KSPEC_FK_OMITTED: RedisModuleKeySpecFindKeysType = 0;
1544#[derive(Copy, Clone)]
1545#[repr(C)]
1546pub struct RedisModuleCommandArg {
1547    pub name: *const libc::c_char,
1548    pub type_0: RedisModuleCommandArgType,
1549    pub key_spec_index: libc::c_int,
1550    pub token: *const libc::c_char,
1551    pub summary: *const libc::c_char,
1552    pub since: *const libc::c_char,
1553    pub flags: libc::c_int,
1554    pub deprecated_since: *const libc::c_char,
1555    pub subargs: *mut RedisModuleCommandArg,
1556}
1557#[derive(Copy, Clone)]
1558#[repr(C)]
1559pub struct RedisModuleCommandHistoryEntry {
1560    pub since: *const libc::c_char,
1561    pub changes: *const libc::c_char,
1562}
1563#[derive(Copy, Clone)]
1564#[repr(C)]
1565pub struct RedisModuleCommandKeySpec {
1566    pub notes: *const libc::c_char,
1567    pub flags: uint64_t,
1568    pub begin_search_type: RedisModuleKeySpecBeginSearchType,
1569    pub bs: C2RustUnnamed_9,
1570    pub find_keys_type: RedisModuleKeySpecFindKeysType,
1571    pub fk: C2RustUnnamed_6,
1572}
1573#[derive(Copy, Clone)]
1574#[repr(C)]
1575pub union C2RustUnnamed_6 {
1576    pub range: C2RustUnnamed_8,
1577    pub keynum: C2RustUnnamed_7,
1578}
1579#[derive(Copy, Clone)]
1580#[repr(C)]
1581pub struct C2RustUnnamed_7 {
1582    pub keynumidx: libc::c_int,
1583    pub firstkey: libc::c_int,
1584    pub keystep: libc::c_int,
1585}
1586#[derive(Copy, Clone)]
1587#[repr(C)]
1588pub struct C2RustUnnamed_8 {
1589    pub lastkey: libc::c_int,
1590    pub keystep: libc::c_int,
1591    pub limit: libc::c_int,
1592}
1593#[derive(Copy, Clone)]
1594#[repr(C)]
1595pub union C2RustUnnamed_9 {
1596    pub index: C2RustUnnamed_11,
1597    pub keyword: C2RustUnnamed_10,
1598}
1599#[derive(Copy, Clone)]
1600#[repr(C)]
1601pub struct C2RustUnnamed_10 {
1602    pub keyword: *const libc::c_char,
1603    pub startfrom: libc::c_int,
1604}
1605#[derive(Copy, Clone)]
1606#[repr(C)]
1607pub struct C2RustUnnamed_11 {
1608    pub pos: libc::c_int,
1609}
1610#[derive(Copy, Clone)]
1611#[repr(C)]
1612pub struct RedisModuleCommandInfoVersion {
1613    pub version: libc::c_int,
1614    pub sizeof_historyentry: size_t,
1615    pub sizeof_keyspec: size_t,
1616    pub sizeof_arg: size_t,
1617}
1618#[derive(Copy, Clone)]
1619#[repr(C)]
1620pub struct RedisModuleCommandInfo {
1621    pub version: *const RedisModuleCommandInfoVersion,
1622    pub summary: *const libc::c_char,
1623    pub complexity: *const libc::c_char,
1624    pub since: *const libc::c_char,
1625    pub history: *mut RedisModuleCommandHistoryEntry,
1626    pub tips: *const libc::c_char,
1627    pub arity: libc::c_int,
1628    pub key_specs: *mut RedisModuleCommandKeySpec,
1629    pub args: *mut RedisModuleCommandArg,
1630}
1631pub type RedisModuleEventLoopFunc = Option::<
1632    unsafe extern "C" fn(libc::c_int, *mut libc::c_void, libc::c_int) -> (),
1633>;
1634pub type RedisModuleEventLoopOneShotFunc = Option::<
1635    unsafe extern "C" fn(*mut libc::c_void) -> (),
1636>;
1637#[derive(Copy, Clone)]
1638#[repr(C)]
1639pub struct RedisModuleEvent {
1640    pub id: uint64_t,
1641    pub dataver: uint64_t,
1642}
1643#[derive(Copy, Clone)]
1644#[repr(C)]
1645pub struct RedisModuleCtx {
1646    pub getapifuncptr: *mut libc::c_void,
1647    pub module: *mut RedisModule,
1648    pub client: *mut client,
1649    pub blocked_client: *mut RedisModuleBlockedClient,
1650    pub amqueue: *mut AutoMemEntry,
1651    pub amqueue_len: libc::c_int,
1652    pub amqueue_used: libc::c_int,
1653    pub flags: libc::c_int,
1654    pub postponed_arrays: *mut *mut libc::c_void,
1655    pub postponed_arrays_count: libc::c_int,
1656    pub blocked_privdata: *mut libc::c_void,
1657    pub blocked_ready_key: *mut robj,
1658    pub keys_result: *mut getKeysResult,
1659    pub pa_head: *mut RedisModulePoolAllocBlock,
1660    pub next_yield_time: libc::c_longlong,
1661    pub user: *const RedisModuleUser,
1662}
1663#[derive(Copy, Clone)]
1664#[repr(C)]
1665pub struct RedisModuleUser {
1666    pub user: *mut user,
1667    pub free_user: libc::c_int,
1668}
1669#[derive(Copy, Clone)]
1670#[repr(C)]
1671pub struct user {
1672    pub name: sds,
1673    pub flags: uint32_t,
1674    pub passwords: *mut list,
1675    pub selectors: *mut list,
1676    pub acl_string: *mut robj,
1677}
1678pub type robj = redisObject;
1679#[derive(Copy, Clone)]
1680#[repr(C)]
1681pub struct RedisModulePoolAllocBlock {
1682    pub size: uint32_t,
1683    pub used: uint32_t,
1684    pub next: *mut RedisModulePoolAllocBlock,
1685    pub memory: [libc::c_char; 0],
1686}
1687#[derive(Copy, Clone)]
1688#[repr(C)]
1689pub struct getKeysResult {
1690    pub keysbuf: [keyReference; 256],
1691    pub keys: *mut keyReference,
1692    pub numkeys: libc::c_int,
1693    pub size: libc::c_int,
1694}
1695#[derive(Copy, Clone)]
1696#[repr(C)]
1697pub struct keyReference {
1698    pub pos: libc::c_int,
1699    pub flags: libc::c_int,
1700}
1701#[derive(Copy, Clone)]
1702#[repr(C)]
1703pub struct AutoMemEntry {
1704    pub ptr: *mut libc::c_void,
1705    pub type_0: libc::c_int,
1706}
1707#[derive(Copy, Clone)]
1708#[repr(C)]
1709pub struct RedisModuleBlockedClient {
1710    pub client: *mut client,
1711    pub module: *mut RedisModule,
1712    pub reply_callback: RedisModuleCmdFunc,
1713    pub timeout_callback: RedisModuleCmdFunc,
1714    pub disconnect_callback: RedisModuleDisconnectFunc,
1715    pub free_privdata: Option::<
1716        unsafe extern "C" fn(*mut RedisModuleCtx, *mut libc::c_void) -> (),
1717    >,
1718    pub privdata: *mut libc::c_void,
1719    pub thread_safe_ctx_client: *mut client,
1720    pub reply_client: *mut client,
1721    pub dbid: libc::c_int,
1722    pub blocked_on_keys: libc::c_int,
1723    pub unblocked: libc::c_int,
1724    pub background_timer: monotime,
1725    pub background_duration: uint64_t,
1726}
1727#[derive(Copy, Clone)]
1728#[repr(C)]
1729pub struct client {
1730    pub id: uint64_t,
1731    pub flags: uint64_t,
1732    pub conn: *mut connection,
1733    pub resp: libc::c_int,
1734    pub db: *mut redisDb,
1735    pub name: *mut robj,
1736    pub querybuf: sds,
1737    pub qb_pos: size_t,
1738    pub querybuf_peak: size_t,
1739    pub argc: libc::c_int,
1740    pub argv: *mut *mut robj,
1741    pub argv_len: libc::c_int,
1742    pub original_argc: libc::c_int,
1743    pub original_argv: *mut *mut robj,
1744    pub argv_len_sum: size_t,
1745    pub cmd: *mut redisCommand,
1746    pub lastcmd: *mut redisCommand,
1747    pub realcmd: *mut redisCommand,
1748    pub user: *mut user,
1749    pub reqtype: libc::c_int,
1750    pub multibulklen: libc::c_int,
1751    pub bulklen: libc::c_long,
1752    pub reply: *mut list,
1753    pub reply_bytes: libc::c_ulonglong,
1754    pub deferred_reply_errors: *mut list,
1755    pub sentlen: size_t,
1756    pub ctime: time_t,
1757    pub duration: libc::c_long,
1758    pub slot: libc::c_int,
1759    pub cur_script: *mut dictEntry,
1760    pub lastinteraction: time_t,
1761    pub obuf_soft_limit_reached_time: time_t,
1762    pub authenticated: libc::c_int,
1763    pub replstate: libc::c_int,
1764    pub repl_start_cmd_stream_on_ack: libc::c_int,
1765    pub repldbfd: libc::c_int,
1766    pub repldboff: off_t,
1767    pub repldbsize: off_t,
1768    pub replpreamble: sds,
1769    pub read_reploff: libc::c_longlong,
1770    pub reploff: libc::c_longlong,
1771    pub repl_applied: libc::c_longlong,
1772    pub repl_ack_off: libc::c_longlong,
1773    pub repl_ack_time: libc::c_longlong,
1774    pub repl_last_partial_write: libc::c_longlong,
1775    pub psync_initial_offset: libc::c_longlong,
1776    pub replid: [libc::c_char; 41],
1777    pub slave_listening_port: libc::c_int,
1778    pub slave_addr: *mut libc::c_char,
1779    pub slave_capa: libc::c_int,
1780    pub slave_req: libc::c_int,
1781    pub mstate: multiState,
1782    pub btype: libc::c_int,
1783    pub bpop: blockingState,
1784    pub woff: libc::c_longlong,
1785    pub watched_keys: *mut list,
1786    pub pubsub_channels: *mut dict,
1787    pub pubsub_patterns: *mut list,
1788    pub pubsubshard_channels: *mut dict,
1789    pub peerid: sds,
1790    pub sockname: sds,
1791    pub client_list_node: *mut listNode,
1792    pub postponed_list_node: *mut listNode,
1793    pub pending_read_list_node: *mut listNode,
1794    pub auth_callback: RedisModuleUserChangedFunc,
1795    pub auth_callback_privdata: *mut libc::c_void,
1796    pub auth_module: *mut libc::c_void,
1797    pub client_tracking_redirection: uint64_t,
1798    pub client_tracking_prefixes: *mut rax,
1799    pub last_memory_usage: size_t,
1800    pub last_memory_type: libc::c_int,
1801    pub mem_usage_bucket_node: *mut listNode,
1802    pub mem_usage_bucket: *mut clientMemUsageBucket,
1803    pub ref_repl_buf_node: *mut listNode,
1804    pub ref_block_pos: size_t,
1805    pub buf_peak: size_t,
1806    pub buf_peak_last_reset_time: mstime_t,
1807    pub bufpos: libc::c_int,
1808    pub buf_usable_size: size_t,
1809    pub buf: *mut libc::c_char,
1810}
1811#[derive(Copy, Clone)]
1812#[repr(C)]
1813pub struct clientMemUsageBucket {
1814    pub clients: *mut list,
1815    pub mem_usage_sum: size_t,
1816}
1817pub type RedisModuleUserChangedFunc = Option::<
1818    unsafe extern "C" fn(uint64_t, *mut libc::c_void) -> (),
1819>;
1820#[derive(Copy, Clone)]
1821#[repr(C)]
1822pub struct blockingState {
1823    pub count: libc::c_long,
1824    pub timeout: mstime_t,
1825    pub keys: *mut dict,
1826    pub target: *mut robj,
1827    pub blockpos: blockPos,
1828    pub xread_count: size_t,
1829    pub xread_group: *mut robj,
1830    pub xread_consumer: *mut robj,
1831    pub xread_group_noack: libc::c_int,
1832    pub numreplicas: libc::c_int,
1833    pub reploffset: libc::c_longlong,
1834    pub module_blocked_handle: *mut libc::c_void,
1835}
1836#[derive(Copy, Clone)]
1837#[repr(C)]
1838pub struct blockPos {
1839    pub wherefrom: libc::c_int,
1840    pub whereto: libc::c_int,
1841}
1842#[derive(Copy, Clone)]
1843#[repr(C)]
1844pub struct multiState {
1845    pub commands: *mut multiCmd,
1846    pub count: libc::c_int,
1847    pub cmd_flags: libc::c_int,
1848    pub cmd_inv_flags: libc::c_int,
1849    pub argv_len_sums: size_t,
1850    pub alloc_count: libc::c_int,
1851}
1852#[derive(Copy, Clone)]
1853#[repr(C)]
1854pub struct multiCmd {
1855    pub argv: *mut *mut robj,
1856    pub argv_len: libc::c_int,
1857    pub argc: libc::c_int,
1858    pub cmd: *mut redisCommand,
1859}
1860#[derive(Copy, Clone)]
1861#[repr(C)]
1862pub struct redisCommand {
1863    pub declared_name: *const libc::c_char,
1864    pub summary: *const libc::c_char,
1865    pub complexity: *const libc::c_char,
1866    pub since: *const libc::c_char,
1867    pub doc_flags: libc::c_int,
1868    pub replaced_by: *const libc::c_char,
1869    pub deprecated_since: *const libc::c_char,
1870    pub group: redisCommandGroup,
1871    pub history: *mut commandHistory,
1872    pub tips: *mut *const libc::c_char,
1873    pub proc_0: Option::<redisCommandProc>,
1874    pub arity: libc::c_int,
1875    pub flags: uint64_t,
1876    pub acl_categories: uint64_t,
1877    pub key_specs_static: [keySpec; 4],
1878    pub getkeys_proc: Option::<redisGetKeysProc>,
1879    pub subcommands: *mut redisCommand,
1880    pub args: *mut redisCommandArg,
1881    pub microseconds: libc::c_longlong,
1882    pub calls: libc::c_longlong,
1883    pub rejected_calls: libc::c_longlong,
1884    pub failed_calls: libc::c_longlong,
1885    pub id: libc::c_int,
1886    pub fullname: sds,
1887    pub latency_histogram: *mut hdr_histogram,
1888    pub key_specs: *mut keySpec,
1889    pub legacy_range_key_spec: keySpec,
1890    pub num_args: libc::c_int,
1891    pub num_history: libc::c_int,
1892    pub num_tips: libc::c_int,
1893    pub key_specs_num: libc::c_int,
1894    pub key_specs_max: libc::c_int,
1895    pub subcommands_dict: *mut dict,
1896    pub parent: *mut redisCommand,
1897    pub module_cmd: *mut RedisModuleCommand,
1898}
1899#[derive(Copy, Clone)]
1900#[repr(C)]
1901pub struct RedisModuleCommand {
1902    pub module: *mut RedisModule,
1903    pub func: RedisModuleCmdFunc,
1904    pub rediscmd: *mut redisCommand,
1905}
1906pub type RedisModuleCmdFunc = Option::<
1907    unsafe extern "C" fn(
1908        *mut RedisModuleCtx,
1909        *mut *mut libc::c_void,
1910        libc::c_int,
1911    ) -> libc::c_int,
1912>;
1913#[derive(Copy, Clone)]
1914#[repr(C)]
1915pub struct RedisModule {
1916    pub handle: *mut libc::c_void,
1917    pub name: *mut libc::c_char,
1918    pub ver: libc::c_int,
1919    pub apiver: libc::c_int,
1920    pub types: *mut list,
1921    pub usedby: *mut list,
1922    pub using: *mut list,
1923    pub filters: *mut list,
1924    pub module_configs: *mut list,
1925    pub configs_initialized: libc::c_int,
1926    pub in_call: libc::c_int,
1927    pub in_hook: libc::c_int,
1928    pub options: libc::c_int,
1929    pub blocked_clients: libc::c_int,
1930    pub info_cb: RedisModuleInfoFunc,
1931    pub defrag_cb: RedisModuleDefragFunc,
1932    pub loadmod: *mut moduleLoadQueueEntry,
1933}
1934#[derive(Copy, Clone)]
1935#[repr(C)]
1936pub struct moduleLoadQueueEntry {
1937    pub path: sds,
1938    pub argc: libc::c_int,
1939    pub argv: *mut *mut robj,
1940}
1941pub type RedisModuleDefragFunc = Option::<
1942    unsafe extern "C" fn(*mut RedisModuleDefragCtx) -> (),
1943>;
1944#[derive(Copy, Clone)]
1945#[repr(C)]
1946pub struct RedisModuleDefragCtx {
1947    pub defragged: libc::c_long,
1948    pub endtime: libc::c_longlong,
1949    pub cursor: *mut libc::c_ulong,
1950    pub key: *mut redisObject,
1951    pub dbid: libc::c_int,
1952}
1953pub type RedisModuleInfoFunc = Option::<
1954    unsafe extern "C" fn(*mut RedisModuleInfoCtx, libc::c_int) -> (),
1955>;
1956#[derive(Copy, Clone)]
1957#[repr(C)]
1958pub struct RedisModuleInfoCtx {
1959    pub module: *mut RedisModule,
1960    pub requested_sections: *mut dict,
1961    pub info: sds,
1962    pub sections: libc::c_int,
1963    pub in_section: libc::c_int,
1964    pub in_dict_field: libc::c_int,
1965}
1966#[derive(Copy, Clone)]
1967#[repr(C)]
1968pub struct keySpec {
1969    pub notes: *const libc::c_char,
1970    pub flags: uint64_t,
1971    pub begin_search_type: kspec_bs_type,
1972    pub bs: C2RustUnnamed_15,
1973    pub find_keys_type: kspec_fk_type,
1974    pub fk: C2RustUnnamed_12,
1975}
1976#[derive(Copy, Clone)]
1977#[repr(C)]
1978pub union C2RustUnnamed_12 {
1979    pub range: C2RustUnnamed_14,
1980    pub keynum: C2RustUnnamed_13,
1981}
1982#[derive(Copy, Clone)]
1983#[repr(C)]
1984pub struct C2RustUnnamed_13 {
1985    pub keynumidx: libc::c_int,
1986    pub firstkey: libc::c_int,
1987    pub keystep: libc::c_int,
1988}
1989#[derive(Copy, Clone)]
1990#[repr(C)]
1991pub struct C2RustUnnamed_14 {
1992    pub lastkey: libc::c_int,
1993    pub keystep: libc::c_int,
1994    pub limit: libc::c_int,
1995}
1996pub type kspec_fk_type = libc::c_uint;
1997pub const KSPEC_FK_KEYNUM: kspec_fk_type = 3;
1998pub const KSPEC_FK_RANGE: kspec_fk_type = 2;
1999pub const KSPEC_FK_UNKNOWN: kspec_fk_type = 1;
2000pub const KSPEC_FK_INVALID: kspec_fk_type = 0;
2001#[derive(Copy, Clone)]
2002#[repr(C)]
2003pub union C2RustUnnamed_15 {
2004    pub index: C2RustUnnamed_17,
2005    pub keyword: C2RustUnnamed_16,
2006}
2007#[derive(Copy, Clone)]
2008#[repr(C)]
2009pub struct C2RustUnnamed_16 {
2010    pub keyword: *const libc::c_char,
2011    pub startfrom: libc::c_int,
2012}
2013#[derive(Copy, Clone)]
2014#[repr(C)]
2015pub struct C2RustUnnamed_17 {
2016    pub pos: libc::c_int,
2017}
2018pub type kspec_bs_type = libc::c_uint;
2019pub const KSPEC_BS_KEYWORD: kspec_bs_type = 3;
2020pub const KSPEC_BS_INDEX: kspec_bs_type = 2;
2021pub const KSPEC_BS_UNKNOWN: kspec_bs_type = 1;
2022pub const KSPEC_BS_INVALID: kspec_bs_type = 0;
2023#[derive(Copy, Clone)]
2024#[repr(C)]
2025pub struct redisCommandArg {
2026    pub name: *const libc::c_char,
2027    pub type_0: redisCommandArgType,
2028    pub key_spec_index: libc::c_int,
2029    pub token: *const libc::c_char,
2030    pub summary: *const libc::c_char,
2031    pub since: *const libc::c_char,
2032    pub flags: libc::c_int,
2033    pub deprecated_since: *const libc::c_char,
2034    pub subargs: *mut redisCommandArg,
2035    pub num_args: libc::c_int,
2036}
2037pub type redisCommandArgType = libc::c_uint;
2038pub const ARG_TYPE_BLOCK: redisCommandArgType = 8;
2039pub const ARG_TYPE_ONEOF: redisCommandArgType = 7;
2040pub const ARG_TYPE_PURE_TOKEN: redisCommandArgType = 6;
2041pub const ARG_TYPE_UNIX_TIME: redisCommandArgType = 5;
2042pub const ARG_TYPE_PATTERN: redisCommandArgType = 4;
2043pub const ARG_TYPE_KEY: redisCommandArgType = 3;
2044pub const ARG_TYPE_DOUBLE: redisCommandArgType = 2;
2045pub const ARG_TYPE_INTEGER: redisCommandArgType = 1;
2046pub const ARG_TYPE_STRING: redisCommandArgType = 0;
2047pub type redisGetKeysProc = unsafe extern "C" fn(
2048    *mut redisCommand,
2049    *mut *mut robj,
2050    libc::c_int,
2051    *mut getKeysResult,
2052) -> libc::c_int;
2053pub type redisCommandProc = unsafe extern "C" fn(*mut client) -> ();
2054#[derive(Copy, Clone)]
2055#[repr(C)]
2056pub struct commandHistory {
2057    pub since: *const libc::c_char,
2058    pub changes: *const libc::c_char,
2059}
2060pub type redisCommandGroup = libc::c_uint;
2061pub const COMMAND_GROUP_MODULE: redisCommandGroup = 17;
2062pub const COMMAND_GROUP_BITMAP: redisCommandGroup = 16;
2063pub const COMMAND_GROUP_STREAM: redisCommandGroup = 15;
2064pub const COMMAND_GROUP_GEO: redisCommandGroup = 14;
2065pub const COMMAND_GROUP_SENTINEL: redisCommandGroup = 13;
2066pub const COMMAND_GROUP_CLUSTER: redisCommandGroup = 12;
2067pub const COMMAND_GROUP_HYPERLOGLOG: redisCommandGroup = 11;
2068pub const COMMAND_GROUP_SCRIPTING: redisCommandGroup = 10;
2069pub const COMMAND_GROUP_SERVER: redisCommandGroup = 9;
2070pub const COMMAND_GROUP_CONNECTION: redisCommandGroup = 8;
2071pub const COMMAND_GROUP_TRANSACTIONS: redisCommandGroup = 7;
2072pub const COMMAND_GROUP_PUBSUB: redisCommandGroup = 6;
2073pub const COMMAND_GROUP_HASH: redisCommandGroup = 5;
2074pub const COMMAND_GROUP_SORTED_SET: redisCommandGroup = 4;
2075pub const COMMAND_GROUP_SET: redisCommandGroup = 3;
2076pub const COMMAND_GROUP_LIST: redisCommandGroup = 2;
2077pub const COMMAND_GROUP_STRING: redisCommandGroup = 1;
2078pub const COMMAND_GROUP_GENERIC: redisCommandGroup = 0;
2079#[derive(Copy, Clone)]
2080#[repr(C)]
2081pub struct redisDb {
2082    pub dict: *mut dict,
2083    pub expires: *mut dict,
2084    pub blocking_keys: *mut dict,
2085    pub ready_keys: *mut dict,
2086    pub watched_keys: *mut dict,
2087    pub id: libc::c_int,
2088    pub avg_ttl: libc::c_longlong,
2089    pub expires_cursor: libc::c_ulong,
2090    pub defrag_later: *mut list,
2091    pub slots_to_keys: *mut clusterSlotToKeyMapping,
2092}
2093#[derive(Copy, Clone)]
2094#[repr(C)]
2095pub struct clusterSlotToKeyMapping {
2096    pub by_slot: [slotToKeys; 16384],
2097}
2098#[derive(Copy, Clone)]
2099#[repr(C)]
2100pub struct slotToKeys {
2101    pub count: uint64_t,
2102    pub head: *mut dictEntry,
2103}
2104pub type RedisModuleDisconnectFunc = Option::<
2105    unsafe extern "C" fn(*mut RedisModuleCtx, *mut RedisModuleBlockedClient) -> (),
2106>;
2107pub type RedisModuleEventCallback = Option::<
2108    unsafe extern "C" fn(
2109        *mut RedisModuleCtx,
2110        RedisModuleEvent,
2111        uint64_t,
2112        *mut libc::c_void,
2113    ) -> (),
2114>;
2115#[derive(Copy, Clone)]
2116#[repr(C)]
2117pub struct RedisModuleClientInfo {
2118    pub version: uint64_t,
2119    pub flags: uint64_t,
2120    pub id: uint64_t,
2121    pub addr: [libc::c_char; 46],
2122    pub port: uint16_t,
2123    pub db: uint16_t,
2124}
2125pub type RedisModuleClientInfoV1 = RedisModuleClientInfo;
2126#[derive(Copy, Clone)]
2127#[repr(C)]
2128pub struct RedisModuleReplicationInfo {
2129    pub version: uint64_t,
2130    pub master: libc::c_int,
2131    pub masterhost: *mut libc::c_char,
2132    pub masterport: libc::c_int,
2133    pub replid1: *mut libc::c_char,
2134    pub replid2: *mut libc::c_char,
2135    pub repl1_offset: uint64_t,
2136    pub repl2_offset: uint64_t,
2137}
2138pub type RedisModuleReplicationInfoV1 = RedisModuleReplicationInfo;
2139#[derive(Copy, Clone)]
2140#[repr(C)]
2141pub struct RedisModuleFlushInfo {
2142    pub version: uint64_t,
2143    pub sync: int32_t,
2144    pub dbnum: int32_t,
2145}
2146pub type RedisModuleFlushInfoV1 = RedisModuleFlushInfo;
2147#[derive(Copy, Clone)]
2148#[repr(C)]
2149pub struct RedisModuleModuleChange {
2150    pub version: uint64_t,
2151    pub module_name: *const libc::c_char,
2152    pub module_version: int32_t,
2153}
2154pub type RedisModuleModuleChangeV1 = RedisModuleModuleChange;
2155#[derive(Copy, Clone)]
2156#[repr(C)]
2157pub struct RedisModuleLoadingProgressInfo {
2158    pub version: uint64_t,
2159    pub hz: int32_t,
2160    pub progress: int32_t,
2161}
2162pub type RedisModuleLoadingProgressV1 = RedisModuleLoadingProgressInfo;
2163pub type RedisModuleACLLogEntryReason = libc::c_uint;
2164pub const REDISMODULE_ACL_LOG_CHANNEL: RedisModuleACLLogEntryReason = 3;
2165pub const REDISMODULE_ACL_LOG_KEY: RedisModuleACLLogEntryReason = 2;
2166pub const REDISMODULE_ACL_LOG_CMD: RedisModuleACLLogEntryReason = 1;
2167pub const REDISMODULE_ACL_LOG_AUTH: RedisModuleACLLogEntryReason = 0;
2168pub type C2RustUnnamed_18 = libc::c_uint;
2169pub const REPL_STATE_CONNECTED: C2RustUnnamed_18 = 12;
2170pub const REPL_STATE_TRANSFER: C2RustUnnamed_18 = 11;
2171pub const REPL_STATE_RECEIVE_PSYNC_REPLY: C2RustUnnamed_18 = 10;
2172pub const REPL_STATE_SEND_PSYNC: C2RustUnnamed_18 = 9;
2173pub const REPL_STATE_RECEIVE_CAPA_REPLY: C2RustUnnamed_18 = 8;
2174pub const REPL_STATE_RECEIVE_IP_REPLY: C2RustUnnamed_18 = 7;
2175pub const REPL_STATE_RECEIVE_PORT_REPLY: C2RustUnnamed_18 = 6;
2176pub const REPL_STATE_RECEIVE_AUTH_REPLY: C2RustUnnamed_18 = 5;
2177pub const REPL_STATE_SEND_HANDSHAKE: C2RustUnnamed_18 = 4;
2178pub const REPL_STATE_RECEIVE_PING_REPLY: C2RustUnnamed_18 = 3;
2179pub const REPL_STATE_CONNECTING: C2RustUnnamed_18 = 2;
2180pub const REPL_STATE_CONNECT: C2RustUnnamed_18 = 1;
2181pub const REPL_STATE_NONE: C2RustUnnamed_18 = 0;
2182pub type pause_type = libc::c_uint;
2183pub const CLIENT_PAUSE_ALL: pause_type = 2;
2184pub const CLIENT_PAUSE_WRITE: pause_type = 1;
2185pub const CLIENT_PAUSE_OFF: pause_type = 0;
2186#[derive(Copy, Clone)]
2187#[repr(C)]
2188pub struct pause_event {
2189    pub type_0: pause_type,
2190    pub end: mstime_t,
2191}
2192#[derive(Copy, Clone)]
2193#[repr(C)]
2194pub struct RedisModuleIO {
2195    pub bytes: size_t,
2196    pub rio: *mut rio,
2197    pub type_0: *mut moduleType,
2198    pub error: libc::c_int,
2199    pub ver: libc::c_int,
2200    pub ctx: *mut RedisModuleCtx,
2201    pub key: *mut redisObject,
2202    pub dbid: libc::c_int,
2203}
2204pub type moduleType = RedisModuleType;
2205#[derive(Copy, Clone)]
2206#[repr(C)]
2207pub struct RedisModuleType {
2208    pub id: uint64_t,
2209    pub module: *mut RedisModule,
2210    pub rdb_load: moduleTypeLoadFunc,
2211    pub rdb_save: moduleTypeSaveFunc,
2212    pub aof_rewrite: moduleTypeRewriteFunc,
2213    pub mem_usage: moduleTypeMemUsageFunc,
2214    pub digest: moduleTypeDigestFunc,
2215    pub free: moduleTypeFreeFunc,
2216    pub free_effort: moduleTypeFreeEffortFunc,
2217    pub unlink: moduleTypeUnlinkFunc,
2218    pub copy: moduleTypeCopyFunc,
2219    pub defrag: moduleTypeDefragFunc,
2220    pub aux_load: moduleTypeAuxLoadFunc,
2221    pub aux_save: moduleTypeAuxSaveFunc,
2222    pub mem_usage2: moduleTypeMemUsageFunc2,
2223    pub free_effort2: moduleTypeFreeEffortFunc2,
2224    pub unlink2: moduleTypeUnlinkFunc2,
2225    pub copy2: moduleTypeCopyFunc2,
2226    pub aux_save_triggers: libc::c_int,
2227    pub name: [libc::c_char; 10],
2228}
2229pub type moduleTypeCopyFunc2 = Option::<
2230    unsafe extern "C" fn(
2231        *mut RedisModuleKeyOptCtx,
2232        *const libc::c_void,
2233    ) -> *mut libc::c_void,
2234>;
2235#[derive(Copy, Clone)]
2236#[repr(C)]
2237pub struct RedisModuleKeyOptCtx {
2238    pub from_key: *mut redisObject,
2239    pub to_key: *mut redisObject,
2240    pub from_dbid: libc::c_int,
2241    pub to_dbid: libc::c_int,
2242}
2243pub type moduleTypeUnlinkFunc2 = Option::<
2244    unsafe extern "C" fn(*mut RedisModuleKeyOptCtx, *mut libc::c_void) -> (),
2245>;
2246pub type moduleTypeFreeEffortFunc2 = Option::<
2247    unsafe extern "C" fn(*mut RedisModuleKeyOptCtx, *const libc::c_void) -> size_t,
2248>;
2249pub type moduleTypeMemUsageFunc2 = Option::<
2250    unsafe extern "C" fn(
2251        *mut RedisModuleKeyOptCtx,
2252        *const libc::c_void,
2253        size_t,
2254    ) -> size_t,
2255>;
2256pub type moduleTypeAuxSaveFunc = Option::<
2257    unsafe extern "C" fn(*mut RedisModuleIO, libc::c_int) -> (),
2258>;
2259pub type moduleTypeAuxLoadFunc = Option::<
2260    unsafe extern "C" fn(*mut RedisModuleIO, libc::c_int, libc::c_int) -> libc::c_int,
2261>;
2262pub type moduleTypeDefragFunc = Option::<
2263    unsafe extern "C" fn(
2264        *mut RedisModuleDefragCtx,
2265        *mut redisObject,
2266        *mut *mut libc::c_void,
2267    ) -> libc::c_int,
2268>;
2269pub type moduleTypeCopyFunc = Option::<
2270    unsafe extern "C" fn(
2271        *mut redisObject,
2272        *mut redisObject,
2273        *const libc::c_void,
2274    ) -> *mut libc::c_void,
2275>;
2276pub type moduleTypeUnlinkFunc = Option::<
2277    unsafe extern "C" fn(*mut redisObject, *mut libc::c_void) -> (),
2278>;
2279pub type moduleTypeFreeEffortFunc = Option::<
2280    unsafe extern "C" fn(*mut redisObject, *const libc::c_void) -> size_t,
2281>;
2282pub type moduleTypeFreeFunc = Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>;
2283pub type moduleTypeDigestFunc = Option::<
2284    unsafe extern "C" fn(*mut RedisModuleDigest, *mut libc::c_void) -> (),
2285>;
2286#[derive(Copy, Clone)]
2287#[repr(C)]
2288pub struct RedisModuleDigest {
2289    pub o: [libc::c_uchar; 20],
2290    pub x: [libc::c_uchar; 20],
2291    pub key: *mut redisObject,
2292    pub dbid: libc::c_int,
2293}
2294pub type moduleTypeMemUsageFunc = Option::<
2295    unsafe extern "C" fn(*const libc::c_void) -> size_t,
2296>;
2297pub type moduleTypeRewriteFunc = Option::<
2298    unsafe extern "C" fn(*mut RedisModuleIO, *mut redisObject, *mut libc::c_void) -> (),
2299>;
2300pub type moduleTypeSaveFunc = Option::<
2301    unsafe extern "C" fn(*mut RedisModuleIO, *mut libc::c_void) -> (),
2302>;
2303pub type moduleTypeLoadFunc = Option::<
2304    unsafe extern "C" fn(*mut RedisModuleIO, libc::c_int) -> *mut libc::c_void,
2305>;
2306#[derive(Copy, Clone)]
2307#[repr(C)]
2308pub struct moduleValue {
2309    pub type_0: *mut moduleType,
2310    pub value: *mut libc::c_void,
2311}
2312#[derive(Copy, Clone)]
2313#[repr(C)]
2314pub struct clientReplyBlock {
2315    pub size: size_t,
2316    pub used: size_t,
2317    pub buf: [libc::c_char; 0],
2318}
2319#[derive(Copy, Clone)]
2320#[repr(C)]
2321pub struct replBacklog {
2322    pub ref_repl_buf_node: *mut listNode,
2323    pub unindexed_count: size_t,
2324    pub blocks_index: *mut rax,
2325    pub histlen: libc::c_longlong,
2326    pub offset: libc::c_longlong,
2327}
2328#[derive(Copy, Clone)]
2329#[repr(C)]
2330pub struct saveparam {
2331    pub seconds: time_t,
2332    pub changes: libc::c_int,
2333}
2334#[derive(Copy, Clone)]
2335#[repr(C)]
2336pub struct sentinelConfig {
2337    pub pre_monitor_cfg: *mut list,
2338    pub monitor_cfg: *mut list,
2339    pub post_monitor_cfg: *mut list,
2340}
2341#[derive(Copy, Clone)]
2342#[repr(C)]
2343pub struct sharedObjectsStruct {
2344    pub crlf: *mut robj,
2345    pub ok: *mut robj,
2346    pub err: *mut robj,
2347    pub emptybulk: *mut robj,
2348    pub czero: *mut robj,
2349    pub cone: *mut robj,
2350    pub pong: *mut robj,
2351    pub space: *mut robj,
2352    pub queued: *mut robj,
2353    pub null: [*mut robj; 4],
2354    pub nullarray: [*mut robj; 4],
2355    pub emptymap: [*mut robj; 4],
2356    pub emptyset: [*mut robj; 4],
2357    pub emptyarray: *mut robj,
2358    pub wrongtypeerr: *mut robj,
2359    pub nokeyerr: *mut robj,
2360    pub syntaxerr: *mut robj,
2361    pub sameobjecterr: *mut robj,
2362    pub outofrangeerr: *mut robj,
2363    pub noscripterr: *mut robj,
2364    pub loadingerr: *mut robj,
2365    pub slowevalerr: *mut robj,
2366    pub slowscripterr: *mut robj,
2367    pub slowmoduleerr: *mut robj,
2368    pub bgsaveerr: *mut robj,
2369    pub masterdownerr: *mut robj,
2370    pub roslaveerr: *mut robj,
2371    pub execaborterr: *mut robj,
2372    pub noautherr: *mut robj,
2373    pub noreplicaserr: *mut robj,
2374    pub busykeyerr: *mut robj,
2375    pub oomerr: *mut robj,
2376    pub plus: *mut robj,
2377    pub messagebulk: *mut robj,
2378    pub pmessagebulk: *mut robj,
2379    pub subscribebulk: *mut robj,
2380    pub unsubscribebulk: *mut robj,
2381    pub psubscribebulk: *mut robj,
2382    pub punsubscribebulk: *mut robj,
2383    pub del: *mut robj,
2384    pub unlink: *mut robj,
2385    pub rpop: *mut robj,
2386    pub lpop: *mut robj,
2387    pub lpush: *mut robj,
2388    pub rpoplpush: *mut robj,
2389    pub lmove: *mut robj,
2390    pub blmove: *mut robj,
2391    pub zpopmin: *mut robj,
2392    pub zpopmax: *mut robj,
2393    pub emptyscan: *mut robj,
2394    pub multi: *mut robj,
2395    pub exec: *mut robj,
2396    pub left: *mut robj,
2397    pub right: *mut robj,
2398    pub hset: *mut robj,
2399    pub srem: *mut robj,
2400    pub xgroup: *mut robj,
2401    pub xclaim: *mut robj,
2402    pub script: *mut robj,
2403    pub replconf: *mut robj,
2404    pub eval: *mut robj,
2405    pub persist: *mut robj,
2406    pub set: *mut robj,
2407    pub pexpireat: *mut robj,
2408    pub pexpire: *mut robj,
2409    pub time: *mut robj,
2410    pub pxat: *mut robj,
2411    pub absttl: *mut robj,
2412    pub retrycount: *mut robj,
2413    pub force: *mut robj,
2414    pub justid: *mut robj,
2415    pub entriesread: *mut robj,
2416    pub lastid: *mut robj,
2417    pub ping: *mut robj,
2418    pub setid: *mut robj,
2419    pub keepttl: *mut robj,
2420    pub load: *mut robj,
2421    pub createconsumer: *mut robj,
2422    pub getack: *mut robj,
2423    pub special_asterick: *mut robj,
2424    pub special_equals: *mut robj,
2425    pub default_username: *mut robj,
2426    pub redacted: *mut robj,
2427    pub ssubscribebulk: *mut robj,
2428    pub sunsubscribebulk: *mut robj,
2429    pub smessagebulk: *mut robj,
2430    pub select: [*mut robj; 10],
2431    pub integers: [*mut robj; 10000],
2432    pub mbulkhdr: [*mut robj; 32],
2433    pub bulkhdr: [*mut robj; 32],
2434    pub maphdr: [*mut robj; 32],
2435    pub sethdr: [*mut robj; 32],
2436    pub minstring: sds,
2437    pub maxstring: sds,
2438}
2439#[derive(Copy, Clone)]
2440#[repr(C)]
2441pub struct zskiplistNode {
2442    pub ele: sds,
2443    pub score: libc::c_double,
2444    pub backward: *mut zskiplistNode,
2445    pub level: [zskiplistLevel; 0],
2446}
2447#[derive(Copy, Clone)]
2448#[repr(C)]
2449pub struct zskiplistLevel {
2450    pub forward: *mut zskiplistNode,
2451    pub span: libc::c_ulong,
2452}
2453#[derive(Copy, Clone)]
2454#[repr(C)]
2455pub struct zskiplist {
2456    pub header: *mut zskiplistNode,
2457    pub tail: *mut zskiplistNode,
2458    pub length: libc::c_ulong,
2459    pub level: libc::c_int,
2460}
2461#[derive(Copy, Clone)]
2462#[repr(C)]
2463pub struct zset {
2464    pub dict: *mut dict,
2465    pub zsl: *mut zskiplist,
2466}
2467#[derive(Copy, Clone)]
2468#[repr(C)]
2469pub struct clientBufferLimitsConfig {
2470    pub hard_limit_bytes: libc::c_ulonglong,
2471    pub soft_limit_bytes: libc::c_ulonglong,
2472    pub soft_limit_seconds: time_t,
2473}
2474#[derive(Copy, Clone)]
2475#[repr(C)]
2476pub struct redisOp {
2477    pub argv: *mut *mut robj,
2478    pub argc: libc::c_int,
2479    pub dbid: libc::c_int,
2480    pub target: libc::c_int,
2481}
2482#[derive(Copy, Clone)]
2483#[repr(C)]
2484pub struct redisOpArray {
2485    pub ops: *mut redisOp,
2486    pub numops: libc::c_int,
2487    pub capacity: libc::c_int,
2488}
2489#[derive(Copy, Clone)]
2490#[repr(C)]
2491pub struct malloc_stats {
2492    pub zmalloc_used: size_t,
2493    pub process_rss: size_t,
2494    pub allocator_allocated: size_t,
2495    pub allocator_active: size_t,
2496    pub allocator_resident: size_t,
2497}
2498#[derive(Copy, Clone)]
2499#[repr(C)]
2500pub struct socketFds {
2501    pub fd: [libc::c_int; 16],
2502    pub count: libc::c_int,
2503}
2504#[derive(Copy, Clone)]
2505#[repr(C)]
2506pub struct redisTLSContextConfig {
2507    pub cert_file: *mut libc::c_char,
2508    pub key_file: *mut libc::c_char,
2509    pub key_file_pass: *mut libc::c_char,
2510    pub client_cert_file: *mut libc::c_char,
2511    pub client_key_file: *mut libc::c_char,
2512    pub client_key_file_pass: *mut libc::c_char,
2513    pub dh_params_file: *mut libc::c_char,
2514    pub ca_cert_file: *mut libc::c_char,
2515    pub ca_cert_dir: *mut libc::c_char,
2516    pub protocols: *mut libc::c_char,
2517    pub ciphers: *mut libc::c_char,
2518    pub ciphersuites: *mut libc::c_char,
2519    pub prefer_server_ciphers: libc::c_int,
2520    pub session_caching: libc::c_int,
2521    pub session_cache_size: libc::c_int,
2522    pub session_cache_timeout: libc::c_int,
2523}
2524pub type aof_file_type = libc::c_uint;
2525pub const AOF_FILE_TYPE_INCR: aof_file_type = 105;
2526pub const AOF_FILE_TYPE_HIST: aof_file_type = 104;
2527pub const AOF_FILE_TYPE_BASE: aof_file_type = 98;
2528#[derive(Copy, Clone)]
2529#[repr(C)]
2530pub struct aofInfo {
2531    pub file_name: sds,
2532    pub file_seq: libc::c_longlong,
2533    pub file_type: aof_file_type,
2534}
2535#[derive(Copy, Clone)]
2536#[repr(C)]
2537pub struct aofManifest {
2538    pub base_aof_info: *mut aofInfo,
2539    pub incr_aof_list: *mut list,
2540    pub history_aof_list: *mut list,
2541    pub curr_base_file_seq: libc::c_longlong,
2542    pub curr_incr_file_seq: libc::c_longlong,
2543    pub dirty: libc::c_int,
2544}
2545pub type childInfoType = libc::c_uint;
2546pub const CHILD_INFO_TYPE_MODULE_COW_SIZE: childInfoType = 3;
2547pub const CHILD_INFO_TYPE_RDB_COW_SIZE: childInfoType = 2;
2548pub const CHILD_INFO_TYPE_AOF_COW_SIZE: childInfoType = 1;
2549pub const CHILD_INFO_TYPE_CURRENT_INFO: childInfoType = 0;
2550#[derive(Copy, Clone)]
2551#[repr(C)]
2552pub struct redisServer {
2553    pub pid: pid_t,
2554    pub main_thread_id: pthread_t,
2555    pub configfile: *mut libc::c_char,
2556    pub executable: *mut libc::c_char,
2557    pub exec_argv: *mut *mut libc::c_char,
2558    pub dynamic_hz: libc::c_int,
2559    pub config_hz: libc::c_int,
2560    pub umask: mode_t,
2561    pub hz: libc::c_int,
2562    pub in_fork_child: libc::c_int,
2563    pub db: *mut redisDb,
2564    pub commands: *mut dict,
2565    pub orig_commands: *mut dict,
2566    pub el: *mut aeEventLoop,
2567    pub errors: *mut rax,
2568    pub lruclock: atomic_uint,
2569    pub shutdown_asap: sig_atomic_t,
2570    pub shutdown_mstime: mstime_t,
2571    pub last_sig_received: libc::c_int,
2572    pub shutdown_flags: libc::c_int,
2573    pub activerehashing: libc::c_int,
2574    pub active_defrag_running: libc::c_int,
2575    pub pidfile: *mut libc::c_char,
2576    pub arch_bits: libc::c_int,
2577    pub cronloops: libc::c_int,
2578    pub runid: [libc::c_char; 41],
2579    pub sentinel_mode: libc::c_int,
2580    pub initial_memory_usage: size_t,
2581    pub always_show_logo: libc::c_int,
2582    pub in_exec: libc::c_int,
2583    pub busy_module_yield_flags: libc::c_int,
2584    pub busy_module_yield_reply: *const libc::c_char,
2585    pub core_propagates: libc::c_int,
2586    pub propagate_no_multi: libc::c_int,
2587    pub module_ctx_nesting: libc::c_int,
2588    pub ignore_warnings: *mut libc::c_char,
2589    pub client_pause_in_transaction: libc::c_int,
2590    pub thp_enabled: libc::c_int,
2591    pub page_size: size_t,
2592    pub moduleapi: *mut dict,
2593    pub sharedapi: *mut dict,
2594    pub module_configs_queue: *mut dict,
2595    pub loadmodule_queue: *mut list,
2596    pub module_pipe: [libc::c_int; 2],
2597    pub child_pid: pid_t,
2598    pub child_type: libc::c_int,
2599    pub port: libc::c_int,
2600    pub tls_port: libc::c_int,
2601    pub tcp_backlog: libc::c_int,
2602    pub bindaddr: [*mut libc::c_char; 16],
2603    pub bindaddr_count: libc::c_int,
2604    pub bind_source_addr: *mut libc::c_char,
2605    pub unixsocket: *mut libc::c_char,
2606    pub unixsocketperm: libc::c_uint,
2607    pub ipfd: socketFds,
2608    pub tlsfd: socketFds,
2609    pub sofd: libc::c_int,
2610    pub socket_mark_id: uint32_t,
2611    pub cfd: socketFds,
2612    pub clients: *mut list,
2613    pub clients_to_close: *mut list,
2614    pub clients_pending_write: *mut list,
2615    pub clients_pending_read: *mut list,
2616    pub slaves: *mut list,
2617    pub monitors: *mut list,
2618    pub current_client: *mut client,
2619    pub client_mem_usage_buckets: *mut clientMemUsageBucket,
2620    pub clients_timeout_table: *mut rax,
2621    pub fixed_time_expire: libc::c_long,
2622    pub in_nested_call: libc::c_int,
2623    pub clients_index: *mut rax,
2624    pub client_pause_type: pause_type,
2625    pub postponed_clients: *mut list,
2626    pub client_pause_end_time: mstime_t,
2627    pub client_pause_per_purpose: [*mut pause_event; 3],
2628    pub neterr: [libc::c_char; 256],
2629    pub migrate_cached_sockets: *mut dict,
2630    pub next_client_id: uint_least64_t,
2631    pub protected_mode: libc::c_int,
2632    pub io_threads_num: libc::c_int,
2633    pub io_threads_do_reads: libc::c_int,
2634    pub io_threads_active: libc::c_int,
2635    pub events_processed_while_blocked: libc::c_longlong,
2636    pub enable_protected_configs: libc::c_int,
2637    pub enable_debug_cmd: libc::c_int,
2638    pub enable_module_cmd: libc::c_int,
2639    pub loading: sig_atomic_t,
2640    pub async_loading: sig_atomic_t,
2641    pub loading_total_bytes: off_t,
2642    pub loading_rdb_used_mem: off_t,
2643    pub loading_loaded_bytes: off_t,
2644    pub loading_start_time: time_t,
2645    pub loading_process_events_interval_bytes: off_t,
2646    pub stat_starttime: time_t,
2647    pub stat_numcommands: libc::c_longlong,
2648    pub stat_numconnections: libc::c_longlong,
2649    pub stat_expiredkeys: libc::c_longlong,
2650    pub stat_expired_stale_perc: libc::c_double,
2651    pub stat_expired_time_cap_reached_count: libc::c_longlong,
2652    pub stat_expire_cycle_time_used: libc::c_longlong,
2653    pub stat_evictedkeys: libc::c_longlong,
2654    pub stat_evictedclients: libc::c_longlong,
2655    pub stat_total_eviction_exceeded_time: libc::c_longlong,
2656    pub stat_last_eviction_exceeded_time: monotime,
2657    pub stat_keyspace_hits: libc::c_longlong,
2658    pub stat_keyspace_misses: libc::c_longlong,
2659    pub stat_active_defrag_hits: libc::c_longlong,
2660    pub stat_active_defrag_misses: libc::c_longlong,
2661    pub stat_active_defrag_key_hits: libc::c_longlong,
2662    pub stat_active_defrag_key_misses: libc::c_longlong,
2663    pub stat_active_defrag_scanned: libc::c_longlong,
2664    pub stat_total_active_defrag_time: libc::c_longlong,
2665    pub stat_last_active_defrag_time: monotime,
2666    pub stat_peak_memory: size_t,
2667    pub stat_aof_rewrites: libc::c_longlong,
2668    pub stat_aofrw_consecutive_failures: libc::c_longlong,
2669    pub stat_rdb_saves: libc::c_longlong,
2670    pub stat_fork_time: libc::c_longlong,
2671    pub stat_fork_rate: libc::c_double,
2672    pub stat_total_forks: libc::c_longlong,
2673    pub stat_rejected_conn: libc::c_longlong,
2674    pub stat_sync_full: libc::c_longlong,
2675    pub stat_sync_partial_ok: libc::c_longlong,
2676    pub stat_sync_partial_err: libc::c_longlong,
2677    pub slowlog: *mut list,
2678    pub slowlog_entry_id: libc::c_longlong,
2679    pub slowlog_log_slower_than: libc::c_longlong,
2680    pub slowlog_max_len: libc::c_ulong,
2681    pub cron_malloc_stats: malloc_stats,
2682    pub stat_net_input_bytes: atomic_llong,
2683    pub stat_net_output_bytes: atomic_llong,
2684    pub stat_net_repl_input_bytes: atomic_llong,
2685    pub stat_net_repl_output_bytes: atomic_llong,
2686    pub stat_current_cow_peak: size_t,
2687    pub stat_current_cow_bytes: size_t,
2688    pub stat_current_cow_updated: monotime,
2689    pub stat_current_save_keys_processed: size_t,
2690    pub stat_current_save_keys_total: size_t,
2691    pub stat_rdb_cow_bytes: size_t,
2692    pub stat_aof_cow_bytes: size_t,
2693    pub stat_module_cow_bytes: size_t,
2694    pub stat_module_progress: libc::c_double,
2695    pub stat_clients_type_memory: [size_t; 4],
2696    pub stat_cluster_links_memory: size_t,
2697    pub stat_unexpected_error_replies: libc::c_longlong,
2698    pub stat_total_error_replies: libc::c_longlong,
2699    pub stat_dump_payload_sanitizations: libc::c_longlong,
2700    pub stat_io_reads_processed: libc::c_longlong,
2701    pub stat_io_writes_processed: libc::c_longlong,
2702    pub stat_total_reads_processed: atomic_llong,
2703    pub stat_total_writes_processed: atomic_llong,
2704    pub inst_metric: [C2RustUnnamed_19; 5],
2705    pub stat_reply_buffer_shrinks: libc::c_longlong,
2706    pub stat_reply_buffer_expands: libc::c_longlong,
2707    pub verbosity: libc::c_int,
2708    pub maxidletime: libc::c_int,
2709    pub tcpkeepalive: libc::c_int,
2710    pub active_expire_enabled: libc::c_int,
2711    pub active_expire_effort: libc::c_int,
2712    pub active_defrag_enabled: libc::c_int,
2713    pub sanitize_dump_payload: libc::c_int,
2714    pub skip_checksum_validation: libc::c_int,
2715    pub jemalloc_bg_thread: libc::c_int,
2716    pub active_defrag_ignore_bytes: size_t,
2717    pub active_defrag_threshold_lower: libc::c_int,
2718    pub active_defrag_threshold_upper: libc::c_int,
2719    pub active_defrag_cycle_min: libc::c_int,
2720    pub active_defrag_cycle_max: libc::c_int,
2721    pub active_defrag_max_scan_fields: libc::c_ulong,
2722    pub client_max_querybuf_len: size_t,
2723    pub dbnum: libc::c_int,
2724    pub supervised: libc::c_int,
2725    pub supervised_mode: libc::c_int,
2726    pub daemonize: libc::c_int,
2727    pub set_proc_title: libc::c_int,
2728    pub proc_title_template: *mut libc::c_char,
2729    pub client_obuf_limits: [clientBufferLimitsConfig; 3],
2730    pub pause_cron: libc::c_int,
2731    pub latency_tracking_enabled: libc::c_int,
2732    pub latency_tracking_info_percentiles: *mut libc::c_double,
2733    pub latency_tracking_info_percentiles_len: libc::c_int,
2734    pub aof_enabled: libc::c_int,
2735    pub aof_state: libc::c_int,
2736    pub aof_fsync: libc::c_int,
2737    pub aof_filename: *mut libc::c_char,
2738    pub aof_dirname: *mut libc::c_char,
2739    pub aof_no_fsync_on_rewrite: libc::c_int,
2740    pub aof_rewrite_perc: libc::c_int,
2741    pub aof_rewrite_min_size: off_t,
2742    pub aof_rewrite_base_size: off_t,
2743    pub aof_current_size: off_t,
2744    pub aof_last_incr_size: off_t,
2745    pub aof_fsync_offset: off_t,
2746    pub aof_flush_sleep: libc::c_int,
2747    pub aof_rewrite_scheduled: libc::c_int,
2748    pub aof_buf: sds,
2749    pub aof_fd: libc::c_int,
2750    pub aof_selected_db: libc::c_int,
2751    pub aof_flush_postponed_start: time_t,
2752    pub aof_last_fsync: time_t,
2753    pub aof_rewrite_time_last: time_t,
2754    pub aof_rewrite_time_start: time_t,
2755    pub aof_cur_timestamp: time_t,
2756    pub aof_timestamp_enabled: libc::c_int,
2757    pub aof_lastbgrewrite_status: libc::c_int,
2758    pub aof_delayed_fsync: libc::c_ulong,
2759    pub aof_rewrite_incremental_fsync: libc::c_int,
2760    pub rdb_save_incremental_fsync: libc::c_int,
2761    pub aof_last_write_status: libc::c_int,
2762    pub aof_last_write_errno: libc::c_int,
2763    pub aof_load_truncated: libc::c_int,
2764    pub aof_use_rdb_preamble: libc::c_int,
2765    pub aof_bio_fsync_status: atomic_int,
2766    pub aof_bio_fsync_errno: atomic_int,
2767    pub aof_manifest: *mut aofManifest,
2768    pub aof_disable_auto_gc: libc::c_int,
2769    pub dirty: libc::c_longlong,
2770    pub dirty_before_bgsave: libc::c_longlong,
2771    pub rdb_last_load_keys_expired: libc::c_longlong,
2772    pub rdb_last_load_keys_loaded: libc::c_longlong,
2773    pub saveparams: *mut saveparam,
2774    pub saveparamslen: libc::c_int,
2775    pub rdb_filename: *mut libc::c_char,
2776    pub rdb_compression: libc::c_int,
2777    pub rdb_checksum: libc::c_int,
2778    pub rdb_del_sync_files: libc::c_int,
2779    pub lastsave: time_t,
2780    pub lastbgsave_try: time_t,
2781    pub rdb_save_time_last: time_t,
2782    pub rdb_save_time_start: time_t,
2783    pub rdb_bgsave_scheduled: libc::c_int,
2784    pub rdb_child_type: libc::c_int,
2785    pub lastbgsave_status: libc::c_int,
2786    pub stop_writes_on_bgsave_err: libc::c_int,
2787    pub rdb_pipe_read: libc::c_int,
2788    pub rdb_child_exit_pipe: libc::c_int,
2789    pub rdb_pipe_conns: *mut *mut connection,
2790    pub rdb_pipe_numconns: libc::c_int,
2791    pub rdb_pipe_numconns_writing: libc::c_int,
2792    pub rdb_pipe_buff: *mut libc::c_char,
2793    pub rdb_pipe_bufflen: libc::c_int,
2794    pub rdb_key_save_delay: libc::c_int,
2795    pub key_load_delay: libc::c_int,
2796    pub child_info_pipe: [libc::c_int; 2],
2797    pub child_info_nread: libc::c_int,
2798    pub also_propagate: redisOpArray,
2799    pub replication_allowed: libc::c_int,
2800    pub logfile: *mut libc::c_char,
2801    pub syslog_enabled: libc::c_int,
2802    pub syslog_ident: *mut libc::c_char,
2803    pub syslog_facility: libc::c_int,
2804    pub crashlog_enabled: libc::c_int,
2805    pub memcheck_enabled: libc::c_int,
2806    pub use_exit_on_panic: libc::c_int,
2807    pub shutdown_timeout: libc::c_int,
2808    pub shutdown_on_sigint: libc::c_int,
2809    pub shutdown_on_sigterm: libc::c_int,
2810    pub replid: [libc::c_char; 41],
2811    pub replid2: [libc::c_char; 41],
2812    pub master_repl_offset: libc::c_longlong,
2813    pub second_replid_offset: libc::c_longlong,
2814    pub slaveseldb: libc::c_int,
2815    pub repl_ping_slave_period: libc::c_int,
2816    pub repl_backlog: *mut replBacklog,
2817    pub repl_backlog_size: libc::c_longlong,
2818    pub repl_backlog_time_limit: time_t,
2819    pub repl_no_slaves_since: time_t,
2820    pub repl_min_slaves_to_write: libc::c_int,
2821    pub repl_min_slaves_max_lag: libc::c_int,
2822    pub repl_good_slaves_count: libc::c_int,
2823    pub repl_diskless_sync: libc::c_int,
2824    pub repl_diskless_load: libc::c_int,
2825    pub repl_diskless_sync_delay: libc::c_int,
2826    pub repl_diskless_sync_max_replicas: libc::c_int,
2827    pub repl_buffer_mem: size_t,
2828    pub repl_buffer_blocks: *mut list,
2829    pub masteruser: *mut libc::c_char,
2830    pub masterauth: sds,
2831    pub masterhost: *mut libc::c_char,
2832    pub masterport: libc::c_int,
2833    pub repl_timeout: libc::c_int,
2834    pub master: *mut client,
2835    pub cached_master: *mut client,
2836    pub repl_syncio_timeout: libc::c_int,
2837    pub repl_state: libc::c_int,
2838    pub repl_transfer_size: off_t,
2839    pub repl_transfer_read: off_t,
2840    pub repl_transfer_last_fsync_off: off_t,
2841    pub repl_transfer_s: *mut connection,
2842    pub repl_transfer_fd: libc::c_int,
2843    pub repl_transfer_tmpfile: *mut libc::c_char,
2844    pub repl_transfer_lastio: time_t,
2845    pub repl_serve_stale_data: libc::c_int,
2846    pub repl_slave_ro: libc::c_int,
2847    pub repl_slave_ignore_maxmemory: libc::c_int,
2848    pub repl_down_since: time_t,
2849    pub repl_disable_tcp_nodelay: libc::c_int,
2850    pub slave_priority: libc::c_int,
2851    pub replica_announced: libc::c_int,
2852    pub slave_announce_port: libc::c_int,
2853    pub slave_announce_ip: *mut libc::c_char,
2854    pub propagation_error_behavior: libc::c_int,
2855    pub repl_ignore_disk_write_error: libc::c_int,
2856    pub master_replid: [libc::c_char; 41],
2857    pub master_initial_offset: libc::c_longlong,
2858    pub repl_slave_lazy_flush: libc::c_int,
2859    pub clients_waiting_acks: *mut list,
2860    pub get_ack_from_slaves: libc::c_int,
2861    pub maxclients: libc::c_uint,
2862    pub maxmemory: libc::c_ulonglong,
2863    pub maxmemory_clients: ssize_t,
2864    pub maxmemory_policy: libc::c_int,
2865    pub maxmemory_samples: libc::c_int,
2866    pub maxmemory_eviction_tenacity: libc::c_int,
2867    pub lfu_log_factor: libc::c_int,
2868    pub lfu_decay_time: libc::c_int,
2869    pub proto_max_bulk_len: libc::c_longlong,
2870    pub oom_score_adj_values: [libc::c_int; 3],
2871    pub oom_score_adj: libc::c_int,
2872    pub disable_thp: libc::c_int,
2873    pub blocked_clients: libc::c_uint,
2874    pub blocked_clients_by_type: [libc::c_uint; 8],
2875    pub unblocked_clients: *mut list,
2876    pub ready_keys: *mut list,
2877    pub tracking_clients: libc::c_uint,
2878    pub tracking_table_max_keys: size_t,
2879    pub tracking_pending_keys: *mut list,
2880    pub sort_desc: libc::c_int,
2881    pub sort_alpha: libc::c_int,
2882    pub sort_bypattern: libc::c_int,
2883    pub sort_store: libc::c_int,
2884    pub hash_max_listpack_entries: size_t,
2885    pub hash_max_listpack_value: size_t,
2886    pub set_max_intset_entries: size_t,
2887    pub zset_max_listpack_entries: size_t,
2888    pub zset_max_listpack_value: size_t,
2889    pub hll_sparse_max_bytes: size_t,
2890    pub stream_node_max_bytes: size_t,
2891    pub stream_node_max_entries: libc::c_longlong,
2892    pub list_max_listpack_size: libc::c_int,
2893    pub list_compress_depth: libc::c_int,
2894    pub unixtime: atomic_int,
2895    pub timezone: time_t,
2896    pub daylight_active: libc::c_int,
2897    pub mstime: mstime_t,
2898    pub ustime: ustime_t,
2899    pub blocking_op_nesting: size_t,
2900    pub blocked_last_cron: libc::c_longlong,
2901    pub pubsub_channels: *mut dict,
2902    pub pubsub_patterns: *mut dict,
2903    pub notify_keyspace_events: libc::c_int,
2904    pub pubsubshard_channels: *mut dict,
2905    pub cluster_enabled: libc::c_int,
2906    pub cluster_port: libc::c_int,
2907    pub cluster_node_timeout: mstime_t,
2908    pub cluster_configfile: *mut libc::c_char,
2909    pub cluster: *mut clusterState,
2910    pub cluster_migration_barrier: libc::c_int,
2911    pub cluster_allow_replica_migration: libc::c_int,
2912    pub cluster_slave_validity_factor: libc::c_int,
2913    pub cluster_require_full_coverage: libc::c_int,
2914    pub cluster_slave_no_failover: libc::c_int,
2915    pub cluster_announce_ip: *mut libc::c_char,
2916    pub cluster_announce_hostname: *mut libc::c_char,
2917    pub cluster_preferred_endpoint_type: libc::c_int,
2918    pub cluster_announce_port: libc::c_int,
2919    pub cluster_announce_tls_port: libc::c_int,
2920    pub cluster_announce_bus_port: libc::c_int,
2921    pub cluster_module_flags: libc::c_int,
2922    pub cluster_allow_reads_when_down: libc::c_int,
2923    pub cluster_config_file_lock_fd: libc::c_int,
2924    pub cluster_link_sendbuf_limit_bytes: libc::c_ulonglong,
2925    pub cluster_drop_packet_filter: libc::c_int,
2926    pub script_caller: *mut client,
2927    pub busy_reply_threshold: mstime_t,
2928    pub pre_command_oom_state: libc::c_int,
2929    pub script_disable_deny_script: libc::c_int,
2930    pub lazyfree_lazy_eviction: libc::c_int,
2931    pub lazyfree_lazy_expire: libc::c_int,
2932    pub lazyfree_lazy_server_del: libc::c_int,
2933    pub lazyfree_lazy_user_del: libc::c_int,
2934    pub lazyfree_lazy_user_flush: libc::c_int,
2935    pub latency_monitor_threshold: libc::c_longlong,
2936    pub latency_events: *mut dict,
2937    pub acl_filename: *mut libc::c_char,
2938    pub acllog_max_len: libc::c_ulong,
2939    pub requirepass: sds,
2940    pub acl_pubsub_default: libc::c_int,
2941    pub watchdog_period: libc::c_int,
2942    pub system_memory_size: size_t,
2943    pub tls_cluster: libc::c_int,
2944    pub tls_replication: libc::c_int,
2945    pub tls_auth_clients: libc::c_int,
2946    pub tls_ctx_config: redisTLSContextConfig,
2947    pub server_cpulist: *mut libc::c_char,
2948    pub bio_cpulist: *mut libc::c_char,
2949    pub aof_rewrite_cpulist: *mut libc::c_char,
2950    pub bgsave_cpulist: *mut libc::c_char,
2951    pub sentinel_config: *mut sentinelConfig,
2952    pub failover_end_time: mstime_t,
2953    pub force_failover: libc::c_int,
2954    pub target_replica_host: *mut libc::c_char,
2955    pub target_replica_port: libc::c_int,
2956    pub failover_state: libc::c_int,
2957    pub cluster_allow_pubsubshard_when_down: libc::c_int,
2958    pub reply_buffer_peak_reset_time: libc::c_long,
2959    pub reply_buffer_resizing_enabled: libc::c_int,
2960}
2961#[derive(Copy, Clone)]
2962#[repr(C)]
2963pub struct clusterState {
2964    pub myself: *mut clusterNode,
2965    pub currentEpoch: uint64_t,
2966    pub state: libc::c_int,
2967    pub size: libc::c_int,
2968    pub nodes: *mut dict,
2969    pub nodes_black_list: *mut dict,
2970    pub migrating_slots_to: [*mut clusterNode; 16384],
2971    pub importing_slots_from: [*mut clusterNode; 16384],
2972    pub slots: [*mut clusterNode; 16384],
2973    pub slots_to_channels: *mut rax,
2974    pub failover_auth_time: mstime_t,
2975    pub failover_auth_count: libc::c_int,
2976    pub failover_auth_sent: libc::c_int,
2977    pub failover_auth_rank: libc::c_int,
2978    pub failover_auth_epoch: uint64_t,
2979    pub cant_failover_reason: libc::c_int,
2980    pub mf_end: mstime_t,
2981    pub mf_slave: *mut clusterNode,
2982    pub mf_master_offset: libc::c_longlong,
2983    pub mf_can_start: libc::c_int,
2984    pub lastVoteEpoch: uint64_t,
2985    pub todo_before_sleep: libc::c_int,
2986    pub stats_bus_messages_sent: [libc::c_longlong; 11],
2987    pub stats_bus_messages_received: [libc::c_longlong; 11],
2988    pub stats_pfail_nodes: libc::c_longlong,
2989    pub stat_cluster_links_buffer_limit_exceeded: libc::c_ulonglong,
2990}
2991#[derive(Copy, Clone)]
2992#[repr(C)]
2993pub struct clusterNode {
2994    pub ctime: mstime_t,
2995    pub name: [libc::c_char; 40],
2996    pub flags: libc::c_int,
2997    pub configEpoch: uint64_t,
2998    pub slots: [libc::c_uchar; 2048],
2999    pub slot_info_pairs: *mut uint16_t,
3000    pub slot_info_pairs_count: libc::c_int,
3001    pub numslots: libc::c_int,
3002    pub numslaves: libc::c_int,
3003    pub slaves: *mut *mut clusterNode,
3004    pub slaveof: *mut clusterNode,
3005    pub last_in_ping_gossip: libc::c_ulonglong,
3006    pub ping_sent: mstime_t,
3007    pub pong_received: mstime_t,
3008    pub data_received: mstime_t,
3009    pub fail_time: mstime_t,
3010    pub voted_time: mstime_t,
3011    pub repl_offset_time: mstime_t,
3012    pub orphaned_time: mstime_t,
3013    pub repl_offset: libc::c_longlong,
3014    pub ip: [libc::c_char; 46],
3015    pub hostname: sds,
3016    pub port: libc::c_int,
3017    pub pport: libc::c_int,
3018    pub cport: libc::c_int,
3019    pub link: *mut clusterLink,
3020    pub inbound_link: *mut clusterLink,
3021    pub fail_reports: *mut list,
3022}
3023#[derive(Copy, Clone)]
3024#[repr(C)]
3025pub struct clusterLink {
3026    pub ctime: mstime_t,
3027    pub conn: *mut connection,
3028    pub sndbuf: sds,
3029    pub rcvbuf: *mut libc::c_char,
3030    pub rcvbuf_len: size_t,
3031    pub rcvbuf_alloc: size_t,
3032    pub node: *mut clusterNode,
3033    pub inbound: libc::c_int,
3034}
3035#[derive(Copy, Clone)]
3036#[repr(C)]
3037pub struct C2RustUnnamed_19 {
3038    pub last_sample_time: libc::c_longlong,
3039    pub last_sample_count: libc::c_longlong,
3040    pub samples: [libc::c_longlong; 16],
3041    pub idx: libc::c_int,
3042}
3043#[derive(Copy, Clone)]
3044#[repr(C)]
3045pub struct listTypeIterator {
3046    pub subject: *mut robj,
3047    pub encoding: libc::c_uchar,
3048    pub direction: libc::c_uchar,
3049    pub iter: *mut quicklistIter,
3050}
3051#[derive(Copy, Clone)]
3052#[repr(C)]
3053pub struct listTypeEntry {
3054    pub li: *mut listTypeIterator,
3055    pub entry: quicklistEntry,
3056}
3057#[derive(Copy, Clone)]
3058#[repr(C)]
3059pub struct streamID {
3060    pub ms: uint64_t,
3061    pub seq: uint64_t,
3062}
3063#[derive(Copy, Clone)]
3064#[repr(C)]
3065pub struct stream {
3066    pub rax: *mut rax,
3067    pub length: uint64_t,
3068    pub last_id: streamID,
3069    pub first_id: streamID,
3070    pub max_deleted_entry_id: streamID,
3071    pub entries_added: uint64_t,
3072    pub cgroups: *mut rax,
3073}
3074#[derive(Copy, Clone)]
3075#[repr(C)]
3076pub struct streamIterator {
3077    pub stream: *mut stream,
3078    pub master_id: streamID,
3079    pub master_fields_count: uint64_t,
3080    pub master_fields_start: *mut libc::c_uchar,
3081    pub master_fields_ptr: *mut libc::c_uchar,
3082    pub entry_flags: libc::c_int,
3083    pub rev: libc::c_int,
3084    pub skip_tombstones: libc::c_int,
3085    pub start_key: [uint64_t; 2],
3086    pub end_key: [uint64_t; 2],
3087    pub ri: raxIterator,
3088    pub lp: *mut libc::c_uchar,
3089    pub lp_ele: *mut libc::c_uchar,
3090    pub lp_flags: *mut libc::c_uchar,
3091    pub field_buf: [libc::c_uchar; 21],
3092    pub value_buf: [libc::c_uchar; 21],
3093}
3094#[derive(Copy, Clone)]
3095#[repr(C)]
3096pub struct ModuleConfig {
3097    pub name: sds,
3098    pub privdata: *mut libc::c_void,
3099    pub get_fn: get_fn,
3100    pub set_fn: set_fn,
3101    pub apply_fn: RedisModuleConfigApplyFunc,
3102    pub module: *mut RedisModule,
3103}
3104pub type RedisModuleConfigApplyFunc = Option::<
3105    unsafe extern "C" fn(
3106        *mut RedisModuleCtx,
3107        *mut libc::c_void,
3108        *mut *mut robj,
3109    ) -> libc::c_int,
3110>;
3111#[derive(Copy, Clone)]
3112#[repr(C)]
3113pub union set_fn {
3114    pub set_string: RedisModuleConfigSetStringFunc,
3115    pub set_numeric: RedisModuleConfigSetNumericFunc,
3116    pub set_bool: RedisModuleConfigSetBoolFunc,
3117    pub set_enum: RedisModuleConfigSetEnumFunc,
3118}
3119pub type RedisModuleConfigSetEnumFunc = Option::<
3120    unsafe extern "C" fn(
3121        *const libc::c_char,
3122        libc::c_int,
3123        *mut libc::c_void,
3124        *mut *mut robj,
3125    ) -> libc::c_int,
3126>;
3127pub type RedisModuleConfigSetBoolFunc = Option::<
3128    unsafe extern "C" fn(
3129        *const libc::c_char,
3130        libc::c_int,
3131        *mut libc::c_void,
3132        *mut *mut robj,
3133    ) -> libc::c_int,
3134>;
3135pub type RedisModuleConfigSetNumericFunc = Option::<
3136    unsafe extern "C" fn(
3137        *const libc::c_char,
3138        libc::c_longlong,
3139        *mut libc::c_void,
3140        *mut *mut robj,
3141    ) -> libc::c_int,
3142>;
3143pub type RedisModuleConfigSetStringFunc = Option::<
3144    unsafe extern "C" fn(
3145        *const libc::c_char,
3146        *mut robj,
3147        *mut libc::c_void,
3148        *mut *mut robj,
3149    ) -> libc::c_int,
3150>;
3151#[derive(Copy, Clone)]
3152#[repr(C)]
3153pub union get_fn {
3154    pub get_string: RedisModuleConfigGetStringFunc,
3155    pub get_numeric: RedisModuleConfigGetNumericFunc,
3156    pub get_bool: RedisModuleConfigGetBoolFunc,
3157    pub get_enum: RedisModuleConfigGetEnumFunc,
3158}
3159pub type RedisModuleConfigGetEnumFunc = Option::<
3160    unsafe extern "C" fn(*const libc::c_char, *mut libc::c_void) -> libc::c_int,
3161>;
3162pub type RedisModuleConfigGetBoolFunc = Option::<
3163    unsafe extern "C" fn(*const libc::c_char, *mut libc::c_void) -> libc::c_int,
3164>;
3165pub type RedisModuleConfigGetNumericFunc = Option::<
3166    unsafe extern "C" fn(*const libc::c_char, *mut libc::c_void) -> libc::c_longlong,
3167>;
3168pub type RedisModuleConfigGetStringFunc = Option::<
3169    unsafe extern "C" fn(*const libc::c_char, *mut libc::c_void) -> *mut robj,
3170>;
3171#[derive(Copy, Clone)]
3172#[repr(C)]
3173pub struct configEnum {
3174    pub name: *mut libc::c_char,
3175    pub val: libc::c_int,
3176}
3177pub type configType = libc::c_uint;
3178pub const SPECIAL_CONFIG: configType = 5;
3179pub const ENUM_CONFIG: configType = 4;
3180pub const SDS_CONFIG: configType = 3;
3181pub const STRING_CONFIG: configType = 2;
3182pub const NUMERIC_CONFIG: configType = 1;
3183pub const BOOL_CONFIG: configType = 0;
3184#[derive(Copy, Clone)]
3185#[repr(C)]
3186pub struct EventLoopOneShot {
3187    pub func: RedisModuleEventLoopOneShotFunc,
3188    pub user_data: *mut libc::c_void,
3189}
3190#[derive(Copy, Clone)]
3191#[repr(C)]
3192pub struct EventLoopData {
3193    pub rFunc: RedisModuleEventLoopFunc,
3194    pub wFunc: RedisModuleEventLoopFunc,
3195    pub user_data: *mut libc::c_void,
3196}
3197pub type RedisModuleScanKeyCB = Option::<
3198    unsafe extern "C" fn(
3199        *mut RedisModuleKey,
3200        *mut robj,
3201        *mut robj,
3202        *mut libc::c_void,
3203    ) -> (),
3204>;
3205#[derive(Copy, Clone)]
3206#[repr(C)]
3207pub struct RedisModuleKey {
3208    pub ctx: *mut RedisModuleCtx,
3209    pub db: *mut redisDb,
3210    pub key: *mut robj,
3211    pub value: *mut robj,
3212    pub iter: *mut libc::c_void,
3213    pub mode: libc::c_int,
3214    pub u: C2RustUnnamed_20,
3215}
3216#[derive(Copy, Clone)]
3217#[repr(C)]
3218pub union C2RustUnnamed_20 {
3219    pub list: C2RustUnnamed_23,
3220    pub zset: C2RustUnnamed_22,
3221    pub stream: C2RustUnnamed_21,
3222}
3223#[derive(Copy, Clone)]
3224#[repr(C)]
3225pub struct C2RustUnnamed_21 {
3226    pub currentid: streamID,
3227    pub numfieldsleft: int64_t,
3228    pub signalready: libc::c_int,
3229}
3230#[derive(Copy, Clone)]
3231#[repr(C)]
3232pub struct C2RustUnnamed_22 {
3233    pub type_0: uint32_t,
3234    pub rs: zrangespec,
3235    pub lrs: zlexrangespec,
3236    pub start: uint32_t,
3237    pub end: uint32_t,
3238    pub current: *mut libc::c_void,
3239    pub er: libc::c_int,
3240}
3241#[derive(Copy, Clone)]
3242#[repr(C)]
3243pub struct zlexrangespec {
3244    pub min: sds,
3245    pub max: sds,
3246    pub minex: libc::c_int,
3247    pub maxex: libc::c_int,
3248}
3249#[derive(Copy, Clone)]
3250#[repr(C)]
3251pub struct zrangespec {
3252    pub min: libc::c_double,
3253    pub max: libc::c_double,
3254    pub minex: libc::c_int,
3255    pub maxex: libc::c_int,
3256}
3257#[derive(Copy, Clone)]
3258#[repr(C)]
3259pub struct C2RustUnnamed_23 {
3260    pub entry: listTypeEntry,
3261    pub index: libc::c_long,
3262}
3263#[derive(Copy, Clone)]
3264#[repr(C)]
3265pub struct RedisModuleScanCursor {
3266    pub cursor: libc::c_ulong,
3267    pub done: libc::c_int,
3268}
3269#[derive(Copy, Clone)]
3270#[repr(C)]
3271pub struct ScanKeyCBData {
3272    pub key: *mut RedisModuleKey,
3273    pub user_data: *mut libc::c_void,
3274    pub fn_0: RedisModuleScanKeyCB,
3275}
3276pub type RedisModuleScanCB = Option::<
3277    unsafe extern "C" fn(
3278        *mut RedisModuleCtx,
3279        *mut robj,
3280        *mut RedisModuleKey,
3281        *mut libc::c_void,
3282    ) -> (),
3283>;
3284#[derive(Copy, Clone)]
3285#[repr(C)]
3286pub struct ScanCBData {
3287    pub ctx: *mut RedisModuleCtx,
3288    pub user_data: *mut libc::c_void,
3289    pub fn_0: RedisModuleScanCB,
3290}
3291#[derive(Copy, Clone)]
3292#[repr(C)]
3293pub struct RedisModuleDict {
3294    pub rax: *mut rax,
3295}
3296#[derive(Copy, Clone)]
3297#[repr(C)]
3298pub struct RedisModuleEventListener {
3299    pub module: *mut RedisModule,
3300    pub event: RedisModuleEvent,
3301    pub callback: RedisModuleEventCallback,
3302}
3303#[derive(Copy, Clone)]
3304#[repr(C)]
3305pub struct RedisModuleServerInfoData {
3306    pub rax: *mut rax,
3307}
3308#[derive(Copy, Clone)]
3309#[repr(C)]
3310pub struct RedisModuleForkInfo {
3311    pub done_handler: RedisModuleForkDoneHandler,
3312    pub done_handler_user_data: *mut libc::c_void,
3313}
3314pub type RedisModuleForkDoneHandler = Option::<
3315    unsafe extern "C" fn(libc::c_int, libc::c_int, *mut libc::c_void) -> (),
3316>;
3317#[derive(Copy, Clone)]
3318#[repr(C)]
3319pub struct RedisModuleCommandFilterCtx {
3320    pub argv: *mut *mut robj,
3321    pub argv_len: libc::c_int,
3322    pub argc: libc::c_int,
3323}
3324#[derive(Copy, Clone)]
3325#[repr(C)]
3326pub struct RedisModuleCommandFilter {
3327    pub module: *mut RedisModule,
3328    pub callback: RedisModuleCommandFilterFunc,
3329    pub flags: libc::c_int,
3330}
3331pub type RedisModuleCommandFilterFunc = Option::<
3332    unsafe extern "C" fn(*mut RedisModuleCommandFilterCtx) -> (),
3333>;
3334#[derive(Copy, Clone)]
3335#[repr(C)]
3336pub struct RedisModuleSharedAPI {
3337    pub func: *mut libc::c_void,
3338    pub module: *mut RedisModule,
3339}
3340#[derive(Copy, Clone)]
3341#[repr(C)]
3342pub struct RedisModuleDictIter {
3343    pub dict: *mut RedisModuleDict,
3344    pub ri: raxIterator,
3345}
3346#[derive(Copy, Clone)]
3347#[repr(C)]
3348pub struct RedisModuleTimer {
3349    pub module: *mut RedisModule,
3350    pub callback: RedisModuleTimerProc,
3351    pub data: *mut libc::c_void,
3352    pub dbid: libc::c_int,
3353}
3354pub type RedisModuleTimerProc = Option::<
3355    unsafe extern "C" fn(*mut RedisModuleCtx, *mut libc::c_void) -> (),
3356>;
3357pub type RedisModuleCallReply = CallReply;
3358pub type RedisModuleClusterMessageReceiver = Option::<
3359    unsafe extern "C" fn(
3360        *mut RedisModuleCtx,
3361        *const libc::c_char,
3362        uint8_t,
3363        *const libc::c_uchar,
3364        uint32_t,
3365    ) -> (),
3366>;
3367#[derive(Copy, Clone)]
3368#[repr(C)]
3369pub struct moduleClusterReceiver {
3370    pub module_id: uint64_t,
3371    pub callback: RedisModuleClusterMessageReceiver,
3372    pub module: *mut RedisModule,
3373    pub next: *mut moduleClusterReceiver,
3374}
3375pub type RedisModuleNotificationFunc = Option::<
3376    unsafe extern "C" fn(
3377        *mut RedisModuleCtx,
3378        libc::c_int,
3379        *const libc::c_char,
3380        *mut robj,
3381    ) -> libc::c_int,
3382>;
3383#[derive(Copy, Clone)]
3384#[repr(C)]
3385pub struct RedisModuleKeyspaceSubscriber {
3386    pub module: *mut RedisModule,
3387    pub notify_callback: RedisModuleNotificationFunc,
3388    pub event_mask: libc::c_int,
3389    pub active: libc::c_int,
3390}
3391#[derive(Copy, Clone)]
3392#[repr(C)]
3393pub union C2RustUnnamed_24 {
3394    pub u: uint64_t,
3395    pub i: int64_t,
3396}
3397#[derive(Copy, Clone)]
3398#[repr(C)]
3399pub union C2RustUnnamed_25 {
3400    pub u: uint64_t,
3401    pub i: int64_t,
3402}
3403#[derive(Copy, Clone)]
3404#[repr(C)]
3405pub struct C2RustUnnamed_26 {
3406    pub mem_usage2: moduleTypeMemUsageFunc2,
3407    pub free_effort2: moduleTypeFreeEffortFunc2,
3408    pub unlink2: moduleTypeUnlinkFunc2,
3409    pub copy2: moduleTypeCopyFunc2,
3410}
3411#[derive(Copy, Clone)]
3412#[repr(C)]
3413pub struct typemethods {
3414    pub version: uint64_t,
3415    pub rdb_load: moduleTypeLoadFunc,
3416    pub rdb_save: moduleTypeSaveFunc,
3417    pub aof_rewrite: moduleTypeRewriteFunc,
3418    pub mem_usage: moduleTypeMemUsageFunc,
3419    pub digest: moduleTypeDigestFunc,
3420    pub free: moduleTypeFreeFunc,
3421    pub v2: C2RustUnnamed_28,
3422    pub v3: C2RustUnnamed_27,
3423    pub v4: C2RustUnnamed_26,
3424}
3425#[derive(Copy, Clone)]
3426#[repr(C)]
3427pub struct C2RustUnnamed_27 {
3428    pub free_effort: moduleTypeFreeEffortFunc,
3429    pub unlink: moduleTypeUnlinkFunc,
3430    pub copy: moduleTypeCopyFunc,
3431    pub defrag: moduleTypeDefragFunc,
3432}
3433#[derive(Copy, Clone)]
3434#[repr(C)]
3435pub struct C2RustUnnamed_28 {
3436    pub aux_load: moduleTypeAuxLoadFunc,
3437    pub aux_save: moduleTypeAuxSaveFunc,
3438    pub aux_save_triggers: libc::c_int,
3439}
3440#[derive(Copy, Clone)]
3441#[repr(C)]
3442pub struct C2RustUnnamed_29 {
3443    pub id: uint64_t,
3444    pub mt: *mut moduleType,
3445}
3446#[inline]
3447unsafe extern "C" fn sdslen(s: sds) -> size_t {
3448    let mut flags: libc::c_uchar = *s.offset(-(1 as libc::c_int) as isize)
3449        as libc::c_uchar;
3450    match flags as libc::c_int & 7 as libc::c_int {
3451        0 => return (flags as libc::c_int >> 3 as libc::c_int) as size_t,
3452        1 => {
3453            return (*(s
3454                .offset(-(core::mem::size_of::<sdshdr8>() as libc::c_ulong as isize))
3455                as *mut sdshdr8))
3456                .len as size_t;
3457        }
3458        2 => {
3459            return (*(s
3460                .offset(-(core::mem::size_of::<sdshdr16>() as libc::c_ulong as isize))
3461                as *mut sdshdr16))
3462                .len as size_t;
3463        }
3464        3 => {
3465            return (*(s
3466                .offset(-(core::mem::size_of::<sdshdr32>() as libc::c_ulong as isize))
3467                as *mut sdshdr32))
3468                .len as size_t;
3469        }
3470        4 => {
3471            return (*(s
3472                .offset(-(core::mem::size_of::<sdshdr64>() as libc::c_ulong as isize))
3473                as *mut sdshdr64))
3474                .len;
3475        }
3476        _ => {}
3477    }
3478    return 0 as libc::c_int as size_t;
3479}
3480#[inline]
3481unsafe extern "C" fn sdsavail(s: sds) -> size_t {
3482    let mut flags: libc::c_uchar = *s.offset(-(1 as libc::c_int) as isize)
3483        as libc::c_uchar;
3484    match flags as libc::c_int & 7 as libc::c_int {
3485        0 => return 0 as libc::c_int as size_t,
3486        1 => {
3487            let mut sh: *mut sdshdr8 = s
3488                .offset(-(core::mem::size_of::<sdshdr8>() as libc::c_ulong as isize))
3489                as *mut libc::c_void as *mut sdshdr8;
3490            return ((*sh).alloc as libc::c_int - (*sh).len as libc::c_int) as size_t;
3491        }
3492        2 => {
3493            let mut sh_0: *mut sdshdr16 = s
3494                .offset(-(core::mem::size_of::<sdshdr16>() as libc::c_ulong as isize))
3495                as *mut libc::c_void as *mut sdshdr16;
3496            return ((*sh_0).alloc as libc::c_int - (*sh_0).len as libc::c_int) as size_t;
3497        }
3498        3 => {
3499            let mut sh_1: *mut sdshdr32 = s
3500                .offset(-(core::mem::size_of::<sdshdr32>() as libc::c_ulong as isize))
3501                as *mut libc::c_void as *mut sdshdr32;
3502            return ((*sh_1).alloc).wrapping_sub((*sh_1).len) as size_t;
3503        }
3504        4 => {
3505            let mut sh_2: *mut sdshdr64 = s
3506                .offset(-(core::mem::size_of::<sdshdr64>() as libc::c_ulong as isize))
3507                as *mut libc::c_void as *mut sdshdr64;
3508            return ((*sh_2).alloc).wrapping_sub((*sh_2).len);
3509        }
3510        _ => {}
3511    }
3512    return 0 as libc::c_int as size_t;
3513}
3514#[inline]
3515unsafe extern "C" fn connGetType(mut conn: *mut connection) -> libc::c_int {
3516    return ((*(*conn).type_0).get_type).expect("non-null function pointer")(conn);
3517}
3518#[inline]
3519unsafe extern "C" fn elapsedStart(mut start_time: *mut monotime) {
3520    *start_time = getMonotonicUs.expect("non-null function pointer")();
3521}
3522#[inline]
3523unsafe extern "C" fn elapsedUs(mut start_time: monotime) -> uint64_t {
3524    return (getMonotonicUs.expect("non-null function pointer")())
3525        .wrapping_sub(start_time);
3526}
3527#[inline]
3528unsafe extern "C" fn stat(
3529    mut __path: *const libc::c_char,
3530    mut __statbuf: *mut stat,
3531) -> libc::c_int {
3532    return __xstat(0 as libc::c_int, __path, __statbuf);
3533}
3534#[no_mangle]
3535pub static mut modules: *mut dict = 0 as *const dict as *mut dict;
3536static mut moduleUnblockedClientsMutex: pthread_mutex_t = pthread_mutex_t {
3537    __data: {
3538        let mut init = __pthread_mutex_s {
3539            __lock: 0 as libc::c_int,
3540            __count: 0 as libc::c_int as libc::c_uint,
3541            __owner: 0 as libc::c_int,
3542            __nusers: 0 as libc::c_int as libc::c_uint,
3543            __kind: PTHREAD_MUTEX_TIMED_NP as libc::c_int,
3544            __spins: 0 as libc::c_int,
3545            __list: {
3546                let mut init = __pthread_internal_list {
3547                    __prev: 0 as *const __pthread_internal_list
3548                        as *mut __pthread_internal_list,
3549                    __next: 0 as *const __pthread_internal_list
3550                        as *mut __pthread_internal_list,
3551                };
3552                init
3553            },
3554        };
3555        init
3556    },
3557};
3558static mut moduleUnblockedClients: *mut list = 0 as *const list as *mut list;
3559static mut moduleTempClients: *mut *mut client = 0 as *const *mut client
3560    as *mut *mut client;
3561static mut moduleTempClientCap: size_t = 0 as libc::c_int as size_t;
3562static mut moduleTempClientCount: size_t = 0 as libc::c_int as size_t;
3563static mut moduleTempClientMinCount: size_t = 0 as libc::c_int as size_t;
3564static mut moduleGIL: pthread_mutex_t = pthread_mutex_t {
3565    __data: {
3566        let mut init = __pthread_mutex_s {
3567            __lock: 0 as libc::c_int,
3568            __count: 0 as libc::c_int as libc::c_uint,
3569            __owner: 0 as libc::c_int,
3570            __nusers: 0 as libc::c_int as libc::c_uint,
3571            __kind: PTHREAD_MUTEX_TIMED_NP as libc::c_int,
3572            __spins: 0 as libc::c_int,
3573            __list: {
3574                let mut init = __pthread_internal_list {
3575                    __prev: 0 as *const __pthread_internal_list
3576                        as *mut __pthread_internal_list,
3577                    __next: 0 as *const __pthread_internal_list
3578                        as *mut __pthread_internal_list,
3579                };
3580                init
3581            },
3582        };
3583        init
3584    },
3585};
3586static mut moduleKeyspaceSubscribers: *mut list = 0 as *const list as *mut list;
3587static mut moduleCommandFilters: *mut list = 0 as *const list as *mut list;
3588static mut moduleForkInfo: RedisModuleForkInfo = {
3589    let mut init = RedisModuleForkInfo {
3590        done_handler: None,
3591        done_handler_user_data: 0 as *const libc::c_void as *mut libc::c_void,
3592    };
3593    init
3594};
3595#[no_mangle]
3596pub static mut RedisModule_EventListeners: *mut list = 0 as *const list as *mut list;
3597#[no_mangle]
3598pub unsafe extern "C" fn RM_Alloc(mut bytes: size_t) -> *mut libc::c_void {
3599    return zmalloc(bytes);
3600}
3601#[no_mangle]
3602pub unsafe extern "C" fn RM_TryAlloc(mut bytes: size_t) -> *mut libc::c_void {
3603    return ztrymalloc(bytes);
3604}
3605#[no_mangle]
3606pub unsafe extern "C" fn RM_Calloc(
3607    mut nmemb: size_t,
3608    mut size: size_t,
3609) -> *mut libc::c_void {
3610    return zcalloc(nmemb.wrapping_mul(size));
3611}
3612#[no_mangle]
3613pub unsafe extern "C" fn RM_Realloc(
3614    mut ptr: *mut libc::c_void,
3615    mut bytes: size_t,
3616) -> *mut libc::c_void {
3617    return zrealloc(ptr, bytes);
3618}
3619#[no_mangle]
3620pub unsafe extern "C" fn RM_Free(mut ptr: *mut libc::c_void) {
3621    zfree(ptr);
3622}
3623#[no_mangle]
3624pub unsafe extern "C" fn RM_Strdup(mut str: *const libc::c_char) -> *mut libc::c_char {
3625    return zstrdup(str);
3626}
3627#[no_mangle]
3628pub unsafe extern "C" fn poolAllocRelease(mut ctx: *mut RedisModuleCtx) {
3629    let mut head: *mut RedisModulePoolAllocBlock = (*ctx).pa_head;
3630    let mut next: *mut RedisModulePoolAllocBlock = 0 as *mut RedisModulePoolAllocBlock;
3631    while !head.is_null() {
3632        next = (*head).next;
3633        zfree(head as *mut libc::c_void);
3634        head = next;
3635    }
3636    (*ctx).pa_head = 0 as *mut RedisModulePoolAllocBlock;
3637}
3638#[no_mangle]
3639pub unsafe extern "C" fn RM_PoolAlloc(
3640    mut ctx: *mut RedisModuleCtx,
3641    mut bytes: size_t,
3642) -> *mut libc::c_void {
3643    if bytes == 0 as libc::c_int as libc::c_ulong {
3644        return 0 as *mut libc::c_void;
3645    }
3646    let mut b: *mut RedisModulePoolAllocBlock = (*ctx).pa_head;
3647    let mut left: size_t = (if !b.is_null() {
3648        ((*b).size).wrapping_sub((*b).used)
3649    } else {
3650        0 as libc::c_int as libc::c_uint
3651    }) as size_t;
3652    if left >= bytes {
3653        let mut alignment: size_t = core::mem::size_of::<*mut libc::c_void>()
3654            as libc::c_ulong;
3655        while bytes < alignment
3656            && alignment.wrapping_div(2 as libc::c_int as libc::c_ulong) >= bytes
3657        {
3658            alignment = (alignment as libc::c_ulong)
3659                .wrapping_div(2 as libc::c_int as libc::c_ulong) as size_t as size_t;
3660        }
3661        if ((*b).used as libc::c_ulong).wrapping_rem(alignment) != 0 {
3662            (*b)
3663                .used = ((*b).used as libc::c_ulong)
3664                .wrapping_add(
3665                    alignment
3666                        .wrapping_sub(
3667                            ((*b).used as libc::c_ulong).wrapping_rem(alignment),
3668                        ),
3669                ) as uint32_t as uint32_t;
3670        }
3671        left = (if (*b).used > (*b).size {
3672            0 as libc::c_int as libc::c_uint
3673        } else {
3674            ((*b).size).wrapping_sub((*b).used)
3675        }) as size_t;
3676    }
3677    if left < bytes {
3678        let mut blocksize: size_t = (1024 as libc::c_int * 8 as libc::c_int) as size_t;
3679        if blocksize < bytes {
3680            blocksize = bytes;
3681        }
3682        b = zmalloc(
3683            (core::mem::size_of::<RedisModulePoolAllocBlock>() as libc::c_ulong)
3684                .wrapping_add(blocksize),
3685        ) as *mut RedisModulePoolAllocBlock;
3686        (*b).size = blocksize as uint32_t;
3687        (*b).used = 0 as libc::c_int as uint32_t;
3688        (*b).next = (*ctx).pa_head;
3689        (*ctx).pa_head = b;
3690    }
3691    let mut retval: *mut libc::c_char = ((*b).memory)
3692        .as_mut_ptr()
3693        .offset((*b).used as isize);
3694    (*b).used = ((*b).used as libc::c_ulong).wrapping_add(bytes) as uint32_t as uint32_t;
3695    return retval as *mut libc::c_void;
3696}
3697#[no_mangle]
3698pub unsafe extern "C" fn moduleAllocTempClient(mut user: *mut user) -> *mut client {
3699    let mut c: *mut client = 0 as *mut client;
3700    if moduleTempClientCount > 0 as libc::c_int as libc::c_ulong {
3701        moduleTempClientCount = moduleTempClientCount.wrapping_sub(1);
3702        c = *moduleTempClients.offset(moduleTempClientCount as isize);
3703        if moduleTempClientCount < moduleTempClientMinCount {
3704            moduleTempClientMinCount = moduleTempClientCount;
3705        }
3706    } else {
3707        c = createClient(0 as *mut connection);
3708        (*c).flags |= ((1 as libc::c_int) << 27 as libc::c_int) as libc::c_ulong;
3709    }
3710    (*c).user = user;
3711    return c;
3712}
3713#[no_mangle]
3714pub unsafe extern "C" fn moduleReleaseTempClient(mut c: *mut client) {
3715    if moduleTempClientCount == moduleTempClientCap {
3716        moduleTempClientCap = if moduleTempClientCap != 0 {
3717            moduleTempClientCap.wrapping_mul(2 as libc::c_int as libc::c_ulong)
3718        } else {
3719            32 as libc::c_int as libc::c_ulong
3720        };
3721        moduleTempClients = zrealloc(
3722            moduleTempClients as *mut libc::c_void,
3723            (core::mem::size_of::<*mut client>() as libc::c_ulong)
3724                .wrapping_mul(moduleTempClientCap),
3725        ) as *mut *mut client;
3726    }
3727    clearClientConnectionState(c);
3728    listEmpty((*c).reply);
3729    (*c).reply_bytes = 0 as libc::c_int as libc::c_ulonglong;
3730    resetClient(c);
3731    (*c).bufpos = 0 as libc::c_int;
3732    (*c).flags = ((1 as libc::c_int) << 27 as libc::c_int) as uint64_t;
3733    (*c).user = 0 as *mut user;
3734    (*c).realcmd = 0 as *mut redisCommand;
3735    (*c).lastcmd = (*c).realcmd;
3736    (*c).cmd = (*c).lastcmd;
3737    let fresh0 = moduleTempClientCount;
3738    moduleTempClientCount = moduleTempClientCount.wrapping_add(1);
3739    let ref mut fresh1 = *moduleTempClients.offset(fresh0 as isize);
3740    *fresh1 = c;
3741}
3742#[no_mangle]
3743pub unsafe extern "C" fn moduleCreateEmptyKey(
3744    mut key: *mut RedisModuleKey,
3745    mut type_0: libc::c_int,
3746) -> libc::c_int {
3747    let mut obj: *mut robj = 0 as *mut robj;
3748    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
3749        || !((*key).value).is_null()
3750    {
3751        return 1 as libc::c_int;
3752    }
3753    match type_0 {
3754        2 => {
3755            obj = createQuicklistObject();
3756            quicklistSetOptions(
3757                (*obj).ptr as *mut quicklist,
3758                server.list_max_listpack_size,
3759                server.list_compress_depth,
3760            );
3761        }
3762        5 => {
3763            obj = createZsetListpackObject();
3764        }
3765        3 => {
3766            obj = createHashObject();
3767        }
3768        7 => {
3769            obj = createStreamObject();
3770        }
3771        _ => return 1 as libc::c_int,
3772    }
3773    dbAdd((*key).db, (*key).key, obj);
3774    (*key).value = obj;
3775    moduleInitKeyTypeSpecific(key);
3776    return 0 as libc::c_int;
3777}
3778unsafe extern "C" fn moduleFreeKeyIterator(mut key: *mut RedisModuleKey) {
3779    if !((*key).iter).is_null() {} else {
3780        _serverAssert(
3781            b"key->iter != NULL\0" as *const u8 as *const libc::c_char,
3782            b"module.c\0" as *const u8 as *const libc::c_char,
3783            650 as libc::c_int,
3784        );
3785        unreachable!();
3786    };
3787    match (*(*key).value).type_0() as libc::c_int {
3788        1 => {
3789            listTypeReleaseIterator((*key).iter as *mut listTypeIterator);
3790        }
3791        6 => {
3792            streamIteratorStop((*key).iter as *mut streamIterator);
3793            zfree((*key).iter);
3794        }
3795        _ => {
3796            if 0 as libc::c_int != 0 {} else {
3797                _serverAssert(
3798                    b"0\0" as *const u8 as *const libc::c_char,
3799                    b"module.c\0" as *const u8 as *const libc::c_char,
3800                    657 as libc::c_int,
3801                );
3802                unreachable!();
3803            };
3804        }
3805    }
3806    (*key).iter = 0 as *mut libc::c_void;
3807}
3808#[no_mangle]
3809pub unsafe extern "C" fn moduleDelKeyIfEmpty(
3810    mut key: *mut RedisModuleKey,
3811) -> libc::c_int {
3812    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
3813        || ((*key).value).is_null()
3814    {
3815        return 0 as libc::c_int;
3816    }
3817    let mut isempty: libc::c_int = 0;
3818    let mut o: *mut robj = (*key).value;
3819    match (*o).type_0() as libc::c_int {
3820        1 => {
3821            isempty = (listTypeLength(o) == 0 as libc::c_int as libc::c_ulong)
3822                as libc::c_int;
3823        }
3824        2 => {
3825            isempty = (setTypeSize(o) == 0 as libc::c_int as libc::c_ulong)
3826                as libc::c_int;
3827        }
3828        3 => {
3829            isempty = (zsetLength(o) == 0 as libc::c_int as libc::c_ulong)
3830                as libc::c_int;
3831        }
3832        4 => {
3833            isempty = (hashTypeLength(o) == 0 as libc::c_int as libc::c_ulong)
3834                as libc::c_int;
3835        }
3836        6 => {
3837            isempty = (streamLength(o) == 0 as libc::c_int as libc::c_ulong)
3838                as libc::c_int;
3839        }
3840        _ => {
3841            isempty = 0 as libc::c_int;
3842        }
3843    }
3844    if isempty != 0 {
3845        if !((*key).iter).is_null() {
3846            moduleFreeKeyIterator(key);
3847        }
3848        dbDelete((*key).db, (*key).key);
3849        (*key).value = 0 as *mut robj;
3850        return 1 as libc::c_int;
3851    } else {
3852        return 0 as libc::c_int
3853    };
3854}
3855#[no_mangle]
3856pub unsafe extern "C" fn RM_GetApi(
3857    mut funcname: *const libc::c_char,
3858    mut targetPtrPtr: *mut *mut libc::c_void,
3859) -> libc::c_int {
3860    let mut he: *mut dictEntry = dictFind(
3861        server.moduleapi,
3862        funcname as *const libc::c_void,
3863    );
3864    if he.is_null() {
3865        return 1 as libc::c_int;
3866    }
3867    *targetPtrPtr = (*he).v.val;
3868    return 0 as libc::c_int;
3869}
3870#[no_mangle]
3871pub unsafe extern "C" fn moduleFreeContext(mut ctx: *mut RedisModuleCtx) {
3872    if (*ctx).flags & (1 as libc::c_int) << 4 as libc::c_int == 0 {
3873        server.module_ctx_nesting -= 1;
3874        if server.module_ctx_nesting == 0 as libc::c_int {
3875            if server.core_propagates == 0 {
3876                propagatePendingCommands();
3877            }
3878            if server.busy_module_yield_flags != 0 {
3879                blockingOperationEnds();
3880                server.busy_module_yield_flags = 0 as libc::c_int;
3881                if !(server.current_client).is_null() {
3882                    unprotectClient(server.current_client);
3883                }
3884                unblockPostponedClients();
3885            }
3886        }
3887    }
3888    autoMemoryCollect(ctx);
3889    poolAllocRelease(ctx);
3890    if !((*ctx).postponed_arrays).is_null() {
3891        zfree((*ctx).postponed_arrays as *mut libc::c_void);
3892        (*ctx).postponed_arrays_count = 0 as libc::c_int;
3893        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
3894            _serverLog(
3895                3 as libc::c_int,
3896                b"API misuse detected in module %s: RedisModule_ReplyWith*(REDISMODULE_POSTPONED_LEN) not matched by the same number of RedisModule_SetReply*Len() calls.\0"
3897                    as *const u8 as *const libc::c_char,
3898                (*(*ctx).module).name,
3899            );
3900        }
3901    }
3902    if (*ctx).flags & (1 as libc::c_int) << 6 as libc::c_int != 0 {
3903        moduleReleaseTempClient((*ctx).client);
3904    } else if (*ctx).flags & (1 as libc::c_int) << 7 as libc::c_int != 0 {
3905        freeClient((*ctx).client);
3906    }
3907}
3908#[no_mangle]
3909pub unsafe extern "C" fn moduleCreateContext(
3910    mut out_ctx: *mut RedisModuleCtx,
3911    mut module: *mut RedisModule,
3912    mut ctx_flags: libc::c_int,
3913) {
3914    memset(
3915        out_ctx as *mut libc::c_void,
3916        0 as libc::c_int,
3917        core::mem::size_of::<RedisModuleCtx>() as libc::c_ulong,
3918    );
3919    (*out_ctx)
3920        .getapifuncptr = core::mem::transmute::<
3921        Option::<
3922            unsafe extern "C" fn(
3923                *const libc::c_char,
3924                *mut *mut libc::c_void,
3925            ) -> libc::c_int,
3926        >,
3927        libc::c_ulong,
3928    >(
3929        Some(
3930            RM_GetApi
3931                as unsafe extern "C" fn(
3932                    *const libc::c_char,
3933                    *mut *mut libc::c_void,
3934                ) -> libc::c_int,
3935        ),
3936    ) as *mut libc::c_void;
3937    (*out_ctx).module = module;
3938    (*out_ctx).flags = ctx_flags;
3939    if ctx_flags & (1 as libc::c_int) << 6 as libc::c_int != 0 {
3940        (*out_ctx).client = moduleAllocTempClient(0 as *mut user);
3941    } else if ctx_flags & (1 as libc::c_int) << 7 as libc::c_int != 0 {
3942        (*out_ctx).client = createClient(0 as *mut connection);
3943    }
3944    if server.loading != 0 {
3945        (*out_ctx)
3946            .next_yield_time = (getMonotonicUs.expect("non-null function pointer")())
3947            .wrapping_add((1000000 as libc::c_int / server.hz) as libc::c_ulong)
3948            as libc::c_longlong;
3949    } else {
3950        (*out_ctx)
3951            .next_yield_time = (getMonotonicUs.expect("non-null function pointer")()
3952            as libc::c_ulonglong)
3953            .wrapping_add(
3954                (server.busy_reply_threshold * 1000 as libc::c_int as libc::c_longlong)
3955                    as libc::c_ulonglong,
3956            ) as libc::c_longlong;
3957    }
3958    if ctx_flags & (1 as libc::c_int) << 4 as libc::c_int == 0 {
3959        server.module_ctx_nesting += 1;
3960    }
3961}
3962#[no_mangle]
3963pub unsafe extern "C" fn RedisModuleCommandDispatcher(mut c: *mut client) {
3964    let mut cp: *mut RedisModuleCommand = (*(*c).cmd).module_cmd;
3965    let mut ctx: RedisModuleCtx = RedisModuleCtx {
3966        getapifuncptr: 0 as *mut libc::c_void,
3967        module: 0 as *mut RedisModule,
3968        client: 0 as *mut client,
3969        blocked_client: 0 as *mut RedisModuleBlockedClient,
3970        amqueue: 0 as *mut AutoMemEntry,
3971        amqueue_len: 0,
3972        amqueue_used: 0,
3973        flags: 0,
3974        postponed_arrays: 0 as *mut *mut libc::c_void,
3975        postponed_arrays_count: 0,
3976        blocked_privdata: 0 as *mut libc::c_void,
3977        blocked_ready_key: 0 as *mut robj,
3978        keys_result: 0 as *mut getKeysResult,
3979        pa_head: 0 as *mut RedisModulePoolAllocBlock,
3980        next_yield_time: 0,
3981        user: 0 as *const RedisModuleUser,
3982    };
3983    moduleCreateContext(&mut ctx, (*cp).module, 0 as libc::c_int);
3984    ctx.client = c;
3985    ((*cp).func)
3986        .expect(
3987            "non-null function pointer",
3988        )(&mut ctx, (*c).argv as *mut *mut libc::c_void, (*c).argc);
3989    moduleFreeContext(&mut ctx);
3990    let mut i: libc::c_int = 0 as libc::c_int;
3991    while i < (*c).argc {
3992        if (**((*c).argv).offset(i as isize)).refcount > 1 as libc::c_int {
3993            trimStringObjectIfNeeded(*((*c).argv).offset(i as isize));
3994        }
3995        i += 1;
3996    }
3997}
3998#[no_mangle]
3999pub unsafe extern "C" fn moduleGetCommandKeysViaAPI(
4000    mut cmd: *mut redisCommand,
4001    mut argv: *mut *mut robj,
4002    mut argc: libc::c_int,
4003    mut result: *mut getKeysResult,
4004) -> libc::c_int {
4005    let mut cp: *mut RedisModuleCommand = (*cmd).module_cmd;
4006    let mut ctx: RedisModuleCtx = RedisModuleCtx {
4007        getapifuncptr: 0 as *mut libc::c_void,
4008        module: 0 as *mut RedisModule,
4009        client: 0 as *mut client,
4010        blocked_client: 0 as *mut RedisModuleBlockedClient,
4011        amqueue: 0 as *mut AutoMemEntry,
4012        amqueue_len: 0,
4013        amqueue_used: 0,
4014        flags: 0,
4015        postponed_arrays: 0 as *mut *mut libc::c_void,
4016        postponed_arrays_count: 0,
4017        blocked_privdata: 0 as *mut libc::c_void,
4018        blocked_ready_key: 0 as *mut robj,
4019        keys_result: 0 as *mut getKeysResult,
4020        pa_head: 0 as *mut RedisModulePoolAllocBlock,
4021        next_yield_time: 0,
4022        user: 0 as *const RedisModuleUser,
4023    };
4024    moduleCreateContext(&mut ctx, (*cp).module, (1 as libc::c_int) << 1 as libc::c_int);
4025    getKeysPrepareResult(result, 256 as libc::c_int);
4026    ctx.keys_result = result;
4027    ((*cp).func)
4028        .expect(
4029            "non-null function pointer",
4030        )(&mut ctx, argv as *mut *mut libc::c_void, argc);
4031    moduleFreeContext(&mut ctx);
4032    return (*result).numkeys;
4033}
4034#[no_mangle]
4035pub unsafe extern "C" fn moduleGetCommandChannelsViaAPI(
4036    mut cmd: *mut redisCommand,
4037    mut argv: *mut *mut robj,
4038    mut argc: libc::c_int,
4039    mut result: *mut getKeysResult,
4040) -> libc::c_int {
4041    let mut cp: *mut RedisModuleCommand = (*cmd).module_cmd;
4042    let mut ctx: RedisModuleCtx = RedisModuleCtx {
4043        getapifuncptr: 0 as *mut libc::c_void,
4044        module: 0 as *mut RedisModule,
4045        client: 0 as *mut client,
4046        blocked_client: 0 as *mut RedisModuleBlockedClient,
4047        amqueue: 0 as *mut AutoMemEntry,
4048        amqueue_len: 0,
4049        amqueue_used: 0,
4050        flags: 0,
4051        postponed_arrays: 0 as *mut *mut libc::c_void,
4052        postponed_arrays_count: 0,
4053        blocked_privdata: 0 as *mut libc::c_void,
4054        blocked_ready_key: 0 as *mut robj,
4055        keys_result: 0 as *mut getKeysResult,
4056        pa_head: 0 as *mut RedisModulePoolAllocBlock,
4057        next_yield_time: 0,
4058        user: 0 as *const RedisModuleUser,
4059    };
4060    moduleCreateContext(&mut ctx, (*cp).module, (1 as libc::c_int) << 8 as libc::c_int);
4061    getKeysPrepareResult(result, 256 as libc::c_int);
4062    ctx.keys_result = result;
4063    ((*cp).func)
4064        .expect(
4065            "non-null function pointer",
4066        )(&mut ctx, argv as *mut *mut libc::c_void, argc);
4067    moduleFreeContext(&mut ctx);
4068    return (*result).numkeys;
4069}
4070#[no_mangle]
4071pub unsafe extern "C" fn RM_IsKeysPositionRequest(
4072    mut ctx: *mut RedisModuleCtx,
4073) -> libc::c_int {
4074    return ((*ctx).flags & (1 as libc::c_int) << 1 as libc::c_int != 0 as libc::c_int)
4075        as libc::c_int;
4076}
4077#[no_mangle]
4078pub unsafe extern "C" fn RM_KeyAtPosWithFlags(
4079    mut ctx: *mut RedisModuleCtx,
4080    mut pos: libc::c_int,
4081    mut flags: libc::c_int,
4082) {
4083    if (*ctx).flags & (1 as libc::c_int) << 1 as libc::c_int == 0
4084        || ((*ctx).keys_result).is_null()
4085    {
4086        return;
4087    }
4088    if pos <= 0 as libc::c_int {
4089        return;
4090    }
4091    let mut res: *mut getKeysResult = (*ctx).keys_result;
4092    if (*res).numkeys == (*res).size {
4093        let mut newsize: libc::c_int = (*res).size
4094            + (if (*res).size > 8192 as libc::c_int {
4095                8192 as libc::c_int
4096            } else {
4097                (*res).size
4098            });
4099        getKeysPrepareResult(res, newsize);
4100    }
4101    (*((*res).keys).offset((*res).numkeys as isize)).pos = pos;
4102    (*((*res).keys).offset((*res).numkeys as isize))
4103        .flags = moduleConvertKeySpecsFlags(flags as int64_t, 1 as libc::c_int)
4104        as libc::c_int;
4105    (*res).numkeys += 1;
4106}
4107#[no_mangle]
4108pub unsafe extern "C" fn RM_KeyAtPos(
4109    mut ctx: *mut RedisModuleCtx,
4110    mut pos: libc::c_int,
4111) {
4112    let mut flags: libc::c_int = moduleConvertKeySpecsFlags(
4113        ((1 as libc::c_ulonglong) << 1 as libc::c_int
4114            | (1 as libc::c_ulonglong) << 4 as libc::c_int
4115            | (1 as libc::c_ulonglong) << 5 as libc::c_int) as int64_t,
4116        0 as libc::c_int,
4117    ) as libc::c_int;
4118    RM_KeyAtPosWithFlags(ctx, pos, flags);
4119}
4120#[no_mangle]
4121pub unsafe extern "C" fn RM_IsChannelsPositionRequest(
4122    mut ctx: *mut RedisModuleCtx,
4123) -> libc::c_int {
4124    return ((*ctx).flags & (1 as libc::c_int) << 8 as libc::c_int != 0 as libc::c_int)
4125        as libc::c_int;
4126}
4127#[no_mangle]
4128pub unsafe extern "C" fn RM_ChannelAtPosWithFlags(
4129    mut ctx: *mut RedisModuleCtx,
4130    mut pos: libc::c_int,
4131    mut flags: libc::c_int,
4132) {
4133    if (*ctx).flags & (1 as libc::c_int) << 8 as libc::c_int == 0
4134        || ((*ctx).keys_result).is_null()
4135    {
4136        return;
4137    }
4138    if pos <= 0 as libc::c_int {
4139        return;
4140    }
4141    let mut res: *mut getKeysResult = (*ctx).keys_result;
4142    if (*res).numkeys == (*res).size {
4143        let mut newsize: libc::c_int = (*res).size
4144            + (if (*res).size > 8192 as libc::c_int {
4145                8192 as libc::c_int
4146            } else {
4147                (*res).size
4148            });
4149        getKeysPrepareResult(res, newsize);
4150    }
4151    let mut new_flags: libc::c_int = 0 as libc::c_int;
4152    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 2 as libc::c_int != 0 {
4153        new_flags = (new_flags as libc::c_ulonglong
4154            | (1 as libc::c_ulonglong) << 12 as libc::c_int) as libc::c_int;
4155    }
4156    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 3 as libc::c_int != 0 {
4157        new_flags = (new_flags as libc::c_ulonglong
4158            | (1 as libc::c_ulonglong) << 13 as libc::c_int) as libc::c_int;
4159    }
4160    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 1 as libc::c_int != 0 {
4161        new_flags = (new_flags as libc::c_ulonglong
4162            | (1 as libc::c_ulonglong) << 14 as libc::c_int) as libc::c_int;
4163    }
4164    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 0 as libc::c_int != 0 {
4165        new_flags = (new_flags as libc::c_ulonglong
4166            | (1 as libc::c_ulonglong) << 11 as libc::c_int) as libc::c_int;
4167    }
4168    (*((*res).keys).offset((*res).numkeys as isize)).pos = pos;
4169    (*((*res).keys).offset((*res).numkeys as isize)).flags = new_flags;
4170    (*res).numkeys += 1;
4171}
4172#[no_mangle]
4173pub unsafe extern "C" fn commandFlagsFromString(mut s: *mut libc::c_char) -> int64_t {
4174    let mut count: libc::c_int = 0;
4175    let mut j: libc::c_int = 0;
4176    let mut flags: int64_t = 0 as libc::c_int as int64_t;
4177    let mut tokens: *mut sds = sdssplitlen(
4178        s,
4179        strlen(s) as ssize_t,
4180        b" \0" as *const u8 as *const libc::c_char,
4181        1 as libc::c_int,
4182        &mut count,
4183    );
4184    j = 0 as libc::c_int;
4185    while j < count {
4186        let mut t: *mut libc::c_char = *tokens.offset(j as isize);
4187        if strcasecmp(t, b"write\0" as *const u8 as *const libc::c_char) == 0 {
4188            flags = (flags as libc::c_ulonglong
4189                | (1 as libc::c_ulonglong) << 0 as libc::c_int) as int64_t;
4190        } else if strcasecmp(t, b"readonly\0" as *const u8 as *const libc::c_char) == 0 {
4191            flags = (flags as libc::c_ulonglong
4192                | (1 as libc::c_ulonglong) << 1 as libc::c_int) as int64_t;
4193        } else if strcasecmp(t, b"admin\0" as *const u8 as *const libc::c_char) == 0 {
4194            flags = (flags as libc::c_ulonglong
4195                | (1 as libc::c_ulonglong) << 4 as libc::c_int) as int64_t;
4196        } else if strcasecmp(t, b"deny-oom\0" as *const u8 as *const libc::c_char) == 0 {
4197            flags = (flags as libc::c_ulonglong
4198                | (1 as libc::c_ulonglong) << 2 as libc::c_int) as int64_t;
4199        } else if strcasecmp(t, b"deny-script\0" as *const u8 as *const libc::c_char)
4200            == 0
4201        {
4202            flags = (flags as libc::c_ulonglong
4203                | (1 as libc::c_ulonglong) << 6 as libc::c_int) as int64_t;
4204        } else if strcasecmp(t, b"allow-loading\0" as *const u8 as *const libc::c_char)
4205            == 0
4206        {
4207            flags = (flags as libc::c_ulonglong
4208                | (1 as libc::c_ulonglong) << 9 as libc::c_int) as int64_t;
4209        } else if strcasecmp(t, b"pubsub\0" as *const u8 as *const libc::c_char) == 0 {
4210            flags = (flags as libc::c_ulonglong
4211                | (1 as libc::c_ulonglong) << 5 as libc::c_int) as int64_t;
4212        } else if !(strcasecmp(t, b"random\0" as *const u8 as *const libc::c_char) == 0)
4213        {
4214            if strcasecmp(t, b"blocking\0" as *const u8 as *const libc::c_char) == 0 {
4215                flags = (flags as libc::c_ulonglong
4216                    | (1 as libc::c_ulonglong) << 8 as libc::c_int) as int64_t;
4217            } else if strcasecmp(t, b"allow-stale\0" as *const u8 as *const libc::c_char)
4218                == 0
4219            {
4220                flags = (flags as libc::c_ulonglong
4221                    | (1 as libc::c_ulonglong) << 10 as libc::c_int) as int64_t;
4222            } else if strcasecmp(t, b"no-monitor\0" as *const u8 as *const libc::c_char)
4223                == 0
4224            {
4225                flags = (flags as libc::c_ulonglong
4226                    | (1 as libc::c_ulonglong) << 11 as libc::c_int) as int64_t;
4227            } else if strcasecmp(t, b"no-slowlog\0" as *const u8 as *const libc::c_char)
4228                == 0
4229            {
4230                flags = (flags as libc::c_ulonglong
4231                    | (1 as libc::c_ulonglong) << 12 as libc::c_int) as int64_t;
4232            } else if strcasecmp(t, b"fast\0" as *const u8 as *const libc::c_char) == 0 {
4233                flags = (flags as libc::c_ulonglong
4234                    | (1 as libc::c_ulonglong) << 14 as libc::c_int) as int64_t;
4235            } else if strcasecmp(t, b"no-auth\0" as *const u8 as *const libc::c_char)
4236                == 0
4237            {
4238                flags = (flags as libc::c_ulonglong
4239                    | (1 as libc::c_ulonglong) << 15 as libc::c_int) as int64_t;
4240            } else if strcasecmp(
4241                t,
4242                b"may-replicate\0" as *const u8 as *const libc::c_char,
4243            ) == 0
4244            {
4245                flags = (flags as libc::c_ulonglong
4246                    | (1 as libc::c_ulonglong) << 16 as libc::c_int) as int64_t;
4247            } else if strcasecmp(t, b"getkeys-api\0" as *const u8 as *const libc::c_char)
4248                == 0
4249            {
4250                flags = (flags as libc::c_ulonglong
4251                    | (1 as libc::c_ulonglong) << 21 as libc::c_int) as int64_t;
4252            } else if strcasecmp(
4253                t,
4254                b"getchannels-api\0" as *const u8 as *const libc::c_char,
4255            ) == 0
4256            {
4257                flags = (flags as libc::c_ulonglong
4258                    | (1 as libc::c_ulonglong) << 27 as libc::c_int) as int64_t;
4259            } else if strcasecmp(t, b"no-cluster\0" as *const u8 as *const libc::c_char)
4260                == 0
4261            {
4262                flags = (flags as libc::c_ulonglong
4263                    | (1 as libc::c_ulonglong) << 22 as libc::c_int) as int64_t;
4264            } else if strcasecmp(
4265                t,
4266                b"no-mandatory-keys\0" as *const u8 as *const libc::c_char,
4267            ) == 0
4268            {
4269                flags = (flags as libc::c_ulonglong
4270                    | (1 as libc::c_ulonglong) << 19 as libc::c_int) as int64_t;
4271            } else {
4272                if !(strcasecmp(t, b"allow-busy\0" as *const u8 as *const libc::c_char)
4273                    == 0)
4274                {
4275                    break;
4276                }
4277                flags = (flags as libc::c_ulonglong
4278                    | (1 as libc::c_ulonglong) << 26 as libc::c_int) as int64_t;
4279            }
4280        }
4281        j += 1;
4282    }
4283    sdsfreesplitres(tokens, count);
4284    if j != count {
4285        return -(1 as libc::c_int) as int64_t;
4286    }
4287    return flags;
4288}
4289#[no_mangle]
4290pub unsafe extern "C" fn RM_CreateCommand(
4291    mut ctx: *mut RedisModuleCtx,
4292    mut name: *const libc::c_char,
4293    mut cmdfunc: RedisModuleCmdFunc,
4294    mut strflags: *const libc::c_char,
4295    mut firstkey: libc::c_int,
4296    mut lastkey: libc::c_int,
4297    mut keystep: libc::c_int,
4298) -> libc::c_int {
4299    let mut flags: int64_t = if !strflags.is_null() {
4300        commandFlagsFromString(strflags as *mut libc::c_char)
4301    } else {
4302        0 as libc::c_int as libc::c_long
4303    };
4304    if flags == -(1 as libc::c_int) as libc::c_long {
4305        return 1 as libc::c_int;
4306    }
4307    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 22 as libc::c_int != 0
4308        && server.cluster_enabled != 0
4309    {
4310        return 1 as libc::c_int;
4311    }
4312    if !(lookupCommandByCString(name)).is_null() {
4313        return 1 as libc::c_int;
4314    }
4315    let mut declared_name: sds = sdsnew(name);
4316    let mut cp: *mut RedisModuleCommand = moduleCreateCommandProxy(
4317        (*ctx).module,
4318        declared_name,
4319        sdsdup(declared_name),
4320        cmdfunc,
4321        flags,
4322        firstkey,
4323        lastkey,
4324        keystep,
4325    );
4326    (*(*cp).rediscmd)
4327        .arity = if cmdfunc.is_some() {
4328        -(1 as libc::c_int)
4329    } else {
4330        -(2 as libc::c_int)
4331    };
4332    if dictAdd(
4333        server.commands,
4334        sdsdup(declared_name) as *mut libc::c_void,
4335        (*cp).rediscmd as *mut libc::c_void,
4336    ) == 0 as libc::c_int
4337    {} else {
4338        _serverAssert(
4339            b"dictAdd(server.commands, sdsdup(declared_name), cp->rediscmd) == DICT_OK\0"
4340                as *const u8 as *const libc::c_char,
4341            b"module.c\0" as *const u8 as *const libc::c_char,
4342            1123 as libc::c_int,
4343        );
4344        unreachable!();
4345    };
4346    if dictAdd(
4347        server.orig_commands,
4348        sdsdup(declared_name) as *mut libc::c_void,
4349        (*cp).rediscmd as *mut libc::c_void,
4350    ) == 0 as libc::c_int
4351    {} else {
4352        _serverAssert(
4353            b"dictAdd(server.orig_commands, sdsdup(declared_name), cp->rediscmd) == DICT_OK\0"
4354                as *const u8 as *const libc::c_char,
4355            b"module.c\0" as *const u8 as *const libc::c_char,
4356            1124 as libc::c_int,
4357        );
4358        unreachable!();
4359    };
4360    (*(*cp).rediscmd).id = ACLGetCommandID(declared_name) as libc::c_int;
4361    return 0 as libc::c_int;
4362}
4363#[no_mangle]
4364pub unsafe extern "C" fn moduleCreateCommandProxy(
4365    mut module: *mut RedisModule,
4366    mut declared_name: sds,
4367    mut fullname: sds,
4368    mut cmdfunc: RedisModuleCmdFunc,
4369    mut flags: int64_t,
4370    mut firstkey: libc::c_int,
4371    mut lastkey: libc::c_int,
4372    mut keystep: libc::c_int,
4373) -> *mut RedisModuleCommand {
4374    let mut rediscmd: *mut redisCommand = 0 as *mut redisCommand;
4375    let mut cp: *mut RedisModuleCommand = 0 as *mut RedisModuleCommand;
4376    cp = zcalloc(core::mem::size_of::<RedisModuleCommand>() as libc::c_ulong)
4377        as *mut RedisModuleCommand;
4378    (*cp).module = module;
4379    (*cp).func = cmdfunc;
4380    (*cp)
4381        .rediscmd = zcalloc(core::mem::size_of::<redisCommand>() as libc::c_ulong)
4382        as *mut redisCommand;
4383    (*(*cp).rediscmd).declared_name = declared_name as *const libc::c_char;
4384    (*(*cp).rediscmd).fullname = fullname;
4385    (*(*cp).rediscmd).group = COMMAND_GROUP_MODULE;
4386    (*(*cp).rediscmd)
4387        .proc_0 = Some(
4388        RedisModuleCommandDispatcher as unsafe extern "C" fn(*mut client) -> (),
4389    );
4390    (*(*cp).rediscmd)
4391        .flags = (flags as libc::c_ulonglong
4392        | (1 as libc::c_ulonglong) << 3 as libc::c_int) as uint64_t;
4393    (*(*cp).rediscmd).module_cmd = cp;
4394    (*(*cp).rediscmd).key_specs_max = 4 as libc::c_int;
4395    (*(*cp).rediscmd).key_specs = ((*(*cp).rediscmd).key_specs_static).as_mut_ptr();
4396    if firstkey != 0 as libc::c_int {
4397        (*(*cp).rediscmd).key_specs_num = 1 as libc::c_int;
4398        (*((*(*cp).rediscmd).key_specs).offset(0 as libc::c_int as isize))
4399            .flags = ((1 as libc::c_ulonglong) << 1 as libc::c_int
4400            | (1 as libc::c_ulonglong) << 4 as libc::c_int
4401            | (1 as libc::c_ulonglong) << 5 as libc::c_int) as uint64_t;
4402        if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 21 as libc::c_int
4403            != 0
4404        {
4405            let ref mut fresh2 = (*((*(*cp).rediscmd).key_specs)
4406                .offset(0 as libc::c_int as isize))
4407                .flags;
4408            *fresh2 = (*fresh2 as libc::c_ulonglong
4409                | (1 as libc::c_ulonglong) << 10 as libc::c_int) as uint64_t;
4410        }
4411        (*((*(*cp).rediscmd).key_specs).offset(0 as libc::c_int as isize))
4412            .begin_search_type = KSPEC_BS_INDEX;
4413        (*((*(*cp).rediscmd).key_specs).offset(0 as libc::c_int as isize))
4414            .bs
4415            .index
4416            .pos = firstkey;
4417        (*((*(*cp).rediscmd).key_specs).offset(0 as libc::c_int as isize))
4418            .find_keys_type = KSPEC_FK_RANGE;
4419        (*((*(*cp).rediscmd).key_specs).offset(0 as libc::c_int as isize))
4420            .fk
4421            .range
4422            .lastkey = if lastkey < 0 as libc::c_int {
4423            lastkey
4424        } else {
4425            lastkey - firstkey
4426        };
4427        (*((*(*cp).rediscmd).key_specs).offset(0 as libc::c_int as isize))
4428            .fk
4429            .range
4430            .keystep = keystep;
4431        (*((*(*cp).rediscmd).key_specs).offset(0 as libc::c_int as isize))
4432            .fk
4433            .range
4434            .limit = 0 as libc::c_int;
4435    } else {
4436        (*(*cp).rediscmd).key_specs_num = 0 as libc::c_int;
4437    }
4438    populateCommandLegacyRangeSpec((*cp).rediscmd);
4439    (*(*cp).rediscmd).microseconds = 0 as libc::c_int as libc::c_longlong;
4440    (*(*cp).rediscmd).calls = 0 as libc::c_int as libc::c_longlong;
4441    (*(*cp).rediscmd).rejected_calls = 0 as libc::c_int as libc::c_longlong;
4442    (*(*cp).rediscmd).failed_calls = 0 as libc::c_int as libc::c_longlong;
4443    return cp;
4444}
4445#[no_mangle]
4446pub unsafe extern "C" fn RM_GetCommand(
4447    mut ctx: *mut RedisModuleCtx,
4448    mut name: *const libc::c_char,
4449) -> *mut RedisModuleCommand {
4450    let mut cmd: *mut redisCommand = lookupCommandByCString(name);
4451    if cmd.is_null()
4452        || (*cmd).flags as libc::c_ulonglong
4453            & (1 as libc::c_ulonglong) << 3 as libc::c_int == 0
4454    {
4455        return 0 as *mut RedisModuleCommand;
4456    }
4457    let mut cp: *mut RedisModuleCommand = (*cmd).module_cmd;
4458    if (*cp).module != (*ctx).module {
4459        return 0 as *mut RedisModuleCommand;
4460    }
4461    return cp;
4462}
4463#[no_mangle]
4464pub unsafe extern "C" fn RM_CreateSubcommand(
4465    mut parent: *mut RedisModuleCommand,
4466    mut name: *const libc::c_char,
4467    mut cmdfunc: RedisModuleCmdFunc,
4468    mut strflags: *const libc::c_char,
4469    mut firstkey: libc::c_int,
4470    mut lastkey: libc::c_int,
4471    mut keystep: libc::c_int,
4472) -> libc::c_int {
4473    let mut flags: int64_t = if !strflags.is_null() {
4474        commandFlagsFromString(strflags as *mut libc::c_char)
4475    } else {
4476        0 as libc::c_int as libc::c_long
4477    };
4478    if flags == -(1 as libc::c_int) as libc::c_long {
4479        return 1 as libc::c_int;
4480    }
4481    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 22 as libc::c_int != 0
4482        && server.cluster_enabled != 0
4483    {
4484        return 1 as libc::c_int;
4485    }
4486    let mut parent_cmd: *mut redisCommand = (*parent).rediscmd;
4487    if !((*parent_cmd).parent).is_null() {
4488        return 1 as libc::c_int;
4489    }
4490    let mut parent_cp: *mut RedisModuleCommand = (*parent_cmd).module_cmd;
4491    if ((*parent_cp).func).is_some() {
4492        return 1 as libc::c_int;
4493    }
4494    let mut declared_name: sds = sdsnew(name);
4495    if !((*parent_cmd).subcommands_dict).is_null()
4496        && !(lookupSubcommand(parent_cmd, declared_name)).is_null()
4497    {
4498        sdsfree(declared_name);
4499        return 1 as libc::c_int;
4500    }
4501    let mut fullname: sds = catSubCommandFullname(
4502        (*parent_cmd).fullname as *const libc::c_char,
4503        name,
4504    );
4505    let mut cp: *mut RedisModuleCommand = moduleCreateCommandProxy(
4506        (*parent).module,
4507        declared_name,
4508        fullname,
4509        cmdfunc,
4510        flags,
4511        firstkey,
4512        lastkey,
4513        keystep,
4514    );
4515    (*(*cp).rediscmd).arity = -(2 as libc::c_int);
4516    commandAddSubcommand(parent_cmd, (*cp).rediscmd, name);
4517    return 0 as libc::c_int;
4518}
4519unsafe extern "C" fn moduleCmdHistoryEntryAt(
4520    mut version: *const RedisModuleCommandInfoVersion,
4521    mut entries: *mut RedisModuleCommandHistoryEntry,
4522    mut index: libc::c_int,
4523) -> *mut RedisModuleCommandHistoryEntry {
4524    let mut offset: off_t = (index as libc::c_ulong)
4525        .wrapping_mul((*version).sizeof_historyentry) as off_t;
4526    return (entries as *mut libc::c_char).offset(offset as isize)
4527        as *mut RedisModuleCommandHistoryEntry;
4528}
4529unsafe extern "C" fn moduleCmdKeySpecAt(
4530    mut version: *const RedisModuleCommandInfoVersion,
4531    mut keyspecs: *mut RedisModuleCommandKeySpec,
4532    mut index: libc::c_int,
4533) -> *mut RedisModuleCommandKeySpec {
4534    let mut offset: off_t = (index as libc::c_ulong)
4535        .wrapping_mul((*version).sizeof_keyspec) as off_t;
4536    return (keyspecs as *mut libc::c_char).offset(offset as isize)
4537        as *mut RedisModuleCommandKeySpec;
4538}
4539unsafe extern "C" fn moduleCmdArgAt(
4540    mut version: *const RedisModuleCommandInfoVersion,
4541    mut args: *const RedisModuleCommandArg,
4542    mut index: libc::c_int,
4543) -> *mut RedisModuleCommandArg {
4544    let mut offset: off_t = (index as libc::c_ulong).wrapping_mul((*version).sizeof_arg)
4545        as off_t;
4546    return (args as *mut libc::c_char).offset(offset as isize)
4547        as *mut RedisModuleCommandArg;
4548}
4549#[no_mangle]
4550pub unsafe extern "C" fn RM_SetCommandInfo(
4551    mut command: *mut RedisModuleCommand,
4552    mut info: *const RedisModuleCommandInfo,
4553) -> libc::c_int {
4554    if moduleValidateCommandInfo(info) == 0 {
4555        *__errno_location() = 22 as libc::c_int;
4556        return 1 as libc::c_int;
4557    }
4558    let mut cmd: *mut redisCommand = (*command).rediscmd;
4559    if !((*cmd).summary).is_null() || !((*cmd).complexity).is_null()
4560        || !((*cmd).since).is_null() || !((*cmd).history).is_null()
4561        || !((*cmd).tips).is_null() || !((*cmd).args).is_null()
4562        || !((*cmd).key_specs_num == 0 as libc::c_int
4563            || (*cmd).key_specs_num == 1 as libc::c_int
4564                && (*cmd).key_specs == ((*cmd).key_specs_static).as_mut_ptr()
4565                && (*((*cmd).key_specs).offset(0 as libc::c_int as isize))
4566                    .begin_search_type as libc::c_uint
4567                    == KSPEC_BS_INDEX as libc::c_int as libc::c_uint
4568                && (*((*cmd).key_specs).offset(0 as libc::c_int as isize)).find_keys_type
4569                    as libc::c_uint == KSPEC_FK_RANGE as libc::c_int as libc::c_uint)
4570    {
4571        *__errno_location() = 17 as libc::c_int;
4572        return 1 as libc::c_int;
4573    }
4574    if !((*info).summary).is_null() {
4575        (*cmd).summary = zstrdup((*info).summary);
4576    }
4577    if !((*info).complexity).is_null() {
4578        (*cmd).complexity = zstrdup((*info).complexity);
4579    }
4580    if !((*info).since).is_null() {
4581        (*cmd).since = zstrdup((*info).since);
4582    }
4583    let mut version: *const RedisModuleCommandInfoVersion = (*info).version;
4584    if !((*info).history).is_null() {
4585        let mut count: size_t = 0 as libc::c_int as size_t;
4586        while !((*moduleCmdHistoryEntryAt(
4587            version,
4588            (*info).history,
4589            count as libc::c_int,
4590        ))
4591            .since)
4592            .is_null()
4593        {
4594            count = count.wrapping_add(1);
4595        }
4596        if count
4597            < (18446744073709551615 as libc::c_ulong)
4598                .wrapping_div(core::mem::size_of::<commandHistory>() as libc::c_ulong)
4599        {} else {
4600            _serverAssert(
4601                b"count < SIZE_MAX / sizeof(commandHistory)\0" as *const u8
4602                    as *const libc::c_char,
4603                b"module.c\0" as *const u8 as *const libc::c_char,
4604                1608 as libc::c_int,
4605            );
4606            unreachable!();
4607        };
4608        (*cmd)
4609            .history = zmalloc(
4610            (core::mem::size_of::<commandHistory>() as libc::c_ulong)
4611                .wrapping_mul(count.wrapping_add(1 as libc::c_int as libc::c_ulong)),
4612        ) as *mut commandHistory;
4613        let mut j: size_t = 0 as libc::c_int as size_t;
4614        while j < count {
4615            let mut entry: *mut RedisModuleCommandHistoryEntry = moduleCmdHistoryEntryAt(
4616                version,
4617                (*info).history,
4618                j as libc::c_int,
4619            );
4620            let ref mut fresh3 = (*((*cmd).history).offset(j as isize)).since;
4621            *fresh3 = zstrdup((*entry).since);
4622            let ref mut fresh4 = (*((*cmd).history).offset(j as isize)).changes;
4623            *fresh4 = zstrdup((*entry).changes);
4624            j = j.wrapping_add(1);
4625        }
4626        let ref mut fresh5 = (*((*cmd).history).offset(count as isize)).since;
4627        *fresh5 = 0 as *const libc::c_char;
4628        let ref mut fresh6 = (*((*cmd).history).offset(count as isize)).changes;
4629        *fresh6 = 0 as *const libc::c_char;
4630        (*cmd).num_history = count as libc::c_int;
4631    }
4632    if !((*info).tips).is_null() {
4633        let mut count_0: libc::c_int = 0;
4634        let mut tokens: *mut sds = sdssplitlen(
4635            (*info).tips,
4636            strlen((*info).tips) as ssize_t,
4637            b" \0" as *const u8 as *const libc::c_char,
4638            1 as libc::c_int,
4639            &mut count_0,
4640        );
4641        if !tokens.is_null() {
4642            (*cmd)
4643                .tips = zmalloc(
4644                (core::mem::size_of::<*mut libc::c_char>() as libc::c_ulong)
4645                    .wrapping_mul((count_0 + 1 as libc::c_int) as libc::c_ulong),
4646            ) as *mut *const libc::c_char;
4647            let mut j_0: libc::c_int = 0 as libc::c_int;
4648            while j_0 < count_0 {
4649                let ref mut fresh7 = *((*cmd).tips).offset(j_0 as isize);
4650                *fresh7 = zstrdup(*tokens.offset(j_0 as isize) as *const libc::c_char);
4651                j_0 += 1;
4652            }
4653            let ref mut fresh8 = *((*cmd).tips).offset(count_0 as isize);
4654            *fresh8 = 0 as *const libc::c_char;
4655            (*cmd).num_tips = count_0;
4656            sdsfreesplitres(tokens, count_0);
4657        }
4658    }
4659    if (*info).arity != 0 {
4660        (*cmd).arity = (*info).arity;
4661    }
4662    if !((*info).key_specs).is_null() {
4663        let mut count_1: size_t = 0 as libc::c_int as size_t;
4664        while (*moduleCmdKeySpecAt(version, (*info).key_specs, count_1 as libc::c_int))
4665            .begin_search_type as u64 != 0
4666        {
4667            count_1 = count_1.wrapping_add(1);
4668        }
4669        if count_1 < 2147483647 as libc::c_int as libc::c_ulong {} else {
4670            _serverAssert(
4671                b"count < INT_MAX\0" as *const u8 as *const libc::c_char,
4672                b"module.c\0" as *const u8 as *const libc::c_char,
4673                1642 as libc::c_int,
4674            );
4675            unreachable!();
4676        };
4677        if count_1 <= 4 as libc::c_int as libc::c_ulong {
4678            (*cmd).key_specs_max = 4 as libc::c_int;
4679            (*cmd).key_specs = ((*cmd).key_specs_static).as_mut_ptr();
4680        } else {
4681            (*cmd).key_specs_max = count_1 as libc::c_int;
4682            (*cmd)
4683                .key_specs = zmalloc(
4684                (core::mem::size_of::<keySpec>() as libc::c_ulong)
4685                    .wrapping_mul(count_1),
4686            ) as *mut keySpec;
4687        }
4688        (*cmd).key_specs_num = count_1 as libc::c_int;
4689        let mut j_1: size_t = 0 as libc::c_int as size_t;
4690        while j_1 < count_1 {
4691            let mut spec: *mut RedisModuleCommandKeySpec = moduleCmdKeySpecAt(
4692                version,
4693                (*info).key_specs,
4694                j_1 as libc::c_int,
4695            );
4696            let ref mut fresh9 = (*((*cmd).key_specs).offset(j_1 as isize)).notes;
4697            *fresh9 = if !((*spec).notes).is_null() {
4698                zstrdup((*spec).notes)
4699            } else {
4700                0 as *mut libc::c_char
4701            };
4702            (*((*cmd).key_specs).offset(j_1 as isize))
4703                .flags = moduleConvertKeySpecsFlags(
4704                (*spec).flags as int64_t,
4705                1 as libc::c_int,
4706            ) as uint64_t;
4707            match (*spec).begin_search_type as libc::c_uint {
4708                1 => {
4709                    (*((*cmd).key_specs).offset(j_1 as isize))
4710                        .begin_search_type = KSPEC_BS_UNKNOWN;
4711                }
4712                2 => {
4713                    (*((*cmd).key_specs).offset(j_1 as isize))
4714                        .begin_search_type = KSPEC_BS_INDEX;
4715                    (*((*cmd).key_specs).offset(j_1 as isize))
4716                        .bs
4717                        .index
4718                        .pos = (*spec).bs.index.pos;
4719                }
4720                3 => {
4721                    (*((*cmd).key_specs).offset(j_1 as isize))
4722                        .begin_search_type = KSPEC_BS_KEYWORD;
4723                    let ref mut fresh10 = (*((*cmd).key_specs).offset(j_1 as isize))
4724                        .bs
4725                        .keyword
4726                        .keyword;
4727                    *fresh10 = zstrdup((*spec).bs.keyword.keyword);
4728                    (*((*cmd).key_specs).offset(j_1 as isize))
4729                        .bs
4730                        .keyword
4731                        .startfrom = (*spec).bs.keyword.startfrom;
4732                }
4733                _ => {
4734                    _serverPanic(
4735                        b"module.c\0" as *const u8 as *const libc::c_char,
4736                        1673 as libc::c_int,
4737                        b"Unknown begin_search_type\0" as *const u8
4738                            as *const libc::c_char,
4739                    );
4740                    unreachable!();
4741                }
4742            }
4743            match (*spec).find_keys_type as libc::c_uint {
4744                0 => {
4745                    (*((*cmd).key_specs).offset(j_1 as isize))
4746                        .find_keys_type = KSPEC_FK_RANGE;
4747                    (*((*cmd).key_specs).offset(j_1 as isize))
4748                        .fk
4749                        .range
4750                        .lastkey = 0 as libc::c_int;
4751                    (*((*cmd).key_specs).offset(j_1 as isize))
4752                        .fk
4753                        .range
4754                        .keystep = 1 as libc::c_int;
4755                    (*((*cmd).key_specs).offset(j_1 as isize))
4756                        .fk
4757                        .range
4758                        .limit = 0 as libc::c_int;
4759                }
4760                1 => {
4761                    (*((*cmd).key_specs).offset(j_1 as isize))
4762                        .find_keys_type = KSPEC_FK_UNKNOWN;
4763                }
4764                2 => {
4765                    (*((*cmd).key_specs).offset(j_1 as isize))
4766                        .find_keys_type = KSPEC_FK_RANGE;
4767                    (*((*cmd).key_specs).offset(j_1 as isize))
4768                        .fk
4769                        .range
4770                        .lastkey = (*spec).fk.range.lastkey;
4771                    (*((*cmd).key_specs).offset(j_1 as isize))
4772                        .fk
4773                        .range
4774                        .keystep = (*spec).fk.range.keystep;
4775                    (*((*cmd).key_specs).offset(j_1 as isize))
4776                        .fk
4777                        .range
4778                        .limit = (*spec).fk.range.limit;
4779                }
4780                3 => {
4781                    (*((*cmd).key_specs).offset(j_1 as isize))
4782                        .find_keys_type = KSPEC_FK_KEYNUM;
4783                    (*((*cmd).key_specs).offset(j_1 as isize))
4784                        .fk
4785                        .keynum
4786                        .keynumidx = (*spec).fk.keynum.keynumidx;
4787                    (*((*cmd).key_specs).offset(j_1 as isize))
4788                        .fk
4789                        .keynum
4790                        .firstkey = (*spec).fk.keynum.firstkey;
4791                    (*((*cmd).key_specs).offset(j_1 as isize))
4792                        .fk
4793                        .keynum
4794                        .keystep = (*spec).fk.keynum.keystep;
4795                }
4796                _ => {
4797                    _serverPanic(
4798                        b"module.c\0" as *const u8 as *const libc::c_char,
4799                        1701 as libc::c_int,
4800                        b"Unknown find_keys_type\0" as *const u8 as *const libc::c_char,
4801                    );
4802                    unreachable!();
4803                }
4804            }
4805            j_1 = j_1.wrapping_add(1);
4806        }
4807        populateCommandLegacyRangeSpec(cmd);
4808    }
4809    if !((*info).args).is_null() {
4810        (*cmd).args = moduleCopyCommandArgs((*info).args, version);
4811        (*cmd).num_args = populateArgsStructure((*cmd).args);
4812    }
4813    return 0 as libc::c_int;
4814}
4815#[inline]
4816unsafe extern "C" fn isPowerOfTwo(mut v: uint64_t) -> libc::c_int {
4817    return (v != 0 && v & v.wrapping_sub(1 as libc::c_int as libc::c_ulong) == 0)
4818        as libc::c_int;
4819}
4820unsafe extern "C" fn moduleValidateCommandInfo(
4821    mut info: *const RedisModuleCommandInfo,
4822) -> libc::c_int {
4823    let mut version: *const RedisModuleCommandInfoVersion = (*info).version;
4824    if version.is_null() {
4825        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4826            _serverLog(
4827                3 as libc::c_int,
4828                b"Invalid command info: version missing\0" as *const u8
4829                    as *const libc::c_char,
4830            );
4831        }
4832        return 0 as libc::c_int;
4833    }
4834    if !((*info).history).is_null() {
4835        let mut j: size_t = 0 as libc::c_int as size_t;
4836        while !((*moduleCmdHistoryEntryAt(version, (*info).history, j as libc::c_int))
4837            .since)
4838            .is_null()
4839        {
4840            if ((*moduleCmdHistoryEntryAt(version, (*info).history, j as libc::c_int))
4841                .changes)
4842                .is_null()
4843            {
4844                if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4845                    _serverLog(
4846                        3 as libc::c_int,
4847                        b"Invalid command info: history[%zd].changes missing\0"
4848                            as *const u8 as *const libc::c_char,
4849                        j,
4850                    );
4851                }
4852                return 0 as libc::c_int;
4853            }
4854            j = j.wrapping_add(1);
4855        }
4856    }
4857    if !((*info).key_specs).is_null() {
4858        let mut j_0: size_t = 0 as libc::c_int as size_t;
4859        while (*moduleCmdKeySpecAt(version, (*info).key_specs, j_0 as libc::c_int))
4860            .begin_search_type as u64 != 0
4861        {
4862            let mut spec: *mut RedisModuleCommandKeySpec = moduleCmdKeySpecAt(
4863                version,
4864                (*info).key_specs,
4865                j_0 as libc::c_int,
4866            );
4867            if j_0 >= 2147483647 as libc::c_int as libc::c_ulong {
4868                if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4869                    _serverLog(
4870                        3 as libc::c_int,
4871                        b"Invalid command info: Too many key specs\0" as *const u8
4872                            as *const libc::c_char,
4873                    );
4874                }
4875                return 0 as libc::c_int;
4876            }
4877            let mut key_flags: uint64_t = ((1 as libc::c_ulonglong) << 0 as libc::c_int
4878                | (1 as libc::c_ulonglong) << 1 as libc::c_int
4879                | (1 as libc::c_ulonglong) << 2 as libc::c_int
4880                | (1 as libc::c_ulonglong) << 3 as libc::c_int) as uint64_t;
4881            let mut write_flags: uint64_t = ((1 as libc::c_ulonglong) << 6 as libc::c_int
4882                | (1 as libc::c_ulonglong) << 7 as libc::c_int
4883                | (1 as libc::c_ulonglong) << 5 as libc::c_int) as uint64_t;
4884            if isPowerOfTwo((*spec).flags & key_flags) == 0 {
4885                if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4886                    _serverLog(
4887                        3 as libc::c_int,
4888                        b"Invalid command info: key_specs[%zd].flags: Exactly one of the flags RO, RW, OW, RM required\0"
4889                            as *const u8 as *const libc::c_char,
4890                        j_0,
4891                    );
4892                }
4893                return 0 as libc::c_int;
4894            }
4895            if (*spec).flags & write_flags != 0 as libc::c_int as libc::c_ulong
4896                && isPowerOfTwo((*spec).flags & write_flags) == 0
4897            {
4898                if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4899                    _serverLog(
4900                        3 as libc::c_int,
4901                        b"Invalid command info: key_specs[%zd].flags: INSERT, DELETE and UPDATE are mutually exclusive\0"
4902                            as *const u8 as *const libc::c_char,
4903                        j_0,
4904                    );
4905                }
4906                return 0 as libc::c_int;
4907            }
4908            match (*spec).begin_search_type as libc::c_uint {
4909                1 | 2 => {}
4910                3 => {
4911                    if ((*spec).bs.keyword.keyword).is_null() {
4912                        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity)
4913                        {
4914                            _serverLog(
4915                                3 as libc::c_int,
4916                                b"Invalid command info: key_specs[%zd].bs.keyword.keyword required when begin_search_type is KEYWORD\0"
4917                                    as *const u8 as *const libc::c_char,
4918                                j_0,
4919                            );
4920                        }
4921                        return 0 as libc::c_int;
4922                    }
4923                }
4924                _ => {
4925                    if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4926                        _serverLog(
4927                            3 as libc::c_int,
4928                            b"Invalid command info: key_specs[%zd].begin_search_type: Invalid value %d\0"
4929                                as *const u8 as *const libc::c_char,
4930                            j_0,
4931                            (*spec).begin_search_type as libc::c_uint,
4932                        );
4933                    }
4934                    return 0 as libc::c_int;
4935                }
4936            }
4937            match (*spec).find_keys_type as libc::c_uint {
4938                0 | 1 | 2 | 3 => {}
4939                _ => {
4940                    if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4941                        _serverLog(
4942                            3 as libc::c_int,
4943                            b"Invalid command info: key_specs[%zd].find_keys_type: Invalid value %d\0"
4944                                as *const u8 as *const libc::c_char,
4945                            j_0,
4946                            (*spec).find_keys_type as libc::c_uint,
4947                        );
4948                    }
4949                    return 0 as libc::c_int;
4950                }
4951            }
4952            j_0 = j_0.wrapping_add(1);
4953        }
4954    }
4955    return moduleValidateCommandArgs((*info).args, version);
4956}
4957unsafe extern "C" fn moduleConvertKeySpecsFlags(
4958    mut flags: int64_t,
4959    mut from_api: libc::c_int,
4960) -> int64_t {
4961    let mut out: int64_t = 0 as libc::c_int as int64_t;
4962    let mut map: [[int64_t; 2]; 12] = [
4963        [
4964            ((1 as libc::c_ulonglong) << 0 as libc::c_int) as int64_t,
4965            ((1 as libc::c_ulonglong) << 0 as libc::c_int) as int64_t,
4966        ],
4967        [
4968            ((1 as libc::c_ulonglong) << 1 as libc::c_int) as int64_t,
4969            ((1 as libc::c_ulonglong) << 1 as libc::c_int) as int64_t,
4970        ],
4971        [
4972            ((1 as libc::c_ulonglong) << 2 as libc::c_int) as int64_t,
4973            ((1 as libc::c_ulonglong) << 2 as libc::c_int) as int64_t,
4974        ],
4975        [
4976            ((1 as libc::c_ulonglong) << 3 as libc::c_int) as int64_t,
4977            ((1 as libc::c_ulonglong) << 3 as libc::c_int) as int64_t,
4978        ],
4979        [
4980            ((1 as libc::c_ulonglong) << 4 as libc::c_int) as int64_t,
4981            ((1 as libc::c_ulonglong) << 4 as libc::c_int) as int64_t,
4982        ],
4983        [
4984            ((1 as libc::c_ulonglong) << 6 as libc::c_int) as int64_t,
4985            ((1 as libc::c_ulonglong) << 6 as libc::c_int) as int64_t,
4986        ],
4987        [
4988            ((1 as libc::c_ulonglong) << 5 as libc::c_int) as int64_t,
4989            ((1 as libc::c_ulonglong) << 5 as libc::c_int) as int64_t,
4990        ],
4991        [
4992            ((1 as libc::c_ulonglong) << 7 as libc::c_int) as int64_t,
4993            ((1 as libc::c_ulonglong) << 7 as libc::c_int) as int64_t,
4994        ],
4995        [
4996            ((1 as libc::c_ulonglong) << 8 as libc::c_int) as int64_t,
4997            ((1 as libc::c_ulonglong) << 8 as libc::c_int) as int64_t,
4998        ],
4999        [
5000            ((1 as libc::c_ulonglong) << 9 as libc::c_int) as int64_t,
5001            ((1 as libc::c_ulonglong) << 9 as libc::c_int) as int64_t,
5002        ],
5003        [
5004            ((1 as libc::c_ulonglong) << 10 as libc::c_int) as int64_t,
5005            ((1 as libc::c_ulonglong) << 10 as libc::c_int) as int64_t,
5006        ],
5007        [0 as libc::c_int as int64_t, 0 as libc::c_int as int64_t],
5008    ];
5009    let mut from_idx: libc::c_int = if from_api != 0 {
5010        0 as libc::c_int
5011    } else {
5012        1 as libc::c_int
5013    };
5014    let mut to_idx: libc::c_int = (from_idx == 0) as libc::c_int;
5015    let mut i: libc::c_int = 0 as libc::c_int;
5016    while map[i as usize][0 as libc::c_int as usize] != 0 {
5017        if flags & map[i as usize][from_idx as usize] != 0 {
5018            out |= map[i as usize][to_idx as usize];
5019        }
5020        i += 1;
5021    }
5022    return out;
5023}
5024unsafe extern "C" fn moduleValidateCommandArgs(
5025    mut args: *mut RedisModuleCommandArg,
5026    mut version: *const RedisModuleCommandInfoVersion,
5027) -> libc::c_int {
5028    if args.is_null() {
5029        return 1 as libc::c_int;
5030    }
5031    let mut j: size_t = 0 as libc::c_int as size_t;
5032    while !((*moduleCmdArgAt(version, args, j as libc::c_int)).name).is_null() {
5033        let mut arg: *mut RedisModuleCommandArg = moduleCmdArgAt(
5034            version,
5035            args,
5036            j as libc::c_int,
5037        );
5038        let mut arg_type_error: libc::c_int = 0 as libc::c_int;
5039        moduleConvertArgType((*arg).type_0, &mut arg_type_error);
5040        if arg_type_error != 0 {
5041            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5042                _serverLog(
5043                    3 as libc::c_int,
5044                    b"Invalid command info: Argument \"%s\": Undefined type %d\0"
5045                        as *const u8 as *const libc::c_char,
5046                    (*arg).name,
5047                    (*arg).type_0 as libc::c_uint,
5048                );
5049            }
5050            return 0 as libc::c_int;
5051        }
5052        if (*arg).type_0 as libc::c_uint
5053            == REDISMODULE_ARG_TYPE_PURE_TOKEN as libc::c_int as libc::c_uint
5054            && ((*arg).token).is_null()
5055        {
5056            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5057                _serverLog(
5058                    3 as libc::c_int,
5059                    b"Invalid command info: Argument \"%s\": token required when type is PURE_TOKEN\0"
5060                        as *const u8 as *const libc::c_char,
5061                    (*args.offset(j as isize)).name,
5062                );
5063            }
5064            return 0 as libc::c_int;
5065        }
5066        if (*arg).type_0 as libc::c_uint
5067            == REDISMODULE_ARG_TYPE_KEY as libc::c_int as libc::c_uint
5068        {
5069            if (*arg).key_spec_index < 0 as libc::c_int {
5070                if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5071                    _serverLog(
5072                        3 as libc::c_int,
5073                        b"Invalid command info: Argument \"%s\": key_spec_index required when type is KEY\0"
5074                            as *const u8 as *const libc::c_char,
5075                        (*arg).name,
5076                    );
5077                }
5078                return 0 as libc::c_int;
5079            }
5080        } else if (*arg).key_spec_index != -(1 as libc::c_int)
5081            && (*arg).key_spec_index != 0 as libc::c_int
5082        {
5083            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5084                _serverLog(
5085                    3 as libc::c_int,
5086                    b"Invalid command info: Argument \"%s\": key_spec_index specified but type isn't KEY\0"
5087                        as *const u8 as *const libc::c_char,
5088                    (*arg).name,
5089                );
5090            }
5091            return 0 as libc::c_int;
5092        }
5093        if (*arg).flags & !(((1 as libc::c_int) << 3 as libc::c_int) - 1 as libc::c_int)
5094            != 0
5095        {
5096            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5097                _serverLog(
5098                    3 as libc::c_int,
5099                    b"Invalid command info: Argument \"%s\": Invalid flags\0"
5100                        as *const u8 as *const libc::c_char,
5101                    (*arg).name,
5102                );
5103            }
5104            return 0 as libc::c_int;
5105        }
5106        if (*arg).type_0 as libc::c_uint
5107            == REDISMODULE_ARG_TYPE_ONEOF as libc::c_int as libc::c_uint
5108            || (*arg).type_0 as libc::c_uint
5109                == REDISMODULE_ARG_TYPE_BLOCK as libc::c_int as libc::c_uint
5110        {
5111            if ((*arg).subargs).is_null() {
5112                if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5113                    _serverLog(
5114                        3 as libc::c_int,
5115                        b"Invalid command info: Argument \"%s\": subargs required when type is ONEOF or BLOCK\0"
5116                            as *const u8 as *const libc::c_char,
5117                        (*arg).name,
5118                    );
5119                }
5120                return 0 as libc::c_int;
5121            }
5122            if moduleValidateCommandArgs((*arg).subargs, version) == 0 {
5123                return 0 as libc::c_int;
5124            }
5125        } else if !((*arg).subargs).is_null() {
5126            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5127                _serverLog(
5128                    3 as libc::c_int,
5129                    b"Invalid command info: Argument \"%s\": subargs specified but type isn't ONEOF nor BLOCK\0"
5130                        as *const u8 as *const libc::c_char,
5131                    (*arg).name,
5132                );
5133            }
5134            return 0 as libc::c_int;
5135        }
5136        j = j.wrapping_add(1);
5137    }
5138    return 1 as libc::c_int;
5139}
5140unsafe extern "C" fn moduleCopyCommandArgs(
5141    mut args: *mut RedisModuleCommandArg,
5142    mut version: *const RedisModuleCommandInfoVersion,
5143) -> *mut redisCommandArg {
5144    let mut count: size_t = 0 as libc::c_int as size_t;
5145    while !((*moduleCmdArgAt(version, args, count as libc::c_int)).name).is_null() {
5146        count = count.wrapping_add(1);
5147    }
5148    if count
5149        < (18446744073709551615 as libc::c_ulong)
5150            .wrapping_div(core::mem::size_of::<redisCommandArg>() as libc::c_ulong)
5151    {} else {
5152        _serverAssert(
5153            b"count < SIZE_MAX / sizeof(struct redisCommandArg)\0" as *const u8
5154                as *const libc::c_char,
5155            b"module.c\0" as *const u8 as *const libc::c_char,
5156            1925 as libc::c_int,
5157        );
5158        unreachable!();
5159    };
5160    let mut realargs: *mut redisCommandArg = zcalloc(
5161        count
5162            .wrapping_add(1 as libc::c_int as libc::c_ulong)
5163            .wrapping_mul(core::mem::size_of::<redisCommandArg>() as libc::c_ulong),
5164    ) as *mut redisCommandArg;
5165    let mut j: size_t = 0 as libc::c_int as size_t;
5166    while j < count {
5167        let mut arg: *mut RedisModuleCommandArg = moduleCmdArgAt(
5168            version,
5169            args,
5170            j as libc::c_int,
5171        );
5172        let ref mut fresh11 = (*realargs.offset(j as isize)).name;
5173        *fresh11 = zstrdup((*arg).name);
5174        (*realargs.offset(j as isize))
5175            .type_0 = moduleConvertArgType((*arg).type_0, 0 as *mut libc::c_int);
5176        if (*arg).type_0 as libc::c_uint
5177            == REDISMODULE_ARG_TYPE_KEY as libc::c_int as libc::c_uint
5178        {
5179            (*realargs.offset(j as isize)).key_spec_index = (*arg).key_spec_index;
5180        } else {
5181            (*realargs.offset(j as isize)).key_spec_index = -(1 as libc::c_int);
5182        }
5183        if !((*arg).token).is_null() {
5184            let ref mut fresh12 = (*realargs.offset(j as isize)).token;
5185            *fresh12 = zstrdup((*arg).token);
5186        }
5187        if !((*arg).summary).is_null() {
5188            let ref mut fresh13 = (*realargs.offset(j as isize)).summary;
5189            *fresh13 = zstrdup((*arg).summary);
5190        }
5191        if !((*arg).since).is_null() {
5192            let ref mut fresh14 = (*realargs.offset(j as isize)).since;
5193            *fresh14 = zstrdup((*arg).since);
5194        }
5195        if !((*arg).deprecated_since).is_null() {
5196            let ref mut fresh15 = (*realargs.offset(j as isize)).deprecated_since;
5197            *fresh15 = zstrdup((*arg).deprecated_since);
5198        }
5199        (*realargs.offset(j as isize)).flags = moduleConvertArgFlags((*arg).flags);
5200        if !((*arg).subargs).is_null() {
5201            let ref mut fresh16 = (*realargs.offset(j as isize)).subargs;
5202            *fresh16 = moduleCopyCommandArgs((*arg).subargs, version);
5203        }
5204        j = j.wrapping_add(1);
5205    }
5206    return realargs;
5207}
5208unsafe extern "C" fn moduleConvertArgType(
5209    mut type_0: RedisModuleCommandArgType,
5210    mut error: *mut libc::c_int,
5211) -> redisCommandArgType {
5212    if !error.is_null() {
5213        *error = 0 as libc::c_int;
5214    }
5215    match type_0 as libc::c_uint {
5216        0 => return ARG_TYPE_STRING,
5217        1 => return ARG_TYPE_INTEGER,
5218        2 => return ARG_TYPE_DOUBLE,
5219        3 => return ARG_TYPE_KEY,
5220        4 => return ARG_TYPE_PATTERN,
5221        5 => return ARG_TYPE_UNIX_TIME,
5222        6 => return ARG_TYPE_PURE_TOKEN,
5223        7 => return ARG_TYPE_ONEOF,
5224        8 => return ARG_TYPE_BLOCK,
5225        _ => {
5226            if !error.is_null() {
5227                *error = 1 as libc::c_int;
5228            }
5229            return 4294967295 as redisCommandArgType;
5230        }
5231    };
5232}
5233unsafe extern "C" fn moduleConvertArgFlags(mut flags: libc::c_int) -> libc::c_int {
5234    let mut realflags: libc::c_int = 0 as libc::c_int;
5235    if flags & (1 as libc::c_int) << 0 as libc::c_int != 0 {
5236        realflags |= (1 as libc::c_int) << 0 as libc::c_int;
5237    }
5238    if flags & (1 as libc::c_int) << 1 as libc::c_int != 0 {
5239        realflags |= (1 as libc::c_int) << 1 as libc::c_int;
5240    }
5241    if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
5242        realflags |= (1 as libc::c_int) << 2 as libc::c_int;
5243    }
5244    return realflags;
5245}
5246#[no_mangle]
5247pub unsafe extern "C" fn moduleGetHandleByName(
5248    mut modulename: *mut libc::c_char,
5249) -> *mut libc::c_void {
5250    return dictFetchValue(modules, modulename as *const libc::c_void);
5251}
5252#[no_mangle]
5253pub unsafe extern "C" fn moduleIsModuleCommand(
5254    mut module_handle: *mut libc::c_void,
5255    mut cmd: *mut redisCommand,
5256) -> libc::c_int {
5257    if (*cmd).proc_0
5258        != Some(RedisModuleCommandDispatcher as unsafe extern "C" fn(*mut client) -> ())
5259    {
5260        return 0 as libc::c_int;
5261    }
5262    if module_handle.is_null() {
5263        return 0 as libc::c_int;
5264    }
5265    let mut cp: *mut RedisModuleCommand = (*cmd).module_cmd;
5266    return ((*cp).module == module_handle as *mut RedisModule) as libc::c_int;
5267}
5268#[no_mangle]
5269pub unsafe extern "C" fn moduleListConfigMatch(
5270    mut config: *mut libc::c_void,
5271    mut name: *mut libc::c_void,
5272) -> libc::c_int {
5273    return (strcasecmp(
5274        (*(config as *mut ModuleConfig)).name as *const libc::c_char,
5275        name as *mut libc::c_char,
5276    ) == 0 as libc::c_int) as libc::c_int;
5277}
5278#[no_mangle]
5279pub unsafe extern "C" fn moduleListFree(mut config: *mut libc::c_void) {
5280    let mut module_config: *mut ModuleConfig = config as *mut ModuleConfig;
5281    sdsfree((*module_config).name);
5282    zfree(config);
5283}
5284#[no_mangle]
5285pub unsafe extern "C" fn RM_SetModuleAttribs(
5286    mut ctx: *mut RedisModuleCtx,
5287    mut name: *const libc::c_char,
5288    mut ver: libc::c_int,
5289    mut apiver: libc::c_int,
5290) {
5291    let mut module: *mut RedisModule = 0 as *mut RedisModule;
5292    if !((*ctx).module).is_null() {
5293        return;
5294    }
5295    module = zmalloc(core::mem::size_of::<RedisModule>() as libc::c_ulong)
5296        as *mut RedisModule;
5297    (*module).name = sdsnew(name);
5298    (*module).ver = ver;
5299    (*module).apiver = apiver;
5300    (*module).types = listCreate();
5301    (*module).usedby = listCreate();
5302    (*module).using = listCreate();
5303    (*module).filters = listCreate();
5304    (*module).module_configs = listCreate();
5305    (*(*module).module_configs)
5306        .match_0 = Some(
5307        moduleListConfigMatch
5308            as unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> libc::c_int,
5309    );
5310    (*(*module).module_configs)
5311        .free = Some(moduleListFree as unsafe extern "C" fn(*mut libc::c_void) -> ());
5312    (*module).in_call = 0 as libc::c_int;
5313    (*module).configs_initialized = 0 as libc::c_int;
5314    (*module).in_hook = 0 as libc::c_int;
5315    (*module).options = 0 as libc::c_int;
5316    (*module).info_cb = None;
5317    (*module).defrag_cb = None;
5318    (*module).loadmod = 0 as *mut moduleLoadQueueEntry;
5319    (*ctx).module = module;
5320}
5321#[no_mangle]
5322pub unsafe extern "C" fn RM_IsModuleNameBusy(
5323    mut name: *const libc::c_char,
5324) -> libc::c_int {
5325    let mut modulename: sds = sdsnew(name);
5326    let mut de: *mut dictEntry = dictFind(modules, modulename as *const libc::c_void);
5327    sdsfree(modulename);
5328    return (de != 0 as *mut libc::c_void as *mut dictEntry) as libc::c_int;
5329}
5330#[no_mangle]
5331pub unsafe extern "C" fn RM_Milliseconds() -> libc::c_longlong {
5332    return mstime();
5333}
5334#[no_mangle]
5335pub unsafe extern "C" fn RM_MonotonicMicroseconds() -> uint64_t {
5336    return getMonotonicUs.expect("non-null function pointer")();
5337}
5338#[no_mangle]
5339pub unsafe extern "C" fn RM_BlockedClientMeasureTimeStart(
5340    mut bc: *mut RedisModuleBlockedClient,
5341) -> libc::c_int {
5342    elapsedStart(&mut (*bc).background_timer);
5343    return 0 as libc::c_int;
5344}
5345#[no_mangle]
5346pub unsafe extern "C" fn RM_BlockedClientMeasureTimeEnd(
5347    mut bc: *mut RedisModuleBlockedClient,
5348) -> libc::c_int {
5349    if (*bc).background_timer == 0 {
5350        return 1 as libc::c_int;
5351    }
5352    (*bc)
5353        .background_duration = ((*bc).background_duration as libc::c_ulong)
5354        .wrapping_add(elapsedUs((*bc).background_timer)) as uint64_t as uint64_t;
5355    return 0 as libc::c_int;
5356}
5357#[no_mangle]
5358pub unsafe extern "C" fn RM_Yield(
5359    mut ctx: *mut RedisModuleCtx,
5360    mut flags: libc::c_int,
5361    mut busy_reply: *const libc::c_char,
5362) {
5363    static mut yield_nesting: libc::c_int = 0 as libc::c_int;
5364    if yield_nesting != 0 {
5365        return;
5366    }
5367    yield_nesting += 1;
5368    let mut now: libc::c_longlong = getMonotonicUs.expect("non-null function pointer")()
5369        as libc::c_longlong;
5370    if now >= (*ctx).next_yield_time {
5371        if server.loading != 0 {
5372            processEventsWhileBlocked();
5373        } else {
5374            let mut prev_busy_module_yield_reply: *const libc::c_char = server
5375                .busy_module_yield_reply;
5376            server.busy_module_yield_reply = busy_reply;
5377            if server.busy_module_yield_flags == 0 {
5378                server.busy_module_yield_flags = (1 as libc::c_int) << 0 as libc::c_int;
5379                blockingOperationStarts();
5380                if !(server.current_client).is_null() {
5381                    protectClient(server.current_client);
5382                }
5383            }
5384            if flags & (1 as libc::c_int) << 1 as libc::c_int != 0 {
5385                server.busy_module_yield_flags |= (1 as libc::c_int) << 1 as libc::c_int;
5386            }
5387            processEventsWhileBlocked();
5388            server.busy_module_yield_reply = prev_busy_module_yield_reply;
5389            server.busy_module_yield_flags &= !((1 as libc::c_int) << 1 as libc::c_int);
5390        }
5391        (*ctx)
5392            .next_yield_time = now
5393            + (1000000 as libc::c_int / server.hz) as libc::c_longlong;
5394    }
5395    yield_nesting -= 1;
5396}
5397#[no_mangle]
5398pub unsafe extern "C" fn RM_SetModuleOptions(
5399    mut ctx: *mut RedisModuleCtx,
5400    mut options: libc::c_int,
5401) {
5402    (*(*ctx).module).options = options;
5403}
5404#[no_mangle]
5405pub unsafe extern "C" fn RM_SignalModifiedKey(
5406    mut ctx: *mut RedisModuleCtx,
5407    mut keyname: *mut robj,
5408) -> libc::c_int {
5409    signalModifiedKey((*ctx).client, (*(*ctx).client).db, keyname);
5410    return 0 as libc::c_int;
5411}
5412#[no_mangle]
5413pub unsafe extern "C" fn RM_AutoMemory(mut ctx: *mut RedisModuleCtx) {
5414    (*ctx).flags |= (1 as libc::c_int) << 0 as libc::c_int;
5415}
5416#[no_mangle]
5417pub unsafe extern "C" fn autoMemoryAdd(
5418    mut ctx: *mut RedisModuleCtx,
5419    mut type_0: libc::c_int,
5420    mut ptr: *mut libc::c_void,
5421) {
5422    if (*ctx).flags & (1 as libc::c_int) << 0 as libc::c_int == 0 {
5423        return;
5424    }
5425    if (*ctx).amqueue_used == (*ctx).amqueue_len {
5426        (*ctx).amqueue_len *= 2 as libc::c_int;
5427        if (*ctx).amqueue_len < 16 as libc::c_int {
5428            (*ctx).amqueue_len = 16 as libc::c_int;
5429        }
5430        (*ctx)
5431            .amqueue = zrealloc(
5432            (*ctx).amqueue as *mut libc::c_void,
5433            (core::mem::size_of::<AutoMemEntry>() as libc::c_ulong)
5434                .wrapping_mul((*ctx).amqueue_len as libc::c_ulong),
5435        ) as *mut AutoMemEntry;
5436    }
5437    (*((*ctx).amqueue).offset((*ctx).amqueue_used as isize)).type_0 = type_0;
5438    let ref mut fresh17 = (*((*ctx).amqueue).offset((*ctx).amqueue_used as isize)).ptr;
5439    *fresh17 = ptr;
5440    (*ctx).amqueue_used += 1;
5441}
5442#[no_mangle]
5443pub unsafe extern "C" fn autoMemoryFreed(
5444    mut ctx: *mut RedisModuleCtx,
5445    mut type_0: libc::c_int,
5446    mut ptr: *mut libc::c_void,
5447) -> libc::c_int {
5448    if (*ctx).flags & (1 as libc::c_int) << 0 as libc::c_int == 0 {
5449        return 0 as libc::c_int;
5450    }
5451    let mut count: libc::c_int = ((*ctx).amqueue_used + 1 as libc::c_int)
5452        / 2 as libc::c_int;
5453    let mut j: libc::c_int = 0 as libc::c_int;
5454    while j < count {
5455        let mut side: libc::c_int = 0 as libc::c_int;
5456        while side < 2 as libc::c_int {
5457            let mut i: libc::c_int = if side == 0 as libc::c_int {
5458                (*ctx).amqueue_used - 1 as libc::c_int - j
5459            } else {
5460                j
5461            };
5462            if (*((*ctx).amqueue).offset(i as isize)).type_0 == type_0
5463                && (*((*ctx).amqueue).offset(i as isize)).ptr == ptr
5464            {
5465                (*((*ctx).amqueue).offset(i as isize)).type_0 = 3 as libc::c_int;
5466                if i != (*ctx).amqueue_used - 1 as libc::c_int {
5467                    *((*ctx).amqueue)
5468                        .offset(
5469                            i as isize,
5470                        ) = *((*ctx).amqueue)
5471                        .offset(((*ctx).amqueue_used - 1 as libc::c_int) as isize);
5472                }
5473                (*ctx).amqueue_used -= 1;
5474                return 1 as libc::c_int;
5475            }
5476            side += 1;
5477        }
5478        j += 1;
5479    }
5480    return 0 as libc::c_int;
5481}
5482#[no_mangle]
5483pub unsafe extern "C" fn autoMemoryCollect(mut ctx: *mut RedisModuleCtx) {
5484    if (*ctx).flags & (1 as libc::c_int) << 0 as libc::c_int == 0 {
5485        return;
5486    }
5487    (*ctx).flags &= !((1 as libc::c_int) << 0 as libc::c_int);
5488    let mut j: libc::c_int = 0;
5489    j = 0 as libc::c_int;
5490    while j < (*ctx).amqueue_used {
5491        let mut ptr: *mut libc::c_void = (*((*ctx).amqueue).offset(j as isize)).ptr;
5492        match (*((*ctx).amqueue).offset(j as isize)).type_0 {
5493            1 => {
5494                decrRefCount(ptr as *mut robj);
5495            }
5496            2 => {
5497                RM_FreeCallReply(ptr as *mut RedisModuleCallReply);
5498            }
5499            0 => {
5500                RM_CloseKey(ptr as *mut RedisModuleKey);
5501            }
5502            4 => {
5503                RM_FreeDict(0 as *mut RedisModuleCtx, ptr as *mut RedisModuleDict);
5504            }
5505            5 => {
5506                RM_FreeServerInfo(
5507                    0 as *mut RedisModuleCtx,
5508                    ptr as *mut RedisModuleServerInfoData,
5509                );
5510            }
5511            _ => {}
5512        }
5513        j += 1;
5514    }
5515    (*ctx).flags |= (1 as libc::c_int) << 0 as libc::c_int;
5516    zfree((*ctx).amqueue as *mut libc::c_void);
5517    (*ctx).amqueue = 0 as *mut AutoMemEntry;
5518    (*ctx).amqueue_len = 0 as libc::c_int;
5519    (*ctx).amqueue_used = 0 as libc::c_int;
5520}
5521#[no_mangle]
5522pub unsafe extern "C" fn RM_CreateString(
5523    mut ctx: *mut RedisModuleCtx,
5524    mut ptr: *const libc::c_char,
5525    mut len: size_t,
5526) -> *mut robj {
5527    let mut o: *mut robj = createStringObject(ptr, len);
5528    if !ctx.is_null() {
5529        autoMemoryAdd(ctx, 1 as libc::c_int, o as *mut libc::c_void);
5530    }
5531    return o;
5532}
5533#[no_mangle]
5534pub unsafe extern "C" fn RM_CreateStringPrintf(
5535    mut ctx: *mut RedisModuleCtx,
5536    mut fmt: *const libc::c_char,
5537    mut args: ...
5538) -> *mut robj {
5539    let mut s: sds = sdsempty();
5540    let mut ap: core::ffi::VaListImpl;
5541    ap = args.clone();
5542    s = sdscatvprintf(s, fmt, ap.as_va_list());
5543    let mut o: *mut robj = createObject(0 as libc::c_int, s as *mut libc::c_void);
5544    if !ctx.is_null() {
5545        autoMemoryAdd(ctx, 1 as libc::c_int, o as *mut libc::c_void);
5546    }
5547    return o;
5548}
5549#[no_mangle]
5550pub unsafe extern "C" fn RM_CreateStringFromLongLong(
5551    mut ctx: *mut RedisModuleCtx,
5552    mut ll: libc::c_longlong,
5553) -> *mut robj {
5554    let mut buf: [libc::c_char; 21] = [0; 21];
5555    let mut len: size_t = ll2string(
5556        buf.as_mut_ptr(),
5557        core::mem::size_of::<[libc::c_char; 21]>() as libc::c_ulong,
5558        ll,
5559    ) as size_t;
5560    return RM_CreateString(ctx, buf.as_mut_ptr(), len);
5561}
5562#[no_mangle]
5563pub unsafe extern "C" fn RM_CreateStringFromULongLong(
5564    mut ctx: *mut RedisModuleCtx,
5565    mut ull: libc::c_ulonglong,
5566) -> *mut robj {
5567    let mut buf: [libc::c_char; 21] = [0; 21];
5568    let mut len: size_t = ull2string(
5569        buf.as_mut_ptr(),
5570        core::mem::size_of::<[libc::c_char; 21]>() as libc::c_ulong,
5571        ull,
5572    ) as size_t;
5573    return RM_CreateString(ctx, buf.as_mut_ptr(), len);
5574}
5575#[no_mangle]
5576pub unsafe extern "C" fn RM_CreateStringFromDouble(
5577    mut ctx: *mut RedisModuleCtx,
5578    mut d: libc::c_double,
5579) -> *mut robj {
5580    let mut buf: [libc::c_char; 128] = [0; 128];
5581    let mut len: size_t = d2string(
5582        buf.as_mut_ptr(),
5583        core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong,
5584        d,
5585    ) as size_t;
5586    return RM_CreateString(ctx, buf.as_mut_ptr(), len);
5587}
5588#[no_mangle]
5589pub unsafe extern "C" fn RM_CreateStringFromLongDouble(
5590    mut ctx: *mut RedisModuleCtx,
5591    mut ld: f64,
5592    mut humanfriendly: libc::c_int,
5593) -> *mut robj {
5594    let mut buf: [libc::c_char; 5120] = [0; 5120];
5595    let mut len: size_t = ld2string(
5596        buf.as_mut_ptr(),
5597        core::mem::size_of::<[libc::c_char; 5120]>() as libc::c_ulong,
5598        ld,
5599        (if humanfriendly != 0 {
5600            LD_STR_HUMAN as libc::c_int
5601        } else {
5602            LD_STR_AUTO as libc::c_int
5603        }) as ld2string_mode,
5604    ) as size_t;
5605    return RM_CreateString(ctx, buf.as_mut_ptr(), len);
5606}
5607#[no_mangle]
5608pub unsafe extern "C" fn RM_CreateStringFromString(
5609    mut ctx: *mut RedisModuleCtx,
5610    mut str: *const robj,
5611) -> *mut robj {
5612    let mut o: *mut robj = dupStringObject(str);
5613    if !ctx.is_null() {
5614        autoMemoryAdd(ctx, 1 as libc::c_int, o as *mut libc::c_void);
5615    }
5616    return o;
5617}
5618#[no_mangle]
5619pub unsafe extern "C" fn RM_CreateStringFromStreamID(
5620    mut ctx: *mut RedisModuleCtx,
5621    mut id: *const RedisModuleStreamID,
5622) -> *mut robj {
5623    let mut streamid: streamID = {
5624        let mut init = streamID {
5625            ms: (*id).ms,
5626            seq: (*id).seq,
5627        };
5628        init
5629    };
5630    let mut o: *mut robj = createObjectFromStreamID(&mut streamid);
5631    if !ctx.is_null() {
5632        autoMemoryAdd(ctx, 1 as libc::c_int, o as *mut libc::c_void);
5633    }
5634    return o;
5635}
5636#[no_mangle]
5637pub unsafe extern "C" fn RM_FreeString(
5638    mut ctx: *mut RedisModuleCtx,
5639    mut str: *mut robj,
5640) {
5641    decrRefCount(str);
5642    if !ctx.is_null() {
5643        autoMemoryFreed(ctx, 1 as libc::c_int, str as *mut libc::c_void);
5644    }
5645}
5646#[no_mangle]
5647pub unsafe extern "C" fn RM_RetainString(
5648    mut ctx: *mut RedisModuleCtx,
5649    mut str: *mut robj,
5650) {
5651    if ctx.is_null()
5652        || autoMemoryFreed(ctx, 1 as libc::c_int, str as *mut libc::c_void) == 0
5653    {
5654        incrRefCount(str);
5655    }
5656}
5657#[no_mangle]
5658pub unsafe extern "C" fn RM_HoldString(
5659    mut ctx: *mut RedisModuleCtx,
5660    mut str: *mut robj,
5661) -> *mut robj {
5662    if (*str).refcount == 2147483647 as libc::c_int - 1 as libc::c_int {
5663        return RM_CreateStringFromString(ctx, str);
5664    }
5665    incrRefCount(str);
5666    if !ctx.is_null() {
5667        autoMemoryAdd(ctx, 1 as libc::c_int, str as *mut libc::c_void);
5668    }
5669    return str;
5670}
5671#[no_mangle]
5672pub unsafe extern "C" fn RM_StringPtrLen(
5673    mut str: *const robj,
5674    mut len: *mut size_t,
5675) -> *const libc::c_char {
5676    if str.is_null() {
5677        let mut errmsg: *const libc::c_char = b"(NULL string reply referenced in module)\0"
5678            as *const u8 as *const libc::c_char;
5679        if !len.is_null() {
5680            *len = strlen(errmsg);
5681        }
5682        return errmsg;
5683    }
5684    if !len.is_null() {
5685        *len = sdslen((*str).ptr as sds);
5686    }
5687    return (*str).ptr as *const libc::c_char;
5688}
5689#[no_mangle]
5690pub unsafe extern "C" fn RM_StringToLongLong(
5691    mut str: *const robj,
5692    mut ll: *mut libc::c_longlong,
5693) -> libc::c_int {
5694    return if string2ll((*str).ptr as *const libc::c_char, sdslen((*str).ptr as sds), ll)
5695        != 0
5696    {
5697        0 as libc::c_int
5698    } else {
5699        1 as libc::c_int
5700    };
5701}
5702#[no_mangle]
5703pub unsafe extern "C" fn RM_StringToULongLong(
5704    mut str: *const robj,
5705    mut ull: *mut libc::c_ulonglong,
5706) -> libc::c_int {
5707    return if string2ull((*str).ptr as *const libc::c_char, ull) != 0 {
5708        0 as libc::c_int
5709    } else {
5710        1 as libc::c_int
5711    };
5712}
5713#[no_mangle]
5714pub unsafe extern "C" fn RM_StringToDouble(
5715    mut str: *const robj,
5716    mut d: *mut libc::c_double,
5717) -> libc::c_int {
5718    let mut retval: libc::c_int = getDoubleFromObject(str, d);
5719    return if retval == 0 as libc::c_int { 0 as libc::c_int } else { 1 as libc::c_int };
5720}
5721#[no_mangle]
5722pub unsafe extern "C" fn RM_StringToLongDouble(
5723    mut str: *const robj,
5724    mut ld: *mut f64,
5725) -> libc::c_int {
5726    let mut retval: libc::c_int = string2ld(
5727        (*str).ptr as *const libc::c_char,
5728        sdslen((*str).ptr as sds),
5729        ld,
5730    );
5731    return if retval != 0 { 0 as libc::c_int } else { 1 as libc::c_int };
5732}
5733#[no_mangle]
5734pub unsafe extern "C" fn RM_StringToStreamID(
5735    mut str: *const robj,
5736    mut id: *mut RedisModuleStreamID,
5737) -> libc::c_int {
5738    let mut streamid: streamID = streamID { ms: 0, seq: 0 };
5739    if streamParseID(str, &mut streamid) == 0 as libc::c_int {
5740        (*id).ms = streamid.ms;
5741        (*id).seq = streamid.seq;
5742        return 0 as libc::c_int;
5743    } else {
5744        return 1 as libc::c_int
5745    };
5746}
5747#[no_mangle]
5748pub unsafe extern "C" fn RM_StringCompare(
5749    mut a: *mut robj,
5750    mut b: *mut robj,
5751) -> libc::c_int {
5752    return compareStringObjects(a, b);
5753}
5754#[no_mangle]
5755pub unsafe extern "C" fn moduleAssertUnsharedString(mut str: *mut robj) -> *mut robj {
5756    if (*str).refcount != 1 as libc::c_int {
5757        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5758            _serverLog(
5759                3 as libc::c_int,
5760                b"Module attempted to use an in-place string modify operation with a string referenced multiple times. Please check the code for API usage correctness.\0"
5761                    as *const u8 as *const libc::c_char,
5762            );
5763        }
5764        return 0 as *mut robj;
5765    }
5766    if (*str).encoding() as libc::c_int == 8 as libc::c_int {
5767        (*str)
5768            .ptr = sdsnewlen((*str).ptr, sdslen((*str).ptr as sds)) as *mut libc::c_void;
5769        (*str).set_encoding(0 as libc::c_int as libc::c_uint);
5770    } else if (*str).encoding() as libc::c_int == 1 as libc::c_int {
5771        (*str)
5772            .ptr = sdsfromlonglong((*str).ptr as libc::c_long as libc::c_longlong)
5773            as *mut libc::c_void;
5774        (*str).set_encoding(0 as libc::c_int as libc::c_uint);
5775    }
5776    return str;
5777}
5778#[no_mangle]
5779pub unsafe extern "C" fn RM_StringAppendBuffer(
5780    mut ctx: *mut RedisModuleCtx,
5781    mut str: *mut robj,
5782    mut buf: *const libc::c_char,
5783    mut len: size_t,
5784) -> libc::c_int {
5785    str = moduleAssertUnsharedString(str);
5786    if str.is_null() {
5787        return 1 as libc::c_int;
5788    }
5789    (*str)
5790        .ptr = sdscatlen((*str).ptr as sds, buf as *const libc::c_void, len)
5791        as *mut libc::c_void;
5792    return 0 as libc::c_int;
5793}
5794#[no_mangle]
5795pub unsafe extern "C" fn RM_TrimStringAllocation(mut str: *mut robj) {
5796    if str.is_null() {
5797        return;
5798    }
5799    trimStringObjectIfNeeded(str);
5800}
5801#[no_mangle]
5802pub unsafe extern "C" fn RM_WrongArity(mut ctx: *mut RedisModuleCtx) -> libc::c_int {
5803    addReplyErrorArity((*ctx).client);
5804    return 0 as libc::c_int;
5805}
5806#[no_mangle]
5807pub unsafe extern "C" fn moduleGetReplyClient(
5808    mut ctx: *mut RedisModuleCtx,
5809) -> *mut client {
5810    if (*ctx).flags & (1 as libc::c_int) << 4 as libc::c_int != 0 {
5811        if !((*ctx).blocked_client).is_null() {
5812            return (*(*ctx).blocked_client).reply_client
5813        } else {
5814            return 0 as *mut client
5815        }
5816    } else {
5817        return (*ctx).client
5818    };
5819}
5820#[no_mangle]
5821pub unsafe extern "C" fn RM_ReplyWithLongLong(
5822    mut ctx: *mut RedisModuleCtx,
5823    mut ll: libc::c_longlong,
5824) -> libc::c_int {
5825    let mut c: *mut client = moduleGetReplyClient(ctx);
5826    if c.is_null() {
5827        return 0 as libc::c_int;
5828    }
5829    addReplyLongLong(c, ll);
5830    return 0 as libc::c_int;
5831}
5832#[no_mangle]
5833pub unsafe extern "C" fn RM_ReplyWithError(
5834    mut ctx: *mut RedisModuleCtx,
5835    mut err: *const libc::c_char,
5836) -> libc::c_int {
5837    let mut c: *mut client = moduleGetReplyClient(ctx);
5838    if c.is_null() {
5839        return 0 as libc::c_int;
5840    }
5841    addReplyErrorFormat(c, b"-%s\0" as *const u8 as *const libc::c_char, err);
5842    return 0 as libc::c_int;
5843}
5844#[no_mangle]
5845pub unsafe extern "C" fn RM_ReplyWithSimpleString(
5846    mut ctx: *mut RedisModuleCtx,
5847    mut msg: *const libc::c_char,
5848) -> libc::c_int {
5849    let mut c: *mut client = moduleGetReplyClient(ctx);
5850    if c.is_null() {
5851        return 0 as libc::c_int;
5852    }
5853    addReplyProto(
5854        c,
5855        b"+\0" as *const u8 as *const libc::c_char,
5856        1 as libc::c_int as size_t,
5857    );
5858    addReplyProto(c, msg, strlen(msg));
5859    addReplyProto(
5860        c,
5861        b"\r\n\0" as *const u8 as *const libc::c_char,
5862        2 as libc::c_int as size_t,
5863    );
5864    return 0 as libc::c_int;
5865}
5866#[no_mangle]
5867pub unsafe extern "C" fn moduleReplyWithCollection(
5868    mut ctx: *mut RedisModuleCtx,
5869    mut len: libc::c_long,
5870    mut type_0: libc::c_int,
5871) -> libc::c_int {
5872    let mut c: *mut client = moduleGetReplyClient(ctx);
5873    if c.is_null() {
5874        return 0 as libc::c_int;
5875    }
5876    if len == -(1 as libc::c_int) as libc::c_long {
5877        (*ctx)
5878            .postponed_arrays = zrealloc(
5879            (*ctx).postponed_arrays as *mut libc::c_void,
5880            (core::mem::size_of::<*mut libc::c_void>() as libc::c_ulong)
5881                .wrapping_mul(
5882                    ((*ctx).postponed_arrays_count + 1 as libc::c_int) as libc::c_ulong,
5883                ),
5884        ) as *mut *mut libc::c_void;
5885        let ref mut fresh18 = *((*ctx).postponed_arrays)
5886            .offset((*ctx).postponed_arrays_count as isize);
5887        *fresh18 = addReplyDeferredLen(c);
5888        (*ctx).postponed_arrays_count += 1;
5889    } else if len == 0 as libc::c_int as libc::c_long {
5890        match type_0 {
5891            1 => {
5892                addReply(c, shared.emptyarray);
5893            }
5894            2 => {
5895                addReply(c, shared.emptymap[(*c).resp as usize]);
5896            }
5897            3 => {
5898                addReply(c, shared.emptyset[(*c).resp as usize]);
5899            }
5900            4 => {
5901                addReplyAttributeLen(c, len);
5902            }
5903            _ => {
5904                _serverPanic(
5905                    b"module.c\0" as *const u8 as *const libc::c_char,
5906                    2793 as libc::c_int,
5907                    b"Invalid module empty reply type %d\0" as *const u8
5908                        as *const libc::c_char,
5909                    type_0,
5910                );
5911                unreachable!();
5912            }
5913        }
5914    } else {
5915        match type_0 {
5916            1 => {
5917                addReplyArrayLen(c, len);
5918            }
5919            2 => {
5920                addReplyMapLen(c, len);
5921            }
5922            3 => {
5923                addReplySetLen(c, len);
5924            }
5925            4 => {
5926                addReplyAttributeLen(c, len);
5927            }
5928            _ => {
5929                _serverPanic(
5930                    b"module.c\0" as *const u8 as *const libc::c_char,
5931                    2809 as libc::c_int,
5932                    b"Invalid module reply type %d\0" as *const u8
5933                        as *const libc::c_char,
5934                    type_0,
5935                );
5936                unreachable!();
5937            }
5938        }
5939    }
5940    return 0 as libc::c_int;
5941}
5942#[no_mangle]
5943pub unsafe extern "C" fn RM_ReplyWithArray(
5944    mut ctx: *mut RedisModuleCtx,
5945    mut len: libc::c_long,
5946) -> libc::c_int {
5947    return moduleReplyWithCollection(ctx, len, 1 as libc::c_int);
5948}
5949#[no_mangle]
5950pub unsafe extern "C" fn RM_ReplyWithMap(
5951    mut ctx: *mut RedisModuleCtx,
5952    mut len: libc::c_long,
5953) -> libc::c_int {
5954    return moduleReplyWithCollection(ctx, len, 2 as libc::c_int);
5955}
5956#[no_mangle]
5957pub unsafe extern "C" fn RM_ReplyWithSet(
5958    mut ctx: *mut RedisModuleCtx,
5959    mut len: libc::c_long,
5960) -> libc::c_int {
5961    return moduleReplyWithCollection(ctx, len, 3 as libc::c_int);
5962}
5963#[no_mangle]
5964pub unsafe extern "C" fn RM_ReplyWithAttribute(
5965    mut ctx: *mut RedisModuleCtx,
5966    mut len: libc::c_long,
5967) -> libc::c_int {
5968    if (*(*ctx).client).resp == 2 as libc::c_int {
5969        return 1 as libc::c_int;
5970    }
5971    return moduleReplyWithCollection(ctx, len, 4 as libc::c_int);
5972}
5973#[no_mangle]
5974pub unsafe extern "C" fn RM_ReplyWithNullArray(
5975    mut ctx: *mut RedisModuleCtx,
5976) -> libc::c_int {
5977    let mut c: *mut client = moduleGetReplyClient(ctx);
5978    if c.is_null() {
5979        return 0 as libc::c_int;
5980    }
5981    addReplyNullArray(c);
5982    return 0 as libc::c_int;
5983}
5984#[no_mangle]
5985pub unsafe extern "C" fn RM_ReplyWithEmptyArray(
5986    mut ctx: *mut RedisModuleCtx,
5987) -> libc::c_int {
5988    let mut c: *mut client = moduleGetReplyClient(ctx);
5989    if c.is_null() {
5990        return 0 as libc::c_int;
5991    }
5992    addReply(c, shared.emptyarray);
5993    return 0 as libc::c_int;
5994}
5995#[no_mangle]
5996pub unsafe extern "C" fn moduleReplySetCollectionLength(
5997    mut ctx: *mut RedisModuleCtx,
5998    mut len: libc::c_long,
5999    mut type_0: libc::c_int,
6000) {
6001    let mut c: *mut client = moduleGetReplyClient(ctx);
6002    if c.is_null() {
6003        return;
6004    }
6005    if (*ctx).postponed_arrays_count == 0 as libc::c_int {
6006        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
6007            _serverLog(
6008                3 as libc::c_int,
6009                b"API misuse detected in module %s: RedisModule_ReplySet*Length() called without previous RedisModule_ReplyWith*(ctx,REDISMODULE_POSTPONED_LEN) call.\0"
6010                    as *const u8 as *const libc::c_char,
6011                (*(*ctx).module).name,
6012            );
6013        }
6014        return;
6015    }
6016    (*ctx).postponed_arrays_count -= 1;
6017    match type_0 {
6018        1 => {
6019            setDeferredArrayLen(
6020                c,
6021                *((*ctx).postponed_arrays)
6022                    .offset((*ctx).postponed_arrays_count as isize),
6023                len,
6024            );
6025        }
6026        2 => {
6027            setDeferredMapLen(
6028                c,
6029                *((*ctx).postponed_arrays)
6030                    .offset((*ctx).postponed_arrays_count as isize),
6031                len,
6032            );
6033        }
6034        3 => {
6035            setDeferredSetLen(
6036                c,
6037                *((*ctx).postponed_arrays)
6038                    .offset((*ctx).postponed_arrays_count as isize),
6039                len,
6040            );
6041        }
6042        4 => {
6043            setDeferredAttributeLen(
6044                c,
6045                *((*ctx).postponed_arrays)
6046                    .offset((*ctx).postponed_arrays_count as isize),
6047                len,
6048            );
6049        }
6050        _ => {
6051            _serverPanic(
6052                b"module.c\0" as *const u8 as *const libc::c_char,
6053                2931 as libc::c_int,
6054                b"Invalid module reply type %d\0" as *const u8 as *const libc::c_char,
6055                type_0,
6056            );
6057            unreachable!();
6058        }
6059    }
6060    if (*ctx).postponed_arrays_count == 0 as libc::c_int {
6061        zfree((*ctx).postponed_arrays as *mut libc::c_void);
6062        (*ctx).postponed_arrays = 0 as *mut *mut libc::c_void;
6063    }
6064}
6065#[no_mangle]
6066pub unsafe extern "C" fn RM_ReplySetArrayLength(
6067    mut ctx: *mut RedisModuleCtx,
6068    mut len: libc::c_long,
6069) {
6070    moduleReplySetCollectionLength(ctx, len, 1 as libc::c_int);
6071}
6072#[no_mangle]
6073pub unsafe extern "C" fn RM_ReplySetMapLength(
6074    mut ctx: *mut RedisModuleCtx,
6075    mut len: libc::c_long,
6076) {
6077    moduleReplySetCollectionLength(ctx, len, 2 as libc::c_int);
6078}
6079#[no_mangle]
6080pub unsafe extern "C" fn RM_ReplySetSetLength(
6081    mut ctx: *mut RedisModuleCtx,
6082    mut len: libc::c_long,
6083) {
6084    moduleReplySetCollectionLength(ctx, len, 3 as libc::c_int);
6085}
6086#[no_mangle]
6087pub unsafe extern "C" fn RM_ReplySetAttributeLength(
6088    mut ctx: *mut RedisModuleCtx,
6089    mut len: libc::c_long,
6090) {
6091    if (*(*ctx).client).resp == 2 as libc::c_int {
6092        return;
6093    }
6094    moduleReplySetCollectionLength(ctx, len, 4 as libc::c_int);
6095}
6096#[no_mangle]
6097pub unsafe extern "C" fn RM_ReplyWithStringBuffer(
6098    mut ctx: *mut RedisModuleCtx,
6099    mut buf: *const libc::c_char,
6100    mut len: size_t,
6101) -> libc::c_int {
6102    let mut c: *mut client = moduleGetReplyClient(ctx);
6103    if c.is_null() {
6104        return 0 as libc::c_int;
6105    }
6106    addReplyBulkCBuffer(c, buf as *mut libc::c_char as *const libc::c_void, len);
6107    return 0 as libc::c_int;
6108}
6109#[no_mangle]
6110pub unsafe extern "C" fn RM_ReplyWithCString(
6111    mut ctx: *mut RedisModuleCtx,
6112    mut buf: *const libc::c_char,
6113) -> libc::c_int {
6114    let mut c: *mut client = moduleGetReplyClient(ctx);
6115    if c.is_null() {
6116        return 0 as libc::c_int;
6117    }
6118    addReplyBulkCString(c, buf as *mut libc::c_char);
6119    return 0 as libc::c_int;
6120}
6121#[no_mangle]
6122pub unsafe extern "C" fn RM_ReplyWithString(
6123    mut ctx: *mut RedisModuleCtx,
6124    mut str: *mut robj,
6125) -> libc::c_int {
6126    let mut c: *mut client = moduleGetReplyClient(ctx);
6127    if c.is_null() {
6128        return 0 as libc::c_int;
6129    }
6130    addReplyBulk(c, str);
6131    return 0 as libc::c_int;
6132}
6133#[no_mangle]
6134pub unsafe extern "C" fn RM_ReplyWithEmptyString(
6135    mut ctx: *mut RedisModuleCtx,
6136) -> libc::c_int {
6137    let mut c: *mut client = moduleGetReplyClient(ctx);
6138    if c.is_null() {
6139        return 0 as libc::c_int;
6140    }
6141    addReply(c, shared.emptybulk);
6142    return 0 as libc::c_int;
6143}
6144#[no_mangle]
6145pub unsafe extern "C" fn RM_ReplyWithVerbatimStringType(
6146    mut ctx: *mut RedisModuleCtx,
6147    mut buf: *const libc::c_char,
6148    mut len: size_t,
6149    mut ext: *const libc::c_char,
6150) -> libc::c_int {
6151    let mut c: *mut client = moduleGetReplyClient(ctx);
6152    if c.is_null() {
6153        return 0 as libc::c_int;
6154    }
6155    addReplyVerbatim(c, buf, len, ext);
6156    return 0 as libc::c_int;
6157}
6158#[no_mangle]
6159pub unsafe extern "C" fn RM_ReplyWithVerbatimString(
6160    mut ctx: *mut RedisModuleCtx,
6161    mut buf: *const libc::c_char,
6162    mut len: size_t,
6163) -> libc::c_int {
6164    return RM_ReplyWithVerbatimStringType(
6165        ctx,
6166        buf,
6167        len,
6168        b"txt\0" as *const u8 as *const libc::c_char,
6169    );
6170}
6171#[no_mangle]
6172pub unsafe extern "C" fn RM_ReplyWithNull(mut ctx: *mut RedisModuleCtx) -> libc::c_int {
6173    let mut c: *mut client = moduleGetReplyClient(ctx);
6174    if c.is_null() {
6175        return 0 as libc::c_int;
6176    }
6177    addReplyNull(c);
6178    return 0 as libc::c_int;
6179}
6180#[no_mangle]
6181pub unsafe extern "C" fn RM_ReplyWithBool(
6182    mut ctx: *mut RedisModuleCtx,
6183    mut b: libc::c_int,
6184) -> libc::c_int {
6185    let mut c: *mut client = moduleGetReplyClient(ctx);
6186    if c.is_null() {
6187        return 0 as libc::c_int;
6188    }
6189    addReplyBool(c, b);
6190    return 0 as libc::c_int;
6191}
6192#[no_mangle]
6193pub unsafe extern "C" fn RM_ReplyWithCallReply(
6194    mut ctx: *mut RedisModuleCtx,
6195    mut reply: *mut RedisModuleCallReply,
6196) -> libc::c_int {
6197    let mut c: *mut client = moduleGetReplyClient(ctx);
6198    if c.is_null() {
6199        return 0 as libc::c_int;
6200    }
6201    if (*c).resp == 2 as libc::c_int && callReplyIsResp3(reply) != 0 {
6202        return 1 as libc::c_int;
6203    }
6204    let mut proto_len: size_t = 0;
6205    let mut proto: *const libc::c_char = callReplyGetProto(reply, &mut proto_len);
6206    addReplyProto(c, proto, proto_len);
6207    let mut errors: *mut list = callReplyDeferredErrorList(reply);
6208    if !errors.is_null() {
6209        deferredAfterErrorReply(c, errors);
6210    }
6211    return 0 as libc::c_int;
6212}
6213#[no_mangle]
6214pub unsafe extern "C" fn RM_ReplyWithDouble(
6215    mut ctx: *mut RedisModuleCtx,
6216    mut d: libc::c_double,
6217) -> libc::c_int {
6218    let mut c: *mut client = moduleGetReplyClient(ctx);
6219    if c.is_null() {
6220        return 0 as libc::c_int;
6221    }
6222    addReplyDouble(c, d);
6223    return 0 as libc::c_int;
6224}
6225#[no_mangle]
6226pub unsafe extern "C" fn RM_ReplyWithBigNumber(
6227    mut ctx: *mut RedisModuleCtx,
6228    mut bignum: *const libc::c_char,
6229    mut len: size_t,
6230) -> libc::c_int {
6231    let mut c: *mut client = moduleGetReplyClient(ctx);
6232    if c.is_null() {
6233        return 0 as libc::c_int;
6234    }
6235    addReplyBigNum(c, bignum, len);
6236    return 0 as libc::c_int;
6237}
6238#[no_mangle]
6239pub unsafe extern "C" fn RM_ReplyWithLongDouble(
6240    mut ctx: *mut RedisModuleCtx,
6241    mut ld: f64,
6242) -> libc::c_int {
6243    let mut c: *mut client = moduleGetReplyClient(ctx);
6244    if c.is_null() {
6245        return 0 as libc::c_int;
6246    }
6247    addReplyHumanLongDouble(c, ld);
6248    return 0 as libc::c_int;
6249}
6250#[no_mangle]
6251pub unsafe extern "C" fn RM_Replicate(
6252    mut ctx: *mut RedisModuleCtx,
6253    mut cmdname: *const libc::c_char,
6254    mut fmt: *const libc::c_char,
6255    mut args: ...
6256) -> libc::c_int {
6257    let mut cmd: *mut redisCommand = 0 as *mut redisCommand;
6258    let mut argv: *mut *mut robj = 0 as *mut *mut robj;
6259    let mut argc: libc::c_int = 0 as libc::c_int;
6260    let mut flags: libc::c_int = 0 as libc::c_int;
6261    let mut j: libc::c_int = 0;
6262    let mut ap: core::ffi::VaListImpl;
6263    cmd = lookupCommandByCString(cmdname as *mut libc::c_char);
6264    if cmd.is_null() {
6265        return 1 as libc::c_int;
6266    }
6267    ap = args.clone();
6268    argv = moduleCreateArgvFromUserFormat(
6269        cmdname,
6270        fmt,
6271        &mut argc,
6272        0 as *mut libc::c_int,
6273        &mut flags,
6274        ap.as_va_list(),
6275    );
6276    if argv.is_null() {
6277        return 1 as libc::c_int;
6278    }
6279    let mut target: libc::c_int = 0 as libc::c_int;
6280    if flags & (1 as libc::c_int) << 1 as libc::c_int == 0 {
6281        target |= 1 as libc::c_int;
6282    }
6283    if flags & (1 as libc::c_int) << 2 as libc::c_int == 0 {
6284        target |= 2 as libc::c_int;
6285    }
6286    alsoPropagate((*(*(*ctx).client).db).id, argv, argc, target);
6287    j = 0 as libc::c_int;
6288    while j < argc {
6289        decrRefCount(*argv.offset(j as isize));
6290        j += 1;
6291    }
6292    zfree(argv as *mut libc::c_void);
6293    server.dirty += 1;
6294    return 0 as libc::c_int;
6295}
6296#[no_mangle]
6297pub unsafe extern "C" fn RM_ReplicateVerbatim(
6298    mut ctx: *mut RedisModuleCtx,
6299) -> libc::c_int {
6300    alsoPropagate(
6301        (*(*(*ctx).client).db).id,
6302        (*(*ctx).client).argv,
6303        (*(*ctx).client).argc,
6304        1 as libc::c_int | 2 as libc::c_int,
6305    );
6306    server.dirty += 1;
6307    return 0 as libc::c_int;
6308}
6309#[no_mangle]
6310pub unsafe extern "C" fn RM_GetClientId(
6311    mut ctx: *mut RedisModuleCtx,
6312) -> libc::c_ulonglong {
6313    if ((*ctx).client).is_null() {
6314        return 0 as libc::c_int as libc::c_ulonglong;
6315    }
6316    return (*(*ctx).client).id as libc::c_ulonglong;
6317}
6318#[no_mangle]
6319pub unsafe extern "C" fn RM_GetClientUserNameById(
6320    mut ctx: *mut RedisModuleCtx,
6321    mut id: uint64_t,
6322) -> *mut robj {
6323    let mut client: *mut client = lookupClientByID(id);
6324    if client.is_null() {
6325        *__errno_location() = 2 as libc::c_int;
6326        return 0 as *mut robj;
6327    }
6328    if ((*client).user).is_null() {
6329        *__errno_location() = 95 as libc::c_int;
6330        return 0 as *mut robj;
6331    }
6332    let mut name: sds = sdsnew((*(*client).user).name as *const libc::c_char);
6333    let mut str: *mut robj = createObject(0 as libc::c_int, name as *mut libc::c_void);
6334    autoMemoryAdd(ctx, 1 as libc::c_int, str as *mut libc::c_void);
6335    return str;
6336}
6337#[no_mangle]
6338pub unsafe extern "C" fn modulePopulateClientInfoStructure(
6339    mut ci: *mut libc::c_void,
6340    mut client: *mut client,
6341    mut structver: libc::c_int,
6342) -> libc::c_int {
6343    if structver != 1 as libc::c_int {
6344        return 1 as libc::c_int;
6345    }
6346    let mut ci1: *mut RedisModuleClientInfoV1 = ci as *mut RedisModuleClientInfoV1;
6347    memset(
6348        ci1 as *mut libc::c_void,
6349        0 as libc::c_int,
6350        core::mem::size_of::<RedisModuleClientInfoV1>() as libc::c_ulong,
6351    );
6352    (*ci1).version = structver as uint64_t;
6353    if (*client).flags & ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_ulong != 0 {
6354        (*ci1).flags |= ((1 as libc::c_int) << 5 as libc::c_int) as libc::c_ulong;
6355    }
6356    if (*client).flags & ((1 as libc::c_int) << 18 as libc::c_int) as libc::c_ulong != 0
6357    {
6358        (*ci1).flags |= ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_ulong;
6359    }
6360    if (*client).flags & ((1 as libc::c_int) << 11 as libc::c_int) as libc::c_ulong != 0
6361    {
6362        (*ci1).flags |= ((1 as libc::c_int) << 4 as libc::c_int) as libc::c_ulong;
6363    }
6364    if (*client).flags as libc::c_ulonglong
6365        & (1 as libc::c_ulonglong) << 31 as libc::c_int != 0
6366    {
6367        (*ci1).flags |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_ulong;
6368    }
6369    if (*client).flags & ((1 as libc::c_int) << 4 as libc::c_int) as libc::c_ulong != 0 {
6370        (*ci1).flags |= ((1 as libc::c_int) << 2 as libc::c_int) as libc::c_ulong;
6371    }
6372    if connGetType((*client).conn) == 2 as libc::c_int {
6373        (*ci1).flags |= ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_ulong;
6374    }
6375    let mut port: libc::c_int = 0;
6376    connPeerToString(
6377        (*client).conn,
6378        ((*ci1).addr).as_mut_ptr(),
6379        core::mem::size_of::<[libc::c_char; 46]>() as libc::c_ulong,
6380        &mut port,
6381    );
6382    (*ci1).port = port as uint16_t;
6383    (*ci1).db = (*(*client).db).id as uint16_t;
6384    (*ci1).id = (*client).id;
6385    return 0 as libc::c_int;
6386}
6387#[no_mangle]
6388pub unsafe extern "C" fn modulePopulateReplicationInfoStructure(
6389    mut ri: *mut libc::c_void,
6390    mut structver: libc::c_int,
6391) -> libc::c_int {
6392    if structver != 1 as libc::c_int {
6393        return 1 as libc::c_int;
6394    }
6395    let mut ri1: *mut RedisModuleReplicationInfoV1 = ri
6396        as *mut RedisModuleReplicationInfoV1;
6397    memset(
6398        ri1 as *mut libc::c_void,
6399        0 as libc::c_int,
6400        core::mem::size_of::<RedisModuleReplicationInfoV1>() as libc::c_ulong,
6401    );
6402    (*ri1).version = structver as uint64_t;
6403    (*ri1)
6404        .master = (server.masterhost == 0 as *mut libc::c_void as *mut libc::c_char)
6405        as libc::c_int;
6406    (*ri1)
6407        .masterhost = (if !(server.masterhost).is_null() {
6408        server.masterhost as *const libc::c_char
6409    } else {
6410        b"\0" as *const u8 as *const libc::c_char
6411    }) as *mut libc::c_char;
6412    (*ri1).masterport = server.masterport;
6413    (*ri1).replid1 = (server.replid).as_mut_ptr();
6414    (*ri1).replid2 = (server.replid2).as_mut_ptr();
6415    (*ri1).repl1_offset = server.master_repl_offset as uint64_t;
6416    (*ri1).repl2_offset = server.second_replid_offset as uint64_t;
6417    return 0 as libc::c_int;
6418}
6419#[no_mangle]
6420pub unsafe extern "C" fn RM_GetClientInfoById(
6421    mut ci: *mut libc::c_void,
6422    mut id: uint64_t,
6423) -> libc::c_int {
6424    let mut client: *mut client = lookupClientByID(id);
6425    if client.is_null() {
6426        return 1 as libc::c_int;
6427    }
6428    if ci.is_null() {
6429        return 0 as libc::c_int;
6430    }
6431    let mut structver: uint64_t = *(ci as *mut uint64_t)
6432        .offset(0 as libc::c_int as isize);
6433    return modulePopulateClientInfoStructure(ci, client, structver as libc::c_int);
6434}
6435#[no_mangle]
6436pub unsafe extern "C" fn RM_GetClientNameById(
6437    mut ctx: *mut RedisModuleCtx,
6438    mut id: uint64_t,
6439) -> *mut robj {
6440    let mut client: *mut client = lookupClientByID(id);
6441    if client.is_null() || ((*client).name).is_null() {
6442        return 0 as *mut robj;
6443    }
6444    let mut name: *mut robj = (*client).name;
6445    incrRefCount(name);
6446    autoMemoryAdd(ctx, 1 as libc::c_int, name as *mut libc::c_void);
6447    return name;
6448}
6449#[no_mangle]
6450pub unsafe extern "C" fn RM_SetClientNameById(
6451    mut id: uint64_t,
6452    mut name: *mut robj,
6453) -> libc::c_int {
6454    let mut client: *mut client = lookupClientByID(id);
6455    if client.is_null() {
6456        *__errno_location() = 2 as libc::c_int;
6457        return 1 as libc::c_int;
6458    }
6459    if clientSetName(client, name) == -(1 as libc::c_int) {
6460        *__errno_location() = 22 as libc::c_int;
6461        return 1 as libc::c_int;
6462    }
6463    return 0 as libc::c_int;
6464}
6465#[no_mangle]
6466pub unsafe extern "C" fn RM_PublishMessage(
6467    mut ctx: *mut RedisModuleCtx,
6468    mut channel: *mut robj,
6469    mut message: *mut robj,
6470) -> libc::c_int {
6471    return pubsubPublishMessageAndPropagateToCluster(channel, message, 0 as libc::c_int);
6472}
6473#[no_mangle]
6474pub unsafe extern "C" fn RM_PublishMessageShard(
6475    mut ctx: *mut RedisModuleCtx,
6476    mut channel: *mut robj,
6477    mut message: *mut robj,
6478) -> libc::c_int {
6479    return pubsubPublishMessageAndPropagateToCluster(channel, message, 1 as libc::c_int);
6480}
6481#[no_mangle]
6482pub unsafe extern "C" fn RM_GetSelectedDb(mut ctx: *mut RedisModuleCtx) -> libc::c_int {
6483    return (*(*(*ctx).client).db).id;
6484}
6485#[no_mangle]
6486pub unsafe extern "C" fn RM_GetContextFlags(
6487    mut ctx: *mut RedisModuleCtx,
6488) -> libc::c_int {
6489    let mut flags: libc::c_int = 0 as libc::c_int;
6490    if !ctx.is_null() {
6491        if !((*ctx).client).is_null() {
6492            if (*(*ctx).client).flags as libc::c_ulonglong
6493                & (1 as libc::c_ulonglong) << 41 as libc::c_int != 0
6494            {
6495                flags |= (1 as libc::c_int) << 21 as libc::c_int;
6496            }
6497            if (*(*ctx).client).flags
6498                & ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_ulong != 0
6499            {
6500                flags |= (1 as libc::c_int) << 12 as libc::c_int;
6501            }
6502            if (*(*ctx).client).resp == 3 as libc::c_int {
6503                flags |= (1 as libc::c_int) << 22 as libc::c_int;
6504            }
6505        }
6506        let mut c: *mut client = if !((*ctx).blocked_client).is_null() {
6507            (*(*ctx).blocked_client).client
6508        } else {
6509            (*ctx).client
6510        };
6511        if !c.is_null()
6512            && (*c).flags
6513                & ((1 as libc::c_int) << 5 as libc::c_int
6514                    | (1 as libc::c_int) << 12 as libc::c_int) as libc::c_ulong != 0
6515        {
6516            flags |= (1 as libc::c_int) << 19 as libc::c_int;
6517        }
6518    }
6519    if scriptIsRunning() != 0 {
6520        flags |= (1 as libc::c_int) << 0 as libc::c_int;
6521    }
6522    if server.in_exec != 0 {
6523        flags |= (1 as libc::c_int) << 1 as libc::c_int;
6524    }
6525    if server.cluster_enabled != 0 {
6526        flags |= (1 as libc::c_int) << 5 as libc::c_int;
6527    }
6528    if server.async_loading != 0 {
6529        flags |= (1 as libc::c_int) << 23 as libc::c_int;
6530    } else if server.loading != 0 {
6531        flags |= (1 as libc::c_int) << 13 as libc::c_int;
6532    }
6533    if server.maxmemory > 0 as libc::c_int as libc::c_ulonglong
6534        && ((server.masterhost).is_null() || server.repl_slave_ignore_maxmemory == 0)
6535    {
6536        flags |= (1 as libc::c_int) << 8 as libc::c_int;
6537        if server.maxmemory_policy != (7 as libc::c_int) << 8 as libc::c_int {
6538            flags |= (1 as libc::c_int) << 9 as libc::c_int;
6539        }
6540    }
6541    if server.aof_state != 0 as libc::c_int {
6542        flags |= (1 as libc::c_int) << 6 as libc::c_int;
6543    }
6544    if server.saveparamslen > 0 as libc::c_int {
6545        flags |= (1 as libc::c_int) << 7 as libc::c_int;
6546    }
6547    if (server.masterhost).is_null() {
6548        flags |= (1 as libc::c_int) << 2 as libc::c_int;
6549    } else {
6550        flags |= (1 as libc::c_int) << 3 as libc::c_int;
6551        if server.repl_slave_ro != 0 {
6552            flags |= (1 as libc::c_int) << 4 as libc::c_int;
6553        }
6554        if server.repl_state == REPL_STATE_CONNECT as libc::c_int
6555            || server.repl_state == REPL_STATE_CONNECTING as libc::c_int
6556        {
6557            flags |= (1 as libc::c_int) << 15 as libc::c_int;
6558        } else if server.repl_state == REPL_STATE_TRANSFER as libc::c_int {
6559            flags |= (1 as libc::c_int) << 16 as libc::c_int;
6560        } else if server.repl_state == REPL_STATE_CONNECTED as libc::c_int {
6561            flags |= (1 as libc::c_int) << 17 as libc::c_int;
6562        }
6563        if server.repl_state != REPL_STATE_CONNECTED as libc::c_int {
6564            flags |= (1 as libc::c_int) << 14 as libc::c_int;
6565        }
6566    }
6567    let mut level: libc::c_float = 0.;
6568    let mut retval: libc::c_int = getMaxmemoryState(
6569        0 as *mut size_t,
6570        0 as *mut size_t,
6571        0 as *mut size_t,
6572        &mut level,
6573    );
6574    if retval == -(1 as libc::c_int) {
6575        flags |= (1 as libc::c_int) << 10 as libc::c_int;
6576    }
6577    if level as libc::c_double > 0.75f64 {
6578        flags |= (1 as libc::c_int) << 11 as libc::c_int;
6579    }
6580    if hasActiveChildProcess() != 0 {
6581        flags |= (1 as libc::c_int) << 18 as libc::c_int;
6582    }
6583    if server.in_fork_child != 0 {
6584        flags |= (1 as libc::c_int) << 20 as libc::c_int;
6585    }
6586    return flags;
6587}
6588#[no_mangle]
6589pub unsafe extern "C" fn RM_AvoidReplicaTraffic() -> libc::c_int {
6590    return checkClientPauseTimeoutAndReturnIfPaused();
6591}
6592#[no_mangle]
6593pub unsafe extern "C" fn RM_SelectDb(
6594    mut ctx: *mut RedisModuleCtx,
6595    mut newid: libc::c_int,
6596) -> libc::c_int {
6597    let mut retval: libc::c_int = selectDb((*ctx).client, newid);
6598    return if retval == 0 as libc::c_int { 0 as libc::c_int } else { 1 as libc::c_int };
6599}
6600#[no_mangle]
6601pub unsafe extern "C" fn RM_KeyExists(
6602    mut ctx: *mut RedisModuleCtx,
6603    mut keyname: *mut robj,
6604) -> libc::c_int {
6605    let mut value: *mut robj = lookupKeyReadWithFlags(
6606        (*(*ctx).client).db,
6607        keyname,
6608        (1 as libc::c_int) << 0 as libc::c_int,
6609    );
6610    return (value != 0 as *mut libc::c_void as *mut robj) as libc::c_int;
6611}
6612unsafe extern "C" fn moduleInitKey(
6613    mut kp: *mut RedisModuleKey,
6614    mut ctx: *mut RedisModuleCtx,
6615    mut keyname: *mut robj,
6616    mut value: *mut robj,
6617    mut mode: libc::c_int,
6618) {
6619    (*kp).ctx = ctx;
6620    (*kp).db = (*(*ctx).client).db;
6621    (*kp).key = keyname;
6622    incrRefCount(keyname);
6623    (*kp).value = value;
6624    (*kp).iter = 0 as *mut libc::c_void;
6625    (*kp).mode = mode;
6626    if !((*kp).value).is_null() {
6627        moduleInitKeyTypeSpecific(kp);
6628    }
6629}
6630unsafe extern "C" fn moduleInitKeyTypeSpecific(mut key: *mut RedisModuleKey) {
6631    match (*(*key).value).type_0() as libc::c_int {
6632        3 => {
6633            zsetKeyReset(key);
6634        }
6635        6 => {
6636            (*key).u.stream.signalready = 0 as libc::c_int;
6637        }
6638        _ => {}
6639    };
6640}
6641#[no_mangle]
6642pub unsafe extern "C" fn RM_OpenKey(
6643    mut ctx: *mut RedisModuleCtx,
6644    mut keyname: *mut robj,
6645    mut mode: libc::c_int,
6646) -> *mut RedisModuleKey {
6647    let mut kp: *mut RedisModuleKey = 0 as *mut RedisModuleKey;
6648    let mut value: *mut robj = 0 as *mut robj;
6649    let mut flags: libc::c_int = if mode & (1 as libc::c_int) << 16 as libc::c_int != 0 {
6650        (1 as libc::c_int) << 0 as libc::c_int
6651    } else {
6652        0 as libc::c_int
6653    };
6654    if mode & (1 as libc::c_int) << 1 as libc::c_int != 0 {
6655        value = lookupKeyWriteWithFlags((*(*ctx).client).db, keyname, flags);
6656    } else {
6657        value = lookupKeyReadWithFlags((*(*ctx).client).db, keyname, flags);
6658        if value.is_null() {
6659            return 0 as *mut RedisModuleKey;
6660        }
6661    }
6662    kp = zmalloc(core::mem::size_of::<RedisModuleKey>() as libc::c_ulong)
6663        as *mut RedisModuleKey;
6664    moduleInitKey(kp, ctx, keyname, value, mode);
6665    autoMemoryAdd(ctx, 0 as libc::c_int, kp as *mut libc::c_void);
6666    return kp;
6667}
6668unsafe extern "C" fn moduleCloseKey(mut key: *mut RedisModuleKey) {
6669    let mut signal: libc::c_int = if !((*(*key).ctx).module).is_null() {
6670        ((*(*(*key).ctx).module).options & (1 as libc::c_int) << 1 as libc::c_int == 0)
6671            as libc::c_int
6672    } else {
6673        1 as libc::c_int
6674    };
6675    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int != 0 && signal != 0 {
6676        signalModifiedKey((*(*key).ctx).client, (*key).db, (*key).key);
6677    }
6678    if !((*key).value).is_null() {
6679        if !((*key).iter).is_null() {
6680            moduleFreeKeyIterator(key);
6681        }
6682        match (*(*key).value).type_0() as libc::c_int {
6683            3 => {
6684                RM_ZsetRangeStop(key);
6685            }
6686            6 => {
6687                if (*key).u.stream.signalready != 0 {
6688                    signalKeyAsReady((*key).db, (*key).key, 6 as libc::c_int);
6689                }
6690            }
6691            _ => {}
6692        }
6693    }
6694    if ((*key).iter).is_null() {} else {
6695        _serverAssert(
6696            b"key->iter == NULL\0" as *const u8 as *const libc::c_char,
6697            b"module.c\0" as *const u8 as *const libc::c_char,
6698            3737 as libc::c_int,
6699        );
6700        unreachable!();
6701    };
6702    decrRefCount((*key).key);
6703}
6704#[no_mangle]
6705pub unsafe extern "C" fn RM_CloseKey(mut key: *mut RedisModuleKey) {
6706    if key.is_null() {
6707        return;
6708    }
6709    moduleCloseKey(key);
6710    autoMemoryFreed((*key).ctx, 0 as libc::c_int, key as *mut libc::c_void);
6711    zfree(key as *mut libc::c_void);
6712}
6713#[no_mangle]
6714pub unsafe extern "C" fn RM_KeyType(mut key: *mut RedisModuleKey) -> libc::c_int {
6715    if key.is_null() || ((*key).value).is_null() {
6716        return 0 as libc::c_int;
6717    }
6718    match (*(*key).value).type_0() as libc::c_int {
6719        0 => return 1 as libc::c_int,
6720        1 => return 2 as libc::c_int,
6721        2 => return 4 as libc::c_int,
6722        3 => return 5 as libc::c_int,
6723        4 => return 3 as libc::c_int,
6724        5 => return 6 as libc::c_int,
6725        6 => return 7 as libc::c_int,
6726        _ => return 0 as libc::c_int,
6727    };
6728}
6729#[no_mangle]
6730pub unsafe extern "C" fn RM_ValueLength(mut key: *mut RedisModuleKey) -> size_t {
6731    if key.is_null() || ((*key).value).is_null() {
6732        return 0 as libc::c_int as size_t;
6733    }
6734    match (*(*key).value).type_0() as libc::c_int {
6735        0 => return stringObjectLen((*key).value),
6736        1 => return listTypeLength((*key).value),
6737        2 => return setTypeSize((*key).value),
6738        3 => return zsetLength((*key).value),
6739        4 => return hashTypeLength((*key).value),
6740        6 => return streamLength((*key).value),
6741        _ => return 0 as libc::c_int as size_t,
6742    };
6743}
6744#[no_mangle]
6745pub unsafe extern "C" fn RM_DeleteKey(mut key: *mut RedisModuleKey) -> libc::c_int {
6746    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
6747        return 1 as libc::c_int;
6748    }
6749    if !((*key).value).is_null() {
6750        dbDelete((*key).db, (*key).key);
6751        (*key).value = 0 as *mut robj;
6752    }
6753    return 0 as libc::c_int;
6754}
6755#[no_mangle]
6756pub unsafe extern "C" fn RM_UnlinkKey(mut key: *mut RedisModuleKey) -> libc::c_int {
6757    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
6758        return 1 as libc::c_int;
6759    }
6760    if !((*key).value).is_null() {
6761        dbAsyncDelete((*key).db, (*key).key);
6762        (*key).value = 0 as *mut robj;
6763    }
6764    return 0 as libc::c_int;
6765}
6766#[no_mangle]
6767pub unsafe extern "C" fn RM_GetExpire(mut key: *mut RedisModuleKey) -> mstime_t {
6768    let mut expire: mstime_t = getExpire((*key).db, (*key).key);
6769    if expire == -(1 as libc::c_int) as libc::c_longlong || ((*key).value).is_null() {
6770        return -(1 as libc::c_int) as mstime_t;
6771    }
6772    expire -= mstime();
6773    return if expire >= 0 as libc::c_int as libc::c_longlong {
6774        expire
6775    } else {
6776        0 as libc::c_int as libc::c_longlong
6777    };
6778}
6779#[no_mangle]
6780pub unsafe extern "C" fn RM_SetExpire(
6781    mut key: *mut RedisModuleKey,
6782    mut expire: mstime_t,
6783) -> libc::c_int {
6784    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
6785        || ((*key).value).is_null()
6786        || expire < 0 as libc::c_int as libc::c_longlong
6787            && expire != -(1 as libc::c_int) as libc::c_longlong
6788    {
6789        return 1 as libc::c_int;
6790    }
6791    if expire != -(1 as libc::c_int) as libc::c_longlong {
6792        expire += mstime();
6793        setExpire((*(*key).ctx).client, (*key).db, (*key).key, expire);
6794    } else {
6795        removeExpire((*key).db, (*key).key);
6796    }
6797    return 0 as libc::c_int;
6798}
6799#[no_mangle]
6800pub unsafe extern "C" fn RM_GetAbsExpire(mut key: *mut RedisModuleKey) -> mstime_t {
6801    let mut expire: mstime_t = getExpire((*key).db, (*key).key);
6802    if expire == -(1 as libc::c_int) as libc::c_longlong || ((*key).value).is_null() {
6803        return -(1 as libc::c_int) as mstime_t;
6804    }
6805    return expire;
6806}
6807#[no_mangle]
6808pub unsafe extern "C" fn RM_SetAbsExpire(
6809    mut key: *mut RedisModuleKey,
6810    mut expire: mstime_t,
6811) -> libc::c_int {
6812    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
6813        || ((*key).value).is_null()
6814        || expire < 0 as libc::c_int as libc::c_longlong
6815            && expire != -(1 as libc::c_int) as libc::c_longlong
6816    {
6817        return 1 as libc::c_int;
6818    }
6819    if expire != -(1 as libc::c_int) as libc::c_longlong {
6820        setExpire((*(*key).ctx).client, (*key).db, (*key).key, expire);
6821    } else {
6822        removeExpire((*key).db, (*key).key);
6823    }
6824    return 0 as libc::c_int;
6825}
6826#[no_mangle]
6827pub unsafe extern "C" fn RM_ResetDataset(
6828    mut restart_aof: libc::c_int,
6829    mut async_0: libc::c_int,
6830) {
6831    if restart_aof != 0 && server.aof_state != 0 as libc::c_int {
6832        stopAppendOnly();
6833    }
6834    flushAllDataAndResetRDB(
6835        (if async_0 != 0 {
6836            (1 as libc::c_int) << 0 as libc::c_int
6837        } else {
6838            0 as libc::c_int
6839        }) | (1 as libc::c_int) << 1 as libc::c_int,
6840    );
6841    if server.aof_enabled != 0 && restart_aof != 0 {
6842        restartAOFAfterSYNC();
6843    }
6844}
6845#[no_mangle]
6846pub unsafe extern "C" fn RM_DbSize(mut ctx: *mut RedisModuleCtx) -> libc::c_ulonglong {
6847    return ((*(*(*(*ctx).client).db).dict).ht_used[0 as libc::c_int as usize])
6848        .wrapping_add((*(*(*(*ctx).client).db).dict).ht_used[1 as libc::c_int as usize])
6849        as libc::c_ulonglong;
6850}
6851#[no_mangle]
6852pub unsafe extern "C" fn RM_RandomKey(mut ctx: *mut RedisModuleCtx) -> *mut robj {
6853    let mut key: *mut robj = dbRandomKey((*(*ctx).client).db);
6854    autoMemoryAdd(ctx, 1 as libc::c_int, key as *mut libc::c_void);
6855    return key;
6856}
6857#[no_mangle]
6858pub unsafe extern "C" fn RM_GetKeyNameFromOptCtx(
6859    mut ctx: *mut RedisModuleKeyOptCtx,
6860) -> *const robj {
6861    return (*ctx).from_key;
6862}
6863#[no_mangle]
6864pub unsafe extern "C" fn RM_GetToKeyNameFromOptCtx(
6865    mut ctx: *mut RedisModuleKeyOptCtx,
6866) -> *const robj {
6867    return (*ctx).to_key;
6868}
6869#[no_mangle]
6870pub unsafe extern "C" fn RM_GetDbIdFromOptCtx(
6871    mut ctx: *mut RedisModuleKeyOptCtx,
6872) -> libc::c_int {
6873    return (*ctx).from_dbid;
6874}
6875#[no_mangle]
6876pub unsafe extern "C" fn RM_GetToDbIdFromOptCtx(
6877    mut ctx: *mut RedisModuleKeyOptCtx,
6878) -> libc::c_int {
6879    return (*ctx).to_dbid;
6880}
6881#[no_mangle]
6882pub unsafe extern "C" fn RM_StringSet(
6883    mut key: *mut RedisModuleKey,
6884    mut str: *mut robj,
6885) -> libc::c_int {
6886    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
6887        || !((*key).iter).is_null()
6888    {
6889        return 1 as libc::c_int;
6890    }
6891    RM_DeleteKey(key);
6892    setKey((*(*key).ctx).client, (*key).db, (*key).key, str, 2 as libc::c_int);
6893    (*key).value = str;
6894    return 0 as libc::c_int;
6895}
6896#[no_mangle]
6897pub unsafe extern "C" fn RM_StringDMA(
6898    mut key: *mut RedisModuleKey,
6899    mut len: *mut size_t,
6900    mut mode: libc::c_int,
6901) -> *mut libc::c_char {
6902    let mut emptystring: *mut libc::c_char = b"<dma-empty-string>\0" as *const u8
6903        as *const libc::c_char as *mut libc::c_char;
6904    if ((*key).value).is_null() {
6905        *len = 0 as libc::c_int as size_t;
6906        return emptystring;
6907    }
6908    if (*(*key).value).type_0() as libc::c_int != 0 as libc::c_int {
6909        return 0 as *mut libc::c_char;
6910    }
6911    if mode & (1 as libc::c_int) << 1 as libc::c_int != 0
6912        || (*(*key).value).encoding() as libc::c_int != 0 as libc::c_int
6913    {
6914        (*key).value = dbUnshareStringValue((*key).db, (*key).key, (*key).value);
6915    }
6916    *len = sdslen((*(*key).value).ptr as sds);
6917    return (*(*key).value).ptr as *mut libc::c_char;
6918}
6919#[no_mangle]
6920pub unsafe extern "C" fn RM_StringTruncate(
6921    mut key: *mut RedisModuleKey,
6922    mut newlen: size_t,
6923) -> libc::c_int {
6924    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
6925        return 1 as libc::c_int;
6926    }
6927    if !((*key).value).is_null()
6928        && (*(*key).value).type_0() as libc::c_int != 0 as libc::c_int
6929    {
6930        return 1 as libc::c_int;
6931    }
6932    if newlen
6933        > (512 as libc::c_int * 1024 as libc::c_int * 1024 as libc::c_int)
6934            as libc::c_ulong
6935    {
6936        return 1 as libc::c_int;
6937    }
6938    if ((*key).value).is_null() && newlen == 0 as libc::c_int as libc::c_ulong {
6939        return 0 as libc::c_int;
6940    }
6941    if ((*key).value).is_null() {
6942        let mut o: *mut robj = createObject(
6943            0 as libc::c_int,
6944            sdsnewlen(0 as *const libc::c_void, newlen) as *mut libc::c_void,
6945        );
6946        setKey((*(*key).ctx).client, (*key).db, (*key).key, o, 2 as libc::c_int);
6947        (*key).value = o;
6948        decrRefCount(o);
6949    } else {
6950        (*key).value = dbUnshareStringValue((*key).db, (*key).key, (*key).value);
6951        let mut curlen: size_t = sdslen((*(*key).value).ptr as sds);
6952        if newlen > curlen {
6953            (*(*key).value)
6954                .ptr = sdsgrowzero((*(*key).value).ptr as sds, newlen)
6955                as *mut libc::c_void;
6956        } else if newlen < curlen {
6957            sdssubstr((*(*key).value).ptr as sds, 0 as libc::c_int as size_t, newlen);
6958            if sdslen((*(*key).value).ptr as sds) < sdsavail((*(*key).value).ptr as sds)
6959            {
6960                (*(*key).value)
6961                    .ptr = sdsRemoveFreeSpace((*(*key).value).ptr as sds)
6962                    as *mut libc::c_void;
6963            }
6964        }
6965    }
6966    return 0 as libc::c_int;
6967}
6968#[no_mangle]
6969pub unsafe extern "C" fn moduleListIteratorSeek(
6970    mut key: *mut RedisModuleKey,
6971    mut index: libc::c_long,
6972    mut mode: libc::c_int,
6973) -> libc::c_int {
6974    if key.is_null() {
6975        *__errno_location() = 22 as libc::c_int;
6976        return 0 as libc::c_int;
6977    } else {
6978        if ((*key).value).is_null()
6979            || (*(*key).value).type_0() as libc::c_int != 1 as libc::c_int
6980        {
6981            *__errno_location() = 95 as libc::c_int;
6982            return 0 as libc::c_int;
6983        }
6984    }
6985    if (*key).mode & mode == 0 {
6986        *__errno_location() = 9 as libc::c_int;
6987        return 0 as libc::c_int;
6988    }
6989    let mut length: libc::c_long = listTypeLength((*key).value) as libc::c_long;
6990    if index < -length || index >= length {
6991        *__errno_location() = 33 as libc::c_int;
6992        return 0 as libc::c_int;
6993    }
6994    if ((*key).iter).is_null() {
6995        (*key)
6996            .iter = listTypeInitIterator(
6997            (*key).value,
6998            index,
6999            1 as libc::c_int as libc::c_uchar,
7000        ) as *mut libc::c_void;
7001        if !((*key).iter).is_null() {} else {
7002            _serverAssert(
7003                b"key->iter != NULL\0" as *const u8 as *const libc::c_char,
7004                b"module.c\0" as *const u8 as *const libc::c_char,
7005                4080 as libc::c_int,
7006            );
7007            unreachable!();
7008        };
7009        if listTypeNext((*key).iter as *mut listTypeIterator, &mut (*key).u.list.entry)
7010            != 0
7011        {} else {
7012            _serverAssert(
7013                b"listTypeNext(key->iter, &key->u.list.entry)\0" as *const u8
7014                    as *const libc::c_char,
7015                b"module.c\0" as *const u8 as *const libc::c_char,
7016                4081 as libc::c_int,
7017            );
7018            unreachable!();
7019        };
7020        (*key).u.list.index = index;
7021        return 1 as libc::c_int;
7022    }
7023    if index < 0 as libc::c_int as libc::c_long
7024        && (*key).u.list.index >= 0 as libc::c_int as libc::c_long
7025    {
7026        index += length;
7027    } else if index >= 0 as libc::c_int as libc::c_long
7028        && (*key).u.list.index < 0 as libc::c_int as libc::c_long
7029    {
7030        index -= length;
7031    }
7032    if index == (*key).u.list.index {
7033        return 1 as libc::c_int;
7034    }
7035    let mut dir: libc::c_uchar = (if (*key).u.list.index < index {
7036        1 as libc::c_int
7037    } else {
7038        0 as libc::c_int
7039    }) as libc::c_uchar;
7040    listTypeSetIteratorDirection((*key).iter as *mut listTypeIterator, dir);
7041    while (*key).u.list.index != index {
7042        if listTypeNext((*key).iter as *mut listTypeIterator, &mut (*key).u.list.entry)
7043            != 0
7044        {} else {
7045            _serverAssert(
7046                b"listTypeNext(key->iter, &key->u.list.entry)\0" as *const u8
7047                    as *const libc::c_char,
7048                b"module.c\0" as *const u8 as *const libc::c_char,
7049                4097 as libc::c_int,
7050            );
7051            unreachable!();
7052        };
7053        (*key).u.list.index
7054            += (if dir as libc::c_int == 0 as libc::c_int {
7055                -(1 as libc::c_int)
7056            } else {
7057                1 as libc::c_int
7058            }) as libc::c_long;
7059    }
7060    return 1 as libc::c_int;
7061}
7062#[no_mangle]
7063pub unsafe extern "C" fn RM_ListPush(
7064    mut key: *mut RedisModuleKey,
7065    mut where_0: libc::c_int,
7066    mut ele: *mut robj,
7067) -> libc::c_int {
7068    if key.is_null() || ele.is_null() {
7069        *__errno_location() = 22 as libc::c_int;
7070        return 1 as libc::c_int;
7071    } else {
7072        if !((*key).value).is_null()
7073            && (*(*key).value).type_0() as libc::c_int != 1 as libc::c_int
7074        {
7075            *__errno_location() = 95 as libc::c_int;
7076            return 1 as libc::c_int;
7077        }
7078    }
7079    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
7080        *__errno_location() = 9 as libc::c_int;
7081        return 1 as libc::c_int;
7082    }
7083    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
7084        return 1 as libc::c_int;
7085    }
7086    if !((*key).value).is_null()
7087        && (*(*key).value).type_0() as libc::c_int != 1 as libc::c_int
7088    {
7089        return 1 as libc::c_int;
7090    }
7091    if !((*key).iter).is_null() {
7092        moduleFreeKeyIterator(key);
7093    }
7094    if ((*key).value).is_null() {
7095        moduleCreateEmptyKey(key, 2 as libc::c_int);
7096    }
7097    listTypePush(
7098        (*key).value,
7099        ele,
7100        if where_0 == 0 as libc::c_int { 0 as libc::c_int } else { 1 as libc::c_int },
7101    );
7102    return 0 as libc::c_int;
7103}
7104#[no_mangle]
7105pub unsafe extern "C" fn RM_ListPop(
7106    mut key: *mut RedisModuleKey,
7107    mut where_0: libc::c_int,
7108) -> *mut robj {
7109    if key.is_null() {
7110        *__errno_location() = 22 as libc::c_int;
7111        return 0 as *mut robj;
7112    } else {
7113        if ((*key).value).is_null()
7114            || (*(*key).value).type_0() as libc::c_int != 1 as libc::c_int
7115        {
7116            *__errno_location() = 95 as libc::c_int;
7117            return 0 as *mut robj;
7118        } else {
7119            if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
7120                *__errno_location() = 9 as libc::c_int;
7121                return 0 as *mut robj;
7122            }
7123        }
7124    }
7125    if !((*key).iter).is_null() {
7126        moduleFreeKeyIterator(key);
7127    }
7128    let mut ele: *mut robj = listTypePop(
7129        (*key).value,
7130        if where_0 == 0 as libc::c_int { 0 as libc::c_int } else { 1 as libc::c_int },
7131    );
7132    let mut decoded: *mut robj = getDecodedObject(ele);
7133    decrRefCount(ele);
7134    moduleDelKeyIfEmpty(key);
7135    autoMemoryAdd((*key).ctx, 1 as libc::c_int, decoded as *mut libc::c_void);
7136    return decoded;
7137}
7138#[no_mangle]
7139pub unsafe extern "C" fn RM_ListGet(
7140    mut key: *mut RedisModuleKey,
7141    mut index: libc::c_long,
7142) -> *mut robj {
7143    if moduleListIteratorSeek(key, index, (1 as libc::c_int) << 0 as libc::c_int) != 0 {
7144        let mut elem: *mut robj = listTypeGet(&mut (*key).u.list.entry);
7145        let mut decoded: *mut robj = getDecodedObject(elem);
7146        decrRefCount(elem);
7147        autoMemoryAdd((*key).ctx, 1 as libc::c_int, decoded as *mut libc::c_void);
7148        return decoded;
7149    } else {
7150        return 0 as *mut robj
7151    };
7152}
7153#[no_mangle]
7154pub unsafe extern "C" fn RM_ListSet(
7155    mut key: *mut RedisModuleKey,
7156    mut index: libc::c_long,
7157    mut value: *mut robj,
7158) -> libc::c_int {
7159    if value.is_null() {
7160        *__errno_location() = 22 as libc::c_int;
7161        return 1 as libc::c_int;
7162    }
7163    if moduleListIteratorSeek(key, index, (1 as libc::c_int) << 1 as libc::c_int) != 0 {
7164        listTypeReplace(&mut (*key).u.list.entry, value);
7165        moduleFreeKeyIterator(key);
7166        return 0 as libc::c_int;
7167    } else {
7168        return 1 as libc::c_int
7169    };
7170}
7171#[no_mangle]
7172pub unsafe extern "C" fn RM_ListInsert(
7173    mut key: *mut RedisModuleKey,
7174    mut index: libc::c_long,
7175    mut value: *mut robj,
7176) -> libc::c_int {
7177    if value.is_null() {
7178        *__errno_location() = 22 as libc::c_int;
7179        return 1 as libc::c_int;
7180    } else {
7181        if !key.is_null() && ((*key).value).is_null()
7182            && (index == 0 as libc::c_int as libc::c_long
7183                || index == -(1 as libc::c_int) as libc::c_long)
7184        {
7185            return RM_ListPush(key, 1 as libc::c_int, value)
7186        } else {
7187            if !key.is_null() && !((*key).value).is_null()
7188                && (*(*key).value).type_0() as libc::c_int == 1 as libc::c_int
7189                && (index == listTypeLength((*key).value) as libc::c_long
7190                    || index == -(1 as libc::c_int) as libc::c_long)
7191            {
7192                return RM_ListPush(key, 1 as libc::c_int, value)
7193            } else {
7194                if !key.is_null() && !((*key).value).is_null()
7195                    && (*(*key).value).type_0() as libc::c_int == 1 as libc::c_int
7196                    && (index == 0 as libc::c_int as libc::c_long
7197                        || index
7198                            == -(listTypeLength((*key).value) as libc::c_long)
7199                                - 1 as libc::c_int as libc::c_long)
7200                {
7201                    return RM_ListPush(key, 0 as libc::c_int, value);
7202                }
7203            }
7204        }
7205    }
7206    if moduleListIteratorSeek(key, index, (1 as libc::c_int) << 1 as libc::c_int) != 0 {
7207        let mut where_0: libc::c_int = if index < 0 as libc::c_int as libc::c_long {
7208            1 as libc::c_int
7209        } else {
7210            0 as libc::c_int
7211        };
7212        listTypeInsert(&mut (*key).u.list.entry, value, where_0);
7213        moduleFreeKeyIterator(key);
7214        return 0 as libc::c_int;
7215    } else {
7216        return 1 as libc::c_int
7217    };
7218}
7219#[no_mangle]
7220pub unsafe extern "C" fn RM_ListDelete(
7221    mut key: *mut RedisModuleKey,
7222    mut index: libc::c_long,
7223) -> libc::c_int {
7224    if moduleListIteratorSeek(key, index, (1 as libc::c_int) << 1 as libc::c_int) != 0 {
7225        listTypeDelete((*key).iter as *mut listTypeIterator, &mut (*key).u.list.entry);
7226        if moduleDelKeyIfEmpty(key) != 0 {
7227            return 0 as libc::c_int;
7228        }
7229        if listTypeNext((*key).iter as *mut listTypeIterator, &mut (*key).u.list.entry)
7230            != 0
7231        {
7232            let mut li: *mut listTypeIterator = (*key).iter as *mut listTypeIterator;
7233            let mut reverse: libc::c_int = ((*li).direction as libc::c_int
7234                == 0 as libc::c_int) as libc::c_int;
7235            if (*key).u.list.index < 0 as libc::c_int as libc::c_long {
7236                (*key).u.list.index
7237                    += (if reverse != 0 { 0 as libc::c_int } else { 1 as libc::c_int })
7238                        as libc::c_long;
7239            } else {
7240                (*key).u.list.index
7241                    += (if reverse != 0 {
7242                        -(1 as libc::c_int)
7243                    } else {
7244                        0 as libc::c_int
7245                    }) as libc::c_long;
7246            }
7247        } else {
7248            moduleFreeKeyIterator(key);
7249        }
7250        return 0 as libc::c_int;
7251    } else {
7252        return 1 as libc::c_int
7253    };
7254}
7255#[no_mangle]
7256pub unsafe extern "C" fn moduleZsetAddFlagsToCoreFlags(
7257    mut flags: libc::c_int,
7258) -> libc::c_int {
7259    let mut retflags: libc::c_int = 0 as libc::c_int;
7260    if flags & (1 as libc::c_int) << 0 as libc::c_int != 0 {
7261        retflags |= (1 as libc::c_int) << 2 as libc::c_int;
7262    }
7263    if flags & (1 as libc::c_int) << 1 as libc::c_int != 0 {
7264        retflags |= (1 as libc::c_int) << 1 as libc::c_int;
7265    }
7266    if flags & (1 as libc::c_int) << 5 as libc::c_int != 0 {
7267        retflags |= (1 as libc::c_int) << 3 as libc::c_int;
7268    }
7269    if flags & (1 as libc::c_int) << 6 as libc::c_int != 0 {
7270        retflags |= (1 as libc::c_int) << 4 as libc::c_int;
7271    }
7272    return retflags;
7273}
7274#[no_mangle]
7275pub unsafe extern "C" fn moduleZsetAddFlagsFromCoreFlags(
7276    mut flags: libc::c_int,
7277) -> libc::c_int {
7278    let mut retflags: libc::c_int = 0 as libc::c_int;
7279    if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
7280        retflags |= (1 as libc::c_int) << 2 as libc::c_int;
7281    }
7282    if flags & (1 as libc::c_int) << 3 as libc::c_int != 0 {
7283        retflags |= (1 as libc::c_int) << 3 as libc::c_int;
7284    }
7285    if flags & (1 as libc::c_int) << 0 as libc::c_int != 0 {
7286        retflags |= (1 as libc::c_int) << 4 as libc::c_int;
7287    }
7288    return retflags;
7289}
7290#[no_mangle]
7291pub unsafe extern "C" fn RM_ZsetAdd(
7292    mut key: *mut RedisModuleKey,
7293    mut score: libc::c_double,
7294    mut ele: *mut robj,
7295    mut flagsptr: *mut libc::c_int,
7296) -> libc::c_int {
7297    let mut in_flags: libc::c_int = 0 as libc::c_int;
7298    let mut out_flags: libc::c_int = 0 as libc::c_int;
7299    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
7300        return 1 as libc::c_int;
7301    }
7302    if !((*key).value).is_null()
7303        && (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7304    {
7305        return 1 as libc::c_int;
7306    }
7307    if ((*key).value).is_null() {
7308        moduleCreateEmptyKey(key, 5 as libc::c_int);
7309    }
7310    if !flagsptr.is_null() {
7311        in_flags = moduleZsetAddFlagsToCoreFlags(*flagsptr);
7312    }
7313    if zsetAdd(
7314        (*key).value,
7315        score,
7316        (*ele).ptr as sds,
7317        in_flags,
7318        &mut out_flags,
7319        0 as *mut libc::c_double,
7320    ) == 0 as libc::c_int
7321    {
7322        if !flagsptr.is_null() {
7323            *flagsptr = 0 as libc::c_int;
7324        }
7325        return 1 as libc::c_int;
7326    }
7327    if !flagsptr.is_null() {
7328        *flagsptr = moduleZsetAddFlagsFromCoreFlags(out_flags);
7329    }
7330    return 0 as libc::c_int;
7331}
7332#[no_mangle]
7333pub unsafe extern "C" fn RM_ZsetIncrby(
7334    mut key: *mut RedisModuleKey,
7335    mut score: libc::c_double,
7336    mut ele: *mut robj,
7337    mut flagsptr: *mut libc::c_int,
7338    mut newscore: *mut libc::c_double,
7339) -> libc::c_int {
7340    let mut in_flags: libc::c_int = 0 as libc::c_int;
7341    let mut out_flags: libc::c_int = 0 as libc::c_int;
7342    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
7343        return 1 as libc::c_int;
7344    }
7345    if !((*key).value).is_null()
7346        && (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7347    {
7348        return 1 as libc::c_int;
7349    }
7350    if ((*key).value).is_null() {
7351        moduleCreateEmptyKey(key, 5 as libc::c_int);
7352    }
7353    if !flagsptr.is_null() {
7354        in_flags = moduleZsetAddFlagsToCoreFlags(*flagsptr);
7355    }
7356    in_flags |= (1 as libc::c_int) << 0 as libc::c_int;
7357    if zsetAdd(
7358        (*key).value,
7359        score,
7360        (*ele).ptr as sds,
7361        in_flags,
7362        &mut out_flags,
7363        newscore,
7364    ) == 0 as libc::c_int
7365    {
7366        if !flagsptr.is_null() {
7367            *flagsptr = 0 as libc::c_int;
7368        }
7369        return 1 as libc::c_int;
7370    }
7371    if !flagsptr.is_null() {
7372        *flagsptr = moduleZsetAddFlagsFromCoreFlags(out_flags);
7373    }
7374    return 0 as libc::c_int;
7375}
7376#[no_mangle]
7377pub unsafe extern "C" fn RM_ZsetRem(
7378    mut key: *mut RedisModuleKey,
7379    mut ele: *mut robj,
7380    mut deleted: *mut libc::c_int,
7381) -> libc::c_int {
7382    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
7383        return 1 as libc::c_int;
7384    }
7385    if !((*key).value).is_null()
7386        && (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7387    {
7388        return 1 as libc::c_int;
7389    }
7390    if !((*key).value).is_null() && zsetDel((*key).value, (*ele).ptr as sds) != 0 {
7391        if !deleted.is_null() {
7392            *deleted = 1 as libc::c_int;
7393        }
7394        moduleDelKeyIfEmpty(key);
7395    } else if !deleted.is_null() {
7396        *deleted = 0 as libc::c_int;
7397    }
7398    return 0 as libc::c_int;
7399}
7400#[no_mangle]
7401pub unsafe extern "C" fn RM_ZsetScore(
7402    mut key: *mut RedisModuleKey,
7403    mut ele: *mut robj,
7404    mut score: *mut libc::c_double,
7405) -> libc::c_int {
7406    if ((*key).value).is_null() {
7407        return 1 as libc::c_int;
7408    }
7409    if (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int {
7410        return 1 as libc::c_int;
7411    }
7412    if zsetScore((*key).value, (*ele).ptr as sds, score) == -(1 as libc::c_int) {
7413        return 1 as libc::c_int;
7414    }
7415    return 0 as libc::c_int;
7416}
7417unsafe extern "C" fn zsetKeyReset(mut key: *mut RedisModuleKey) {
7418    (*key).u.zset.type_0 = 0 as libc::c_int as uint32_t;
7419    (*key).u.zset.current = 0 as *mut libc::c_void;
7420    (*key).u.zset.er = 1 as libc::c_int;
7421}
7422#[no_mangle]
7423pub unsafe extern "C" fn RM_ZsetRangeStop(mut key: *mut RedisModuleKey) {
7424    if ((*key).value).is_null()
7425        || (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7426    {
7427        return;
7428    }
7429    if (*key).u.zset.type_0 == 1 as libc::c_int as libc::c_uint {
7430        zslFreeLexRange(&mut (*key).u.zset.lrs);
7431    }
7432    zsetKeyReset(key);
7433}
7434#[no_mangle]
7435pub unsafe extern "C" fn RM_ZsetRangeEndReached(
7436    mut key: *mut RedisModuleKey,
7437) -> libc::c_int {
7438    if ((*key).value).is_null()
7439        || (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7440    {
7441        return 1 as libc::c_int;
7442    }
7443    return (*key).u.zset.er;
7444}
7445#[no_mangle]
7446pub unsafe extern "C" fn zsetInitScoreRange(
7447    mut key: *mut RedisModuleKey,
7448    mut min: libc::c_double,
7449    mut max: libc::c_double,
7450    mut minex: libc::c_int,
7451    mut maxex: libc::c_int,
7452    mut first: libc::c_int,
7453) -> libc::c_int {
7454    if ((*key).value).is_null()
7455        || (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7456    {
7457        return 1 as libc::c_int;
7458    }
7459    RM_ZsetRangeStop(key);
7460    (*key).u.zset.type_0 = 2 as libc::c_int as uint32_t;
7461    (*key).u.zset.er = 0 as libc::c_int;
7462    let mut zrs: *mut zrangespec = &mut (*key).u.zset.rs;
7463    (*zrs).min = min;
7464    (*zrs).max = max;
7465    (*zrs).minex = minex;
7466    (*zrs).maxex = maxex;
7467    if (*(*key).value).encoding() as libc::c_int == 11 as libc::c_int {
7468        (*key)
7469            .u
7470            .zset
7471            .current = (if first != 0 {
7472            zzlFirstInRange((*(*key).value).ptr as *mut libc::c_uchar, zrs)
7473        } else {
7474            zzlLastInRange((*(*key).value).ptr as *mut libc::c_uchar, zrs)
7475        }) as *mut libc::c_void;
7476    } else if (*(*key).value).encoding() as libc::c_int == 7 as libc::c_int {
7477        let mut zs: *mut zset = (*(*key).value).ptr as *mut zset;
7478        let mut zsl: *mut zskiplist = (*zs).zsl;
7479        (*key)
7480            .u
7481            .zset
7482            .current = (if first != 0 {
7483            zslFirstInRange(zsl, zrs)
7484        } else {
7485            zslLastInRange(zsl, zrs)
7486        }) as *mut libc::c_void;
7487    } else {
7488        _serverPanic(
7489            b"module.c\0" as *const u8 as *const libc::c_char,
7490            4514 as libc::c_int,
7491            b"Unsupported zset encoding\0" as *const u8 as *const libc::c_char,
7492        );
7493        unreachable!();
7494    }
7495    if ((*key).u.zset.current).is_null() {
7496        (*key).u.zset.er = 1 as libc::c_int;
7497    }
7498    return 0 as libc::c_int;
7499}
7500#[no_mangle]
7501pub unsafe extern "C" fn RM_ZsetFirstInScoreRange(
7502    mut key: *mut RedisModuleKey,
7503    mut min: libc::c_double,
7504    mut max: libc::c_double,
7505    mut minex: libc::c_int,
7506    mut maxex: libc::c_int,
7507) -> libc::c_int {
7508    return zsetInitScoreRange(key, min, max, minex, maxex, 1 as libc::c_int);
7509}
7510#[no_mangle]
7511pub unsafe extern "C" fn RM_ZsetLastInScoreRange(
7512    mut key: *mut RedisModuleKey,
7513    mut min: libc::c_double,
7514    mut max: libc::c_double,
7515    mut minex: libc::c_int,
7516    mut maxex: libc::c_int,
7517) -> libc::c_int {
7518    return zsetInitScoreRange(key, min, max, minex, maxex, 0 as libc::c_int);
7519}
7520#[no_mangle]
7521pub unsafe extern "C" fn zsetInitLexRange(
7522    mut key: *mut RedisModuleKey,
7523    mut min: *mut robj,
7524    mut max: *mut robj,
7525    mut first: libc::c_int,
7526) -> libc::c_int {
7527    if ((*key).value).is_null()
7528        || (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7529    {
7530        return 1 as libc::c_int;
7531    }
7532    RM_ZsetRangeStop(key);
7533    (*key).u.zset.er = 0 as libc::c_int;
7534    let mut zlrs: *mut zlexrangespec = &mut (*key).u.zset.lrs;
7535    if zslParseLexRange(min, max, zlrs) == -(1 as libc::c_int) {
7536        return 1 as libc::c_int;
7537    }
7538    (*key).u.zset.type_0 = 1 as libc::c_int as uint32_t;
7539    if (*(*key).value).encoding() as libc::c_int == 11 as libc::c_int {
7540        (*key)
7541            .u
7542            .zset
7543            .current = (if first != 0 {
7544            zzlFirstInLexRange((*(*key).value).ptr as *mut libc::c_uchar, zlrs)
7545        } else {
7546            zzlLastInLexRange((*(*key).value).ptr as *mut libc::c_uchar, zlrs)
7547        }) as *mut libc::c_void;
7548    } else if (*(*key).value).encoding() as libc::c_int == 7 as libc::c_int {
7549        let mut zs: *mut zset = (*(*key).value).ptr as *mut zset;
7550        let mut zsl: *mut zskiplist = (*zs).zsl;
7551        (*key)
7552            .u
7553            .zset
7554            .current = (if first != 0 {
7555            zslFirstInLexRange(zsl, zlrs)
7556        } else {
7557            zslLastInLexRange(zsl, zlrs)
7558        }) as *mut libc::c_void;
7559    } else {
7560        _serverPanic(
7561            b"module.c\0" as *const u8 as *const libc::c_char,
7562            4578 as libc::c_int,
7563            b"Unsupported zset encoding\0" as *const u8 as *const libc::c_char,
7564        );
7565        unreachable!();
7566    }
7567    if ((*key).u.zset.current).is_null() {
7568        (*key).u.zset.er = 1 as libc::c_int;
7569    }
7570    return 0 as libc::c_int;
7571}
7572#[no_mangle]
7573pub unsafe extern "C" fn RM_ZsetFirstInLexRange(
7574    mut key: *mut RedisModuleKey,
7575    mut min: *mut robj,
7576    mut max: *mut robj,
7577) -> libc::c_int {
7578    return zsetInitLexRange(key, min, max, 1 as libc::c_int);
7579}
7580#[no_mangle]
7581pub unsafe extern "C" fn RM_ZsetLastInLexRange(
7582    mut key: *mut RedisModuleKey,
7583    mut min: *mut robj,
7584    mut max: *mut robj,
7585) -> libc::c_int {
7586    return zsetInitLexRange(key, min, max, 0 as libc::c_int);
7587}
7588#[no_mangle]
7589pub unsafe extern "C" fn RM_ZsetRangeCurrentElement(
7590    mut key: *mut RedisModuleKey,
7591    mut score: *mut libc::c_double,
7592) -> *mut robj {
7593    let mut str: *mut robj = 0 as *mut robj;
7594    if ((*key).value).is_null()
7595        || (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7596    {
7597        return 0 as *mut robj;
7598    }
7599    if ((*key).u.zset.current).is_null() {
7600        return 0 as *mut robj;
7601    }
7602    if (*(*key).value).encoding() as libc::c_int == 11 as libc::c_int {
7603        let mut eptr: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
7604        let mut sptr: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
7605        eptr = (*key).u.zset.current as *mut libc::c_uchar;
7606        let mut ele: sds = lpGetObject(eptr);
7607        if !score.is_null() {
7608            sptr = lpNext((*(*key).value).ptr as *mut libc::c_uchar, eptr);
7609            *score = zzlGetScore(sptr);
7610        }
7611        str = createObject(0 as libc::c_int, ele as *mut libc::c_void);
7612    } else if (*(*key).value).encoding() as libc::c_int == 7 as libc::c_int {
7613        let mut ln: *mut zskiplistNode = (*key).u.zset.current as *mut zskiplistNode;
7614        if !score.is_null() {
7615            *score = (*ln).score;
7616        }
7617        str = createStringObject((*ln).ele as *const libc::c_char, sdslen((*ln).ele));
7618    } else {
7619        _serverPanic(
7620            b"module.c\0" as *const u8 as *const libc::c_char,
7621            4629 as libc::c_int,
7622            b"Unsupported zset encoding\0" as *const u8 as *const libc::c_char,
7623        );
7624        unreachable!();
7625    }
7626    autoMemoryAdd((*key).ctx, 1 as libc::c_int, str as *mut libc::c_void);
7627    return str;
7628}
7629#[no_mangle]
7630pub unsafe extern "C" fn RM_ZsetRangeNext(mut key: *mut RedisModuleKey) -> libc::c_int {
7631    if ((*key).value).is_null()
7632        || (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7633    {
7634        return 0 as libc::c_int;
7635    }
7636    if (*key).u.zset.type_0 == 0 || ((*key).u.zset.current).is_null() {
7637        return 0 as libc::c_int;
7638    }
7639    if (*(*key).value).encoding() as libc::c_int == 11 as libc::c_int {
7640        let mut zl: *mut libc::c_uchar = (*(*key).value).ptr as *mut libc::c_uchar;
7641        let mut eptr: *mut libc::c_uchar = (*key).u.zset.current as *mut libc::c_uchar;
7642        let mut next: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
7643        next = lpNext(zl, eptr);
7644        if !next.is_null() {
7645            next = lpNext(zl, next);
7646        }
7647        if next.is_null() {
7648            (*key).u.zset.er = 1 as libc::c_int;
7649            return 0 as libc::c_int;
7650        } else {
7651            if (*key).u.zset.type_0 == 2 as libc::c_int as libc::c_uint {
7652                let mut saved_next: *mut libc::c_uchar = next;
7653                next = lpNext(zl, next);
7654                let mut score: libc::c_double = zzlGetScore(next);
7655                if zslValueLteMax(score, &mut (*key).u.zset.rs) == 0 {
7656                    (*key).u.zset.er = 1 as libc::c_int;
7657                    return 0 as libc::c_int;
7658                }
7659                next = saved_next;
7660            } else if (*key).u.zset.type_0 == 1 as libc::c_int as libc::c_uint {
7661                if zzlLexValueLteMax(next, &mut (*key).u.zset.lrs) == 0 {
7662                    (*key).u.zset.er = 1 as libc::c_int;
7663                    return 0 as libc::c_int;
7664                }
7665            }
7666            (*key).u.zset.current = next as *mut libc::c_void;
7667            return 1 as libc::c_int;
7668        }
7669    } else {
7670        if (*(*key).value).encoding() as libc::c_int == 7 as libc::c_int {
7671            let mut ln: *mut zskiplistNode = (*key).u.zset.current as *mut zskiplistNode;
7672            let mut next_0: *mut zskiplistNode = (*((*ln).level)
7673                .as_mut_ptr()
7674                .offset(0 as libc::c_int as isize))
7675                .forward;
7676            if next_0.is_null() {
7677                (*key).u.zset.er = 1 as libc::c_int;
7678                return 0 as libc::c_int;
7679            } else {
7680                if (*key).u.zset.type_0 == 2 as libc::c_int as libc::c_uint
7681                    && zslValueLteMax((*next_0).score, &mut (*key).u.zset.rs) == 0
7682                {
7683                    (*key).u.zset.er = 1 as libc::c_int;
7684                    return 0 as libc::c_int;
7685                } else {
7686                    if (*key).u.zset.type_0 == 1 as libc::c_int as libc::c_uint {
7687                        if zslLexValueLteMax((*next_0).ele, &mut (*key).u.zset.lrs) == 0
7688                        {
7689                            (*key).u.zset.er = 1 as libc::c_int;
7690                            return 0 as libc::c_int;
7691                        }
7692                    }
7693                }
7694                (*key).u.zset.current = next_0 as *mut libc::c_void;
7695                return 1 as libc::c_int;
7696            }
7697        } else {
7698            _serverPanic(
7699                b"module.c\0" as *const u8 as *const libc::c_char,
7700                4695 as libc::c_int,
7701                b"Unsupported zset encoding\0" as *const u8 as *const libc::c_char,
7702            );
7703            unreachable!();
7704        }
7705    }
7706    panic!("Reached end of non-void function without returning");
7707}
7708#[no_mangle]
7709pub unsafe extern "C" fn RM_ZsetRangePrev(mut key: *mut RedisModuleKey) -> libc::c_int {
7710    if ((*key).value).is_null()
7711        || (*(*key).value).type_0() as libc::c_int != 3 as libc::c_int
7712    {
7713        return 0 as libc::c_int;
7714    }
7715    if (*key).u.zset.type_0 == 0 || ((*key).u.zset.current).is_null() {
7716        return 0 as libc::c_int;
7717    }
7718    if (*(*key).value).encoding() as libc::c_int == 11 as libc::c_int {
7719        let mut zl: *mut libc::c_uchar = (*(*key).value).ptr as *mut libc::c_uchar;
7720        let mut eptr: *mut libc::c_uchar = (*key).u.zset.current as *mut libc::c_uchar;
7721        let mut prev: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
7722        prev = lpPrev(zl, eptr);
7723        if !prev.is_null() {
7724            prev = lpPrev(zl, prev);
7725        }
7726        if prev.is_null() {
7727            (*key).u.zset.er = 1 as libc::c_int;
7728            return 0 as libc::c_int;
7729        } else {
7730            if (*key).u.zset.type_0 == 2 as libc::c_int as libc::c_uint {
7731                let mut saved_prev: *mut libc::c_uchar = prev;
7732                prev = lpNext(zl, prev);
7733                let mut score: libc::c_double = zzlGetScore(prev);
7734                if zslValueGteMin(score, &mut (*key).u.zset.rs) == 0 {
7735                    (*key).u.zset.er = 1 as libc::c_int;
7736                    return 0 as libc::c_int;
7737                }
7738                prev = saved_prev;
7739            } else if (*key).u.zset.type_0 == 1 as libc::c_int as libc::c_uint {
7740                if zzlLexValueGteMin(prev, &mut (*key).u.zset.lrs) == 0 {
7741                    (*key).u.zset.er = 1 as libc::c_int;
7742                    return 0 as libc::c_int;
7743                }
7744            }
7745            (*key).u.zset.current = prev as *mut libc::c_void;
7746            return 1 as libc::c_int;
7747        }
7748    } else {
7749        if (*(*key).value).encoding() as libc::c_int == 7 as libc::c_int {
7750            let mut ln: *mut zskiplistNode = (*key).u.zset.current as *mut zskiplistNode;
7751            let mut prev_0: *mut zskiplistNode = (*ln).backward;
7752            if prev_0.is_null() {
7753                (*key).u.zset.er = 1 as libc::c_int;
7754                return 0 as libc::c_int;
7755            } else {
7756                if (*key).u.zset.type_0 == 2 as libc::c_int as libc::c_uint
7757                    && zslValueGteMin((*prev_0).score, &mut (*key).u.zset.rs) == 0
7758                {
7759                    (*key).u.zset.er = 1 as libc::c_int;
7760                    return 0 as libc::c_int;
7761                } else {
7762                    if (*key).u.zset.type_0 == 1 as libc::c_int as libc::c_uint {
7763                        if zslLexValueGteMin((*prev_0).ele, &mut (*key).u.zset.lrs) == 0
7764                        {
7765                            (*key).u.zset.er = 1 as libc::c_int;
7766                            return 0 as libc::c_int;
7767                        }
7768                    }
7769                }
7770                (*key).u.zset.current = prev_0 as *mut libc::c_void;
7771                return 1 as libc::c_int;
7772            }
7773        } else {
7774            _serverPanic(
7775                b"module.c\0" as *const u8 as *const libc::c_char,
7776                4759 as libc::c_int,
7777                b"Unsupported zset encoding\0" as *const u8 as *const libc::c_char,
7778            );
7779            unreachable!();
7780        }
7781    }
7782    panic!("Reached end of non-void function without returning");
7783}
7784#[no_mangle]
7785pub unsafe extern "C" fn RM_HashSet(
7786    mut key: *mut RedisModuleKey,
7787    mut flags: libc::c_int,
7788    mut args: ...
7789) -> libc::c_int {
7790    let mut ap: core::ffi::VaListImpl;
7791    if key.is_null()
7792        || flags
7793            & !((1 as libc::c_int) << 0 as libc::c_int
7794                | (1 as libc::c_int) << 1 as libc::c_int
7795                | (1 as libc::c_int) << 2 as libc::c_int
7796                | (1 as libc::c_int) << 4 as libc::c_int) != 0
7797    {
7798        *__errno_location() = 22 as libc::c_int;
7799        return 0 as libc::c_int;
7800    } else {
7801        if !((*key).value).is_null()
7802            && (*(*key).value).type_0() as libc::c_int != 4 as libc::c_int
7803        {
7804            *__errno_location() = 95 as libc::c_int;
7805            return 0 as libc::c_int;
7806        } else {
7807            if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
7808                *__errno_location() = 9 as libc::c_int;
7809                return 0 as libc::c_int;
7810            }
7811        }
7812    }
7813    if ((*key).value).is_null() {
7814        moduleCreateEmptyKey(key, 3 as libc::c_int);
7815    }
7816    let mut count: libc::c_int = 0 as libc::c_int;
7817    ap = args.clone();
7818    loop {
7819        let mut field: *mut robj = 0 as *mut robj;
7820        let mut value: *mut robj = 0 as *mut robj;
7821        if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
7822            let mut cfield: *mut libc::c_char = ap.arg::<*mut libc::c_char>();
7823            if cfield.is_null() {
7824                break;
7825            }
7826            field = createRawStringObject(cfield, strlen(cfield));
7827        } else {
7828            field = ap.arg::<*mut robj>();
7829            if field.is_null() {
7830                break;
7831            }
7832        }
7833        value = ap.arg::<*mut robj>();
7834        if flags
7835            & ((1 as libc::c_int) << 1 as libc::c_int
7836                | (1 as libc::c_int) << 0 as libc::c_int) != 0
7837        {
7838            let mut exists: libc::c_int = hashTypeExists(
7839                (*key).value,
7840                (*field).ptr as sds,
7841            );
7842            if flags & (1 as libc::c_int) << 1 as libc::c_int != 0 && exists == 0
7843                || flags & (1 as libc::c_int) << 0 as libc::c_int != 0 && exists != 0
7844            {
7845                if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
7846                    decrRefCount(field);
7847                }
7848                continue;
7849            }
7850        }
7851        if value == 1 as libc::c_int as libc::c_long as *mut robj {
7852            count += hashTypeDelete((*key).value, (*field).ptr as sds);
7853            if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
7854                decrRefCount(field);
7855            }
7856        } else {
7857            let mut low_flags: libc::c_int = 0 as libc::c_int;
7858            if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
7859                low_flags |= (1 as libc::c_int) << 0 as libc::c_int;
7860            }
7861            let mut argv: [*mut robj; 2] = [field, value];
7862            hashTypeTryConversion(
7863                (*key).value,
7864                argv.as_mut_ptr(),
7865                0 as libc::c_int,
7866                1 as libc::c_int,
7867            );
7868            let mut updated: libc::c_int = hashTypeSet(
7869                (*key).value,
7870                (*field).ptr as sds,
7871                (*value).ptr as sds,
7872                low_flags,
7873            );
7874            count
7875                += if flags & (1 as libc::c_int) << 4 as libc::c_int != 0 {
7876                    1 as libc::c_int
7877                } else {
7878                    updated
7879                };
7880            if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
7881                (*field).ptr = 0 as *mut libc::c_void;
7882                decrRefCount(field);
7883            }
7884        }
7885    }
7886    moduleDelKeyIfEmpty(key);
7887    if count == 0 as libc::c_int {
7888        *__errno_location() = 2 as libc::c_int;
7889    }
7890    return count;
7891}
7892#[no_mangle]
7893pub unsafe extern "C" fn RM_HashGet(
7894    mut key: *mut RedisModuleKey,
7895    mut flags: libc::c_int,
7896    mut args: ...
7897) -> libc::c_int {
7898    let mut ap: core::ffi::VaListImpl;
7899    if !((*key).value).is_null()
7900        && (*(*key).value).type_0() as libc::c_int != 4 as libc::c_int
7901    {
7902        return 1 as libc::c_int;
7903    }
7904    ap = args.clone();
7905    loop {
7906        let mut field: *mut robj = 0 as *mut robj;
7907        let mut valueptr: *mut *mut robj = 0 as *mut *mut robj;
7908        let mut existsptr: *mut libc::c_int = 0 as *mut libc::c_int;
7909        if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
7910            let mut cfield: *mut libc::c_char = ap.arg::<*mut libc::c_char>();
7911            if cfield.is_null() {
7912                break;
7913            }
7914            field = createRawStringObject(cfield, strlen(cfield));
7915        } else {
7916            field = ap.arg::<*mut robj>();
7917            if field.is_null() {
7918                break;
7919            }
7920        }
7921        if flags & (1 as libc::c_int) << 3 as libc::c_int != 0 {
7922            existsptr = ap.arg::<*mut libc::c_int>();
7923            if !((*key).value).is_null() {
7924                *existsptr = hashTypeExists((*key).value, (*field).ptr as sds);
7925            } else {
7926                *existsptr = 0 as libc::c_int;
7927            }
7928        } else {
7929            valueptr = ap.arg::<*mut *mut robj>();
7930            if !((*key).value).is_null() {
7931                *valueptr = hashTypeGetValueObject((*key).value, (*field).ptr as sds);
7932                if !(*valueptr).is_null() {
7933                    let mut decoded: *mut robj = getDecodedObject(*valueptr);
7934                    decrRefCount(*valueptr);
7935                    *valueptr = decoded;
7936                }
7937                if !(*valueptr).is_null() {
7938                    autoMemoryAdd(
7939                        (*key).ctx,
7940                        1 as libc::c_int,
7941                        *valueptr as *mut libc::c_void,
7942                    );
7943                }
7944            } else {
7945                *valueptr = 0 as *mut robj;
7946            }
7947        }
7948        if flags & (1 as libc::c_int) << 2 as libc::c_int != 0 {
7949            decrRefCount(field);
7950        }
7951    }
7952    return 0 as libc::c_int;
7953}
7954#[no_mangle]
7955pub unsafe extern "C" fn RM_StreamAdd(
7956    mut key: *mut RedisModuleKey,
7957    mut flags: libc::c_int,
7958    mut id: *mut RedisModuleStreamID,
7959    mut argv: *mut *mut robj,
7960    mut numfields: libc::c_long,
7961) -> libc::c_int {
7962    if key.is_null() || numfields != 0 as libc::c_int as libc::c_long && argv.is_null()
7963        || flags & !((1 as libc::c_int) << 0 as libc::c_int) != 0
7964        || flags & (1 as libc::c_int) << 0 as libc::c_int == 0 && id.is_null()
7965    {
7966        *__errno_location() = 22 as libc::c_int;
7967        return 1 as libc::c_int;
7968    } else {
7969        if !((*key).value).is_null()
7970            && (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
7971        {
7972            *__errno_location() = 95 as libc::c_int;
7973            return 1 as libc::c_int;
7974        } else {
7975            if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
7976                *__errno_location() = 9 as libc::c_int;
7977                return 1 as libc::c_int;
7978            } else {
7979                if flags & (1 as libc::c_int) << 0 as libc::c_int == 0
7980                    && (*id).ms == 0 as libc::c_int as libc::c_ulong
7981                    && (*id).seq == 0 as libc::c_int as libc::c_ulong
7982                {
7983                    *__errno_location() = 33 as libc::c_int;
7984                    return 1 as libc::c_int;
7985                }
7986            }
7987        }
7988    }
7989    let mut created: libc::c_int = 0 as libc::c_int;
7990    if ((*key).value).is_null() {
7991        moduleCreateEmptyKey(key, 7 as libc::c_int);
7992        created = 1 as libc::c_int;
7993    }
7994    let mut s: *mut stream = (*(*key).value).ptr as *mut stream;
7995    if (*s).last_id.ms == 18446744073709551615 as libc::c_ulong
7996        && (*s).last_id.seq == 18446744073709551615 as libc::c_ulong
7997    {
7998        *__errno_location() = 27 as libc::c_int;
7999        return 1 as libc::c_int;
8000    }
8001    let mut added_id: streamID = streamID { ms: 0, seq: 0 };
8002    let mut use_id: streamID = streamID { ms: 0, seq: 0 };
8003    let mut use_id_ptr: *mut streamID = 0 as *mut streamID;
8004    if flags & (1 as libc::c_int) << 0 as libc::c_int == 0 {
8005        use_id.ms = (*id).ms;
8006        use_id.seq = (*id).seq;
8007        use_id_ptr = &mut use_id;
8008    }
8009    if streamAppendItem(s, argv, numfields, &mut added_id, use_id_ptr, 1 as libc::c_int)
8010        == -(1 as libc::c_int)
8011    {
8012        return 1 as libc::c_int;
8013    }
8014    if created == 0 {
8015        (*key).u.stream.signalready = 1 as libc::c_int;
8016    }
8017    if !id.is_null() {
8018        (*id).ms = added_id.ms;
8019        (*id).seq = added_id.seq;
8020    }
8021    return 0 as libc::c_int;
8022}
8023#[no_mangle]
8024pub unsafe extern "C" fn RM_StreamDelete(
8025    mut key: *mut RedisModuleKey,
8026    mut id: *mut RedisModuleStreamID,
8027) -> libc::c_int {
8028    if key.is_null() || id.is_null() {
8029        *__errno_location() = 22 as libc::c_int;
8030        return 1 as libc::c_int;
8031    } else {
8032        if ((*key).value).is_null()
8033            || (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
8034        {
8035            *__errno_location() = 95 as libc::c_int;
8036            return 1 as libc::c_int;
8037        } else {
8038            if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
8039                || !((*key).iter).is_null()
8040            {
8041                *__errno_location() = 9 as libc::c_int;
8042                return 1 as libc::c_int;
8043            }
8044        }
8045    }
8046    let mut s: *mut stream = (*(*key).value).ptr as *mut stream;
8047    let mut streamid: streamID = {
8048        let mut init = streamID {
8049            ms: (*id).ms,
8050            seq: (*id).seq,
8051        };
8052        init
8053    };
8054    if streamDeleteItem(s, &mut streamid) != 0 {
8055        return 0 as libc::c_int
8056    } else {
8057        *__errno_location() = 2 as libc::c_int;
8058        return 1 as libc::c_int;
8059    };
8060}
8061#[no_mangle]
8062pub unsafe extern "C" fn RM_StreamIteratorStart(
8063    mut key: *mut RedisModuleKey,
8064    mut flags: libc::c_int,
8065    mut start: *mut RedisModuleStreamID,
8066    mut end: *mut RedisModuleStreamID,
8067) -> libc::c_int {
8068    if key.is_null()
8069        || flags
8070            & !((1 as libc::c_int) << 0 as libc::c_int
8071                | (1 as libc::c_int) << 1 as libc::c_int) != 0
8072    {
8073        *__errno_location() = 22 as libc::c_int;
8074        return 1 as libc::c_int;
8075    } else {
8076        if ((*key).value).is_null()
8077            || (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
8078        {
8079            *__errno_location() = 95 as libc::c_int;
8080            return 1 as libc::c_int;
8081        } else {
8082            if !((*key).iter).is_null() {
8083                *__errno_location() = 9 as libc::c_int;
8084                return 1 as libc::c_int;
8085            }
8086        }
8087    }
8088    let mut lower: streamID = streamID { ms: 0, seq: 0 };
8089    let mut upper: streamID = streamID { ms: 0, seq: 0 };
8090    if !start.is_null() {
8091        lower = {
8092            let mut init = streamID {
8093                ms: (*start).ms,
8094                seq: (*start).seq,
8095            };
8096            init
8097        };
8098    }
8099    if !end.is_null() {
8100        upper = {
8101            let mut init = streamID {
8102                ms: (*end).ms,
8103                seq: (*end).seq,
8104            };
8105            init
8106        };
8107    }
8108    if flags & (1 as libc::c_int) << 0 as libc::c_int != 0 {
8109        if !start.is_null() && streamIncrID(&mut lower) != 0 as libc::c_int
8110            || !end.is_null() && streamDecrID(&mut upper) != 0 as libc::c_int
8111        {
8112            *__errno_location() = 33 as libc::c_int;
8113            return 1 as libc::c_int;
8114        }
8115    }
8116    let mut s: *mut stream = (*(*key).value).ptr as *mut stream;
8117    let mut rev: libc::c_int = flags & (1 as libc::c_int) << 1 as libc::c_int;
8118    let mut si: *mut streamIterator = zmalloc(
8119        core::mem::size_of::<streamIterator>() as libc::c_ulong,
8120    ) as *mut streamIterator;
8121    streamIteratorStart(
8122        si,
8123        s,
8124        if !start.is_null() { &mut lower } else { 0 as *mut streamID },
8125        if !end.is_null() { &mut upper } else { 0 as *mut streamID },
8126        rev,
8127    );
8128    (*key).iter = si as *mut libc::c_void;
8129    (*key).u.stream.currentid.ms = 0 as libc::c_int as uint64_t;
8130    (*key).u.stream.currentid.seq = 0 as libc::c_int as uint64_t;
8131    (*key).u.stream.numfieldsleft = 0 as libc::c_int as int64_t;
8132    return 0 as libc::c_int;
8133}
8134#[no_mangle]
8135pub unsafe extern "C" fn RM_StreamIteratorStop(
8136    mut key: *mut RedisModuleKey,
8137) -> libc::c_int {
8138    if key.is_null() {
8139        *__errno_location() = 22 as libc::c_int;
8140        return 1 as libc::c_int;
8141    } else {
8142        if ((*key).value).is_null()
8143            || (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
8144        {
8145            *__errno_location() = 95 as libc::c_int;
8146            return 1 as libc::c_int;
8147        } else {
8148            if ((*key).iter).is_null() {
8149                *__errno_location() = 9 as libc::c_int;
8150                return 1 as libc::c_int;
8151            }
8152        }
8153    }
8154    streamIteratorStop((*key).iter as *mut streamIterator);
8155    zfree((*key).iter);
8156    (*key).iter = 0 as *mut libc::c_void;
8157    return 0 as libc::c_int;
8158}
8159#[no_mangle]
8160pub unsafe extern "C" fn RM_StreamIteratorNextID(
8161    mut key: *mut RedisModuleKey,
8162    mut id: *mut RedisModuleStreamID,
8163    mut numfields: *mut libc::c_long,
8164) -> libc::c_int {
8165    if key.is_null() {
8166        *__errno_location() = 22 as libc::c_int;
8167        return 1 as libc::c_int;
8168    } else {
8169        if ((*key).value).is_null()
8170            || (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
8171        {
8172            *__errno_location() = 95 as libc::c_int;
8173            return 1 as libc::c_int;
8174        } else {
8175            if ((*key).iter).is_null() {
8176                *__errno_location() = 9 as libc::c_int;
8177                return 1 as libc::c_int;
8178            }
8179        }
8180    }
8181    let mut si: *mut streamIterator = (*key).iter as *mut streamIterator;
8182    let mut num_ptr: *mut int64_t = &mut (*key).u.stream.numfieldsleft;
8183    let mut streamid_ptr: *mut streamID = &mut (*key).u.stream.currentid;
8184    if streamIteratorGetID(si, streamid_ptr, num_ptr) != 0 {
8185        if !id.is_null() {
8186            (*id).ms = (*streamid_ptr).ms;
8187            (*id).seq = (*streamid_ptr).seq;
8188        }
8189        if !numfields.is_null() {
8190            *numfields = *num_ptr;
8191        }
8192        return 0 as libc::c_int;
8193    } else {
8194        (*key).u.stream.currentid.ms = 0 as libc::c_int as uint64_t;
8195        (*key).u.stream.currentid.seq = 0 as libc::c_int as uint64_t;
8196        (*key).u.stream.numfieldsleft = 0 as libc::c_int as int64_t;
8197        *__errno_location() = 2 as libc::c_int;
8198        return 1 as libc::c_int;
8199    };
8200}
8201#[no_mangle]
8202pub unsafe extern "C" fn RM_StreamIteratorNextField(
8203    mut key: *mut RedisModuleKey,
8204    mut field_ptr: *mut *mut robj,
8205    mut value_ptr: *mut *mut robj,
8206) -> libc::c_int {
8207    if key.is_null() {
8208        *__errno_location() = 22 as libc::c_int;
8209        return 1 as libc::c_int;
8210    } else {
8211        if ((*key).value).is_null()
8212            || (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
8213        {
8214            *__errno_location() = 95 as libc::c_int;
8215            return 1 as libc::c_int;
8216        } else {
8217            if ((*key).iter).is_null() {
8218                *__errno_location() = 9 as libc::c_int;
8219                return 1 as libc::c_int;
8220            } else {
8221                if (*key).u.stream.numfieldsleft <= 0 as libc::c_int as libc::c_long {
8222                    *__errno_location() = 2 as libc::c_int;
8223                    return 1 as libc::c_int;
8224                }
8225            }
8226        }
8227    }
8228    let mut si: *mut streamIterator = (*key).iter as *mut streamIterator;
8229    let mut field: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
8230    let mut value: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
8231    let mut field_len: int64_t = 0;
8232    let mut value_len: int64_t = 0;
8233    streamIteratorGetField(si, &mut field, &mut value, &mut field_len, &mut value_len);
8234    if !field_ptr.is_null() {
8235        *field_ptr = createRawStringObject(
8236            field as *mut libc::c_char,
8237            field_len as size_t,
8238        );
8239        autoMemoryAdd((*key).ctx, 1 as libc::c_int, *field_ptr as *mut libc::c_void);
8240    }
8241    if !value_ptr.is_null() {
8242        *value_ptr = createRawStringObject(
8243            value as *mut libc::c_char,
8244            value_len as size_t,
8245        );
8246        autoMemoryAdd((*key).ctx, 1 as libc::c_int, *value_ptr as *mut libc::c_void);
8247    }
8248    (*key).u.stream.numfieldsleft -= 1;
8249    return 0 as libc::c_int;
8250}
8251#[no_mangle]
8252pub unsafe extern "C" fn RM_StreamIteratorDelete(
8253    mut key: *mut RedisModuleKey,
8254) -> libc::c_int {
8255    if key.is_null() {
8256        *__errno_location() = 22 as libc::c_int;
8257        return 1 as libc::c_int;
8258    } else {
8259        if ((*key).value).is_null()
8260            || (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
8261        {
8262            *__errno_location() = 95 as libc::c_int;
8263            return 1 as libc::c_int;
8264        } else {
8265            if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
8266                || ((*key).iter).is_null()
8267            {
8268                *__errno_location() = 9 as libc::c_int;
8269                return 1 as libc::c_int;
8270            } else {
8271                if (*key).u.stream.currentid.ms == 0 as libc::c_int as libc::c_ulong
8272                    && (*key).u.stream.currentid.seq == 0 as libc::c_int as libc::c_ulong
8273                {
8274                    *__errno_location() = 2 as libc::c_int;
8275                    return 1 as libc::c_int;
8276                }
8277            }
8278        }
8279    }
8280    let mut si: *mut streamIterator = (*key).iter as *mut streamIterator;
8281    streamIteratorRemoveEntry(si, &mut (*key).u.stream.currentid);
8282    (*key).u.stream.currentid.ms = 0 as libc::c_int as uint64_t;
8283    (*key).u.stream.currentid.seq = 0 as libc::c_int as uint64_t;
8284    (*key).u.stream.numfieldsleft = 0 as libc::c_int as int64_t;
8285    return 0 as libc::c_int;
8286}
8287#[no_mangle]
8288pub unsafe extern "C" fn RM_StreamTrimByLength(
8289    mut key: *mut RedisModuleKey,
8290    mut flags: libc::c_int,
8291    mut length: libc::c_longlong,
8292) -> libc::c_longlong {
8293    if key.is_null() || flags & !((1 as libc::c_int) << 0 as libc::c_int) != 0
8294        || length < 0 as libc::c_int as libc::c_longlong
8295    {
8296        *__errno_location() = 22 as libc::c_int;
8297        return -(1 as libc::c_int) as libc::c_longlong;
8298    } else {
8299        if ((*key).value).is_null()
8300            || (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
8301        {
8302            *__errno_location() = 95 as libc::c_int;
8303            return -(1 as libc::c_int) as libc::c_longlong;
8304        } else {
8305            if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
8306                *__errno_location() = 9 as libc::c_int;
8307                return -(1 as libc::c_int) as libc::c_longlong;
8308            }
8309        }
8310    }
8311    let mut approx: libc::c_int = if flags & (1 as libc::c_int) << 0 as libc::c_int != 0
8312    {
8313        1 as libc::c_int
8314    } else {
8315        0 as libc::c_int
8316    };
8317    return streamTrimByLength((*(*key).value).ptr as *mut stream, length, approx)
8318        as libc::c_longlong;
8319}
8320#[no_mangle]
8321pub unsafe extern "C" fn RM_StreamTrimByID(
8322    mut key: *mut RedisModuleKey,
8323    mut flags: libc::c_int,
8324    mut id: *mut RedisModuleStreamID,
8325) -> libc::c_longlong {
8326    if key.is_null() || flags & !((1 as libc::c_int) << 0 as libc::c_int) != 0
8327        || id.is_null()
8328    {
8329        *__errno_location() = 22 as libc::c_int;
8330        return -(1 as libc::c_int) as libc::c_longlong;
8331    } else {
8332        if ((*key).value).is_null()
8333            || (*(*key).value).type_0() as libc::c_int != 6 as libc::c_int
8334        {
8335            *__errno_location() = 95 as libc::c_int;
8336            return -(1 as libc::c_int) as libc::c_longlong;
8337        } else {
8338            if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0 {
8339                *__errno_location() = 9 as libc::c_int;
8340                return -(1 as libc::c_int) as libc::c_longlong;
8341            }
8342        }
8343    }
8344    let mut approx: libc::c_int = if flags & (1 as libc::c_int) << 0 as libc::c_int != 0
8345    {
8346        1 as libc::c_int
8347    } else {
8348        0 as libc::c_int
8349    };
8350    let mut minid: streamID = {
8351        let mut init = streamID {
8352            ms: (*id).ms,
8353            seq: (*id).seq,
8354        };
8355        init
8356    };
8357    return streamTrimByID((*(*key).value).ptr as *mut stream, minid, approx)
8358        as libc::c_longlong;
8359}
8360#[no_mangle]
8361pub unsafe extern "C" fn RM_FreeCallReply(mut reply: *mut RedisModuleCallReply) {
8362    let mut ctx: *mut RedisModuleCtx = callReplyGetPrivateData(reply)
8363        as *mut RedisModuleCtx;
8364    freeCallReply(reply);
8365    autoMemoryFreed(ctx, 2 as libc::c_int, reply as *mut libc::c_void);
8366}
8367#[no_mangle]
8368pub unsafe extern "C" fn RM_CallReplyType(
8369    mut reply: *mut RedisModuleCallReply,
8370) -> libc::c_int {
8371    return callReplyType(reply);
8372}
8373#[no_mangle]
8374pub unsafe extern "C" fn RM_CallReplyLength(
8375    mut reply: *mut RedisModuleCallReply,
8376) -> size_t {
8377    return callReplyGetLen(reply);
8378}
8379#[no_mangle]
8380pub unsafe extern "C" fn RM_CallReplyArrayElement(
8381    mut reply: *mut RedisModuleCallReply,
8382    mut idx: size_t,
8383) -> *mut RedisModuleCallReply {
8384    return callReplyGetArrayElement(reply, idx);
8385}
8386#[no_mangle]
8387pub unsafe extern "C" fn RM_CallReplyInteger(
8388    mut reply: *mut RedisModuleCallReply,
8389) -> libc::c_longlong {
8390    return callReplyGetLongLong(reply);
8391}
8392#[no_mangle]
8393pub unsafe extern "C" fn RM_CallReplyDouble(
8394    mut reply: *mut RedisModuleCallReply,
8395) -> libc::c_double {
8396    return callReplyGetDouble(reply);
8397}
8398#[no_mangle]
8399pub unsafe extern "C" fn RM_CallReplyBigNumber(
8400    mut reply: *mut RedisModuleCallReply,
8401    mut len: *mut size_t,
8402) -> *const libc::c_char {
8403    return callReplyGetBigNumber(reply, len);
8404}
8405#[no_mangle]
8406pub unsafe extern "C" fn RM_CallReplyVerbatim(
8407    mut reply: *mut RedisModuleCallReply,
8408    mut len: *mut size_t,
8409    mut format: *mut *const libc::c_char,
8410) -> *const libc::c_char {
8411    return callReplyGetVerbatim(reply, len, format);
8412}
8413#[no_mangle]
8414pub unsafe extern "C" fn RM_CallReplyBool(
8415    mut reply: *mut RedisModuleCallReply,
8416) -> libc::c_int {
8417    return callReplyGetBool(reply);
8418}
8419#[no_mangle]
8420pub unsafe extern "C" fn RM_CallReplySetElement(
8421    mut reply: *mut RedisModuleCallReply,
8422    mut idx: size_t,
8423) -> *mut RedisModuleCallReply {
8424    return callReplyGetSetElement(reply, idx);
8425}
8426#[no_mangle]
8427pub unsafe extern "C" fn RM_CallReplyMapElement(
8428    mut reply: *mut RedisModuleCallReply,
8429    mut idx: size_t,
8430    mut key: *mut *mut RedisModuleCallReply,
8431    mut val: *mut *mut RedisModuleCallReply,
8432) -> libc::c_int {
8433    if callReplyGetMapElement(reply, idx, key, val) == 0 as libc::c_int {
8434        return 0 as libc::c_int;
8435    }
8436    return 1 as libc::c_int;
8437}
8438#[no_mangle]
8439pub unsafe extern "C" fn RM_CallReplyAttribute(
8440    mut reply: *mut RedisModuleCallReply,
8441) -> *mut RedisModuleCallReply {
8442    return callReplyGetAttribute(reply);
8443}
8444#[no_mangle]
8445pub unsafe extern "C" fn RM_CallReplyAttributeElement(
8446    mut reply: *mut RedisModuleCallReply,
8447    mut idx: size_t,
8448    mut key: *mut *mut RedisModuleCallReply,
8449    mut val: *mut *mut RedisModuleCallReply,
8450) -> libc::c_int {
8451    if callReplyGetAttributeElement(reply, idx, key, val) == 0 as libc::c_int {
8452        return 0 as libc::c_int;
8453    }
8454    return 1 as libc::c_int;
8455}
8456#[no_mangle]
8457pub unsafe extern "C" fn RM_CallReplyStringPtr(
8458    mut reply: *mut RedisModuleCallReply,
8459    mut len: *mut size_t,
8460) -> *const libc::c_char {
8461    let mut private_len: size_t = 0;
8462    if len.is_null() {
8463        len = &mut private_len;
8464    }
8465    return callReplyGetString(reply, len);
8466}
8467#[no_mangle]
8468pub unsafe extern "C" fn RM_CreateStringFromCallReply(
8469    mut reply: *mut RedisModuleCallReply,
8470) -> *mut robj {
8471    let mut ctx: *mut RedisModuleCtx = callReplyGetPrivateData(reply)
8472        as *mut RedisModuleCtx;
8473    let mut len: size_t = 0;
8474    let mut str: *const libc::c_char = 0 as *const libc::c_char;
8475    match callReplyType(reply) {
8476        0 | 1 => {
8477            str = callReplyGetString(reply, &mut len);
8478            return RM_CreateString(ctx, str, len);
8479        }
8480        2 => {
8481            let mut buf: [libc::c_char; 64] = [0; 64];
8482            let mut len_0: libc::c_int = ll2string(
8483                buf.as_mut_ptr(),
8484                core::mem::size_of::<[libc::c_char; 64]>() as libc::c_ulong,
8485                callReplyGetLongLong(reply),
8486            );
8487            return RM_CreateString(ctx, buf.as_mut_ptr(), len_0 as size_t);
8488        }
8489        _ => return 0 as *mut robj,
8490    };
8491}
8492#[no_mangle]
8493pub unsafe extern "C" fn RM_SetContextUser(
8494    mut ctx: *mut RedisModuleCtx,
8495    mut user: *const RedisModuleUser,
8496) {
8497    (*ctx).user = user;
8498}
8499#[no_mangle]
8500pub unsafe extern "C" fn moduleCreateArgvFromUserFormat(
8501    mut cmdname: *const libc::c_char,
8502    mut fmt: *const libc::c_char,
8503    mut argcp: *mut libc::c_int,
8504    mut argvlenp: *mut libc::c_int,
8505    mut flags: *mut libc::c_int,
8506    mut ap: core::ffi::VaList,
8507) -> *mut *mut robj {
8508    let mut current_block: u64;
8509    let mut argc: libc::c_int = 0 as libc::c_int;
8510    let mut argv_size: libc::c_int = 0;
8511    let mut j: libc::c_int = 0;
8512    let mut argv: *mut *mut robj = 0 as *mut *mut robj;
8513    argv_size = (strlen(fmt)).wrapping_add(1 as libc::c_int as libc::c_ulong)
8514        as libc::c_int;
8515    argv = zrealloc(
8516        argv as *mut libc::c_void,
8517        (core::mem::size_of::<*mut robj>() as libc::c_ulong)
8518            .wrapping_mul(argv_size as libc::c_ulong),
8519    ) as *mut *mut robj;
8520    let ref mut fresh19 = *argv.offset(0 as libc::c_int as isize);
8521    *fresh19 = createStringObject(cmdname, strlen(cmdname));
8522    argc += 1;
8523    let mut p: *const libc::c_char = fmt;
8524    loop {
8525        if !(*p != 0) {
8526            current_block = 4888910987971495881;
8527            break;
8528        }
8529        if *p as libc::c_int == 'c' as i32 {
8530            let mut cstr: *mut libc::c_char = ap.arg::<*mut libc::c_char>();
8531            let fresh20 = argc;
8532            argc = argc + 1;
8533            let ref mut fresh21 = *argv.offset(fresh20 as isize);
8534            *fresh21 = createStringObject(cstr, strlen(cstr));
8535        } else if *p as libc::c_int == 's' as i32 {
8536            let mut obj: *mut robj = ap.arg::<*mut libc::c_void>() as *mut robj;
8537            if (*obj).refcount == 2147483647 as libc::c_int - 1 as libc::c_int {
8538                obj = createStringObject(
8539                    (*obj).ptr as *const libc::c_char,
8540                    sdslen((*obj).ptr as sds),
8541                );
8542            } else {
8543                incrRefCount(obj);
8544            }
8545            let fresh22 = argc;
8546            argc = argc + 1;
8547            let ref mut fresh23 = *argv.offset(fresh22 as isize);
8548            *fresh23 = obj;
8549        } else if *p as libc::c_int == 'b' as i32 {
8550            let mut buf: *mut libc::c_char = ap.arg::<*mut libc::c_char>();
8551            let mut len: size_t = ap.arg::<size_t>();
8552            let fresh24 = argc;
8553            argc = argc + 1;
8554            let ref mut fresh25 = *argv.offset(fresh24 as isize);
8555            *fresh25 = createStringObject(buf, len);
8556        } else if *p as libc::c_int == 'l' as i32 {
8557            let mut ll: libc::c_longlong = ap.arg::<libc::c_longlong>();
8558            let fresh26 = argc;
8559            argc = argc + 1;
8560            let ref mut fresh27 = *argv.offset(fresh26 as isize);
8561            *fresh27 = createObject(
8562                0 as libc::c_int,
8563                sdsfromlonglong(ll) as *mut libc::c_void,
8564            );
8565        } else if *p as libc::c_int == 'v' as i32 {
8566            let mut v: *mut *mut robj = ap.arg::<*mut libc::c_void>() as *mut *mut robj;
8567            let mut vlen: size_t = ap.arg::<size_t>();
8568            argv_size = (argv_size as libc::c_ulong)
8569                .wrapping_add(vlen.wrapping_sub(1 as libc::c_int as libc::c_ulong))
8570                as libc::c_int as libc::c_int;
8571            argv = zrealloc(
8572                argv as *mut libc::c_void,
8573                (core::mem::size_of::<*mut robj>() as libc::c_ulong)
8574                    .wrapping_mul(argv_size as libc::c_ulong),
8575            ) as *mut *mut robj;
8576            let mut i: size_t = 0 as libc::c_int as size_t;
8577            i = 0 as libc::c_int as size_t;
8578            while i < vlen {
8579                incrRefCount(*v.offset(i as isize));
8580                let fresh28 = argc;
8581                argc = argc + 1;
8582                let ref mut fresh29 = *argv.offset(fresh28 as isize);
8583                *fresh29 = *v.offset(i as isize);
8584                i = i.wrapping_add(1);
8585            }
8586        } else if *p as libc::c_int == '!' as i32 {
8587            if !flags.is_null() {
8588                *flags |= (1 as libc::c_int) << 0 as libc::c_int;
8589            }
8590        } else if *p as libc::c_int == 'A' as i32 {
8591            if !flags.is_null() {
8592                *flags |= (1 as libc::c_int) << 1 as libc::c_int;
8593            }
8594        } else if *p as libc::c_int == 'R' as i32 {
8595            if !flags.is_null() {
8596                *flags |= (1 as libc::c_int) << 2 as libc::c_int;
8597            }
8598        } else if *p as libc::c_int == '3' as i32 {
8599            if !flags.is_null() {
8600                *flags |= (1 as libc::c_int) << 3 as libc::c_int;
8601            }
8602        } else if *p as libc::c_int == '0' as i32 {
8603            if !flags.is_null() {
8604                *flags |= (1 as libc::c_int) << 4 as libc::c_int;
8605            }
8606        } else if *p as libc::c_int == 'C' as i32 {
8607            if !flags.is_null() {
8608                *flags |= (1 as libc::c_int) << 5 as libc::c_int;
8609            }
8610        } else if *p as libc::c_int == 'S' as i32 {
8611            if !flags.is_null() {
8612                *flags |= (1 as libc::c_int) << 6 as libc::c_int;
8613            }
8614        } else if *p as libc::c_int == 'W' as i32 {
8615            if !flags.is_null() {
8616                *flags |= (1 as libc::c_int) << 7 as libc::c_int;
8617            }
8618        } else if *p as libc::c_int == 'M' as i32 {
8619            if !flags.is_null() {
8620                *flags |= (1 as libc::c_int) << 9 as libc::c_int;
8621            }
8622        } else {
8623            if !(*p as libc::c_int == 'E' as i32) {
8624                current_block = 7895087294770463614;
8625                break;
8626            }
8627            if !flags.is_null() {
8628                *flags |= (1 as libc::c_int) << 8 as libc::c_int;
8629            }
8630        }
8631        p = p.offset(1);
8632    }
8633    match current_block {
8634        7895087294770463614 => {
8635            j = 0 as libc::c_int;
8636            while j < argc {
8637                decrRefCount(*argv.offset(j as isize));
8638                j += 1;
8639            }
8640            zfree(argv as *mut libc::c_void);
8641            return 0 as *mut *mut robj;
8642        }
8643        _ => {
8644            if !argcp.is_null() {
8645                *argcp = argc;
8646            }
8647            if !argvlenp.is_null() {
8648                *argvlenp = argv_size;
8649            }
8650            return argv;
8651        }
8652    };
8653}
8654#[no_mangle]
8655pub unsafe extern "C" fn RM_Call(
8656    mut ctx: *mut RedisModuleCtx,
8657    mut cmdname: *const libc::c_char,
8658    mut fmt: *const libc::c_char,
8659    mut args: ...
8660) -> *mut RedisModuleCallReply {
8661    let mut err: sds = 0 as *mut libc::c_char;
8662    let mut prev_replication_allowed: libc::c_int = 0;
8663    let mut call_flags: libc::c_int = 0;
8664    let mut proto: sds = 0 as *mut libc::c_char;
8665    let mut current_block: u64;
8666    let mut c: *mut client = 0 as *mut client;
8667    let mut argv: *mut *mut robj = 0 as *mut *mut robj;
8668    let mut argc: libc::c_int = 0 as libc::c_int;
8669    let mut argv_len: libc::c_int = 0 as libc::c_int;
8670    let mut flags: libc::c_int = 0 as libc::c_int;
8671    let mut ap: core::ffi::VaListImpl;
8672    let mut reply: *mut RedisModuleCallReply = 0 as *mut RedisModuleCallReply;
8673    let mut replicate: libc::c_int = 0 as libc::c_int;
8674    let mut error_as_call_replies: libc::c_int = 0 as libc::c_int;
8675    let mut cmd_flags: uint64_t = 0;
8676    ap = args.clone();
8677    argv = moduleCreateArgvFromUserFormat(
8678        cmdname,
8679        fmt,
8680        &mut argc,
8681        &mut argv_len,
8682        &mut flags,
8683        ap.as_va_list(),
8684    );
8685    replicate = flags & (1 as libc::c_int) << 0 as libc::c_int;
8686    error_as_call_replies = flags & (1 as libc::c_int) << 8 as libc::c_int;
8687    let mut user: *mut user = 0 as *mut user;
8688    if flags & (1 as libc::c_int) << 5 as libc::c_int != 0 {
8689        user = if !((*ctx).user).is_null() {
8690            (*(*ctx).user).user
8691        } else {
8692            (*(*ctx).client).user
8693        };
8694        if user.is_null() {
8695            *__errno_location() = 95 as libc::c_int;
8696            if error_as_call_replies != 0 {
8697                let mut msg: sds = sdsnew(
8698                    b"cannot run as user, no user directly attached to context or context's client\0"
8699                        as *const u8 as *const libc::c_char,
8700                );
8701                reply = callReplyCreateError(msg, ctx as *mut libc::c_void);
8702            }
8703            return reply;
8704        }
8705    }
8706    c = moduleAllocTempClient(user);
8707    (*c)
8708        .flags = ((*c).flags as libc::c_ulonglong
8709        | (1 as libc::c_ulonglong) << 41 as libc::c_int) as uint64_t;
8710    (*c).db = (*(*ctx).client).db;
8711    (*c).argv = argv;
8712    (*c).argc = argc;
8713    (*c).argv_len = argv_len;
8714    (*c).resp = 2 as libc::c_int;
8715    if flags & (1 as libc::c_int) << 3 as libc::c_int != 0 {
8716        (*c).resp = 3 as libc::c_int;
8717    } else if flags & (1 as libc::c_int) << 4 as libc::c_int != 0 {
8718        (*c).resp = (*(*ctx).client).resp;
8719    }
8720    if !((*ctx).module).is_null() {
8721        (*(*ctx).module).in_call += 1;
8722    }
8723    if argv.is_null() {
8724        *__errno_location() = 9 as libc::c_int;
8725    } else {
8726        moduleCallCommandFilters(c);
8727        (*c).realcmd = lookupCommand((*c).argv, (*c).argc);
8728        (*c).lastcmd = (*c).realcmd;
8729        (*c).cmd = (*c).lastcmd;
8730        err = 0 as *mut libc::c_char;
8731        if commandCheckExistence(
8732            c,
8733            if error_as_call_replies != 0 { &mut err } else { 0 as *mut sds },
8734        ) == 0
8735        {
8736            *__errno_location() = 2 as libc::c_int;
8737            if error_as_call_replies != 0 {
8738                reply = callReplyCreateError(err, ctx as *mut libc::c_void);
8739            }
8740        } else if commandCheckArity(
8741            c,
8742            if error_as_call_replies != 0 { &mut err } else { 0 as *mut sds },
8743        ) == 0
8744        {
8745            *__errno_location() = 22 as libc::c_int;
8746            if error_as_call_replies != 0 {
8747                reply = callReplyCreateError(err, ctx as *mut libc::c_void);
8748            }
8749        } else {
8750            cmd_flags = getCommandFlags(c);
8751            if flags & (1 as libc::c_int) << 6 as libc::c_int != 0 {
8752                if cmd_flags as libc::c_ulonglong
8753                    & (1 as libc::c_ulonglong) << 6 as libc::c_int != 0
8754                {
8755                    *__errno_location() = 29 as libc::c_int;
8756                    if error_as_call_replies != 0 {
8757                        let mut msg_0: sds = sdscatfmt(
8758                            sdsempty(),
8759                            b"command '%S' is not allowed on script mode\0" as *const u8
8760                                as *const libc::c_char,
8761                            (*(*c).cmd).fullname,
8762                        );
8763                        reply = callReplyCreateError(msg_0, ctx as *mut libc::c_void);
8764                    }
8765                    current_block = 5642327860040497898;
8766                } else {
8767                    current_block = 15512526488502093901;
8768                }
8769            } else {
8770                current_block = 15512526488502093901;
8771            }
8772            match current_block {
8773                5642327860040497898 => {}
8774                _ => {
8775                    if flags & (1 as libc::c_int) << 9 as libc::c_int != 0 {
8776                        if cmd_flags as libc::c_ulonglong
8777                            & (1 as libc::c_ulonglong) << 2 as libc::c_int != 0
8778                        {
8779                            let mut oom_state: libc::c_int = 0;
8780                            if (*ctx).flags & (1 as libc::c_int) << 4 as libc::c_int != 0
8781                            {
8782                                oom_state = (getMaxmemoryState(
8783                                    0 as *mut size_t,
8784                                    0 as *mut size_t,
8785                                    0 as *mut size_t,
8786                                    0 as *mut libc::c_float,
8787                                ) == -(1 as libc::c_int)) as libc::c_int;
8788                            } else {
8789                                oom_state = server.pre_command_oom_state;
8790                            }
8791                            if oom_state != 0 {
8792                                *__errno_location() = 28 as libc::c_int;
8793                                if error_as_call_replies != 0 {
8794                                    let mut msg_1: sds = sdsdup((*shared.oomerr).ptr as sds);
8795                                    reply = callReplyCreateError(
8796                                        msg_1,
8797                                        ctx as *mut libc::c_void,
8798                                    );
8799                                }
8800                                current_block = 5642327860040497898;
8801                            } else {
8802                                current_block = 1854459640724737493;
8803                            }
8804                        } else {
8805                            current_block = 1854459640724737493;
8806                        }
8807                    } else {
8808                        current_block = 1854459640724737493;
8809                    }
8810                    match current_block {
8811                        5642327860040497898 => {}
8812                        _ => {
8813                            if flags & (1 as libc::c_int) << 7 as libc::c_int != 0 {
8814                                if cmd_flags as libc::c_ulonglong
8815                                    & (1 as libc::c_ulonglong) << 0 as libc::c_int != 0
8816                                {
8817                                    *__errno_location() = 28 as libc::c_int;
8818                                    if error_as_call_replies != 0 {
8819                                        let mut msg_2: sds = sdscatfmt(
8820                                            sdsempty(),
8821                                            b"Write command '%S' was called while write is not allowed.\0"
8822                                                as *const u8 as *const libc::c_char,
8823                                            (*(*c).cmd).fullname,
8824                                        );
8825                                        reply = callReplyCreateError(
8826                                            msg_2,
8827                                            ctx as *mut libc::c_void,
8828                                        );
8829                                    }
8830                                    current_block = 5642327860040497898;
8831                                } else {
8832                                    current_block = 8835654301469918283;
8833                                }
8834                            } else {
8835                                current_block = 8835654301469918283;
8836                            }
8837                            match current_block {
8838                                5642327860040497898 => {}
8839                                _ => {
8840                                    if flags & (1 as libc::c_int) << 6 as libc::c_int != 0 {
8841                                        if cmd_flags as libc::c_ulonglong
8842                                            & (1 as libc::c_ulonglong) << 0 as libc::c_int != 0
8843                                        {
8844                                            if checkGoodReplicasStatus() == 0 {
8845                                                *__errno_location() = 29 as libc::c_int;
8846                                                if error_as_call_replies != 0 {
8847                                                    let mut msg_3: sds = sdsdup(
8848                                                        (*shared.noreplicaserr).ptr as sds,
8849                                                    );
8850                                                    reply = callReplyCreateError(
8851                                                        msg_3,
8852                                                        ctx as *mut libc::c_void,
8853                                                    );
8854                                                }
8855                                                current_block = 5642327860040497898;
8856                                            } else {
8857                                                let mut deny_write_type: libc::c_int = writeCommandsDeniedByDiskError();
8858                                                let mut obey_client: libc::c_int = (!(server.current_client)
8859                                                    .is_null() && mustObeyClient(server.current_client) != 0)
8860                                                    as libc::c_int;
8861                                                if deny_write_type != 0 as libc::c_int && obey_client == 0 {
8862                                                    *__errno_location() = 29 as libc::c_int;
8863                                                    if error_as_call_replies != 0 {
8864                                                        let mut msg_4: sds = writeCommandsGetDiskErrorMessage(
8865                                                            deny_write_type,
8866                                                        );
8867                                                        reply = callReplyCreateError(
8868                                                            msg_4,
8869                                                            ctx as *mut libc::c_void,
8870                                                        );
8871                                                    }
8872                                                    current_block = 5642327860040497898;
8873                                                } else if !(server.masterhost).is_null()
8874                                                    && server.repl_slave_ro != 0 && obey_client == 0
8875                                                {
8876                                                    *__errno_location() = 29 as libc::c_int;
8877                                                    if error_as_call_replies != 0 {
8878                                                        let mut msg_5: sds = sdsdup(
8879                                                            (*shared.roslaveerr).ptr as sds,
8880                                                        );
8881                                                        reply = callReplyCreateError(
8882                                                            msg_5,
8883                                                            ctx as *mut libc::c_void,
8884                                                        );
8885                                                    }
8886                                                    current_block = 5642327860040497898;
8887                                                } else {
8888                                                    current_block = 15514718523126015390;
8889                                                }
8890                                            }
8891                                        } else {
8892                                            current_block = 15514718523126015390;
8893                                        }
8894                                        match current_block {
8895                                            5642327860040497898 => {}
8896                                            _ => {
8897                                                if !(server.masterhost).is_null()
8898                                                    && server.repl_state != REPL_STATE_CONNECTED as libc::c_int
8899                                                    && server.repl_serve_stale_data == 0 as libc::c_int
8900                                                    && cmd_flags as libc::c_ulonglong
8901                                                        & (1 as libc::c_ulonglong) << 10 as libc::c_int == 0
8902                                                {
8903                                                    *__errno_location() = 29 as libc::c_int;
8904                                                    if error_as_call_replies != 0 {
8905                                                        let mut msg_6: sds = sdsdup(
8906                                                            (*shared.masterdownerr).ptr as sds,
8907                                                        );
8908                                                        reply = callReplyCreateError(
8909                                                            msg_6,
8910                                                            ctx as *mut libc::c_void,
8911                                                        );
8912                                                    }
8913                                                    current_block = 5642327860040497898;
8914                                                } else {
8915                                                    current_block = 18325745679564279244;
8916                                                }
8917                                            }
8918                                        }
8919                                    } else {
8920                                        current_block = 18325745679564279244;
8921                                    }
8922                                    match current_block {
8923                                        5642327860040497898 => {}
8924                                        _ => {
8925                                            if flags & (1 as libc::c_int) << 5 as libc::c_int != 0 {
8926                                                let mut acl_errpos: libc::c_int = 0;
8927                                                let mut acl_retval: libc::c_int = 0;
8928                                                acl_retval = ACLCheckAllUserCommandPerm(
8929                                                    user,
8930                                                    (*c).cmd,
8931                                                    (*c).argv,
8932                                                    (*c).argc,
8933                                                    &mut acl_errpos,
8934                                                );
8935                                                if acl_retval != 0 as libc::c_int {
8936                                                    let mut object: sds = if acl_retval == 1 as libc::c_int {
8937                                                        sdsdup((*(*c).cmd).fullname)
8938                                                    } else {
8939                                                        sdsdup(
8940                                                            (**((*c).argv).offset(acl_errpos as isize)).ptr as sds,
8941                                                        )
8942                                                    };
8943                                                    addACLLogEntry(
8944                                                        (*ctx).client,
8945                                                        acl_retval,
8946                                                        3 as libc::c_int,
8947                                                        -(1 as libc::c_int),
8948                                                        (*(*(*ctx).client).user).name,
8949                                                        object,
8950                                                    );
8951                                                    if error_as_call_replies != 0 {
8952                                                        let mut msg_7: sds = sdscatfmt(
8953                                                            sdsempty(),
8954                                                            b"acl verification failed, %s.\0" as *const u8
8955                                                                as *const libc::c_char,
8956                                                            getAclErrorMessage(acl_retval),
8957                                                        );
8958                                                        reply = callReplyCreateError(
8959                                                            msg_7,
8960                                                            ctx as *mut libc::c_void,
8961                                                        );
8962                                                    }
8963                                                    *__errno_location() = 13 as libc::c_int;
8964                                                    current_block = 5642327860040497898;
8965                                                } else {
8966                                                    current_block = 5687667889785024198;
8967                                                }
8968                                            } else {
8969                                                current_block = 5687667889785024198;
8970                                            }
8971                                            match current_block {
8972                                                5642327860040497898 => {}
8973                                                _ => {
8974                                                    if server.cluster_enabled != 0
8975                                                        && mustObeyClient((*ctx).client) == 0
8976                                                    {
8977                                                        let mut error_code: libc::c_int = 0;
8978                                                        (*c).flags
8979                                                            &= !((1 as libc::c_int) << 17 as libc::c_int
8980                                                                | (1 as libc::c_int) << 9 as libc::c_int) as libc::c_ulong;
8981                                                        (*c).flags
8982                                                            |= (*(*ctx).client).flags
8983                                                                & ((1 as libc::c_int) << 17 as libc::c_int
8984                                                                    | (1 as libc::c_int) << 9 as libc::c_int) as libc::c_ulong;
8985                                                        if getNodeByQuery(
8986                                                            c,
8987                                                            (*c).cmd,
8988                                                            (*c).argv,
8989                                                            (*c).argc,
8990                                                            0 as *mut libc::c_int,
8991                                                            &mut error_code,
8992                                                        ) != (*server.cluster).myself
8993                                                        {
8994                                                            let mut msg_8: sds = 0 as sds;
8995                                                            if error_code == 7 as libc::c_int {
8996                                                                if error_as_call_replies != 0 {
8997                                                                    msg_8 = sdscatfmt(
8998                                                                        sdsempty(),
8999                                                                        b"Can not execute a write command '%S' while the cluster is down and readonly\0"
9000                                                                            as *const u8 as *const libc::c_char,
9001                                                                        (*(*c).cmd).fullname,
9002                                                                    );
9003                                                                }
9004                                                                *__errno_location() = 30 as libc::c_int;
9005                                                            } else if error_code == 5 as libc::c_int {
9006                                                                if error_as_call_replies != 0 {
9007                                                                    msg_8 = sdscatfmt(
9008                                                                        sdsempty(),
9009                                                                        b"Can not execute a command '%S' while the cluster is down\0"
9010                                                                            as *const u8 as *const libc::c_char,
9011                                                                        (*(*c).cmd).fullname,
9012                                                                    );
9013                                                                }
9014                                                                *__errno_location() = 100 as libc::c_int;
9015                                                            } else {
9016                                                                if error_as_call_replies != 0 {
9017                                                                    msg_8 = sdsnew(
9018                                                                        b"Attempted to access a non local key in a cluster node\0"
9019                                                                            as *const u8 as *const libc::c_char,
9020                                                                    );
9021                                                                }
9022                                                                *__errno_location() = 1 as libc::c_int;
9023                                                            }
9024                                                            if !msg_8.is_null() {
9025                                                                reply = callReplyCreateError(
9026                                                                    msg_8,
9027                                                                    ctx as *mut libc::c_void,
9028                                                                );
9029                                                            }
9030                                                            current_block = 5642327860040497898;
9031                                                        } else {
9032                                                            current_block = 2522825242109451841;
9033                                                        }
9034                                                    } else {
9035                                                        current_block = 2522825242109451841;
9036                                                    }
9037                                                    match current_block {
9038                                                        5642327860040497898 => {}
9039                                                        _ => {
9040                                                            prev_replication_allowed = server.replication_allowed;
9041                                                            server
9042                                                                .replication_allowed = (replicate != 0
9043                                                                && server.replication_allowed != 0) as libc::c_int;
9044                                                            call_flags = (1 as libc::c_int) << 0 as libc::c_int
9045                                                                | (1 as libc::c_int) << 1 as libc::c_int
9046                                                                | (1 as libc::c_int) << 4 as libc::c_int;
9047                                                            if replicate != 0 {
9048                                                                if flags & (1 as libc::c_int) << 1 as libc::c_int == 0 {
9049                                                                    call_flags |= (1 as libc::c_int) << 2 as libc::c_int;
9050                                                                }
9051                                                                if flags & (1 as libc::c_int) << 2 as libc::c_int == 0 {
9052                                                                    call_flags |= (1 as libc::c_int) << 3 as libc::c_int;
9053                                                                }
9054                                                            }
9055                                                            call(c, call_flags);
9056                                                            server.replication_allowed = prev_replication_allowed;
9057                                                            if (*c).flags
9058                                                                & ((1 as libc::c_int) << 4 as libc::c_int) as libc::c_ulong
9059                                                                == 0 as libc::c_int as libc::c_ulong
9060                                                            {} else {
9061                                                                _serverAssert(
9062                                                                    b"(c->flags & CLIENT_BLOCKED) == 0\0" as *const u8
9063                                                                        as *const libc::c_char,
9064                                                                    b"module.c\0" as *const u8 as *const libc::c_char,
9065                                                                    6050 as libc::c_int,
9066                                                                );
9067                                                                unreachable!();
9068                                                            };
9069                                                            proto = sdsnewlen(
9070                                                                (*c).buf as *const libc::c_void,
9071                                                                (*c).bufpos as size_t,
9072                                                            );
9073                                                            (*c).bufpos = 0 as libc::c_int;
9074                                                            while (*(*c).reply).len != 0 {
9075                                                                let mut o: *mut clientReplyBlock = (*(*(*c).reply).head)
9076                                                                    .value as *mut clientReplyBlock;
9077                                                                proto = sdscatlen(
9078                                                                    proto,
9079                                                                    ((*o).buf).as_mut_ptr() as *const libc::c_void,
9080                                                                    (*o).used,
9081                                                                );
9082                                                                listDelNode((*c).reply, (*(*c).reply).head);
9083                                                            }
9084                                                            reply = callReplyCreate(
9085                                                                proto,
9086                                                                (*c).deferred_reply_errors,
9087                                                                ctx as *mut libc::c_void,
9088                                                            );
9089                                                            (*c).deferred_reply_errors = 0 as *mut list;
9090                                                        }
9091                                                    }
9092                                                }
9093                                            }
9094                                        }
9095                                    }
9096                                }
9097                            }
9098                        }
9099                    }
9100                }
9101            }
9102        }
9103    }
9104    if !reply.is_null() {
9105        autoMemoryAdd(ctx, 2 as libc::c_int, reply as *mut libc::c_void);
9106    }
9107    if !((*ctx).module).is_null() {
9108        (*(*ctx).module).in_call -= 1;
9109    }
9110    moduleReleaseTempClient(c);
9111    return reply;
9112}
9113#[no_mangle]
9114pub unsafe extern "C" fn RM_CallReplyProto(
9115    mut reply: *mut RedisModuleCallReply,
9116    mut len: *mut size_t,
9117) -> *const libc::c_char {
9118    return callReplyGetProto(reply, len);
9119}
9120#[no_mangle]
9121pub static mut ModuleTypeNameCharSet: *const libc::c_char = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\0"
9122    as *const u8 as *const libc::c_char;
9123#[no_mangle]
9124pub unsafe extern "C" fn moduleTypeEncodeId(
9125    mut name: *const libc::c_char,
9126    mut encver: libc::c_int,
9127) -> uint64_t {
9128    let mut cset: *const libc::c_char = ModuleTypeNameCharSet;
9129    if strlen(name) != 9 as libc::c_int as libc::c_ulong {
9130        return 0 as libc::c_int as uint64_t;
9131    }
9132    if encver < 0 as libc::c_int || encver > 1023 as libc::c_int {
9133        return 0 as libc::c_int as uint64_t;
9134    }
9135    let mut id: uint64_t = 0 as libc::c_int as uint64_t;
9136    let mut j: libc::c_int = 0 as libc::c_int;
9137    while j < 9 as libc::c_int {
9138        let mut p: *mut libc::c_char = strchr(
9139            cset,
9140            *name.offset(j as isize) as libc::c_int,
9141        );
9142        if p.is_null() {
9143            return 0 as libc::c_int as uint64_t;
9144        }
9145        let mut pos: libc::c_ulong = p.offset_from(cset) as libc::c_long
9146            as libc::c_ulong;
9147        id = id << 6 as libc::c_int | pos;
9148        j += 1;
9149    }
9150    id = id << 10 as libc::c_int | encver as libc::c_ulong;
9151    return id;
9152}
9153#[no_mangle]
9154pub unsafe extern "C" fn moduleTypeLookupModuleByName(
9155    mut name: *const libc::c_char,
9156) -> *mut moduleType {
9157    let mut di: *mut dictIterator = dictGetIterator(modules);
9158    let mut de: *mut dictEntry = 0 as *mut dictEntry;
9159    loop {
9160        de = dictNext(di);
9161        if de.is_null() {
9162            break;
9163        }
9164        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
9165        let mut li: listIter = listIter {
9166            next: 0 as *mut listNode,
9167            direction: 0,
9168        };
9169        let mut ln: *mut listNode = 0 as *mut listNode;
9170        listRewind((*module).types, &mut li);
9171        loop {
9172            ln = listNext(&mut li);
9173            if ln.is_null() {
9174                break;
9175            }
9176            let mut mt: *mut moduleType = (*ln).value as *mut moduleType;
9177            if memcmp(
9178                name as *const libc::c_void,
9179                ((*mt).name).as_mut_ptr() as *const libc::c_void,
9180                core::mem::size_of::<[libc::c_char; 10]>() as libc::c_ulong,
9181            ) == 0 as libc::c_int
9182            {
9183                dictReleaseIterator(di);
9184                return mt;
9185            }
9186        }
9187    }
9188    dictReleaseIterator(di);
9189    return 0 as *mut moduleType;
9190}
9191#[no_mangle]
9192pub unsafe extern "C" fn moduleTypeLookupModuleByID(
9193    mut id: uint64_t,
9194) -> *mut moduleType {
9195    static mut cache: [C2RustUnnamed_29; 3] = [C2RustUnnamed_29 {
9196        id: 0,
9197        mt: 0 as *const moduleType as *mut moduleType,
9198    }; 3];
9199    let mut j: libc::c_int = 0;
9200    j = 0 as libc::c_int;
9201    while j < 3 as libc::c_int && !(cache[j as usize].mt).is_null() {
9202        if cache[j as usize].id == id {
9203            return cache[j as usize].mt;
9204        }
9205        j += 1;
9206    }
9207    let mut mt: *mut moduleType = 0 as *mut moduleType;
9208    let mut di: *mut dictIterator = dictGetIterator(modules);
9209    let mut de: *mut dictEntry = 0 as *mut dictEntry;
9210    loop {
9211        de = dictNext(di);
9212        if !(!de.is_null() && mt.is_null()) {
9213            break;
9214        }
9215        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
9216        let mut li: listIter = listIter {
9217            next: 0 as *mut listNode,
9218            direction: 0,
9219        };
9220        let mut ln: *mut listNode = 0 as *mut listNode;
9221        listRewind((*module).types, &mut li);
9222        loop {
9223            ln = listNext(&mut li);
9224            if ln.is_null() {
9225                break;
9226            }
9227            let mut this_mt: *mut moduleType = (*ln).value as *mut moduleType;
9228            if !((*this_mt).id >> 10 as libc::c_int == id >> 10 as libc::c_int) {
9229                continue;
9230            }
9231            mt = this_mt;
9232            break;
9233        }
9234    }
9235    dictReleaseIterator(di);
9236    if !mt.is_null() && j < 3 as libc::c_int {
9237        cache[j as usize].id = id;
9238        cache[j as usize].mt = mt;
9239    }
9240    return mt;
9241}
9242#[no_mangle]
9243pub unsafe extern "C" fn moduleTypeNameByID(
9244    mut name: *mut libc::c_char,
9245    mut moduleid: uint64_t,
9246) {
9247    let mut cset: *const libc::c_char = ModuleTypeNameCharSet;
9248    *name.offset(9 as libc::c_int as isize) = '\0' as i32 as libc::c_char;
9249    let mut p: *mut libc::c_char = name.offset(8 as libc::c_int as isize);
9250    moduleid >>= 10 as libc::c_int;
9251    let mut j: libc::c_int = 0 as libc::c_int;
9252    while j < 9 as libc::c_int {
9253        let fresh30 = p;
9254        p = p.offset(-1);
9255        *fresh30 = *cset
9256            .offset((moduleid & 63 as libc::c_int as libc::c_ulong) as isize);
9257        moduleid >>= 6 as libc::c_int;
9258        j += 1;
9259    }
9260}
9261#[no_mangle]
9262pub unsafe extern "C" fn moduleTypeModuleName(
9263    mut mt: *mut moduleType,
9264) -> *const libc::c_char {
9265    if mt.is_null() || ((*mt).module).is_null() {
9266        return 0 as *const libc::c_char;
9267    }
9268    return (*(*mt).module).name;
9269}
9270#[no_mangle]
9271pub unsafe extern "C" fn moduleNameFromCommand(
9272    mut cmd: *mut redisCommand,
9273) -> *const libc::c_char {
9274    if (*cmd).proc_0
9275        == Some(RedisModuleCommandDispatcher as unsafe extern "C" fn(*mut client) -> ())
9276    {} else {
9277        _serverAssert(
9278            b"cmd->proc == RedisModuleCommandDispatcher\0" as *const u8
9279                as *const libc::c_char,
9280            b"module.c\0" as *const u8 as *const libc::c_char,
9281            6229 as libc::c_int,
9282        );
9283        unreachable!();
9284    };
9285    let mut cp: *mut RedisModuleCommand = (*cmd).module_cmd;
9286    return (*(*cp).module).name;
9287}
9288#[no_mangle]
9289pub unsafe extern "C" fn moduleTypeDupOrReply(
9290    mut c: *mut client,
9291    mut fromkey: *mut robj,
9292    mut tokey: *mut robj,
9293    mut todb: libc::c_int,
9294    mut value: *mut robj,
9295) -> *mut robj {
9296    let mut mv: *mut moduleValue = (*value).ptr as *mut moduleValue;
9297    let mut mt: *mut moduleType = (*mv).type_0;
9298    if ((*mt).copy).is_none() && ((*mt).copy2).is_none() {
9299        addReplyError(
9300            c,
9301            b"not supported for this module key\0" as *const u8 as *const libc::c_char,
9302        );
9303        return 0 as *mut robj;
9304    }
9305    let mut newval: *mut libc::c_void = 0 as *mut libc::c_void;
9306    if ((*mt).copy2).is_some() {
9307        let mut ctx: RedisModuleKeyOptCtx = {
9308            let mut init = RedisModuleKeyOptCtx {
9309                from_key: fromkey,
9310                to_key: tokey,
9311                from_dbid: (*(*c).db).id,
9312                to_dbid: todb,
9313            };
9314            init
9315        };
9316        newval = ((*mt).copy2)
9317            .expect("non-null function pointer")(&mut ctx, (*mv).value);
9318    } else {
9319        newval = ((*mt).copy)
9320            .expect("non-null function pointer")(fromkey, tokey, (*mv).value);
9321    }
9322    if newval.is_null() {
9323        addReplyError(
9324            c,
9325            b"module key failed to copy\0" as *const u8 as *const libc::c_char,
9326        );
9327        return 0 as *mut robj;
9328    }
9329    return createModuleObject(mt, newval);
9330}
9331#[no_mangle]
9332pub unsafe extern "C" fn RM_CreateDataType(
9333    mut ctx: *mut RedisModuleCtx,
9334    mut name: *const libc::c_char,
9335    mut encver: libc::c_int,
9336    mut typemethods_ptr: *mut libc::c_void,
9337) -> *mut moduleType {
9338    let mut id: uint64_t = moduleTypeEncodeId(name, encver);
9339    if id == 0 as libc::c_int as libc::c_ulong {
9340        return 0 as *mut moduleType;
9341    }
9342    if !(moduleTypeLookupModuleByName(name)).is_null() {
9343        return 0 as *mut moduleType;
9344    }
9345    let mut typemethods_version: libc::c_long = *(typemethods_ptr as *mut libc::c_long)
9346        .offset(0 as libc::c_int as isize);
9347    if typemethods_version == 0 as libc::c_int as libc::c_long {
9348        return 0 as *mut moduleType;
9349    }
9350    let mut tms: *mut typemethods = typemethods_ptr as *mut typemethods;
9351    let mut mt: *mut moduleType = zcalloc(
9352        core::mem::size_of::<moduleType>() as libc::c_ulong,
9353    ) as *mut moduleType;
9354    (*mt).id = id;
9355    (*mt).module = (*ctx).module;
9356    (*mt).rdb_load = (*tms).rdb_load;
9357    (*mt).rdb_save = (*tms).rdb_save;
9358    (*mt).aof_rewrite = (*tms).aof_rewrite;
9359    (*mt).mem_usage = (*tms).mem_usage;
9360    (*mt).digest = (*tms).digest;
9361    (*mt).free = (*tms).free;
9362    if (*tms).version >= 2 as libc::c_int as libc::c_ulong {
9363        (*mt).aux_load = (*tms).v2.aux_load;
9364        (*mt).aux_save = (*tms).v2.aux_save;
9365        (*mt).aux_save_triggers = (*tms).v2.aux_save_triggers;
9366    }
9367    if (*tms).version >= 3 as libc::c_int as libc::c_ulong {
9368        (*mt).free_effort = (*tms).v3.free_effort;
9369        (*mt).unlink = (*tms).v3.unlink;
9370        (*mt).copy = (*tms).v3.copy;
9371        (*mt).defrag = (*tms).v3.defrag;
9372    }
9373    if (*tms).version >= 4 as libc::c_int as libc::c_ulong {
9374        (*mt).mem_usage2 = (*tms).v4.mem_usage2;
9375        (*mt).unlink2 = (*tms).v4.unlink2;
9376        (*mt).free_effort2 = (*tms).v4.free_effort2;
9377        (*mt).copy2 = (*tms).v4.copy2;
9378    }
9379    memcpy(
9380        ((*mt).name).as_mut_ptr() as *mut libc::c_void,
9381        name as *const libc::c_void,
9382        core::mem::size_of::<[libc::c_char; 10]>() as libc::c_ulong,
9383    );
9384    listAddNodeTail((*(*ctx).module).types, mt as *mut libc::c_void);
9385    return mt;
9386}
9387#[no_mangle]
9388pub unsafe extern "C" fn RM_ModuleTypeSetValue(
9389    mut key: *mut RedisModuleKey,
9390    mut mt: *mut moduleType,
9391    mut value: *mut libc::c_void,
9392) -> libc::c_int {
9393    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
9394        || !((*key).iter).is_null()
9395    {
9396        return 1 as libc::c_int;
9397    }
9398    RM_DeleteKey(key);
9399    let mut o: *mut robj = createModuleObject(mt, value);
9400    setKey((*(*key).ctx).client, (*key).db, (*key).key, o, 2 as libc::c_int);
9401    decrRefCount(o);
9402    (*key).value = o;
9403    return 0 as libc::c_int;
9404}
9405#[no_mangle]
9406pub unsafe extern "C" fn RM_ModuleTypeGetType(
9407    mut key: *mut RedisModuleKey,
9408) -> *mut moduleType {
9409    if key.is_null() || ((*key).value).is_null() || RM_KeyType(key) != 6 as libc::c_int {
9410        return 0 as *mut moduleType;
9411    }
9412    let mut mv: *mut moduleValue = (*(*key).value).ptr as *mut moduleValue;
9413    return (*mv).type_0;
9414}
9415#[no_mangle]
9416pub unsafe extern "C" fn RM_ModuleTypeGetValue(
9417    mut key: *mut RedisModuleKey,
9418) -> *mut libc::c_void {
9419    if key.is_null() || ((*key).value).is_null() || RM_KeyType(key) != 6 as libc::c_int {
9420        return 0 as *mut libc::c_void;
9421    }
9422    let mut mv: *mut moduleValue = (*(*key).value).ptr as *mut moduleValue;
9423    return (*mv).value;
9424}
9425#[no_mangle]
9426pub unsafe extern "C" fn moduleRDBLoadError(mut io: *mut RedisModuleIO) {
9427    if (*(*(*io).type_0).module).options & (1 as libc::c_int) << 0 as libc::c_int != 0 {
9428        (*io).error = 1 as libc::c_int;
9429        return;
9430    }
9431    _serverPanic(
9432        b"module.c\0" as *const u8 as *const libc::c_char,
9433        6504 as libc::c_int,
9434        b"Error loading data from RDB (short read or EOF). Read performed by module '%s' about type '%s' after reading '%llu' bytes of a value for key named: '%s'.\0"
9435            as *const u8 as *const libc::c_char,
9436        (*(*(*io).type_0).module).name,
9437        ((*(*io).type_0).name).as_mut_ptr(),
9438        (*io).bytes as libc::c_ulonglong,
9439        (if !((*io).key).is_null() {
9440            (*(*io).key).ptr as *mut libc::c_char as *const libc::c_char
9441        } else {
9442            b"(null)\0" as *const u8 as *const libc::c_char
9443        }),
9444    );
9445    unreachable!();
9446}
9447#[no_mangle]
9448pub unsafe extern "C" fn moduleAllDatatypesHandleErrors() -> libc::c_int {
9449    let mut di: *mut dictIterator = dictGetIterator(modules);
9450    let mut de: *mut dictEntry = 0 as *mut dictEntry;
9451    loop {
9452        de = dictNext(di);
9453        if de.is_null() {
9454            break;
9455        }
9456        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
9457        if (*(*module).types).len != 0
9458            && (*module).options & (1 as libc::c_int) << 0 as libc::c_int == 0
9459        {
9460            dictReleaseIterator(di);
9461            return 0 as libc::c_int;
9462        }
9463    }
9464    dictReleaseIterator(di);
9465    return 1 as libc::c_int;
9466}
9467#[no_mangle]
9468pub unsafe extern "C" fn moduleAllModulesHandleReplAsyncLoad() -> libc::c_int {
9469    let mut di: *mut dictIterator = dictGetIterator(modules);
9470    let mut de: *mut dictEntry = 0 as *mut dictEntry;
9471    loop {
9472        de = dictNext(di);
9473        if de.is_null() {
9474            break;
9475        }
9476        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
9477        if (*module).options & (1 as libc::c_int) << 2 as libc::c_int == 0 {
9478            dictReleaseIterator(di);
9479            return 0 as libc::c_int;
9480        }
9481    }
9482    dictReleaseIterator(di);
9483    return 1 as libc::c_int;
9484}
9485#[no_mangle]
9486pub unsafe extern "C" fn RM_IsIOError(mut io: *mut RedisModuleIO) -> libc::c_int {
9487    return (*io).error;
9488}
9489#[no_mangle]
9490pub unsafe extern "C" fn RM_SaveUnsigned(
9491    mut io: *mut RedisModuleIO,
9492    mut value: uint64_t,
9493) {
9494    if (*io).error != 0 {
9495        return;
9496    }
9497    let mut retval: libc::c_int = rdbSaveLen((*io).rio, 2 as libc::c_int as uint64_t);
9498    if !(retval == -(1 as libc::c_int)) {
9499        (*io)
9500            .bytes = ((*io).bytes as libc::c_ulong).wrapping_add(retval as libc::c_ulong)
9501            as size_t as size_t;
9502        retval = rdbSaveLen((*io).rio, value);
9503        if !(retval == -(1 as libc::c_int)) {
9504            (*io)
9505                .bytes = ((*io).bytes as libc::c_ulong)
9506                .wrapping_add(retval as libc::c_ulong) as size_t as size_t;
9507            return;
9508        }
9509    }
9510    (*io).error = 1 as libc::c_int;
9511}
9512#[no_mangle]
9513pub unsafe extern "C" fn RM_LoadUnsigned(mut io: *mut RedisModuleIO) -> uint64_t {
9514    let mut value: uint64_t = 0;
9515    let mut retval: libc::c_int = 0;
9516    let mut current_block: u64;
9517    if (*io).error != 0 {
9518        return 0 as libc::c_int as uint64_t;
9519    }
9520    if (*io).ver == 2 as libc::c_int {
9521        let mut opcode: uint64_t = rdbLoadLen((*io).rio, 0 as *mut libc::c_int);
9522        if opcode != 2 as libc::c_int as libc::c_ulong {
9523            current_block = 15120159549690775694;
9524        } else {
9525            current_block = 17778012151635330486;
9526        }
9527    } else {
9528        current_block = 17778012151635330486;
9529    }
9530    match current_block {
9531        17778012151635330486 => {
9532            value = 0;
9533            retval = rdbLoadLenByRef((*io).rio, 0 as *mut libc::c_int, &mut value);
9534            if !(retval == -(1 as libc::c_int)) {
9535                return value;
9536            }
9537        }
9538        _ => {}
9539    }
9540    moduleRDBLoadError(io);
9541    return 0 as libc::c_int as uint64_t;
9542}
9543#[no_mangle]
9544pub unsafe extern "C" fn RM_SaveSigned(mut io: *mut RedisModuleIO, mut value: int64_t) {
9545    let mut conv: C2RustUnnamed_25 = C2RustUnnamed_25 { u: 0 };
9546    conv.i = value;
9547    RM_SaveUnsigned(io, conv.u);
9548}
9549#[no_mangle]
9550pub unsafe extern "C" fn RM_LoadSigned(mut io: *mut RedisModuleIO) -> int64_t {
9551    let mut conv: C2RustUnnamed_24 = C2RustUnnamed_24 { u: 0 };
9552    conv.u = RM_LoadUnsigned(io);
9553    return conv.i;
9554}
9555#[no_mangle]
9556pub unsafe extern "C" fn RM_SaveString(mut io: *mut RedisModuleIO, mut s: *mut robj) {
9557    if (*io).error != 0 {
9558        return;
9559    }
9560    let mut retval: ssize_t = rdbSaveLen((*io).rio, 5 as libc::c_int as uint64_t)
9561        as ssize_t;
9562    if !(retval == -(1 as libc::c_int) as libc::c_long) {
9563        (*io)
9564            .bytes = ((*io).bytes as libc::c_ulong).wrapping_add(retval as libc::c_ulong)
9565            as size_t as size_t;
9566        retval = rdbSaveStringObject((*io).rio, s);
9567        if !(retval == -(1 as libc::c_int) as libc::c_long) {
9568            (*io)
9569                .bytes = ((*io).bytes as libc::c_ulong)
9570                .wrapping_add(retval as libc::c_ulong) as size_t as size_t;
9571            return;
9572        }
9573    }
9574    (*io).error = 1 as libc::c_int;
9575}
9576#[no_mangle]
9577pub unsafe extern "C" fn RM_SaveStringBuffer(
9578    mut io: *mut RedisModuleIO,
9579    mut str: *const libc::c_char,
9580    mut len: size_t,
9581) {
9582    if (*io).error != 0 {
9583        return;
9584    }
9585    let mut retval: ssize_t = rdbSaveLen((*io).rio, 5 as libc::c_int as uint64_t)
9586        as ssize_t;
9587    if !(retval == -(1 as libc::c_int) as libc::c_long) {
9588        (*io)
9589            .bytes = ((*io).bytes as libc::c_ulong).wrapping_add(retval as libc::c_ulong)
9590            as size_t as size_t;
9591        retval = rdbSaveRawString((*io).rio, str as *mut libc::c_uchar, len);
9592        if !(retval == -(1 as libc::c_int) as libc::c_long) {
9593            (*io)
9594                .bytes = ((*io).bytes as libc::c_ulong)
9595                .wrapping_add(retval as libc::c_ulong) as size_t as size_t;
9596            return;
9597        }
9598    }
9599    (*io).error = 1 as libc::c_int;
9600}
9601#[no_mangle]
9602pub unsafe extern "C" fn moduleLoadString(
9603    mut io: *mut RedisModuleIO,
9604    mut plain: libc::c_int,
9605    mut lenptr: *mut size_t,
9606) -> *mut libc::c_void {
9607    let mut s: *mut libc::c_void = 0 as *mut libc::c_void;
9608    let mut current_block: u64;
9609    if (*io).error != 0 {
9610        return 0 as *mut libc::c_void;
9611    }
9612    if (*io).ver == 2 as libc::c_int {
9613        let mut opcode: uint64_t = rdbLoadLen((*io).rio, 0 as *mut libc::c_int);
9614        if opcode != 5 as libc::c_int as libc::c_ulong {
9615            current_block = 11094523046203751053;
9616        } else {
9617            current_block = 17778012151635330486;
9618        }
9619    } else {
9620        current_block = 17778012151635330486;
9621    }
9622    match current_block {
9623        17778012151635330486 => {
9624            s = rdbGenericLoadStringObject(
9625                (*io).rio,
9626                if plain != 0 {
9627                    (1 as libc::c_int) << 1 as libc::c_int
9628                } else {
9629                    0 as libc::c_int
9630                },
9631                lenptr,
9632            );
9633            if !s.is_null() {
9634                return s;
9635            }
9636        }
9637        _ => {}
9638    }
9639    moduleRDBLoadError(io);
9640    return 0 as *mut libc::c_void;
9641}
9642#[no_mangle]
9643pub unsafe extern "C" fn RM_LoadString(mut io: *mut RedisModuleIO) -> *mut robj {
9644    return moduleLoadString(io, 0 as libc::c_int, 0 as *mut size_t) as *mut robj;
9645}
9646#[no_mangle]
9647pub unsafe extern "C" fn RM_LoadStringBuffer(
9648    mut io: *mut RedisModuleIO,
9649    mut lenptr: *mut size_t,
9650) -> *mut libc::c_char {
9651    return moduleLoadString(io, 1 as libc::c_int, lenptr) as *mut libc::c_char;
9652}
9653#[no_mangle]
9654pub unsafe extern "C" fn RM_SaveDouble(
9655    mut io: *mut RedisModuleIO,
9656    mut value: libc::c_double,
9657) {
9658    if (*io).error != 0 {
9659        return;
9660    }
9661    let mut retval: libc::c_int = rdbSaveLen((*io).rio, 4 as libc::c_int as uint64_t);
9662    if !(retval == -(1 as libc::c_int)) {
9663        (*io)
9664            .bytes = ((*io).bytes as libc::c_ulong).wrapping_add(retval as libc::c_ulong)
9665            as size_t as size_t;
9666        retval = rdbSaveBinaryDoubleValue((*io).rio, value);
9667        if !(retval == -(1 as libc::c_int)) {
9668            (*io)
9669                .bytes = ((*io).bytes as libc::c_ulong)
9670                .wrapping_add(retval as libc::c_ulong) as size_t as size_t;
9671            return;
9672        }
9673    }
9674    (*io).error = 1 as libc::c_int;
9675}
9676#[no_mangle]
9677pub unsafe extern "C" fn RM_LoadDouble(mut io: *mut RedisModuleIO) -> libc::c_double {
9678    let mut value: libc::c_double = 0.;
9679    let mut retval: libc::c_int = 0;
9680    let mut current_block: u64;
9681    if (*io).error != 0 {
9682        return 0 as libc::c_int as libc::c_double;
9683    }
9684    if (*io).ver == 2 as libc::c_int {
9685        let mut opcode: uint64_t = rdbLoadLen((*io).rio, 0 as *mut libc::c_int);
9686        if opcode != 4 as libc::c_int as libc::c_ulong {
9687            current_block = 16848152805145497277;
9688        } else {
9689            current_block = 17778012151635330486;
9690        }
9691    } else {
9692        current_block = 17778012151635330486;
9693    }
9694    match current_block {
9695        17778012151635330486 => {
9696            value = 0.;
9697            retval = rdbLoadBinaryDoubleValue((*io).rio, &mut value);
9698            if !(retval == -(1 as libc::c_int)) {
9699                return value;
9700            }
9701        }
9702        _ => {}
9703    }
9704    moduleRDBLoadError(io);
9705    return 0 as libc::c_int as libc::c_double;
9706}
9707#[no_mangle]
9708pub unsafe extern "C" fn RM_SaveFloat(
9709    mut io: *mut RedisModuleIO,
9710    mut value: libc::c_float,
9711) {
9712    if (*io).error != 0 {
9713        return;
9714    }
9715    let mut retval: libc::c_int = rdbSaveLen((*io).rio, 3 as libc::c_int as uint64_t);
9716    if !(retval == -(1 as libc::c_int)) {
9717        (*io)
9718            .bytes = ((*io).bytes as libc::c_ulong).wrapping_add(retval as libc::c_ulong)
9719            as size_t as size_t;
9720        retval = rdbSaveBinaryFloatValue((*io).rio, value);
9721        if !(retval == -(1 as libc::c_int)) {
9722            (*io)
9723                .bytes = ((*io).bytes as libc::c_ulong)
9724                .wrapping_add(retval as libc::c_ulong) as size_t as size_t;
9725            return;
9726        }
9727    }
9728    (*io).error = 1 as libc::c_int;
9729}
9730#[no_mangle]
9731pub unsafe extern "C" fn RM_LoadFloat(mut io: *mut RedisModuleIO) -> libc::c_float {
9732    let mut value: libc::c_float = 0.;
9733    let mut retval: libc::c_int = 0;
9734    let mut current_block: u64;
9735    if (*io).error != 0 {
9736        return 0 as libc::c_int as libc::c_float;
9737    }
9738    if (*io).ver == 2 as libc::c_int {
9739        let mut opcode: uint64_t = rdbLoadLen((*io).rio, 0 as *mut libc::c_int);
9740        if opcode != 3 as libc::c_int as libc::c_ulong {
9741            current_block = 2548736969172793501;
9742        } else {
9743            current_block = 17778012151635330486;
9744        }
9745    } else {
9746        current_block = 17778012151635330486;
9747    }
9748    match current_block {
9749        17778012151635330486 => {
9750            value = 0.;
9751            retval = rdbLoadBinaryFloatValue((*io).rio, &mut value);
9752            if !(retval == -(1 as libc::c_int)) {
9753                return value;
9754            }
9755        }
9756        _ => {}
9757    }
9758    moduleRDBLoadError(io);
9759    return 0 as libc::c_int as libc::c_float;
9760}
9761#[no_mangle]
9762pub unsafe extern "C" fn RM_SaveLongDouble(
9763    mut io: *mut RedisModuleIO,
9764    mut value: f64,
9765) {
9766    if (*io).error != 0 {
9767        return;
9768    }
9769    let mut buf: [libc::c_char; 5120] = [0; 5120];
9770    let mut len: size_t = ld2string(
9771        buf.as_mut_ptr(),
9772        core::mem::size_of::<[libc::c_char; 5120]>() as libc::c_ulong,
9773        value,
9774        LD_STR_HEX,
9775    ) as size_t;
9776    RM_SaveStringBuffer(io, buf.as_mut_ptr(), len);
9777}
9778#[no_mangle]
9779pub unsafe extern "C" fn RM_LoadLongDouble(mut io: *mut RedisModuleIO) -> f64 {
9780    if (*io).error != 0 {
9781        return (0 as libc::c_int) as f64;
9782    }
9783    let mut value: f64 = 0 as f64;
9784    let mut len: size_t = 0;
9785    let mut str: *mut libc::c_char = RM_LoadStringBuffer(io, &mut len);
9786    if str.is_null() {
9787        return (0 as libc::c_int) as f64;
9788    }
9789    string2ld(str, len, &mut value);
9790    RM_Free(str as *mut libc::c_void);
9791    return value;
9792}
9793#[no_mangle]
9794pub unsafe extern "C" fn rdbSaveModulesAux(
9795    mut rdb: *mut rio,
9796    mut when: libc::c_int,
9797) -> ssize_t {
9798    let mut total_written: size_t = 0 as libc::c_int as size_t;
9799    let mut di: *mut dictIterator = dictGetIterator(modules);
9800    let mut de: *mut dictEntry = 0 as *mut dictEntry;
9801    loop {
9802        de = dictNext(di);
9803        if de.is_null() {
9804            break;
9805        }
9806        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
9807        let mut li: listIter = listIter {
9808            next: 0 as *mut listNode,
9809            direction: 0,
9810        };
9811        let mut ln: *mut listNode = 0 as *mut listNode;
9812        listRewind((*module).types, &mut li);
9813        loop {
9814            ln = listNext(&mut li);
9815            if ln.is_null() {
9816                break;
9817            }
9818            let mut mt: *mut moduleType = (*ln).value as *mut moduleType;
9819            if ((*mt).aux_save).is_none() || (*mt).aux_save_triggers & when == 0 {
9820                continue;
9821            }
9822            let mut ret: ssize_t = rdbSaveSingleModuleAux(rdb, when, mt);
9823            if ret == -(1 as libc::c_int) as libc::c_long {
9824                dictReleaseIterator(di);
9825                return -(1 as libc::c_int) as ssize_t;
9826            }
9827            total_written = (total_written as libc::c_ulong)
9828                .wrapping_add(ret as libc::c_ulong) as size_t as size_t;
9829        }
9830    }
9831    dictReleaseIterator(di);
9832    return total_written as ssize_t;
9833}
9834#[no_mangle]
9835pub unsafe extern "C" fn RM_DigestAddStringBuffer(
9836    mut md: *mut RedisModuleDigest,
9837    mut ele: *const libc::c_char,
9838    mut len: size_t,
9839) {
9840    mixDigest(((*md).o).as_mut_ptr(), ele as *const libc::c_void, len);
9841}
9842#[no_mangle]
9843pub unsafe extern "C" fn RM_DigestAddLongLong(
9844    mut md: *mut RedisModuleDigest,
9845    mut ll: libc::c_longlong,
9846) {
9847    let mut buf: [libc::c_char; 21] = [0; 21];
9848    let mut len: size_t = ll2string(
9849        buf.as_mut_ptr(),
9850        core::mem::size_of::<[libc::c_char; 21]>() as libc::c_ulong,
9851        ll,
9852    ) as size_t;
9853    mixDigest(((*md).o).as_mut_ptr(), buf.as_mut_ptr() as *const libc::c_void, len);
9854}
9855#[no_mangle]
9856pub unsafe extern "C" fn RM_DigestEndSequence(mut md: *mut RedisModuleDigest) {
9857    xorDigest(
9858        ((*md).x).as_mut_ptr(),
9859        ((*md).o).as_mut_ptr() as *const libc::c_void,
9860        core::mem::size_of::<[libc::c_uchar; 20]>() as libc::c_ulong,
9861    );
9862    memset(
9863        ((*md).o).as_mut_ptr() as *mut libc::c_void,
9864        0 as libc::c_int,
9865        core::mem::size_of::<[libc::c_uchar; 20]>() as libc::c_ulong,
9866    );
9867}
9868#[no_mangle]
9869pub unsafe extern "C" fn RM_LoadDataTypeFromStringEncver(
9870    mut str: *const robj,
9871    mut mt: *const moduleType,
9872    mut encver: libc::c_int,
9873) -> *mut libc::c_void {
9874    let mut payload: rio = rio {
9875        read: None,
9876        write: None,
9877        tell: None,
9878        flush: None,
9879        update_cksum: None,
9880        cksum: 0,
9881        flags: 0,
9882        processed_bytes: 0,
9883        max_processing_chunk: 0,
9884        io: C2RustUnnamed {
9885            buffer: C2RustUnnamed_3 {
9886                ptr: 0 as *mut libc::c_char,
9887                pos: 0,
9888            },
9889        },
9890    };
9891    let mut io: RedisModuleIO = RedisModuleIO {
9892        bytes: 0,
9893        rio: 0 as *mut rio,
9894        type_0: 0 as *mut moduleType,
9895        error: 0,
9896        ver: 0,
9897        ctx: 0 as *mut RedisModuleCtx,
9898        key: 0 as *mut redisObject,
9899        dbid: 0,
9900    };
9901    let mut ret: *mut libc::c_void = 0 as *mut libc::c_void;
9902    rioInitWithBuffer(&mut payload, (*str).ptr as sds);
9903    io.rio = &mut payload;
9904    io.type_0 = mt as *mut moduleType;
9905    io.bytes = 0 as libc::c_int as size_t;
9906    io.error = 0 as libc::c_int;
9907    io.ver = 0 as libc::c_int;
9908    io.key = 0 as *mut redisObject;
9909    io.dbid = -(1 as libc::c_int);
9910    io.ctx = 0 as *mut RedisModuleCtx;
9911    io.ver = 2 as libc::c_int;
9912    ret = ((*mt).rdb_load).expect("non-null function pointer")(&mut io, encver);
9913    if !(io.ctx).is_null() {
9914        moduleFreeContext(io.ctx);
9915        zfree(io.ctx as *mut libc::c_void);
9916    }
9917    return ret;
9918}
9919#[no_mangle]
9920pub unsafe extern "C" fn RM_LoadDataTypeFromString(
9921    mut str: *const robj,
9922    mut mt: *const moduleType,
9923) -> *mut libc::c_void {
9924    return RM_LoadDataTypeFromStringEncver(str, mt, 0 as libc::c_int);
9925}
9926#[no_mangle]
9927pub unsafe extern "C" fn RM_SaveDataTypeToString(
9928    mut ctx: *mut RedisModuleCtx,
9929    mut data: *mut libc::c_void,
9930    mut mt: *const moduleType,
9931) -> *mut robj {
9932    let mut payload: rio = rio {
9933        read: None,
9934        write: None,
9935        tell: None,
9936        flush: None,
9937        update_cksum: None,
9938        cksum: 0,
9939        flags: 0,
9940        processed_bytes: 0,
9941        max_processing_chunk: 0,
9942        io: C2RustUnnamed {
9943            buffer: C2RustUnnamed_3 {
9944                ptr: 0 as *mut libc::c_char,
9945                pos: 0,
9946            },
9947        },
9948    };
9949    let mut io: RedisModuleIO = RedisModuleIO {
9950        bytes: 0,
9951        rio: 0 as *mut rio,
9952        type_0: 0 as *mut moduleType,
9953        error: 0,
9954        ver: 0,
9955        ctx: 0 as *mut RedisModuleCtx,
9956        key: 0 as *mut redisObject,
9957        dbid: 0,
9958    };
9959    rioInitWithBuffer(&mut payload, sdsempty());
9960    io.rio = &mut payload;
9961    io.type_0 = mt as *mut moduleType;
9962    io.bytes = 0 as libc::c_int as size_t;
9963    io.error = 0 as libc::c_int;
9964    io.ver = 0 as libc::c_int;
9965    io.key = 0 as *mut redisObject;
9966    io.dbid = -(1 as libc::c_int);
9967    io.ctx = 0 as *mut RedisModuleCtx;
9968    ((*mt).rdb_save).expect("non-null function pointer")(&mut io, data);
9969    if !(io.ctx).is_null() {
9970        moduleFreeContext(io.ctx);
9971        zfree(io.ctx as *mut libc::c_void);
9972    }
9973    if io.error != 0 {
9974        return 0 as *mut robj
9975    } else {
9976        let mut str: *mut robj = createObject(
9977            0 as libc::c_int,
9978            payload.io.buffer.ptr as *mut libc::c_void,
9979        );
9980        if !ctx.is_null() {
9981            autoMemoryAdd(ctx, 1 as libc::c_int, str as *mut libc::c_void);
9982        }
9983        return str;
9984    };
9985}
9986#[no_mangle]
9987pub unsafe extern "C" fn RM_GetKeyNameFromDigest(
9988    mut dig: *mut RedisModuleDigest,
9989) -> *const robj {
9990    return (*dig).key;
9991}
9992#[no_mangle]
9993pub unsafe extern "C" fn RM_GetDbIdFromDigest(
9994    mut dig: *mut RedisModuleDigest,
9995) -> libc::c_int {
9996    return (*dig).dbid;
9997}
9998#[no_mangle]
9999pub unsafe extern "C" fn RM_EmitAOF(
10000    mut io: *mut RedisModuleIO,
10001    mut cmdname: *const libc::c_char,
10002    mut fmt: *const libc::c_char,
10003    mut args: ...
10004) {
10005    if (*io).error != 0 {
10006        return;
10007    }
10008    let mut cmd: *mut redisCommand = 0 as *mut redisCommand;
10009    let mut argv: *mut *mut robj = 0 as *mut *mut robj;
10010    let mut argc: libc::c_int = 0 as libc::c_int;
10011    let mut flags: libc::c_int = 0 as libc::c_int;
10012    let mut j: libc::c_int = 0;
10013    let mut ap: core::ffi::VaListImpl;
10014    cmd = lookupCommandByCString(cmdname as *mut libc::c_char);
10015    if cmd.is_null() {
10016        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
10017            _serverLog(
10018                3 as libc::c_int,
10019                b"Fatal: AOF method for module data type '%s' tried to emit unknown command '%s'\0"
10020                    as *const u8 as *const libc::c_char,
10021                ((*(*io).type_0).name).as_mut_ptr(),
10022                cmdname,
10023            );
10024        }
10025        (*io).error = 1 as libc::c_int;
10026        *__errno_location() = 22 as libc::c_int;
10027        return;
10028    }
10029    ap = args.clone();
10030    argv = moduleCreateArgvFromUserFormat(
10031        cmdname,
10032        fmt,
10033        &mut argc,
10034        0 as *mut libc::c_int,
10035        &mut flags,
10036        ap.as_va_list(),
10037    );
10038    if argv.is_null() {
10039        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
10040            _serverLog(
10041                3 as libc::c_int,
10042                b"Fatal: AOF method for module data type '%s' tried to call RedisModule_EmitAOF() with wrong format specifiers '%s'\0"
10043                    as *const u8 as *const libc::c_char,
10044                ((*(*io).type_0).name).as_mut_ptr(),
10045                fmt,
10046            );
10047        }
10048        (*io).error = 1 as libc::c_int;
10049        *__errno_location() = 22 as libc::c_int;
10050        return;
10051    }
10052    if (*io).error == 0
10053        && rioWriteBulkCount((*io).rio, '*' as i32 as libc::c_char, argc as libc::c_long)
10054            == 0 as libc::c_int as libc::c_ulong
10055    {
10056        (*io).error = 1 as libc::c_int;
10057    }
10058    j = 0 as libc::c_int;
10059    while j < argc {
10060        if (*io).error == 0
10061            && rioWriteBulkObject((*io).rio, *argv.offset(j as isize))
10062                == 0 as libc::c_int
10063        {
10064            (*io).error = 1 as libc::c_int;
10065        }
10066        decrRefCount(*argv.offset(j as isize));
10067        j += 1;
10068    }
10069    zfree(argv as *mut libc::c_void);
10070}
10071#[no_mangle]
10072pub unsafe extern "C" fn RM_GetContextFromIO(
10073    mut io: *mut RedisModuleIO,
10074) -> *mut RedisModuleCtx {
10075    if !((*io).ctx).is_null() {
10076        return (*io).ctx;
10077    }
10078    (*io)
10079        .ctx = zmalloc(core::mem::size_of::<RedisModuleCtx>() as libc::c_ulong)
10080        as *mut RedisModuleCtx;
10081    moduleCreateContext((*io).ctx, (*(*io).type_0).module, 0 as libc::c_int);
10082    return (*io).ctx;
10083}
10084#[no_mangle]
10085pub unsafe extern "C" fn RM_GetKeyNameFromIO(mut io: *mut RedisModuleIO) -> *const robj {
10086    return (*io).key;
10087}
10088#[no_mangle]
10089pub unsafe extern "C" fn RM_GetKeyNameFromModuleKey(
10090    mut key: *mut RedisModuleKey,
10091) -> *const robj {
10092    return if !key.is_null() { (*key).key } else { 0 as *mut robj };
10093}
10094#[no_mangle]
10095pub unsafe extern "C" fn RM_GetDbIdFromModuleKey(
10096    mut key: *mut RedisModuleKey,
10097) -> libc::c_int {
10098    return if !key.is_null() { (*(*key).db).id } else { -(1 as libc::c_int) };
10099}
10100#[no_mangle]
10101pub unsafe extern "C" fn RM_GetDbIdFromIO(mut io: *mut RedisModuleIO) -> libc::c_int {
10102    return (*io).dbid;
10103}
10104#[no_mangle]
10105pub unsafe extern "C" fn moduleLogRaw(
10106    mut module: *mut RedisModule,
10107    mut levelstr: *const libc::c_char,
10108    mut fmt: *const libc::c_char,
10109    mut ap: core::ffi::VaList,
10110) {
10111    let mut msg: [libc::c_char; 1024] = [0; 1024];
10112    let mut name_len: size_t = 0;
10113    let mut level: libc::c_int = 0;
10114    if strcasecmp(levelstr, b"debug\0" as *const u8 as *const libc::c_char) == 0 {
10115        level = 0 as libc::c_int;
10116    } else if strcasecmp(levelstr, b"verbose\0" as *const u8 as *const libc::c_char) == 0
10117    {
10118        level = 1 as libc::c_int;
10119    } else if strcasecmp(levelstr, b"notice\0" as *const u8 as *const libc::c_char) == 0
10120    {
10121        level = 2 as libc::c_int;
10122    } else if strcasecmp(levelstr, b"warning\0" as *const u8 as *const libc::c_char) == 0
10123    {
10124        level = 3 as libc::c_int;
10125    } else {
10126        level = 1 as libc::c_int;
10127    }
10128    if level < server.verbosity {
10129        return;
10130    }
10131    name_len = snprintf(
10132        msg.as_mut_ptr(),
10133        core::mem::size_of::<[libc::c_char; 1024]>() as libc::c_ulong,
10134        b"<%s> \0" as *const u8 as *const libc::c_char,
10135        if !module.is_null() {
10136            (*module).name as *const libc::c_char
10137        } else {
10138            b"module\0" as *const u8 as *const libc::c_char
10139        },
10140    ) as size_t;
10141    vsnprintf(
10142        msg.as_mut_ptr().offset(name_len as isize),
10143        (core::mem::size_of::<[libc::c_char; 1024]>() as libc::c_ulong)
10144            .wrapping_sub(name_len),
10145        fmt,
10146        ap.as_va_list(),
10147    );
10148    serverLogRaw(level, msg.as_mut_ptr());
10149}
10150#[no_mangle]
10151pub unsafe extern "C" fn RM_Log(
10152    mut ctx: *mut RedisModuleCtx,
10153    mut levelstr: *const libc::c_char,
10154    mut fmt: *const libc::c_char,
10155    mut args: ...
10156) {
10157    let mut ap: core::ffi::VaListImpl;
10158    ap = args.clone();
10159    moduleLogRaw(
10160        if !ctx.is_null() { (*ctx).module } else { 0 as *mut RedisModule },
10161        levelstr,
10162        fmt,
10163        ap.as_va_list(),
10164    );
10165}
10166#[no_mangle]
10167pub unsafe extern "C" fn RM_LogIOError(
10168    mut io: *mut RedisModuleIO,
10169    mut levelstr: *const libc::c_char,
10170    mut fmt: *const libc::c_char,
10171    mut args: ...
10172) {
10173    let mut ap: core::ffi::VaListImpl;
10174    ap = args.clone();
10175    moduleLogRaw((*(*io).type_0).module, levelstr, fmt, ap.as_va_list());
10176}
10177#[no_mangle]
10178pub unsafe extern "C" fn RM__Assert(
10179    mut estr: *const libc::c_char,
10180    mut file: *const libc::c_char,
10181    mut line: libc::c_int,
10182) {
10183    _serverAssert(estr, file, line);
10184}
10185#[no_mangle]
10186pub unsafe extern "C" fn RM_LatencyAddSample(
10187    mut event: *const libc::c_char,
10188    mut latency: mstime_t,
10189) {
10190    if latency >= server.latency_monitor_threshold {
10191        latencyAddSample(event, latency);
10192    }
10193}
10194#[no_mangle]
10195pub unsafe extern "C" fn unblockClientFromModule(mut c: *mut client) {
10196    let mut bc: *mut RedisModuleBlockedClient = (*c).bpop.module_blocked_handle
10197        as *mut RedisModuleBlockedClient;
10198    if ((*bc).disconnect_callback).is_some() {
10199        let mut ctx: RedisModuleCtx = RedisModuleCtx {
10200            getapifuncptr: 0 as *mut libc::c_void,
10201            module: 0 as *mut RedisModule,
10202            client: 0 as *mut client,
10203            blocked_client: 0 as *mut RedisModuleBlockedClient,
10204            amqueue: 0 as *mut AutoMemEntry,
10205            amqueue_len: 0,
10206            amqueue_used: 0,
10207            flags: 0,
10208            postponed_arrays: 0 as *mut *mut libc::c_void,
10209            postponed_arrays_count: 0,
10210            blocked_privdata: 0 as *mut libc::c_void,
10211            blocked_ready_key: 0 as *mut robj,
10212            keys_result: 0 as *mut getKeysResult,
10213            pa_head: 0 as *mut RedisModulePoolAllocBlock,
10214            next_yield_time: 0,
10215            user: 0 as *const RedisModuleUser,
10216        };
10217        moduleCreateContext(&mut ctx, (*bc).module, 0 as libc::c_int);
10218        ctx.blocked_privdata = (*bc).privdata;
10219        ctx.client = (*bc).client;
10220        ((*bc).disconnect_callback).expect("non-null function pointer")(&mut ctx, bc);
10221        moduleFreeContext(&mut ctx);
10222    }
10223    if (*bc).blocked_on_keys != 0 && (*bc).unblocked == 0 {
10224        moduleUnblockClient(c);
10225    }
10226    (*bc).client = 0 as *mut client;
10227}
10228#[no_mangle]
10229pub unsafe extern "C" fn moduleBlockClient(
10230    mut ctx: *mut RedisModuleCtx,
10231    mut reply_callback: RedisModuleCmdFunc,
10232    mut timeout_callback: RedisModuleCmdFunc,
10233    mut free_privdata: Option::<
10234        unsafe extern "C" fn(*mut RedisModuleCtx, *mut libc::c_void) -> (),
10235    >,
10236    mut timeout_ms: libc::c_longlong,
10237    mut keys: *mut *mut robj,
10238    mut numkeys: libc::c_int,
10239    mut privdata: *mut libc::c_void,
10240) -> *mut RedisModuleBlockedClient {
10241    let mut c: *mut client = (*ctx).client;
10242    let mut islua: libc::c_int = scriptIsRunning();
10243    let mut ismulti: libc::c_int = server.in_exec;
10244    (*c)
10245        .bpop
10246        .module_blocked_handle = zmalloc(
10247        core::mem::size_of::<RedisModuleBlockedClient>() as libc::c_ulong,
10248    );
10249    let mut bc: *mut RedisModuleBlockedClient = (*c).bpop.module_blocked_handle
10250        as *mut RedisModuleBlockedClient;
10251    (*(*ctx).module).blocked_clients += 1;
10252    let mut timeout: mstime_t = if timeout_ms != 0 {
10253        mstime() + timeout_ms
10254    } else {
10255        0 as libc::c_int as libc::c_longlong
10256    };
10257    (*bc).client = if islua != 0 || ismulti != 0 { 0 as *mut client } else { c };
10258    (*bc).module = (*ctx).module;
10259    (*bc).reply_callback = reply_callback;
10260    (*bc).timeout_callback = timeout_callback;
10261    (*bc).disconnect_callback = None;
10262    (*bc).free_privdata = free_privdata;
10263    (*bc).privdata = privdata;
10264    (*bc).reply_client = moduleAllocTempClient(0 as *mut user);
10265    (*bc).thread_safe_ctx_client = moduleAllocTempClient(0 as *mut user);
10266    if !((*bc).client).is_null() {
10267        (*(*bc).reply_client).resp = (*(*bc).client).resp;
10268    }
10269    (*bc).dbid = (*(*c).db).id;
10270    (*bc)
10271        .blocked_on_keys = (keys != 0 as *mut libc::c_void as *mut *mut robj)
10272        as libc::c_int;
10273    (*bc).unblocked = 0 as libc::c_int;
10274    (*bc).background_timer = 0 as libc::c_int as monotime;
10275    (*bc).background_duration = 0 as libc::c_int as uint64_t;
10276    (*c).bpop.timeout = timeout;
10277    if islua != 0 || ismulti != 0 {
10278        (*c).bpop.module_blocked_handle = 0 as *mut libc::c_void;
10279        addReplyError(
10280            c,
10281            if islua != 0 {
10282                b"Blocking module command called from Lua script\0" as *const u8
10283                    as *const libc::c_char
10284            } else {
10285                b"Blocking module command called from transaction\0" as *const u8
10286                    as *const libc::c_char
10287            },
10288        );
10289    } else if !keys.is_null() {
10290        blockForKeys(
10291            c,
10292            3 as libc::c_int,
10293            keys,
10294            numkeys,
10295            -(1 as libc::c_int) as libc::c_long,
10296            timeout,
10297            0 as *mut robj,
10298            0 as *mut blockPos,
10299            0 as *mut streamID,
10300        );
10301    } else {
10302        blockClient(c, 3 as libc::c_int);
10303    }
10304    return bc;
10305}
10306#[no_mangle]
10307pub unsafe extern "C" fn moduleTryServeClientBlockedOnKey(
10308    mut c: *mut client,
10309    mut key: *mut robj,
10310) -> libc::c_int {
10311    let mut served: libc::c_int = 0 as libc::c_int;
10312    let mut bc: *mut RedisModuleBlockedClient = (*c).bpop.module_blocked_handle
10313        as *mut RedisModuleBlockedClient;
10314    if (*bc).unblocked != 0 {
10315        return 0 as libc::c_int;
10316    }
10317    let mut ctx: RedisModuleCtx = RedisModuleCtx {
10318        getapifuncptr: 0 as *mut libc::c_void,
10319        module: 0 as *mut RedisModule,
10320        client: 0 as *mut client,
10321        blocked_client: 0 as *mut RedisModuleBlockedClient,
10322        amqueue: 0 as *mut AutoMemEntry,
10323        amqueue_len: 0,
10324        amqueue_used: 0,
10325        flags: 0,
10326        postponed_arrays: 0 as *mut *mut libc::c_void,
10327        postponed_arrays_count: 0,
10328        blocked_privdata: 0 as *mut libc::c_void,
10329        blocked_ready_key: 0 as *mut robj,
10330        keys_result: 0 as *mut getKeysResult,
10331        pa_head: 0 as *mut RedisModulePoolAllocBlock,
10332        next_yield_time: 0,
10333        user: 0 as *const RedisModuleUser,
10334    };
10335    moduleCreateContext(&mut ctx, (*bc).module, (1 as libc::c_int) << 2 as libc::c_int);
10336    ctx.blocked_ready_key = key;
10337    ctx.blocked_privdata = (*bc).privdata;
10338    ctx.client = (*bc).client;
10339    ctx.blocked_client = bc;
10340    if ((*bc).reply_callback)
10341        .expect(
10342            "non-null function pointer",
10343        )(&mut ctx, (*c).argv as *mut *mut libc::c_void, (*c).argc) == 0 as libc::c_int
10344    {
10345        served = 1 as libc::c_int;
10346    }
10347    moduleFreeContext(&mut ctx);
10348    return served;
10349}
10350#[no_mangle]
10351pub unsafe extern "C" fn RM_BlockClient(
10352    mut ctx: *mut RedisModuleCtx,
10353    mut reply_callback: RedisModuleCmdFunc,
10354    mut timeout_callback: RedisModuleCmdFunc,
10355    mut free_privdata: Option::<
10356        unsafe extern "C" fn(*mut RedisModuleCtx, *mut libc::c_void) -> (),
10357    >,
10358    mut timeout_ms: libc::c_longlong,
10359) -> *mut RedisModuleBlockedClient {
10360    return moduleBlockClient(
10361        ctx,
10362        reply_callback,
10363        timeout_callback,
10364        free_privdata,
10365        timeout_ms,
10366        0 as *mut *mut robj,
10367        0 as libc::c_int,
10368        0 as *mut libc::c_void,
10369    );
10370}
10371#[no_mangle]
10372pub unsafe extern "C" fn RM_BlockClientOnKeys(
10373    mut ctx: *mut RedisModuleCtx,
10374    mut reply_callback: RedisModuleCmdFunc,
10375    mut timeout_callback: RedisModuleCmdFunc,
10376    mut free_privdata: Option::<
10377        unsafe extern "C" fn(*mut RedisModuleCtx, *mut libc::c_void) -> (),
10378    >,
10379    mut timeout_ms: libc::c_longlong,
10380    mut keys: *mut *mut robj,
10381    mut numkeys: libc::c_int,
10382    mut privdata: *mut libc::c_void,
10383) -> *mut RedisModuleBlockedClient {
10384    return moduleBlockClient(
10385        ctx,
10386        reply_callback,
10387        timeout_callback,
10388        free_privdata,
10389        timeout_ms,
10390        keys,
10391        numkeys,
10392        privdata,
10393    );
10394}
10395#[no_mangle]
10396pub unsafe extern "C" fn RM_SignalKeyAsReady(
10397    mut ctx: *mut RedisModuleCtx,
10398    mut key: *mut robj,
10399) {
10400    signalKeyAsReady((*(*ctx).client).db, key, 5 as libc::c_int);
10401}
10402#[no_mangle]
10403pub unsafe extern "C" fn moduleUnblockClientByHandle(
10404    mut bc: *mut RedisModuleBlockedClient,
10405    mut privdata: *mut libc::c_void,
10406) -> libc::c_int {
10407    pthread_mutex_lock(&mut moduleUnblockedClientsMutex);
10408    if (*bc).blocked_on_keys == 0 {
10409        (*bc).privdata = privdata;
10410    }
10411    (*bc).unblocked = 1 as libc::c_int;
10412    if (*moduleUnblockedClients).len == 0 as libc::c_int as libc::c_ulong {
10413        write(
10414            server.module_pipe[1 as libc::c_int as usize],
10415            b"A\0" as *const u8 as *const libc::c_char as *const libc::c_void,
10416            1 as libc::c_int as size_t,
10417        ) != 1 as libc::c_int as libc::c_long;
10418    }
10419    listAddNodeTail(moduleUnblockedClients, bc as *mut libc::c_void);
10420    pthread_mutex_unlock(&mut moduleUnblockedClientsMutex);
10421    return 0 as libc::c_int;
10422}
10423#[no_mangle]
10424pub unsafe extern "C" fn moduleUnblockClient(mut c: *mut client) {
10425    let mut bc: *mut RedisModuleBlockedClient = (*c).bpop.module_blocked_handle
10426        as *mut RedisModuleBlockedClient;
10427    moduleUnblockClientByHandle(bc, 0 as *mut libc::c_void);
10428}
10429#[no_mangle]
10430pub unsafe extern "C" fn moduleClientIsBlockedOnKeys(mut c: *mut client) -> libc::c_int {
10431    let mut bc: *mut RedisModuleBlockedClient = (*c).bpop.module_blocked_handle
10432        as *mut RedisModuleBlockedClient;
10433    return (*bc).blocked_on_keys;
10434}
10435#[no_mangle]
10436pub unsafe extern "C" fn RM_UnblockClient(
10437    mut bc: *mut RedisModuleBlockedClient,
10438    mut privdata: *mut libc::c_void,
10439) -> libc::c_int {
10440    if (*bc).blocked_on_keys != 0 {
10441        if ((*bc).timeout_callback).is_none() {
10442            return 1 as libc::c_int;
10443        }
10444        if (*bc).unblocked != 0 {
10445            return 0 as libc::c_int;
10446        }
10447        if !((*bc).client).is_null() {
10448            moduleBlockedClientTimedOut((*bc).client);
10449        }
10450    }
10451    moduleUnblockClientByHandle(bc, privdata);
10452    return 0 as libc::c_int;
10453}
10454#[no_mangle]
10455pub unsafe extern "C" fn RM_AbortBlock(
10456    mut bc: *mut RedisModuleBlockedClient,
10457) -> libc::c_int {
10458    (*bc).reply_callback = None;
10459    (*bc).disconnect_callback = None;
10460    return RM_UnblockClient(bc, 0 as *mut libc::c_void);
10461}
10462#[no_mangle]
10463pub unsafe extern "C" fn RM_SetDisconnectCallback(
10464    mut bc: *mut RedisModuleBlockedClient,
10465    mut callback: RedisModuleDisconnectFunc,
10466) {
10467    (*bc).disconnect_callback = callback;
10468}
10469#[no_mangle]
10470pub unsafe extern "C" fn moduleHandleBlockedClients() {
10471    let mut ln: *mut listNode = 0 as *mut listNode;
10472    let mut bc: *mut RedisModuleBlockedClient = 0 as *mut RedisModuleBlockedClient;
10473    pthread_mutex_lock(&mut moduleUnblockedClientsMutex);
10474    while (*moduleUnblockedClients).len != 0 {
10475        ln = (*moduleUnblockedClients).head;
10476        bc = (*ln).value as *mut RedisModuleBlockedClient;
10477        let mut c: *mut client = (*bc).client;
10478        listDelNode(moduleUnblockedClients, ln);
10479        pthread_mutex_unlock(&mut moduleUnblockedClientsMutex);
10480        let mut prev_error_replies: libc::c_longlong = server.stat_total_error_replies;
10481        let mut reply_us: uint64_t = 0 as libc::c_int as uint64_t;
10482        if !c.is_null() && (*bc).blocked_on_keys == 0 && ((*bc).reply_callback).is_some()
10483        {
10484            let mut ctx: RedisModuleCtx = RedisModuleCtx {
10485                getapifuncptr: 0 as *mut libc::c_void,
10486                module: 0 as *mut RedisModule,
10487                client: 0 as *mut client,
10488                blocked_client: 0 as *mut RedisModuleBlockedClient,
10489                amqueue: 0 as *mut AutoMemEntry,
10490                amqueue_len: 0,
10491                amqueue_used: 0,
10492                flags: 0,
10493                postponed_arrays: 0 as *mut *mut libc::c_void,
10494                postponed_arrays_count: 0,
10495                blocked_privdata: 0 as *mut libc::c_void,
10496                blocked_ready_key: 0 as *mut robj,
10497                keys_result: 0 as *mut getKeysResult,
10498                pa_head: 0 as *mut RedisModulePoolAllocBlock,
10499                next_yield_time: 0,
10500                user: 0 as *const RedisModuleUser,
10501            };
10502            moduleCreateContext(
10503                &mut ctx,
10504                (*bc).module,
10505                (1 as libc::c_int) << 2 as libc::c_int,
10506            );
10507            ctx.blocked_privdata = (*bc).privdata;
10508            ctx.blocked_ready_key = 0 as *mut robj;
10509            ctx.client = (*bc).client;
10510            ctx.blocked_client = bc;
10511            let mut replyTimer: monotime = 0;
10512            elapsedStart(&mut replyTimer);
10513            ((*bc).reply_callback)
10514                .expect(
10515                    "non-null function pointer",
10516                )(&mut ctx, (*c).argv as *mut *mut libc::c_void, (*c).argc);
10517            reply_us = elapsedUs(replyTimer);
10518            moduleFreeContext(&mut ctx);
10519        }
10520        if !((*bc).privdata).is_null() && ((*bc).free_privdata).is_some() {
10521            let mut ctx_0: RedisModuleCtx = RedisModuleCtx {
10522                getapifuncptr: 0 as *mut libc::c_void,
10523                module: 0 as *mut RedisModule,
10524                client: 0 as *mut client,
10525                blocked_client: 0 as *mut RedisModuleBlockedClient,
10526                amqueue: 0 as *mut AutoMemEntry,
10527                amqueue_len: 0,
10528                amqueue_used: 0,
10529                flags: 0,
10530                postponed_arrays: 0 as *mut *mut libc::c_void,
10531                postponed_arrays_count: 0,
10532                blocked_privdata: 0 as *mut libc::c_void,
10533                blocked_ready_key: 0 as *mut robj,
10534                keys_result: 0 as *mut getKeysResult,
10535                pa_head: 0 as *mut RedisModulePoolAllocBlock,
10536                next_yield_time: 0,
10537                user: 0 as *const RedisModuleUser,
10538            };
10539            let mut ctx_flags: libc::c_int = if c.is_null() {
10540                (1 as libc::c_int) << 5 as libc::c_int
10541            } else {
10542                0 as libc::c_int
10543            };
10544            moduleCreateContext(&mut ctx_0, (*bc).module, ctx_flags);
10545            ctx_0.blocked_privdata = (*bc).privdata;
10546            ctx_0.client = (*bc).client;
10547            ((*bc).free_privdata)
10548                .expect("non-null function pointer")(&mut ctx_0, (*bc).privdata);
10549            moduleFreeContext(&mut ctx_0);
10550        }
10551        if !c.is_null() {
10552            AddReplyFromClient(c, (*bc).reply_client);
10553        }
10554        moduleReleaseTempClient((*bc).reply_client);
10555        moduleReleaseTempClient((*bc).thread_safe_ctx_client);
10556        if !c.is_null() && (*bc).blocked_on_keys == 0 {
10557            updateStatsOnUnblock(
10558                c,
10559                (*bc).background_duration as libc::c_long,
10560                reply_us as libc::c_long,
10561                (server.stat_total_error_replies != prev_error_replies) as libc::c_int,
10562            );
10563        }
10564        if !c.is_null() {
10565            (*bc).disconnect_callback = None;
10566            unblockClient(c);
10567            if clientHasPendingReplies(c) != 0
10568                && (*c).flags
10569                    & ((1 as libc::c_int) << 21 as libc::c_int) as libc::c_ulong == 0
10570            {
10571                (*c).flags |= ((1 as libc::c_int) << 21 as libc::c_int) as libc::c_ulong;
10572                listAddNodeHead(server.clients_pending_write, c as *mut libc::c_void);
10573            }
10574        }
10575        (*(*bc).module).blocked_clients -= 1;
10576        zfree(bc as *mut libc::c_void);
10577        pthread_mutex_lock(&mut moduleUnblockedClientsMutex);
10578    }
10579    pthread_mutex_unlock(&mut moduleUnblockedClientsMutex);
10580}
10581#[no_mangle]
10582pub unsafe extern "C" fn moduleBlockedClientMayTimeout(
10583    mut c: *mut client,
10584) -> libc::c_int {
10585    if (*c).btype != 3 as libc::c_int {
10586        return 1 as libc::c_int;
10587    }
10588    let mut bc: *mut RedisModuleBlockedClient = (*c).bpop.module_blocked_handle
10589        as *mut RedisModuleBlockedClient;
10590    return (!bc.is_null() && ((*bc).timeout_callback).is_some()) as libc::c_int;
10591}
10592#[no_mangle]
10593pub unsafe extern "C" fn moduleBlockedClientTimedOut(mut c: *mut client) {
10594    let mut bc: *mut RedisModuleBlockedClient = (*c).bpop.module_blocked_handle
10595        as *mut RedisModuleBlockedClient;
10596    if (*bc).unblocked != 0 {
10597        return;
10598    }
10599    let mut ctx: RedisModuleCtx = RedisModuleCtx {
10600        getapifuncptr: 0 as *mut libc::c_void,
10601        module: 0 as *mut RedisModule,
10602        client: 0 as *mut client,
10603        blocked_client: 0 as *mut RedisModuleBlockedClient,
10604        amqueue: 0 as *mut AutoMemEntry,
10605        amqueue_len: 0,
10606        amqueue_used: 0,
10607        flags: 0,
10608        postponed_arrays: 0 as *mut *mut libc::c_void,
10609        postponed_arrays_count: 0,
10610        blocked_privdata: 0 as *mut libc::c_void,
10611        blocked_ready_key: 0 as *mut robj,
10612        keys_result: 0 as *mut getKeysResult,
10613        pa_head: 0 as *mut RedisModulePoolAllocBlock,
10614        next_yield_time: 0,
10615        user: 0 as *const RedisModuleUser,
10616    };
10617    moduleCreateContext(&mut ctx, (*bc).module, (1 as libc::c_int) << 3 as libc::c_int);
10618    ctx.client = (*bc).client;
10619    ctx.blocked_client = bc;
10620    ctx.blocked_privdata = (*bc).privdata;
10621    let mut prev_error_replies: libc::c_longlong = server.stat_total_error_replies;
10622    ((*bc).timeout_callback)
10623        .expect(
10624            "non-null function pointer",
10625        )(&mut ctx, (*c).argv as *mut *mut libc::c_void, (*c).argc);
10626    moduleFreeContext(&mut ctx);
10627    if (*bc).blocked_on_keys == 0 {
10628        updateStatsOnUnblock(
10629            c,
10630            (*bc).background_duration as libc::c_long,
10631            0 as libc::c_int as libc::c_long,
10632            (server.stat_total_error_replies != prev_error_replies) as libc::c_int,
10633        );
10634    }
10635    (*bc).disconnect_callback = None;
10636}
10637#[no_mangle]
10638pub unsafe extern "C" fn RM_IsBlockedReplyRequest(
10639    mut ctx: *mut RedisModuleCtx,
10640) -> libc::c_int {
10641    return ((*ctx).flags & (1 as libc::c_int) << 2 as libc::c_int != 0 as libc::c_int)
10642        as libc::c_int;
10643}
10644#[no_mangle]
10645pub unsafe extern "C" fn RM_IsBlockedTimeoutRequest(
10646    mut ctx: *mut RedisModuleCtx,
10647) -> libc::c_int {
10648    return ((*ctx).flags & (1 as libc::c_int) << 3 as libc::c_int != 0 as libc::c_int)
10649        as libc::c_int;
10650}
10651#[no_mangle]
10652pub unsafe extern "C" fn RM_GetBlockedClientPrivateData(
10653    mut ctx: *mut RedisModuleCtx,
10654) -> *mut libc::c_void {
10655    return (*ctx).blocked_privdata;
10656}
10657#[no_mangle]
10658pub unsafe extern "C" fn RM_GetBlockedClientReadyKey(
10659    mut ctx: *mut RedisModuleCtx,
10660) -> *mut robj {
10661    return (*ctx).blocked_ready_key;
10662}
10663#[no_mangle]
10664pub unsafe extern "C" fn RM_GetBlockedClientHandle(
10665    mut ctx: *mut RedisModuleCtx,
10666) -> *mut RedisModuleBlockedClient {
10667    return (*ctx).blocked_client;
10668}
10669#[no_mangle]
10670pub unsafe extern "C" fn RM_BlockedClientDisconnected(
10671    mut ctx: *mut RedisModuleCtx,
10672) -> libc::c_int {
10673    return ((*ctx).flags & (1 as libc::c_int) << 5 as libc::c_int != 0 as libc::c_int)
10674        as libc::c_int;
10675}
10676#[no_mangle]
10677pub unsafe extern "C" fn RM_GetThreadSafeContext(
10678    mut bc: *mut RedisModuleBlockedClient,
10679) -> *mut RedisModuleCtx {
10680    let mut ctx: *mut RedisModuleCtx = zmalloc(
10681        core::mem::size_of::<RedisModuleCtx>() as libc::c_ulong,
10682    ) as *mut RedisModuleCtx;
10683    let mut module: *mut RedisModule = if !bc.is_null() {
10684        (*bc).module
10685    } else {
10686        0 as *mut RedisModule
10687    };
10688    let mut flags: libc::c_int = (1 as libc::c_int) << 4 as libc::c_int;
10689    if bc.is_null() {
10690        flags |= (1 as libc::c_int) << 7 as libc::c_int;
10691    }
10692    moduleCreateContext(ctx, module, flags);
10693    if !bc.is_null() {
10694        (*ctx).blocked_client = bc;
10695        (*ctx).client = (*bc).thread_safe_ctx_client;
10696        selectDb((*ctx).client, (*bc).dbid);
10697        if !((*bc).client).is_null() {
10698            (*(*ctx).client).id = (*(*bc).client).id;
10699            (*(*ctx).client).resp = (*(*bc).client).resp;
10700        }
10701    }
10702    return ctx;
10703}
10704#[no_mangle]
10705pub unsafe extern "C" fn RM_GetDetachedThreadSafeContext(
10706    mut ctx: *mut RedisModuleCtx,
10707) -> *mut RedisModuleCtx {
10708    let mut new_ctx: *mut RedisModuleCtx = zmalloc(
10709        core::mem::size_of::<RedisModuleCtx>() as libc::c_ulong,
10710    ) as *mut RedisModuleCtx;
10711    moduleCreateContext(
10712        new_ctx,
10713        (*ctx).module,
10714        (1 as libc::c_int) << 4 as libc::c_int | (1 as libc::c_int) << 7 as libc::c_int,
10715    );
10716    return new_ctx;
10717}
10718#[no_mangle]
10719pub unsafe extern "C" fn RM_FreeThreadSafeContext(mut ctx: *mut RedisModuleCtx) {
10720    moduleFreeContext(ctx);
10721    zfree(ctx as *mut libc::c_void);
10722}
10723#[no_mangle]
10724pub unsafe extern "C" fn moduleGILAfterLock() {
10725    if server.module_ctx_nesting == 0 as libc::c_int {} else {
10726        _serverAssert(
10727            b"server.module_ctx_nesting == 0\0" as *const u8 as *const libc::c_char,
10728            b"module.c\0" as *const u8 as *const libc::c_char,
10729            7737 as libc::c_int,
10730        );
10731        unreachable!();
10732    };
10733    server.module_ctx_nesting += 1;
10734}
10735#[no_mangle]
10736pub unsafe extern "C" fn RM_ThreadSafeContextLock(mut ctx: *mut RedisModuleCtx) {
10737    moduleAcquireGIL();
10738    moduleGILAfterLock();
10739}
10740#[no_mangle]
10741pub unsafe extern "C" fn RM_ThreadSafeContextTryLock(
10742    mut ctx: *mut RedisModuleCtx,
10743) -> libc::c_int {
10744    let mut res: libc::c_int = moduleTryAcquireGIL();
10745    if res != 0 as libc::c_int {
10746        *__errno_location() = res;
10747        return 1 as libc::c_int;
10748    }
10749    moduleGILAfterLock();
10750    return 0 as libc::c_int;
10751}
10752#[no_mangle]
10753pub unsafe extern "C" fn moduleGILBeforeUnlock() {
10754    if server.module_ctx_nesting == 1 as libc::c_int {} else {
10755        _serverAssert(
10756            b"server.module_ctx_nesting == 1\0" as *const u8 as *const libc::c_char,
10757            b"module.c\0" as *const u8 as *const libc::c_char,
10758            7774 as libc::c_int,
10759        );
10760        unreachable!();
10761    };
10762    server.module_ctx_nesting -= 1;
10763    propagatePendingCommands();
10764    if server.busy_module_yield_flags != 0 {
10765        blockingOperationEnds();
10766        server.busy_module_yield_flags = 0 as libc::c_int;
10767        if !(server.current_client).is_null() {
10768            unprotectClient(server.current_client);
10769        }
10770        unblockPostponedClients();
10771    }
10772}
10773#[no_mangle]
10774pub unsafe extern "C" fn RM_ThreadSafeContextUnlock(mut ctx: *mut RedisModuleCtx) {
10775    moduleGILBeforeUnlock();
10776    moduleReleaseGIL();
10777}
10778#[no_mangle]
10779pub unsafe extern "C" fn moduleAcquireGIL() {
10780    pthread_mutex_lock(&mut moduleGIL);
10781}
10782#[no_mangle]
10783pub unsafe extern "C" fn moduleTryAcquireGIL() -> libc::c_int {
10784    return pthread_mutex_trylock(&mut moduleGIL);
10785}
10786#[no_mangle]
10787pub unsafe extern "C" fn moduleReleaseGIL() {
10788    pthread_mutex_unlock(&mut moduleGIL);
10789}
10790#[no_mangle]
10791pub unsafe extern "C" fn RM_SubscribeToKeyspaceEvents(
10792    mut ctx: *mut RedisModuleCtx,
10793    mut types: libc::c_int,
10794    mut callback: RedisModuleNotificationFunc,
10795) -> libc::c_int {
10796    let mut sub: *mut RedisModuleKeyspaceSubscriber = zmalloc(
10797        core::mem::size_of::<RedisModuleKeyspaceSubscriber>() as libc::c_ulong,
10798    ) as *mut RedisModuleKeyspaceSubscriber;
10799    (*sub).module = (*ctx).module;
10800    (*sub).event_mask = types;
10801    (*sub).notify_callback = callback;
10802    (*sub).active = 0 as libc::c_int;
10803    listAddNodeTail(moduleKeyspaceSubscribers, sub as *mut libc::c_void);
10804    return 0 as libc::c_int;
10805}
10806#[no_mangle]
10807pub unsafe extern "C" fn RM_GetNotifyKeyspaceEvents() -> libc::c_int {
10808    return server.notify_keyspace_events;
10809}
10810#[no_mangle]
10811pub unsafe extern "C" fn RM_NotifyKeyspaceEvent(
10812    mut ctx: *mut RedisModuleCtx,
10813    mut type_0: libc::c_int,
10814    mut event: *const libc::c_char,
10815    mut key: *mut robj,
10816) -> libc::c_int {
10817    if ctx.is_null() || ((*ctx).client).is_null() {
10818        return 1 as libc::c_int;
10819    }
10820    notifyKeyspaceEvent(
10821        type_0,
10822        event as *mut libc::c_char,
10823        key,
10824        (*(*(*ctx).client).db).id,
10825    );
10826    return 0 as libc::c_int;
10827}
10828#[no_mangle]
10829pub unsafe extern "C" fn moduleNotifyKeyspaceEvent(
10830    mut type_0: libc::c_int,
10831    mut event: *const libc::c_char,
10832    mut key: *mut robj,
10833    mut dbid: libc::c_int,
10834) {
10835    if (*moduleKeyspaceSubscribers).len == 0 as libc::c_int as libc::c_ulong {
10836        return;
10837    }
10838    let mut li: listIter = listIter {
10839        next: 0 as *mut listNode,
10840        direction: 0,
10841    };
10842    let mut ln: *mut listNode = 0 as *mut listNode;
10843    listRewind(moduleKeyspaceSubscribers, &mut li);
10844    type_0
10845        &= !((1 as libc::c_int) << 1 as libc::c_int
10846            | (1 as libc::c_int) << 0 as libc::c_int);
10847    loop {
10848        ln = listNext(&mut li);
10849        if ln.is_null() {
10850            break;
10851        }
10852        let mut sub: *mut RedisModuleKeyspaceSubscriber = (*ln).value
10853            as *mut RedisModuleKeyspaceSubscriber;
10854        if (*sub).event_mask & type_0 != 0 && (*sub).active == 0 as libc::c_int {
10855            let mut ctx: RedisModuleCtx = RedisModuleCtx {
10856                getapifuncptr: 0 as *mut libc::c_void,
10857                module: 0 as *mut RedisModule,
10858                client: 0 as *mut client,
10859                blocked_client: 0 as *mut RedisModuleBlockedClient,
10860                amqueue: 0 as *mut AutoMemEntry,
10861                amqueue_len: 0,
10862                amqueue_used: 0,
10863                flags: 0,
10864                postponed_arrays: 0 as *mut *mut libc::c_void,
10865                postponed_arrays_count: 0,
10866                blocked_privdata: 0 as *mut libc::c_void,
10867                blocked_ready_key: 0 as *mut robj,
10868                keys_result: 0 as *mut getKeysResult,
10869                pa_head: 0 as *mut RedisModulePoolAllocBlock,
10870                next_yield_time: 0,
10871                user: 0 as *const RedisModuleUser,
10872            };
10873            moduleCreateContext(
10874                &mut ctx,
10875                (*sub).module,
10876                (1 as libc::c_int) << 6 as libc::c_int,
10877            );
10878            selectDb(ctx.client, dbid);
10879            (*sub).active = 1 as libc::c_int;
10880            ((*sub).notify_callback)
10881                .expect("non-null function pointer")(&mut ctx, type_0, event, key);
10882            (*sub).active = 0 as libc::c_int;
10883            moduleFreeContext(&mut ctx);
10884        }
10885    };
10886}
10887#[no_mangle]
10888pub unsafe extern "C" fn moduleUnsubscribeNotifications(mut module: *mut RedisModule) {
10889    let mut li: listIter = listIter {
10890        next: 0 as *mut listNode,
10891        direction: 0,
10892    };
10893    let mut ln: *mut listNode = 0 as *mut listNode;
10894    listRewind(moduleKeyspaceSubscribers, &mut li);
10895    loop {
10896        ln = listNext(&mut li);
10897        if ln.is_null() {
10898            break;
10899        }
10900        let mut sub: *mut RedisModuleKeyspaceSubscriber = (*ln).value
10901            as *mut RedisModuleKeyspaceSubscriber;
10902        if (*sub).module == module {
10903            listDelNode(moduleKeyspaceSubscribers, ln);
10904            zfree(sub as *mut libc::c_void);
10905        }
10906    };
10907}
10908static mut clusterReceivers: [*mut moduleClusterReceiver; 255] = [0
10909    as *const moduleClusterReceiver as *mut moduleClusterReceiver; 255];
10910#[no_mangle]
10911pub unsafe extern "C" fn moduleCallClusterReceivers(
10912    mut sender_id: *const libc::c_char,
10913    mut module_id: uint64_t,
10914    mut type_0: uint8_t,
10915    mut payload: *const libc::c_uchar,
10916    mut len: uint32_t,
10917) {
10918    let mut r: *mut moduleClusterReceiver = clusterReceivers[type_0 as usize];
10919    while !r.is_null() {
10920        if (*r).module_id == module_id {
10921            let mut ctx: RedisModuleCtx = RedisModuleCtx {
10922                getapifuncptr: 0 as *mut libc::c_void,
10923                module: 0 as *mut RedisModule,
10924                client: 0 as *mut client,
10925                blocked_client: 0 as *mut RedisModuleBlockedClient,
10926                amqueue: 0 as *mut AutoMemEntry,
10927                amqueue_len: 0,
10928                amqueue_used: 0,
10929                flags: 0,
10930                postponed_arrays: 0 as *mut *mut libc::c_void,
10931                postponed_arrays_count: 0,
10932                blocked_privdata: 0 as *mut libc::c_void,
10933                blocked_ready_key: 0 as *mut robj,
10934                keys_result: 0 as *mut getKeysResult,
10935                pa_head: 0 as *mut RedisModulePoolAllocBlock,
10936                next_yield_time: 0,
10937                user: 0 as *const RedisModuleUser,
10938            };
10939            moduleCreateContext(
10940                &mut ctx,
10941                (*r).module,
10942                (1 as libc::c_int) << 6 as libc::c_int,
10943            );
10944            ((*r).callback)
10945                .expect(
10946                    "non-null function pointer",
10947                )(&mut ctx, sender_id, type_0, payload, len);
10948            moduleFreeContext(&mut ctx);
10949            return;
10950        }
10951        r = (*r).next;
10952    }
10953}
10954#[no_mangle]
10955pub unsafe extern "C" fn RM_RegisterClusterMessageReceiver(
10956    mut ctx: *mut RedisModuleCtx,
10957    mut type_0: uint8_t,
10958    mut callback: RedisModuleClusterMessageReceiver,
10959) {
10960    if server.cluster_enabled == 0 {
10961        return;
10962    }
10963    let mut module_id: uint64_t = moduleTypeEncodeId(
10964        (*(*ctx).module).name,
10965        0 as libc::c_int,
10966    );
10967    let mut r: *mut moduleClusterReceiver = clusterReceivers[type_0 as usize];
10968    let mut prev: *mut moduleClusterReceiver = 0 as *mut moduleClusterReceiver;
10969    while !r.is_null() {
10970        if (*r).module_id == module_id {
10971            if callback.is_some() {
10972                (*r).callback = callback;
10973            } else {
10974                if !prev.is_null() {
10975                    (*prev).next = (*r).next;
10976                } else {
10977                    (*clusterReceivers[type_0 as usize]).next = (*r).next;
10978                }
10979                zfree(r as *mut libc::c_void);
10980            }
10981            return;
10982        }
10983        prev = r;
10984        r = (*r).next;
10985    }
10986    if callback.is_some() {
10987        r = zmalloc(core::mem::size_of::<moduleClusterReceiver>() as libc::c_ulong)
10988            as *mut moduleClusterReceiver;
10989        (*r).module_id = module_id;
10990        (*r).module = (*ctx).module;
10991        (*r).callback = callback;
10992        (*r).next = clusterReceivers[type_0 as usize];
10993        clusterReceivers[type_0 as usize] = r;
10994    }
10995}
10996#[no_mangle]
10997pub unsafe extern "C" fn RM_SendClusterMessage(
10998    mut ctx: *mut RedisModuleCtx,
10999    mut target_id: *const libc::c_char,
11000    mut type_0: uint8_t,
11001    mut msg: *const libc::c_char,
11002    mut len: uint32_t,
11003) -> libc::c_int {
11004    if server.cluster_enabled == 0 {
11005        return 1 as libc::c_int;
11006    }
11007    let mut module_id: uint64_t = moduleTypeEncodeId(
11008        (*(*ctx).module).name,
11009        0 as libc::c_int,
11010    );
11011    if clusterSendModuleMessageToTarget(target_id, module_id, type_0, msg, len)
11012        == 0 as libc::c_int
11013    {
11014        return 0 as libc::c_int
11015    } else {
11016        return 1 as libc::c_int
11017    };
11018}
11019#[no_mangle]
11020pub unsafe extern "C" fn RM_GetClusterNodesList(
11021    mut ctx: *mut RedisModuleCtx,
11022    mut numnodes: *mut size_t,
11023) -> *mut *mut libc::c_char {
11024    if server.cluster_enabled == 0 {
11025        return 0 as *mut *mut libc::c_char;
11026    }
11027    let mut count: size_t = ((*(*server.cluster).nodes)
11028        .ht_used[0 as libc::c_int as usize])
11029        .wrapping_add((*(*server.cluster).nodes).ht_used[1 as libc::c_int as usize]);
11030    let mut ids: *mut *mut libc::c_char = zmalloc(
11031        count
11032            .wrapping_add(1 as libc::c_int as libc::c_ulong)
11033            .wrapping_mul(40 as libc::c_int as libc::c_ulong),
11034    ) as *mut *mut libc::c_char;
11035    let mut di: *mut dictIterator = dictGetIterator((*server.cluster).nodes);
11036    let mut de: *mut dictEntry = 0 as *mut dictEntry;
11037    let mut j: libc::c_int = 0 as libc::c_int;
11038    loop {
11039        de = dictNext(di);
11040        if de.is_null() {
11041            break;
11042        }
11043        let mut node: *mut clusterNode = (*de).v.val as *mut clusterNode;
11044        if (*node).flags & (64 as libc::c_int | 32 as libc::c_int) != 0 {
11045            continue;
11046        }
11047        let ref mut fresh31 = *ids.offset(j as isize);
11048        *fresh31 = zmalloc(40 as libc::c_int as size_t) as *mut libc::c_char;
11049        memcpy(
11050            *ids.offset(j as isize) as *mut libc::c_void,
11051            ((*node).name).as_mut_ptr() as *const libc::c_void,
11052            40 as libc::c_int as libc::c_ulong,
11053        );
11054        j += 1;
11055    }
11056    *numnodes = j as size_t;
11057    let ref mut fresh32 = *ids.offset(j as isize);
11058    *fresh32 = 0 as *mut libc::c_char;
11059    dictReleaseIterator(di);
11060    return ids;
11061}
11062#[no_mangle]
11063pub unsafe extern "C" fn RM_FreeClusterNodesList(mut ids: *mut *mut libc::c_char) {
11064    if ids.is_null() {
11065        return;
11066    }
11067    let mut j: libc::c_int = 0 as libc::c_int;
11068    while !(*ids.offset(j as isize)).is_null() {
11069        zfree(*ids.offset(j as isize) as *mut libc::c_void);
11070        j += 1;
11071    }
11072    zfree(ids as *mut libc::c_void);
11073}
11074#[no_mangle]
11075pub unsafe extern "C" fn RM_GetMyClusterID() -> *const libc::c_char {
11076    if server.cluster_enabled == 0 {
11077        return 0 as *const libc::c_char;
11078    }
11079    return ((*(*server.cluster).myself).name).as_mut_ptr();
11080}
11081#[no_mangle]
11082pub unsafe extern "C" fn RM_GetClusterSize() -> size_t {
11083    if server.cluster_enabled == 0 {
11084        return 0 as libc::c_int as size_t;
11085    }
11086    return ((*(*server.cluster).nodes).ht_used[0 as libc::c_int as usize])
11087        .wrapping_add((*(*server.cluster).nodes).ht_used[1 as libc::c_int as usize]);
11088}
11089#[no_mangle]
11090pub unsafe extern "C" fn RM_GetClusterNodeInfo(
11091    mut ctx: *mut RedisModuleCtx,
11092    mut id: *const libc::c_char,
11093    mut ip: *mut libc::c_char,
11094    mut master_id: *mut libc::c_char,
11095    mut port: *mut libc::c_int,
11096    mut flags: *mut libc::c_int,
11097) -> libc::c_int {
11098    let mut node: *mut clusterNode = clusterLookupNode(id, strlen(id) as libc::c_int);
11099    if node.is_null() || (*node).flags & (64 as libc::c_int | 32 as libc::c_int) != 0 {
11100        return 1 as libc::c_int;
11101    }
11102    if !ip.is_null() {
11103        strncpy(ip, ((*node).ip).as_mut_ptr(), 46 as libc::c_int as libc::c_ulong);
11104    }
11105    if !master_id.is_null() {
11106        if (*node).flags & 2 as libc::c_int != 0 && !((*node).slaveof).is_null() {
11107            memcpy(
11108                master_id as *mut libc::c_void,
11109                ((*(*node).slaveof).name).as_mut_ptr() as *const libc::c_void,
11110                40 as libc::c_int as libc::c_ulong,
11111            );
11112        } else {
11113            memset(
11114                master_id as *mut libc::c_void,
11115                0 as libc::c_int,
11116                40 as libc::c_int as libc::c_ulong,
11117            );
11118        }
11119    }
11120    if !port.is_null() {
11121        *port = (*node).port;
11122    }
11123    if !flags.is_null() {
11124        *flags = 0 as libc::c_int;
11125        if (*node).flags & 16 as libc::c_int != 0 {
11126            *flags |= (1 as libc::c_int) << 0 as libc::c_int;
11127        }
11128        if (*node).flags & 1 as libc::c_int != 0 {
11129            *flags |= (1 as libc::c_int) << 1 as libc::c_int;
11130        }
11131        if (*node).flags & 2 as libc::c_int != 0 {
11132            *flags |= (1 as libc::c_int) << 2 as libc::c_int;
11133        }
11134        if (*node).flags & 4 as libc::c_int != 0 {
11135            *flags |= (1 as libc::c_int) << 3 as libc::c_int;
11136        }
11137        if (*node).flags & 8 as libc::c_int != 0 {
11138            *flags |= (1 as libc::c_int) << 4 as libc::c_int;
11139        }
11140        if (*node).flags & 512 as libc::c_int != 0 {
11141            *flags |= (1 as libc::c_int) << 5 as libc::c_int;
11142        }
11143    }
11144    return 0 as libc::c_int;
11145}
11146#[no_mangle]
11147pub unsafe extern "C" fn RM_SetClusterFlags(
11148    mut ctx: *mut RedisModuleCtx,
11149    mut flags: uint64_t,
11150) {
11151    if flags & ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_ulong != 0 {
11152        server.cluster_module_flags |= (1 as libc::c_int) << 1 as libc::c_int;
11153    }
11154    if flags & ((1 as libc::c_int) << 2 as libc::c_int) as libc::c_ulong != 0 {
11155        server.cluster_module_flags |= (1 as libc::c_int) << 2 as libc::c_int;
11156    }
11157}
11158static mut Timers: *mut rax = 0 as *const rax as *mut rax;
11159#[no_mangle]
11160pub static mut aeTimer: libc::c_longlong = -(1 as libc::c_int) as libc::c_longlong;
11161#[no_mangle]
11162pub unsafe extern "C" fn moduleTimerHandler(
11163    mut eventLoop: *mut aeEventLoop,
11164    mut id: libc::c_longlong,
11165    mut clientData: *mut libc::c_void,
11166) -> libc::c_int {
11167    let mut ri: raxIterator = raxIterator {
11168        flags: 0,
11169        rt: 0 as *mut rax,
11170        key: 0 as *mut libc::c_uchar,
11171        data: 0 as *mut libc::c_void,
11172        key_len: 0,
11173        key_max: 0,
11174        key_static_string: [0; 128],
11175        node: 0 as *mut raxNode,
11176        stack: raxStack {
11177            stack: 0 as *mut *mut libc::c_void,
11178            items: 0,
11179            maxitems: 0,
11180            static_items: [0 as *mut libc::c_void; 32],
11181            oom: 0,
11182        },
11183        node_cb: None,
11184    };
11185    raxStart(&mut ri, Timers);
11186    let mut now: uint64_t = ustime() as uint64_t;
11187    let mut next_period: libc::c_longlong = 0 as libc::c_int as libc::c_longlong;
11188    loop {
11189        raxSeek(
11190            &mut ri,
11191            b"^\0" as *const u8 as *const libc::c_char,
11192            0 as *mut libc::c_uchar,
11193            0 as libc::c_int as size_t,
11194        );
11195        if raxNext(&mut ri) == 0 {
11196            break;
11197        }
11198        let mut expiretime: uint64_t = 0;
11199        memcpy(
11200            &mut expiretime as *mut uint64_t as *mut libc::c_void,
11201            ri.key as *const libc::c_void,
11202            core::mem::size_of::<uint64_t>() as libc::c_ulong,
11203        );
11204        expiretime = intrev64(expiretime);
11205        if now >= expiretime {
11206            let mut timer: *mut RedisModuleTimer = ri.data as *mut RedisModuleTimer;
11207            let mut ctx: RedisModuleCtx = RedisModuleCtx {
11208                getapifuncptr: 0 as *mut libc::c_void,
11209                module: 0 as *mut RedisModule,
11210                client: 0 as *mut client,
11211                blocked_client: 0 as *mut RedisModuleBlockedClient,
11212                amqueue: 0 as *mut AutoMemEntry,
11213                amqueue_len: 0,
11214                amqueue_used: 0,
11215                flags: 0,
11216                postponed_arrays: 0 as *mut *mut libc::c_void,
11217                postponed_arrays_count: 0,
11218                blocked_privdata: 0 as *mut libc::c_void,
11219                blocked_ready_key: 0 as *mut robj,
11220                keys_result: 0 as *mut getKeysResult,
11221                pa_head: 0 as *mut RedisModulePoolAllocBlock,
11222                next_yield_time: 0,
11223                user: 0 as *const RedisModuleUser,
11224            };
11225            moduleCreateContext(
11226                &mut ctx,
11227                (*timer).module,
11228                (1 as libc::c_int) << 6 as libc::c_int,
11229            );
11230            selectDb(ctx.client, (*timer).dbid);
11231            ((*timer).callback)
11232                .expect("non-null function pointer")(&mut ctx, (*timer).data);
11233            moduleFreeContext(&mut ctx);
11234            raxRemove(Timers, ri.key, ri.key_len, 0 as *mut *mut libc::c_void);
11235            zfree(timer as *mut libc::c_void);
11236        } else {
11237            next_period = (expiretime as libc::c_longlong - ustime())
11238                / 1000 as libc::c_int as libc::c_longlong;
11239            break;
11240        }
11241    }
11242    raxStop(&mut ri);
11243    if next_period <= 0 as libc::c_int as libc::c_longlong {
11244        next_period = 1 as libc::c_int as libc::c_longlong;
11245    }
11246    if raxSize(Timers) > 0 as libc::c_int as libc::c_ulong {
11247        return next_period as libc::c_int
11248    } else {
11249        aeTimer = -(1 as libc::c_int) as libc::c_longlong;
11250        return -(1 as libc::c_int);
11251    };
11252}
11253#[no_mangle]
11254pub unsafe extern "C" fn RM_CreateTimer(
11255    mut ctx: *mut RedisModuleCtx,
11256    mut period: mstime_t,
11257    mut callback: RedisModuleTimerProc,
11258    mut data: *mut libc::c_void,
11259) -> RedisModuleTimerID {
11260    let mut timer: *mut RedisModuleTimer = zmalloc(
11261        core::mem::size_of::<RedisModuleTimer>() as libc::c_ulong,
11262    ) as *mut RedisModuleTimer;
11263    (*timer).module = (*ctx).module;
11264    (*timer).callback = callback;
11265    (*timer).data = data;
11266    (*timer)
11267        .dbid = if !((*ctx).client).is_null() {
11268        (*(*(*ctx).client).db).id
11269    } else {
11270        0 as libc::c_int
11271    };
11272    let mut expiretime: uint64_t = (ustime()
11273        + period * 1000 as libc::c_int as libc::c_longlong) as uint64_t;
11274    let mut key: uint64_t = 0;
11275    loop {
11276        key = intrev64(expiretime);
11277        if raxFind(
11278            Timers,
11279            &mut key as *mut uint64_t as *mut libc::c_uchar,
11280            core::mem::size_of::<uint64_t>() as libc::c_ulong,
11281        ) == raxNotFound
11282        {
11283            raxInsert(
11284                Timers,
11285                &mut key as *mut uint64_t as *mut libc::c_uchar,
11286                core::mem::size_of::<uint64_t>() as libc::c_ulong,
11287                timer as *mut libc::c_void,
11288                0 as *mut *mut libc::c_void,
11289            );
11290            break;
11291        } else {
11292            expiretime = expiretime.wrapping_add(1);
11293        }
11294    }
11295    if aeTimer != -(1 as libc::c_int) as libc::c_longlong {
11296        let mut ri: raxIterator = raxIterator {
11297            flags: 0,
11298            rt: 0 as *mut rax,
11299            key: 0 as *mut libc::c_uchar,
11300            data: 0 as *mut libc::c_void,
11301            key_len: 0,
11302            key_max: 0,
11303            key_static_string: [0; 128],
11304            node: 0 as *mut raxNode,
11305            stack: raxStack {
11306                stack: 0 as *mut *mut libc::c_void,
11307                items: 0,
11308                maxitems: 0,
11309                static_items: [0 as *mut libc::c_void; 32],
11310                oom: 0,
11311            },
11312            node_cb: None,
11313        };
11314        raxStart(&mut ri, Timers);
11315        raxSeek(
11316            &mut ri,
11317            b"^\0" as *const u8 as *const libc::c_char,
11318            0 as *mut libc::c_uchar,
11319            0 as libc::c_int as size_t,
11320        );
11321        raxNext(&mut ri);
11322        if memcmp(
11323            ri.key as *const libc::c_void,
11324            &mut key as *mut uint64_t as *const libc::c_void,
11325            core::mem::size_of::<uint64_t>() as libc::c_ulong,
11326        ) == 0 as libc::c_int
11327        {
11328            aeDeleteTimeEvent(server.el, aeTimer);
11329            aeTimer = -(1 as libc::c_int) as libc::c_longlong;
11330        }
11331        raxStop(&mut ri);
11332    }
11333    if aeTimer == -(1 as libc::c_int) as libc::c_longlong {
11334        aeTimer = aeCreateTimeEvent(
11335            server.el,
11336            period,
11337            Some(
11338                moduleTimerHandler
11339                    as unsafe extern "C" fn(
11340                        *mut aeEventLoop,
11341                        libc::c_longlong,
11342                        *mut libc::c_void,
11343                    ) -> libc::c_int,
11344            ),
11345            0 as *mut libc::c_void,
11346            None,
11347        );
11348    }
11349    return key;
11350}
11351#[no_mangle]
11352pub unsafe extern "C" fn RM_StopTimer(
11353    mut ctx: *mut RedisModuleCtx,
11354    mut id: RedisModuleTimerID,
11355    mut data: *mut *mut libc::c_void,
11356) -> libc::c_int {
11357    let mut timer: *mut RedisModuleTimer = raxFind(
11358        Timers,
11359        &mut id as *mut RedisModuleTimerID as *mut libc::c_uchar,
11360        core::mem::size_of::<RedisModuleTimerID>() as libc::c_ulong,
11361    ) as *mut RedisModuleTimer;
11362    if timer == raxNotFound as *mut RedisModuleTimer || (*timer).module != (*ctx).module
11363    {
11364        return 1 as libc::c_int;
11365    }
11366    if !data.is_null() {
11367        *data = (*timer).data;
11368    }
11369    raxRemove(
11370        Timers,
11371        &mut id as *mut RedisModuleTimerID as *mut libc::c_uchar,
11372        core::mem::size_of::<RedisModuleTimerID>() as libc::c_ulong,
11373        0 as *mut *mut libc::c_void,
11374    );
11375    zfree(timer as *mut libc::c_void);
11376    return 0 as libc::c_int;
11377}
11378#[no_mangle]
11379pub unsafe extern "C" fn RM_GetTimerInfo(
11380    mut ctx: *mut RedisModuleCtx,
11381    mut id: RedisModuleTimerID,
11382    mut remaining: *mut uint64_t,
11383    mut data: *mut *mut libc::c_void,
11384) -> libc::c_int {
11385    let mut timer: *mut RedisModuleTimer = raxFind(
11386        Timers,
11387        &mut id as *mut RedisModuleTimerID as *mut libc::c_uchar,
11388        core::mem::size_of::<RedisModuleTimerID>() as libc::c_ulong,
11389    ) as *mut RedisModuleTimer;
11390    if timer == raxNotFound as *mut RedisModuleTimer || (*timer).module != (*ctx).module
11391    {
11392        return 1 as libc::c_int;
11393    }
11394    if !remaining.is_null() {
11395        let mut rem: int64_t = (intrev64(id) as libc::c_ulonglong)
11396            .wrapping_sub(ustime() as libc::c_ulonglong) as int64_t;
11397        if rem < 0 as libc::c_int as libc::c_long {
11398            rem = 0 as libc::c_int as int64_t;
11399        }
11400        *remaining = (rem / 1000 as libc::c_int as libc::c_long) as uint64_t;
11401    }
11402    if !data.is_null() {
11403        *data = (*timer).data;
11404    }
11405    return 0 as libc::c_int;
11406}
11407#[no_mangle]
11408pub unsafe extern "C" fn moduleHoldsTimer(mut module: *mut RedisModule) -> libc::c_int {
11409    let mut iter: raxIterator = raxIterator {
11410        flags: 0,
11411        rt: 0 as *mut rax,
11412        key: 0 as *mut libc::c_uchar,
11413        data: 0 as *mut libc::c_void,
11414        key_len: 0,
11415        key_max: 0,
11416        key_static_string: [0; 128],
11417        node: 0 as *mut raxNode,
11418        stack: raxStack {
11419            stack: 0 as *mut *mut libc::c_void,
11420            items: 0,
11421            maxitems: 0,
11422            static_items: [0 as *mut libc::c_void; 32],
11423            oom: 0,
11424        },
11425        node_cb: None,
11426    };
11427    let mut found: libc::c_int = 0 as libc::c_int;
11428    raxStart(&mut iter, Timers);
11429    raxSeek(
11430        &mut iter,
11431        b"^\0" as *const u8 as *const libc::c_char,
11432        0 as *mut libc::c_uchar,
11433        0 as libc::c_int as size_t,
11434    );
11435    while raxNext(&mut iter) != 0 {
11436        let mut timer: *mut RedisModuleTimer = iter.data as *mut RedisModuleTimer;
11437        if !((*timer).module == module) {
11438            continue;
11439        }
11440        found = 1 as libc::c_int;
11441        break;
11442    }
11443    raxStop(&mut iter);
11444    return found;
11445}
11446#[no_mangle]
11447pub static mut moduleEventLoopOneShots: *mut list = 0 as *const list as *mut list;
11448static mut moduleEventLoopMutex: pthread_mutex_t = pthread_mutex_t {
11449    __data: {
11450        let mut init = __pthread_mutex_s {
11451            __lock: 0 as libc::c_int,
11452            __count: 0 as libc::c_int as libc::c_uint,
11453            __owner: 0 as libc::c_int,
11454            __nusers: 0 as libc::c_int as libc::c_uint,
11455            __kind: PTHREAD_MUTEX_TIMED_NP as libc::c_int,
11456            __spins: 0 as libc::c_int,
11457            __list: {
11458                let mut init = __pthread_internal_list {
11459                    __prev: 0 as *const __pthread_internal_list
11460                        as *mut __pthread_internal_list,
11461                    __next: 0 as *const __pthread_internal_list
11462                        as *mut __pthread_internal_list,
11463                };
11464                init
11465            },
11466        };
11467        init
11468    },
11469};
11470unsafe extern "C" fn eventLoopToAeMask(mut mask: libc::c_int) -> libc::c_int {
11471    let mut aeMask: libc::c_int = 0 as libc::c_int;
11472    if mask & 1 as libc::c_int != 0 {
11473        aeMask |= 1 as libc::c_int;
11474    }
11475    if mask & 2 as libc::c_int != 0 {
11476        aeMask |= 2 as libc::c_int;
11477    }
11478    return aeMask;
11479}
11480unsafe extern "C" fn eventLoopFromAeMask(mut ae_mask: libc::c_int) -> libc::c_int {
11481    let mut mask: libc::c_int = 0 as libc::c_int;
11482    if ae_mask & 1 as libc::c_int != 0 {
11483        mask |= 1 as libc::c_int;
11484    }
11485    if ae_mask & 2 as libc::c_int != 0 {
11486        mask |= 2 as libc::c_int;
11487    }
11488    return mask;
11489}
11490unsafe extern "C" fn eventLoopCbReadable(
11491    mut ae: *mut aeEventLoop,
11492    mut fd: libc::c_int,
11493    mut user_data: *mut libc::c_void,
11494    mut ae_mask: libc::c_int,
11495) {
11496    let mut data: *mut EventLoopData = user_data as *mut EventLoopData;
11497    ((*data).rFunc)
11498        .expect(
11499            "non-null function pointer",
11500        )(fd, (*data).user_data, eventLoopFromAeMask(ae_mask));
11501}
11502unsafe extern "C" fn eventLoopCbWritable(
11503    mut ae: *mut aeEventLoop,
11504    mut fd: libc::c_int,
11505    mut user_data: *mut libc::c_void,
11506    mut ae_mask: libc::c_int,
11507) {
11508    let mut data: *mut EventLoopData = user_data as *mut EventLoopData;
11509    ((*data).wFunc)
11510        .expect(
11511            "non-null function pointer",
11512        )(fd, (*data).user_data, eventLoopFromAeMask(ae_mask));
11513}
11514#[no_mangle]
11515pub unsafe extern "C" fn RM_EventLoopAdd(
11516    mut fd: libc::c_int,
11517    mut mask: libc::c_int,
11518    mut func: RedisModuleEventLoopFunc,
11519    mut user_data: *mut libc::c_void,
11520) -> libc::c_int {
11521    if fd < 0 as libc::c_int || fd >= aeGetSetSize(server.el) {
11522        *__errno_location() = 34 as libc::c_int;
11523        return 1 as libc::c_int;
11524    }
11525    if func.is_none() || mask & !(1 as libc::c_int | 2 as libc::c_int) != 0 {
11526        *__errno_location() = 22 as libc::c_int;
11527        return 1 as libc::c_int;
11528    }
11529    let mut data: *mut EventLoopData = aeGetFileClientData(server.el, fd)
11530        as *mut EventLoopData;
11531    if data.is_null() {
11532        data = zcalloc(core::mem::size_of::<EventLoopData>() as libc::c_ulong)
11533            as *mut EventLoopData;
11534    }
11535    let mut aeProc: Option::<aeFileProc> = None;
11536    if mask & 1 as libc::c_int != 0 {
11537        aeProc = Some(
11538            eventLoopCbReadable
11539                as unsafe extern "C" fn(
11540                    *mut aeEventLoop,
11541                    libc::c_int,
11542                    *mut libc::c_void,
11543                    libc::c_int,
11544                ) -> (),
11545        );
11546    } else {
11547        aeProc = Some(
11548            eventLoopCbWritable
11549                as unsafe extern "C" fn(
11550                    *mut aeEventLoop,
11551                    libc::c_int,
11552                    *mut libc::c_void,
11553                    libc::c_int,
11554                ) -> (),
11555        );
11556    }
11557    let mut aeMask: libc::c_int = eventLoopToAeMask(mask);
11558    if aeCreateFileEvent(server.el, fd, aeMask, aeProc, data as *mut libc::c_void)
11559        != 0 as libc::c_int
11560    {
11561        if aeGetFileEvents(server.el, fd) == 0 as libc::c_int {
11562            zfree(data as *mut libc::c_void);
11563        }
11564        return 1 as libc::c_int;
11565    }
11566    (*data).user_data = user_data;
11567    if mask & 1 as libc::c_int != 0 {
11568        (*data).rFunc = func;
11569    }
11570    if mask & 2 as libc::c_int != 0 {
11571        (*data).wFunc = func;
11572    }
11573    *__errno_location() = 0 as libc::c_int;
11574    return 0 as libc::c_int;
11575}
11576#[no_mangle]
11577pub unsafe extern "C" fn RM_EventLoopDel(
11578    mut fd: libc::c_int,
11579    mut mask: libc::c_int,
11580) -> libc::c_int {
11581    if fd < 0 as libc::c_int || fd >= aeGetSetSize(server.el) {
11582        *__errno_location() = 34 as libc::c_int;
11583        return 1 as libc::c_int;
11584    }
11585    if mask & !(1 as libc::c_int | 2 as libc::c_int) != 0 {
11586        *__errno_location() = 22 as libc::c_int;
11587        return 1 as libc::c_int;
11588    }
11589    let mut data: *mut EventLoopData = aeGetFileClientData(server.el, fd)
11590        as *mut EventLoopData;
11591    aeDeleteFileEvent(server.el, fd, eventLoopToAeMask(mask));
11592    if aeGetFileEvents(server.el, fd) == 0 as libc::c_int {
11593        zfree(data as *mut libc::c_void);
11594    }
11595    *__errno_location() = 0 as libc::c_int;
11596    return 0 as libc::c_int;
11597}
11598#[no_mangle]
11599pub unsafe extern "C" fn RM_EventLoopAddOneShot(
11600    mut func: RedisModuleEventLoopOneShotFunc,
11601    mut user_data: *mut libc::c_void,
11602) -> libc::c_int {
11603    if func.is_none() {
11604        *__errno_location() = 22 as libc::c_int;
11605        return 1 as libc::c_int;
11606    }
11607    let mut oneshot: *mut EventLoopOneShot = zmalloc(
11608        core::mem::size_of::<EventLoopOneShot>() as libc::c_ulong,
11609    ) as *mut EventLoopOneShot;
11610    (*oneshot).func = func;
11611    (*oneshot).user_data = user_data;
11612    pthread_mutex_lock(&mut moduleEventLoopMutex);
11613    if moduleEventLoopOneShots.is_null() {
11614        moduleEventLoopOneShots = listCreate();
11615    }
11616    listAddNodeTail(moduleEventLoopOneShots, oneshot as *mut libc::c_void);
11617    pthread_mutex_unlock(&mut moduleEventLoopMutex);
11618    write(
11619        server.module_pipe[1 as libc::c_int as usize],
11620        b"A\0" as *const u8 as *const libc::c_char as *const libc::c_void,
11621        1 as libc::c_int as size_t,
11622    ) != 1 as libc::c_int as libc::c_long;
11623    *__errno_location() = 0 as libc::c_int;
11624    return 0 as libc::c_int;
11625}
11626unsafe extern "C" fn eventLoopHandleOneShotEvents() {
11627    pthread_mutex_lock(&mut moduleEventLoopMutex);
11628    if !moduleEventLoopOneShots.is_null() {
11629        while (*moduleEventLoopOneShots).len != 0 {
11630            let mut ln: *mut listNode = (*moduleEventLoopOneShots).head;
11631            let mut oneshot: *mut EventLoopOneShot = (*ln).value
11632                as *mut EventLoopOneShot;
11633            listDelNode(moduleEventLoopOneShots, ln);
11634            pthread_mutex_unlock(&mut moduleEventLoopMutex);
11635            ((*oneshot).func).expect("non-null function pointer")((*oneshot).user_data);
11636            zfree(oneshot as *mut libc::c_void);
11637            pthread_mutex_lock(&mut moduleEventLoopMutex);
11638        }
11639    }
11640    pthread_mutex_unlock(&mut moduleEventLoopMutex);
11641}
11642#[no_mangle]
11643pub unsafe extern "C" fn moduleNotifyUserChanged(mut c: *mut client) {
11644    if ((*c).auth_callback).is_some() {
11645        ((*c).auth_callback)
11646            .expect("non-null function pointer")((*c).id, (*c).auth_callback_privdata);
11647        (*c).auth_callback = None;
11648        (*c).auth_callback_privdata = 0 as *mut libc::c_void;
11649        (*c).auth_module = 0 as *mut libc::c_void;
11650    }
11651}
11652#[no_mangle]
11653pub unsafe extern "C" fn revokeClientAuthentication(mut c: *mut client) {
11654    moduleNotifyUserChanged(c);
11655    (*c).user = DefaultUser;
11656    (*c).authenticated = 0 as libc::c_int;
11657    if c == server.current_client {
11658        (*c)
11659            .flags = ((*c).flags as libc::c_ulonglong
11660            | (1 as libc::c_ulonglong) << 40 as libc::c_int) as uint64_t;
11661    } else {
11662        freeClientAsync(c);
11663    };
11664}
11665unsafe extern "C" fn moduleFreeAuthenticatedClients(mut module: *mut RedisModule) {
11666    let mut li: listIter = listIter {
11667        next: 0 as *mut listNode,
11668        direction: 0,
11669    };
11670    let mut ln: *mut listNode = 0 as *mut listNode;
11671    listRewind(server.clients, &mut li);
11672    loop {
11673        ln = listNext(&mut li);
11674        if ln.is_null() {
11675            break;
11676        }
11677        let mut c: *mut client = (*ln).value as *mut client;
11678        if ((*c).auth_module).is_null() {
11679            continue;
11680        }
11681        let mut auth_module: *mut RedisModule = (*c).auth_module as *mut RedisModule;
11682        if auth_module == module {
11683            revokeClientAuthentication(c);
11684        }
11685    };
11686}
11687#[no_mangle]
11688pub unsafe extern "C" fn RM_CreateModuleUser(
11689    mut name: *const libc::c_char,
11690) -> *mut RedisModuleUser {
11691    let mut new_user: *mut RedisModuleUser = zmalloc(
11692        core::mem::size_of::<RedisModuleUser>() as libc::c_ulong,
11693    ) as *mut RedisModuleUser;
11694    (*new_user).user = ACLCreateUnlinkedUser();
11695    (*new_user).free_user = 1 as libc::c_int;
11696    sdsfree((*(*new_user).user).name);
11697    (*(*new_user).user).name = sdsnew(name);
11698    return new_user;
11699}
11700#[no_mangle]
11701pub unsafe extern "C" fn RM_FreeModuleUser(
11702    mut user: *mut RedisModuleUser,
11703) -> libc::c_int {
11704    if (*user).free_user != 0 {
11705        ACLFreeUserAndKillClients((*user).user);
11706    }
11707    zfree(user as *mut libc::c_void);
11708    return 0 as libc::c_int;
11709}
11710#[no_mangle]
11711pub unsafe extern "C" fn RM_SetModuleUserACL(
11712    mut user: *mut RedisModuleUser,
11713    mut acl: *const libc::c_char,
11714) -> libc::c_int {
11715    return ACLSetUser((*user).user, acl, -(1 as libc::c_int) as ssize_t);
11716}
11717#[no_mangle]
11718pub unsafe extern "C" fn RM_SetModuleUserACLString(
11719    mut ctx: *mut RedisModuleCtx,
11720    mut user: *mut RedisModuleUser,
11721    mut acl: *const libc::c_char,
11722    mut error: *mut *mut robj,
11723) -> libc::c_int {
11724    if !user.is_null() {} else {
11725        _serverAssert(
11726            b"user != NULL\0" as *const u8 as *const libc::c_char,
11727            b"module.c\0" as *const u8 as *const libc::c_char,
11728            8714 as libc::c_int,
11729        );
11730        unreachable!();
11731    };
11732    let mut argc: libc::c_int = 0;
11733    let mut argv: *mut sds = sdssplitargs(acl, &mut argc);
11734    let mut err: sds = ACLStringSetUser((*user).user, 0 as sds, argv, argc);
11735    sdsfreesplitres(argv, argc);
11736    if !err.is_null() {
11737        if !error.is_null() {
11738            *error = createObject(0 as libc::c_int, err as *mut libc::c_void);
11739            if !ctx.is_null() {
11740                autoMemoryAdd(ctx, 1 as libc::c_int, *error as *mut libc::c_void);
11741            }
11742        } else {
11743            sdsfree(err);
11744        }
11745        return 1 as libc::c_int;
11746    }
11747    return 0 as libc::c_int;
11748}
11749#[no_mangle]
11750pub unsafe extern "C" fn RM_GetModuleUserACLString(
11751    mut user: *mut RedisModuleUser,
11752) -> *mut robj {
11753    if !user.is_null() {} else {
11754        _serverAssert(
11755            b"user != NULL\0" as *const u8 as *const libc::c_char,
11756            b"module.c\0" as *const u8 as *const libc::c_char,
11757            8741 as libc::c_int,
11758        );
11759        unreachable!();
11760    };
11761    return ACLDescribeUser((*user).user);
11762}
11763#[no_mangle]
11764pub unsafe extern "C" fn RM_GetCurrentUserName(
11765    mut ctx: *mut RedisModuleCtx,
11766) -> *mut robj {
11767    return RM_CreateString(
11768        ctx,
11769        (*(*(*ctx).client).user).name as *const libc::c_char,
11770        sdslen((*(*(*ctx).client).user).name),
11771    );
11772}
11773#[no_mangle]
11774pub unsafe extern "C" fn RM_GetModuleUserFromUserName(
11775    mut name: *mut robj,
11776) -> *mut RedisModuleUser {
11777    let mut acl_user: *mut user = ACLGetUserByName(
11778        (*name).ptr as *const libc::c_char,
11779        sdslen((*name).ptr as sds),
11780    );
11781    if acl_user.is_null() {
11782        return 0 as *mut RedisModuleUser;
11783    }
11784    let mut new_user: *mut RedisModuleUser = zmalloc(
11785        core::mem::size_of::<RedisModuleUser>() as libc::c_ulong,
11786    ) as *mut RedisModuleUser;
11787    (*new_user).user = acl_user;
11788    (*new_user).free_user = 0 as libc::c_int;
11789    return new_user;
11790}
11791#[no_mangle]
11792pub unsafe extern "C" fn RM_ACLCheckCommandPermissions(
11793    mut user: *mut RedisModuleUser,
11794    mut argv: *mut *mut robj,
11795    mut argc: libc::c_int,
11796) -> libc::c_int {
11797    let mut keyidxptr: libc::c_int = 0;
11798    let mut cmd: *mut redisCommand = 0 as *mut redisCommand;
11799    cmd = lookupCommand(argv, argc);
11800    if cmd.is_null() {
11801        *__errno_location() = 2 as libc::c_int;
11802        return 1 as libc::c_int;
11803    }
11804    if ACLCheckAllUserCommandPerm((*user).user, cmd, argv, argc, &mut keyidxptr)
11805        != 0 as libc::c_int
11806    {
11807        *__errno_location() = 13 as libc::c_int;
11808        return 1 as libc::c_int;
11809    }
11810    return 0 as libc::c_int;
11811}
11812#[no_mangle]
11813pub unsafe extern "C" fn RM_ACLCheckKeyPermissions(
11814    mut user: *mut RedisModuleUser,
11815    mut key: *mut robj,
11816    mut flags: libc::c_int,
11817) -> libc::c_int {
11818    let allow_mask: libc::c_int = ((1 as libc::c_ulonglong) << 4 as libc::c_int
11819        | (1 as libc::c_ulonglong) << 6 as libc::c_int
11820        | (1 as libc::c_ulonglong) << 7 as libc::c_int
11821        | (1 as libc::c_ulonglong) << 5 as libc::c_int) as libc::c_int;
11822    if flags & allow_mask != flags {
11823        *__errno_location() = 22 as libc::c_int;
11824        return 1 as libc::c_int;
11825    }
11826    let mut keyspec_flags: libc::c_int = moduleConvertKeySpecsFlags(
11827        flags as int64_t,
11828        0 as libc::c_int,
11829    ) as libc::c_int;
11830    if ACLUserCheckKeyPerm(
11831        (*user).user,
11832        (*key).ptr as *const libc::c_char,
11833        sdslen((*key).ptr as sds) as libc::c_int,
11834        keyspec_flags,
11835    ) != 0 as libc::c_int
11836    {
11837        *__errno_location() = 13 as libc::c_int;
11838        return 1 as libc::c_int;
11839    }
11840    return 0 as libc::c_int;
11841}
11842#[no_mangle]
11843pub unsafe extern "C" fn RM_ACLCheckChannelPermissions(
11844    mut user: *mut RedisModuleUser,
11845    mut ch: *mut robj,
11846    mut flags: libc::c_int,
11847) -> libc::c_int {
11848    let allow_mask: libc::c_int = ((1 as libc::c_ulonglong) << 1 as libc::c_int
11849        | (1 as libc::c_ulonglong) << 2 as libc::c_int
11850        | (1 as libc::c_ulonglong) << 3 as libc::c_int
11851        | (1 as libc::c_ulonglong) << 0 as libc::c_int) as libc::c_int;
11852    if flags & allow_mask != flags {
11853        *__errno_location() = 22 as libc::c_int;
11854        return 1 as libc::c_int;
11855    }
11856    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 3 as libc::c_int != 0 {
11857        return 0 as libc::c_int;
11858    }
11859    let mut is_pattern: libc::c_int = (flags as libc::c_ulonglong
11860        & (1 as libc::c_ulonglong) << 0 as libc::c_int) as libc::c_int;
11861    if ACLUserCheckChannelPerm((*user).user, (*ch).ptr as sds, is_pattern)
11862        != 0 as libc::c_int
11863    {
11864        return 1 as libc::c_int;
11865    }
11866    return 0 as libc::c_int;
11867}
11868#[no_mangle]
11869pub unsafe extern "C" fn RM_ACLAddLogEntry(
11870    mut ctx: *mut RedisModuleCtx,
11871    mut user: *mut RedisModuleUser,
11872    mut object: *mut robj,
11873    mut reason: RedisModuleACLLogEntryReason,
11874) -> libc::c_int {
11875    let mut acl_reason: libc::c_int = 0;
11876    match reason as libc::c_uint {
11877        0 => {
11878            acl_reason = 3 as libc::c_int;
11879        }
11880        2 => {
11881            acl_reason = 2 as libc::c_int;
11882        }
11883        3 => {
11884            acl_reason = 4 as libc::c_int;
11885        }
11886        1 => {
11887            acl_reason = 1 as libc::c_int;
11888        }
11889        _ => return 1 as libc::c_int,
11890    }
11891    addACLLogEntry(
11892        (*ctx).client,
11893        acl_reason,
11894        3 as libc::c_int,
11895        -(1 as libc::c_int),
11896        (*(*user).user).name,
11897        sdsdup((*object).ptr as sds),
11898    );
11899    return 0 as libc::c_int;
11900}
11901unsafe extern "C" fn authenticateClientWithUser(
11902    mut ctx: *mut RedisModuleCtx,
11903    mut user: *mut user,
11904    mut callback: RedisModuleUserChangedFunc,
11905    mut privdata: *mut libc::c_void,
11906    mut client_id: *mut uint64_t,
11907) -> libc::c_int {
11908    if (*user).flags & ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint != 0 {
11909        return 1 as libc::c_int;
11910    }
11911    if ((*ctx).client).is_null()
11912        || (*(*ctx).client).flags
11913            & ((1 as libc::c_int) << 27 as libc::c_int) as libc::c_ulong != 0
11914    {
11915        return 1 as libc::c_int;
11916    }
11917    moduleNotifyUserChanged((*ctx).client);
11918    (*(*ctx).client).user = user;
11919    (*(*ctx).client).authenticated = 1 as libc::c_int;
11920    if callback.is_some() {
11921        (*(*ctx).client).auth_callback = callback;
11922        (*(*ctx).client).auth_callback_privdata = privdata;
11923        (*(*ctx).client).auth_module = (*ctx).module as *mut libc::c_void;
11924    }
11925    if !client_id.is_null() {
11926        *client_id = (*(*ctx).client).id;
11927    }
11928    return 0 as libc::c_int;
11929}
11930#[no_mangle]
11931pub unsafe extern "C" fn RM_AuthenticateClientWithUser(
11932    mut ctx: *mut RedisModuleCtx,
11933    mut module_user: *mut RedisModuleUser,
11934    mut callback: RedisModuleUserChangedFunc,
11935    mut privdata: *mut libc::c_void,
11936    mut client_id: *mut uint64_t,
11937) -> libc::c_int {
11938    return authenticateClientWithUser(
11939        ctx,
11940        (*module_user).user,
11941        callback,
11942        privdata,
11943        client_id,
11944    );
11945}
11946#[no_mangle]
11947pub unsafe extern "C" fn RM_AuthenticateClientWithACLUser(
11948    mut ctx: *mut RedisModuleCtx,
11949    mut name: *const libc::c_char,
11950    mut len: size_t,
11951    mut callback: RedisModuleUserChangedFunc,
11952    mut privdata: *mut libc::c_void,
11953    mut client_id: *mut uint64_t,
11954) -> libc::c_int {
11955    let mut acl_user: *mut user = ACLGetUserByName(name, len);
11956    if acl_user.is_null() {
11957        return 1 as libc::c_int;
11958    }
11959    return authenticateClientWithUser(ctx, acl_user, callback, privdata, client_id);
11960}
11961#[no_mangle]
11962pub unsafe extern "C" fn RM_DeauthenticateAndCloseClient(
11963    mut ctx: *mut RedisModuleCtx,
11964    mut client_id: uint64_t,
11965) -> libc::c_int {
11966    let mut c: *mut client = lookupClientByID(client_id);
11967    if c.is_null() {
11968        return 1 as libc::c_int;
11969    }
11970    revokeClientAuthentication(c);
11971    return 0 as libc::c_int;
11972}
11973#[no_mangle]
11974pub unsafe extern "C" fn RM_RedactClientCommandArgument(
11975    mut ctx: *mut RedisModuleCtx,
11976    mut pos: libc::c_int,
11977) -> libc::c_int {
11978    if ctx.is_null() || ((*ctx).client).is_null() || pos <= 0 as libc::c_int
11979        || (*(*ctx).client).argc <= pos
11980    {
11981        return 1 as libc::c_int;
11982    }
11983    redactClientCommandArgument((*ctx).client, pos);
11984    return 0 as libc::c_int;
11985}
11986#[no_mangle]
11987pub unsafe extern "C" fn RM_GetClientCertificate(
11988    mut ctx: *mut RedisModuleCtx,
11989    mut client_id: uint64_t,
11990) -> *mut robj {
11991    let mut c: *mut client = lookupClientByID(client_id);
11992    if c.is_null() {
11993        return 0 as *mut robj;
11994    }
11995    let mut cert: sds = connTLSGetPeerCert((*c).conn);
11996    if cert.is_null() {
11997        return 0 as *mut robj;
11998    }
11999    let mut s: *mut robj = createObject(0 as libc::c_int, cert as *mut libc::c_void);
12000    if !ctx.is_null() {
12001        autoMemoryAdd(ctx, 1 as libc::c_int, s as *mut libc::c_void);
12002    }
12003    return s;
12004}
12005#[no_mangle]
12006pub unsafe extern "C" fn RM_CreateDict(
12007    mut ctx: *mut RedisModuleCtx,
12008) -> *mut RedisModuleDict {
12009    let mut d: *mut RedisModuleDict = zmalloc(
12010        core::mem::size_of::<RedisModuleDict>() as libc::c_ulong,
12011    ) as *mut RedisModuleDict;
12012    (*d).rax = raxNew();
12013    if !ctx.is_null() {
12014        autoMemoryAdd(ctx, 4 as libc::c_int, d as *mut libc::c_void);
12015    }
12016    return d;
12017}
12018#[no_mangle]
12019pub unsafe extern "C" fn RM_FreeDict(
12020    mut ctx: *mut RedisModuleCtx,
12021    mut d: *mut RedisModuleDict,
12022) {
12023    if !ctx.is_null() {
12024        autoMemoryFreed(ctx, 4 as libc::c_int, d as *mut libc::c_void);
12025    }
12026    raxFree((*d).rax);
12027    zfree(d as *mut libc::c_void);
12028}
12029#[no_mangle]
12030pub unsafe extern "C" fn RM_DictSize(mut d: *mut RedisModuleDict) -> uint64_t {
12031    return raxSize((*d).rax);
12032}
12033#[no_mangle]
12034pub unsafe extern "C" fn RM_DictSetC(
12035    mut d: *mut RedisModuleDict,
12036    mut key: *mut libc::c_void,
12037    mut keylen: size_t,
12038    mut ptr: *mut libc::c_void,
12039) -> libc::c_int {
12040    let mut retval: libc::c_int = raxTryInsert(
12041        (*d).rax,
12042        key as *mut libc::c_uchar,
12043        keylen,
12044        ptr,
12045        0 as *mut *mut libc::c_void,
12046    );
12047    return if retval == 1 as libc::c_int { 0 as libc::c_int } else { 1 as libc::c_int };
12048}
12049#[no_mangle]
12050pub unsafe extern "C" fn RM_DictReplaceC(
12051    mut d: *mut RedisModuleDict,
12052    mut key: *mut libc::c_void,
12053    mut keylen: size_t,
12054    mut ptr: *mut libc::c_void,
12055) -> libc::c_int {
12056    let mut retval: libc::c_int = raxInsert(
12057        (*d).rax,
12058        key as *mut libc::c_uchar,
12059        keylen,
12060        ptr,
12061        0 as *mut *mut libc::c_void,
12062    );
12063    return if retval == 1 as libc::c_int { 0 as libc::c_int } else { 1 as libc::c_int };
12064}
12065#[no_mangle]
12066pub unsafe extern "C" fn RM_DictSet(
12067    mut d: *mut RedisModuleDict,
12068    mut key: *mut robj,
12069    mut ptr: *mut libc::c_void,
12070) -> libc::c_int {
12071    return RM_DictSetC(d, (*key).ptr, sdslen((*key).ptr as sds), ptr);
12072}
12073#[no_mangle]
12074pub unsafe extern "C" fn RM_DictReplace(
12075    mut d: *mut RedisModuleDict,
12076    mut key: *mut robj,
12077    mut ptr: *mut libc::c_void,
12078) -> libc::c_int {
12079    return RM_DictReplaceC(d, (*key).ptr, sdslen((*key).ptr as sds), ptr);
12080}
12081#[no_mangle]
12082pub unsafe extern "C" fn RM_DictGetC(
12083    mut d: *mut RedisModuleDict,
12084    mut key: *mut libc::c_void,
12085    mut keylen: size_t,
12086    mut nokey: *mut libc::c_int,
12087) -> *mut libc::c_void {
12088    let mut res: *mut libc::c_void = raxFind(
12089        (*d).rax,
12090        key as *mut libc::c_uchar,
12091        keylen,
12092    );
12093    if !nokey.is_null() {
12094        *nokey = (res == raxNotFound) as libc::c_int;
12095    }
12096    return if res == raxNotFound { 0 as *mut libc::c_void } else { res };
12097}
12098#[no_mangle]
12099pub unsafe extern "C" fn RM_DictGet(
12100    mut d: *mut RedisModuleDict,
12101    mut key: *mut robj,
12102    mut nokey: *mut libc::c_int,
12103) -> *mut libc::c_void {
12104    return RM_DictGetC(d, (*key).ptr, sdslen((*key).ptr as sds), nokey);
12105}
12106#[no_mangle]
12107pub unsafe extern "C" fn RM_DictDelC(
12108    mut d: *mut RedisModuleDict,
12109    mut key: *mut libc::c_void,
12110    mut keylen: size_t,
12111    mut oldval: *mut libc::c_void,
12112) -> libc::c_int {
12113    let mut retval: libc::c_int = raxRemove(
12114        (*d).rax,
12115        key as *mut libc::c_uchar,
12116        keylen,
12117        oldval as *mut *mut libc::c_void,
12118    );
12119    return if retval != 0 { 0 as libc::c_int } else { 1 as libc::c_int };
12120}
12121#[no_mangle]
12122pub unsafe extern "C" fn RM_DictDel(
12123    mut d: *mut RedisModuleDict,
12124    mut key: *mut robj,
12125    mut oldval: *mut libc::c_void,
12126) -> libc::c_int {
12127    return RM_DictDelC(d, (*key).ptr, sdslen((*key).ptr as sds), oldval);
12128}
12129#[no_mangle]
12130pub unsafe extern "C" fn RM_DictIteratorStartC(
12131    mut d: *mut RedisModuleDict,
12132    mut op: *const libc::c_char,
12133    mut key: *mut libc::c_void,
12134    mut keylen: size_t,
12135) -> *mut RedisModuleDictIter {
12136    let mut di: *mut RedisModuleDictIter = zmalloc(
12137        core::mem::size_of::<RedisModuleDictIter>() as libc::c_ulong,
12138    ) as *mut RedisModuleDictIter;
12139    (*di).dict = d;
12140    raxStart(&mut (*di).ri, (*d).rax);
12141    raxSeek(&mut (*di).ri, op, key as *mut libc::c_uchar, keylen);
12142    return di;
12143}
12144#[no_mangle]
12145pub unsafe extern "C" fn RM_DictIteratorStart(
12146    mut d: *mut RedisModuleDict,
12147    mut op: *const libc::c_char,
12148    mut key: *mut robj,
12149) -> *mut RedisModuleDictIter {
12150    return RM_DictIteratorStartC(d, op, (*key).ptr, sdslen((*key).ptr as sds));
12151}
12152#[no_mangle]
12153pub unsafe extern "C" fn RM_DictIteratorStop(mut di: *mut RedisModuleDictIter) {
12154    raxStop(&mut (*di).ri);
12155    zfree(di as *mut libc::c_void);
12156}
12157#[no_mangle]
12158pub unsafe extern "C" fn RM_DictIteratorReseekC(
12159    mut di: *mut RedisModuleDictIter,
12160    mut op: *const libc::c_char,
12161    mut key: *mut libc::c_void,
12162    mut keylen: size_t,
12163) -> libc::c_int {
12164    return raxSeek(&mut (*di).ri, op, key as *mut libc::c_uchar, keylen);
12165}
12166#[no_mangle]
12167pub unsafe extern "C" fn RM_DictIteratorReseek(
12168    mut di: *mut RedisModuleDictIter,
12169    mut op: *const libc::c_char,
12170    mut key: *mut robj,
12171) -> libc::c_int {
12172    return RM_DictIteratorReseekC(di, op, (*key).ptr, sdslen((*key).ptr as sds));
12173}
12174#[no_mangle]
12175pub unsafe extern "C" fn RM_DictNextC(
12176    mut di: *mut RedisModuleDictIter,
12177    mut keylen: *mut size_t,
12178    mut dataptr: *mut *mut libc::c_void,
12179) -> *mut libc::c_void {
12180    if raxNext(&mut (*di).ri) == 0 {
12181        return 0 as *mut libc::c_void;
12182    }
12183    if !keylen.is_null() {
12184        *keylen = (*di).ri.key_len;
12185    }
12186    if !dataptr.is_null() {
12187        *dataptr = (*di).ri.data;
12188    }
12189    return (*di).ri.key as *mut libc::c_void;
12190}
12191#[no_mangle]
12192pub unsafe extern "C" fn RM_DictPrevC(
12193    mut di: *mut RedisModuleDictIter,
12194    mut keylen: *mut size_t,
12195    mut dataptr: *mut *mut libc::c_void,
12196) -> *mut libc::c_void {
12197    if raxPrev(&mut (*di).ri) == 0 {
12198        return 0 as *mut libc::c_void;
12199    }
12200    if !keylen.is_null() {
12201        *keylen = (*di).ri.key_len;
12202    }
12203    if !dataptr.is_null() {
12204        *dataptr = (*di).ri.data;
12205    }
12206    return (*di).ri.key as *mut libc::c_void;
12207}
12208#[no_mangle]
12209pub unsafe extern "C" fn RM_DictNext(
12210    mut ctx: *mut RedisModuleCtx,
12211    mut di: *mut RedisModuleDictIter,
12212    mut dataptr: *mut *mut libc::c_void,
12213) -> *mut robj {
12214    let mut keylen: size_t = 0;
12215    let mut key: *mut libc::c_void = RM_DictNextC(di, &mut keylen, dataptr);
12216    if key.is_null() {
12217        return 0 as *mut robj;
12218    }
12219    return RM_CreateString(ctx, key as *const libc::c_char, keylen);
12220}
12221#[no_mangle]
12222pub unsafe extern "C" fn RM_DictPrev(
12223    mut ctx: *mut RedisModuleCtx,
12224    mut di: *mut RedisModuleDictIter,
12225    mut dataptr: *mut *mut libc::c_void,
12226) -> *mut robj {
12227    let mut keylen: size_t = 0;
12228    let mut key: *mut libc::c_void = RM_DictPrevC(di, &mut keylen, dataptr);
12229    if key.is_null() {
12230        return 0 as *mut robj;
12231    }
12232    return RM_CreateString(ctx, key as *const libc::c_char, keylen);
12233}
12234#[no_mangle]
12235pub unsafe extern "C" fn RM_DictCompareC(
12236    mut di: *mut RedisModuleDictIter,
12237    mut op: *const libc::c_char,
12238    mut key: *mut libc::c_void,
12239    mut keylen: size_t,
12240) -> libc::c_int {
12241    if raxEOF(&mut (*di).ri) != 0 {
12242        return 1 as libc::c_int;
12243    }
12244    let mut res: libc::c_int = raxCompare(
12245        &mut (*di).ri,
12246        op,
12247        key as *mut libc::c_uchar,
12248        keylen,
12249    );
12250    return if res != 0 { 0 as libc::c_int } else { 1 as libc::c_int };
12251}
12252#[no_mangle]
12253pub unsafe extern "C" fn RM_DictCompare(
12254    mut di: *mut RedisModuleDictIter,
12255    mut op: *const libc::c_char,
12256    mut key: *mut robj,
12257) -> libc::c_int {
12258    if raxEOF(&mut (*di).ri) != 0 {
12259        return 1 as libc::c_int;
12260    }
12261    let mut res: libc::c_int = raxCompare(
12262        &mut (*di).ri,
12263        op,
12264        (*key).ptr as *mut libc::c_uchar,
12265        sdslen((*key).ptr as sds),
12266    );
12267    return if res != 0 { 0 as libc::c_int } else { 1 as libc::c_int };
12268}
12269#[no_mangle]
12270pub unsafe extern "C" fn RM_InfoAddSection(
12271    mut ctx: *mut RedisModuleInfoCtx,
12272    mut name: *const libc::c_char,
12273) -> libc::c_int {
12274    let mut full_name: sds = sdsdup((*(*ctx).module).name);
12275    if !name.is_null() && strlen(name) > 0 as libc::c_int as libc::c_ulong {
12276        full_name = sdscatfmt(
12277            full_name,
12278            b"_%s\0" as *const u8 as *const libc::c_char,
12279            name,
12280        );
12281    }
12282    if (*ctx).in_dict_field != 0 {
12283        RM_InfoEndDictField(ctx);
12284    }
12285    if !((*ctx).requested_sections).is_null() {
12286        if (full_name.is_null()
12287            || (dictFind((*ctx).requested_sections, full_name as *const libc::c_void))
12288                .is_null())
12289            && (dictFind(
12290                (*ctx).requested_sections,
12291                (*(*ctx).module).name as *const libc::c_void,
12292            ))
12293                .is_null()
12294        {
12295            sdsfree(full_name);
12296            (*ctx).in_section = 0 as libc::c_int;
12297            return 1 as libc::c_int;
12298        }
12299    }
12300    let fresh33 = (*ctx).sections;
12301    (*ctx).sections = (*ctx).sections + 1;
12302    if fresh33 != 0 {
12303        (*ctx).info = sdscat((*ctx).info, b"\r\n\0" as *const u8 as *const libc::c_char);
12304    }
12305    (*ctx)
12306        .info = sdscatfmt(
12307        (*ctx).info,
12308        b"# %S\r\n\0" as *const u8 as *const libc::c_char,
12309        full_name,
12310    );
12311    (*ctx).in_section = 1 as libc::c_int;
12312    sdsfree(full_name);
12313    return 0 as libc::c_int;
12314}
12315#[no_mangle]
12316pub unsafe extern "C" fn RM_InfoBeginDictField(
12317    mut ctx: *mut RedisModuleInfoCtx,
12318    mut name: *const libc::c_char,
12319) -> libc::c_int {
12320    if (*ctx).in_section == 0 {
12321        return 1 as libc::c_int;
12322    }
12323    if (*ctx).in_dict_field != 0 {
12324        RM_InfoEndDictField(ctx);
12325    }
12326    let mut tmpmodname: *mut libc::c_char = 0 as *mut libc::c_char;
12327    let mut tmpname: *mut libc::c_char = 0 as *mut libc::c_char;
12328    (*ctx)
12329        .info = sdscatfmt(
12330        (*ctx).info,
12331        b"%s_%s:\0" as *const u8 as *const libc::c_char,
12332        getSafeInfoString(
12333            (*(*ctx).module).name,
12334            strlen((*(*ctx).module).name),
12335            &mut tmpmodname,
12336        ),
12337        getSafeInfoString(name, strlen(name), &mut tmpname),
12338    );
12339    if !tmpmodname.is_null() {
12340        zfree(tmpmodname as *mut libc::c_void);
12341    }
12342    if !tmpname.is_null() {
12343        zfree(tmpname as *mut libc::c_void);
12344    }
12345    (*ctx).in_dict_field = 1 as libc::c_int;
12346    return 0 as libc::c_int;
12347}
12348#[no_mangle]
12349pub unsafe extern "C" fn RM_InfoEndDictField(
12350    mut ctx: *mut RedisModuleInfoCtx,
12351) -> libc::c_int {
12352    if (*ctx).in_dict_field == 0 {
12353        return 1 as libc::c_int;
12354    }
12355    if *((*ctx).info)
12356        .offset(
12357            (sdslen((*ctx).info)).wrapping_sub(1 as libc::c_int as libc::c_ulong)
12358                as isize,
12359        ) as libc::c_int == ',' as i32
12360    {
12361        sdsIncrLen((*ctx).info, -(1 as libc::c_int) as ssize_t);
12362    }
12363    (*ctx).info = sdscat((*ctx).info, b"\r\n\0" as *const u8 as *const libc::c_char);
12364    (*ctx).in_dict_field = 0 as libc::c_int;
12365    return 0 as libc::c_int;
12366}
12367#[no_mangle]
12368pub unsafe extern "C" fn RM_InfoAddFieldString(
12369    mut ctx: *mut RedisModuleInfoCtx,
12370    mut field: *const libc::c_char,
12371    mut value: *mut robj,
12372) -> libc::c_int {
12373    if (*ctx).in_section == 0 {
12374        return 1 as libc::c_int;
12375    }
12376    if (*ctx).in_dict_field != 0 {
12377        (*ctx)
12378            .info = sdscatfmt(
12379            (*ctx).info,
12380            b"%s=%S,\0" as *const u8 as *const libc::c_char,
12381            field,
12382            (*value).ptr as sds,
12383        );
12384        return 0 as libc::c_int;
12385    }
12386    (*ctx)
12387        .info = sdscatfmt(
12388        (*ctx).info,
12389        b"%s_%s:%S\r\n\0" as *const u8 as *const libc::c_char,
12390        (*(*ctx).module).name,
12391        field,
12392        (*value).ptr as sds,
12393    );
12394    return 0 as libc::c_int;
12395}
12396#[no_mangle]
12397pub unsafe extern "C" fn RM_InfoAddFieldCString(
12398    mut ctx: *mut RedisModuleInfoCtx,
12399    mut field: *const libc::c_char,
12400    mut value: *const libc::c_char,
12401) -> libc::c_int {
12402    if (*ctx).in_section == 0 {
12403        return 1 as libc::c_int;
12404    }
12405    if (*ctx).in_dict_field != 0 {
12406        (*ctx)
12407            .info = sdscatfmt(
12408            (*ctx).info,
12409            b"%s=%s,\0" as *const u8 as *const libc::c_char,
12410            field,
12411            value,
12412        );
12413        return 0 as libc::c_int;
12414    }
12415    (*ctx)
12416        .info = sdscatfmt(
12417        (*ctx).info,
12418        b"%s_%s:%s\r\n\0" as *const u8 as *const libc::c_char,
12419        (*(*ctx).module).name,
12420        field,
12421        value,
12422    );
12423    return 0 as libc::c_int;
12424}
12425#[no_mangle]
12426pub unsafe extern "C" fn RM_InfoAddFieldDouble(
12427    mut ctx: *mut RedisModuleInfoCtx,
12428    mut field: *const libc::c_char,
12429    mut value: libc::c_double,
12430) -> libc::c_int {
12431    if (*ctx).in_section == 0 {
12432        return 1 as libc::c_int;
12433    }
12434    if (*ctx).in_dict_field != 0 {
12435        (*ctx)
12436            .info = sdscatprintf(
12437            (*ctx).info,
12438            b"%s=%.17g,\0" as *const u8 as *const libc::c_char,
12439            field,
12440            value,
12441        );
12442        return 0 as libc::c_int;
12443    }
12444    (*ctx)
12445        .info = sdscatprintf(
12446        (*ctx).info,
12447        b"%s_%s:%.17g\r\n\0" as *const u8 as *const libc::c_char,
12448        (*(*ctx).module).name,
12449        field,
12450        value,
12451    );
12452    return 0 as libc::c_int;
12453}
12454#[no_mangle]
12455pub unsafe extern "C" fn RM_InfoAddFieldLongLong(
12456    mut ctx: *mut RedisModuleInfoCtx,
12457    mut field: *const libc::c_char,
12458    mut value: libc::c_longlong,
12459) -> libc::c_int {
12460    if (*ctx).in_section == 0 {
12461        return 1 as libc::c_int;
12462    }
12463    if (*ctx).in_dict_field != 0 {
12464        (*ctx)
12465            .info = sdscatfmt(
12466            (*ctx).info,
12467            b"%s=%I,\0" as *const u8 as *const libc::c_char,
12468            field,
12469            value,
12470        );
12471        return 0 as libc::c_int;
12472    }
12473    (*ctx)
12474        .info = sdscatfmt(
12475        (*ctx).info,
12476        b"%s_%s:%I\r\n\0" as *const u8 as *const libc::c_char,
12477        (*(*ctx).module).name,
12478        field,
12479        value,
12480    );
12481    return 0 as libc::c_int;
12482}
12483#[no_mangle]
12484pub unsafe extern "C" fn RM_InfoAddFieldULongLong(
12485    mut ctx: *mut RedisModuleInfoCtx,
12486    mut field: *const libc::c_char,
12487    mut value: libc::c_ulonglong,
12488) -> libc::c_int {
12489    if (*ctx).in_section == 0 {
12490        return 1 as libc::c_int;
12491    }
12492    if (*ctx).in_dict_field != 0 {
12493        (*ctx)
12494            .info = sdscatfmt(
12495            (*ctx).info,
12496            b"%s=%U,\0" as *const u8 as *const libc::c_char,
12497            field,
12498            value,
12499        );
12500        return 0 as libc::c_int;
12501    }
12502    (*ctx)
12503        .info = sdscatfmt(
12504        (*ctx).info,
12505        b"%s_%s:%U\r\n\0" as *const u8 as *const libc::c_char,
12506        (*(*ctx).module).name,
12507        field,
12508        value,
12509    );
12510    return 0 as libc::c_int;
12511}
12512#[no_mangle]
12513pub unsafe extern "C" fn RM_RegisterInfoFunc(
12514    mut ctx: *mut RedisModuleCtx,
12515    mut cb: RedisModuleInfoFunc,
12516) -> libc::c_int {
12517    (*(*ctx).module).info_cb = cb;
12518    return 0 as libc::c_int;
12519}
12520#[no_mangle]
12521pub unsafe extern "C" fn modulesCollectInfo(
12522    mut info: sds,
12523    mut sections_dict: *mut dict,
12524    mut for_crash_report: libc::c_int,
12525    mut sections: libc::c_int,
12526) -> sds {
12527    let mut di: *mut dictIterator = dictGetIterator(modules);
12528    let mut de: *mut dictEntry = 0 as *mut dictEntry;
12529    loop {
12530        de = dictNext(di);
12531        if de.is_null() {
12532            break;
12533        }
12534        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
12535        if ((*module).info_cb).is_none() {
12536            continue;
12537        }
12538        let mut info_ctx: RedisModuleInfoCtx = {
12539            let mut init = RedisModuleInfoCtx {
12540                module: module,
12541                requested_sections: sections_dict,
12542                info: info,
12543                sections: sections,
12544                in_section: 0 as libc::c_int,
12545                in_dict_field: 0 as libc::c_int,
12546            };
12547            init
12548        };
12549        ((*module).info_cb)
12550            .expect("non-null function pointer")(&mut info_ctx, for_crash_report);
12551        if info_ctx.in_dict_field != 0 {
12552            RM_InfoEndDictField(&mut info_ctx);
12553        }
12554        info = info_ctx.info;
12555        sections = info_ctx.sections;
12556    }
12557    dictReleaseIterator(di);
12558    return info;
12559}
12560#[no_mangle]
12561pub unsafe extern "C" fn RM_GetServerInfo(
12562    mut ctx: *mut RedisModuleCtx,
12563    mut section: *const libc::c_char,
12564) -> *mut RedisModuleServerInfoData {
12565    let mut d: *mut RedisModuleServerInfoData = zmalloc(
12566        core::mem::size_of::<RedisModuleServerInfoData>() as libc::c_ulong,
12567    ) as *mut RedisModuleServerInfoData;
12568    (*d).rax = raxNew();
12569    if !ctx.is_null() {
12570        autoMemoryAdd(ctx, 5 as libc::c_int, d as *mut libc::c_void);
12571    }
12572    let mut all: libc::c_int = 0 as libc::c_int;
12573    let mut everything: libc::c_int = 0 as libc::c_int;
12574    let mut argv: [*mut robj; 1] = [0 as *mut robj; 1];
12575    argv[0 as libc::c_int
12576        as usize] = if !section.is_null() {
12577        createStringObject(section, strlen(section))
12578    } else {
12579        0 as *mut robj
12580    };
12581    let mut section_dict: *mut dict = genInfoSectionDict(
12582        argv.as_mut_ptr(),
12583        if !section.is_null() { 1 as libc::c_int } else { 0 as libc::c_int },
12584        0 as *mut *mut libc::c_char,
12585        &mut all,
12586        &mut everything,
12587    );
12588    let mut info: sds = genRedisInfoString(section_dict, all, everything);
12589    let mut totlines: libc::c_int = 0;
12590    let mut i: libc::c_int = 0;
12591    let mut lines: *mut sds = sdssplitlen(
12592        info as *const libc::c_char,
12593        sdslen(info) as ssize_t,
12594        b"\r\n\0" as *const u8 as *const libc::c_char,
12595        2 as libc::c_int,
12596        &mut totlines,
12597    );
12598    i = 0 as libc::c_int;
12599    while i < totlines {
12600        let mut line: sds = *lines.offset(i as isize);
12601        if !(*line.offset(0 as libc::c_int as isize) as libc::c_int == '#' as i32) {
12602            let mut sep: *mut libc::c_char = strchr(
12603                line as *const libc::c_char,
12604                ':' as i32,
12605            );
12606            if !sep.is_null() {
12607                let mut key: *mut libc::c_uchar = line as *mut libc::c_uchar;
12608                let mut keylen: size_t = (sep as intptr_t - line as intptr_t) as size_t;
12609                let mut val: sds = sdsnewlen(
12610                    sep.offset(1 as libc::c_int as isize) as *const libc::c_void,
12611                    (sdslen(line))
12612                        .wrapping_sub(
12613                            (sep as intptr_t - line as intptr_t) as libc::c_ulong,
12614                        )
12615                        .wrapping_sub(1 as libc::c_int as libc::c_ulong),
12616                );
12617                if raxTryInsert(
12618                    (*d).rax,
12619                    key,
12620                    keylen,
12621                    val as *mut libc::c_void,
12622                    0 as *mut *mut libc::c_void,
12623                ) == 0
12624                {
12625                    sdsfree(val);
12626                }
12627            }
12628        }
12629        i += 1;
12630    }
12631    sdsfree(info);
12632    sdsfreesplitres(lines, totlines);
12633    releaseInfoSectionDict(section_dict);
12634    if !(argv[0 as libc::c_int as usize]).is_null() {
12635        decrRefCount(argv[0 as libc::c_int as usize]);
12636    }
12637    return d;
12638}
12639#[no_mangle]
12640pub unsafe extern "C" fn RM_FreeServerInfo(
12641    mut ctx: *mut RedisModuleCtx,
12642    mut data: *mut RedisModuleServerInfoData,
12643) {
12644    if !ctx.is_null() {
12645        autoMemoryFreed(ctx, 5 as libc::c_int, data as *mut libc::c_void);
12646    }
12647    raxFreeWithCallback(
12648        (*data).rax,
12649        core::mem::transmute::<
12650            Option::<unsafe extern "C" fn(sds) -> ()>,
12651            Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>,
12652        >(Some(sdsfree as unsafe extern "C" fn(sds) -> ())),
12653    );
12654    zfree(data as *mut libc::c_void);
12655}
12656#[no_mangle]
12657pub unsafe extern "C" fn RM_ServerInfoGetField(
12658    mut ctx: *mut RedisModuleCtx,
12659    mut data: *mut RedisModuleServerInfoData,
12660    mut field: *const libc::c_char,
12661) -> *mut robj {
12662    let mut val: sds = raxFind((*data).rax, field as *mut libc::c_uchar, strlen(field))
12663        as sds;
12664    if val == raxNotFound as sds {
12665        return 0 as *mut robj;
12666    }
12667    let mut o: *mut robj = createStringObject(val as *const libc::c_char, sdslen(val));
12668    if !ctx.is_null() {
12669        autoMemoryAdd(ctx, 1 as libc::c_int, o as *mut libc::c_void);
12670    }
12671    return o;
12672}
12673#[no_mangle]
12674pub unsafe extern "C" fn RM_ServerInfoGetFieldC(
12675    mut data: *mut RedisModuleServerInfoData,
12676    mut field: *const libc::c_char,
12677) -> *const libc::c_char {
12678    let mut val: sds = raxFind((*data).rax, field as *mut libc::c_uchar, strlen(field))
12679        as sds;
12680    if val == raxNotFound as sds {
12681        return 0 as *const libc::c_char;
12682    }
12683    return val as *const libc::c_char;
12684}
12685#[no_mangle]
12686pub unsafe extern "C" fn RM_ServerInfoGetFieldSigned(
12687    mut data: *mut RedisModuleServerInfoData,
12688    mut field: *const libc::c_char,
12689    mut out_err: *mut libc::c_int,
12690) -> libc::c_longlong {
12691    let mut ll: libc::c_longlong = 0;
12692    let mut val: sds = raxFind((*data).rax, field as *mut libc::c_uchar, strlen(field))
12693        as sds;
12694    if val == raxNotFound as sds {
12695        if !out_err.is_null() {
12696            *out_err = 1 as libc::c_int;
12697        }
12698        return 0 as libc::c_int as libc::c_longlong;
12699    }
12700    if string2ll(val as *const libc::c_char, sdslen(val), &mut ll) == 0 {
12701        if !out_err.is_null() {
12702            *out_err = 1 as libc::c_int;
12703        }
12704        return 0 as libc::c_int as libc::c_longlong;
12705    }
12706    if !out_err.is_null() {
12707        *out_err = 0 as libc::c_int;
12708    }
12709    return ll;
12710}
12711#[no_mangle]
12712pub unsafe extern "C" fn RM_ServerInfoGetFieldUnsigned(
12713    mut data: *mut RedisModuleServerInfoData,
12714    mut field: *const libc::c_char,
12715    mut out_err: *mut libc::c_int,
12716) -> libc::c_ulonglong {
12717    let mut ll: libc::c_ulonglong = 0;
12718    let mut val: sds = raxFind((*data).rax, field as *mut libc::c_uchar, strlen(field))
12719        as sds;
12720    if val == raxNotFound as sds {
12721        if !out_err.is_null() {
12722            *out_err = 1 as libc::c_int;
12723        }
12724        return 0 as libc::c_int as libc::c_ulonglong;
12725    }
12726    if string2ull(val as *const libc::c_char, &mut ll) == 0 {
12727        if !out_err.is_null() {
12728            *out_err = 1 as libc::c_int;
12729        }
12730        return 0 as libc::c_int as libc::c_ulonglong;
12731    }
12732    if !out_err.is_null() {
12733        *out_err = 0 as libc::c_int;
12734    }
12735    return ll;
12736}
12737#[no_mangle]
12738pub unsafe extern "C" fn RM_ServerInfoGetFieldDouble(
12739    mut data: *mut RedisModuleServerInfoData,
12740    mut field: *const libc::c_char,
12741    mut out_err: *mut libc::c_int,
12742) -> libc::c_double {
12743    let mut dbl: libc::c_double = 0.;
12744    let mut val: sds = raxFind((*data).rax, field as *mut libc::c_uchar, strlen(field))
12745        as sds;
12746    if val == raxNotFound as sds {
12747        if !out_err.is_null() {
12748            *out_err = 1 as libc::c_int;
12749        }
12750        return 0 as libc::c_int as libc::c_double;
12751    }
12752    if string2d(val as *const libc::c_char, sdslen(val), &mut dbl) == 0 {
12753        if !out_err.is_null() {
12754            *out_err = 1 as libc::c_int;
12755        }
12756        return 0 as libc::c_int as libc::c_double;
12757    }
12758    if !out_err.is_null() {
12759        *out_err = 0 as libc::c_int;
12760    }
12761    return dbl;
12762}
12763#[no_mangle]
12764pub unsafe extern "C" fn RM_GetRandomBytes(
12765    mut dst: *mut libc::c_uchar,
12766    mut len: size_t,
12767) {
12768    getRandomBytes(dst, len);
12769}
12770#[no_mangle]
12771pub unsafe extern "C" fn RM_GetRandomHexChars(
12772    mut dst: *mut libc::c_char,
12773    mut len: size_t,
12774) {
12775    getRandomHexChars(dst, len);
12776}
12777#[no_mangle]
12778pub unsafe extern "C" fn RM_ExportSharedAPI(
12779    mut ctx: *mut RedisModuleCtx,
12780    mut apiname: *const libc::c_char,
12781    mut func: *mut libc::c_void,
12782) -> libc::c_int {
12783    let mut sapi: *mut RedisModuleSharedAPI = zmalloc(
12784        core::mem::size_of::<RedisModuleSharedAPI>() as libc::c_ulong,
12785    ) as *mut RedisModuleSharedAPI;
12786    (*sapi).module = (*ctx).module;
12787    (*sapi).func = func;
12788    if dictAdd(
12789        server.sharedapi,
12790        apiname as *mut libc::c_char as *mut libc::c_void,
12791        sapi as *mut libc::c_void,
12792    ) != 0 as libc::c_int
12793    {
12794        zfree(sapi as *mut libc::c_void);
12795        return 1 as libc::c_int;
12796    }
12797    return 0 as libc::c_int;
12798}
12799#[no_mangle]
12800pub unsafe extern "C" fn RM_GetSharedAPI(
12801    mut ctx: *mut RedisModuleCtx,
12802    mut apiname: *const libc::c_char,
12803) -> *mut libc::c_void {
12804    let mut de: *mut dictEntry = dictFind(
12805        server.sharedapi,
12806        apiname as *const libc::c_void,
12807    );
12808    if de.is_null() {
12809        return 0 as *mut libc::c_void;
12810    }
12811    let mut sapi: *mut RedisModuleSharedAPI = (*de).v.val as *mut RedisModuleSharedAPI;
12812    if (listSearchKey((*(*sapi).module).usedby, (*ctx).module as *mut libc::c_void))
12813        .is_null()
12814    {
12815        listAddNodeTail((*(*sapi).module).usedby, (*ctx).module as *mut libc::c_void);
12816        listAddNodeTail((*(*ctx).module).using, (*sapi).module as *mut libc::c_void);
12817    }
12818    return (*sapi).func;
12819}
12820#[no_mangle]
12821pub unsafe extern "C" fn moduleUnregisterSharedAPI(
12822    mut module: *mut RedisModule,
12823) -> libc::c_int {
12824    let mut count: libc::c_int = 0 as libc::c_int;
12825    let mut di: *mut dictIterator = dictGetSafeIterator(server.sharedapi);
12826    let mut de: *mut dictEntry = 0 as *mut dictEntry;
12827    loop {
12828        de = dictNext(di);
12829        if de.is_null() {
12830            break;
12831        }
12832        let mut apiname: *const libc::c_char = (*de).key as *const libc::c_char;
12833        let mut sapi: *mut RedisModuleSharedAPI = (*de).v.val
12834            as *mut RedisModuleSharedAPI;
12835        if (*sapi).module == module {
12836            dictDelete(server.sharedapi, apiname as *const libc::c_void);
12837            zfree(sapi as *mut libc::c_void);
12838            count += 1;
12839        }
12840    }
12841    dictReleaseIterator(di);
12842    return count;
12843}
12844#[no_mangle]
12845pub unsafe extern "C" fn moduleUnregisterUsedAPI(
12846    mut module: *mut RedisModule,
12847) -> libc::c_int {
12848    let mut li: listIter = listIter {
12849        next: 0 as *mut listNode,
12850        direction: 0,
12851    };
12852    let mut ln: *mut listNode = 0 as *mut listNode;
12853    let mut count: libc::c_int = 0 as libc::c_int;
12854    listRewind((*module).using, &mut li);
12855    loop {
12856        ln = listNext(&mut li);
12857        if ln.is_null() {
12858            break;
12859        }
12860        let mut used: *mut RedisModule = (*ln).value as *mut RedisModule;
12861        let mut ln_0: *mut listNode = listSearchKey(
12862            (*used).usedby,
12863            module as *mut libc::c_void,
12864        );
12865        if !ln_0.is_null() {
12866            listDelNode((*used).usedby, ln_0);
12867            count += 1;
12868        }
12869    }
12870    return count;
12871}
12872#[no_mangle]
12873pub unsafe extern "C" fn moduleUnregisterFilters(
12874    mut module: *mut RedisModule,
12875) -> libc::c_int {
12876    let mut li: listIter = listIter {
12877        next: 0 as *mut listNode,
12878        direction: 0,
12879    };
12880    let mut ln: *mut listNode = 0 as *mut listNode;
12881    let mut count: libc::c_int = 0 as libc::c_int;
12882    listRewind((*module).filters, &mut li);
12883    loop {
12884        ln = listNext(&mut li);
12885        if ln.is_null() {
12886            break;
12887        }
12888        let mut filter: *mut RedisModuleCommandFilter = (*ln).value
12889            as *mut RedisModuleCommandFilter;
12890        let mut ln_0: *mut listNode = listSearchKey(
12891            moduleCommandFilters,
12892            filter as *mut libc::c_void,
12893        );
12894        if !ln_0.is_null() {
12895            listDelNode(moduleCommandFilters, ln_0);
12896            count += 1;
12897        }
12898        zfree(filter as *mut libc::c_void);
12899    }
12900    return count;
12901}
12902#[no_mangle]
12903pub unsafe extern "C" fn RM_RegisterCommandFilter(
12904    mut ctx: *mut RedisModuleCtx,
12905    mut callback: RedisModuleCommandFilterFunc,
12906    mut flags: libc::c_int,
12907) -> *mut RedisModuleCommandFilter {
12908    let mut filter: *mut RedisModuleCommandFilter = zmalloc(
12909        core::mem::size_of::<RedisModuleCommandFilter>() as libc::c_ulong,
12910    ) as *mut RedisModuleCommandFilter;
12911    (*filter).module = (*ctx).module;
12912    (*filter).callback = callback;
12913    (*filter).flags = flags;
12914    listAddNodeTail(moduleCommandFilters, filter as *mut libc::c_void);
12915    listAddNodeTail((*(*ctx).module).filters, filter as *mut libc::c_void);
12916    return filter;
12917}
12918#[no_mangle]
12919pub unsafe extern "C" fn RM_UnregisterCommandFilter(
12920    mut ctx: *mut RedisModuleCtx,
12921    mut filter: *mut RedisModuleCommandFilter,
12922) -> libc::c_int {
12923    let mut ln: *mut listNode = 0 as *mut listNode;
12924    if (*filter).module != (*ctx).module {
12925        return 1 as libc::c_int;
12926    }
12927    ln = listSearchKey(moduleCommandFilters, filter as *mut libc::c_void);
12928    if ln.is_null() {
12929        return 1 as libc::c_int;
12930    }
12931    listDelNode(moduleCommandFilters, ln);
12932    ln = listSearchKey((*(*ctx).module).filters, filter as *mut libc::c_void);
12933    if ln.is_null() {
12934        return 1 as libc::c_int;
12935    }
12936    listDelNode((*(*ctx).module).filters, ln);
12937    zfree(filter as *mut libc::c_void);
12938    return 0 as libc::c_int;
12939}
12940#[no_mangle]
12941pub unsafe extern "C" fn moduleCallCommandFilters(mut c: *mut client) {
12942    if (*moduleCommandFilters).len == 0 as libc::c_int as libc::c_ulong {
12943        return;
12944    }
12945    let mut li: listIter = listIter {
12946        next: 0 as *mut listNode,
12947        direction: 0,
12948    };
12949    let mut ln: *mut listNode = 0 as *mut listNode;
12950    listRewind(moduleCommandFilters, &mut li);
12951    let mut filter: RedisModuleCommandFilterCtx = {
12952        let mut init = RedisModuleCommandFilterCtx {
12953            argv: (*c).argv,
12954            argv_len: (*c).argv_len,
12955            argc: (*c).argc,
12956        };
12957        init
12958    };
12959    loop {
12960        ln = listNext(&mut li);
12961        if ln.is_null() {
12962            break;
12963        }
12964        let mut f: *mut RedisModuleCommandFilter = (*ln).value
12965            as *mut RedisModuleCommandFilter;
12966        if (*f).flags & (1 as libc::c_int) << 0 as libc::c_int != 0
12967            && (*(*f).module).in_call != 0
12968        {
12969            continue;
12970        }
12971        ((*f).callback).expect("non-null function pointer")(&mut filter);
12972    }
12973    (*c).argv = filter.argv;
12974    (*c).argv_len = filter.argv_len;
12975    (*c).argc = filter.argc;
12976}
12977#[no_mangle]
12978pub unsafe extern "C" fn RM_CommandFilterArgsCount(
12979    mut fctx: *mut RedisModuleCommandFilterCtx,
12980) -> libc::c_int {
12981    return (*fctx).argc;
12982}
12983#[no_mangle]
12984pub unsafe extern "C" fn RM_CommandFilterArgGet(
12985    mut fctx: *mut RedisModuleCommandFilterCtx,
12986    mut pos: libc::c_int,
12987) -> *mut robj {
12988    if pos < 0 as libc::c_int || pos >= (*fctx).argc {
12989        return 0 as *mut robj;
12990    }
12991    return *((*fctx).argv).offset(pos as isize);
12992}
12993#[no_mangle]
12994pub unsafe extern "C" fn RM_CommandFilterArgInsert(
12995    mut fctx: *mut RedisModuleCommandFilterCtx,
12996    mut pos: libc::c_int,
12997    mut arg: *mut robj,
12998) -> libc::c_int {
12999    let mut i: libc::c_int = 0;
13000    if pos < 0 as libc::c_int || pos > (*fctx).argc {
13001        return 1 as libc::c_int;
13002    }
13003    if (*fctx).argv_len < (*fctx).argc + 1 as libc::c_int {
13004        (*fctx).argv_len = (*fctx).argc + 1 as libc::c_int;
13005        (*fctx)
13006            .argv = zrealloc(
13007            (*fctx).argv as *mut libc::c_void,
13008            ((*fctx).argv_len as libc::c_ulong)
13009                .wrapping_mul(core::mem::size_of::<*mut robj>() as libc::c_ulong),
13010        ) as *mut *mut robj;
13011    }
13012    i = (*fctx).argc;
13013    while i > pos {
13014        let ref mut fresh34 = *((*fctx).argv).offset(i as isize);
13015        *fresh34 = *((*fctx).argv).offset((i - 1 as libc::c_int) as isize);
13016        i -= 1;
13017    }
13018    let ref mut fresh35 = *((*fctx).argv).offset(pos as isize);
13019    *fresh35 = arg;
13020    (*fctx).argc += 1;
13021    return 0 as libc::c_int;
13022}
13023#[no_mangle]
13024pub unsafe extern "C" fn RM_CommandFilterArgReplace(
13025    mut fctx: *mut RedisModuleCommandFilterCtx,
13026    mut pos: libc::c_int,
13027    mut arg: *mut robj,
13028) -> libc::c_int {
13029    if pos < 0 as libc::c_int || pos >= (*fctx).argc {
13030        return 1 as libc::c_int;
13031    }
13032    decrRefCount(*((*fctx).argv).offset(pos as isize));
13033    let ref mut fresh36 = *((*fctx).argv).offset(pos as isize);
13034    *fresh36 = arg;
13035    return 0 as libc::c_int;
13036}
13037#[no_mangle]
13038pub unsafe extern "C" fn RM_CommandFilterArgDelete(
13039    mut fctx: *mut RedisModuleCommandFilterCtx,
13040    mut pos: libc::c_int,
13041) -> libc::c_int {
13042    let mut i: libc::c_int = 0;
13043    if pos < 0 as libc::c_int || pos >= (*fctx).argc {
13044        return 1 as libc::c_int;
13045    }
13046    decrRefCount(*((*fctx).argv).offset(pos as isize));
13047    i = pos;
13048    while i < (*fctx).argc - 1 as libc::c_int {
13049        let ref mut fresh37 = *((*fctx).argv).offset(i as isize);
13050        *fresh37 = *((*fctx).argv).offset((i + 1 as libc::c_int) as isize);
13051        i += 1;
13052    }
13053    (*fctx).argc -= 1;
13054    return 0 as libc::c_int;
13055}
13056#[no_mangle]
13057pub unsafe extern "C" fn RM_MallocSize(mut ptr: *mut libc::c_void) -> size_t {
13058    return je_malloc_usable_size(ptr);
13059}
13060#[no_mangle]
13061pub unsafe extern "C" fn RM_MallocUsableSize(mut ptr: *mut libc::c_void) -> size_t {
13062    return je_malloc_usable_size(ptr);
13063}
13064#[no_mangle]
13065pub unsafe extern "C" fn RM_MallocSizeString(mut str: *mut robj) -> size_t {
13066    if (*str).type_0() as libc::c_int == 0 as libc::c_int {} else {
13067        _serverAssert(
13068            b"str->type == OBJ_STRING\0" as *const u8 as *const libc::c_char,
13069            b"module.c\0" as *const u8 as *const libc::c_char,
13070            9960 as libc::c_int,
13071        );
13072        unreachable!();
13073    };
13074    return (core::mem::size_of::<robj>() as libc::c_ulong)
13075        .wrapping_add(getStringObjectSdsUsedMemory(str));
13076}
13077#[no_mangle]
13078pub unsafe extern "C" fn RM_MallocSizeDict(mut dict: *mut RedisModuleDict) -> size_t {
13079    let mut size: size_t = (core::mem::size_of::<RedisModuleDict>() as libc::c_ulong)
13080        .wrapping_add(core::mem::size_of::<rax>() as libc::c_ulong);
13081    size = (size as libc::c_ulong)
13082        .wrapping_add(
13083            ((*(*dict).rax).numnodes)
13084                .wrapping_mul(core::mem::size_of::<raxNode>() as libc::c_ulong),
13085        ) as size_t as size_t;
13086    size = (size as libc::c_ulong)
13087        .wrapping_add(
13088            ((*(*dict).rax).numnodes)
13089                .wrapping_mul(core::mem::size_of::<libc::c_long>() as libc::c_ulong)
13090                .wrapping_mul(30 as libc::c_int as libc::c_ulong),
13091        ) as size_t as size_t;
13092    return size;
13093}
13094#[no_mangle]
13095pub unsafe extern "C" fn RM_GetUsedMemoryRatio() -> libc::c_float {
13096    let mut level: libc::c_float = 0.;
13097    getMaxmemoryState(0 as *mut size_t, 0 as *mut size_t, 0 as *mut size_t, &mut level);
13098    return level;
13099}
13100unsafe extern "C" fn moduleScanCallback(
13101    mut privdata: *mut libc::c_void,
13102    mut de: *const dictEntry,
13103) {
13104    let mut data: *mut ScanCBData = privdata as *mut ScanCBData;
13105    let mut key: sds = (*de).key as sds;
13106    let mut val: *mut robj = (*de).v.val as *mut robj;
13107    let mut keyname: *mut robj = createObject(
13108        0 as libc::c_int,
13109        sdsdup(key) as *mut libc::c_void,
13110    );
13111    let mut kp: RedisModuleKey = {
13112        let mut init = RedisModuleKey {
13113            ctx: 0 as *mut RedisModuleCtx,
13114            db: 0 as *mut redisDb,
13115            key: 0 as *mut robj,
13116            value: 0 as *mut robj,
13117            iter: 0 as *mut libc::c_void,
13118            mode: 0,
13119            u: C2RustUnnamed_20 {
13120                list: C2RustUnnamed_23 {
13121                    entry: listTypeEntry {
13122                        li: 0 as *mut listTypeIterator,
13123                        entry: quicklistEntry {
13124                            quicklist: 0 as *const quicklist,
13125                            node: 0 as *mut quicklistNode,
13126                            zi: 0 as *mut libc::c_uchar,
13127                            value: 0 as *mut libc::c_uchar,
13128                            longval: 0,
13129                            sz: 0,
13130                            offset: 0,
13131                        },
13132                    },
13133                    index: 0,
13134                },
13135            },
13136        };
13137        init
13138    };
13139    moduleInitKey(
13140        &mut kp,
13141        (*data).ctx,
13142        keyname,
13143        val,
13144        (1 as libc::c_int) << 0 as libc::c_int,
13145    );
13146    ((*data).fn_0)
13147        .expect(
13148            "non-null function pointer",
13149        )((*data).ctx, keyname, &mut kp, (*data).user_data);
13150    moduleCloseKey(&mut kp);
13151    decrRefCount(keyname);
13152}
13153#[no_mangle]
13154pub unsafe extern "C" fn RM_ScanCursorCreate() -> *mut RedisModuleScanCursor {
13155    let mut cursor: *mut RedisModuleScanCursor = zmalloc(
13156        core::mem::size_of::<RedisModuleScanCursor>() as libc::c_ulong,
13157    ) as *mut RedisModuleScanCursor;
13158    (*cursor).cursor = 0 as libc::c_int as libc::c_ulong;
13159    (*cursor).done = 0 as libc::c_int;
13160    return cursor;
13161}
13162#[no_mangle]
13163pub unsafe extern "C" fn RM_ScanCursorRestart(mut cursor: *mut RedisModuleScanCursor) {
13164    (*cursor).cursor = 0 as libc::c_int as libc::c_ulong;
13165    (*cursor).done = 0 as libc::c_int;
13166}
13167#[no_mangle]
13168pub unsafe extern "C" fn RM_ScanCursorDestroy(mut cursor: *mut RedisModuleScanCursor) {
13169    zfree(cursor as *mut libc::c_void);
13170}
13171#[no_mangle]
13172pub unsafe extern "C" fn RM_Scan(
13173    mut ctx: *mut RedisModuleCtx,
13174    mut cursor: *mut RedisModuleScanCursor,
13175    mut fn_0: RedisModuleScanCB,
13176    mut privdata: *mut libc::c_void,
13177) -> libc::c_int {
13178    if (*cursor).done != 0 {
13179        *__errno_location() = 2 as libc::c_int;
13180        return 0 as libc::c_int;
13181    }
13182    let mut ret: libc::c_int = 1 as libc::c_int;
13183    let mut data: ScanCBData = {
13184        let mut init = ScanCBData {
13185            ctx: ctx,
13186            user_data: privdata,
13187            fn_0: fn_0,
13188        };
13189        init
13190    };
13191    (*cursor)
13192        .cursor = dictScan(
13193        (*(*(*ctx).client).db).dict,
13194        (*cursor).cursor,
13195        Some(
13196            moduleScanCallback
13197                as unsafe extern "C" fn(*mut libc::c_void, *const dictEntry) -> (),
13198        ),
13199        None,
13200        &mut data as *mut ScanCBData as *mut libc::c_void,
13201    );
13202    if (*cursor).cursor == 0 as libc::c_int as libc::c_ulong {
13203        (*cursor).done = 1 as libc::c_int;
13204        ret = 0 as libc::c_int;
13205    }
13206    *__errno_location() = 0 as libc::c_int;
13207    return ret;
13208}
13209unsafe extern "C" fn moduleScanKeyCallback(
13210    mut privdata: *mut libc::c_void,
13211    mut de: *const dictEntry,
13212) {
13213    let mut data: *mut ScanKeyCBData = privdata as *mut ScanKeyCBData;
13214    let mut key: sds = (*de).key as sds;
13215    let mut o: *mut robj = (*(*data).key).value;
13216    let mut field: *mut robj = createStringObject(
13217        key as *const libc::c_char,
13218        sdslen(key),
13219    );
13220    let mut value: *mut robj = 0 as *mut robj;
13221    if (*o).type_0() as libc::c_int == 2 as libc::c_int {
13222        value = 0 as *mut robj;
13223    } else if (*o).type_0() as libc::c_int == 4 as libc::c_int {
13224        let mut val: sds = (*de).v.val as sds;
13225        value = createStringObject(val as *const libc::c_char, sdslen(val));
13226    } else if (*o).type_0() as libc::c_int == 3 as libc::c_int {
13227        let mut val_0: *mut libc::c_double = (*de).v.val as *mut libc::c_double;
13228        value = createStringObjectFromLongDouble(
13229            (*val_0) as f64,
13230            0 as libc::c_int,
13231        );
13232    }
13233    ((*data).fn_0)
13234        .expect(
13235            "non-null function pointer",
13236        )((*data).key, field, value, (*data).user_data);
13237    decrRefCount(field);
13238    if !value.is_null() {
13239        decrRefCount(value);
13240    }
13241}
13242#[no_mangle]
13243pub unsafe extern "C" fn RM_ScanKey(
13244    mut key: *mut RedisModuleKey,
13245    mut cursor: *mut RedisModuleScanCursor,
13246    mut fn_0: RedisModuleScanKeyCB,
13247    mut privdata: *mut libc::c_void,
13248) -> libc::c_int {
13249    if key.is_null() || ((*key).value).is_null() {
13250        *__errno_location() = 22 as libc::c_int;
13251        return 0 as libc::c_int;
13252    }
13253    let mut ht: *mut dict = 0 as *mut dict;
13254    let mut o: *mut robj = (*key).value;
13255    if (*o).type_0() as libc::c_int == 2 as libc::c_int {
13256        if (*o).encoding() as libc::c_int == 2 as libc::c_int {
13257            ht = (*o).ptr as *mut dict;
13258        }
13259    } else if (*o).type_0() as libc::c_int == 4 as libc::c_int {
13260        if (*o).encoding() as libc::c_int == 2 as libc::c_int {
13261            ht = (*o).ptr as *mut dict;
13262        }
13263    } else if (*o).type_0() as libc::c_int == 3 as libc::c_int {
13264        if (*o).encoding() as libc::c_int == 7 as libc::c_int {
13265            ht = (*((*o).ptr as *mut zset)).dict;
13266        }
13267    } else {
13268        *__errno_location() = 22 as libc::c_int;
13269        return 0 as libc::c_int;
13270    }
13271    if (*cursor).done != 0 {
13272        *__errno_location() = 2 as libc::c_int;
13273        return 0 as libc::c_int;
13274    }
13275    let mut ret: libc::c_int = 1 as libc::c_int;
13276    if !ht.is_null() {
13277        let mut data: ScanKeyCBData = {
13278            let mut init = ScanKeyCBData {
13279                key: key,
13280                user_data: privdata,
13281                fn_0: fn_0,
13282            };
13283            init
13284        };
13285        (*cursor)
13286            .cursor = dictScan(
13287            ht,
13288            (*cursor).cursor,
13289            Some(
13290                moduleScanKeyCallback
13291                    as unsafe extern "C" fn(*mut libc::c_void, *const dictEntry) -> (),
13292            ),
13293            None,
13294            &mut data as *mut ScanKeyCBData as *mut libc::c_void,
13295        );
13296        if (*cursor).cursor == 0 as libc::c_int as libc::c_ulong {
13297            (*cursor).done = 1 as libc::c_int;
13298            ret = 0 as libc::c_int;
13299        }
13300    } else if (*o).type_0() as libc::c_int == 2 as libc::c_int
13301        && (*o).encoding() as libc::c_int == 6 as libc::c_int
13302    {
13303        let mut pos: libc::c_int = 0 as libc::c_int;
13304        let mut ll: int64_t = 0;
13305        loop {
13306            let fresh38 = pos;
13307            pos = pos + 1;
13308            if !(intsetGet((*o).ptr as *mut intset, fresh38 as uint32_t, &mut ll) != 0) {
13309                break;
13310            }
13311            let mut field: *mut robj = createObject(
13312                0 as libc::c_int,
13313                sdsfromlonglong(ll as libc::c_longlong) as *mut libc::c_void,
13314            );
13315            fn_0
13316                .expect(
13317                    "non-null function pointer",
13318                )(key, field, 0 as *mut robj, privdata);
13319            decrRefCount(field);
13320        }
13321        (*cursor).cursor = 1 as libc::c_int as libc::c_ulong;
13322        (*cursor).done = 1 as libc::c_int;
13323        ret = 0 as libc::c_int;
13324    } else if (*o).type_0() as libc::c_int == 3 as libc::c_int {
13325        let mut p: *mut libc::c_uchar = lpSeek(
13326            (*o).ptr as *mut libc::c_uchar,
13327            0 as libc::c_int as libc::c_long,
13328        );
13329        let mut vstr: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
13330        let mut vlen: libc::c_uint = 0;
13331        let mut vll: libc::c_longlong = 0;
13332        while !p.is_null() {
13333            vstr = lpGetValue(p, &mut vlen, &mut vll);
13334            let mut field_0: *mut robj = if !vstr.is_null() {
13335                createStringObject(vstr as *mut libc::c_char, vlen as size_t)
13336            } else {
13337                createObject(0 as libc::c_int, sdsfromlonglong(vll) as *mut libc::c_void)
13338            };
13339            p = lpNext((*o).ptr as *mut libc::c_uchar, p);
13340            vstr = lpGetValue(p, &mut vlen, &mut vll);
13341            let mut value: *mut robj = if !vstr.is_null() {
13342                createStringObject(vstr as *mut libc::c_char, vlen as size_t)
13343            } else {
13344                createObject(0 as libc::c_int, sdsfromlonglong(vll) as *mut libc::c_void)
13345            };
13346            fn_0.expect("non-null function pointer")(key, field_0, value, privdata);
13347            p = lpNext((*o).ptr as *mut libc::c_uchar, p);
13348            decrRefCount(field_0);
13349            decrRefCount(value);
13350        }
13351        (*cursor).cursor = 1 as libc::c_int as libc::c_ulong;
13352        (*cursor).done = 1 as libc::c_int;
13353        ret = 0 as libc::c_int;
13354    } else if (*o).type_0() as libc::c_int == 4 as libc::c_int {
13355        let mut p_0: *mut libc::c_uchar = lpFirst((*o).ptr as *mut libc::c_uchar);
13356        let mut vstr_0: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
13357        let mut vlen_0: int64_t = 0;
13358        let mut intbuf: [libc::c_uchar; 21] = [0; 21];
13359        while !p_0.is_null() {
13360            vstr_0 = lpGet(p_0, &mut vlen_0, intbuf.as_mut_ptr());
13361            let mut field_1: *mut robj = createStringObject(
13362                vstr_0 as *mut libc::c_char,
13363                vlen_0 as size_t,
13364            );
13365            p_0 = lpNext((*o).ptr as *mut libc::c_uchar, p_0);
13366            vstr_0 = lpGet(p_0, &mut vlen_0, intbuf.as_mut_ptr());
13367            let mut value_0: *mut robj = createStringObject(
13368                vstr_0 as *mut libc::c_char,
13369                vlen_0 as size_t,
13370            );
13371            fn_0.expect("non-null function pointer")(key, field_1, value_0, privdata);
13372            p_0 = lpNext((*o).ptr as *mut libc::c_uchar, p_0);
13373            decrRefCount(field_1);
13374            decrRefCount(value_0);
13375        }
13376        (*cursor).cursor = 1 as libc::c_int as libc::c_ulong;
13377        (*cursor).done = 1 as libc::c_int;
13378        ret = 0 as libc::c_int;
13379    }
13380    *__errno_location() = 0 as libc::c_int;
13381    return ret;
13382}
13383#[no_mangle]
13384pub unsafe extern "C" fn RM_Fork(
13385    mut cb: RedisModuleForkDoneHandler,
13386    mut user_data: *mut libc::c_void,
13387) -> libc::c_int {
13388    let mut childpid: pid_t = 0;
13389    childpid = redisFork(4 as libc::c_int);
13390    if childpid == 0 as libc::c_int {
13391        redisSetProcTitle(
13392            b"redis-module-fork\0" as *const u8 as *const libc::c_char
13393                as *mut libc::c_char,
13394        );
13395    } else if childpid == -(1 as libc::c_int) {
13396        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
13397            _serverLog(
13398                3 as libc::c_int,
13399                b"Can't fork for module: %s\0" as *const u8 as *const libc::c_char,
13400                strerror(*__errno_location()),
13401            );
13402        }
13403    } else {
13404        moduleForkInfo.done_handler = cb;
13405        moduleForkInfo.done_handler_user_data = user_data;
13406        if !((1 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
13407            _serverLog(
13408                1 as libc::c_int,
13409                b"Module fork started pid: %ld \0" as *const u8 as *const libc::c_char,
13410                childpid as libc::c_long,
13411            );
13412        }
13413    }
13414    return childpid;
13415}
13416#[no_mangle]
13417pub unsafe extern "C" fn RM_SendChildHeartbeat(mut progress: libc::c_double) {
13418    sendChildInfoGeneric(
13419        CHILD_INFO_TYPE_CURRENT_INFO,
13420        0 as libc::c_int as size_t,
13421        progress,
13422        b"Module fork\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
13423    );
13424}
13425#[no_mangle]
13426pub unsafe extern "C" fn RM_ExitFromChild(mut retcode: libc::c_int) -> libc::c_int {
13427    sendChildCowInfo(
13428        CHILD_INFO_TYPE_MODULE_COW_SIZE,
13429        b"Module fork\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
13430    );
13431    exitFromChild(retcode);
13432    return 0 as libc::c_int;
13433}
13434#[no_mangle]
13435pub unsafe extern "C" fn TerminateModuleForkChild(
13436    mut child_pid: libc::c_int,
13437    mut wait: libc::c_int,
13438) -> libc::c_int {
13439    if server.child_type != 4 as libc::c_int || server.child_pid != child_pid {
13440        return -(1 as libc::c_int);
13441    }
13442    let mut statloc: libc::c_int = 0;
13443    if !((1 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
13444        _serverLog(
13445            1 as libc::c_int,
13446            b"Killing running module fork child: %ld\0" as *const u8
13447                as *const libc::c_char,
13448            server.child_pid as libc::c_long,
13449        );
13450    }
13451    if kill(server.child_pid, 10 as libc::c_int) != -(1 as libc::c_int) && wait != 0 {
13452        while waitpid(server.child_pid, &mut statloc, 0 as libc::c_int)
13453            != server.child_pid
13454        {}
13455    }
13456    resetChildState();
13457    moduleForkInfo.done_handler = None;
13458    moduleForkInfo.done_handler_user_data = 0 as *mut libc::c_void;
13459    return 0 as libc::c_int;
13460}
13461#[no_mangle]
13462pub unsafe extern "C" fn RM_KillForkChild(mut child_pid: libc::c_int) -> libc::c_int {
13463    if TerminateModuleForkChild(child_pid, 1 as libc::c_int) == 0 as libc::c_int {
13464        return 0 as libc::c_int
13465    } else {
13466        return 1 as libc::c_int
13467    };
13468}
13469#[no_mangle]
13470pub unsafe extern "C" fn ModuleForkDoneHandler(
13471    mut exitcode: libc::c_int,
13472    mut bysignal: libc::c_int,
13473) {
13474    if !((2 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
13475        _serverLog(
13476            2 as libc::c_int,
13477            b"Module fork exited pid: %ld, retcode: %d, bysignal: %d\0" as *const u8
13478                as *const libc::c_char,
13479            server.child_pid as libc::c_long,
13480            exitcode,
13481            bysignal,
13482        );
13483    }
13484    if (moduleForkInfo.done_handler).is_some() {
13485        (moduleForkInfo.done_handler)
13486            .expect(
13487                "non-null function pointer",
13488            )(exitcode, bysignal, moduleForkInfo.done_handler_user_data);
13489    }
13490    moduleForkInfo.done_handler = None;
13491    moduleForkInfo.done_handler_user_data = 0 as *mut libc::c_void;
13492}
13493static mut moduleEventVersions: [uint64_t; 17] = [
13494    1 as libc::c_int as uint64_t,
13495    -(1 as libc::c_int) as uint64_t,
13496    1 as libc::c_int as uint64_t,
13497    -(1 as libc::c_int) as uint64_t,
13498    1 as libc::c_int as uint64_t,
13499    -(1 as libc::c_int) as uint64_t,
13500    -(1 as libc::c_int) as uint64_t,
13501    -(1 as libc::c_int) as uint64_t,
13502    1 as libc::c_int as uint64_t,
13503    1 as libc::c_int as uint64_t,
13504    1 as libc::c_int as uint64_t,
13505    1 as libc::c_int as uint64_t,
13506    -(1 as libc::c_int) as uint64_t,
13507    -(1 as libc::c_int) as uint64_t,
13508    -(1 as libc::c_int) as uint64_t,
13509    -(1 as libc::c_int) as uint64_t,
13510    -(1 as libc::c_int) as uint64_t,
13511];
13512#[no_mangle]
13513pub unsafe extern "C" fn RM_SubscribeToServerEvent(
13514    mut ctx: *mut RedisModuleCtx,
13515    mut event: RedisModuleEvent,
13516    mut callback: RedisModuleEventCallback,
13517) -> libc::c_int {
13518    let mut el: *mut RedisModuleEventListener = 0 as *mut RedisModuleEventListener;
13519    if ((*ctx).module).is_null() {
13520        return 1 as libc::c_int;
13521    }
13522    if event.id >= 17 as libc::c_int as libc::c_ulong {
13523        return 1 as libc::c_int;
13524    }
13525    if event.dataver > moduleEventVersions[event.id as usize] {
13526        return 1 as libc::c_int;
13527    }
13528    let mut li: listIter = listIter {
13529        next: 0 as *mut listNode,
13530        direction: 0,
13531    };
13532    let mut ln: *mut listNode = 0 as *mut listNode;
13533    listRewind(RedisModule_EventListeners, &mut li);
13534    loop {
13535        ln = listNext(&mut li);
13536        if ln.is_null() {
13537            break;
13538        }
13539        el = (*ln).value as *mut RedisModuleEventListener;
13540        if (*el).module == (*ctx).module && (*el).event.id == event.id {
13541            break;
13542        }
13543    }
13544    if !ln.is_null() {
13545        if callback.is_none() {
13546            listDelNode(RedisModule_EventListeners, ln);
13547            zfree(el as *mut libc::c_void);
13548        } else {
13549            (*el).callback = callback;
13550        }
13551        return 0 as libc::c_int;
13552    }
13553    el = zmalloc(core::mem::size_of::<RedisModuleEventListener>() as libc::c_ulong)
13554        as *mut RedisModuleEventListener;
13555    (*el).module = (*ctx).module;
13556    (*el).event = event;
13557    (*el).callback = callback;
13558    listAddNodeTail(RedisModule_EventListeners, el as *mut libc::c_void);
13559    return 0 as libc::c_int;
13560}
13561#[no_mangle]
13562pub unsafe extern "C" fn RM_IsSubEventSupported(
13563    mut event: RedisModuleEvent,
13564    mut subevent: int64_t,
13565) -> libc::c_int {
13566    match event.id {
13567        0 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13568        1 => return (subevent < 6 as libc::c_int as libc::c_long) as libc::c_int,
13569        2 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13570        3 => return (subevent < 5 as libc::c_int as libc::c_long) as libc::c_int,
13571        4 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13572        5 => return (subevent < 0 as libc::c_int as libc::c_long) as libc::c_int,
13573        6 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13574        7 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13575        8 => return (subevent < 0 as libc::c_int as libc::c_long) as libc::c_int,
13576        9 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13577        10 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13578        11 => return (subevent < 0 as libc::c_int as libc::c_long) as libc::c_int,
13579        14 => return (subevent < 3 as libc::c_int as libc::c_long) as libc::c_int,
13580        13 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13581        15 => return (subevent < 2 as libc::c_int as libc::c_long) as libc::c_int,
13582        16 => return (subevent < 1 as libc::c_int as libc::c_long) as libc::c_int,
13583        _ => {}
13584    }
13585    return 0 as libc::c_int;
13586}
13587#[no_mangle]
13588pub unsafe extern "C" fn moduleFireServerEvent(
13589    mut eid: uint64_t,
13590    mut subid: libc::c_int,
13591    mut data: *mut libc::c_void,
13592) {
13593    if (*RedisModule_EventListeners).len == 0 as libc::c_int as libc::c_ulong {
13594        return;
13595    }
13596    let mut li: listIter = listIter {
13597        next: 0 as *mut listNode,
13598        direction: 0,
13599    };
13600    let mut ln: *mut listNode = 0 as *mut listNode;
13601    listRewind(RedisModule_EventListeners, &mut li);
13602    loop {
13603        ln = listNext(&mut li);
13604        if ln.is_null() {
13605            break;
13606        }
13607        let mut el: *mut RedisModuleEventListener = (*ln).value
13608            as *mut RedisModuleEventListener;
13609        if !((*el).event.id == eid) {
13610            continue;
13611        }
13612        let mut ctx: RedisModuleCtx = RedisModuleCtx {
13613            getapifuncptr: 0 as *mut libc::c_void,
13614            module: 0 as *mut RedisModule,
13615            client: 0 as *mut client,
13616            blocked_client: 0 as *mut RedisModuleBlockedClient,
13617            amqueue: 0 as *mut AutoMemEntry,
13618            amqueue_len: 0,
13619            amqueue_used: 0,
13620            flags: 0,
13621            postponed_arrays: 0 as *mut *mut libc::c_void,
13622            postponed_arrays_count: 0,
13623            blocked_privdata: 0 as *mut libc::c_void,
13624            blocked_ready_key: 0 as *mut robj,
13625            keys_result: 0 as *mut getKeysResult,
13626            pa_head: 0 as *mut RedisModulePoolAllocBlock,
13627            next_yield_time: 0,
13628            user: 0 as *const RedisModuleUser,
13629        };
13630        if eid == 4 as libc::c_int as libc::c_ulong {
13631            moduleCreateContext(&mut ctx, (*el).module, 0 as libc::c_int);
13632            ctx.client = data as *mut client;
13633        } else {
13634            moduleCreateContext(
13635                &mut ctx,
13636                (*el).module,
13637                (1 as libc::c_int) << 6 as libc::c_int,
13638            );
13639        }
13640        let mut moduledata: *mut libc::c_void = 0 as *mut libc::c_void;
13641        let mut civ1: RedisModuleClientInfoV1 = RedisModuleClientInfoV1 {
13642            version: 0,
13643            flags: 0,
13644            id: 0,
13645            addr: [0; 46],
13646            port: 0,
13647            db: 0,
13648        };
13649        let mut riv1: RedisModuleReplicationInfoV1 = RedisModuleReplicationInfoV1 {
13650            version: 0,
13651            master: 0,
13652            masterhost: 0 as *mut libc::c_char,
13653            masterport: 0,
13654            replid1: 0 as *mut libc::c_char,
13655            replid2: 0 as *mut libc::c_char,
13656            repl1_offset: 0,
13657            repl2_offset: 0,
13658        };
13659        let mut mcv1: RedisModuleModuleChangeV1 = RedisModuleModuleChangeV1 {
13660            version: 0,
13661            module_name: 0 as *const libc::c_char,
13662            module_version: 0,
13663        };
13664        if eid == 4 as libc::c_int as libc::c_ulong {
13665            if modulePopulateClientInfoStructure(
13666                &mut civ1 as *mut RedisModuleClientInfoV1 as *mut libc::c_void,
13667                data as *mut client,
13668                (*el).event.dataver as libc::c_int,
13669            ) == 0 as libc::c_int
13670            {} else {
13671                _serverAssert(
13672                    b"modulePopulateClientInfoStructure(&civ1,data, el->event.dataver) == REDISMODULE_OK\0"
13673                        as *const u8 as *const libc::c_char,
13674                    b"module.c\0" as *const u8 as *const libc::c_char,
13675                    10798 as libc::c_int,
13676                );
13677                unreachable!();
13678            };
13679            moduledata = &mut civ1 as *mut RedisModuleClientInfoV1 as *mut libc::c_void;
13680        } else if eid == 0 as libc::c_int as libc::c_ulong {
13681            if modulePopulateReplicationInfoStructure(
13682                &mut riv1 as *mut RedisModuleReplicationInfoV1 as *mut libc::c_void,
13683                (*el).event.dataver as libc::c_int,
13684            ) == 0 as libc::c_int
13685            {} else {
13686                _serverAssert(
13687                    b"modulePopulateReplicationInfoStructure(&riv1,el->event.dataver) == REDISMODULE_OK\0"
13688                        as *const u8 as *const libc::c_char,
13689                    b"module.c\0" as *const u8 as *const libc::c_char,
13690                    10801 as libc::c_int,
13691                );
13692                unreachable!();
13693            };
13694            moduledata = &mut riv1 as *mut RedisModuleReplicationInfoV1
13695                as *mut libc::c_void;
13696        } else if eid == 2 as libc::c_int as libc::c_ulong {
13697            moduledata = data;
13698            let mut fi: *mut RedisModuleFlushInfoV1 = data
13699                as *mut RedisModuleFlushInfoV1;
13700            if (*fi).dbnum != -(1 as libc::c_int) {
13701                selectDb(ctx.client, (*fi).dbnum);
13702            }
13703        } else if eid == 9 as libc::c_int as libc::c_ulong {
13704            let mut m: *mut RedisModule = data as *mut RedisModule;
13705            if m == (*el).module {
13706                moduleFreeContext(&mut ctx);
13707                continue;
13708            } else {
13709                mcv1.version = 1 as libc::c_int as uint64_t;
13710                mcv1.module_name = (*m).name;
13711                mcv1.module_version = (*m).ver;
13712                moduledata = &mut mcv1 as *mut RedisModuleModuleChangeV1
13713                    as *mut libc::c_void;
13714            }
13715        } else if eid == 10 as libc::c_int as libc::c_ulong {
13716            moduledata = data;
13717        } else if eid == 8 as libc::c_int as libc::c_ulong {
13718            moduledata = data;
13719        } else if eid == 11 as libc::c_int as libc::c_ulong {
13720            moduledata = data;
13721        } else if eid == 16 as libc::c_int as libc::c_ulong {
13722            moduledata = data;
13723        }
13724        (*(*el).module).in_hook += 1;
13725        ((*el).callback)
13726            .expect(
13727                "non-null function pointer",
13728            )(&mut ctx, (*el).event, subid as uint64_t, moduledata);
13729        (*(*el).module).in_hook -= 1;
13730        moduleFreeContext(&mut ctx);
13731    };
13732}
13733#[no_mangle]
13734pub unsafe extern "C" fn moduleUnsubscribeAllServerEvents(mut module: *mut RedisModule) {
13735    let mut el: *mut RedisModuleEventListener = 0 as *mut RedisModuleEventListener;
13736    let mut li: listIter = listIter {
13737        next: 0 as *mut listNode,
13738        direction: 0,
13739    };
13740    let mut ln: *mut listNode = 0 as *mut listNode;
13741    listRewind(RedisModule_EventListeners, &mut li);
13742    loop {
13743        ln = listNext(&mut li);
13744        if ln.is_null() {
13745            break;
13746        }
13747        el = (*ln).value as *mut RedisModuleEventListener;
13748        if (*el).module == module {
13749            listDelNode(RedisModule_EventListeners, ln);
13750            zfree(el as *mut libc::c_void);
13751        }
13752    };
13753}
13754#[no_mangle]
13755pub unsafe extern "C" fn processModuleLoadingProgressEvent(mut is_aof: libc::c_int) {
13756    let mut now: libc::c_longlong = server.ustime;
13757    static mut next_event: libc::c_longlong = 0 as libc::c_int as libc::c_longlong;
13758    if now >= next_event {
13759        let mut progress: libc::c_int = -(1 as libc::c_int);
13760        if server.loading_total_bytes != 0 {
13761            progress = ((server.loading_loaded_bytes << 10 as libc::c_int)
13762                / server.loading_total_bytes) as libc::c_int;
13763        }
13764        let mut fi: RedisModuleLoadingProgressV1 = {
13765            let mut init = RedisModuleLoadingProgressInfo {
13766                version: 1 as libc::c_int as uint64_t,
13767                hz: server.hz,
13768                progress: progress,
13769            };
13770            init
13771        };
13772        moduleFireServerEvent(
13773            10 as libc::c_int as uint64_t,
13774            if is_aof != 0 { 1 as libc::c_int } else { 0 as libc::c_int },
13775            &mut fi as *mut RedisModuleLoadingProgressV1 as *mut libc::c_void,
13776        );
13777        next_event = now + (1000000 as libc::c_int / server.hz) as libc::c_longlong;
13778    }
13779}
13780#[no_mangle]
13781pub unsafe extern "C" fn moduleNotifyKeyUnlink(
13782    mut key: *mut robj,
13783    mut val: *mut robj,
13784    mut dbid: libc::c_int,
13785) {
13786    if (*val).type_0() as libc::c_int == 5 as libc::c_int {
13787        let mut mv: *mut moduleValue = (*val).ptr as *mut moduleValue;
13788        let mut mt: *mut moduleType = (*mv).type_0;
13789        if ((*mt).unlink2).is_some() {
13790            let mut ctx: RedisModuleKeyOptCtx = {
13791                let mut init = RedisModuleKeyOptCtx {
13792                    from_key: key,
13793                    to_key: 0 as *mut redisObject,
13794                    from_dbid: dbid,
13795                    to_dbid: -(1 as libc::c_int),
13796                };
13797                init
13798            };
13799            ((*mt).unlink2).expect("non-null function pointer")(&mut ctx, (*mv).value);
13800        } else if ((*mt).unlink).is_some() {
13801            ((*mt).unlink).expect("non-null function pointer")(key, (*mv).value);
13802        }
13803    }
13804}
13805#[no_mangle]
13806pub unsafe extern "C" fn moduleGetFreeEffort(
13807    mut key: *mut robj,
13808    mut val: *mut robj,
13809    mut dbid: libc::c_int,
13810) -> size_t {
13811    let mut mv: *mut moduleValue = (*val).ptr as *mut moduleValue;
13812    let mut mt: *mut moduleType = (*mv).type_0;
13813    let mut effort: size_t = 1 as libc::c_int as size_t;
13814    if ((*mt).free_effort2).is_some() {
13815        let mut ctx: RedisModuleKeyOptCtx = {
13816            let mut init = RedisModuleKeyOptCtx {
13817                from_key: key,
13818                to_key: 0 as *mut redisObject,
13819                from_dbid: dbid,
13820                to_dbid: -(1 as libc::c_int),
13821            };
13822            init
13823        };
13824        effort = ((*mt).free_effort2)
13825            .expect("non-null function pointer")(&mut ctx, (*mv).value);
13826    } else if ((*mt).free_effort).is_some() {
13827        effort = ((*mt).free_effort)
13828            .expect("non-null function pointer")(key, (*mv).value);
13829    }
13830    return effort;
13831}
13832#[no_mangle]
13833pub unsafe extern "C" fn moduleGetMemUsage(
13834    mut key: *mut robj,
13835    mut val: *mut robj,
13836    mut sample_size: size_t,
13837    mut dbid: libc::c_int,
13838) -> size_t {
13839    let mut mv: *mut moduleValue = (*val).ptr as *mut moduleValue;
13840    let mut mt: *mut moduleType = (*mv).type_0;
13841    let mut size: size_t = 0 as libc::c_int as size_t;
13842    if ((*mt).mem_usage2).is_some() {
13843        let mut ctx: RedisModuleKeyOptCtx = {
13844            let mut init = RedisModuleKeyOptCtx {
13845                from_key: key,
13846                to_key: 0 as *mut redisObject,
13847                from_dbid: dbid,
13848                to_dbid: -(1 as libc::c_int),
13849            };
13850            init
13851        };
13852        size = ((*mt).mem_usage2)
13853            .expect("non-null function pointer")(&mut ctx, (*mv).value, sample_size);
13854    } else if ((*mt).mem_usage).is_some() {
13855        size = ((*mt).mem_usage).expect("non-null function pointer")((*mv).value);
13856    }
13857    return size;
13858}
13859#[no_mangle]
13860pub unsafe extern "C" fn dictCStringKeyHash(mut key: *const libc::c_void) -> uint64_t {
13861    return dictGenHashFunction(
13862        key as *mut libc::c_uchar as *const libc::c_void,
13863        strlen(key as *mut libc::c_char),
13864    );
13865}
13866#[no_mangle]
13867pub unsafe extern "C" fn dictCStringKeyCompare(
13868    mut d: *mut dict,
13869    mut key1: *const libc::c_void,
13870    mut key2: *const libc::c_void,
13871) -> libc::c_int {
13872    return (strcmp(key1 as *const libc::c_char, key2 as *const libc::c_char)
13873        == 0 as libc::c_int) as libc::c_int;
13874}
13875#[no_mangle]
13876pub static mut moduleAPIDictType: dictType = unsafe {
13877    {
13878        let mut init = dictType {
13879            hashFunction: Some(
13880                dictCStringKeyHash
13881                    as unsafe extern "C" fn(*const libc::c_void) -> uint64_t,
13882            ),
13883            keyDup: None,
13884            valDup: None,
13885            keyCompare: Some(
13886                dictCStringKeyCompare
13887                    as unsafe extern "C" fn(
13888                        *mut dict,
13889                        *const libc::c_void,
13890                        *const libc::c_void,
13891                    ) -> libc::c_int,
13892            ),
13893            keyDestructor: None,
13894            valDestructor: None,
13895            expandAllowed: None,
13896            dictEntryMetadataBytes: None,
13897        };
13898        init
13899    }
13900};
13901#[no_mangle]
13902pub unsafe extern "C" fn moduleRegisterApi(
13903    mut funcname: *const libc::c_char,
13904    mut funcptr: *mut libc::c_void,
13905) -> libc::c_int {
13906    return dictAdd(
13907        server.moduleapi,
13908        funcname as *mut libc::c_char as *mut libc::c_void,
13909        funcptr,
13910    );
13911}
13912#[no_mangle]
13913pub unsafe extern "C" fn moduleInitModulesSystemLast() {}
13914#[no_mangle]
13915pub static mut sdsKeyValueHashDictType: dictType = unsafe {
13916    {
13917        let mut init = dictType {
13918            hashFunction: Some(
13919                dictSdsCaseHash as unsafe extern "C" fn(*const libc::c_void) -> uint64_t,
13920            ),
13921            keyDup: None,
13922            valDup: None,
13923            keyCompare: Some(
13924                dictSdsKeyCaseCompare
13925                    as unsafe extern "C" fn(
13926                        *mut dict,
13927                        *const libc::c_void,
13928                        *const libc::c_void,
13929                    ) -> libc::c_int,
13930            ),
13931            keyDestructor: Some(
13932                dictSdsDestructor
13933                    as unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
13934            ),
13935            valDestructor: Some(
13936                dictSdsDestructor
13937                    as unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
13938            ),
13939            expandAllowed: None,
13940            dictEntryMetadataBytes: None,
13941        };
13942        init
13943    }
13944};
13945#[no_mangle]
13946pub unsafe extern "C" fn moduleInitModulesSystem() {
13947    moduleUnblockedClients = listCreate();
13948    server.loadmodule_queue = listCreate();
13949    server.module_configs_queue = dictCreate(&mut sdsKeyValueHashDictType);
13950    modules = dictCreate(&mut modulesDictType);
13951    moduleKeyspaceSubscribers = listCreate();
13952    moduleCommandFilters = listCreate();
13953    moduleRegisterCoreAPI();
13954    if anetPipe(
13955        (server.module_pipe).as_mut_ptr(),
13956        0o2000000 as libc::c_int | 0o4000 as libc::c_int,
13957        0o2000000 as libc::c_int | 0o4000 as libc::c_int,
13958    ) == -(1 as libc::c_int)
13959    {
13960        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
13961            _serverLog(
13962                3 as libc::c_int,
13963                b"Can't create the pipe for module threads: %s\0" as *const u8
13964                    as *const libc::c_char,
13965                strerror(*__errno_location()),
13966            );
13967        }
13968        exit(1 as libc::c_int);
13969    }
13970    Timers = raxNew();
13971    RedisModule_EventListeners = listCreate();
13972    if (core::mem::size_of::<[uint64_t; 17]>() as libc::c_ulong)
13973        .wrapping_div(core::mem::size_of::<uint64_t>() as libc::c_ulong)
13974        == 17 as libc::c_int as libc::c_ulong
13975    {} else {
13976        _serverAssert(
13977            b"sizeof(moduleEventVersions)/sizeof(moduleEventVersions[0]) == _REDISMODULE_EVENT_NEXT\0"
13978                as *const u8 as *const libc::c_char,
13979            b"module.c\0" as *const u8 as *const libc::c_char,
13980            11012 as libc::c_int,
13981        );
13982        unreachable!();
13983    };
13984    pthread_mutex_lock(&mut moduleGIL);
13985}
13986#[no_mangle]
13987pub unsafe extern "C" fn modulesCron() {
13988    let mut iteration: libc::c_int = 50 as libc::c_int;
13989    let min_client: libc::c_uint = 8 as libc::c_int as libc::c_uint;
13990    while iteration > 0 as libc::c_int
13991        && moduleTempClientCount > 0 as libc::c_int as libc::c_ulong
13992        && moduleTempClientMinCount > min_client as libc::c_ulong
13993    {
13994        moduleTempClientCount = moduleTempClientCount.wrapping_sub(1);
13995        let mut c: *mut client = *moduleTempClients
13996            .offset(moduleTempClientCount as isize);
13997        freeClient(c);
13998        iteration -= 1;
13999        moduleTempClientMinCount = moduleTempClientMinCount.wrapping_sub(1);
14000    }
14001    moduleTempClientMinCount = moduleTempClientCount;
14002    if moduleTempClientCap > 32 as libc::c_int as libc::c_ulong
14003        && moduleTempClientCap
14004            > moduleTempClientCount.wrapping_mul(4 as libc::c_int as libc::c_ulong)
14005    {
14006        moduleTempClientCap = (moduleTempClientCap as libc::c_ulong)
14007            .wrapping_div(4 as libc::c_int as libc::c_ulong) as size_t as size_t;
14008        moduleTempClients = zrealloc(
14009            moduleTempClients as *mut libc::c_void,
14010            (core::mem::size_of::<*mut client>() as libc::c_ulong)
14011                .wrapping_mul(moduleTempClientCap),
14012        ) as *mut *mut client;
14013    }
14014}
14015#[no_mangle]
14016pub unsafe extern "C" fn moduleLoadQueueEntryFree(
14017    mut loadmod: *mut moduleLoadQueueEntry,
14018) {
14019    if loadmod.is_null() {
14020        return;
14021    }
14022    sdsfree((*loadmod).path);
14023    let mut i: libc::c_int = 0 as libc::c_int;
14024    while i < (*loadmod).argc {
14025        decrRefCount(*((*loadmod).argv).offset(i as isize));
14026        i += 1;
14027    }
14028    zfree((*loadmod).argv as *mut libc::c_void);
14029    zfree(loadmod as *mut libc::c_void);
14030}
14031#[no_mangle]
14032pub unsafe extern "C" fn moduleRemoveConfigs(mut module: *mut RedisModule) {
14033    let mut li: listIter = listIter {
14034        next: 0 as *mut listNode,
14035        direction: 0,
14036    };
14037    let mut ln: *mut listNode = 0 as *mut listNode;
14038    listRewind((*module).module_configs, &mut li);
14039    loop {
14040        ln = listNext(&mut li);
14041        if ln.is_null() {
14042            break;
14043        }
14044        let mut config: *mut ModuleConfig = (*ln).value as *mut ModuleConfig;
14045        let mut module_name: sds = sdsnew((*module).name);
14046        let mut full_name: sds = sdscat(
14047            sdscat(module_name, b".\0" as *const u8 as *const libc::c_char),
14048            (*config).name as *const libc::c_char,
14049        );
14050        removeConfig(full_name);
14051        sdsfree(full_name);
14052    };
14053}
14054#[no_mangle]
14055pub unsafe extern "C" fn moduleLoadFromQueue() {
14056    let mut li: listIter = listIter {
14057        next: 0 as *mut listNode,
14058        direction: 0,
14059    };
14060    let mut ln: *mut listNode = 0 as *mut listNode;
14061    listRewind(server.loadmodule_queue, &mut li);
14062    loop {
14063        ln = listNext(&mut li);
14064        if ln.is_null() {
14065            break;
14066        }
14067        let mut loadmod: *mut moduleLoadQueueEntry = (*ln).value
14068            as *mut moduleLoadQueueEntry;
14069        if moduleLoad(
14070            (*loadmod).path as *const libc::c_char,
14071            (*loadmod).argv as *mut *mut libc::c_void,
14072            (*loadmod).argc,
14073            0 as libc::c_int,
14074        ) == -(1 as libc::c_int)
14075        {
14076            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14077                _serverLog(
14078                    3 as libc::c_int,
14079                    b"Can't load module from %s: server aborting\0" as *const u8
14080                        as *const libc::c_char,
14081                    (*loadmod).path,
14082                );
14083            }
14084            exit(1 as libc::c_int);
14085        }
14086        moduleLoadQueueEntryFree(loadmod);
14087        listDelNode(server.loadmodule_queue, ln);
14088    }
14089    if ((*server.module_configs_queue).ht_used[0 as libc::c_int as usize])
14090        .wrapping_add((*server.module_configs_queue).ht_used[1 as libc::c_int as usize])
14091        != 0
14092    {
14093        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14094            _serverLog(
14095                3 as libc::c_int,
14096                b"Module Configuration detected without loadmodule directive or no ApplyConfig call: aborting\0"
14097                    as *const u8 as *const libc::c_char,
14098            );
14099        }
14100        exit(1 as libc::c_int);
14101    }
14102}
14103#[no_mangle]
14104pub unsafe extern "C" fn moduleFreeModuleStructure(mut module: *mut RedisModule) {
14105    listRelease((*module).types);
14106    listRelease((*module).filters);
14107    listRelease((*module).usedby);
14108    listRelease((*module).using);
14109    listRelease((*module).module_configs);
14110    sdsfree((*module).name);
14111    moduleLoadQueueEntryFree((*module).loadmod);
14112    zfree(module as *mut libc::c_void);
14113}
14114#[no_mangle]
14115pub unsafe extern "C" fn moduleFreeArgs(
14116    mut args: *mut redisCommandArg,
14117    mut num_args: libc::c_int,
14118) {
14119    let mut j: libc::c_int = 0 as libc::c_int;
14120    while j < num_args {
14121        zfree((*args.offset(j as isize)).name as *mut libc::c_char as *mut libc::c_void);
14122        zfree(
14123            (*args.offset(j as isize)).token as *mut libc::c_char as *mut libc::c_void,
14124        );
14125        zfree(
14126            (*args.offset(j as isize)).summary as *mut libc::c_char as *mut libc::c_void,
14127        );
14128        zfree(
14129            (*args.offset(j as isize)).since as *mut libc::c_char as *mut libc::c_void,
14130        );
14131        zfree(
14132            (*args.offset(j as isize)).deprecated_since as *mut libc::c_char
14133                as *mut libc::c_void,
14134        );
14135        if !((*args.offset(j as isize)).subargs).is_null() {
14136            moduleFreeArgs(
14137                (*args.offset(j as isize)).subargs,
14138                (*args.offset(j as isize)).num_args,
14139            );
14140        }
14141        j += 1;
14142    }
14143    zfree(args as *mut libc::c_void);
14144}
14145#[no_mangle]
14146pub unsafe extern "C" fn moduleFreeCommand(
14147    mut module: *mut RedisModule,
14148    mut cmd: *mut redisCommand,
14149) -> libc::c_int {
14150    if (*cmd).proc_0
14151        != Some(RedisModuleCommandDispatcher as unsafe extern "C" fn(*mut client) -> ())
14152    {
14153        return -(1 as libc::c_int);
14154    }
14155    let mut cp: *mut RedisModuleCommand = (*cmd).module_cmd;
14156    if (*cp).module != module {
14157        return -(1 as libc::c_int);
14158    }
14159    let mut j: libc::c_int = 0 as libc::c_int;
14160    while j < (*cmd).key_specs_num {
14161        if !((*((*cmd).key_specs).offset(j as isize)).notes).is_null() {
14162            zfree(
14163                (*((*cmd).key_specs).offset(j as isize)).notes as *mut libc::c_char
14164                    as *mut libc::c_void,
14165            );
14166        }
14167        if (*((*cmd).key_specs).offset(j as isize)).begin_search_type as libc::c_uint
14168            == KSPEC_BS_KEYWORD as libc::c_int as libc::c_uint
14169        {
14170            zfree(
14171                (*((*cmd).key_specs).offset(j as isize)).bs.keyword.keyword
14172                    as *mut libc::c_char as *mut libc::c_void,
14173            );
14174        }
14175        j += 1;
14176    }
14177    if (*cmd).key_specs != ((*cmd).key_specs_static).as_mut_ptr() {
14178        zfree((*cmd).key_specs as *mut libc::c_void);
14179    }
14180    let mut j_0: libc::c_int = 0 as libc::c_int;
14181    while !((*cmd).tips).is_null() && !(*((*cmd).tips).offset(j_0 as isize)).is_null() {
14182        zfree(
14183            *((*cmd).tips).offset(j_0 as isize) as *mut libc::c_char as *mut libc::c_void,
14184        );
14185        j_0 += 1;
14186    }
14187    zfree((*cmd).tips as *mut libc::c_void);
14188    let mut j_1: libc::c_int = 0 as libc::c_int;
14189    while !((*cmd).history).is_null()
14190        && !((*((*cmd).history).offset(j_1 as isize)).since).is_null()
14191    {
14192        zfree(
14193            (*((*cmd).history).offset(j_1 as isize)).since as *mut libc::c_char
14194                as *mut libc::c_void,
14195        );
14196        zfree(
14197            (*((*cmd).history).offset(j_1 as isize)).changes as *mut libc::c_char
14198                as *mut libc::c_void,
14199        );
14200        j_1 += 1;
14201    }
14202    zfree((*cmd).history as *mut libc::c_void);
14203    zfree((*cmd).summary as *mut libc::c_char as *mut libc::c_void);
14204    zfree((*cmd).since as *mut libc::c_char as *mut libc::c_void);
14205    zfree((*cmd).deprecated_since as *mut libc::c_char as *mut libc::c_void);
14206    zfree((*cmd).complexity as *mut libc::c_char as *mut libc::c_void);
14207    if !((*cmd).latency_histogram).is_null() {
14208        hdr_close((*cmd).latency_histogram);
14209        (*cmd).latency_histogram = 0 as *mut hdr_histogram;
14210    }
14211    moduleFreeArgs((*cmd).args, (*cmd).num_args);
14212    zfree(cp as *mut libc::c_void);
14213    if !((*cmd).subcommands_dict).is_null() {
14214        let mut de: *mut dictEntry = 0 as *mut dictEntry;
14215        let mut di: *mut dictIterator = dictGetSafeIterator((*cmd).subcommands_dict);
14216        loop {
14217            de = dictNext(di);
14218            if de.is_null() {
14219                break;
14220            }
14221            let mut sub: *mut redisCommand = (*de).v.val as *mut redisCommand;
14222            if moduleFreeCommand(module, sub) != 0 as libc::c_int {
14223                continue;
14224            }
14225            if dictDelete(
14226                (*cmd).subcommands_dict,
14227                (*sub).declared_name as *const libc::c_void,
14228            ) == 0 as libc::c_int
14229            {} else {
14230                _serverAssert(
14231                    b"dictDelete(cmd->subcommands_dict, sub->declared_name) == DICT_OK\0"
14232                        as *const u8 as *const libc::c_char,
14233                    b"module.c\0" as *const u8 as *const libc::c_char,
14234                    11178 as libc::c_int,
14235                );
14236                unreachable!();
14237            };
14238            sdsfree((*sub).declared_name as sds);
14239            sdsfree((*sub).fullname);
14240            zfree(sub as *mut libc::c_void);
14241        }
14242        dictReleaseIterator(di);
14243        dictRelease((*cmd).subcommands_dict);
14244    }
14245    return 0 as libc::c_int;
14246}
14247#[no_mangle]
14248pub unsafe extern "C" fn moduleUnregisterCommands(mut module: *mut RedisModule) {
14249    let mut di: *mut dictIterator = dictGetSafeIterator(server.commands);
14250    let mut de: *mut dictEntry = 0 as *mut dictEntry;
14251    loop {
14252        de = dictNext(di);
14253        if de.is_null() {
14254            break;
14255        }
14256        let mut cmd: *mut redisCommand = (*de).v.val as *mut redisCommand;
14257        if moduleFreeCommand(module, cmd) != 0 as libc::c_int {
14258            continue;
14259        }
14260        if dictDelete(server.commands, (*cmd).fullname as *const libc::c_void)
14261            == 0 as libc::c_int
14262        {} else {
14263            _serverAssert(
14264                b"dictDelete(server.commands, cmd->fullname) == DICT_OK\0" as *const u8
14265                    as *const libc::c_char,
14266                b"module.c\0" as *const u8 as *const libc::c_char,
14267                11198 as libc::c_int,
14268            );
14269            unreachable!();
14270        };
14271        if dictDelete(server.orig_commands, (*cmd).fullname as *const libc::c_void)
14272            == 0 as libc::c_int
14273        {} else {
14274            _serverAssert(
14275                b"dictDelete(server.orig_commands, cmd->fullname) == DICT_OK\0"
14276                    as *const u8 as *const libc::c_char,
14277                b"module.c\0" as *const u8 as *const libc::c_char,
14278                11199 as libc::c_int,
14279            );
14280            unreachable!();
14281        };
14282        sdsfree((*cmd).declared_name as sds);
14283        sdsfree((*cmd).fullname);
14284        zfree(cmd as *mut libc::c_void);
14285    }
14286    dictReleaseIterator(di);
14287}
14288#[no_mangle]
14289pub unsafe extern "C" fn parseLoadexArguments(
14290    mut module_argv: *mut *mut *mut robj,
14291    mut module_argc: *mut libc::c_int,
14292) -> libc::c_int {
14293    let mut args_specified: libc::c_int = 0 as libc::c_int;
14294    let mut argv: *mut *mut robj = *module_argv;
14295    let mut argc: libc::c_int = *module_argc;
14296    let mut i: libc::c_int = 0 as libc::c_int;
14297    while i < argc {
14298        let mut arg_val: *mut libc::c_char = (**argv.offset(i as isize)).ptr
14299            as *mut libc::c_char;
14300        if strcasecmp(arg_val, b"CONFIG\0" as *const u8 as *const libc::c_char) == 0 {
14301            if i + 2 as libc::c_int >= argc {
14302                if !((2 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14303                    _serverLog(
14304                        2 as libc::c_int,
14305                        b"CONFIG specified without name value pair\0" as *const u8
14306                            as *const libc::c_char,
14307                    );
14308                }
14309                return 1 as libc::c_int;
14310            }
14311            let mut name: sds = sdsdup(
14312                (**argv.offset((i + 1 as libc::c_int) as isize)).ptr as sds,
14313            );
14314            let mut value: sds = sdsdup(
14315                (**argv.offset((i + 2 as libc::c_int) as isize)).ptr as sds,
14316            );
14317            if dictReplace(
14318                server.module_configs_queue,
14319                name as *mut libc::c_void,
14320                value as *mut libc::c_void,
14321            ) == 0
14322            {
14323                sdsfree(name);
14324            }
14325            i += 2 as libc::c_int;
14326            i += 1;
14327        } else if strcasecmp(arg_val, b"ARGS\0" as *const u8 as *const libc::c_char) == 0
14328        {
14329            args_specified = 1 as libc::c_int;
14330            i += 1;
14331            if i >= argc {
14332                *module_argv = 0 as *mut *mut robj;
14333                *module_argc = 0 as libc::c_int;
14334            } else {
14335                *module_argv = argv.offset(i as isize);
14336                *module_argc = argc - i;
14337            }
14338            break;
14339        } else {
14340            if !((2 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14341                _serverLog(
14342                    2 as libc::c_int,
14343                    b"Syntax Error from arguments to loadex around %s.\0" as *const u8
14344                        as *const libc::c_char,
14345                    arg_val,
14346                );
14347            }
14348            return 1 as libc::c_int;
14349        }
14350    }
14351    if args_specified == 0 {
14352        *module_argv = 0 as *mut *mut robj;
14353        *module_argc = 0 as libc::c_int;
14354    }
14355    return 0 as libc::c_int;
14356}
14357#[no_mangle]
14358pub unsafe extern "C" fn moduleLoad(
14359    mut path: *const libc::c_char,
14360    mut module_argv: *mut *mut libc::c_void,
14361    mut module_argc: libc::c_int,
14362    mut is_loadex: libc::c_int,
14363) -> libc::c_int {
14364    let mut onload: Option::<
14365        unsafe extern "C" fn(
14366            *mut libc::c_void,
14367            *mut *mut libc::c_void,
14368            libc::c_int,
14369        ) -> libc::c_int,
14370    > = None;
14371    let mut handle: *mut libc::c_void = 0 as *mut libc::c_void;
14372    let mut st: stat = stat {
14373        st_dev: 0,
14374        st_ino: 0,
14375        st_mode: 0,
14376        st_nlink: 0,
14377        st_uid: 0,
14378        st_gid: 0,
14379        st_rdev: 0,
14380        __pad1: 0,
14381        st_size: 0,
14382        st_blksize: 0,
14383        __pad2: 0,
14384        st_blocks: 0,
14385        st_atim: timespec { tv_sec: 0, tv_nsec: 0 },
14386        st_mtim: timespec { tv_sec: 0, tv_nsec: 0 },
14387        st_ctim: timespec { tv_sec: 0, tv_nsec: 0 },
14388        __glibc_reserved: [0; 2],
14389    };
14390    if stat(path, &mut st) == 0 as libc::c_int {
14391        if st.st_mode
14392            & (0o100 as libc::c_int | 0o100 as libc::c_int >> 3 as libc::c_int
14393                | 0o100 as libc::c_int >> 3 as libc::c_int >> 3 as libc::c_int)
14394                as libc::c_uint == 0
14395        {
14396            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14397                _serverLog(
14398                    3 as libc::c_int,
14399                    b"Module %s failed to load: It does not have execute permissions.\0"
14400                        as *const u8 as *const libc::c_char,
14401                    path,
14402                );
14403            }
14404            return -(1 as libc::c_int);
14405        }
14406    }
14407    handle = dlopen(path, 0x2 as libc::c_int | 0 as libc::c_int);
14408    if handle.is_null() {
14409        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14410            _serverLog(
14411                3 as libc::c_int,
14412                b"Module %s failed to load: %s\0" as *const u8 as *const libc::c_char,
14413                path,
14414                dlerror(),
14415            );
14416        }
14417        return -(1 as libc::c_int);
14418    }
14419    onload = core::mem::transmute::<
14420        libc::intptr_t,
14421        Option::<
14422            unsafe extern "C" fn(
14423                *mut libc::c_void,
14424                *mut *mut libc::c_void,
14425                libc::c_int,
14426            ) -> libc::c_int,
14427        >,
14428    >(
14429        dlsym(handle, b"RedisModule_OnLoad\0" as *const u8 as *const libc::c_char)
14430            as libc::c_ulong as libc::intptr_t,
14431    );
14432    if onload.is_none() {
14433        dlclose(handle);
14434        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14435            _serverLog(
14436                3 as libc::c_int,
14437                b"Module %s does not export RedisModule_OnLoad() symbol. Module not loaded.\0"
14438                    as *const u8 as *const libc::c_char,
14439                path,
14440            );
14441        }
14442        return -(1 as libc::c_int);
14443    }
14444    let mut ctx: RedisModuleCtx = RedisModuleCtx {
14445        getapifuncptr: 0 as *mut libc::c_void,
14446        module: 0 as *mut RedisModule,
14447        client: 0 as *mut client,
14448        blocked_client: 0 as *mut RedisModuleBlockedClient,
14449        amqueue: 0 as *mut AutoMemEntry,
14450        amqueue_len: 0,
14451        amqueue_used: 0,
14452        flags: 0,
14453        postponed_arrays: 0 as *mut *mut libc::c_void,
14454        postponed_arrays_count: 0,
14455        blocked_privdata: 0 as *mut libc::c_void,
14456        blocked_ready_key: 0 as *mut robj,
14457        keys_result: 0 as *mut getKeysResult,
14458        pa_head: 0 as *mut RedisModulePoolAllocBlock,
14459        next_yield_time: 0,
14460        user: 0 as *const RedisModuleUser,
14461    };
14462    moduleCreateContext(
14463        &mut ctx,
14464        0 as *mut RedisModule,
14465        (1 as libc::c_int) << 6 as libc::c_int,
14466    );
14467    if onload
14468        .expect(
14469            "non-null function pointer",
14470        )(&mut ctx as *mut RedisModuleCtx as *mut libc::c_void, module_argv, module_argc)
14471        == 1 as libc::c_int
14472    {
14473        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14474            _serverLog(
14475                3 as libc::c_int,
14476                b"Module %s initialization failed. Module not loaded\0" as *const u8
14477                    as *const libc::c_char,
14478                path,
14479            );
14480        }
14481        if !(ctx.module).is_null() {
14482            moduleUnregisterCommands(ctx.module);
14483            moduleUnregisterSharedAPI(ctx.module);
14484            moduleUnregisterUsedAPI(ctx.module);
14485            moduleRemoveConfigs(ctx.module);
14486            moduleFreeModuleStructure(ctx.module);
14487        }
14488        moduleFreeContext(&mut ctx);
14489        dlclose(handle);
14490        return -(1 as libc::c_int);
14491    }
14492    dictAdd(
14493        modules,
14494        (*ctx.module).name as *mut libc::c_void,
14495        ctx.module as *mut libc::c_void,
14496    );
14497    (*ctx.module).blocked_clients = 0 as libc::c_int;
14498    (*ctx.module).handle = handle;
14499    (*ctx.module)
14500        .loadmod = zmalloc(
14501        core::mem::size_of::<moduleLoadQueueEntry>() as libc::c_ulong,
14502    ) as *mut moduleLoadQueueEntry;
14503    (*(*ctx.module).loadmod).path = sdsnew(path);
14504    (*(*ctx.module).loadmod)
14505        .argv = (if module_argc != 0 {
14506        zmalloc(
14507            (core::mem::size_of::<*mut robj>() as libc::c_ulong)
14508                .wrapping_mul(module_argc as libc::c_ulong),
14509        )
14510    } else {
14511        0 as *mut libc::c_void
14512    }) as *mut *mut robj;
14513    (*(*ctx.module).loadmod).argc = module_argc;
14514    let mut i: libc::c_int = 0 as libc::c_int;
14515    while i < module_argc {
14516        let ref mut fresh39 = *((*(*ctx.module).loadmod).argv).offset(i as isize);
14517        *fresh39 = *module_argv.offset(i as isize) as *mut robj;
14518        incrRefCount(*((*(*ctx.module).loadmod).argv).offset(i as isize));
14519        i += 1;
14520    }
14521    if !((2 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14522        _serverLog(
14523            2 as libc::c_int,
14524            b"Module '%s' loaded from %s\0" as *const u8 as *const libc::c_char,
14525            (*ctx.module).name,
14526            path,
14527        );
14528    }
14529    if (*(*ctx.module).module_configs).len != 0 && (*ctx.module).configs_initialized == 0
14530    {
14531        serverLogRaw(
14532            3 as libc::c_int,
14533            b"Module Configurations were not set, likely a missing LoadConfigs call. Unloading the module.\0"
14534                as *const u8 as *const libc::c_char,
14535        );
14536        moduleUnload((*ctx.module).name);
14537        moduleFreeContext(&mut ctx);
14538        return -(1 as libc::c_int);
14539    }
14540    if is_loadex != 0
14541        && ((*server.module_configs_queue).ht_used[0 as libc::c_int as usize])
14542            .wrapping_add(
14543                (*server.module_configs_queue).ht_used[1 as libc::c_int as usize],
14544            ) != 0
14545    {
14546        serverLogRaw(
14547            3 as libc::c_int,
14548            b"Loadex configurations were not applied, likely due to invalid arguments. Unloading the module.\0"
14549                as *const u8 as *const libc::c_char,
14550        );
14551        moduleUnload((*ctx.module).name);
14552        moduleFreeContext(&mut ctx);
14553        return -(1 as libc::c_int);
14554    }
14555    moduleFireServerEvent(
14556        9 as libc::c_int as uint64_t,
14557        0 as libc::c_int,
14558        ctx.module as *mut libc::c_void,
14559    );
14560    moduleFreeContext(&mut ctx);
14561    return 0 as libc::c_int;
14562}
14563#[no_mangle]
14564pub unsafe extern "C" fn moduleUnload(mut name: sds) -> libc::c_int {
14565    let mut module: *mut RedisModule = dictFetchValue(
14566        modules,
14567        name as *const libc::c_void,
14568    ) as *mut RedisModule;
14569    if module.is_null() {
14570        *__errno_location() = 2 as libc::c_int;
14571        return -(1 as libc::c_int);
14572    } else {
14573        if (*(*module).types).len != 0 {
14574            *__errno_location() = 16 as libc::c_int;
14575            return -(1 as libc::c_int);
14576        } else {
14577            if (*(*module).usedby).len != 0 {
14578                *__errno_location() = 1 as libc::c_int;
14579                return -(1 as libc::c_int);
14580            } else {
14581                if (*module).blocked_clients != 0 {
14582                    *__errno_location() = 11 as libc::c_int;
14583                    return -(1 as libc::c_int);
14584                } else {
14585                    if moduleHoldsTimer(module) != 0 {
14586                        *__errno_location() = 115 as libc::c_int;
14587                        return -(1 as libc::c_int);
14588                    }
14589                }
14590            }
14591        }
14592    }
14593    let mut onunload: Option::<unsafe extern "C" fn(*mut libc::c_void) -> libc::c_int> = None;
14594    onunload = core::mem::transmute::<
14595        libc::intptr_t,
14596        Option::<unsafe extern "C" fn(*mut libc::c_void) -> libc::c_int>,
14597    >(
14598        dlsym(
14599            (*module).handle,
14600            b"RedisModule_OnUnload\0" as *const u8 as *const libc::c_char,
14601        ) as libc::c_ulong as libc::intptr_t,
14602    );
14603    if onunload.is_some() {
14604        let mut ctx: RedisModuleCtx = RedisModuleCtx {
14605            getapifuncptr: 0 as *mut libc::c_void,
14606            module: 0 as *mut RedisModule,
14607            client: 0 as *mut client,
14608            blocked_client: 0 as *mut RedisModuleBlockedClient,
14609            amqueue: 0 as *mut AutoMemEntry,
14610            amqueue_len: 0,
14611            amqueue_used: 0,
14612            flags: 0,
14613            postponed_arrays: 0 as *mut *mut libc::c_void,
14614            postponed_arrays_count: 0,
14615            blocked_privdata: 0 as *mut libc::c_void,
14616            blocked_ready_key: 0 as *mut robj,
14617            keys_result: 0 as *mut getKeysResult,
14618            pa_head: 0 as *mut RedisModulePoolAllocBlock,
14619            next_yield_time: 0,
14620            user: 0 as *const RedisModuleUser,
14621        };
14622        moduleCreateContext(&mut ctx, module, (1 as libc::c_int) << 6 as libc::c_int);
14623        let mut unload_status: libc::c_int = onunload
14624            .expect(
14625                "non-null function pointer",
14626            )(&mut ctx as *mut RedisModuleCtx as *mut libc::c_void);
14627        moduleFreeContext(&mut ctx);
14628        if unload_status == 1 as libc::c_int {
14629            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14630                _serverLog(
14631                    3 as libc::c_int,
14632                    b"Module %s OnUnload failed.  Unload canceled.\0" as *const u8
14633                        as *const libc::c_char,
14634                    name,
14635                );
14636            }
14637            *__errno_location() = 125 as libc::c_int;
14638            return -(1 as libc::c_int);
14639        }
14640    }
14641    moduleFreeAuthenticatedClients(module);
14642    moduleUnregisterCommands(module);
14643    moduleUnregisterSharedAPI(module);
14644    moduleUnregisterUsedAPI(module);
14645    moduleUnregisterFilters(module);
14646    moduleRemoveConfigs(module);
14647    moduleUnsubscribeNotifications(module);
14648    moduleUnsubscribeAllServerEvents(module);
14649    if dlclose((*module).handle) == -(1 as libc::c_int) {
14650        let mut error: *mut libc::c_char = dlerror();
14651        if error.is_null() {
14652            error = b"Unknown error\0" as *const u8 as *const libc::c_char
14653                as *mut libc::c_char;
14654        }
14655        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14656            _serverLog(
14657                3 as libc::c_int,
14658                b"Error when trying to close the %s module: %s\0" as *const u8
14659                    as *const libc::c_char,
14660                (*module).name,
14661                error,
14662            );
14663        }
14664    }
14665    moduleFireServerEvent(
14666        9 as libc::c_int as uint64_t,
14667        1 as libc::c_int,
14668        module as *mut libc::c_void,
14669    );
14670    if !((2 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14671        _serverLog(
14672            2 as libc::c_int,
14673            b"Module %s unloaded\0" as *const u8 as *const libc::c_char,
14674            (*module).name,
14675        );
14676    }
14677    dictDelete(modules, (*module).name as *const libc::c_void);
14678    (*module).name = 0 as *mut libc::c_char;
14679    moduleFreeModuleStructure(module);
14680    return 0 as libc::c_int;
14681}
14682#[no_mangle]
14683pub unsafe extern "C" fn modulePipeReadable(
14684    mut el: *mut aeEventLoop,
14685    mut fd: libc::c_int,
14686    mut privdata: *mut libc::c_void,
14687    mut mask: libc::c_int,
14688) {
14689    let mut buf: [libc::c_char; 128] = [0; 128];
14690    while read(
14691        fd,
14692        buf.as_mut_ptr() as *mut libc::c_void,
14693        core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong,
14694    ) as libc::c_ulong == core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong
14695    {}
14696    eventLoopHandleOneShotEvents();
14697}
14698#[no_mangle]
14699pub unsafe extern "C" fn addReplyLoadedModules(mut c: *mut client) {
14700    let mut di: *mut dictIterator = dictGetIterator(modules);
14701    let mut de: *mut dictEntry = 0 as *mut dictEntry;
14702    addReplyArrayLen(
14703        c,
14704        ((*modules).ht_used[0 as libc::c_int as usize])
14705            .wrapping_add((*modules).ht_used[1 as libc::c_int as usize]) as libc::c_long,
14706    );
14707    loop {
14708        de = dictNext(di);
14709        if de.is_null() {
14710            break;
14711        }
14712        let mut name: sds = (*de).key as sds;
14713        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
14714        let mut path: sds = (*(*module).loadmod).path;
14715        addReplyMapLen(c, 4 as libc::c_int as libc::c_long);
14716        addReplyBulkCString(c, b"name\0" as *const u8 as *const libc::c_char);
14717        addReplyBulkCBuffer(c, name as *const libc::c_void, sdslen(name));
14718        addReplyBulkCString(c, b"ver\0" as *const u8 as *const libc::c_char);
14719        addReplyLongLong(c, (*module).ver as libc::c_longlong);
14720        addReplyBulkCString(c, b"path\0" as *const u8 as *const libc::c_char);
14721        addReplyBulkCBuffer(c, path as *const libc::c_void, sdslen(path));
14722        addReplyBulkCString(c, b"args\0" as *const u8 as *const libc::c_char);
14723        addReplyArrayLen(c, (*(*module).loadmod).argc as libc::c_long);
14724        let mut i: libc::c_int = 0 as libc::c_int;
14725        while i < (*(*module).loadmod).argc {
14726            addReplyBulk(c, *((*(*module).loadmod).argv).offset(i as isize));
14727            i += 1;
14728        }
14729    }
14730    dictReleaseIterator(di);
14731}
14732#[no_mangle]
14733pub unsafe extern "C" fn genModulesInfoStringRenderModulesList(mut l: *mut list) -> sds {
14734    let mut li: listIter = listIter {
14735        next: 0 as *mut listNode,
14736        direction: 0,
14737    };
14738    let mut ln: *mut listNode = 0 as *mut listNode;
14739    listRewind(l, &mut li);
14740    let mut output: sds = sdsnew(b"[\0" as *const u8 as *const libc::c_char);
14741    loop {
14742        ln = listNext(&mut li);
14743        if ln.is_null() {
14744            break;
14745        }
14746        let mut module: *mut RedisModule = (*ln).value as *mut RedisModule;
14747        output = sdscat(output, (*module).name);
14748        if ln != (*l).tail {
14749            output = sdscat(output, b"|\0" as *const u8 as *const libc::c_char);
14750        }
14751    }
14752    output = sdscat(output, b"]\0" as *const u8 as *const libc::c_char);
14753    return output;
14754}
14755#[no_mangle]
14756pub unsafe extern "C" fn genModulesInfoStringRenderModuleOptions(
14757    mut module: *mut RedisModule,
14758) -> sds {
14759    let mut output: sds = sdsnew(b"[\0" as *const u8 as *const libc::c_char);
14760    if (*module).options & (1 as libc::c_int) << 0 as libc::c_int != 0 {
14761        output = sdscat(
14762            output,
14763            b"handle-io-errors|\0" as *const u8 as *const libc::c_char,
14764        );
14765    }
14766    if (*module).options & (1 as libc::c_int) << 2 as libc::c_int != 0 {
14767        output = sdscat(
14768            output,
14769            b"handle-repl-async-load|\0" as *const u8 as *const libc::c_char,
14770        );
14771    }
14772    if (*module).options & (1 as libc::c_int) << 1 as libc::c_int != 0 {
14773        output = sdscat(
14774            output,
14775            b"no-implicit-signal-modified|\0" as *const u8 as *const libc::c_char,
14776        );
14777    }
14778    output = sdstrim(output, b"|\0" as *const u8 as *const libc::c_char);
14779    output = sdscat(output, b"]\0" as *const u8 as *const libc::c_char);
14780    return output;
14781}
14782#[no_mangle]
14783pub unsafe extern "C" fn genModulesInfoString(mut info: sds) -> sds {
14784    let mut di: *mut dictIterator = dictGetIterator(modules);
14785    let mut de: *mut dictEntry = 0 as *mut dictEntry;
14786    loop {
14787        de = dictNext(di);
14788        if de.is_null() {
14789            break;
14790        }
14791        let mut name: sds = (*de).key as sds;
14792        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
14793        let mut usedby: sds = genModulesInfoStringRenderModulesList((*module).usedby);
14794        let mut using: sds = genModulesInfoStringRenderModulesList((*module).using);
14795        let mut options: sds = genModulesInfoStringRenderModuleOptions(module);
14796        info = sdscatfmt(
14797            info,
14798            b"module:name=%S,ver=%i,api=%i,filters=%i,usedby=%S,using=%S,options=%S\r\n\0"
14799                as *const u8 as *const libc::c_char,
14800            name,
14801            (*module).ver,
14802            (*module).apiver,
14803            (*(*module).filters).len as libc::c_int,
14804            usedby,
14805            using,
14806            options,
14807        );
14808        sdsfree(usedby);
14809        sdsfree(using);
14810        sdsfree(options);
14811    }
14812    dictReleaseIterator(di);
14813    return info;
14814}
14815#[no_mangle]
14816pub unsafe extern "C" fn isModuleConfigNameRegistered(
14817    mut module: *mut RedisModule,
14818    mut name: sds,
14819) -> libc::c_int {
14820    let mut match_0: *mut listNode = listSearchKey(
14821        (*module).module_configs,
14822        name as *mut libc::c_void,
14823    );
14824    return (match_0 != 0 as *mut libc::c_void as *mut listNode) as libc::c_int;
14825}
14826#[no_mangle]
14827pub unsafe extern "C" fn moduleVerifyConfigFlags(
14828    mut flags: libc::c_uint,
14829    mut type_0: configType,
14830) -> libc::c_int {
14831    if flags as libc::c_ulonglong
14832        & !(0 as libc::c_int as libc::c_ulonglong
14833            | (1 as libc::c_ulonglong) << 0 as libc::c_int
14834            | (1 as libc::c_ulonglong) << 1 as libc::c_int
14835            | (1 as libc::c_ulonglong) << 4 as libc::c_int
14836            | (1 as libc::c_ulonglong) << 5 as libc::c_int
14837            | (1 as libc::c_ulonglong) << 6 as libc::c_int
14838            | (1 as libc::c_ulonglong) << 8 as libc::c_int
14839            | (1 as libc::c_ulonglong) << 7 as libc::c_int) != 0
14840    {
14841        serverLogRaw(
14842            3 as libc::c_int,
14843            b"Invalid flag(s) for configuration\0" as *const u8 as *const libc::c_char,
14844        );
14845        return 1 as libc::c_int;
14846    }
14847    if type_0 as libc::c_uint != NUMERIC_CONFIG as libc::c_int as libc::c_uint
14848        && flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 7 as libc::c_int != 0
14849    {
14850        serverLogRaw(
14851            3 as libc::c_int,
14852            b"Numeric flag provided for non-numeric configuration.\0" as *const u8
14853                as *const libc::c_char,
14854        );
14855        return 1 as libc::c_int;
14856    }
14857    if type_0 as libc::c_uint != ENUM_CONFIG as libc::c_int as libc::c_uint
14858        && flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 8 as libc::c_int != 0
14859    {
14860        serverLogRaw(
14861            3 as libc::c_int,
14862            b"Enum flag provided for non-enum configuration.\0" as *const u8
14863                as *const libc::c_char,
14864        );
14865        return 1 as libc::c_int;
14866    }
14867    return 0 as libc::c_int;
14868}
14869#[no_mangle]
14870pub unsafe extern "C" fn moduleVerifyConfigName(mut name: sds) -> libc::c_int {
14871    if sdslen(name) == 0 as libc::c_int as libc::c_ulong {
14872        serverLogRaw(
14873            3 as libc::c_int,
14874            b"Module config names cannot be an empty string.\0" as *const u8
14875                as *const libc::c_char,
14876        );
14877        return 1 as libc::c_int;
14878    }
14879    let mut i: size_t = 0 as libc::c_int as size_t;
14880    while i < sdslen(name) {
14881        let mut curr_char: libc::c_char = *name.offset(i as isize);
14882        if curr_char as libc::c_int >= 'a' as i32
14883            && curr_char as libc::c_int <= 'z' as i32
14884            || curr_char as libc::c_int >= 'A' as i32
14885                && curr_char as libc::c_int <= 'Z' as i32
14886            || curr_char as libc::c_int >= '0' as i32
14887                && curr_char as libc::c_int <= '9' as i32
14888            || curr_char as libc::c_int == '_' as i32
14889            || curr_char as libc::c_int == '-' as i32
14890        {
14891            i = i.wrapping_add(1);
14892        } else {
14893            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
14894                _serverLog(
14895                    3 as libc::c_int,
14896                    b"Invalid character %c in Module Config name %s.\0" as *const u8
14897                        as *const libc::c_char,
14898                    curr_char as libc::c_int,
14899                    name,
14900                );
14901            }
14902            return 1 as libc::c_int;
14903        }
14904    }
14905    return 0 as libc::c_int;
14906}
14907static mut configerr: [libc::c_char; 256] = [0; 256];
14908unsafe extern "C" fn propagateErrorString(
14909    mut err_in: *mut robj,
14910    mut err: *mut *const libc::c_char,
14911) {
14912    if !err_in.is_null() {
14913        strncpy(
14914            configerr.as_mut_ptr(),
14915            (*err_in).ptr as *const libc::c_char,
14916            256 as libc::c_int as libc::c_ulong,
14917        );
14918        configerr[(256 as libc::c_int - 1 as libc::c_int)
14919            as usize] = '\0' as i32 as libc::c_char;
14920        decrRefCount(err_in);
14921        *err = configerr.as_mut_ptr();
14922    }
14923}
14924#[no_mangle]
14925pub unsafe extern "C" fn setModuleBoolConfig(
14926    mut config: *mut ModuleConfig,
14927    mut val: libc::c_int,
14928    mut err: *mut *const libc::c_char,
14929) -> libc::c_int {
14930    let mut error: *mut robj = 0 as *mut robj;
14931    let mut return_code: libc::c_int = ((*config).set_fn.set_bool)
14932        .expect(
14933            "non-null function pointer",
14934        )((*config).name as *const libc::c_char, val, (*config).privdata, &mut error);
14935    propagateErrorString(error, err);
14936    return if return_code == 0 as libc::c_int {
14937        1 as libc::c_int
14938    } else {
14939        0 as libc::c_int
14940    };
14941}
14942#[no_mangle]
14943pub unsafe extern "C" fn setModuleStringConfig(
14944    mut config: *mut ModuleConfig,
14945    mut strval: sds,
14946    mut err: *mut *const libc::c_char,
14947) -> libc::c_int {
14948    let mut error: *mut robj = 0 as *mut robj;
14949    let mut new: *mut robj = createStringObject(
14950        strval as *const libc::c_char,
14951        sdslen(strval),
14952    );
14953    let mut return_code: libc::c_int = ((*config).set_fn.set_string)
14954        .expect(
14955            "non-null function pointer",
14956        )((*config).name as *const libc::c_char, new, (*config).privdata, &mut error);
14957    propagateErrorString(error, err);
14958    decrRefCount(new);
14959    return if return_code == 0 as libc::c_int {
14960        1 as libc::c_int
14961    } else {
14962        0 as libc::c_int
14963    };
14964}
14965#[no_mangle]
14966pub unsafe extern "C" fn setModuleEnumConfig(
14967    mut config: *mut ModuleConfig,
14968    mut val: libc::c_int,
14969    mut err: *mut *const libc::c_char,
14970) -> libc::c_int {
14971    let mut error: *mut robj = 0 as *mut robj;
14972    let mut return_code: libc::c_int = ((*config).set_fn.set_enum)
14973        .expect(
14974            "non-null function pointer",
14975        )((*config).name as *const libc::c_char, val, (*config).privdata, &mut error);
14976    propagateErrorString(error, err);
14977    return if return_code == 0 as libc::c_int {
14978        1 as libc::c_int
14979    } else {
14980        0 as libc::c_int
14981    };
14982}
14983#[no_mangle]
14984pub unsafe extern "C" fn setModuleNumericConfig(
14985    mut config: *mut ModuleConfig,
14986    mut val: libc::c_longlong,
14987    mut err: *mut *const libc::c_char,
14988) -> libc::c_int {
14989    let mut error: *mut robj = 0 as *mut robj;
14990    let mut return_code: libc::c_int = ((*config).set_fn.set_numeric)
14991        .expect(
14992            "non-null function pointer",
14993        )((*config).name as *const libc::c_char, val, (*config).privdata, &mut error);
14994    propagateErrorString(error, err);
14995    return if return_code == 0 as libc::c_int {
14996        1 as libc::c_int
14997    } else {
14998        0 as libc::c_int
14999    };
15000}
15001#[no_mangle]
15002pub unsafe extern "C" fn getModuleBoolConfig(
15003    mut module_config: *mut ModuleConfig,
15004) -> libc::c_int {
15005    return ((*module_config).get_fn.get_bool)
15006        .expect(
15007            "non-null function pointer",
15008        )((*module_config).name as *const libc::c_char, (*module_config).privdata);
15009}
15010#[no_mangle]
15011pub unsafe extern "C" fn getModuleStringConfig(
15012    mut module_config: *mut ModuleConfig,
15013) -> sds {
15014    let mut val: *mut robj = ((*module_config).get_fn.get_string)
15015        .expect(
15016            "non-null function pointer",
15017        )((*module_config).name as *const libc::c_char, (*module_config).privdata);
15018    return if !val.is_null() { sdsdup((*val).ptr as sds) } else { 0 as sds };
15019}
15020#[no_mangle]
15021pub unsafe extern "C" fn getModuleEnumConfig(
15022    mut module_config: *mut ModuleConfig,
15023) -> libc::c_int {
15024    return ((*module_config).get_fn.get_enum)
15025        .expect(
15026            "non-null function pointer",
15027        )((*module_config).name as *const libc::c_char, (*module_config).privdata);
15028}
15029#[no_mangle]
15030pub unsafe extern "C" fn getModuleNumericConfig(
15031    mut module_config: *mut ModuleConfig,
15032) -> libc::c_longlong {
15033    return ((*module_config).get_fn.get_numeric)
15034        .expect(
15035            "non-null function pointer",
15036        )((*module_config).name as *const libc::c_char, (*module_config).privdata);
15037}
15038#[no_mangle]
15039pub unsafe extern "C" fn loadModuleConfigs(mut module: *mut RedisModule) -> libc::c_int {
15040    let mut li: listIter = listIter {
15041        next: 0 as *mut listNode,
15042        direction: 0,
15043    };
15044    let mut ln: *mut listNode = 0 as *mut listNode;
15045    let mut err: *const libc::c_char = 0 as *const libc::c_char;
15046    listRewind((*module).module_configs, &mut li);
15047    loop {
15048        ln = listNext(&mut li);
15049        if ln.is_null() {
15050            break;
15051        }
15052        let mut module_config: *mut ModuleConfig = (*ln).value as *mut ModuleConfig;
15053        let mut config_name: sds = sdscatfmt(
15054            sdsempty(),
15055            b"%s.%s\0" as *const u8 as *const libc::c_char,
15056            (*module).name,
15057            (*module_config).name,
15058        );
15059        let mut config_argument: *mut dictEntry = dictFind(
15060            server.module_configs_queue,
15061            config_name as *const libc::c_void,
15062        );
15063        if !config_argument.is_null() {
15064            if performModuleConfigSetFromName(
15065                (*config_argument).key as sds,
15066                (*config_argument).v.val as sds,
15067                &mut err,
15068            ) == 0
15069            {
15070                if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
15071                    _serverLog(
15072                        3 as libc::c_int,
15073                        b"Issue during loading of configuration %s : %s\0" as *const u8
15074                            as *const libc::c_char,
15075                        (*config_argument).key as sds,
15076                        err,
15077                    );
15078                }
15079                sdsfree(config_name);
15080                dictEmpty(server.module_configs_queue, None);
15081                return 1 as libc::c_int;
15082            }
15083        } else if performModuleConfigSetDefaultFromName(config_name, &mut err) == 0 {
15084            if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
15085                _serverLog(
15086                    3 as libc::c_int,
15087                    b"Issue attempting to set default value of configuration %s : %s\0"
15088                        as *const u8 as *const libc::c_char,
15089                    (*module_config).name,
15090                    err,
15091                );
15092            }
15093            sdsfree(config_name);
15094            dictEmpty(server.module_configs_queue, None);
15095            return 1 as libc::c_int;
15096        }
15097        dictDelete(server.module_configs_queue, config_name as *const libc::c_void);
15098        sdsfree(config_name);
15099    }
15100    (*module).configs_initialized = 1 as libc::c_int;
15101    return 0 as libc::c_int;
15102}
15103#[no_mangle]
15104pub unsafe extern "C" fn addModuleConfigApply(
15105    mut module_configs: *mut list,
15106    mut module_config: *mut ModuleConfig,
15107) {
15108    if ((*module_config).apply_fn).is_none() {
15109        return;
15110    }
15111    let mut li: listIter = listIter {
15112        next: 0 as *mut listNode,
15113        direction: 0,
15114    };
15115    let mut ln: *mut listNode = 0 as *mut listNode;
15116    let mut pending_apply: *mut ModuleConfig = 0 as *mut ModuleConfig;
15117    listRewind(module_configs, &mut li);
15118    loop {
15119        ln = listNext(&mut li);
15120        if ln.is_null() {
15121            break;
15122        }
15123        pending_apply = (*ln).value as *mut ModuleConfig;
15124        if (*pending_apply).apply_fn == (*module_config).apply_fn
15125            && (*pending_apply).privdata == (*module_config).privdata
15126        {
15127            return;
15128        }
15129    }
15130    listAddNodeTail(module_configs, module_config as *mut libc::c_void);
15131}
15132#[no_mangle]
15133pub unsafe extern "C" fn moduleConfigApplyConfig(
15134    mut module_configs: *mut list,
15135    mut err: *mut *const libc::c_char,
15136    mut err_arg_name: *mut *const libc::c_char,
15137) -> libc::c_int {
15138    if (*module_configs).len == 0 {
15139        return 1 as libc::c_int;
15140    }
15141    let mut li: listIter = listIter {
15142        next: 0 as *mut listNode,
15143        direction: 0,
15144    };
15145    let mut ln: *mut listNode = 0 as *mut listNode;
15146    let mut module_config: *mut ModuleConfig = 0 as *mut ModuleConfig;
15147    let mut error: *mut robj = 0 as *mut robj;
15148    let mut ctx: RedisModuleCtx = RedisModuleCtx {
15149        getapifuncptr: 0 as *mut libc::c_void,
15150        module: 0 as *mut RedisModule,
15151        client: 0 as *mut client,
15152        blocked_client: 0 as *mut RedisModuleBlockedClient,
15153        amqueue: 0 as *mut AutoMemEntry,
15154        amqueue_len: 0,
15155        amqueue_used: 0,
15156        flags: 0,
15157        postponed_arrays: 0 as *mut *mut libc::c_void,
15158        postponed_arrays_count: 0,
15159        blocked_privdata: 0 as *mut libc::c_void,
15160        blocked_ready_key: 0 as *mut robj,
15161        keys_result: 0 as *mut getKeysResult,
15162        pa_head: 0 as *mut RedisModulePoolAllocBlock,
15163        next_yield_time: 0,
15164        user: 0 as *const RedisModuleUser,
15165    };
15166    listRewind(module_configs, &mut li);
15167    loop {
15168        ln = listNext(&mut li);
15169        if ln.is_null() {
15170            break;
15171        }
15172        module_config = (*ln).value as *mut ModuleConfig;
15173        moduleCreateContext(&mut ctx, (*module_config).module, 0 as libc::c_int);
15174        if ((*module_config).apply_fn)
15175            .expect(
15176                "non-null function pointer",
15177            )(&mut ctx, (*module_config).privdata, &mut error) != 0
15178        {
15179            if !err_arg_name.is_null() {
15180                *err_arg_name = (*module_config).name as *const libc::c_char;
15181            }
15182            propagateErrorString(error, err);
15183            moduleFreeContext(&mut ctx);
15184            return 0 as libc::c_int;
15185        }
15186        moduleFreeContext(&mut ctx);
15187    }
15188    return 1 as libc::c_int;
15189}
15190#[no_mangle]
15191pub unsafe extern "C" fn createModuleConfig(
15192    mut name: sds,
15193    mut apply_fn: RedisModuleConfigApplyFunc,
15194    mut privdata: *mut libc::c_void,
15195    mut module: *mut RedisModule,
15196) -> *mut ModuleConfig {
15197    let mut new_config: *mut ModuleConfig = zmalloc(
15198        core::mem::size_of::<ModuleConfig>() as libc::c_ulong,
15199    ) as *mut ModuleConfig;
15200    (*new_config).name = sdsdup(name);
15201    (*new_config).apply_fn = apply_fn;
15202    (*new_config).privdata = privdata;
15203    (*new_config).module = module;
15204    return new_config;
15205}
15206#[no_mangle]
15207pub unsafe extern "C" fn moduleConfigValidityCheck(
15208    mut module: *mut RedisModule,
15209    mut name: sds,
15210    mut flags: libc::c_uint,
15211    mut type_0: configType,
15212) -> libc::c_int {
15213    if moduleVerifyConfigFlags(flags, type_0) != 0 || moduleVerifyConfigName(name) != 0 {
15214        *__errno_location() = 22 as libc::c_int;
15215        return 1 as libc::c_int;
15216    }
15217    if isModuleConfigNameRegistered(module, name) != 0 {
15218        if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
15219            _serverLog(
15220                3 as libc::c_int,
15221                b"Configuration by the name: %s already registered\0" as *const u8
15222                    as *const libc::c_char,
15223                name,
15224            );
15225        }
15226        *__errno_location() = 114 as libc::c_int;
15227        return 1 as libc::c_int;
15228    }
15229    return 0 as libc::c_int;
15230}
15231#[no_mangle]
15232pub unsafe extern "C" fn maskModuleConfigFlags(mut flags: libc::c_uint) -> libc::c_uint {
15233    let mut new_flags: libc::c_uint = 0 as libc::c_int as libc::c_uint;
15234    if flags & 0 as libc::c_int as libc::c_uint != 0 {
15235        new_flags |= 0 as libc::c_int as libc::c_uint;
15236    }
15237    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 0 as libc::c_int != 0 {
15238        new_flags = (new_flags as libc::c_ulonglong
15239            | (1 as libc::c_ulonglong) << 0 as libc::c_int) as libc::c_uint;
15240    }
15241    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 4 as libc::c_int != 0 {
15242        new_flags = (new_flags as libc::c_ulonglong
15243            | (1 as libc::c_ulonglong) << 4 as libc::c_int) as libc::c_uint;
15244    }
15245    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 5 as libc::c_int != 0 {
15246        new_flags = (new_flags as libc::c_ulonglong
15247            | (1 as libc::c_ulonglong) << 5 as libc::c_int) as libc::c_uint;
15248    }
15249    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 6 as libc::c_int != 0 {
15250        new_flags = (new_flags as libc::c_ulonglong
15251            | (1 as libc::c_ulonglong) << 6 as libc::c_int) as libc::c_uint;
15252    }
15253    return new_flags;
15254}
15255#[no_mangle]
15256pub unsafe extern "C" fn maskModuleNumericConfigFlags(
15257    mut flags: libc::c_uint,
15258) -> libc::c_uint {
15259    let mut new_flags: libc::c_uint = 0 as libc::c_int as libc::c_uint;
15260    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 7 as libc::c_int != 0 {
15261        new_flags |= ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint;
15262    }
15263    return new_flags;
15264}
15265#[no_mangle]
15266pub unsafe extern "C" fn maskModuleEnumConfigFlags(
15267    mut flags: libc::c_uint,
15268) -> libc::c_uint {
15269    let mut new_flags: libc::c_uint = 0 as libc::c_int as libc::c_uint;
15270    if flags as libc::c_ulonglong & (1 as libc::c_ulonglong) << 8 as libc::c_int != 0 {
15271        new_flags = (new_flags as libc::c_ulonglong
15272            | (1 as libc::c_ulonglong) << 3 as libc::c_int) as libc::c_uint;
15273    }
15274    return new_flags;
15275}
15276#[no_mangle]
15277pub unsafe extern "C" fn RM_RegisterStringConfig(
15278    mut ctx: *mut RedisModuleCtx,
15279    mut name: *const libc::c_char,
15280    mut default_val: *const libc::c_char,
15281    mut flags: libc::c_uint,
15282    mut getfn: RedisModuleConfigGetStringFunc,
15283    mut setfn: RedisModuleConfigSetStringFunc,
15284    mut applyfn: RedisModuleConfigApplyFunc,
15285    mut privdata: *mut libc::c_void,
15286) -> libc::c_int {
15287    let mut module: *mut RedisModule = (*ctx).module;
15288    let mut config_name: sds = sdsnew(name);
15289    if moduleConfigValidityCheck(module, config_name, flags, NUMERIC_CONFIG) != 0 {
15290        sdsfree(config_name);
15291        return 1 as libc::c_int;
15292    }
15293    let mut new_config: *mut ModuleConfig = createModuleConfig(
15294        config_name,
15295        applyfn,
15296        privdata,
15297        module,
15298    );
15299    sdsfree(config_name);
15300    (*new_config).get_fn.get_string = getfn;
15301    (*new_config).set_fn.set_string = setfn;
15302    listAddNodeTail((*module).module_configs, new_config as *mut libc::c_void);
15303    flags = maskModuleConfigFlags(flags);
15304    addModuleStringConfig(
15305        (*module).name,
15306        name,
15307        flags as libc::c_int,
15308        new_config as *mut libc::c_void,
15309        if !default_val.is_null() { sdsnew(default_val) } else { 0 as sds },
15310    );
15311    return 0 as libc::c_int;
15312}
15313#[no_mangle]
15314pub unsafe extern "C" fn RM_RegisterBoolConfig(
15315    mut ctx: *mut RedisModuleCtx,
15316    mut name: *const libc::c_char,
15317    mut default_val: libc::c_int,
15318    mut flags: libc::c_uint,
15319    mut getfn: RedisModuleConfigGetBoolFunc,
15320    mut setfn: RedisModuleConfigSetBoolFunc,
15321    mut applyfn: RedisModuleConfigApplyFunc,
15322    mut privdata: *mut libc::c_void,
15323) -> libc::c_int {
15324    let mut module: *mut RedisModule = (*ctx).module;
15325    let mut config_name: sds = sdsnew(name);
15326    if moduleConfigValidityCheck(module, config_name, flags, BOOL_CONFIG) != 0 {
15327        sdsfree(config_name);
15328        return 1 as libc::c_int;
15329    }
15330    let mut new_config: *mut ModuleConfig = createModuleConfig(
15331        config_name,
15332        applyfn,
15333        privdata,
15334        module,
15335    );
15336    sdsfree(config_name);
15337    (*new_config).get_fn.get_bool = getfn;
15338    (*new_config).set_fn.set_bool = setfn;
15339    listAddNodeTail((*module).module_configs, new_config as *mut libc::c_void);
15340    flags = maskModuleConfigFlags(flags);
15341    addModuleBoolConfig(
15342        (*module).name,
15343        name,
15344        flags as libc::c_int,
15345        new_config as *mut libc::c_void,
15346        default_val,
15347    );
15348    return 0 as libc::c_int;
15349}
15350#[no_mangle]
15351pub unsafe extern "C" fn RM_RegisterEnumConfig(
15352    mut ctx: *mut RedisModuleCtx,
15353    mut name: *const libc::c_char,
15354    mut default_val: libc::c_int,
15355    mut flags: libc::c_uint,
15356    mut enum_values: *mut *const libc::c_char,
15357    mut int_values: *const libc::c_int,
15358    mut num_enum_vals: libc::c_int,
15359    mut getfn: RedisModuleConfigGetEnumFunc,
15360    mut setfn: RedisModuleConfigSetEnumFunc,
15361    mut applyfn: RedisModuleConfigApplyFunc,
15362    mut privdata: *mut libc::c_void,
15363) -> libc::c_int {
15364    let mut module: *mut RedisModule = (*ctx).module;
15365    let mut config_name: sds = sdsnew(name);
15366    if moduleConfigValidityCheck(module, config_name, flags, ENUM_CONFIG) != 0 {
15367        sdsfree(config_name);
15368        return 1 as libc::c_int;
15369    }
15370    let mut new_config: *mut ModuleConfig = createModuleConfig(
15371        config_name,
15372        applyfn,
15373        privdata,
15374        module,
15375    );
15376    sdsfree(config_name);
15377    (*new_config).get_fn.get_enum = getfn;
15378    (*new_config).set_fn.set_enum = setfn;
15379    let mut enum_vals: *mut configEnum = zmalloc(
15380        ((num_enum_vals + 1 as libc::c_int) as libc::c_ulong)
15381            .wrapping_mul(core::mem::size_of::<configEnum>() as libc::c_ulong),
15382    ) as *mut configEnum;
15383    let mut i: libc::c_int = 0 as libc::c_int;
15384    while i < num_enum_vals {
15385        let ref mut fresh40 = (*enum_vals.offset(i as isize)).name;
15386        *fresh40 = zstrdup(*enum_values.offset(i as isize));
15387        (*enum_vals.offset(i as isize)).val = *int_values.offset(i as isize);
15388        i += 1;
15389    }
15390    let ref mut fresh41 = (*enum_vals.offset(num_enum_vals as isize)).name;
15391    *fresh41 = 0 as *mut libc::c_char;
15392    (*enum_vals.offset(num_enum_vals as isize)).val = 0 as libc::c_int;
15393    listAddNodeTail((*module).module_configs, new_config as *mut libc::c_void);
15394    flags = maskModuleConfigFlags(flags) | maskModuleEnumConfigFlags(flags);
15395    addModuleEnumConfig(
15396        (*module).name,
15397        name,
15398        flags as libc::c_int,
15399        new_config as *mut libc::c_void,
15400        default_val,
15401        enum_vals,
15402    );
15403    return 0 as libc::c_int;
15404}
15405#[no_mangle]
15406pub unsafe extern "C" fn RM_RegisterNumericConfig(
15407    mut ctx: *mut RedisModuleCtx,
15408    mut name: *const libc::c_char,
15409    mut default_val: libc::c_longlong,
15410    mut flags: libc::c_uint,
15411    mut min: libc::c_longlong,
15412    mut max: libc::c_longlong,
15413    mut getfn: RedisModuleConfigGetNumericFunc,
15414    mut setfn: RedisModuleConfigSetNumericFunc,
15415    mut applyfn: RedisModuleConfigApplyFunc,
15416    mut privdata: *mut libc::c_void,
15417) -> libc::c_int {
15418    let mut module: *mut RedisModule = (*ctx).module;
15419    let mut config_name: sds = sdsnew(name);
15420    if moduleConfigValidityCheck(module, config_name, flags, NUMERIC_CONFIG) != 0 {
15421        sdsfree(config_name);
15422        return 1 as libc::c_int;
15423    }
15424    let mut new_config: *mut ModuleConfig = createModuleConfig(
15425        config_name,
15426        applyfn,
15427        privdata,
15428        module,
15429    );
15430    sdsfree(config_name);
15431    (*new_config).get_fn.get_numeric = getfn;
15432    (*new_config).set_fn.set_numeric = setfn;
15433    listAddNodeTail((*module).module_configs, new_config as *mut libc::c_void);
15434    let mut numeric_flags: libc::c_uint = maskModuleNumericConfigFlags(flags);
15435    flags = maskModuleConfigFlags(flags);
15436    addModuleNumericConfig(
15437        (*module).name,
15438        name,
15439        flags as libc::c_int,
15440        new_config as *mut libc::c_void,
15441        default_val,
15442        numeric_flags as libc::c_int,
15443        min,
15444        max,
15445    );
15446    return 0 as libc::c_int;
15447}
15448#[no_mangle]
15449pub unsafe extern "C" fn RM_LoadConfigs(mut ctx: *mut RedisModuleCtx) -> libc::c_int {
15450    if ctx.is_null() || ((*ctx).module).is_null() {
15451        return 1 as libc::c_int;
15452    }
15453    let mut module: *mut RedisModule = (*ctx).module;
15454    if loadModuleConfigs(module) != 0 {
15455        return 1 as libc::c_int;
15456    }
15457    return 0 as libc::c_int;
15458}
15459#[no_mangle]
15460pub unsafe extern "C" fn moduleCommand(mut c: *mut client) {
15461    let mut subcmd: *mut libc::c_char = (**((*c).argv).offset(1 as libc::c_int as isize))
15462        .ptr as *mut libc::c_char;
15463    if (*c).argc == 2 as libc::c_int
15464        && strcasecmp(subcmd, b"help\0" as *const u8 as *const libc::c_char) == 0
15465    {
15466        let mut help: [*const libc::c_char; 9] = [
15467            b"LIST\0" as *const u8 as *const libc::c_char,
15468            b"    Return a list of loaded modules.\0" as *const u8
15469                as *const libc::c_char,
15470            b"LOAD <path> [<arg> ...]\0" as *const u8 as *const libc::c_char,
15471            b"    Load a module library from <path>, passing to it any optional arguments.\0"
15472                as *const u8 as *const libc::c_char,
15473            b"LOADEX <path> [[CONFIG NAME VALUE] [CONFIG NAME VALUE]] [ARGS ...]\0"
15474                as *const u8 as *const libc::c_char,
15475            b"    Load a module library from <path>, while passing it module configurations and optional arguments.\0"
15476                as *const u8 as *const libc::c_char,
15477            b"UNLOAD <name>\0" as *const u8 as *const libc::c_char,
15478            b"    Unload a module.\0" as *const u8 as *const libc::c_char,
15479            0 as *const libc::c_char,
15480        ];
15481        addReplyHelp(c, help.as_mut_ptr());
15482    } else if strcasecmp(subcmd, b"load\0" as *const u8 as *const libc::c_char) == 0
15483        && (*c).argc >= 3 as libc::c_int
15484    {
15485        let mut argv: *mut *mut robj = 0 as *mut *mut robj;
15486        let mut argc: libc::c_int = 0 as libc::c_int;
15487        if (*c).argc > 3 as libc::c_int {
15488            argc = (*c).argc - 3 as libc::c_int;
15489            argv = &mut *((*c).argv).offset(3 as libc::c_int as isize) as *mut *mut robj;
15490        }
15491        if moduleLoad(
15492            (**((*c).argv).offset(2 as libc::c_int as isize)).ptr as *const libc::c_char,
15493            argv as *mut *mut libc::c_void,
15494            argc,
15495            0 as libc::c_int,
15496        ) == 0 as libc::c_int
15497        {
15498            addReply(c, shared.ok);
15499        } else {
15500            addReplyError(
15501                c,
15502                b"Error loading the extension. Please check the server logs.\0"
15503                    as *const u8 as *const libc::c_char,
15504            );
15505        }
15506    } else if strcasecmp(subcmd, b"loadex\0" as *const u8 as *const libc::c_char) == 0
15507        && (*c).argc >= 3 as libc::c_int
15508    {
15509        let mut argv_0: *mut *mut robj = 0 as *mut *mut robj;
15510        let mut argc_0: libc::c_int = 0 as libc::c_int;
15511        if (*c).argc > 3 as libc::c_int {
15512            argc_0 = (*c).argc - 3 as libc::c_int;
15513            argv_0 = &mut *((*c).argv).offset(3 as libc::c_int as isize)
15514                as *mut *mut robj;
15515        }
15516        if parseLoadexArguments(&mut argv_0 as *mut *mut *mut robj, &mut argc_0)
15517            == 0 as libc::c_int
15518            && moduleLoad(
15519                (**((*c).argv).offset(2 as libc::c_int as isize)).ptr
15520                    as *const libc::c_char,
15521                argv_0 as *mut *mut libc::c_void,
15522                argc_0,
15523                1 as libc::c_int,
15524            ) == 0 as libc::c_int
15525        {
15526            addReply(c, shared.ok);
15527        } else {
15528            dictEmpty(server.module_configs_queue, None);
15529            addReplyError(
15530                c,
15531                b"Error loading the extension. Please check the server logs.\0"
15532                    as *const u8 as *const libc::c_char,
15533            );
15534        }
15535    } else if strcasecmp(subcmd, b"unload\0" as *const u8 as *const libc::c_char) == 0
15536        && (*c).argc == 3 as libc::c_int
15537    {
15538        if moduleUnload((**((*c).argv).offset(2 as libc::c_int as isize)).ptr as sds)
15539            == 0 as libc::c_int
15540        {
15541            addReply(c, shared.ok);
15542        } else {
15543            let mut errmsg: *mut libc::c_char = 0 as *mut libc::c_char;
15544            match *__errno_location() {
15545                2 => {
15546                    errmsg = b"no such module with that name\0" as *const u8
15547                        as *const libc::c_char as *mut libc::c_char;
15548                }
15549                16 => {
15550                    errmsg = b"the module exports one or more module-side data types, can't unload\0"
15551                        as *const u8 as *const libc::c_char as *mut libc::c_char;
15552                }
15553                1 => {
15554                    errmsg = b"the module exports APIs used by other modules. Please unload them first and try again\0"
15555                        as *const u8 as *const libc::c_char as *mut libc::c_char;
15556                }
15557                11 => {
15558                    errmsg = b"the module has blocked clients. Please wait them unblocked and try again\0"
15559                        as *const u8 as *const libc::c_char as *mut libc::c_char;
15560                }
15561                115 => {
15562                    errmsg = b"the module holds timer that is not fired. Please stop the timer or wait until it fires.\0"
15563                        as *const u8 as *const libc::c_char as *mut libc::c_char;
15564                }
15565                _ => {
15566                    errmsg = b"operation not possible.\0" as *const u8
15567                        as *const libc::c_char as *mut libc::c_char;
15568                }
15569            }
15570            addReplyErrorFormat(
15571                c,
15572                b"Error unloading module: %s\0" as *const u8 as *const libc::c_char,
15573                errmsg,
15574            );
15575        }
15576    } else if strcasecmp(subcmd, b"list\0" as *const u8 as *const libc::c_char) == 0
15577        && (*c).argc == 2 as libc::c_int
15578    {
15579        addReplyLoadedModules(c);
15580    } else {
15581        addReplySubcommandSyntaxError(c);
15582        return;
15583    };
15584}
15585#[no_mangle]
15586pub unsafe extern "C" fn moduleCount() -> size_t {
15587    return ((*modules).ht_used[0 as libc::c_int as usize])
15588        .wrapping_add((*modules).ht_used[1 as libc::c_int as usize]);
15589}
15590#[no_mangle]
15591pub unsafe extern "C" fn RM_SetLRU(
15592    mut key: *mut RedisModuleKey,
15593    mut lru_idle: mstime_t,
15594) -> libc::c_int {
15595    if ((*key).value).is_null() {
15596        return 1 as libc::c_int;
15597    }
15598    if objectSetLRUOrLFU(
15599        (*key).value,
15600        -(1 as libc::c_int) as libc::c_longlong,
15601        lru_idle,
15602        (if lru_idle >= 0 as libc::c_int as libc::c_longlong {
15603            LRU_CLOCK()
15604        } else {
15605            0 as libc::c_int as libc::c_uint
15606        }) as libc::c_longlong,
15607        1 as libc::c_int,
15608    ) != 0
15609    {
15610        return 0 as libc::c_int;
15611    }
15612    return 1 as libc::c_int;
15613}
15614#[no_mangle]
15615pub unsafe extern "C" fn RM_GetLRU(
15616    mut key: *mut RedisModuleKey,
15617    mut lru_idle: *mut mstime_t,
15618) -> libc::c_int {
15619    *lru_idle = -(1 as libc::c_int) as mstime_t;
15620    if ((*key).value).is_null() {
15621        return 1 as libc::c_int;
15622    }
15623    if server.maxmemory_policy & (1 as libc::c_int) << 1 as libc::c_int != 0 {
15624        return 0 as libc::c_int;
15625    }
15626    *lru_idle = estimateObjectIdleTime((*key).value) as mstime_t;
15627    return 0 as libc::c_int;
15628}
15629#[no_mangle]
15630pub unsafe extern "C" fn RM_SetLFU(
15631    mut key: *mut RedisModuleKey,
15632    mut lfu_freq: libc::c_longlong,
15633) -> libc::c_int {
15634    if ((*key).value).is_null() {
15635        return 1 as libc::c_int;
15636    }
15637    if objectSetLRUOrLFU(
15638        (*key).value,
15639        lfu_freq,
15640        -(1 as libc::c_int) as libc::c_longlong,
15641        0 as libc::c_int as libc::c_longlong,
15642        1 as libc::c_int,
15643    ) != 0
15644    {
15645        return 0 as libc::c_int;
15646    }
15647    return 1 as libc::c_int;
15648}
15649#[no_mangle]
15650pub unsafe extern "C" fn RM_GetLFU(
15651    mut key: *mut RedisModuleKey,
15652    mut lfu_freq: *mut libc::c_longlong,
15653) -> libc::c_int {
15654    *lfu_freq = -(1 as libc::c_int) as libc::c_longlong;
15655    if ((*key).value).is_null() {
15656        return 1 as libc::c_int;
15657    }
15658    if server.maxmemory_policy & (1 as libc::c_int) << 1 as libc::c_int != 0 {
15659        *lfu_freq = LFUDecrAndReturn((*key).value) as libc::c_longlong;
15660    }
15661    return 0 as libc::c_int;
15662}
15663#[no_mangle]
15664pub unsafe extern "C" fn RM_GetContextFlagsAll() -> libc::c_int {
15665    return ((1 as libc::c_int) << 24 as libc::c_int) - 1 as libc::c_int;
15666}
15667#[no_mangle]
15668pub unsafe extern "C" fn RM_GetKeyspaceNotificationFlagsAll() -> libc::c_int {
15669    return ((1 as libc::c_int) << 15 as libc::c_int) - 1 as libc::c_int;
15670}
15671#[no_mangle]
15672pub unsafe extern "C" fn RM_GetServerVersion() -> libc::c_int {
15673    return 0x70008 as libc::c_int;
15674}
15675#[no_mangle]
15676pub unsafe extern "C" fn RM_GetTypeMethodVersion() -> libc::c_int {
15677    return 4 as libc::c_int;
15678}
15679#[no_mangle]
15680pub unsafe extern "C" fn RM_ModuleTypeReplaceValue(
15681    mut key: *mut RedisModuleKey,
15682    mut mt: *mut moduleType,
15683    mut new_value: *mut libc::c_void,
15684    mut old_value: *mut *mut libc::c_void,
15685) -> libc::c_int {
15686    if (*key).mode & (1 as libc::c_int) << 1 as libc::c_int == 0
15687        || !((*key).iter).is_null()
15688    {
15689        return 1 as libc::c_int;
15690    }
15691    if ((*key).value).is_null()
15692        || (*(*key).value).type_0() as libc::c_int != 5 as libc::c_int
15693    {
15694        return 1 as libc::c_int;
15695    }
15696    let mut mv: *mut moduleValue = (*(*key).value).ptr as *mut moduleValue;
15697    if (*mv).type_0 != mt {
15698        return 1 as libc::c_int;
15699    }
15700    if !old_value.is_null() {
15701        *old_value = (*mv).value;
15702    }
15703    (*mv).value = new_value;
15704    return 0 as libc::c_int;
15705}
15706#[no_mangle]
15707pub unsafe extern "C" fn RM_GetCommandKeysWithFlags(
15708    mut ctx: *mut RedisModuleCtx,
15709    mut argv: *mut *mut robj,
15710    mut argc: libc::c_int,
15711    mut num_keys: *mut libc::c_int,
15712    mut out_flags: *mut *mut libc::c_int,
15713) -> *mut libc::c_int {
15714    let mut cmd: *mut redisCommand = 0 as *mut redisCommand;
15715    let mut res: *mut libc::c_int = 0 as *mut libc::c_int;
15716    cmd = lookupCommand(argv, argc);
15717    if cmd.is_null() {
15718        *__errno_location() = 2 as libc::c_int;
15719        return 0 as *mut libc::c_int;
15720    }
15721    if doesCommandHaveKeys(cmd) == 0 {
15722        *__errno_location() = 0 as libc::c_int;
15723        return 0 as *mut libc::c_int;
15724    }
15725    if (*cmd).arity > 0 as libc::c_int && (*cmd).arity != argc || argc < -(*cmd).arity {
15726        *__errno_location() = 22 as libc::c_int;
15727        return 0 as *mut libc::c_int;
15728    }
15729    let mut result: getKeysResult = {
15730        let mut init = getKeysResult {
15731            keysbuf: [
15732                {
15733                    let mut init = keyReference {
15734                        pos: 0 as libc::c_int,
15735                        flags: 0,
15736                    };
15737                    init
15738                },
15739                keyReference { pos: 0, flags: 0 },
15740                keyReference { pos: 0, flags: 0 },
15741                keyReference { pos: 0, flags: 0 },
15742                keyReference { pos: 0, flags: 0 },
15743                keyReference { pos: 0, flags: 0 },
15744                keyReference { pos: 0, flags: 0 },
15745                keyReference { pos: 0, flags: 0 },
15746                keyReference { pos: 0, flags: 0 },
15747                keyReference { pos: 0, flags: 0 },
15748                keyReference { pos: 0, flags: 0 },
15749                keyReference { pos: 0, flags: 0 },
15750                keyReference { pos: 0, flags: 0 },
15751                keyReference { pos: 0, flags: 0 },
15752                keyReference { pos: 0, flags: 0 },
15753                keyReference { pos: 0, flags: 0 },
15754                keyReference { pos: 0, flags: 0 },
15755                keyReference { pos: 0, flags: 0 },
15756                keyReference { pos: 0, flags: 0 },
15757                keyReference { pos: 0, flags: 0 },
15758                keyReference { pos: 0, flags: 0 },
15759                keyReference { pos: 0, flags: 0 },
15760                keyReference { pos: 0, flags: 0 },
15761                keyReference { pos: 0, flags: 0 },
15762                keyReference { pos: 0, flags: 0 },
15763                keyReference { pos: 0, flags: 0 },
15764                keyReference { pos: 0, flags: 0 },
15765                keyReference { pos: 0, flags: 0 },
15766                keyReference { pos: 0, flags: 0 },
15767                keyReference { pos: 0, flags: 0 },
15768                keyReference { pos: 0, flags: 0 },
15769                keyReference { pos: 0, flags: 0 },
15770                keyReference { pos: 0, flags: 0 },
15771                keyReference { pos: 0, flags: 0 },
15772                keyReference { pos: 0, flags: 0 },
15773                keyReference { pos: 0, flags: 0 },
15774                keyReference { pos: 0, flags: 0 },
15775                keyReference { pos: 0, flags: 0 },
15776                keyReference { pos: 0, flags: 0 },
15777                keyReference { pos: 0, flags: 0 },
15778                keyReference { pos: 0, flags: 0 },
15779                keyReference { pos: 0, flags: 0 },
15780                keyReference { pos: 0, flags: 0 },
15781                keyReference { pos: 0, flags: 0 },
15782                keyReference { pos: 0, flags: 0 },
15783                keyReference { pos: 0, flags: 0 },
15784                keyReference { pos: 0, flags: 0 },
15785                keyReference { pos: 0, flags: 0 },
15786                keyReference { pos: 0, flags: 0 },
15787                keyReference { pos: 0, flags: 0 },
15788                keyReference { pos: 0, flags: 0 },
15789                keyReference { pos: 0, flags: 0 },
15790                keyReference { pos: 0, flags: 0 },
15791                keyReference { pos: 0, flags: 0 },
15792                keyReference { pos: 0, flags: 0 },
15793                keyReference { pos: 0, flags: 0 },
15794                keyReference { pos: 0, flags: 0 },
15795                keyReference { pos: 0, flags: 0 },
15796                keyReference { pos: 0, flags: 0 },
15797                keyReference { pos: 0, flags: 0 },
15798                keyReference { pos: 0, flags: 0 },
15799                keyReference { pos: 0, flags: 0 },
15800                keyReference { pos: 0, flags: 0 },
15801                keyReference { pos: 0, flags: 0 },
15802                keyReference { pos: 0, flags: 0 },
15803                keyReference { pos: 0, flags: 0 },
15804                keyReference { pos: 0, flags: 0 },
15805                keyReference { pos: 0, flags: 0 },
15806                keyReference { pos: 0, flags: 0 },
15807                keyReference { pos: 0, flags: 0 },
15808                keyReference { pos: 0, flags: 0 },
15809                keyReference { pos: 0, flags: 0 },
15810                keyReference { pos: 0, flags: 0 },
15811                keyReference { pos: 0, flags: 0 },
15812                keyReference { pos: 0, flags: 0 },
15813                keyReference { pos: 0, flags: 0 },
15814                keyReference { pos: 0, flags: 0 },
15815                keyReference { pos: 0, flags: 0 },
15816                keyReference { pos: 0, flags: 0 },
15817                keyReference { pos: 0, flags: 0 },
15818                keyReference { pos: 0, flags: 0 },
15819                keyReference { pos: 0, flags: 0 },
15820                keyReference { pos: 0, flags: 0 },
15821                keyReference { pos: 0, flags: 0 },
15822                keyReference { pos: 0, flags: 0 },
15823                keyReference { pos: 0, flags: 0 },
15824                keyReference { pos: 0, flags: 0 },
15825                keyReference { pos: 0, flags: 0 },
15826                keyReference { pos: 0, flags: 0 },
15827                keyReference { pos: 0, flags: 0 },
15828                keyReference { pos: 0, flags: 0 },
15829                keyReference { pos: 0, flags: 0 },
15830                keyReference { pos: 0, flags: 0 },
15831                keyReference { pos: 0, flags: 0 },
15832                keyReference { pos: 0, flags: 0 },
15833                keyReference { pos: 0, flags: 0 },
15834                keyReference { pos: 0, flags: 0 },
15835                keyReference { pos: 0, flags: 0 },
15836                keyReference { pos: 0, flags: 0 },
15837                keyReference { pos: 0, flags: 0 },
15838                keyReference { pos: 0, flags: 0 },
15839                keyReference { pos: 0, flags: 0 },
15840                keyReference { pos: 0, flags: 0 },
15841                keyReference { pos: 0, flags: 0 },
15842                keyReference { pos: 0, flags: 0 },
15843                keyReference { pos: 0, flags: 0 },
15844                keyReference { pos: 0, flags: 0 },
15845                keyReference { pos: 0, flags: 0 },
15846                keyReference { pos: 0, flags: 0 },
15847                keyReference { pos: 0, flags: 0 },
15848                keyReference { pos: 0, flags: 0 },
15849                keyReference { pos: 0, flags: 0 },
15850                keyReference { pos: 0, flags: 0 },
15851                keyReference { pos: 0, flags: 0 },
15852                keyReference { pos: 0, flags: 0 },
15853                keyReference { pos: 0, flags: 0 },
15854                keyReference { pos: 0, flags: 0 },
15855                keyReference { pos: 0, flags: 0 },
15856                keyReference { pos: 0, flags: 0 },
15857                keyReference { pos: 0, flags: 0 },
15858                keyReference { pos: 0, flags: 0 },
15859                keyReference { pos: 0, flags: 0 },
15860                keyReference { pos: 0, flags: 0 },
15861                keyReference { pos: 0, flags: 0 },
15862                keyReference { pos: 0, flags: 0 },
15863                keyReference { pos: 0, flags: 0 },
15864                keyReference { pos: 0, flags: 0 },
15865                keyReference { pos: 0, flags: 0 },
15866                keyReference { pos: 0, flags: 0 },
15867                keyReference { pos: 0, flags: 0 },
15868                keyReference { pos: 0, flags: 0 },
15869                keyReference { pos: 0, flags: 0 },
15870                keyReference { pos: 0, flags: 0 },
15871                keyReference { pos: 0, flags: 0 },
15872                keyReference { pos: 0, flags: 0 },
15873                keyReference { pos: 0, flags: 0 },
15874                keyReference { pos: 0, flags: 0 },
15875                keyReference { pos: 0, flags: 0 },
15876                keyReference { pos: 0, flags: 0 },
15877                keyReference { pos: 0, flags: 0 },
15878                keyReference { pos: 0, flags: 0 },
15879                keyReference { pos: 0, flags: 0 },
15880                keyReference { pos: 0, flags: 0 },
15881                keyReference { pos: 0, flags: 0 },
15882                keyReference { pos: 0, flags: 0 },
15883                keyReference { pos: 0, flags: 0 },
15884                keyReference { pos: 0, flags: 0 },
15885                keyReference { pos: 0, flags: 0 },
15886                keyReference { pos: 0, flags: 0 },
15887                keyReference { pos: 0, flags: 0 },
15888                keyReference { pos: 0, flags: 0 },
15889                keyReference { pos: 0, flags: 0 },
15890                keyReference { pos: 0, flags: 0 },
15891                keyReference { pos: 0, flags: 0 },
15892                keyReference { pos: 0, flags: 0 },
15893                keyReference { pos: 0, flags: 0 },
15894                keyReference { pos: 0, flags: 0 },
15895                keyReference { pos: 0, flags: 0 },
15896                keyReference { pos: 0, flags: 0 },
15897                keyReference { pos: 0, flags: 0 },
15898                keyReference { pos: 0, flags: 0 },
15899                keyReference { pos: 0, flags: 0 },
15900                keyReference { pos: 0, flags: 0 },
15901                keyReference { pos: 0, flags: 0 },
15902                keyReference { pos: 0, flags: 0 },
15903                keyReference { pos: 0, flags: 0 },
15904                keyReference { pos: 0, flags: 0 },
15905                keyReference { pos: 0, flags: 0 },
15906                keyReference { pos: 0, flags: 0 },
15907                keyReference { pos: 0, flags: 0 },
15908                keyReference { pos: 0, flags: 0 },
15909                keyReference { pos: 0, flags: 0 },
15910                keyReference { pos: 0, flags: 0 },
15911                keyReference { pos: 0, flags: 0 },
15912                keyReference { pos: 0, flags: 0 },
15913                keyReference { pos: 0, flags: 0 },
15914                keyReference { pos: 0, flags: 0 },
15915                keyReference { pos: 0, flags: 0 },
15916                keyReference { pos: 0, flags: 0 },
15917                keyReference { pos: 0, flags: 0 },
15918                keyReference { pos: 0, flags: 0 },
15919                keyReference { pos: 0, flags: 0 },
15920                keyReference { pos: 0, flags: 0 },
15921                keyReference { pos: 0, flags: 0 },
15922                keyReference { pos: 0, flags: 0 },
15923                keyReference { pos: 0, flags: 0 },
15924                keyReference { pos: 0, flags: 0 },
15925                keyReference { pos: 0, flags: 0 },
15926                keyReference { pos: 0, flags: 0 },
15927                keyReference { pos: 0, flags: 0 },
15928                keyReference { pos: 0, flags: 0 },
15929                keyReference { pos: 0, flags: 0 },
15930                keyReference { pos: 0, flags: 0 },
15931                keyReference { pos: 0, flags: 0 },
15932                keyReference { pos: 0, flags: 0 },
15933                keyReference { pos: 0, flags: 0 },
15934                keyReference { pos: 0, flags: 0 },
15935                keyReference { pos: 0, flags: 0 },
15936                keyReference { pos: 0, flags: 0 },
15937                keyReference { pos: 0, flags: 0 },
15938                keyReference { pos: 0, flags: 0 },
15939                keyReference { pos: 0, flags: 0 },
15940                keyReference { pos: 0, flags: 0 },
15941                keyReference { pos: 0, flags: 0 },
15942                keyReference { pos: 0, flags: 0 },
15943                keyReference { pos: 0, flags: 0 },
15944                keyReference { pos: 0, flags: 0 },
15945                keyReference { pos: 0, flags: 0 },
15946                keyReference { pos: 0, flags: 0 },
15947                keyReference { pos: 0, flags: 0 },
15948                keyReference { pos: 0, flags: 0 },
15949                keyReference { pos: 0, flags: 0 },
15950                keyReference { pos: 0, flags: 0 },
15951                keyReference { pos: 0, flags: 0 },
15952                keyReference { pos: 0, flags: 0 },
15953                keyReference { pos: 0, flags: 0 },
15954                keyReference { pos: 0, flags: 0 },
15955                keyReference { pos: 0, flags: 0 },
15956                keyReference { pos: 0, flags: 0 },
15957                keyReference { pos: 0, flags: 0 },
15958                keyReference { pos: 0, flags: 0 },
15959                keyReference { pos: 0, flags: 0 },
15960                keyReference { pos: 0, flags: 0 },
15961                keyReference { pos: 0, flags: 0 },
15962                keyReference { pos: 0, flags: 0 },
15963                keyReference { pos: 0, flags: 0 },
15964                keyReference { pos: 0, flags: 0 },
15965                keyReference { pos: 0, flags: 0 },
15966                keyReference { pos: 0, flags: 0 },
15967                keyReference { pos: 0, flags: 0 },
15968                keyReference { pos: 0, flags: 0 },
15969                keyReference { pos: 0, flags: 0 },
15970                keyReference { pos: 0, flags: 0 },
15971                keyReference { pos: 0, flags: 0 },
15972                keyReference { pos: 0, flags: 0 },
15973                keyReference { pos: 0, flags: 0 },
15974                keyReference { pos: 0, flags: 0 },
15975                keyReference { pos: 0, flags: 0 },
15976                keyReference { pos: 0, flags: 0 },
15977                keyReference { pos: 0, flags: 0 },
15978                keyReference { pos: 0, flags: 0 },
15979                keyReference { pos: 0, flags: 0 },
15980                keyReference { pos: 0, flags: 0 },
15981                keyReference { pos: 0, flags: 0 },
15982                keyReference { pos: 0, flags: 0 },
15983                keyReference { pos: 0, flags: 0 },
15984                keyReference { pos: 0, flags: 0 },
15985                keyReference { pos: 0, flags: 0 },
15986                keyReference { pos: 0, flags: 0 },
15987                keyReference { pos: 0, flags: 0 },
15988                keyReference { pos: 0, flags: 0 },
15989                keyReference { pos: 0, flags: 0 },
15990                keyReference { pos: 0, flags: 0 },
15991                keyReference { pos: 0, flags: 0 },
15992                keyReference { pos: 0, flags: 0 },
15993                keyReference { pos: 0, flags: 0 },
15994            ],
15995            keys: 0 as *mut keyReference,
15996            numkeys: 0 as libc::c_int,
15997            size: 256 as libc::c_int,
15998        };
15999        init
16000    };
16001    getKeysFromCommand(cmd, argv, argc, &mut result);
16002    *num_keys = result.numkeys;
16003    if result.numkeys == 0 {
16004        *__errno_location() = 0 as libc::c_int;
16005        getKeysFreeResult(&mut result);
16006        return 0 as *mut libc::c_int;
16007    }
16008    let mut size: libc::c_ulong = (core::mem::size_of::<libc::c_int>()
16009        as libc::c_ulong)
16010        .wrapping_mul(result.numkeys as libc::c_ulong);
16011    res = zmalloc(size) as *mut libc::c_int;
16012    if !out_flags.is_null() {
16013        *out_flags = zmalloc(size) as *mut libc::c_int;
16014    }
16015    let mut i: libc::c_int = 0 as libc::c_int;
16016    while i < result.numkeys {
16017        *res.offset(i as isize) = (*(result.keys).offset(i as isize)).pos;
16018        if !out_flags.is_null() {
16019            *(*out_flags)
16020                .offset(
16021                    i as isize,
16022                ) = moduleConvertKeySpecsFlags(
16023                (*(result.keys).offset(i as isize)).flags as int64_t,
16024                0 as libc::c_int,
16025            ) as libc::c_int;
16026        }
16027        i += 1;
16028    }
16029    return res;
16030}
16031#[no_mangle]
16032pub unsafe extern "C" fn RM_GetCommandKeys(
16033    mut ctx: *mut RedisModuleCtx,
16034    mut argv: *mut *mut robj,
16035    mut argc: libc::c_int,
16036    mut num_keys: *mut libc::c_int,
16037) -> *mut libc::c_int {
16038    return RM_GetCommandKeysWithFlags(
16039        ctx,
16040        argv,
16041        argc,
16042        num_keys,
16043        0 as *mut *mut libc::c_int,
16044    );
16045}
16046#[no_mangle]
16047pub unsafe extern "C" fn RM_GetCurrentCommandName(
16048    mut ctx: *mut RedisModuleCtx,
16049) -> *const libc::c_char {
16050    if ctx.is_null() || ((*ctx).client).is_null() || ((*(*ctx).client).cmd).is_null() {
16051        return 0 as *const libc::c_char;
16052    }
16053    return (*(*(*ctx).client).cmd).fullname as *const libc::c_char;
16054}
16055#[no_mangle]
16056pub unsafe extern "C" fn RM_RegisterDefragFunc(
16057    mut ctx: *mut RedisModuleCtx,
16058    mut cb: RedisModuleDefragFunc,
16059) -> libc::c_int {
16060    (*(*ctx).module).defrag_cb = cb;
16061    return 0 as libc::c_int;
16062}
16063#[no_mangle]
16064pub unsafe extern "C" fn RM_DefragShouldStop(
16065    mut ctx: *mut RedisModuleDefragCtx,
16066) -> libc::c_int {
16067    return ((*ctx).endtime != 0 as libc::c_int as libc::c_longlong
16068        && (*ctx).endtime < ustime()) as libc::c_int;
16069}
16070#[no_mangle]
16071pub unsafe extern "C" fn RM_DefragCursorSet(
16072    mut ctx: *mut RedisModuleDefragCtx,
16073    mut cursor: libc::c_ulong,
16074) -> libc::c_int {
16075    if ((*ctx).cursor).is_null() {
16076        return 1 as libc::c_int;
16077    }
16078    *(*ctx).cursor = cursor;
16079    return 0 as libc::c_int;
16080}
16081#[no_mangle]
16082pub unsafe extern "C" fn RM_DefragCursorGet(
16083    mut ctx: *mut RedisModuleDefragCtx,
16084    mut cursor: *mut libc::c_ulong,
16085) -> libc::c_int {
16086    if ((*ctx).cursor).is_null() {
16087        return 1 as libc::c_int;
16088    }
16089    *cursor = *(*ctx).cursor;
16090    return 0 as libc::c_int;
16091}
16092#[no_mangle]
16093pub unsafe extern "C" fn RM_DefragAlloc(
16094    mut ctx: *mut RedisModuleDefragCtx,
16095    mut ptr: *mut libc::c_void,
16096) -> *mut libc::c_void {
16097    let mut newptr: *mut libc::c_void = activeDefragAlloc(ptr);
16098    if !newptr.is_null() {
16099        (*ctx).defragged += 1;
16100    }
16101    return newptr;
16102}
16103#[no_mangle]
16104pub unsafe extern "C" fn RM_DefragRedisModuleString(
16105    mut ctx: *mut RedisModuleDefragCtx,
16106    mut str: *mut robj,
16107) -> *mut robj {
16108    return activeDefragStringOb(str, &mut (*ctx).defragged);
16109}
16110#[no_mangle]
16111pub unsafe extern "C" fn moduleLateDefrag(
16112    mut key: *mut robj,
16113    mut value: *mut robj,
16114    mut cursor: *mut libc::c_ulong,
16115    mut endtime: libc::c_longlong,
16116    mut defragged: *mut libc::c_longlong,
16117    mut dbid: libc::c_int,
16118) -> libc::c_int {
16119    let mut mv: *mut moduleValue = (*value).ptr as *mut moduleValue;
16120    let mut mt: *mut moduleType = (*mv).type_0;
16121    let mut defrag_ctx: RedisModuleDefragCtx = {
16122        let mut init = RedisModuleDefragCtx {
16123            defragged: 0 as libc::c_int as libc::c_long,
16124            endtime: endtime,
16125            cursor: cursor,
16126            key: key,
16127            dbid: dbid,
16128        };
16129        init
16130    };
16131    let mut ret: libc::c_int = 0 as libc::c_int;
16132    if ((*mt).defrag).is_some() {
16133        ret = ((*mt).defrag)
16134            .expect("non-null function pointer")(&mut defrag_ctx, key, &mut (*mv).value);
16135    }
16136    *defragged += defrag_ctx.defragged as libc::c_longlong;
16137    if ret == 0 {
16138        *cursor = 0 as libc::c_int as libc::c_ulong;
16139        return 0 as libc::c_int;
16140    }
16141    return 1 as libc::c_int;
16142}
16143#[no_mangle]
16144pub unsafe extern "C" fn moduleDefragValue(
16145    mut key: *mut robj,
16146    mut value: *mut robj,
16147    mut defragged: *mut libc::c_long,
16148    mut dbid: libc::c_int,
16149) -> libc::c_int {
16150    let mut mv: *mut moduleValue = (*value).ptr as *mut moduleValue;
16151    let mut mt: *mut moduleType = (*mv).type_0;
16152    let mut newmv: *mut moduleValue = activeDefragAlloc(mv as *mut libc::c_void)
16153        as *mut moduleValue;
16154    if !newmv.is_null() {
16155        *defragged += 1;
16156        mv = newmv;
16157        (*value).ptr = mv as *mut libc::c_void;
16158    }
16159    if ((*mt).defrag).is_none() {
16160        return 1 as libc::c_int;
16161    }
16162    let mut effort: size_t = moduleGetFreeEffort(key, value, dbid);
16163    if effort == 0 {
16164        effort = 18446744073709551615 as libc::c_ulong;
16165    }
16166    if effort > server.active_defrag_max_scan_fields {
16167        return 0 as libc::c_int;
16168    }
16169    let mut defrag_ctx: RedisModuleDefragCtx = {
16170        let mut init = RedisModuleDefragCtx {
16171            defragged: 0 as libc::c_int as libc::c_long,
16172            endtime: 0 as libc::c_int as libc::c_longlong,
16173            cursor: 0 as *mut libc::c_ulong,
16174            key: key,
16175            dbid: dbid,
16176        };
16177        init
16178    };
16179    ((*mt).defrag)
16180        .expect("non-null function pointer")(&mut defrag_ctx, key, &mut (*mv).value);
16181    *defragged += defrag_ctx.defragged;
16182    return 1 as libc::c_int;
16183}
16184#[no_mangle]
16185pub unsafe extern "C" fn moduleDefragGlobals() -> libc::c_long {
16186    let mut di: *mut dictIterator = dictGetIterator(modules);
16187    let mut de: *mut dictEntry = 0 as *mut dictEntry;
16188    let mut defragged: libc::c_long = 0 as libc::c_int as libc::c_long;
16189    loop {
16190        de = dictNext(di);
16191        if de.is_null() {
16192            break;
16193        }
16194        let mut module: *mut RedisModule = (*de).v.val as *mut RedisModule;
16195        if ((*module).defrag_cb).is_none() {
16196            continue;
16197        }
16198        let mut defrag_ctx: RedisModuleDefragCtx = {
16199            let mut init = RedisModuleDefragCtx {
16200                defragged: 0 as libc::c_int as libc::c_long,
16201                endtime: 0 as libc::c_int as libc::c_longlong,
16202                cursor: 0 as *mut libc::c_ulong,
16203                key: 0 as *mut redisObject,
16204                dbid: -(1 as libc::c_int),
16205            };
16206            init
16207        };
16208        ((*module).defrag_cb).expect("non-null function pointer")(&mut defrag_ctx);
16209        defragged += defrag_ctx.defragged;
16210    }
16211    dictReleaseIterator(di);
16212    return defragged;
16213}
16214#[no_mangle]
16215pub unsafe extern "C" fn RM_GetKeyNameFromDefragCtx(
16216    mut ctx: *mut RedisModuleDefragCtx,
16217) -> *const robj {
16218    return (*ctx).key;
16219}
16220#[no_mangle]
16221pub unsafe extern "C" fn RM_GetDbIdFromDefragCtx(
16222    mut ctx: *mut RedisModuleDefragCtx,
16223) -> libc::c_int {
16224    return (*ctx).dbid;
16225}
16226#[no_mangle]
16227pub unsafe extern "C" fn moduleRegisterCoreAPI() {
16228    server.moduleapi = dictCreate(&mut moduleAPIDictType);
16229    server.sharedapi = dictCreate(&mut moduleAPIDictType);
16230    moduleRegisterApi(
16231        b"RedisModule_Alloc\0" as *const u8 as *const libc::c_char,
16232        core::mem::transmute::<
16233            Option::<unsafe extern "C" fn(size_t) -> *mut libc::c_void>,
16234            libc::c_ulong,
16235        >(Some(RM_Alloc as unsafe extern "C" fn(size_t) -> *mut libc::c_void))
16236            as *mut libc::c_void,
16237    );
16238    moduleRegisterApi(
16239        b"RedisModule_TryAlloc\0" as *const u8 as *const libc::c_char,
16240        core::mem::transmute::<
16241            Option::<unsafe extern "C" fn(size_t) -> *mut libc::c_void>,
16242            libc::c_ulong,
16243        >(Some(RM_TryAlloc as unsafe extern "C" fn(size_t) -> *mut libc::c_void))
16244            as *mut libc::c_void,
16245    );
16246    moduleRegisterApi(
16247        b"RedisModule_Calloc\0" as *const u8 as *const libc::c_char,
16248        core::mem::transmute::<
16249            Option::<unsafe extern "C" fn(size_t, size_t) -> *mut libc::c_void>,
16250            libc::c_ulong,
16251        >(Some(RM_Calloc as unsafe extern "C" fn(size_t, size_t) -> *mut libc::c_void))
16252            as *mut libc::c_void,
16253    );
16254    moduleRegisterApi(
16255        b"RedisModule_Realloc\0" as *const u8 as *const libc::c_char,
16256        core::mem::transmute::<
16257            Option::<
16258                unsafe extern "C" fn(*mut libc::c_void, size_t) -> *mut libc::c_void,
16259            >,
16260            libc::c_ulong,
16261        >(
16262            Some(
16263                RM_Realloc
16264                    as unsafe extern "C" fn(
16265                        *mut libc::c_void,
16266                        size_t,
16267                    ) -> *mut libc::c_void,
16268            ),
16269        ) as *mut libc::c_void,
16270    );
16271    moduleRegisterApi(
16272        b"RedisModule_Free\0" as *const u8 as *const libc::c_char,
16273        core::mem::transmute::<
16274            Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>,
16275            libc::c_ulong,
16276        >(Some(RM_Free as unsafe extern "C" fn(*mut libc::c_void) -> ()))
16277            as *mut libc::c_void,
16278    );
16279    moduleRegisterApi(
16280        b"RedisModule_Strdup\0" as *const u8 as *const libc::c_char,
16281        core::mem::transmute::<
16282            Option::<unsafe extern "C" fn(*const libc::c_char) -> *mut libc::c_char>,
16283            libc::c_ulong,
16284        >(
16285            Some(
16286                RM_Strdup
16287                    as unsafe extern "C" fn(*const libc::c_char) -> *mut libc::c_char,
16288            ),
16289        ) as *mut libc::c_void,
16290    );
16291    moduleRegisterApi(
16292        b"RedisModule_CreateCommand\0" as *const u8 as *const libc::c_char,
16293        core::mem::transmute::<
16294            Option::<
16295                unsafe extern "C" fn(
16296                    *mut RedisModuleCtx,
16297                    *const libc::c_char,
16298                    RedisModuleCmdFunc,
16299                    *const libc::c_char,
16300                    libc::c_int,
16301                    libc::c_int,
16302                    libc::c_int,
16303                ) -> libc::c_int,
16304            >,
16305            libc::c_ulong,
16306        >(
16307            Some(
16308                RM_CreateCommand
16309                    as unsafe extern "C" fn(
16310                        *mut RedisModuleCtx,
16311                        *const libc::c_char,
16312                        RedisModuleCmdFunc,
16313                        *const libc::c_char,
16314                        libc::c_int,
16315                        libc::c_int,
16316                        libc::c_int,
16317                    ) -> libc::c_int,
16318            ),
16319        ) as *mut libc::c_void,
16320    );
16321    moduleRegisterApi(
16322        b"RedisModule_GetCommand\0" as *const u8 as *const libc::c_char,
16323        core::mem::transmute::<
16324            Option::<
16325                unsafe extern "C" fn(
16326                    *mut RedisModuleCtx,
16327                    *const libc::c_char,
16328                ) -> *mut RedisModuleCommand,
16329            >,
16330            libc::c_ulong,
16331        >(
16332            Some(
16333                RM_GetCommand
16334                    as unsafe extern "C" fn(
16335                        *mut RedisModuleCtx,
16336                        *const libc::c_char,
16337                    ) -> *mut RedisModuleCommand,
16338            ),
16339        ) as *mut libc::c_void,
16340    );
16341    moduleRegisterApi(
16342        b"RedisModule_CreateSubcommand\0" as *const u8 as *const libc::c_char,
16343        core::mem::transmute::<
16344            Option::<
16345                unsafe extern "C" fn(
16346                    *mut RedisModuleCommand,
16347                    *const libc::c_char,
16348                    RedisModuleCmdFunc,
16349                    *const libc::c_char,
16350                    libc::c_int,
16351                    libc::c_int,
16352                    libc::c_int,
16353                ) -> libc::c_int,
16354            >,
16355            libc::c_ulong,
16356        >(
16357            Some(
16358                RM_CreateSubcommand
16359                    as unsafe extern "C" fn(
16360                        *mut RedisModuleCommand,
16361                        *const libc::c_char,
16362                        RedisModuleCmdFunc,
16363                        *const libc::c_char,
16364                        libc::c_int,
16365                        libc::c_int,
16366                        libc::c_int,
16367                    ) -> libc::c_int,
16368            ),
16369        ) as *mut libc::c_void,
16370    );
16371    moduleRegisterApi(
16372        b"RedisModule_SetCommandInfo\0" as *const u8 as *const libc::c_char,
16373        core::mem::transmute::<
16374            Option::<
16375                unsafe extern "C" fn(
16376                    *mut RedisModuleCommand,
16377                    *const RedisModuleCommandInfo,
16378                ) -> libc::c_int,
16379            >,
16380            libc::c_ulong,
16381        >(
16382            Some(
16383                RM_SetCommandInfo
16384                    as unsafe extern "C" fn(
16385                        *mut RedisModuleCommand,
16386                        *const RedisModuleCommandInfo,
16387                    ) -> libc::c_int,
16388            ),
16389        ) as *mut libc::c_void,
16390    );
16391    moduleRegisterApi(
16392        b"RedisModule_SetModuleAttribs\0" as *const u8 as *const libc::c_char,
16393        core::mem::transmute::<
16394            Option::<
16395                unsafe extern "C" fn(
16396                    *mut RedisModuleCtx,
16397                    *const libc::c_char,
16398                    libc::c_int,
16399                    libc::c_int,
16400                ) -> (),
16401            >,
16402            libc::c_ulong,
16403        >(
16404            Some(
16405                RM_SetModuleAttribs
16406                    as unsafe extern "C" fn(
16407                        *mut RedisModuleCtx,
16408                        *const libc::c_char,
16409                        libc::c_int,
16410                        libc::c_int,
16411                    ) -> (),
16412            ),
16413        ) as *mut libc::c_void,
16414    );
16415    moduleRegisterApi(
16416        b"RedisModule_IsModuleNameBusy\0" as *const u8 as *const libc::c_char,
16417        core::mem::transmute::<
16418            Option::<unsafe extern "C" fn(*const libc::c_char) -> libc::c_int>,
16419            libc::c_ulong,
16420        >(
16421            Some(
16422                RM_IsModuleNameBusy
16423                    as unsafe extern "C" fn(*const libc::c_char) -> libc::c_int,
16424            ),
16425        ) as *mut libc::c_void,
16426    );
16427    moduleRegisterApi(
16428        b"RedisModule_WrongArity\0" as *const u8 as *const libc::c_char,
16429        core::mem::transmute::<
16430            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
16431            libc::c_ulong,
16432        >(
16433            Some(
16434                RM_WrongArity as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
16435            ),
16436        ) as *mut libc::c_void,
16437    );
16438    moduleRegisterApi(
16439        b"RedisModule_ReplyWithLongLong\0" as *const u8 as *const libc::c_char,
16440        core::mem::transmute::<
16441            Option::<
16442                unsafe extern "C" fn(
16443                    *mut RedisModuleCtx,
16444                    libc::c_longlong,
16445                ) -> libc::c_int,
16446            >,
16447            libc::c_ulong,
16448        >(
16449            Some(
16450                RM_ReplyWithLongLong
16451                    as unsafe extern "C" fn(
16452                        *mut RedisModuleCtx,
16453                        libc::c_longlong,
16454                    ) -> libc::c_int,
16455            ),
16456        ) as *mut libc::c_void,
16457    );
16458    moduleRegisterApi(
16459        b"RedisModule_ReplyWithError\0" as *const u8 as *const libc::c_char,
16460        core::mem::transmute::<
16461            Option::<
16462                unsafe extern "C" fn(
16463                    *mut RedisModuleCtx,
16464                    *const libc::c_char,
16465                ) -> libc::c_int,
16466            >,
16467            libc::c_ulong,
16468        >(
16469            Some(
16470                RM_ReplyWithError
16471                    as unsafe extern "C" fn(
16472                        *mut RedisModuleCtx,
16473                        *const libc::c_char,
16474                    ) -> libc::c_int,
16475            ),
16476        ) as *mut libc::c_void,
16477    );
16478    moduleRegisterApi(
16479        b"RedisModule_ReplyWithSimpleString\0" as *const u8 as *const libc::c_char,
16480        core::mem::transmute::<
16481            Option::<
16482                unsafe extern "C" fn(
16483                    *mut RedisModuleCtx,
16484                    *const libc::c_char,
16485                ) -> libc::c_int,
16486            >,
16487            libc::c_ulong,
16488        >(
16489            Some(
16490                RM_ReplyWithSimpleString
16491                    as unsafe extern "C" fn(
16492                        *mut RedisModuleCtx,
16493                        *const libc::c_char,
16494                    ) -> libc::c_int,
16495            ),
16496        ) as *mut libc::c_void,
16497    );
16498    moduleRegisterApi(
16499        b"RedisModule_ReplyWithArray\0" as *const u8 as *const libc::c_char,
16500        core::mem::transmute::<
16501            Option::<
16502                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> libc::c_int,
16503            >,
16504            libc::c_ulong,
16505        >(
16506            Some(
16507                RM_ReplyWithArray
16508                    as unsafe extern "C" fn(
16509                        *mut RedisModuleCtx,
16510                        libc::c_long,
16511                    ) -> libc::c_int,
16512            ),
16513        ) as *mut libc::c_void,
16514    );
16515    moduleRegisterApi(
16516        b"RedisModule_ReplyWithMap\0" as *const u8 as *const libc::c_char,
16517        core::mem::transmute::<
16518            Option::<
16519                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> libc::c_int,
16520            >,
16521            libc::c_ulong,
16522        >(
16523            Some(
16524                RM_ReplyWithMap
16525                    as unsafe extern "C" fn(
16526                        *mut RedisModuleCtx,
16527                        libc::c_long,
16528                    ) -> libc::c_int,
16529            ),
16530        ) as *mut libc::c_void,
16531    );
16532    moduleRegisterApi(
16533        b"RedisModule_ReplyWithSet\0" as *const u8 as *const libc::c_char,
16534        core::mem::transmute::<
16535            Option::<
16536                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> libc::c_int,
16537            >,
16538            libc::c_ulong,
16539        >(
16540            Some(
16541                RM_ReplyWithSet
16542                    as unsafe extern "C" fn(
16543                        *mut RedisModuleCtx,
16544                        libc::c_long,
16545                    ) -> libc::c_int,
16546            ),
16547        ) as *mut libc::c_void,
16548    );
16549    moduleRegisterApi(
16550        b"RedisModule_ReplyWithAttribute\0" as *const u8 as *const libc::c_char,
16551        core::mem::transmute::<
16552            Option::<
16553                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> libc::c_int,
16554            >,
16555            libc::c_ulong,
16556        >(
16557            Some(
16558                RM_ReplyWithAttribute
16559                    as unsafe extern "C" fn(
16560                        *mut RedisModuleCtx,
16561                        libc::c_long,
16562                    ) -> libc::c_int,
16563            ),
16564        ) as *mut libc::c_void,
16565    );
16566    moduleRegisterApi(
16567        b"RedisModule_ReplyWithNullArray\0" as *const u8 as *const libc::c_char,
16568        core::mem::transmute::<
16569            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
16570            libc::c_ulong,
16571        >(
16572            Some(
16573                RM_ReplyWithNullArray
16574                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
16575            ),
16576        ) as *mut libc::c_void,
16577    );
16578    moduleRegisterApi(
16579        b"RedisModule_ReplyWithEmptyArray\0" as *const u8 as *const libc::c_char,
16580        core::mem::transmute::<
16581            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
16582            libc::c_ulong,
16583        >(
16584            Some(
16585                RM_ReplyWithEmptyArray
16586                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
16587            ),
16588        ) as *mut libc::c_void,
16589    );
16590    moduleRegisterApi(
16591        b"RedisModule_ReplySetArrayLength\0" as *const u8 as *const libc::c_char,
16592        core::mem::transmute::<
16593            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> ()>,
16594            libc::c_ulong,
16595        >(
16596            Some(
16597                RM_ReplySetArrayLength
16598                    as unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> (),
16599            ),
16600        ) as *mut libc::c_void,
16601    );
16602    moduleRegisterApi(
16603        b"RedisModule_ReplySetMapLength\0" as *const u8 as *const libc::c_char,
16604        core::mem::transmute::<
16605            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> ()>,
16606            libc::c_ulong,
16607        >(
16608            Some(
16609                RM_ReplySetMapLength
16610                    as unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> (),
16611            ),
16612        ) as *mut libc::c_void,
16613    );
16614    moduleRegisterApi(
16615        b"RedisModule_ReplySetSetLength\0" as *const u8 as *const libc::c_char,
16616        core::mem::transmute::<
16617            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> ()>,
16618            libc::c_ulong,
16619        >(
16620            Some(
16621                RM_ReplySetSetLength
16622                    as unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> (),
16623            ),
16624        ) as *mut libc::c_void,
16625    );
16626    moduleRegisterApi(
16627        b"RedisModule_ReplySetAttributeLength\0" as *const u8 as *const libc::c_char,
16628        core::mem::transmute::<
16629            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> ()>,
16630            libc::c_ulong,
16631        >(
16632            Some(
16633                RM_ReplySetAttributeLength
16634                    as unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_long) -> (),
16635            ),
16636        ) as *mut libc::c_void,
16637    );
16638    moduleRegisterApi(
16639        b"RedisModule_ReplyWithString\0" as *const u8 as *const libc::c_char,
16640        core::mem::transmute::<
16641            Option::<
16642                unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> libc::c_int,
16643            >,
16644            libc::c_ulong,
16645        >(
16646            Some(
16647                RM_ReplyWithString
16648                    as unsafe extern "C" fn(
16649                        *mut RedisModuleCtx,
16650                        *mut robj,
16651                    ) -> libc::c_int,
16652            ),
16653        ) as *mut libc::c_void,
16654    );
16655    moduleRegisterApi(
16656        b"RedisModule_ReplyWithEmptyString\0" as *const u8 as *const libc::c_char,
16657        core::mem::transmute::<
16658            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
16659            libc::c_ulong,
16660        >(
16661            Some(
16662                RM_ReplyWithEmptyString
16663                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
16664            ),
16665        ) as *mut libc::c_void,
16666    );
16667    moduleRegisterApi(
16668        b"RedisModule_ReplyWithVerbatimString\0" as *const u8 as *const libc::c_char,
16669        core::mem::transmute::<
16670            Option::<
16671                unsafe extern "C" fn(
16672                    *mut RedisModuleCtx,
16673                    *const libc::c_char,
16674                    size_t,
16675                ) -> libc::c_int,
16676            >,
16677            libc::c_ulong,
16678        >(
16679            Some(
16680                RM_ReplyWithVerbatimString
16681                    as unsafe extern "C" fn(
16682                        *mut RedisModuleCtx,
16683                        *const libc::c_char,
16684                        size_t,
16685                    ) -> libc::c_int,
16686            ),
16687        ) as *mut libc::c_void,
16688    );
16689    moduleRegisterApi(
16690        b"RedisModule_ReplyWithVerbatimStringType\0" as *const u8 as *const libc::c_char,
16691        core::mem::transmute::<
16692            Option::<
16693                unsafe extern "C" fn(
16694                    *mut RedisModuleCtx,
16695                    *const libc::c_char,
16696                    size_t,
16697                    *const libc::c_char,
16698                ) -> libc::c_int,
16699            >,
16700            libc::c_ulong,
16701        >(
16702            Some(
16703                RM_ReplyWithVerbatimStringType
16704                    as unsafe extern "C" fn(
16705                        *mut RedisModuleCtx,
16706                        *const libc::c_char,
16707                        size_t,
16708                        *const libc::c_char,
16709                    ) -> libc::c_int,
16710            ),
16711        ) as *mut libc::c_void,
16712    );
16713    moduleRegisterApi(
16714        b"RedisModule_ReplyWithStringBuffer\0" as *const u8 as *const libc::c_char,
16715        core::mem::transmute::<
16716            Option::<
16717                unsafe extern "C" fn(
16718                    *mut RedisModuleCtx,
16719                    *const libc::c_char,
16720                    size_t,
16721                ) -> libc::c_int,
16722            >,
16723            libc::c_ulong,
16724        >(
16725            Some(
16726                RM_ReplyWithStringBuffer
16727                    as unsafe extern "C" fn(
16728                        *mut RedisModuleCtx,
16729                        *const libc::c_char,
16730                        size_t,
16731                    ) -> libc::c_int,
16732            ),
16733        ) as *mut libc::c_void,
16734    );
16735    moduleRegisterApi(
16736        b"RedisModule_ReplyWithCString\0" as *const u8 as *const libc::c_char,
16737        core::mem::transmute::<
16738            Option::<
16739                unsafe extern "C" fn(
16740                    *mut RedisModuleCtx,
16741                    *const libc::c_char,
16742                ) -> libc::c_int,
16743            >,
16744            libc::c_ulong,
16745        >(
16746            Some(
16747                RM_ReplyWithCString
16748                    as unsafe extern "C" fn(
16749                        *mut RedisModuleCtx,
16750                        *const libc::c_char,
16751                    ) -> libc::c_int,
16752            ),
16753        ) as *mut libc::c_void,
16754    );
16755    moduleRegisterApi(
16756        b"RedisModule_ReplyWithNull\0" as *const u8 as *const libc::c_char,
16757        core::mem::transmute::<
16758            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
16759            libc::c_ulong,
16760        >(
16761            Some(
16762                RM_ReplyWithNull
16763                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
16764            ),
16765        ) as *mut libc::c_void,
16766    );
16767    moduleRegisterApi(
16768        b"RedisModule_ReplyWithBool\0" as *const u8 as *const libc::c_char,
16769        core::mem::transmute::<
16770            Option::<
16771                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int) -> libc::c_int,
16772            >,
16773            libc::c_ulong,
16774        >(
16775            Some(
16776                RM_ReplyWithBool
16777                    as unsafe extern "C" fn(
16778                        *mut RedisModuleCtx,
16779                        libc::c_int,
16780                    ) -> libc::c_int,
16781            ),
16782        ) as *mut libc::c_void,
16783    );
16784    moduleRegisterApi(
16785        b"RedisModule_ReplyWithCallReply\0" as *const u8 as *const libc::c_char,
16786        core::mem::transmute::<
16787            Option::<
16788                unsafe extern "C" fn(
16789                    *mut RedisModuleCtx,
16790                    *mut RedisModuleCallReply,
16791                ) -> libc::c_int,
16792            >,
16793            libc::c_ulong,
16794        >(
16795            Some(
16796                RM_ReplyWithCallReply
16797                    as unsafe extern "C" fn(
16798                        *mut RedisModuleCtx,
16799                        *mut RedisModuleCallReply,
16800                    ) -> libc::c_int,
16801            ),
16802        ) as *mut libc::c_void,
16803    );
16804    moduleRegisterApi(
16805        b"RedisModule_ReplyWithDouble\0" as *const u8 as *const libc::c_char,
16806        core::mem::transmute::<
16807            Option::<
16808                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_double) -> libc::c_int,
16809            >,
16810            libc::c_ulong,
16811        >(
16812            Some(
16813                RM_ReplyWithDouble
16814                    as unsafe extern "C" fn(
16815                        *mut RedisModuleCtx,
16816                        libc::c_double,
16817                    ) -> libc::c_int,
16818            ),
16819        ) as *mut libc::c_void,
16820    );
16821    moduleRegisterApi(
16822        b"RedisModule_ReplyWithBigNumber\0" as *const u8 as *const libc::c_char,
16823        core::mem::transmute::<
16824            Option::<
16825                unsafe extern "C" fn(
16826                    *mut RedisModuleCtx,
16827                    *const libc::c_char,
16828                    size_t,
16829                ) -> libc::c_int,
16830            >,
16831            libc::c_ulong,
16832        >(
16833            Some(
16834                RM_ReplyWithBigNumber
16835                    as unsafe extern "C" fn(
16836                        *mut RedisModuleCtx,
16837                        *const libc::c_char,
16838                        size_t,
16839                    ) -> libc::c_int,
16840            ),
16841        ) as *mut libc::c_void,
16842    );
16843    moduleRegisterApi(
16844        b"RedisModule_ReplyWithLongDouble\0" as *const u8 as *const libc::c_char,
16845        core::mem::transmute::<
16846            Option::<
16847                unsafe extern "C" fn(*mut RedisModuleCtx, f64) -> libc::c_int,
16848            >,
16849            libc::c_ulong,
16850        >(
16851            Some(
16852                RM_ReplyWithLongDouble
16853                    as unsafe extern "C" fn(
16854                        *mut RedisModuleCtx,
16855                        f64,
16856                    ) -> libc::c_int,
16857            ),
16858        ) as *mut libc::c_void,
16859    );
16860    moduleRegisterApi(
16861        b"RedisModule_GetSelectedDb\0" as *const u8 as *const libc::c_char,
16862        core::mem::transmute::<
16863            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
16864            libc::c_ulong,
16865        >(
16866            Some(
16867                RM_GetSelectedDb
16868                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
16869            ),
16870        ) as *mut libc::c_void,
16871    );
16872    moduleRegisterApi(
16873        b"RedisModule_SelectDb\0" as *const u8 as *const libc::c_char,
16874        core::mem::transmute::<
16875            Option::<
16876                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int) -> libc::c_int,
16877            >,
16878            libc::c_ulong,
16879        >(
16880            Some(
16881                RM_SelectDb
16882                    as unsafe extern "C" fn(
16883                        *mut RedisModuleCtx,
16884                        libc::c_int,
16885                    ) -> libc::c_int,
16886            ),
16887        ) as *mut libc::c_void,
16888    );
16889    moduleRegisterApi(
16890        b"RedisModule_KeyExists\0" as *const u8 as *const libc::c_char,
16891        core::mem::transmute::<
16892            Option::<
16893                unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> libc::c_int,
16894            >,
16895            libc::c_ulong,
16896        >(
16897            Some(
16898                RM_KeyExists
16899                    as unsafe extern "C" fn(
16900                        *mut RedisModuleCtx,
16901                        *mut robj,
16902                    ) -> libc::c_int,
16903            ),
16904        ) as *mut libc::c_void,
16905    );
16906    moduleRegisterApi(
16907        b"RedisModule_OpenKey\0" as *const u8 as *const libc::c_char,
16908        core::mem::transmute::<
16909            Option::<
16910                unsafe extern "C" fn(
16911                    *mut RedisModuleCtx,
16912                    *mut robj,
16913                    libc::c_int,
16914                ) -> *mut RedisModuleKey,
16915            >,
16916            libc::c_ulong,
16917        >(
16918            Some(
16919                RM_OpenKey
16920                    as unsafe extern "C" fn(
16921                        *mut RedisModuleCtx,
16922                        *mut robj,
16923                        libc::c_int,
16924                    ) -> *mut RedisModuleKey,
16925            ),
16926        ) as *mut libc::c_void,
16927    );
16928    moduleRegisterApi(
16929        b"RedisModule_CloseKey\0" as *const u8 as *const libc::c_char,
16930        core::mem::transmute::<
16931            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> ()>,
16932            libc::c_ulong,
16933        >(Some(RM_CloseKey as unsafe extern "C" fn(*mut RedisModuleKey) -> ()))
16934            as *mut libc::c_void,
16935    );
16936    moduleRegisterApi(
16937        b"RedisModule_KeyType\0" as *const u8 as *const libc::c_char,
16938        core::mem::transmute::<
16939            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
16940            libc::c_ulong,
16941        >(Some(RM_KeyType as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int))
16942            as *mut libc::c_void,
16943    );
16944    moduleRegisterApi(
16945        b"RedisModule_ValueLength\0" as *const u8 as *const libc::c_char,
16946        core::mem::transmute::<
16947            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> size_t>,
16948            libc::c_ulong,
16949        >(Some(RM_ValueLength as unsafe extern "C" fn(*mut RedisModuleKey) -> size_t))
16950            as *mut libc::c_void,
16951    );
16952    moduleRegisterApi(
16953        b"RedisModule_ListPush\0" as *const u8 as *const libc::c_char,
16954        core::mem::transmute::<
16955            Option::<
16956                unsafe extern "C" fn(
16957                    *mut RedisModuleKey,
16958                    libc::c_int,
16959                    *mut robj,
16960                ) -> libc::c_int,
16961            >,
16962            libc::c_ulong,
16963        >(
16964            Some(
16965                RM_ListPush
16966                    as unsafe extern "C" fn(
16967                        *mut RedisModuleKey,
16968                        libc::c_int,
16969                        *mut robj,
16970                    ) -> libc::c_int,
16971            ),
16972        ) as *mut libc::c_void,
16973    );
16974    moduleRegisterApi(
16975        b"RedisModule_ListPop\0" as *const u8 as *const libc::c_char,
16976        core::mem::transmute::<
16977            Option::<
16978                unsafe extern "C" fn(*mut RedisModuleKey, libc::c_int) -> *mut robj,
16979            >,
16980            libc::c_ulong,
16981        >(
16982            Some(
16983                RM_ListPop
16984                    as unsafe extern "C" fn(
16985                        *mut RedisModuleKey,
16986                        libc::c_int,
16987                    ) -> *mut robj,
16988            ),
16989        ) as *mut libc::c_void,
16990    );
16991    moduleRegisterApi(
16992        b"RedisModule_ListGet\0" as *const u8 as *const libc::c_char,
16993        core::mem::transmute::<
16994            Option::<
16995                unsafe extern "C" fn(*mut RedisModuleKey, libc::c_long) -> *mut robj,
16996            >,
16997            libc::c_ulong,
16998        >(
16999            Some(
17000                RM_ListGet
17001                    as unsafe extern "C" fn(
17002                        *mut RedisModuleKey,
17003                        libc::c_long,
17004                    ) -> *mut robj,
17005            ),
17006        ) as *mut libc::c_void,
17007    );
17008    moduleRegisterApi(
17009        b"RedisModule_ListSet\0" as *const u8 as *const libc::c_char,
17010        core::mem::transmute::<
17011            Option::<
17012                unsafe extern "C" fn(
17013                    *mut RedisModuleKey,
17014                    libc::c_long,
17015                    *mut robj,
17016                ) -> libc::c_int,
17017            >,
17018            libc::c_ulong,
17019        >(
17020            Some(
17021                RM_ListSet
17022                    as unsafe extern "C" fn(
17023                        *mut RedisModuleKey,
17024                        libc::c_long,
17025                        *mut robj,
17026                    ) -> libc::c_int,
17027            ),
17028        ) as *mut libc::c_void,
17029    );
17030    moduleRegisterApi(
17031        b"RedisModule_ListInsert\0" as *const u8 as *const libc::c_char,
17032        core::mem::transmute::<
17033            Option::<
17034                unsafe extern "C" fn(
17035                    *mut RedisModuleKey,
17036                    libc::c_long,
17037                    *mut robj,
17038                ) -> libc::c_int,
17039            >,
17040            libc::c_ulong,
17041        >(
17042            Some(
17043                RM_ListInsert
17044                    as unsafe extern "C" fn(
17045                        *mut RedisModuleKey,
17046                        libc::c_long,
17047                        *mut robj,
17048                    ) -> libc::c_int,
17049            ),
17050        ) as *mut libc::c_void,
17051    );
17052    moduleRegisterApi(
17053        b"RedisModule_ListDelete\0" as *const u8 as *const libc::c_char,
17054        core::mem::transmute::<
17055            Option::<
17056                unsafe extern "C" fn(*mut RedisModuleKey, libc::c_long) -> libc::c_int,
17057            >,
17058            libc::c_ulong,
17059        >(
17060            Some(
17061                RM_ListDelete
17062                    as unsafe extern "C" fn(
17063                        *mut RedisModuleKey,
17064                        libc::c_long,
17065                    ) -> libc::c_int,
17066            ),
17067        ) as *mut libc::c_void,
17068    );
17069    moduleRegisterApi(
17070        b"RedisModule_StringToLongLong\0" as *const u8 as *const libc::c_char,
17071        core::mem::transmute::<
17072            Option::<
17073                unsafe extern "C" fn(*const robj, *mut libc::c_longlong) -> libc::c_int,
17074            >,
17075            libc::c_ulong,
17076        >(
17077            Some(
17078                RM_StringToLongLong
17079                    as unsafe extern "C" fn(
17080                        *const robj,
17081                        *mut libc::c_longlong,
17082                    ) -> libc::c_int,
17083            ),
17084        ) as *mut libc::c_void,
17085    );
17086    moduleRegisterApi(
17087        b"RedisModule_StringToULongLong\0" as *const u8 as *const libc::c_char,
17088        core::mem::transmute::<
17089            Option::<
17090                unsafe extern "C" fn(*const robj, *mut libc::c_ulonglong) -> libc::c_int,
17091            >,
17092            libc::c_ulong,
17093        >(
17094            Some(
17095                RM_StringToULongLong
17096                    as unsafe extern "C" fn(
17097                        *const robj,
17098                        *mut libc::c_ulonglong,
17099                    ) -> libc::c_int,
17100            ),
17101        ) as *mut libc::c_void,
17102    );
17103    moduleRegisterApi(
17104        b"RedisModule_StringToDouble\0" as *const u8 as *const libc::c_char,
17105        core::mem::transmute::<
17106            Option::<
17107                unsafe extern "C" fn(*const robj, *mut libc::c_double) -> libc::c_int,
17108            >,
17109            libc::c_ulong,
17110        >(
17111            Some(
17112                RM_StringToDouble
17113                    as unsafe extern "C" fn(
17114                        *const robj,
17115                        *mut libc::c_double,
17116                    ) -> libc::c_int,
17117            ),
17118        ) as *mut libc::c_void,
17119    );
17120    moduleRegisterApi(
17121        b"RedisModule_StringToLongDouble\0" as *const u8 as *const libc::c_char,
17122        core::mem::transmute::<
17123            Option::<unsafe extern "C" fn(*const robj, *mut f64) -> libc::c_int>,
17124            libc::c_ulong,
17125        >(
17126            Some(
17127                RM_StringToLongDouble
17128                    as unsafe extern "C" fn(*const robj, *mut f64) -> libc::c_int,
17129            ),
17130        ) as *mut libc::c_void,
17131    );
17132    moduleRegisterApi(
17133        b"RedisModule_StringToStreamID\0" as *const u8 as *const libc::c_char,
17134        core::mem::transmute::<
17135            Option::<
17136                unsafe extern "C" fn(
17137                    *const robj,
17138                    *mut RedisModuleStreamID,
17139                ) -> libc::c_int,
17140            >,
17141            libc::c_ulong,
17142        >(
17143            Some(
17144                RM_StringToStreamID
17145                    as unsafe extern "C" fn(
17146                        *const robj,
17147                        *mut RedisModuleStreamID,
17148                    ) -> libc::c_int,
17149            ),
17150        ) as *mut libc::c_void,
17151    );
17152    moduleRegisterApi(
17153        b"RedisModule_Call\0" as *const u8 as *const libc::c_char,
17154        core::mem::transmute::<
17155            Option::<
17156                unsafe extern "C" fn(
17157                    *mut RedisModuleCtx,
17158                    *const libc::c_char,
17159                    *const libc::c_char,
17160                    ...
17161                ) -> *mut RedisModuleCallReply,
17162            >,
17163            libc::c_ulong,
17164        >(
17165            Some(
17166                RM_Call
17167                    as unsafe extern "C" fn(
17168                        *mut RedisModuleCtx,
17169                        *const libc::c_char,
17170                        *const libc::c_char,
17171                        ...
17172                    ) -> *mut RedisModuleCallReply,
17173            ),
17174        ) as *mut libc::c_void,
17175    );
17176    moduleRegisterApi(
17177        b"RedisModule_CallReplyProto\0" as *const u8 as *const libc::c_char,
17178        core::mem::transmute::<
17179            Option::<
17180                unsafe extern "C" fn(
17181                    *mut RedisModuleCallReply,
17182                    *mut size_t,
17183                ) -> *const libc::c_char,
17184            >,
17185            libc::c_ulong,
17186        >(
17187            Some(
17188                RM_CallReplyProto
17189                    as unsafe extern "C" fn(
17190                        *mut RedisModuleCallReply,
17191                        *mut size_t,
17192                    ) -> *const libc::c_char,
17193            ),
17194        ) as *mut libc::c_void,
17195    );
17196    moduleRegisterApi(
17197        b"RedisModule_FreeCallReply\0" as *const u8 as *const libc::c_char,
17198        core::mem::transmute::<
17199            Option::<unsafe extern "C" fn(*mut RedisModuleCallReply) -> ()>,
17200            libc::c_ulong,
17201        >(
17202            Some(
17203                RM_FreeCallReply as unsafe extern "C" fn(*mut RedisModuleCallReply) -> (),
17204            ),
17205        ) as *mut libc::c_void,
17206    );
17207    moduleRegisterApi(
17208        b"RedisModule_CallReplyInteger\0" as *const u8 as *const libc::c_char,
17209        core::mem::transmute::<
17210            Option::<
17211                unsafe extern "C" fn(*mut RedisModuleCallReply) -> libc::c_longlong,
17212            >,
17213            libc::c_ulong,
17214        >(
17215            Some(
17216                RM_CallReplyInteger
17217                    as unsafe extern "C" fn(
17218                        *mut RedisModuleCallReply,
17219                    ) -> libc::c_longlong,
17220            ),
17221        ) as *mut libc::c_void,
17222    );
17223    moduleRegisterApi(
17224        b"RedisModule_CallReplyDouble\0" as *const u8 as *const libc::c_char,
17225        core::mem::transmute::<
17226            Option::<unsafe extern "C" fn(*mut RedisModuleCallReply) -> libc::c_double>,
17227            libc::c_ulong,
17228        >(
17229            Some(
17230                RM_CallReplyDouble
17231                    as unsafe extern "C" fn(*mut RedisModuleCallReply) -> libc::c_double,
17232            ),
17233        ) as *mut libc::c_void,
17234    );
17235    moduleRegisterApi(
17236        b"RedisModule_CallReplyBigNumber\0" as *const u8 as *const libc::c_char,
17237        core::mem::transmute::<
17238            Option::<
17239                unsafe extern "C" fn(
17240                    *mut RedisModuleCallReply,
17241                    *mut size_t,
17242                ) -> *const libc::c_char,
17243            >,
17244            libc::c_ulong,
17245        >(
17246            Some(
17247                RM_CallReplyBigNumber
17248                    as unsafe extern "C" fn(
17249                        *mut RedisModuleCallReply,
17250                        *mut size_t,
17251                    ) -> *const libc::c_char,
17252            ),
17253        ) as *mut libc::c_void,
17254    );
17255    moduleRegisterApi(
17256        b"RedisModule_CallReplyVerbatim\0" as *const u8 as *const libc::c_char,
17257        core::mem::transmute::<
17258            Option::<
17259                unsafe extern "C" fn(
17260                    *mut RedisModuleCallReply,
17261                    *mut size_t,
17262                    *mut *const libc::c_char,
17263                ) -> *const libc::c_char,
17264            >,
17265            libc::c_ulong,
17266        >(
17267            Some(
17268                RM_CallReplyVerbatim
17269                    as unsafe extern "C" fn(
17270                        *mut RedisModuleCallReply,
17271                        *mut size_t,
17272                        *mut *const libc::c_char,
17273                    ) -> *const libc::c_char,
17274            ),
17275        ) as *mut libc::c_void,
17276    );
17277    moduleRegisterApi(
17278        b"RedisModule_CallReplyBool\0" as *const u8 as *const libc::c_char,
17279        core::mem::transmute::<
17280            Option::<unsafe extern "C" fn(*mut RedisModuleCallReply) -> libc::c_int>,
17281            libc::c_ulong,
17282        >(
17283            Some(
17284                RM_CallReplyBool
17285                    as unsafe extern "C" fn(*mut RedisModuleCallReply) -> libc::c_int,
17286            ),
17287        ) as *mut libc::c_void,
17288    );
17289    moduleRegisterApi(
17290        b"RedisModule_CallReplySetElement\0" as *const u8 as *const libc::c_char,
17291        core::mem::transmute::<
17292            Option::<
17293                unsafe extern "C" fn(
17294                    *mut RedisModuleCallReply,
17295                    size_t,
17296                ) -> *mut RedisModuleCallReply,
17297            >,
17298            libc::c_ulong,
17299        >(
17300            Some(
17301                RM_CallReplySetElement
17302                    as unsafe extern "C" fn(
17303                        *mut RedisModuleCallReply,
17304                        size_t,
17305                    ) -> *mut RedisModuleCallReply,
17306            ),
17307        ) as *mut libc::c_void,
17308    );
17309    moduleRegisterApi(
17310        b"RedisModule_CallReplyMapElement\0" as *const u8 as *const libc::c_char,
17311        core::mem::transmute::<
17312            Option::<
17313                unsafe extern "C" fn(
17314                    *mut RedisModuleCallReply,
17315                    size_t,
17316                    *mut *mut RedisModuleCallReply,
17317                    *mut *mut RedisModuleCallReply,
17318                ) -> libc::c_int,
17319            >,
17320            libc::c_ulong,
17321        >(
17322            Some(
17323                RM_CallReplyMapElement
17324                    as unsafe extern "C" fn(
17325                        *mut RedisModuleCallReply,
17326                        size_t,
17327                        *mut *mut RedisModuleCallReply,
17328                        *mut *mut RedisModuleCallReply,
17329                    ) -> libc::c_int,
17330            ),
17331        ) as *mut libc::c_void,
17332    );
17333    moduleRegisterApi(
17334        b"RedisModule_CallReplyAttributeElement\0" as *const u8 as *const libc::c_char,
17335        core::mem::transmute::<
17336            Option::<
17337                unsafe extern "C" fn(
17338                    *mut RedisModuleCallReply,
17339                    size_t,
17340                    *mut *mut RedisModuleCallReply,
17341                    *mut *mut RedisModuleCallReply,
17342                ) -> libc::c_int,
17343            >,
17344            libc::c_ulong,
17345        >(
17346            Some(
17347                RM_CallReplyAttributeElement
17348                    as unsafe extern "C" fn(
17349                        *mut RedisModuleCallReply,
17350                        size_t,
17351                        *mut *mut RedisModuleCallReply,
17352                        *mut *mut RedisModuleCallReply,
17353                    ) -> libc::c_int,
17354            ),
17355        ) as *mut libc::c_void,
17356    );
17357    moduleRegisterApi(
17358        b"RedisModule_CallReplyAttribute\0" as *const u8 as *const libc::c_char,
17359        core::mem::transmute::<
17360            Option::<
17361                unsafe extern "C" fn(
17362                    *mut RedisModuleCallReply,
17363                ) -> *mut RedisModuleCallReply,
17364            >,
17365            libc::c_ulong,
17366        >(
17367            Some(
17368                RM_CallReplyAttribute
17369                    as unsafe extern "C" fn(
17370                        *mut RedisModuleCallReply,
17371                    ) -> *mut RedisModuleCallReply,
17372            ),
17373        ) as *mut libc::c_void,
17374    );
17375    moduleRegisterApi(
17376        b"RedisModule_CallReplyType\0" as *const u8 as *const libc::c_char,
17377        core::mem::transmute::<
17378            Option::<unsafe extern "C" fn(*mut RedisModuleCallReply) -> libc::c_int>,
17379            libc::c_ulong,
17380        >(
17381            Some(
17382                RM_CallReplyType
17383                    as unsafe extern "C" fn(*mut RedisModuleCallReply) -> libc::c_int,
17384            ),
17385        ) as *mut libc::c_void,
17386    );
17387    moduleRegisterApi(
17388        b"RedisModule_CallReplyLength\0" as *const u8 as *const libc::c_char,
17389        core::mem::transmute::<
17390            Option::<unsafe extern "C" fn(*mut RedisModuleCallReply) -> size_t>,
17391            libc::c_ulong,
17392        >(
17393            Some(
17394                RM_CallReplyLength
17395                    as unsafe extern "C" fn(*mut RedisModuleCallReply) -> size_t,
17396            ),
17397        ) as *mut libc::c_void,
17398    );
17399    moduleRegisterApi(
17400        b"RedisModule_CallReplyArrayElement\0" as *const u8 as *const libc::c_char,
17401        core::mem::transmute::<
17402            Option::<
17403                unsafe extern "C" fn(
17404                    *mut RedisModuleCallReply,
17405                    size_t,
17406                ) -> *mut RedisModuleCallReply,
17407            >,
17408            libc::c_ulong,
17409        >(
17410            Some(
17411                RM_CallReplyArrayElement
17412                    as unsafe extern "C" fn(
17413                        *mut RedisModuleCallReply,
17414                        size_t,
17415                    ) -> *mut RedisModuleCallReply,
17416            ),
17417        ) as *mut libc::c_void,
17418    );
17419    moduleRegisterApi(
17420        b"RedisModule_CallReplyStringPtr\0" as *const u8 as *const libc::c_char,
17421        core::mem::transmute::<
17422            Option::<
17423                unsafe extern "C" fn(
17424                    *mut RedisModuleCallReply,
17425                    *mut size_t,
17426                ) -> *const libc::c_char,
17427            >,
17428            libc::c_ulong,
17429        >(
17430            Some(
17431                RM_CallReplyStringPtr
17432                    as unsafe extern "C" fn(
17433                        *mut RedisModuleCallReply,
17434                        *mut size_t,
17435                    ) -> *const libc::c_char,
17436            ),
17437        ) as *mut libc::c_void,
17438    );
17439    moduleRegisterApi(
17440        b"RedisModule_CreateStringFromCallReply\0" as *const u8 as *const libc::c_char,
17441        core::mem::transmute::<
17442            Option::<unsafe extern "C" fn(*mut RedisModuleCallReply) -> *mut robj>,
17443            libc::c_ulong,
17444        >(
17445            Some(
17446                RM_CreateStringFromCallReply
17447                    as unsafe extern "C" fn(*mut RedisModuleCallReply) -> *mut robj,
17448            ),
17449        ) as *mut libc::c_void,
17450    );
17451    moduleRegisterApi(
17452        b"RedisModule_CreateString\0" as *const u8 as *const libc::c_char,
17453        core::mem::transmute::<
17454            Option::<
17455                unsafe extern "C" fn(
17456                    *mut RedisModuleCtx,
17457                    *const libc::c_char,
17458                    size_t,
17459                ) -> *mut robj,
17460            >,
17461            libc::c_ulong,
17462        >(
17463            Some(
17464                RM_CreateString
17465                    as unsafe extern "C" fn(
17466                        *mut RedisModuleCtx,
17467                        *const libc::c_char,
17468                        size_t,
17469                    ) -> *mut robj,
17470            ),
17471        ) as *mut libc::c_void,
17472    );
17473    moduleRegisterApi(
17474        b"RedisModule_CreateStringFromLongLong\0" as *const u8 as *const libc::c_char,
17475        core::mem::transmute::<
17476            Option::<
17477                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_longlong) -> *mut robj,
17478            >,
17479            libc::c_ulong,
17480        >(
17481            Some(
17482                RM_CreateStringFromLongLong
17483                    as unsafe extern "C" fn(
17484                        *mut RedisModuleCtx,
17485                        libc::c_longlong,
17486                    ) -> *mut robj,
17487            ),
17488        ) as *mut libc::c_void,
17489    );
17490    moduleRegisterApi(
17491        b"RedisModule_CreateStringFromULongLong\0" as *const u8 as *const libc::c_char,
17492        core::mem::transmute::<
17493            Option::<
17494                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_ulonglong) -> *mut robj,
17495            >,
17496            libc::c_ulong,
17497        >(
17498            Some(
17499                RM_CreateStringFromULongLong
17500                    as unsafe extern "C" fn(
17501                        *mut RedisModuleCtx,
17502                        libc::c_ulonglong,
17503                    ) -> *mut robj,
17504            ),
17505        ) as *mut libc::c_void,
17506    );
17507    moduleRegisterApi(
17508        b"RedisModule_CreateStringFromDouble\0" as *const u8 as *const libc::c_char,
17509        core::mem::transmute::<
17510            Option::<
17511                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_double) -> *mut robj,
17512            >,
17513            libc::c_ulong,
17514        >(
17515            Some(
17516                RM_CreateStringFromDouble
17517                    as unsafe extern "C" fn(
17518                        *mut RedisModuleCtx,
17519                        libc::c_double,
17520                    ) -> *mut robj,
17521            ),
17522        ) as *mut libc::c_void,
17523    );
17524    moduleRegisterApi(
17525        b"RedisModule_CreateStringFromLongDouble\0" as *const u8 as *const libc::c_char,
17526        core::mem::transmute::<
17527            Option::<
17528                unsafe extern "C" fn(
17529                    *mut RedisModuleCtx,
17530                    f64,
17531                    libc::c_int,
17532                ) -> *mut robj,
17533            >,
17534            libc::c_ulong,
17535        >(
17536            Some(
17537                RM_CreateStringFromLongDouble
17538                    as unsafe extern "C" fn(
17539                        *mut RedisModuleCtx,
17540                        f64,
17541                        libc::c_int,
17542                    ) -> *mut robj,
17543            ),
17544        ) as *mut libc::c_void,
17545    );
17546    moduleRegisterApi(
17547        b"RedisModule_CreateStringFromString\0" as *const u8 as *const libc::c_char,
17548        core::mem::transmute::<
17549            Option::<
17550                unsafe extern "C" fn(*mut RedisModuleCtx, *const robj) -> *mut robj,
17551            >,
17552            libc::c_ulong,
17553        >(
17554            Some(
17555                RM_CreateStringFromString
17556                    as unsafe extern "C" fn(
17557                        *mut RedisModuleCtx,
17558                        *const robj,
17559                    ) -> *mut robj,
17560            ),
17561        ) as *mut libc::c_void,
17562    );
17563    moduleRegisterApi(
17564        b"RedisModule_CreateStringFromStreamID\0" as *const u8 as *const libc::c_char,
17565        core::mem::transmute::<
17566            Option::<
17567                unsafe extern "C" fn(
17568                    *mut RedisModuleCtx,
17569                    *const RedisModuleStreamID,
17570                ) -> *mut robj,
17571            >,
17572            libc::c_ulong,
17573        >(
17574            Some(
17575                RM_CreateStringFromStreamID
17576                    as unsafe extern "C" fn(
17577                        *mut RedisModuleCtx,
17578                        *const RedisModuleStreamID,
17579                    ) -> *mut robj,
17580            ),
17581        ) as *mut libc::c_void,
17582    );
17583    moduleRegisterApi(
17584        b"RedisModule_CreateStringPrintf\0" as *const u8 as *const libc::c_char,
17585        core::mem::transmute::<
17586            Option::<
17587                unsafe extern "C" fn(
17588                    *mut RedisModuleCtx,
17589                    *const libc::c_char,
17590                    ...
17591                ) -> *mut robj,
17592            >,
17593            libc::c_ulong,
17594        >(
17595            Some(
17596                RM_CreateStringPrintf
17597                    as unsafe extern "C" fn(
17598                        *mut RedisModuleCtx,
17599                        *const libc::c_char,
17600                        ...
17601                    ) -> *mut robj,
17602            ),
17603        ) as *mut libc::c_void,
17604    );
17605    moduleRegisterApi(
17606        b"RedisModule_FreeString\0" as *const u8 as *const libc::c_char,
17607        core::mem::transmute::<
17608            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> ()>,
17609            libc::c_ulong,
17610        >(
17611            Some(
17612                RM_FreeString
17613                    as unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> (),
17614            ),
17615        ) as *mut libc::c_void,
17616    );
17617    moduleRegisterApi(
17618        b"RedisModule_StringPtrLen\0" as *const u8 as *const libc::c_char,
17619        core::mem::transmute::<
17620            Option::<
17621                unsafe extern "C" fn(*const robj, *mut size_t) -> *const libc::c_char,
17622            >,
17623            libc::c_ulong,
17624        >(
17625            Some(
17626                RM_StringPtrLen
17627                    as unsafe extern "C" fn(
17628                        *const robj,
17629                        *mut size_t,
17630                    ) -> *const libc::c_char,
17631            ),
17632        ) as *mut libc::c_void,
17633    );
17634    moduleRegisterApi(
17635        b"RedisModule_AutoMemory\0" as *const u8 as *const libc::c_char,
17636        core::mem::transmute::<
17637            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> ()>,
17638            libc::c_ulong,
17639        >(Some(RM_AutoMemory as unsafe extern "C" fn(*mut RedisModuleCtx) -> ()))
17640            as *mut libc::c_void,
17641    );
17642    moduleRegisterApi(
17643        b"RedisModule_Replicate\0" as *const u8 as *const libc::c_char,
17644        core::mem::transmute::<
17645            Option::<
17646                unsafe extern "C" fn(
17647                    *mut RedisModuleCtx,
17648                    *const libc::c_char,
17649                    *const libc::c_char,
17650                    ...
17651                ) -> libc::c_int,
17652            >,
17653            libc::c_ulong,
17654        >(
17655            Some(
17656                RM_Replicate
17657                    as unsafe extern "C" fn(
17658                        *mut RedisModuleCtx,
17659                        *const libc::c_char,
17660                        *const libc::c_char,
17661                        ...
17662                    ) -> libc::c_int,
17663            ),
17664        ) as *mut libc::c_void,
17665    );
17666    moduleRegisterApi(
17667        b"RedisModule_ReplicateVerbatim\0" as *const u8 as *const libc::c_char,
17668        core::mem::transmute::<
17669            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
17670            libc::c_ulong,
17671        >(
17672            Some(
17673                RM_ReplicateVerbatim
17674                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
17675            ),
17676        ) as *mut libc::c_void,
17677    );
17678    moduleRegisterApi(
17679        b"RedisModule_DeleteKey\0" as *const u8 as *const libc::c_char,
17680        core::mem::transmute::<
17681            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
17682            libc::c_ulong,
17683        >(Some(RM_DeleteKey as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int))
17684            as *mut libc::c_void,
17685    );
17686    moduleRegisterApi(
17687        b"RedisModule_UnlinkKey\0" as *const u8 as *const libc::c_char,
17688        core::mem::transmute::<
17689            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
17690            libc::c_ulong,
17691        >(Some(RM_UnlinkKey as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int))
17692            as *mut libc::c_void,
17693    );
17694    moduleRegisterApi(
17695        b"RedisModule_StringSet\0" as *const u8 as *const libc::c_char,
17696        core::mem::transmute::<
17697            Option::<
17698                unsafe extern "C" fn(*mut RedisModuleKey, *mut robj) -> libc::c_int,
17699            >,
17700            libc::c_ulong,
17701        >(
17702            Some(
17703                RM_StringSet
17704                    as unsafe extern "C" fn(
17705                        *mut RedisModuleKey,
17706                        *mut robj,
17707                    ) -> libc::c_int,
17708            ),
17709        ) as *mut libc::c_void,
17710    );
17711    moduleRegisterApi(
17712        b"RedisModule_StringDMA\0" as *const u8 as *const libc::c_char,
17713        core::mem::transmute::<
17714            Option::<
17715                unsafe extern "C" fn(
17716                    *mut RedisModuleKey,
17717                    *mut size_t,
17718                    libc::c_int,
17719                ) -> *mut libc::c_char,
17720            >,
17721            libc::c_ulong,
17722        >(
17723            Some(
17724                RM_StringDMA
17725                    as unsafe extern "C" fn(
17726                        *mut RedisModuleKey,
17727                        *mut size_t,
17728                        libc::c_int,
17729                    ) -> *mut libc::c_char,
17730            ),
17731        ) as *mut libc::c_void,
17732    );
17733    moduleRegisterApi(
17734        b"RedisModule_StringTruncate\0" as *const u8 as *const libc::c_char,
17735        core::mem::transmute::<
17736            Option::<unsafe extern "C" fn(*mut RedisModuleKey, size_t) -> libc::c_int>,
17737            libc::c_ulong,
17738        >(
17739            Some(
17740                RM_StringTruncate
17741                    as unsafe extern "C" fn(*mut RedisModuleKey, size_t) -> libc::c_int,
17742            ),
17743        ) as *mut libc::c_void,
17744    );
17745    moduleRegisterApi(
17746        b"RedisModule_SetExpire\0" as *const u8 as *const libc::c_char,
17747        core::mem::transmute::<
17748            Option::<unsafe extern "C" fn(*mut RedisModuleKey, mstime_t) -> libc::c_int>,
17749            libc::c_ulong,
17750        >(
17751            Some(
17752                RM_SetExpire
17753                    as unsafe extern "C" fn(*mut RedisModuleKey, mstime_t) -> libc::c_int,
17754            ),
17755        ) as *mut libc::c_void,
17756    );
17757    moduleRegisterApi(
17758        b"RedisModule_GetExpire\0" as *const u8 as *const libc::c_char,
17759        core::mem::transmute::<
17760            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> mstime_t>,
17761            libc::c_ulong,
17762        >(Some(RM_GetExpire as unsafe extern "C" fn(*mut RedisModuleKey) -> mstime_t))
17763            as *mut libc::c_void,
17764    );
17765    moduleRegisterApi(
17766        b"RedisModule_SetAbsExpire\0" as *const u8 as *const libc::c_char,
17767        core::mem::transmute::<
17768            Option::<unsafe extern "C" fn(*mut RedisModuleKey, mstime_t) -> libc::c_int>,
17769            libc::c_ulong,
17770        >(
17771            Some(
17772                RM_SetAbsExpire
17773                    as unsafe extern "C" fn(*mut RedisModuleKey, mstime_t) -> libc::c_int,
17774            ),
17775        ) as *mut libc::c_void,
17776    );
17777    moduleRegisterApi(
17778        b"RedisModule_GetAbsExpire\0" as *const u8 as *const libc::c_char,
17779        core::mem::transmute::<
17780            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> mstime_t>,
17781            libc::c_ulong,
17782        >(Some(RM_GetAbsExpire as unsafe extern "C" fn(*mut RedisModuleKey) -> mstime_t))
17783            as *mut libc::c_void,
17784    );
17785    moduleRegisterApi(
17786        b"RedisModule_ResetDataset\0" as *const u8 as *const libc::c_char,
17787        core::mem::transmute::<
17788            Option::<unsafe extern "C" fn(libc::c_int, libc::c_int) -> ()>,
17789            libc::c_ulong,
17790        >(Some(RM_ResetDataset as unsafe extern "C" fn(libc::c_int, libc::c_int) -> ()))
17791            as *mut libc::c_void,
17792    );
17793    moduleRegisterApi(
17794        b"RedisModule_DbSize\0" as *const u8 as *const libc::c_char,
17795        core::mem::transmute::<
17796            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_ulonglong>,
17797            libc::c_ulong,
17798        >(
17799            Some(
17800                RM_DbSize
17801                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_ulonglong,
17802            ),
17803        ) as *mut libc::c_void,
17804    );
17805    moduleRegisterApi(
17806        b"RedisModule_RandomKey\0" as *const u8 as *const libc::c_char,
17807        core::mem::transmute::<
17808            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut robj>,
17809            libc::c_ulong,
17810        >(Some(RM_RandomKey as unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut robj))
17811            as *mut libc::c_void,
17812    );
17813    moduleRegisterApi(
17814        b"RedisModule_ZsetAdd\0" as *const u8 as *const libc::c_char,
17815        core::mem::transmute::<
17816            Option::<
17817                unsafe extern "C" fn(
17818                    *mut RedisModuleKey,
17819                    libc::c_double,
17820                    *mut robj,
17821                    *mut libc::c_int,
17822                ) -> libc::c_int,
17823            >,
17824            libc::c_ulong,
17825        >(
17826            Some(
17827                RM_ZsetAdd
17828                    as unsafe extern "C" fn(
17829                        *mut RedisModuleKey,
17830                        libc::c_double,
17831                        *mut robj,
17832                        *mut libc::c_int,
17833                    ) -> libc::c_int,
17834            ),
17835        ) as *mut libc::c_void,
17836    );
17837    moduleRegisterApi(
17838        b"RedisModule_ZsetIncrby\0" as *const u8 as *const libc::c_char,
17839        core::mem::transmute::<
17840            Option::<
17841                unsafe extern "C" fn(
17842                    *mut RedisModuleKey,
17843                    libc::c_double,
17844                    *mut robj,
17845                    *mut libc::c_int,
17846                    *mut libc::c_double,
17847                ) -> libc::c_int,
17848            >,
17849            libc::c_ulong,
17850        >(
17851            Some(
17852                RM_ZsetIncrby
17853                    as unsafe extern "C" fn(
17854                        *mut RedisModuleKey,
17855                        libc::c_double,
17856                        *mut robj,
17857                        *mut libc::c_int,
17858                        *mut libc::c_double,
17859                    ) -> libc::c_int,
17860            ),
17861        ) as *mut libc::c_void,
17862    );
17863    moduleRegisterApi(
17864        b"RedisModule_ZsetScore\0" as *const u8 as *const libc::c_char,
17865        core::mem::transmute::<
17866            Option::<
17867                unsafe extern "C" fn(
17868                    *mut RedisModuleKey,
17869                    *mut robj,
17870                    *mut libc::c_double,
17871                ) -> libc::c_int,
17872            >,
17873            libc::c_ulong,
17874        >(
17875            Some(
17876                RM_ZsetScore
17877                    as unsafe extern "C" fn(
17878                        *mut RedisModuleKey,
17879                        *mut robj,
17880                        *mut libc::c_double,
17881                    ) -> libc::c_int,
17882            ),
17883        ) as *mut libc::c_void,
17884    );
17885    moduleRegisterApi(
17886        b"RedisModule_ZsetRem\0" as *const u8 as *const libc::c_char,
17887        core::mem::transmute::<
17888            Option::<
17889                unsafe extern "C" fn(
17890                    *mut RedisModuleKey,
17891                    *mut robj,
17892                    *mut libc::c_int,
17893                ) -> libc::c_int,
17894            >,
17895            libc::c_ulong,
17896        >(
17897            Some(
17898                RM_ZsetRem
17899                    as unsafe extern "C" fn(
17900                        *mut RedisModuleKey,
17901                        *mut robj,
17902                        *mut libc::c_int,
17903                    ) -> libc::c_int,
17904            ),
17905        ) as *mut libc::c_void,
17906    );
17907    moduleRegisterApi(
17908        b"RedisModule_ZsetRangeStop\0" as *const u8 as *const libc::c_char,
17909        core::mem::transmute::<
17910            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> ()>,
17911            libc::c_ulong,
17912        >(Some(RM_ZsetRangeStop as unsafe extern "C" fn(*mut RedisModuleKey) -> ()))
17913            as *mut libc::c_void,
17914    );
17915    moduleRegisterApi(
17916        b"RedisModule_ZsetFirstInScoreRange\0" as *const u8 as *const libc::c_char,
17917        core::mem::transmute::<
17918            Option::<
17919                unsafe extern "C" fn(
17920                    *mut RedisModuleKey,
17921                    libc::c_double,
17922                    libc::c_double,
17923                    libc::c_int,
17924                    libc::c_int,
17925                ) -> libc::c_int,
17926            >,
17927            libc::c_ulong,
17928        >(
17929            Some(
17930                RM_ZsetFirstInScoreRange
17931                    as unsafe extern "C" fn(
17932                        *mut RedisModuleKey,
17933                        libc::c_double,
17934                        libc::c_double,
17935                        libc::c_int,
17936                        libc::c_int,
17937                    ) -> libc::c_int,
17938            ),
17939        ) as *mut libc::c_void,
17940    );
17941    moduleRegisterApi(
17942        b"RedisModule_ZsetLastInScoreRange\0" as *const u8 as *const libc::c_char,
17943        core::mem::transmute::<
17944            Option::<
17945                unsafe extern "C" fn(
17946                    *mut RedisModuleKey,
17947                    libc::c_double,
17948                    libc::c_double,
17949                    libc::c_int,
17950                    libc::c_int,
17951                ) -> libc::c_int,
17952            >,
17953            libc::c_ulong,
17954        >(
17955            Some(
17956                RM_ZsetLastInScoreRange
17957                    as unsafe extern "C" fn(
17958                        *mut RedisModuleKey,
17959                        libc::c_double,
17960                        libc::c_double,
17961                        libc::c_int,
17962                        libc::c_int,
17963                    ) -> libc::c_int,
17964            ),
17965        ) as *mut libc::c_void,
17966    );
17967    moduleRegisterApi(
17968        b"RedisModule_ZsetFirstInLexRange\0" as *const u8 as *const libc::c_char,
17969        core::mem::transmute::<
17970            Option::<
17971                unsafe extern "C" fn(
17972                    *mut RedisModuleKey,
17973                    *mut robj,
17974                    *mut robj,
17975                ) -> libc::c_int,
17976            >,
17977            libc::c_ulong,
17978        >(
17979            Some(
17980                RM_ZsetFirstInLexRange
17981                    as unsafe extern "C" fn(
17982                        *mut RedisModuleKey,
17983                        *mut robj,
17984                        *mut robj,
17985                    ) -> libc::c_int,
17986            ),
17987        ) as *mut libc::c_void,
17988    );
17989    moduleRegisterApi(
17990        b"RedisModule_ZsetLastInLexRange\0" as *const u8 as *const libc::c_char,
17991        core::mem::transmute::<
17992            Option::<
17993                unsafe extern "C" fn(
17994                    *mut RedisModuleKey,
17995                    *mut robj,
17996                    *mut robj,
17997                ) -> libc::c_int,
17998            >,
17999            libc::c_ulong,
18000        >(
18001            Some(
18002                RM_ZsetLastInLexRange
18003                    as unsafe extern "C" fn(
18004                        *mut RedisModuleKey,
18005                        *mut robj,
18006                        *mut robj,
18007                    ) -> libc::c_int,
18008            ),
18009        ) as *mut libc::c_void,
18010    );
18011    moduleRegisterApi(
18012        b"RedisModule_ZsetRangeCurrentElement\0" as *const u8 as *const libc::c_char,
18013        core::mem::transmute::<
18014            Option::<
18015                unsafe extern "C" fn(
18016                    *mut RedisModuleKey,
18017                    *mut libc::c_double,
18018                ) -> *mut robj,
18019            >,
18020            libc::c_ulong,
18021        >(
18022            Some(
18023                RM_ZsetRangeCurrentElement
18024                    as unsafe extern "C" fn(
18025                        *mut RedisModuleKey,
18026                        *mut libc::c_double,
18027                    ) -> *mut robj,
18028            ),
18029        ) as *mut libc::c_void,
18030    );
18031    moduleRegisterApi(
18032        b"RedisModule_ZsetRangeNext\0" as *const u8 as *const libc::c_char,
18033        core::mem::transmute::<
18034            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
18035            libc::c_ulong,
18036        >(
18037            Some(
18038                RM_ZsetRangeNext
18039                    as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int,
18040            ),
18041        ) as *mut libc::c_void,
18042    );
18043    moduleRegisterApi(
18044        b"RedisModule_ZsetRangePrev\0" as *const u8 as *const libc::c_char,
18045        core::mem::transmute::<
18046            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
18047            libc::c_ulong,
18048        >(
18049            Some(
18050                RM_ZsetRangePrev
18051                    as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int,
18052            ),
18053        ) as *mut libc::c_void,
18054    );
18055    moduleRegisterApi(
18056        b"RedisModule_ZsetRangeEndReached\0" as *const u8 as *const libc::c_char,
18057        core::mem::transmute::<
18058            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
18059            libc::c_ulong,
18060        >(
18061            Some(
18062                RM_ZsetRangeEndReached
18063                    as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int,
18064            ),
18065        ) as *mut libc::c_void,
18066    );
18067    moduleRegisterApi(
18068        b"RedisModule_HashSet\0" as *const u8 as *const libc::c_char,
18069        core::mem::transmute::<
18070            Option::<
18071                unsafe extern "C" fn(
18072                    *mut RedisModuleKey,
18073                    libc::c_int,
18074                    ...
18075                ) -> libc::c_int,
18076            >,
18077            libc::c_ulong,
18078        >(
18079            Some(
18080                RM_HashSet
18081                    as unsafe extern "C" fn(
18082                        *mut RedisModuleKey,
18083                        libc::c_int,
18084                        ...
18085                    ) -> libc::c_int,
18086            ),
18087        ) as *mut libc::c_void,
18088    );
18089    moduleRegisterApi(
18090        b"RedisModule_HashGet\0" as *const u8 as *const libc::c_char,
18091        core::mem::transmute::<
18092            Option::<
18093                unsafe extern "C" fn(
18094                    *mut RedisModuleKey,
18095                    libc::c_int,
18096                    ...
18097                ) -> libc::c_int,
18098            >,
18099            libc::c_ulong,
18100        >(
18101            Some(
18102                RM_HashGet
18103                    as unsafe extern "C" fn(
18104                        *mut RedisModuleKey,
18105                        libc::c_int,
18106                        ...
18107                    ) -> libc::c_int,
18108            ),
18109        ) as *mut libc::c_void,
18110    );
18111    moduleRegisterApi(
18112        b"RedisModule_StreamAdd\0" as *const u8 as *const libc::c_char,
18113        core::mem::transmute::<
18114            Option::<
18115                unsafe extern "C" fn(
18116                    *mut RedisModuleKey,
18117                    libc::c_int,
18118                    *mut RedisModuleStreamID,
18119                    *mut *mut robj,
18120                    libc::c_long,
18121                ) -> libc::c_int,
18122            >,
18123            libc::c_ulong,
18124        >(
18125            Some(
18126                RM_StreamAdd
18127                    as unsafe extern "C" fn(
18128                        *mut RedisModuleKey,
18129                        libc::c_int,
18130                        *mut RedisModuleStreamID,
18131                        *mut *mut robj,
18132                        libc::c_long,
18133                    ) -> libc::c_int,
18134            ),
18135        ) as *mut libc::c_void,
18136    );
18137    moduleRegisterApi(
18138        b"RedisModule_StreamDelete\0" as *const u8 as *const libc::c_char,
18139        core::mem::transmute::<
18140            Option::<
18141                unsafe extern "C" fn(
18142                    *mut RedisModuleKey,
18143                    *mut RedisModuleStreamID,
18144                ) -> libc::c_int,
18145            >,
18146            libc::c_ulong,
18147        >(
18148            Some(
18149                RM_StreamDelete
18150                    as unsafe extern "C" fn(
18151                        *mut RedisModuleKey,
18152                        *mut RedisModuleStreamID,
18153                    ) -> libc::c_int,
18154            ),
18155        ) as *mut libc::c_void,
18156    );
18157    moduleRegisterApi(
18158        b"RedisModule_StreamIteratorStart\0" as *const u8 as *const libc::c_char,
18159        core::mem::transmute::<
18160            Option::<
18161                unsafe extern "C" fn(
18162                    *mut RedisModuleKey,
18163                    libc::c_int,
18164                    *mut RedisModuleStreamID,
18165                    *mut RedisModuleStreamID,
18166                ) -> libc::c_int,
18167            >,
18168            libc::c_ulong,
18169        >(
18170            Some(
18171                RM_StreamIteratorStart
18172                    as unsafe extern "C" fn(
18173                        *mut RedisModuleKey,
18174                        libc::c_int,
18175                        *mut RedisModuleStreamID,
18176                        *mut RedisModuleStreamID,
18177                    ) -> libc::c_int,
18178            ),
18179        ) as *mut libc::c_void,
18180    );
18181    moduleRegisterApi(
18182        b"RedisModule_StreamIteratorStop\0" as *const u8 as *const libc::c_char,
18183        core::mem::transmute::<
18184            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
18185            libc::c_ulong,
18186        >(
18187            Some(
18188                RM_StreamIteratorStop
18189                    as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int,
18190            ),
18191        ) as *mut libc::c_void,
18192    );
18193    moduleRegisterApi(
18194        b"RedisModule_StreamIteratorNextID\0" as *const u8 as *const libc::c_char,
18195        core::mem::transmute::<
18196            Option::<
18197                unsafe extern "C" fn(
18198                    *mut RedisModuleKey,
18199                    *mut RedisModuleStreamID,
18200                    *mut libc::c_long,
18201                ) -> libc::c_int,
18202            >,
18203            libc::c_ulong,
18204        >(
18205            Some(
18206                RM_StreamIteratorNextID
18207                    as unsafe extern "C" fn(
18208                        *mut RedisModuleKey,
18209                        *mut RedisModuleStreamID,
18210                        *mut libc::c_long,
18211                    ) -> libc::c_int,
18212            ),
18213        ) as *mut libc::c_void,
18214    );
18215    moduleRegisterApi(
18216        b"RedisModule_StreamIteratorNextField\0" as *const u8 as *const libc::c_char,
18217        core::mem::transmute::<
18218            Option::<
18219                unsafe extern "C" fn(
18220                    *mut RedisModuleKey,
18221                    *mut *mut robj,
18222                    *mut *mut robj,
18223                ) -> libc::c_int,
18224            >,
18225            libc::c_ulong,
18226        >(
18227            Some(
18228                RM_StreamIteratorNextField
18229                    as unsafe extern "C" fn(
18230                        *mut RedisModuleKey,
18231                        *mut *mut robj,
18232                        *mut *mut robj,
18233                    ) -> libc::c_int,
18234            ),
18235        ) as *mut libc::c_void,
18236    );
18237    moduleRegisterApi(
18238        b"RedisModule_StreamIteratorDelete\0" as *const u8 as *const libc::c_char,
18239        core::mem::transmute::<
18240            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
18241            libc::c_ulong,
18242        >(
18243            Some(
18244                RM_StreamIteratorDelete
18245                    as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int,
18246            ),
18247        ) as *mut libc::c_void,
18248    );
18249    moduleRegisterApi(
18250        b"RedisModule_StreamTrimByLength\0" as *const u8 as *const libc::c_char,
18251        core::mem::transmute::<
18252            Option::<
18253                unsafe extern "C" fn(
18254                    *mut RedisModuleKey,
18255                    libc::c_int,
18256                    libc::c_longlong,
18257                ) -> libc::c_longlong,
18258            >,
18259            libc::c_ulong,
18260        >(
18261            Some(
18262                RM_StreamTrimByLength
18263                    as unsafe extern "C" fn(
18264                        *mut RedisModuleKey,
18265                        libc::c_int,
18266                        libc::c_longlong,
18267                    ) -> libc::c_longlong,
18268            ),
18269        ) as *mut libc::c_void,
18270    );
18271    moduleRegisterApi(
18272        b"RedisModule_StreamTrimByID\0" as *const u8 as *const libc::c_char,
18273        core::mem::transmute::<
18274            Option::<
18275                unsafe extern "C" fn(
18276                    *mut RedisModuleKey,
18277                    libc::c_int,
18278                    *mut RedisModuleStreamID,
18279                ) -> libc::c_longlong,
18280            >,
18281            libc::c_ulong,
18282        >(
18283            Some(
18284                RM_StreamTrimByID
18285                    as unsafe extern "C" fn(
18286                        *mut RedisModuleKey,
18287                        libc::c_int,
18288                        *mut RedisModuleStreamID,
18289                    ) -> libc::c_longlong,
18290            ),
18291        ) as *mut libc::c_void,
18292    );
18293    moduleRegisterApi(
18294        b"RedisModule_IsKeysPositionRequest\0" as *const u8 as *const libc::c_char,
18295        core::mem::transmute::<
18296            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
18297            libc::c_ulong,
18298        >(
18299            Some(
18300                RM_IsKeysPositionRequest
18301                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
18302            ),
18303        ) as *mut libc::c_void,
18304    );
18305    moduleRegisterApi(
18306        b"RedisModule_KeyAtPos\0" as *const u8 as *const libc::c_char,
18307        core::mem::transmute::<
18308            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int) -> ()>,
18309            libc::c_ulong,
18310        >(
18311            Some(
18312                RM_KeyAtPos
18313                    as unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int) -> (),
18314            ),
18315        ) as *mut libc::c_void,
18316    );
18317    moduleRegisterApi(
18318        b"RedisModule_KeyAtPosWithFlags\0" as *const u8 as *const libc::c_char,
18319        core::mem::transmute::<
18320            Option::<
18321                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int, libc::c_int) -> (),
18322            >,
18323            libc::c_ulong,
18324        >(
18325            Some(
18326                RM_KeyAtPosWithFlags
18327                    as unsafe extern "C" fn(
18328                        *mut RedisModuleCtx,
18329                        libc::c_int,
18330                        libc::c_int,
18331                    ) -> (),
18332            ),
18333        ) as *mut libc::c_void,
18334    );
18335    moduleRegisterApi(
18336        b"RedisModule_IsChannelsPositionRequest\0" as *const u8 as *const libc::c_char,
18337        core::mem::transmute::<
18338            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
18339            libc::c_ulong,
18340        >(
18341            Some(
18342                RM_IsChannelsPositionRequest
18343                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
18344            ),
18345        ) as *mut libc::c_void,
18346    );
18347    moduleRegisterApi(
18348        b"RedisModule_ChannelAtPosWithFlags\0" as *const u8 as *const libc::c_char,
18349        core::mem::transmute::<
18350            Option::<
18351                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int, libc::c_int) -> (),
18352            >,
18353            libc::c_ulong,
18354        >(
18355            Some(
18356                RM_ChannelAtPosWithFlags
18357                    as unsafe extern "C" fn(
18358                        *mut RedisModuleCtx,
18359                        libc::c_int,
18360                        libc::c_int,
18361                    ) -> (),
18362            ),
18363        ) as *mut libc::c_void,
18364    );
18365    moduleRegisterApi(
18366        b"RedisModule_GetClientId\0" as *const u8 as *const libc::c_char,
18367        core::mem::transmute::<
18368            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_ulonglong>,
18369            libc::c_ulong,
18370        >(
18371            Some(
18372                RM_GetClientId
18373                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_ulonglong,
18374            ),
18375        ) as *mut libc::c_void,
18376    );
18377    moduleRegisterApi(
18378        b"RedisModule_GetClientUserNameById\0" as *const u8 as *const libc::c_char,
18379        core::mem::transmute::<
18380            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> *mut robj>,
18381            libc::c_ulong,
18382        >(
18383            Some(
18384                RM_GetClientUserNameById
18385                    as unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> *mut robj,
18386            ),
18387        ) as *mut libc::c_void,
18388    );
18389    moduleRegisterApi(
18390        b"RedisModule_GetContextFlags\0" as *const u8 as *const libc::c_char,
18391        core::mem::transmute::<
18392            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
18393            libc::c_ulong,
18394        >(
18395            Some(
18396                RM_GetContextFlags
18397                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
18398            ),
18399        ) as *mut libc::c_void,
18400    );
18401    moduleRegisterApi(
18402        b"RedisModule_AvoidReplicaTraffic\0" as *const u8 as *const libc::c_char,
18403        core::mem::transmute::<
18404            Option::<unsafe extern "C" fn() -> libc::c_int>,
18405            libc::c_ulong,
18406        >(
18407            Some(
18408                core::mem::transmute::<
18409                    unsafe extern "C" fn() -> libc::c_int,
18410                    unsafe extern "C" fn() -> libc::c_int,
18411                >(RM_AvoidReplicaTraffic),
18412            ),
18413        ) as *mut libc::c_void,
18414    );
18415    moduleRegisterApi(
18416        b"RedisModule_PoolAlloc\0" as *const u8 as *const libc::c_char,
18417        core::mem::transmute::<
18418            Option::<
18419                unsafe extern "C" fn(*mut RedisModuleCtx, size_t) -> *mut libc::c_void,
18420            >,
18421            libc::c_ulong,
18422        >(
18423            Some(
18424                RM_PoolAlloc
18425                    as unsafe extern "C" fn(
18426                        *mut RedisModuleCtx,
18427                        size_t,
18428                    ) -> *mut libc::c_void,
18429            ),
18430        ) as *mut libc::c_void,
18431    );
18432    moduleRegisterApi(
18433        b"RedisModule_CreateDataType\0" as *const u8 as *const libc::c_char,
18434        core::mem::transmute::<
18435            Option::<
18436                unsafe extern "C" fn(
18437                    *mut RedisModuleCtx,
18438                    *const libc::c_char,
18439                    libc::c_int,
18440                    *mut libc::c_void,
18441                ) -> *mut moduleType,
18442            >,
18443            libc::c_ulong,
18444        >(
18445            Some(
18446                RM_CreateDataType
18447                    as unsafe extern "C" fn(
18448                        *mut RedisModuleCtx,
18449                        *const libc::c_char,
18450                        libc::c_int,
18451                        *mut libc::c_void,
18452                    ) -> *mut moduleType,
18453            ),
18454        ) as *mut libc::c_void,
18455    );
18456    moduleRegisterApi(
18457        b"RedisModule_ModuleTypeSetValue\0" as *const u8 as *const libc::c_char,
18458        core::mem::transmute::<
18459            Option::<
18460                unsafe extern "C" fn(
18461                    *mut RedisModuleKey,
18462                    *mut moduleType,
18463                    *mut libc::c_void,
18464                ) -> libc::c_int,
18465            >,
18466            libc::c_ulong,
18467        >(
18468            Some(
18469                RM_ModuleTypeSetValue
18470                    as unsafe extern "C" fn(
18471                        *mut RedisModuleKey,
18472                        *mut moduleType,
18473                        *mut libc::c_void,
18474                    ) -> libc::c_int,
18475            ),
18476        ) as *mut libc::c_void,
18477    );
18478    moduleRegisterApi(
18479        b"RedisModule_ModuleTypeReplaceValue\0" as *const u8 as *const libc::c_char,
18480        core::mem::transmute::<
18481            Option::<
18482                unsafe extern "C" fn(
18483                    *mut RedisModuleKey,
18484                    *mut moduleType,
18485                    *mut libc::c_void,
18486                    *mut *mut libc::c_void,
18487                ) -> libc::c_int,
18488            >,
18489            libc::c_ulong,
18490        >(
18491            Some(
18492                RM_ModuleTypeReplaceValue
18493                    as unsafe extern "C" fn(
18494                        *mut RedisModuleKey,
18495                        *mut moduleType,
18496                        *mut libc::c_void,
18497                        *mut *mut libc::c_void,
18498                    ) -> libc::c_int,
18499            ),
18500        ) as *mut libc::c_void,
18501    );
18502    moduleRegisterApi(
18503        b"RedisModule_ModuleTypeGetType\0" as *const u8 as *const libc::c_char,
18504        core::mem::transmute::<
18505            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> *mut moduleType>,
18506            libc::c_ulong,
18507        >(
18508            Some(
18509                RM_ModuleTypeGetType
18510                    as unsafe extern "C" fn(*mut RedisModuleKey) -> *mut moduleType,
18511            ),
18512        ) as *mut libc::c_void,
18513    );
18514    moduleRegisterApi(
18515        b"RedisModule_ModuleTypeGetValue\0" as *const u8 as *const libc::c_char,
18516        core::mem::transmute::<
18517            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> *mut libc::c_void>,
18518            libc::c_ulong,
18519        >(
18520            Some(
18521                RM_ModuleTypeGetValue
18522                    as unsafe extern "C" fn(*mut RedisModuleKey) -> *mut libc::c_void,
18523            ),
18524        ) as *mut libc::c_void,
18525    );
18526    moduleRegisterApi(
18527        b"RedisModule_IsIOError\0" as *const u8 as *const libc::c_char,
18528        core::mem::transmute::<
18529            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> libc::c_int>,
18530            libc::c_ulong,
18531        >(Some(RM_IsIOError as unsafe extern "C" fn(*mut RedisModuleIO) -> libc::c_int))
18532            as *mut libc::c_void,
18533    );
18534    moduleRegisterApi(
18535        b"RedisModule_SetModuleOptions\0" as *const u8 as *const libc::c_char,
18536        core::mem::transmute::<
18537            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int) -> ()>,
18538            libc::c_ulong,
18539        >(
18540            Some(
18541                RM_SetModuleOptions
18542                    as unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int) -> (),
18543            ),
18544        ) as *mut libc::c_void,
18545    );
18546    moduleRegisterApi(
18547        b"RedisModule_SignalModifiedKey\0" as *const u8 as *const libc::c_char,
18548        core::mem::transmute::<
18549            Option::<
18550                unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> libc::c_int,
18551            >,
18552            libc::c_ulong,
18553        >(
18554            Some(
18555                RM_SignalModifiedKey
18556                    as unsafe extern "C" fn(
18557                        *mut RedisModuleCtx,
18558                        *mut robj,
18559                    ) -> libc::c_int,
18560            ),
18561        ) as *mut libc::c_void,
18562    );
18563    moduleRegisterApi(
18564        b"RedisModule_SaveUnsigned\0" as *const u8 as *const libc::c_char,
18565        core::mem::transmute::<
18566            Option::<unsafe extern "C" fn(*mut RedisModuleIO, uint64_t) -> ()>,
18567            libc::c_ulong,
18568        >(
18569            Some(
18570                RM_SaveUnsigned
18571                    as unsafe extern "C" fn(*mut RedisModuleIO, uint64_t) -> (),
18572            ),
18573        ) as *mut libc::c_void,
18574    );
18575    moduleRegisterApi(
18576        b"RedisModule_LoadUnsigned\0" as *const u8 as *const libc::c_char,
18577        core::mem::transmute::<
18578            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> uint64_t>,
18579            libc::c_ulong,
18580        >(Some(RM_LoadUnsigned as unsafe extern "C" fn(*mut RedisModuleIO) -> uint64_t))
18581            as *mut libc::c_void,
18582    );
18583    moduleRegisterApi(
18584        b"RedisModule_SaveSigned\0" as *const u8 as *const libc::c_char,
18585        core::mem::transmute::<
18586            Option::<unsafe extern "C" fn(*mut RedisModuleIO, int64_t) -> ()>,
18587            libc::c_ulong,
18588        >(Some(RM_SaveSigned as unsafe extern "C" fn(*mut RedisModuleIO, int64_t) -> ()))
18589            as *mut libc::c_void,
18590    );
18591    moduleRegisterApi(
18592        b"RedisModule_LoadSigned\0" as *const u8 as *const libc::c_char,
18593        core::mem::transmute::<
18594            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> int64_t>,
18595            libc::c_ulong,
18596        >(Some(RM_LoadSigned as unsafe extern "C" fn(*mut RedisModuleIO) -> int64_t))
18597            as *mut libc::c_void,
18598    );
18599    moduleRegisterApi(
18600        b"RedisModule_SaveString\0" as *const u8 as *const libc::c_char,
18601        core::mem::transmute::<
18602            Option::<unsafe extern "C" fn(*mut RedisModuleIO, *mut robj) -> ()>,
18603            libc::c_ulong,
18604        >(
18605            Some(
18606                RM_SaveString
18607                    as unsafe extern "C" fn(*mut RedisModuleIO, *mut robj) -> (),
18608            ),
18609        ) as *mut libc::c_void,
18610    );
18611    moduleRegisterApi(
18612        b"RedisModule_SaveStringBuffer\0" as *const u8 as *const libc::c_char,
18613        core::mem::transmute::<
18614            Option::<
18615                unsafe extern "C" fn(
18616                    *mut RedisModuleIO,
18617                    *const libc::c_char,
18618                    size_t,
18619                ) -> (),
18620            >,
18621            libc::c_ulong,
18622        >(
18623            Some(
18624                RM_SaveStringBuffer
18625                    as unsafe extern "C" fn(
18626                        *mut RedisModuleIO,
18627                        *const libc::c_char,
18628                        size_t,
18629                    ) -> (),
18630            ),
18631        ) as *mut libc::c_void,
18632    );
18633    moduleRegisterApi(
18634        b"RedisModule_LoadString\0" as *const u8 as *const libc::c_char,
18635        core::mem::transmute::<
18636            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> *mut robj>,
18637            libc::c_ulong,
18638        >(Some(RM_LoadString as unsafe extern "C" fn(*mut RedisModuleIO) -> *mut robj))
18639            as *mut libc::c_void,
18640    );
18641    moduleRegisterApi(
18642        b"RedisModule_LoadStringBuffer\0" as *const u8 as *const libc::c_char,
18643        core::mem::transmute::<
18644            Option::<
18645                unsafe extern "C" fn(
18646                    *mut RedisModuleIO,
18647                    *mut size_t,
18648                ) -> *mut libc::c_char,
18649            >,
18650            libc::c_ulong,
18651        >(
18652            Some(
18653                RM_LoadStringBuffer
18654                    as unsafe extern "C" fn(
18655                        *mut RedisModuleIO,
18656                        *mut size_t,
18657                    ) -> *mut libc::c_char,
18658            ),
18659        ) as *mut libc::c_void,
18660    );
18661    moduleRegisterApi(
18662        b"RedisModule_SaveDouble\0" as *const u8 as *const libc::c_char,
18663        core::mem::transmute::<
18664            Option::<unsafe extern "C" fn(*mut RedisModuleIO, libc::c_double) -> ()>,
18665            libc::c_ulong,
18666        >(
18667            Some(
18668                RM_SaveDouble
18669                    as unsafe extern "C" fn(*mut RedisModuleIO, libc::c_double) -> (),
18670            ),
18671        ) as *mut libc::c_void,
18672    );
18673    moduleRegisterApi(
18674        b"RedisModule_LoadDouble\0" as *const u8 as *const libc::c_char,
18675        core::mem::transmute::<
18676            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> libc::c_double>,
18677            libc::c_ulong,
18678        >(
18679            Some(
18680                RM_LoadDouble
18681                    as unsafe extern "C" fn(*mut RedisModuleIO) -> libc::c_double,
18682            ),
18683        ) as *mut libc::c_void,
18684    );
18685    moduleRegisterApi(
18686        b"RedisModule_SaveFloat\0" as *const u8 as *const libc::c_char,
18687        core::mem::transmute::<
18688            Option::<unsafe extern "C" fn(*mut RedisModuleIO, libc::c_float) -> ()>,
18689            libc::c_ulong,
18690        >(
18691            Some(
18692                RM_SaveFloat
18693                    as unsafe extern "C" fn(*mut RedisModuleIO, libc::c_float) -> (),
18694            ),
18695        ) as *mut libc::c_void,
18696    );
18697    moduleRegisterApi(
18698        b"RedisModule_LoadFloat\0" as *const u8 as *const libc::c_char,
18699        core::mem::transmute::<
18700            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> libc::c_float>,
18701            libc::c_ulong,
18702        >(
18703            Some(
18704                RM_LoadFloat as unsafe extern "C" fn(*mut RedisModuleIO) -> libc::c_float,
18705            ),
18706        ) as *mut libc::c_void,
18707    );
18708    moduleRegisterApi(
18709        b"RedisModule_SaveLongDouble\0" as *const u8 as *const libc::c_char,
18710        core::mem::transmute::<
18711            Option::<unsafe extern "C" fn(*mut RedisModuleIO, f64) -> ()>,
18712            libc::c_ulong,
18713        >(
18714            Some(
18715                RM_SaveLongDouble
18716                    as unsafe extern "C" fn(*mut RedisModuleIO, f64) -> (),
18717            ),
18718        ) as *mut libc::c_void,
18719    );
18720    moduleRegisterApi(
18721        b"RedisModule_LoadLongDouble\0" as *const u8 as *const libc::c_char,
18722        core::mem::transmute::<
18723            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> f64>,
18724            libc::c_ulong,
18725        >(
18726            Some(
18727                RM_LoadLongDouble
18728                    as unsafe extern "C" fn(*mut RedisModuleIO) -> f64,
18729            ),
18730        ) as *mut libc::c_void,
18731    );
18732    moduleRegisterApi(
18733        b"RedisModule_SaveDataTypeToString\0" as *const u8 as *const libc::c_char,
18734        core::mem::transmute::<
18735            Option::<
18736                unsafe extern "C" fn(
18737                    *mut RedisModuleCtx,
18738                    *mut libc::c_void,
18739                    *const moduleType,
18740                ) -> *mut robj,
18741            >,
18742            libc::c_ulong,
18743        >(
18744            Some(
18745                RM_SaveDataTypeToString
18746                    as unsafe extern "C" fn(
18747                        *mut RedisModuleCtx,
18748                        *mut libc::c_void,
18749                        *const moduleType,
18750                    ) -> *mut robj,
18751            ),
18752        ) as *mut libc::c_void,
18753    );
18754    moduleRegisterApi(
18755        b"RedisModule_LoadDataTypeFromString\0" as *const u8 as *const libc::c_char,
18756        core::mem::transmute::<
18757            Option::<
18758                unsafe extern "C" fn(*const robj, *const moduleType) -> *mut libc::c_void,
18759            >,
18760            libc::c_ulong,
18761        >(
18762            Some(
18763                RM_LoadDataTypeFromString
18764                    as unsafe extern "C" fn(
18765                        *const robj,
18766                        *const moduleType,
18767                    ) -> *mut libc::c_void,
18768            ),
18769        ) as *mut libc::c_void,
18770    );
18771    moduleRegisterApi(
18772        b"RedisModule_LoadDataTypeFromStringEncver\0" as *const u8
18773            as *const libc::c_char,
18774        core::mem::transmute::<
18775            Option::<
18776                unsafe extern "C" fn(
18777                    *const robj,
18778                    *const moduleType,
18779                    libc::c_int,
18780                ) -> *mut libc::c_void,
18781            >,
18782            libc::c_ulong,
18783        >(
18784            Some(
18785                RM_LoadDataTypeFromStringEncver
18786                    as unsafe extern "C" fn(
18787                        *const robj,
18788                        *const moduleType,
18789                        libc::c_int,
18790                    ) -> *mut libc::c_void,
18791            ),
18792        ) as *mut libc::c_void,
18793    );
18794    moduleRegisterApi(
18795        b"RedisModule_EmitAOF\0" as *const u8 as *const libc::c_char,
18796        core::mem::transmute::<
18797            Option::<
18798                unsafe extern "C" fn(
18799                    *mut RedisModuleIO,
18800                    *const libc::c_char,
18801                    *const libc::c_char,
18802                    ...
18803                ) -> (),
18804            >,
18805            libc::c_ulong,
18806        >(
18807            Some(
18808                RM_EmitAOF
18809                    as unsafe extern "C" fn(
18810                        *mut RedisModuleIO,
18811                        *const libc::c_char,
18812                        *const libc::c_char,
18813                        ...
18814                    ) -> (),
18815            ),
18816        ) as *mut libc::c_void,
18817    );
18818    moduleRegisterApi(
18819        b"RedisModule_Log\0" as *const u8 as *const libc::c_char,
18820        core::mem::transmute::<
18821            Option::<
18822                unsafe extern "C" fn(
18823                    *mut RedisModuleCtx,
18824                    *const libc::c_char,
18825                    *const libc::c_char,
18826                    ...
18827                ) -> (),
18828            >,
18829            libc::c_ulong,
18830        >(
18831            Some(
18832                RM_Log
18833                    as unsafe extern "C" fn(
18834                        *mut RedisModuleCtx,
18835                        *const libc::c_char,
18836                        *const libc::c_char,
18837                        ...
18838                    ) -> (),
18839            ),
18840        ) as *mut libc::c_void,
18841    );
18842    moduleRegisterApi(
18843        b"RedisModule_LogIOError\0" as *const u8 as *const libc::c_char,
18844        core::mem::transmute::<
18845            Option::<
18846                unsafe extern "C" fn(
18847                    *mut RedisModuleIO,
18848                    *const libc::c_char,
18849                    *const libc::c_char,
18850                    ...
18851                ) -> (),
18852            >,
18853            libc::c_ulong,
18854        >(
18855            Some(
18856                RM_LogIOError
18857                    as unsafe extern "C" fn(
18858                        *mut RedisModuleIO,
18859                        *const libc::c_char,
18860                        *const libc::c_char,
18861                        ...
18862                    ) -> (),
18863            ),
18864        ) as *mut libc::c_void,
18865    );
18866    moduleRegisterApi(
18867        b"RedisModule__Assert\0" as *const u8 as *const libc::c_char,
18868        core::mem::transmute::<
18869            Option::<
18870                unsafe extern "C" fn(
18871                    *const libc::c_char,
18872                    *const libc::c_char,
18873                    libc::c_int,
18874                ) -> (),
18875            >,
18876            libc::c_ulong,
18877        >(
18878            Some(
18879                RM__Assert
18880                    as unsafe extern "C" fn(
18881                        *const libc::c_char,
18882                        *const libc::c_char,
18883                        libc::c_int,
18884                    ) -> (),
18885            ),
18886        ) as *mut libc::c_void,
18887    );
18888    moduleRegisterApi(
18889        b"RedisModule_LatencyAddSample\0" as *const u8 as *const libc::c_char,
18890        core::mem::transmute::<
18891            Option::<unsafe extern "C" fn(*const libc::c_char, mstime_t) -> ()>,
18892            libc::c_ulong,
18893        >(
18894            Some(
18895                RM_LatencyAddSample
18896                    as unsafe extern "C" fn(*const libc::c_char, mstime_t) -> (),
18897            ),
18898        ) as *mut libc::c_void,
18899    );
18900    moduleRegisterApi(
18901        b"RedisModule_StringAppendBuffer\0" as *const u8 as *const libc::c_char,
18902        core::mem::transmute::<
18903            Option::<
18904                unsafe extern "C" fn(
18905                    *mut RedisModuleCtx,
18906                    *mut robj,
18907                    *const libc::c_char,
18908                    size_t,
18909                ) -> libc::c_int,
18910            >,
18911            libc::c_ulong,
18912        >(
18913            Some(
18914                RM_StringAppendBuffer
18915                    as unsafe extern "C" fn(
18916                        *mut RedisModuleCtx,
18917                        *mut robj,
18918                        *const libc::c_char,
18919                        size_t,
18920                    ) -> libc::c_int,
18921            ),
18922        ) as *mut libc::c_void,
18923    );
18924    moduleRegisterApi(
18925        b"RedisModule_TrimStringAllocation\0" as *const u8 as *const libc::c_char,
18926        core::mem::transmute::<
18927            Option::<unsafe extern "C" fn(*mut robj) -> ()>,
18928            libc::c_ulong,
18929        >(Some(RM_TrimStringAllocation as unsafe extern "C" fn(*mut robj) -> ()))
18930            as *mut libc::c_void,
18931    );
18932    moduleRegisterApi(
18933        b"RedisModule_RetainString\0" as *const u8 as *const libc::c_char,
18934        core::mem::transmute::<
18935            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> ()>,
18936            libc::c_ulong,
18937        >(
18938            Some(
18939                RM_RetainString
18940                    as unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> (),
18941            ),
18942        ) as *mut libc::c_void,
18943    );
18944    moduleRegisterApi(
18945        b"RedisModule_HoldString\0" as *const u8 as *const libc::c_char,
18946        core::mem::transmute::<
18947            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> *mut robj>,
18948            libc::c_ulong,
18949        >(
18950            Some(
18951                RM_HoldString
18952                    as unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> *mut robj,
18953            ),
18954        ) as *mut libc::c_void,
18955    );
18956    moduleRegisterApi(
18957        b"RedisModule_StringCompare\0" as *const u8 as *const libc::c_char,
18958        core::mem::transmute::<
18959            Option::<unsafe extern "C" fn(*mut robj, *mut robj) -> libc::c_int>,
18960            libc::c_ulong,
18961        >(
18962            Some(
18963                RM_StringCompare
18964                    as unsafe extern "C" fn(*mut robj, *mut robj) -> libc::c_int,
18965            ),
18966        ) as *mut libc::c_void,
18967    );
18968    moduleRegisterApi(
18969        b"RedisModule_GetContextFromIO\0" as *const u8 as *const libc::c_char,
18970        core::mem::transmute::<
18971            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> *mut RedisModuleCtx>,
18972            libc::c_ulong,
18973        >(
18974            Some(
18975                RM_GetContextFromIO
18976                    as unsafe extern "C" fn(*mut RedisModuleIO) -> *mut RedisModuleCtx,
18977            ),
18978        ) as *mut libc::c_void,
18979    );
18980    moduleRegisterApi(
18981        b"RedisModule_GetKeyNameFromIO\0" as *const u8 as *const libc::c_char,
18982        core::mem::transmute::<
18983            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> *const robj>,
18984            libc::c_ulong,
18985        >(
18986            Some(
18987                RM_GetKeyNameFromIO
18988                    as unsafe extern "C" fn(*mut RedisModuleIO) -> *const robj,
18989            ),
18990        ) as *mut libc::c_void,
18991    );
18992    moduleRegisterApi(
18993        b"RedisModule_GetKeyNameFromModuleKey\0" as *const u8 as *const libc::c_char,
18994        core::mem::transmute::<
18995            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> *const robj>,
18996            libc::c_ulong,
18997        >(
18998            Some(
18999                RM_GetKeyNameFromModuleKey
19000                    as unsafe extern "C" fn(*mut RedisModuleKey) -> *const robj,
19001            ),
19002        ) as *mut libc::c_void,
19003    );
19004    moduleRegisterApi(
19005        b"RedisModule_GetDbIdFromModuleKey\0" as *const u8 as *const libc::c_char,
19006        core::mem::transmute::<
19007            Option::<unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int>,
19008            libc::c_ulong,
19009        >(
19010            Some(
19011                RM_GetDbIdFromModuleKey
19012                    as unsafe extern "C" fn(*mut RedisModuleKey) -> libc::c_int,
19013            ),
19014        ) as *mut libc::c_void,
19015    );
19016    moduleRegisterApi(
19017        b"RedisModule_GetDbIdFromIO\0" as *const u8 as *const libc::c_char,
19018        core::mem::transmute::<
19019            Option::<unsafe extern "C" fn(*mut RedisModuleIO) -> libc::c_int>,
19020            libc::c_ulong,
19021        >(
19022            Some(
19023                RM_GetDbIdFromIO
19024                    as unsafe extern "C" fn(*mut RedisModuleIO) -> libc::c_int,
19025            ),
19026        ) as *mut libc::c_void,
19027    );
19028    moduleRegisterApi(
19029        b"RedisModule_GetKeyNameFromOptCtx\0" as *const u8 as *const libc::c_char,
19030        core::mem::transmute::<
19031            Option::<unsafe extern "C" fn(*mut RedisModuleKeyOptCtx) -> *const robj>,
19032            libc::c_ulong,
19033        >(
19034            Some(
19035                RM_GetKeyNameFromOptCtx
19036                    as unsafe extern "C" fn(*mut RedisModuleKeyOptCtx) -> *const robj,
19037            ),
19038        ) as *mut libc::c_void,
19039    );
19040    moduleRegisterApi(
19041        b"RedisModule_GetToKeyNameFromOptCtx\0" as *const u8 as *const libc::c_char,
19042        core::mem::transmute::<
19043            Option::<unsafe extern "C" fn(*mut RedisModuleKeyOptCtx) -> *const robj>,
19044            libc::c_ulong,
19045        >(
19046            Some(
19047                RM_GetToKeyNameFromOptCtx
19048                    as unsafe extern "C" fn(*mut RedisModuleKeyOptCtx) -> *const robj,
19049            ),
19050        ) as *mut libc::c_void,
19051    );
19052    moduleRegisterApi(
19053        b"RedisModule_GetDbIdFromOptCtx\0" as *const u8 as *const libc::c_char,
19054        core::mem::transmute::<
19055            Option::<unsafe extern "C" fn(*mut RedisModuleKeyOptCtx) -> libc::c_int>,
19056            libc::c_ulong,
19057        >(
19058            Some(
19059                RM_GetDbIdFromOptCtx
19060                    as unsafe extern "C" fn(*mut RedisModuleKeyOptCtx) -> libc::c_int,
19061            ),
19062        ) as *mut libc::c_void,
19063    );
19064    moduleRegisterApi(
19065        b"RedisModule_GetToDbIdFromOptCtx\0" as *const u8 as *const libc::c_char,
19066        core::mem::transmute::<
19067            Option::<unsafe extern "C" fn(*mut RedisModuleKeyOptCtx) -> libc::c_int>,
19068            libc::c_ulong,
19069        >(
19070            Some(
19071                RM_GetToDbIdFromOptCtx
19072                    as unsafe extern "C" fn(*mut RedisModuleKeyOptCtx) -> libc::c_int,
19073            ),
19074        ) as *mut libc::c_void,
19075    );
19076    moduleRegisterApi(
19077        b"RedisModule_GetKeyNameFromDefragCtx\0" as *const u8 as *const libc::c_char,
19078        core::mem::transmute::<
19079            Option::<unsafe extern "C" fn(*mut RedisModuleDefragCtx) -> *const robj>,
19080            libc::c_ulong,
19081        >(
19082            Some(
19083                RM_GetKeyNameFromDefragCtx
19084                    as unsafe extern "C" fn(*mut RedisModuleDefragCtx) -> *const robj,
19085            ),
19086        ) as *mut libc::c_void,
19087    );
19088    moduleRegisterApi(
19089        b"RedisModule_GetDbIdFromDefragCtx\0" as *const u8 as *const libc::c_char,
19090        core::mem::transmute::<
19091            Option::<unsafe extern "C" fn(*mut RedisModuleDefragCtx) -> libc::c_int>,
19092            libc::c_ulong,
19093        >(
19094            Some(
19095                RM_GetDbIdFromDefragCtx
19096                    as unsafe extern "C" fn(*mut RedisModuleDefragCtx) -> libc::c_int,
19097            ),
19098        ) as *mut libc::c_void,
19099    );
19100    moduleRegisterApi(
19101        b"RedisModule_GetKeyNameFromDigest\0" as *const u8 as *const libc::c_char,
19102        core::mem::transmute::<
19103            Option::<unsafe extern "C" fn(*mut RedisModuleDigest) -> *const robj>,
19104            libc::c_ulong,
19105        >(
19106            Some(
19107                RM_GetKeyNameFromDigest
19108                    as unsafe extern "C" fn(*mut RedisModuleDigest) -> *const robj,
19109            ),
19110        ) as *mut libc::c_void,
19111    );
19112    moduleRegisterApi(
19113        b"RedisModule_GetDbIdFromDigest\0" as *const u8 as *const libc::c_char,
19114        core::mem::transmute::<
19115            Option::<unsafe extern "C" fn(*mut RedisModuleDigest) -> libc::c_int>,
19116            libc::c_ulong,
19117        >(
19118            Some(
19119                RM_GetDbIdFromDigest
19120                    as unsafe extern "C" fn(*mut RedisModuleDigest) -> libc::c_int,
19121            ),
19122        ) as *mut libc::c_void,
19123    );
19124    moduleRegisterApi(
19125        b"RedisModule_BlockClient\0" as *const u8 as *const libc::c_char,
19126        core::mem::transmute::<
19127            Option::<
19128                unsafe extern "C" fn(
19129                    *mut RedisModuleCtx,
19130                    RedisModuleCmdFunc,
19131                    RedisModuleCmdFunc,
19132                    Option::<
19133                        unsafe extern "C" fn(
19134                            *mut RedisModuleCtx,
19135                            *mut libc::c_void,
19136                        ) -> (),
19137                    >,
19138                    libc::c_longlong,
19139                ) -> *mut RedisModuleBlockedClient,
19140            >,
19141            libc::c_ulong,
19142        >(
19143            Some(
19144                RM_BlockClient
19145                    as unsafe extern "C" fn(
19146                        *mut RedisModuleCtx,
19147                        RedisModuleCmdFunc,
19148                        RedisModuleCmdFunc,
19149                        Option::<
19150                            unsafe extern "C" fn(
19151                                *mut RedisModuleCtx,
19152                                *mut libc::c_void,
19153                            ) -> (),
19154                        >,
19155                        libc::c_longlong,
19156                    ) -> *mut RedisModuleBlockedClient,
19157            ),
19158        ) as *mut libc::c_void,
19159    );
19160    moduleRegisterApi(
19161        b"RedisModule_UnblockClient\0" as *const u8 as *const libc::c_char,
19162        core::mem::transmute::<
19163            Option::<
19164                unsafe extern "C" fn(
19165                    *mut RedisModuleBlockedClient,
19166                    *mut libc::c_void,
19167                ) -> libc::c_int,
19168            >,
19169            libc::c_ulong,
19170        >(
19171            Some(
19172                RM_UnblockClient
19173                    as unsafe extern "C" fn(
19174                        *mut RedisModuleBlockedClient,
19175                        *mut libc::c_void,
19176                    ) -> libc::c_int,
19177            ),
19178        ) as *mut libc::c_void,
19179    );
19180    moduleRegisterApi(
19181        b"RedisModule_IsBlockedReplyRequest\0" as *const u8 as *const libc::c_char,
19182        core::mem::transmute::<
19183            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
19184            libc::c_ulong,
19185        >(
19186            Some(
19187                RM_IsBlockedReplyRequest
19188                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
19189            ),
19190        ) as *mut libc::c_void,
19191    );
19192    moduleRegisterApi(
19193        b"RedisModule_IsBlockedTimeoutRequest\0" as *const u8 as *const libc::c_char,
19194        core::mem::transmute::<
19195            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
19196            libc::c_ulong,
19197        >(
19198            Some(
19199                RM_IsBlockedTimeoutRequest
19200                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
19201            ),
19202        ) as *mut libc::c_void,
19203    );
19204    moduleRegisterApi(
19205        b"RedisModule_GetBlockedClientPrivateData\0" as *const u8 as *const libc::c_char,
19206        core::mem::transmute::<
19207            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut libc::c_void>,
19208            libc::c_ulong,
19209        >(
19210            Some(
19211                RM_GetBlockedClientPrivateData
19212                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut libc::c_void,
19213            ),
19214        ) as *mut libc::c_void,
19215    );
19216    moduleRegisterApi(
19217        b"RedisModule_AbortBlock\0" as *const u8 as *const libc::c_char,
19218        core::mem::transmute::<
19219            Option::<unsafe extern "C" fn(*mut RedisModuleBlockedClient) -> libc::c_int>,
19220            libc::c_ulong,
19221        >(
19222            Some(
19223                RM_AbortBlock
19224                    as unsafe extern "C" fn(*mut RedisModuleBlockedClient) -> libc::c_int,
19225            ),
19226        ) as *mut libc::c_void,
19227    );
19228    moduleRegisterApi(
19229        b"RedisModule_Milliseconds\0" as *const u8 as *const libc::c_char,
19230        core::mem::transmute::<
19231            Option::<unsafe extern "C" fn() -> libc::c_longlong>,
19232            libc::c_ulong,
19233        >(Some(RM_Milliseconds as unsafe extern "C" fn() -> libc::c_longlong))
19234            as *mut libc::c_void,
19235    );
19236    moduleRegisterApi(
19237        b"RedisModule_MonotonicMicroseconds\0" as *const u8 as *const libc::c_char,
19238        core::mem::transmute::<
19239            Option::<unsafe extern "C" fn() -> uint64_t>,
19240            libc::c_ulong,
19241        >(Some(RM_MonotonicMicroseconds as unsafe extern "C" fn() -> uint64_t))
19242            as *mut libc::c_void,
19243    );
19244    moduleRegisterApi(
19245        b"RedisModule_BlockedClientMeasureTimeStart\0" as *const u8
19246            as *const libc::c_char,
19247        core::mem::transmute::<
19248            Option::<unsafe extern "C" fn(*mut RedisModuleBlockedClient) -> libc::c_int>,
19249            libc::c_ulong,
19250        >(
19251            Some(
19252                RM_BlockedClientMeasureTimeStart
19253                    as unsafe extern "C" fn(*mut RedisModuleBlockedClient) -> libc::c_int,
19254            ),
19255        ) as *mut libc::c_void,
19256    );
19257    moduleRegisterApi(
19258        b"RedisModule_BlockedClientMeasureTimeEnd\0" as *const u8 as *const libc::c_char,
19259        core::mem::transmute::<
19260            Option::<unsafe extern "C" fn(*mut RedisModuleBlockedClient) -> libc::c_int>,
19261            libc::c_ulong,
19262        >(
19263            Some(
19264                RM_BlockedClientMeasureTimeEnd
19265                    as unsafe extern "C" fn(*mut RedisModuleBlockedClient) -> libc::c_int,
19266            ),
19267        ) as *mut libc::c_void,
19268    );
19269    moduleRegisterApi(
19270        b"RedisModule_GetThreadSafeContext\0" as *const u8 as *const libc::c_char,
19271        core::mem::transmute::<
19272            Option::<
19273                unsafe extern "C" fn(
19274                    *mut RedisModuleBlockedClient,
19275                ) -> *mut RedisModuleCtx,
19276            >,
19277            libc::c_ulong,
19278        >(
19279            Some(
19280                RM_GetThreadSafeContext
19281                    as unsafe extern "C" fn(
19282                        *mut RedisModuleBlockedClient,
19283                    ) -> *mut RedisModuleCtx,
19284            ),
19285        ) as *mut libc::c_void,
19286    );
19287    moduleRegisterApi(
19288        b"RedisModule_GetDetachedThreadSafeContext\0" as *const u8
19289            as *const libc::c_char,
19290        core::mem::transmute::<
19291            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut RedisModuleCtx>,
19292            libc::c_ulong,
19293        >(
19294            Some(
19295                RM_GetDetachedThreadSafeContext
19296                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut RedisModuleCtx,
19297            ),
19298        ) as *mut libc::c_void,
19299    );
19300    moduleRegisterApi(
19301        b"RedisModule_FreeThreadSafeContext\0" as *const u8 as *const libc::c_char,
19302        core::mem::transmute::<
19303            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> ()>,
19304            libc::c_ulong,
19305        >(
19306            Some(
19307                RM_FreeThreadSafeContext
19308                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> (),
19309            ),
19310        ) as *mut libc::c_void,
19311    );
19312    moduleRegisterApi(
19313        b"RedisModule_ThreadSafeContextLock\0" as *const u8 as *const libc::c_char,
19314        core::mem::transmute::<
19315            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> ()>,
19316            libc::c_ulong,
19317        >(
19318            Some(
19319                RM_ThreadSafeContextLock
19320                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> (),
19321            ),
19322        ) as *mut libc::c_void,
19323    );
19324    moduleRegisterApi(
19325        b"RedisModule_ThreadSafeContextTryLock\0" as *const u8 as *const libc::c_char,
19326        core::mem::transmute::<
19327            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
19328            libc::c_ulong,
19329        >(
19330            Some(
19331                RM_ThreadSafeContextTryLock
19332                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
19333            ),
19334        ) as *mut libc::c_void,
19335    );
19336    moduleRegisterApi(
19337        b"RedisModule_ThreadSafeContextUnlock\0" as *const u8 as *const libc::c_char,
19338        core::mem::transmute::<
19339            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> ()>,
19340            libc::c_ulong,
19341        >(
19342            Some(
19343                RM_ThreadSafeContextUnlock
19344                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> (),
19345            ),
19346        ) as *mut libc::c_void,
19347    );
19348    moduleRegisterApi(
19349        b"RedisModule_DigestAddStringBuffer\0" as *const u8 as *const libc::c_char,
19350        core::mem::transmute::<
19351            Option::<
19352                unsafe extern "C" fn(
19353                    *mut RedisModuleDigest,
19354                    *const libc::c_char,
19355                    size_t,
19356                ) -> (),
19357            >,
19358            libc::c_ulong,
19359        >(
19360            Some(
19361                RM_DigestAddStringBuffer
19362                    as unsafe extern "C" fn(
19363                        *mut RedisModuleDigest,
19364                        *const libc::c_char,
19365                        size_t,
19366                    ) -> (),
19367            ),
19368        ) as *mut libc::c_void,
19369    );
19370    moduleRegisterApi(
19371        b"RedisModule_DigestAddLongLong\0" as *const u8 as *const libc::c_char,
19372        core::mem::transmute::<
19373            Option::<
19374                unsafe extern "C" fn(*mut RedisModuleDigest, libc::c_longlong) -> (),
19375            >,
19376            libc::c_ulong,
19377        >(
19378            Some(
19379                RM_DigestAddLongLong
19380                    as unsafe extern "C" fn(
19381                        *mut RedisModuleDigest,
19382                        libc::c_longlong,
19383                    ) -> (),
19384            ),
19385        ) as *mut libc::c_void,
19386    );
19387    moduleRegisterApi(
19388        b"RedisModule_DigestEndSequence\0" as *const u8 as *const libc::c_char,
19389        core::mem::transmute::<
19390            Option::<unsafe extern "C" fn(*mut RedisModuleDigest) -> ()>,
19391            libc::c_ulong,
19392        >(
19393            Some(
19394                RM_DigestEndSequence
19395                    as unsafe extern "C" fn(*mut RedisModuleDigest) -> (),
19396            ),
19397        ) as *mut libc::c_void,
19398    );
19399    moduleRegisterApi(
19400        b"RedisModule_NotifyKeyspaceEvent\0" as *const u8 as *const libc::c_char,
19401        core::mem::transmute::<
19402            Option::<
19403                unsafe extern "C" fn(
19404                    *mut RedisModuleCtx,
19405                    libc::c_int,
19406                    *const libc::c_char,
19407                    *mut robj,
19408                ) -> libc::c_int,
19409            >,
19410            libc::c_ulong,
19411        >(
19412            Some(
19413                RM_NotifyKeyspaceEvent
19414                    as unsafe extern "C" fn(
19415                        *mut RedisModuleCtx,
19416                        libc::c_int,
19417                        *const libc::c_char,
19418                        *mut robj,
19419                    ) -> libc::c_int,
19420            ),
19421        ) as *mut libc::c_void,
19422    );
19423    moduleRegisterApi(
19424        b"RedisModule_GetNotifyKeyspaceEvents\0" as *const u8 as *const libc::c_char,
19425        core::mem::transmute::<
19426            Option::<unsafe extern "C" fn() -> libc::c_int>,
19427            libc::c_ulong,
19428        >(
19429            Some(
19430                core::mem::transmute::<
19431                    unsafe extern "C" fn() -> libc::c_int,
19432                    unsafe extern "C" fn() -> libc::c_int,
19433                >(RM_GetNotifyKeyspaceEvents),
19434            ),
19435        ) as *mut libc::c_void,
19436    );
19437    moduleRegisterApi(
19438        b"RedisModule_SubscribeToKeyspaceEvents\0" as *const u8 as *const libc::c_char,
19439        core::mem::transmute::<
19440            Option::<
19441                unsafe extern "C" fn(
19442                    *mut RedisModuleCtx,
19443                    libc::c_int,
19444                    RedisModuleNotificationFunc,
19445                ) -> libc::c_int,
19446            >,
19447            libc::c_ulong,
19448        >(
19449            Some(
19450                RM_SubscribeToKeyspaceEvents
19451                    as unsafe extern "C" fn(
19452                        *mut RedisModuleCtx,
19453                        libc::c_int,
19454                        RedisModuleNotificationFunc,
19455                    ) -> libc::c_int,
19456            ),
19457        ) as *mut libc::c_void,
19458    );
19459    moduleRegisterApi(
19460        b"RedisModule_RegisterClusterMessageReceiver\0" as *const u8
19461            as *const libc::c_char,
19462        core::mem::transmute::<
19463            Option::<
19464                unsafe extern "C" fn(
19465                    *mut RedisModuleCtx,
19466                    uint8_t,
19467                    RedisModuleClusterMessageReceiver,
19468                ) -> (),
19469            >,
19470            libc::c_ulong,
19471        >(
19472            Some(
19473                RM_RegisterClusterMessageReceiver
19474                    as unsafe extern "C" fn(
19475                        *mut RedisModuleCtx,
19476                        uint8_t,
19477                        RedisModuleClusterMessageReceiver,
19478                    ) -> (),
19479            ),
19480        ) as *mut libc::c_void,
19481    );
19482    moduleRegisterApi(
19483        b"RedisModule_SendClusterMessage\0" as *const u8 as *const libc::c_char,
19484        core::mem::transmute::<
19485            Option::<
19486                unsafe extern "C" fn(
19487                    *mut RedisModuleCtx,
19488                    *const libc::c_char,
19489                    uint8_t,
19490                    *const libc::c_char,
19491                    uint32_t,
19492                ) -> libc::c_int,
19493            >,
19494            libc::c_ulong,
19495        >(
19496            Some(
19497                RM_SendClusterMessage
19498                    as unsafe extern "C" fn(
19499                        *mut RedisModuleCtx,
19500                        *const libc::c_char,
19501                        uint8_t,
19502                        *const libc::c_char,
19503                        uint32_t,
19504                    ) -> libc::c_int,
19505            ),
19506        ) as *mut libc::c_void,
19507    );
19508    moduleRegisterApi(
19509        b"RedisModule_GetClusterNodeInfo\0" as *const u8 as *const libc::c_char,
19510        core::mem::transmute::<
19511            Option::<
19512                unsafe extern "C" fn(
19513                    *mut RedisModuleCtx,
19514                    *const libc::c_char,
19515                    *mut libc::c_char,
19516                    *mut libc::c_char,
19517                    *mut libc::c_int,
19518                    *mut libc::c_int,
19519                ) -> libc::c_int,
19520            >,
19521            libc::c_ulong,
19522        >(
19523            Some(
19524                RM_GetClusterNodeInfo
19525                    as unsafe extern "C" fn(
19526                        *mut RedisModuleCtx,
19527                        *const libc::c_char,
19528                        *mut libc::c_char,
19529                        *mut libc::c_char,
19530                        *mut libc::c_int,
19531                        *mut libc::c_int,
19532                    ) -> libc::c_int,
19533            ),
19534        ) as *mut libc::c_void,
19535    );
19536    moduleRegisterApi(
19537        b"RedisModule_GetClusterNodesList\0" as *const u8 as *const libc::c_char,
19538        core::mem::transmute::<
19539            Option::<
19540                unsafe extern "C" fn(
19541                    *mut RedisModuleCtx,
19542                    *mut size_t,
19543                ) -> *mut *mut libc::c_char,
19544            >,
19545            libc::c_ulong,
19546        >(
19547            Some(
19548                RM_GetClusterNodesList
19549                    as unsafe extern "C" fn(
19550                        *mut RedisModuleCtx,
19551                        *mut size_t,
19552                    ) -> *mut *mut libc::c_char,
19553            ),
19554        ) as *mut libc::c_void,
19555    );
19556    moduleRegisterApi(
19557        b"RedisModule_FreeClusterNodesList\0" as *const u8 as *const libc::c_char,
19558        core::mem::transmute::<
19559            Option::<unsafe extern "C" fn(*mut *mut libc::c_char) -> ()>,
19560            libc::c_ulong,
19561        >(
19562            Some(
19563                RM_FreeClusterNodesList
19564                    as unsafe extern "C" fn(*mut *mut libc::c_char) -> (),
19565            ),
19566        ) as *mut libc::c_void,
19567    );
19568    moduleRegisterApi(
19569        b"RedisModule_CreateTimer\0" as *const u8 as *const libc::c_char,
19570        core::mem::transmute::<
19571            Option::<
19572                unsafe extern "C" fn(
19573                    *mut RedisModuleCtx,
19574                    mstime_t,
19575                    RedisModuleTimerProc,
19576                    *mut libc::c_void,
19577                ) -> RedisModuleTimerID,
19578            >,
19579            libc::c_ulong,
19580        >(
19581            Some(
19582                RM_CreateTimer
19583                    as unsafe extern "C" fn(
19584                        *mut RedisModuleCtx,
19585                        mstime_t,
19586                        RedisModuleTimerProc,
19587                        *mut libc::c_void,
19588                    ) -> RedisModuleTimerID,
19589            ),
19590        ) as *mut libc::c_void,
19591    );
19592    moduleRegisterApi(
19593        b"RedisModule_StopTimer\0" as *const u8 as *const libc::c_char,
19594        core::mem::transmute::<
19595            Option::<
19596                unsafe extern "C" fn(
19597                    *mut RedisModuleCtx,
19598                    RedisModuleTimerID,
19599                    *mut *mut libc::c_void,
19600                ) -> libc::c_int,
19601            >,
19602            libc::c_ulong,
19603        >(
19604            Some(
19605                RM_StopTimer
19606                    as unsafe extern "C" fn(
19607                        *mut RedisModuleCtx,
19608                        RedisModuleTimerID,
19609                        *mut *mut libc::c_void,
19610                    ) -> libc::c_int,
19611            ),
19612        ) as *mut libc::c_void,
19613    );
19614    moduleRegisterApi(
19615        b"RedisModule_GetTimerInfo\0" as *const u8 as *const libc::c_char,
19616        core::mem::transmute::<
19617            Option::<
19618                unsafe extern "C" fn(
19619                    *mut RedisModuleCtx,
19620                    RedisModuleTimerID,
19621                    *mut uint64_t,
19622                    *mut *mut libc::c_void,
19623                ) -> libc::c_int,
19624            >,
19625            libc::c_ulong,
19626        >(
19627            Some(
19628                RM_GetTimerInfo
19629                    as unsafe extern "C" fn(
19630                        *mut RedisModuleCtx,
19631                        RedisModuleTimerID,
19632                        *mut uint64_t,
19633                        *mut *mut libc::c_void,
19634                    ) -> libc::c_int,
19635            ),
19636        ) as *mut libc::c_void,
19637    );
19638    moduleRegisterApi(
19639        b"RedisModule_GetMyClusterID\0" as *const u8 as *const libc::c_char,
19640        core::mem::transmute::<
19641            Option::<unsafe extern "C" fn() -> *const libc::c_char>,
19642            libc::c_ulong,
19643        >(Some(RM_GetMyClusterID as unsafe extern "C" fn() -> *const libc::c_char))
19644            as *mut libc::c_void,
19645    );
19646    moduleRegisterApi(
19647        b"RedisModule_GetClusterSize\0" as *const u8 as *const libc::c_char,
19648        core::mem::transmute::<
19649            Option::<unsafe extern "C" fn() -> size_t>,
19650            libc::c_ulong,
19651        >(Some(RM_GetClusterSize as unsafe extern "C" fn() -> size_t))
19652            as *mut libc::c_void,
19653    );
19654    moduleRegisterApi(
19655        b"RedisModule_GetRandomBytes\0" as *const u8 as *const libc::c_char,
19656        core::mem::transmute::<
19657            Option::<unsafe extern "C" fn(*mut libc::c_uchar, size_t) -> ()>,
19658            libc::c_ulong,
19659        >(
19660            Some(
19661                RM_GetRandomBytes
19662                    as unsafe extern "C" fn(*mut libc::c_uchar, size_t) -> (),
19663            ),
19664        ) as *mut libc::c_void,
19665    );
19666    moduleRegisterApi(
19667        b"RedisModule_GetRandomHexChars\0" as *const u8 as *const libc::c_char,
19668        core::mem::transmute::<
19669            Option::<unsafe extern "C" fn(*mut libc::c_char, size_t) -> ()>,
19670            libc::c_ulong,
19671        >(
19672            Some(
19673                RM_GetRandomHexChars
19674                    as unsafe extern "C" fn(*mut libc::c_char, size_t) -> (),
19675            ),
19676        ) as *mut libc::c_void,
19677    );
19678    moduleRegisterApi(
19679        b"RedisModule_BlockedClientDisconnected\0" as *const u8 as *const libc::c_char,
19680        core::mem::transmute::<
19681            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
19682            libc::c_ulong,
19683        >(
19684            Some(
19685                RM_BlockedClientDisconnected
19686                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
19687            ),
19688        ) as *mut libc::c_void,
19689    );
19690    moduleRegisterApi(
19691        b"RedisModule_SetDisconnectCallback\0" as *const u8 as *const libc::c_char,
19692        core::mem::transmute::<
19693            Option::<
19694                unsafe extern "C" fn(
19695                    *mut RedisModuleBlockedClient,
19696                    RedisModuleDisconnectFunc,
19697                ) -> (),
19698            >,
19699            libc::c_ulong,
19700        >(
19701            Some(
19702                RM_SetDisconnectCallback
19703                    as unsafe extern "C" fn(
19704                        *mut RedisModuleBlockedClient,
19705                        RedisModuleDisconnectFunc,
19706                    ) -> (),
19707            ),
19708        ) as *mut libc::c_void,
19709    );
19710    moduleRegisterApi(
19711        b"RedisModule_GetBlockedClientHandle\0" as *const u8 as *const libc::c_char,
19712        core::mem::transmute::<
19713            Option::<
19714                unsafe extern "C" fn(
19715                    *mut RedisModuleCtx,
19716                ) -> *mut RedisModuleBlockedClient,
19717            >,
19718            libc::c_ulong,
19719        >(
19720            Some(
19721                RM_GetBlockedClientHandle
19722                    as unsafe extern "C" fn(
19723                        *mut RedisModuleCtx,
19724                    ) -> *mut RedisModuleBlockedClient,
19725            ),
19726        ) as *mut libc::c_void,
19727    );
19728    moduleRegisterApi(
19729        b"RedisModule_SetClusterFlags\0" as *const u8 as *const libc::c_char,
19730        core::mem::transmute::<
19731            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> ()>,
19732            libc::c_ulong,
19733        >(
19734            Some(
19735                RM_SetClusterFlags
19736                    as unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> (),
19737            ),
19738        ) as *mut libc::c_void,
19739    );
19740    moduleRegisterApi(
19741        b"RedisModule_CreateDict\0" as *const u8 as *const libc::c_char,
19742        core::mem::transmute::<
19743            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut RedisModuleDict>,
19744            libc::c_ulong,
19745        >(
19746            Some(
19747                RM_CreateDict
19748                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut RedisModuleDict,
19749            ),
19750        ) as *mut libc::c_void,
19751    );
19752    moduleRegisterApi(
19753        b"RedisModule_FreeDict\0" as *const u8 as *const libc::c_char,
19754        core::mem::transmute::<
19755            Option::<
19756                unsafe extern "C" fn(*mut RedisModuleCtx, *mut RedisModuleDict) -> (),
19757            >,
19758            libc::c_ulong,
19759        >(
19760            Some(
19761                RM_FreeDict
19762                    as unsafe extern "C" fn(
19763                        *mut RedisModuleCtx,
19764                        *mut RedisModuleDict,
19765                    ) -> (),
19766            ),
19767        ) as *mut libc::c_void,
19768    );
19769    moduleRegisterApi(
19770        b"RedisModule_DictSize\0" as *const u8 as *const libc::c_char,
19771        core::mem::transmute::<
19772            Option::<unsafe extern "C" fn(*mut RedisModuleDict) -> uint64_t>,
19773            libc::c_ulong,
19774        >(Some(RM_DictSize as unsafe extern "C" fn(*mut RedisModuleDict) -> uint64_t))
19775            as *mut libc::c_void,
19776    );
19777    moduleRegisterApi(
19778        b"RedisModule_DictSetC\0" as *const u8 as *const libc::c_char,
19779        core::mem::transmute::<
19780            Option::<
19781                unsafe extern "C" fn(
19782                    *mut RedisModuleDict,
19783                    *mut libc::c_void,
19784                    size_t,
19785                    *mut libc::c_void,
19786                ) -> libc::c_int,
19787            >,
19788            libc::c_ulong,
19789        >(
19790            Some(
19791                RM_DictSetC
19792                    as unsafe extern "C" fn(
19793                        *mut RedisModuleDict,
19794                        *mut libc::c_void,
19795                        size_t,
19796                        *mut libc::c_void,
19797                    ) -> libc::c_int,
19798            ),
19799        ) as *mut libc::c_void,
19800    );
19801    moduleRegisterApi(
19802        b"RedisModule_DictReplaceC\0" as *const u8 as *const libc::c_char,
19803        core::mem::transmute::<
19804            Option::<
19805                unsafe extern "C" fn(
19806                    *mut RedisModuleDict,
19807                    *mut libc::c_void,
19808                    size_t,
19809                    *mut libc::c_void,
19810                ) -> libc::c_int,
19811            >,
19812            libc::c_ulong,
19813        >(
19814            Some(
19815                RM_DictReplaceC
19816                    as unsafe extern "C" fn(
19817                        *mut RedisModuleDict,
19818                        *mut libc::c_void,
19819                        size_t,
19820                        *mut libc::c_void,
19821                    ) -> libc::c_int,
19822            ),
19823        ) as *mut libc::c_void,
19824    );
19825    moduleRegisterApi(
19826        b"RedisModule_DictSet\0" as *const u8 as *const libc::c_char,
19827        core::mem::transmute::<
19828            Option::<
19829                unsafe extern "C" fn(
19830                    *mut RedisModuleDict,
19831                    *mut robj,
19832                    *mut libc::c_void,
19833                ) -> libc::c_int,
19834            >,
19835            libc::c_ulong,
19836        >(
19837            Some(
19838                RM_DictSet
19839                    as unsafe extern "C" fn(
19840                        *mut RedisModuleDict,
19841                        *mut robj,
19842                        *mut libc::c_void,
19843                    ) -> libc::c_int,
19844            ),
19845        ) as *mut libc::c_void,
19846    );
19847    moduleRegisterApi(
19848        b"RedisModule_DictReplace\0" as *const u8 as *const libc::c_char,
19849        core::mem::transmute::<
19850            Option::<
19851                unsafe extern "C" fn(
19852                    *mut RedisModuleDict,
19853                    *mut robj,
19854                    *mut libc::c_void,
19855                ) -> libc::c_int,
19856            >,
19857            libc::c_ulong,
19858        >(
19859            Some(
19860                RM_DictReplace
19861                    as unsafe extern "C" fn(
19862                        *mut RedisModuleDict,
19863                        *mut robj,
19864                        *mut libc::c_void,
19865                    ) -> libc::c_int,
19866            ),
19867        ) as *mut libc::c_void,
19868    );
19869    moduleRegisterApi(
19870        b"RedisModule_DictGetC\0" as *const u8 as *const libc::c_char,
19871        core::mem::transmute::<
19872            Option::<
19873                unsafe extern "C" fn(
19874                    *mut RedisModuleDict,
19875                    *mut libc::c_void,
19876                    size_t,
19877                    *mut libc::c_int,
19878                ) -> *mut libc::c_void,
19879            >,
19880            libc::c_ulong,
19881        >(
19882            Some(
19883                RM_DictGetC
19884                    as unsafe extern "C" fn(
19885                        *mut RedisModuleDict,
19886                        *mut libc::c_void,
19887                        size_t,
19888                        *mut libc::c_int,
19889                    ) -> *mut libc::c_void,
19890            ),
19891        ) as *mut libc::c_void,
19892    );
19893    moduleRegisterApi(
19894        b"RedisModule_DictGet\0" as *const u8 as *const libc::c_char,
19895        core::mem::transmute::<
19896            Option::<
19897                unsafe extern "C" fn(
19898                    *mut RedisModuleDict,
19899                    *mut robj,
19900                    *mut libc::c_int,
19901                ) -> *mut libc::c_void,
19902            >,
19903            libc::c_ulong,
19904        >(
19905            Some(
19906                RM_DictGet
19907                    as unsafe extern "C" fn(
19908                        *mut RedisModuleDict,
19909                        *mut robj,
19910                        *mut libc::c_int,
19911                    ) -> *mut libc::c_void,
19912            ),
19913        ) as *mut libc::c_void,
19914    );
19915    moduleRegisterApi(
19916        b"RedisModule_DictDelC\0" as *const u8 as *const libc::c_char,
19917        core::mem::transmute::<
19918            Option::<
19919                unsafe extern "C" fn(
19920                    *mut RedisModuleDict,
19921                    *mut libc::c_void,
19922                    size_t,
19923                    *mut libc::c_void,
19924                ) -> libc::c_int,
19925            >,
19926            libc::c_ulong,
19927        >(
19928            Some(
19929                RM_DictDelC
19930                    as unsafe extern "C" fn(
19931                        *mut RedisModuleDict,
19932                        *mut libc::c_void,
19933                        size_t,
19934                        *mut libc::c_void,
19935                    ) -> libc::c_int,
19936            ),
19937        ) as *mut libc::c_void,
19938    );
19939    moduleRegisterApi(
19940        b"RedisModule_DictDel\0" as *const u8 as *const libc::c_char,
19941        core::mem::transmute::<
19942            Option::<
19943                unsafe extern "C" fn(
19944                    *mut RedisModuleDict,
19945                    *mut robj,
19946                    *mut libc::c_void,
19947                ) -> libc::c_int,
19948            >,
19949            libc::c_ulong,
19950        >(
19951            Some(
19952                RM_DictDel
19953                    as unsafe extern "C" fn(
19954                        *mut RedisModuleDict,
19955                        *mut robj,
19956                        *mut libc::c_void,
19957                    ) -> libc::c_int,
19958            ),
19959        ) as *mut libc::c_void,
19960    );
19961    moduleRegisterApi(
19962        b"RedisModule_DictIteratorStartC\0" as *const u8 as *const libc::c_char,
19963        core::mem::transmute::<
19964            Option::<
19965                unsafe extern "C" fn(
19966                    *mut RedisModuleDict,
19967                    *const libc::c_char,
19968                    *mut libc::c_void,
19969                    size_t,
19970                ) -> *mut RedisModuleDictIter,
19971            >,
19972            libc::c_ulong,
19973        >(
19974            Some(
19975                RM_DictIteratorStartC
19976                    as unsafe extern "C" fn(
19977                        *mut RedisModuleDict,
19978                        *const libc::c_char,
19979                        *mut libc::c_void,
19980                        size_t,
19981                    ) -> *mut RedisModuleDictIter,
19982            ),
19983        ) as *mut libc::c_void,
19984    );
19985    moduleRegisterApi(
19986        b"RedisModule_DictIteratorStart\0" as *const u8 as *const libc::c_char,
19987        core::mem::transmute::<
19988            Option::<
19989                unsafe extern "C" fn(
19990                    *mut RedisModuleDict,
19991                    *const libc::c_char,
19992                    *mut robj,
19993                ) -> *mut RedisModuleDictIter,
19994            >,
19995            libc::c_ulong,
19996        >(
19997            Some(
19998                RM_DictIteratorStart
19999                    as unsafe extern "C" fn(
20000                        *mut RedisModuleDict,
20001                        *const libc::c_char,
20002                        *mut robj,
20003                    ) -> *mut RedisModuleDictIter,
20004            ),
20005        ) as *mut libc::c_void,
20006    );
20007    moduleRegisterApi(
20008        b"RedisModule_DictIteratorStop\0" as *const u8 as *const libc::c_char,
20009        core::mem::transmute::<
20010            Option::<unsafe extern "C" fn(*mut RedisModuleDictIter) -> ()>,
20011            libc::c_ulong,
20012        >(
20013            Some(
20014                RM_DictIteratorStop
20015                    as unsafe extern "C" fn(*mut RedisModuleDictIter) -> (),
20016            ),
20017        ) as *mut libc::c_void,
20018    );
20019    moduleRegisterApi(
20020        b"RedisModule_DictIteratorReseekC\0" as *const u8 as *const libc::c_char,
20021        core::mem::transmute::<
20022            Option::<
20023                unsafe extern "C" fn(
20024                    *mut RedisModuleDictIter,
20025                    *const libc::c_char,
20026                    *mut libc::c_void,
20027                    size_t,
20028                ) -> libc::c_int,
20029            >,
20030            libc::c_ulong,
20031        >(
20032            Some(
20033                RM_DictIteratorReseekC
20034                    as unsafe extern "C" fn(
20035                        *mut RedisModuleDictIter,
20036                        *const libc::c_char,
20037                        *mut libc::c_void,
20038                        size_t,
20039                    ) -> libc::c_int,
20040            ),
20041        ) as *mut libc::c_void,
20042    );
20043    moduleRegisterApi(
20044        b"RedisModule_DictIteratorReseek\0" as *const u8 as *const libc::c_char,
20045        core::mem::transmute::<
20046            Option::<
20047                unsafe extern "C" fn(
20048                    *mut RedisModuleDictIter,
20049                    *const libc::c_char,
20050                    *mut robj,
20051                ) -> libc::c_int,
20052            >,
20053            libc::c_ulong,
20054        >(
20055            Some(
20056                RM_DictIteratorReseek
20057                    as unsafe extern "C" fn(
20058                        *mut RedisModuleDictIter,
20059                        *const libc::c_char,
20060                        *mut robj,
20061                    ) -> libc::c_int,
20062            ),
20063        ) as *mut libc::c_void,
20064    );
20065    moduleRegisterApi(
20066        b"RedisModule_DictNextC\0" as *const u8 as *const libc::c_char,
20067        core::mem::transmute::<
20068            Option::<
20069                unsafe extern "C" fn(
20070                    *mut RedisModuleDictIter,
20071                    *mut size_t,
20072                    *mut *mut libc::c_void,
20073                ) -> *mut libc::c_void,
20074            >,
20075            libc::c_ulong,
20076        >(
20077            Some(
20078                RM_DictNextC
20079                    as unsafe extern "C" fn(
20080                        *mut RedisModuleDictIter,
20081                        *mut size_t,
20082                        *mut *mut libc::c_void,
20083                    ) -> *mut libc::c_void,
20084            ),
20085        ) as *mut libc::c_void,
20086    );
20087    moduleRegisterApi(
20088        b"RedisModule_DictPrevC\0" as *const u8 as *const libc::c_char,
20089        core::mem::transmute::<
20090            Option::<
20091                unsafe extern "C" fn(
20092                    *mut RedisModuleDictIter,
20093                    *mut size_t,
20094                    *mut *mut libc::c_void,
20095                ) -> *mut libc::c_void,
20096            >,
20097            libc::c_ulong,
20098        >(
20099            Some(
20100                RM_DictPrevC
20101                    as unsafe extern "C" fn(
20102                        *mut RedisModuleDictIter,
20103                        *mut size_t,
20104                        *mut *mut libc::c_void,
20105                    ) -> *mut libc::c_void,
20106            ),
20107        ) as *mut libc::c_void,
20108    );
20109    moduleRegisterApi(
20110        b"RedisModule_DictNext\0" as *const u8 as *const libc::c_char,
20111        core::mem::transmute::<
20112            Option::<
20113                unsafe extern "C" fn(
20114                    *mut RedisModuleCtx,
20115                    *mut RedisModuleDictIter,
20116                    *mut *mut libc::c_void,
20117                ) -> *mut robj,
20118            >,
20119            libc::c_ulong,
20120        >(
20121            Some(
20122                RM_DictNext
20123                    as unsafe extern "C" fn(
20124                        *mut RedisModuleCtx,
20125                        *mut RedisModuleDictIter,
20126                        *mut *mut libc::c_void,
20127                    ) -> *mut robj,
20128            ),
20129        ) as *mut libc::c_void,
20130    );
20131    moduleRegisterApi(
20132        b"RedisModule_DictPrev\0" as *const u8 as *const libc::c_char,
20133        core::mem::transmute::<
20134            Option::<
20135                unsafe extern "C" fn(
20136                    *mut RedisModuleCtx,
20137                    *mut RedisModuleDictIter,
20138                    *mut *mut libc::c_void,
20139                ) -> *mut robj,
20140            >,
20141            libc::c_ulong,
20142        >(
20143            Some(
20144                RM_DictPrev
20145                    as unsafe extern "C" fn(
20146                        *mut RedisModuleCtx,
20147                        *mut RedisModuleDictIter,
20148                        *mut *mut libc::c_void,
20149                    ) -> *mut robj,
20150            ),
20151        ) as *mut libc::c_void,
20152    );
20153    moduleRegisterApi(
20154        b"RedisModule_DictCompareC\0" as *const u8 as *const libc::c_char,
20155        core::mem::transmute::<
20156            Option::<
20157                unsafe extern "C" fn(
20158                    *mut RedisModuleDictIter,
20159                    *const libc::c_char,
20160                    *mut libc::c_void,
20161                    size_t,
20162                ) -> libc::c_int,
20163            >,
20164            libc::c_ulong,
20165        >(
20166            Some(
20167                RM_DictCompareC
20168                    as unsafe extern "C" fn(
20169                        *mut RedisModuleDictIter,
20170                        *const libc::c_char,
20171                        *mut libc::c_void,
20172                        size_t,
20173                    ) -> libc::c_int,
20174            ),
20175        ) as *mut libc::c_void,
20176    );
20177    moduleRegisterApi(
20178        b"RedisModule_DictCompare\0" as *const u8 as *const libc::c_char,
20179        core::mem::transmute::<
20180            Option::<
20181                unsafe extern "C" fn(
20182                    *mut RedisModuleDictIter,
20183                    *const libc::c_char,
20184                    *mut robj,
20185                ) -> libc::c_int,
20186            >,
20187            libc::c_ulong,
20188        >(
20189            Some(
20190                RM_DictCompare
20191                    as unsafe extern "C" fn(
20192                        *mut RedisModuleDictIter,
20193                        *const libc::c_char,
20194                        *mut robj,
20195                    ) -> libc::c_int,
20196            ),
20197        ) as *mut libc::c_void,
20198    );
20199    moduleRegisterApi(
20200        b"RedisModule_ExportSharedAPI\0" as *const u8 as *const libc::c_char,
20201        core::mem::transmute::<
20202            Option::<
20203                unsafe extern "C" fn(
20204                    *mut RedisModuleCtx,
20205                    *const libc::c_char,
20206                    *mut libc::c_void,
20207                ) -> libc::c_int,
20208            >,
20209            libc::c_ulong,
20210        >(
20211            Some(
20212                RM_ExportSharedAPI
20213                    as unsafe extern "C" fn(
20214                        *mut RedisModuleCtx,
20215                        *const libc::c_char,
20216                        *mut libc::c_void,
20217                    ) -> libc::c_int,
20218            ),
20219        ) as *mut libc::c_void,
20220    );
20221    moduleRegisterApi(
20222        b"RedisModule_GetSharedAPI\0" as *const u8 as *const libc::c_char,
20223        core::mem::transmute::<
20224            Option::<
20225                unsafe extern "C" fn(
20226                    *mut RedisModuleCtx,
20227                    *const libc::c_char,
20228                ) -> *mut libc::c_void,
20229            >,
20230            libc::c_ulong,
20231        >(
20232            Some(
20233                RM_GetSharedAPI
20234                    as unsafe extern "C" fn(
20235                        *mut RedisModuleCtx,
20236                        *const libc::c_char,
20237                    ) -> *mut libc::c_void,
20238            ),
20239        ) as *mut libc::c_void,
20240    );
20241    moduleRegisterApi(
20242        b"RedisModule_RegisterCommandFilter\0" as *const u8 as *const libc::c_char,
20243        core::mem::transmute::<
20244            Option::<
20245                unsafe extern "C" fn(
20246                    *mut RedisModuleCtx,
20247                    RedisModuleCommandFilterFunc,
20248                    libc::c_int,
20249                ) -> *mut RedisModuleCommandFilter,
20250            >,
20251            libc::c_ulong,
20252        >(
20253            Some(
20254                RM_RegisterCommandFilter
20255                    as unsafe extern "C" fn(
20256                        *mut RedisModuleCtx,
20257                        RedisModuleCommandFilterFunc,
20258                        libc::c_int,
20259                    ) -> *mut RedisModuleCommandFilter,
20260            ),
20261        ) as *mut libc::c_void,
20262    );
20263    moduleRegisterApi(
20264        b"RedisModule_UnregisterCommandFilter\0" as *const u8 as *const libc::c_char,
20265        core::mem::transmute::<
20266            Option::<
20267                unsafe extern "C" fn(
20268                    *mut RedisModuleCtx,
20269                    *mut RedisModuleCommandFilter,
20270                ) -> libc::c_int,
20271            >,
20272            libc::c_ulong,
20273        >(
20274            Some(
20275                RM_UnregisterCommandFilter
20276                    as unsafe extern "C" fn(
20277                        *mut RedisModuleCtx,
20278                        *mut RedisModuleCommandFilter,
20279                    ) -> libc::c_int,
20280            ),
20281        ) as *mut libc::c_void,
20282    );
20283    moduleRegisterApi(
20284        b"RedisModule_CommandFilterArgsCount\0" as *const u8 as *const libc::c_char,
20285        core::mem::transmute::<
20286            Option::<
20287                unsafe extern "C" fn(*mut RedisModuleCommandFilterCtx) -> libc::c_int,
20288            >,
20289            libc::c_ulong,
20290        >(
20291            Some(
20292                RM_CommandFilterArgsCount
20293                    as unsafe extern "C" fn(
20294                        *mut RedisModuleCommandFilterCtx,
20295                    ) -> libc::c_int,
20296            ),
20297        ) as *mut libc::c_void,
20298    );
20299    moduleRegisterApi(
20300        b"RedisModule_CommandFilterArgGet\0" as *const u8 as *const libc::c_char,
20301        core::mem::transmute::<
20302            Option::<
20303                unsafe extern "C" fn(
20304                    *mut RedisModuleCommandFilterCtx,
20305                    libc::c_int,
20306                ) -> *mut robj,
20307            >,
20308            libc::c_ulong,
20309        >(
20310            Some(
20311                RM_CommandFilterArgGet
20312                    as unsafe extern "C" fn(
20313                        *mut RedisModuleCommandFilterCtx,
20314                        libc::c_int,
20315                    ) -> *mut robj,
20316            ),
20317        ) as *mut libc::c_void,
20318    );
20319    moduleRegisterApi(
20320        b"RedisModule_CommandFilterArgInsert\0" as *const u8 as *const libc::c_char,
20321        core::mem::transmute::<
20322            Option::<
20323                unsafe extern "C" fn(
20324                    *mut RedisModuleCommandFilterCtx,
20325                    libc::c_int,
20326                    *mut robj,
20327                ) -> libc::c_int,
20328            >,
20329            libc::c_ulong,
20330        >(
20331            Some(
20332                RM_CommandFilterArgInsert
20333                    as unsafe extern "C" fn(
20334                        *mut RedisModuleCommandFilterCtx,
20335                        libc::c_int,
20336                        *mut robj,
20337                    ) -> libc::c_int,
20338            ),
20339        ) as *mut libc::c_void,
20340    );
20341    moduleRegisterApi(
20342        b"RedisModule_CommandFilterArgReplace\0" as *const u8 as *const libc::c_char,
20343        core::mem::transmute::<
20344            Option::<
20345                unsafe extern "C" fn(
20346                    *mut RedisModuleCommandFilterCtx,
20347                    libc::c_int,
20348                    *mut robj,
20349                ) -> libc::c_int,
20350            >,
20351            libc::c_ulong,
20352        >(
20353            Some(
20354                RM_CommandFilterArgReplace
20355                    as unsafe extern "C" fn(
20356                        *mut RedisModuleCommandFilterCtx,
20357                        libc::c_int,
20358                        *mut robj,
20359                    ) -> libc::c_int,
20360            ),
20361        ) as *mut libc::c_void,
20362    );
20363    moduleRegisterApi(
20364        b"RedisModule_CommandFilterArgDelete\0" as *const u8 as *const libc::c_char,
20365        core::mem::transmute::<
20366            Option::<
20367                unsafe extern "C" fn(
20368                    *mut RedisModuleCommandFilterCtx,
20369                    libc::c_int,
20370                ) -> libc::c_int,
20371            >,
20372            libc::c_ulong,
20373        >(
20374            Some(
20375                RM_CommandFilterArgDelete
20376                    as unsafe extern "C" fn(
20377                        *mut RedisModuleCommandFilterCtx,
20378                        libc::c_int,
20379                    ) -> libc::c_int,
20380            ),
20381        ) as *mut libc::c_void,
20382    );
20383    moduleRegisterApi(
20384        b"RedisModule_Fork\0" as *const u8 as *const libc::c_char,
20385        core::mem::transmute::<
20386            Option::<
20387                unsafe extern "C" fn(
20388                    RedisModuleForkDoneHandler,
20389                    *mut libc::c_void,
20390                ) -> libc::c_int,
20391            >,
20392            libc::c_ulong,
20393        >(
20394            Some(
20395                RM_Fork
20396                    as unsafe extern "C" fn(
20397                        RedisModuleForkDoneHandler,
20398                        *mut libc::c_void,
20399                    ) -> libc::c_int,
20400            ),
20401        ) as *mut libc::c_void,
20402    );
20403    moduleRegisterApi(
20404        b"RedisModule_SendChildHeartbeat\0" as *const u8 as *const libc::c_char,
20405        core::mem::transmute::<
20406            Option::<unsafe extern "C" fn(libc::c_double) -> ()>,
20407            libc::c_ulong,
20408        >(Some(RM_SendChildHeartbeat as unsafe extern "C" fn(libc::c_double) -> ()))
20409            as *mut libc::c_void,
20410    );
20411    moduleRegisterApi(
20412        b"RedisModule_ExitFromChild\0" as *const u8 as *const libc::c_char,
20413        core::mem::transmute::<
20414            Option::<unsafe extern "C" fn(libc::c_int) -> libc::c_int>,
20415            libc::c_ulong,
20416        >(Some(RM_ExitFromChild as unsafe extern "C" fn(libc::c_int) -> libc::c_int))
20417            as *mut libc::c_void,
20418    );
20419    moduleRegisterApi(
20420        b"RedisModule_KillForkChild\0" as *const u8 as *const libc::c_char,
20421        core::mem::transmute::<
20422            Option::<unsafe extern "C" fn(libc::c_int) -> libc::c_int>,
20423            libc::c_ulong,
20424        >(Some(RM_KillForkChild as unsafe extern "C" fn(libc::c_int) -> libc::c_int))
20425            as *mut libc::c_void,
20426    );
20427    moduleRegisterApi(
20428        b"RedisModule_RegisterInfoFunc\0" as *const u8 as *const libc::c_char,
20429        core::mem::transmute::<
20430            Option::<
20431                unsafe extern "C" fn(
20432                    *mut RedisModuleCtx,
20433                    RedisModuleInfoFunc,
20434                ) -> libc::c_int,
20435            >,
20436            libc::c_ulong,
20437        >(
20438            Some(
20439                RM_RegisterInfoFunc
20440                    as unsafe extern "C" fn(
20441                        *mut RedisModuleCtx,
20442                        RedisModuleInfoFunc,
20443                    ) -> libc::c_int,
20444            ),
20445        ) as *mut libc::c_void,
20446    );
20447    moduleRegisterApi(
20448        b"RedisModule_InfoAddSection\0" as *const u8 as *const libc::c_char,
20449        core::mem::transmute::<
20450            Option::<
20451                unsafe extern "C" fn(
20452                    *mut RedisModuleInfoCtx,
20453                    *const libc::c_char,
20454                ) -> libc::c_int,
20455            >,
20456            libc::c_ulong,
20457        >(
20458            Some(
20459                RM_InfoAddSection
20460                    as unsafe extern "C" fn(
20461                        *mut RedisModuleInfoCtx,
20462                        *const libc::c_char,
20463                    ) -> libc::c_int,
20464            ),
20465        ) as *mut libc::c_void,
20466    );
20467    moduleRegisterApi(
20468        b"RedisModule_InfoBeginDictField\0" as *const u8 as *const libc::c_char,
20469        core::mem::transmute::<
20470            Option::<
20471                unsafe extern "C" fn(
20472                    *mut RedisModuleInfoCtx,
20473                    *const libc::c_char,
20474                ) -> libc::c_int,
20475            >,
20476            libc::c_ulong,
20477        >(
20478            Some(
20479                RM_InfoBeginDictField
20480                    as unsafe extern "C" fn(
20481                        *mut RedisModuleInfoCtx,
20482                        *const libc::c_char,
20483                    ) -> libc::c_int,
20484            ),
20485        ) as *mut libc::c_void,
20486    );
20487    moduleRegisterApi(
20488        b"RedisModule_InfoEndDictField\0" as *const u8 as *const libc::c_char,
20489        core::mem::transmute::<
20490            Option::<unsafe extern "C" fn(*mut RedisModuleInfoCtx) -> libc::c_int>,
20491            libc::c_ulong,
20492        >(
20493            Some(
20494                RM_InfoEndDictField
20495                    as unsafe extern "C" fn(*mut RedisModuleInfoCtx) -> libc::c_int,
20496            ),
20497        ) as *mut libc::c_void,
20498    );
20499    moduleRegisterApi(
20500        b"RedisModule_InfoAddFieldString\0" as *const u8 as *const libc::c_char,
20501        core::mem::transmute::<
20502            Option::<
20503                unsafe extern "C" fn(
20504                    *mut RedisModuleInfoCtx,
20505                    *const libc::c_char,
20506                    *mut robj,
20507                ) -> libc::c_int,
20508            >,
20509            libc::c_ulong,
20510        >(
20511            Some(
20512                RM_InfoAddFieldString
20513                    as unsafe extern "C" fn(
20514                        *mut RedisModuleInfoCtx,
20515                        *const libc::c_char,
20516                        *mut robj,
20517                    ) -> libc::c_int,
20518            ),
20519        ) as *mut libc::c_void,
20520    );
20521    moduleRegisterApi(
20522        b"RedisModule_InfoAddFieldCString\0" as *const u8 as *const libc::c_char,
20523        core::mem::transmute::<
20524            Option::<
20525                unsafe extern "C" fn(
20526                    *mut RedisModuleInfoCtx,
20527                    *const libc::c_char,
20528                    *const libc::c_char,
20529                ) -> libc::c_int,
20530            >,
20531            libc::c_ulong,
20532        >(
20533            Some(
20534                RM_InfoAddFieldCString
20535                    as unsafe extern "C" fn(
20536                        *mut RedisModuleInfoCtx,
20537                        *const libc::c_char,
20538                        *const libc::c_char,
20539                    ) -> libc::c_int,
20540            ),
20541        ) as *mut libc::c_void,
20542    );
20543    moduleRegisterApi(
20544        b"RedisModule_InfoAddFieldDouble\0" as *const u8 as *const libc::c_char,
20545        core::mem::transmute::<
20546            Option::<
20547                unsafe extern "C" fn(
20548                    *mut RedisModuleInfoCtx,
20549                    *const libc::c_char,
20550                    libc::c_double,
20551                ) -> libc::c_int,
20552            >,
20553            libc::c_ulong,
20554        >(
20555            Some(
20556                RM_InfoAddFieldDouble
20557                    as unsafe extern "C" fn(
20558                        *mut RedisModuleInfoCtx,
20559                        *const libc::c_char,
20560                        libc::c_double,
20561                    ) -> libc::c_int,
20562            ),
20563        ) as *mut libc::c_void,
20564    );
20565    moduleRegisterApi(
20566        b"RedisModule_InfoAddFieldLongLong\0" as *const u8 as *const libc::c_char,
20567        core::mem::transmute::<
20568            Option::<
20569                unsafe extern "C" fn(
20570                    *mut RedisModuleInfoCtx,
20571                    *const libc::c_char,
20572                    libc::c_longlong,
20573                ) -> libc::c_int,
20574            >,
20575            libc::c_ulong,
20576        >(
20577            Some(
20578                RM_InfoAddFieldLongLong
20579                    as unsafe extern "C" fn(
20580                        *mut RedisModuleInfoCtx,
20581                        *const libc::c_char,
20582                        libc::c_longlong,
20583                    ) -> libc::c_int,
20584            ),
20585        ) as *mut libc::c_void,
20586    );
20587    moduleRegisterApi(
20588        b"RedisModule_InfoAddFieldULongLong\0" as *const u8 as *const libc::c_char,
20589        core::mem::transmute::<
20590            Option::<
20591                unsafe extern "C" fn(
20592                    *mut RedisModuleInfoCtx,
20593                    *const libc::c_char,
20594                    libc::c_ulonglong,
20595                ) -> libc::c_int,
20596            >,
20597            libc::c_ulong,
20598        >(
20599            Some(
20600                RM_InfoAddFieldULongLong
20601                    as unsafe extern "C" fn(
20602                        *mut RedisModuleInfoCtx,
20603                        *const libc::c_char,
20604                        libc::c_ulonglong,
20605                    ) -> libc::c_int,
20606            ),
20607        ) as *mut libc::c_void,
20608    );
20609    moduleRegisterApi(
20610        b"RedisModule_GetServerInfo\0" as *const u8 as *const libc::c_char,
20611        core::mem::transmute::<
20612            Option::<
20613                unsafe extern "C" fn(
20614                    *mut RedisModuleCtx,
20615                    *const libc::c_char,
20616                ) -> *mut RedisModuleServerInfoData,
20617            >,
20618            libc::c_ulong,
20619        >(
20620            Some(
20621                RM_GetServerInfo
20622                    as unsafe extern "C" fn(
20623                        *mut RedisModuleCtx,
20624                        *const libc::c_char,
20625                    ) -> *mut RedisModuleServerInfoData,
20626            ),
20627        ) as *mut libc::c_void,
20628    );
20629    moduleRegisterApi(
20630        b"RedisModule_FreeServerInfo\0" as *const u8 as *const libc::c_char,
20631        core::mem::transmute::<
20632            Option::<
20633                unsafe extern "C" fn(
20634                    *mut RedisModuleCtx,
20635                    *mut RedisModuleServerInfoData,
20636                ) -> (),
20637            >,
20638            libc::c_ulong,
20639        >(
20640            Some(
20641                RM_FreeServerInfo
20642                    as unsafe extern "C" fn(
20643                        *mut RedisModuleCtx,
20644                        *mut RedisModuleServerInfoData,
20645                    ) -> (),
20646            ),
20647        ) as *mut libc::c_void,
20648    );
20649    moduleRegisterApi(
20650        b"RedisModule_ServerInfoGetField\0" as *const u8 as *const libc::c_char,
20651        core::mem::transmute::<
20652            Option::<
20653                unsafe extern "C" fn(
20654                    *mut RedisModuleCtx,
20655                    *mut RedisModuleServerInfoData,
20656                    *const libc::c_char,
20657                ) -> *mut robj,
20658            >,
20659            libc::c_ulong,
20660        >(
20661            Some(
20662                RM_ServerInfoGetField
20663                    as unsafe extern "C" fn(
20664                        *mut RedisModuleCtx,
20665                        *mut RedisModuleServerInfoData,
20666                        *const libc::c_char,
20667                    ) -> *mut robj,
20668            ),
20669        ) as *mut libc::c_void,
20670    );
20671    moduleRegisterApi(
20672        b"RedisModule_ServerInfoGetFieldC\0" as *const u8 as *const libc::c_char,
20673        core::mem::transmute::<
20674            Option::<
20675                unsafe extern "C" fn(
20676                    *mut RedisModuleServerInfoData,
20677                    *const libc::c_char,
20678                ) -> *const libc::c_char,
20679            >,
20680            libc::c_ulong,
20681        >(
20682            Some(
20683                RM_ServerInfoGetFieldC
20684                    as unsafe extern "C" fn(
20685                        *mut RedisModuleServerInfoData,
20686                        *const libc::c_char,
20687                    ) -> *const libc::c_char,
20688            ),
20689        ) as *mut libc::c_void,
20690    );
20691    moduleRegisterApi(
20692        b"RedisModule_ServerInfoGetFieldSigned\0" as *const u8 as *const libc::c_char,
20693        core::mem::transmute::<
20694            Option::<
20695                unsafe extern "C" fn(
20696                    *mut RedisModuleServerInfoData,
20697                    *const libc::c_char,
20698                    *mut libc::c_int,
20699                ) -> libc::c_longlong,
20700            >,
20701            libc::c_ulong,
20702        >(
20703            Some(
20704                RM_ServerInfoGetFieldSigned
20705                    as unsafe extern "C" fn(
20706                        *mut RedisModuleServerInfoData,
20707                        *const libc::c_char,
20708                        *mut libc::c_int,
20709                    ) -> libc::c_longlong,
20710            ),
20711        ) as *mut libc::c_void,
20712    );
20713    moduleRegisterApi(
20714        b"RedisModule_ServerInfoGetFieldUnsigned\0" as *const u8 as *const libc::c_char,
20715        core::mem::transmute::<
20716            Option::<
20717                unsafe extern "C" fn(
20718                    *mut RedisModuleServerInfoData,
20719                    *const libc::c_char,
20720                    *mut libc::c_int,
20721                ) -> libc::c_ulonglong,
20722            >,
20723            libc::c_ulong,
20724        >(
20725            Some(
20726                RM_ServerInfoGetFieldUnsigned
20727                    as unsafe extern "C" fn(
20728                        *mut RedisModuleServerInfoData,
20729                        *const libc::c_char,
20730                        *mut libc::c_int,
20731                    ) -> libc::c_ulonglong,
20732            ),
20733        ) as *mut libc::c_void,
20734    );
20735    moduleRegisterApi(
20736        b"RedisModule_ServerInfoGetFieldDouble\0" as *const u8 as *const libc::c_char,
20737        core::mem::transmute::<
20738            Option::<
20739                unsafe extern "C" fn(
20740                    *mut RedisModuleServerInfoData,
20741                    *const libc::c_char,
20742                    *mut libc::c_int,
20743                ) -> libc::c_double,
20744            >,
20745            libc::c_ulong,
20746        >(
20747            Some(
20748                RM_ServerInfoGetFieldDouble
20749                    as unsafe extern "C" fn(
20750                        *mut RedisModuleServerInfoData,
20751                        *const libc::c_char,
20752                        *mut libc::c_int,
20753                    ) -> libc::c_double,
20754            ),
20755        ) as *mut libc::c_void,
20756    );
20757    moduleRegisterApi(
20758        b"RedisModule_GetClientInfoById\0" as *const u8 as *const libc::c_char,
20759        core::mem::transmute::<
20760            Option::<unsafe extern "C" fn(*mut libc::c_void, uint64_t) -> libc::c_int>,
20761            libc::c_ulong,
20762        >(
20763            Some(
20764                RM_GetClientInfoById
20765                    as unsafe extern "C" fn(*mut libc::c_void, uint64_t) -> libc::c_int,
20766            ),
20767        ) as *mut libc::c_void,
20768    );
20769    moduleRegisterApi(
20770        b"RedisModule_GetClientNameById\0" as *const u8 as *const libc::c_char,
20771        core::mem::transmute::<
20772            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> *mut robj>,
20773            libc::c_ulong,
20774        >(
20775            Some(
20776                RM_GetClientNameById
20777                    as unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> *mut robj,
20778            ),
20779        ) as *mut libc::c_void,
20780    );
20781    moduleRegisterApi(
20782        b"RedisModule_SetClientNameById\0" as *const u8 as *const libc::c_char,
20783        core::mem::transmute::<
20784            Option::<unsafe extern "C" fn(uint64_t, *mut robj) -> libc::c_int>,
20785            libc::c_ulong,
20786        >(
20787            Some(
20788                RM_SetClientNameById
20789                    as unsafe extern "C" fn(uint64_t, *mut robj) -> libc::c_int,
20790            ),
20791        ) as *mut libc::c_void,
20792    );
20793    moduleRegisterApi(
20794        b"RedisModule_PublishMessage\0" as *const u8 as *const libc::c_char,
20795        core::mem::transmute::<
20796            Option::<
20797                unsafe extern "C" fn(
20798                    *mut RedisModuleCtx,
20799                    *mut robj,
20800                    *mut robj,
20801                ) -> libc::c_int,
20802            >,
20803            libc::c_ulong,
20804        >(
20805            Some(
20806                RM_PublishMessage
20807                    as unsafe extern "C" fn(
20808                        *mut RedisModuleCtx,
20809                        *mut robj,
20810                        *mut robj,
20811                    ) -> libc::c_int,
20812            ),
20813        ) as *mut libc::c_void,
20814    );
20815    moduleRegisterApi(
20816        b"RedisModule_PublishMessageShard\0" as *const u8 as *const libc::c_char,
20817        core::mem::transmute::<
20818            Option::<
20819                unsafe extern "C" fn(
20820                    *mut RedisModuleCtx,
20821                    *mut robj,
20822                    *mut robj,
20823                ) -> libc::c_int,
20824            >,
20825            libc::c_ulong,
20826        >(
20827            Some(
20828                RM_PublishMessageShard
20829                    as unsafe extern "C" fn(
20830                        *mut RedisModuleCtx,
20831                        *mut robj,
20832                        *mut robj,
20833                    ) -> libc::c_int,
20834            ),
20835        ) as *mut libc::c_void,
20836    );
20837    moduleRegisterApi(
20838        b"RedisModule_SubscribeToServerEvent\0" as *const u8 as *const libc::c_char,
20839        core::mem::transmute::<
20840            Option::<
20841                unsafe extern "C" fn(
20842                    *mut RedisModuleCtx,
20843                    RedisModuleEvent,
20844                    RedisModuleEventCallback,
20845                ) -> libc::c_int,
20846            >,
20847            libc::c_ulong,
20848        >(
20849            Some(
20850                RM_SubscribeToServerEvent
20851                    as unsafe extern "C" fn(
20852                        *mut RedisModuleCtx,
20853                        RedisModuleEvent,
20854                        RedisModuleEventCallback,
20855                    ) -> libc::c_int,
20856            ),
20857        ) as *mut libc::c_void,
20858    );
20859    moduleRegisterApi(
20860        b"RedisModule_SetLRU\0" as *const u8 as *const libc::c_char,
20861        core::mem::transmute::<
20862            Option::<unsafe extern "C" fn(*mut RedisModuleKey, mstime_t) -> libc::c_int>,
20863            libc::c_ulong,
20864        >(
20865            Some(
20866                RM_SetLRU
20867                    as unsafe extern "C" fn(*mut RedisModuleKey, mstime_t) -> libc::c_int,
20868            ),
20869        ) as *mut libc::c_void,
20870    );
20871    moduleRegisterApi(
20872        b"RedisModule_GetLRU\0" as *const u8 as *const libc::c_char,
20873        core::mem::transmute::<
20874            Option::<
20875                unsafe extern "C" fn(*mut RedisModuleKey, *mut mstime_t) -> libc::c_int,
20876            >,
20877            libc::c_ulong,
20878        >(
20879            Some(
20880                RM_GetLRU
20881                    as unsafe extern "C" fn(
20882                        *mut RedisModuleKey,
20883                        *mut mstime_t,
20884                    ) -> libc::c_int,
20885            ),
20886        ) as *mut libc::c_void,
20887    );
20888    moduleRegisterApi(
20889        b"RedisModule_SetLFU\0" as *const u8 as *const libc::c_char,
20890        core::mem::transmute::<
20891            Option::<
20892                unsafe extern "C" fn(
20893                    *mut RedisModuleKey,
20894                    libc::c_longlong,
20895                ) -> libc::c_int,
20896            >,
20897            libc::c_ulong,
20898        >(
20899            Some(
20900                RM_SetLFU
20901                    as unsafe extern "C" fn(
20902                        *mut RedisModuleKey,
20903                        libc::c_longlong,
20904                    ) -> libc::c_int,
20905            ),
20906        ) as *mut libc::c_void,
20907    );
20908    moduleRegisterApi(
20909        b"RedisModule_GetLFU\0" as *const u8 as *const libc::c_char,
20910        core::mem::transmute::<
20911            Option::<
20912                unsafe extern "C" fn(
20913                    *mut RedisModuleKey,
20914                    *mut libc::c_longlong,
20915                ) -> libc::c_int,
20916            >,
20917            libc::c_ulong,
20918        >(
20919            Some(
20920                RM_GetLFU
20921                    as unsafe extern "C" fn(
20922                        *mut RedisModuleKey,
20923                        *mut libc::c_longlong,
20924                    ) -> libc::c_int,
20925            ),
20926        ) as *mut libc::c_void,
20927    );
20928    moduleRegisterApi(
20929        b"RedisModule_BlockClientOnKeys\0" as *const u8 as *const libc::c_char,
20930        core::mem::transmute::<
20931            Option::<
20932                unsafe extern "C" fn(
20933                    *mut RedisModuleCtx,
20934                    RedisModuleCmdFunc,
20935                    RedisModuleCmdFunc,
20936                    Option::<
20937                        unsafe extern "C" fn(
20938                            *mut RedisModuleCtx,
20939                            *mut libc::c_void,
20940                        ) -> (),
20941                    >,
20942                    libc::c_longlong,
20943                    *mut *mut robj,
20944                    libc::c_int,
20945                    *mut libc::c_void,
20946                ) -> *mut RedisModuleBlockedClient,
20947            >,
20948            libc::c_ulong,
20949        >(
20950            Some(
20951                RM_BlockClientOnKeys
20952                    as unsafe extern "C" fn(
20953                        *mut RedisModuleCtx,
20954                        RedisModuleCmdFunc,
20955                        RedisModuleCmdFunc,
20956                        Option::<
20957                            unsafe extern "C" fn(
20958                                *mut RedisModuleCtx,
20959                                *mut libc::c_void,
20960                            ) -> (),
20961                        >,
20962                        libc::c_longlong,
20963                        *mut *mut robj,
20964                        libc::c_int,
20965                        *mut libc::c_void,
20966                    ) -> *mut RedisModuleBlockedClient,
20967            ),
20968        ) as *mut libc::c_void,
20969    );
20970    moduleRegisterApi(
20971        b"RedisModule_SignalKeyAsReady\0" as *const u8 as *const libc::c_char,
20972        core::mem::transmute::<
20973            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> ()>,
20974            libc::c_ulong,
20975        >(
20976            Some(
20977                RM_SignalKeyAsReady
20978                    as unsafe extern "C" fn(*mut RedisModuleCtx, *mut robj) -> (),
20979            ),
20980        ) as *mut libc::c_void,
20981    );
20982    moduleRegisterApi(
20983        b"RedisModule_GetBlockedClientReadyKey\0" as *const u8 as *const libc::c_char,
20984        core::mem::transmute::<
20985            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut robj>,
20986            libc::c_ulong,
20987        >(
20988            Some(
20989                RM_GetBlockedClientReadyKey
20990                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut robj,
20991            ),
20992        ) as *mut libc::c_void,
20993    );
20994    moduleRegisterApi(
20995        b"RedisModule_GetUsedMemoryRatio\0" as *const u8 as *const libc::c_char,
20996        core::mem::transmute::<
20997            Option::<unsafe extern "C" fn() -> libc::c_float>,
20998            libc::c_ulong,
20999        >(
21000            Some(
21001                core::mem::transmute::<
21002                    unsafe extern "C" fn() -> libc::c_float,
21003                    unsafe extern "C" fn() -> libc::c_float,
21004                >(RM_GetUsedMemoryRatio),
21005            ),
21006        ) as *mut libc::c_void,
21007    );
21008    moduleRegisterApi(
21009        b"RedisModule_MallocSize\0" as *const u8 as *const libc::c_char,
21010        core::mem::transmute::<
21011            Option::<unsafe extern "C" fn(*mut libc::c_void) -> size_t>,
21012            libc::c_ulong,
21013        >(Some(RM_MallocSize as unsafe extern "C" fn(*mut libc::c_void) -> size_t))
21014            as *mut libc::c_void,
21015    );
21016    moduleRegisterApi(
21017        b"RedisModule_MallocUsableSize\0" as *const u8 as *const libc::c_char,
21018        core::mem::transmute::<
21019            Option::<unsafe extern "C" fn(*mut libc::c_void) -> size_t>,
21020            libc::c_ulong,
21021        >(Some(RM_MallocUsableSize as unsafe extern "C" fn(*mut libc::c_void) -> size_t))
21022            as *mut libc::c_void,
21023    );
21024    moduleRegisterApi(
21025        b"RedisModule_MallocSizeString\0" as *const u8 as *const libc::c_char,
21026        core::mem::transmute::<
21027            Option::<unsafe extern "C" fn(*mut robj) -> size_t>,
21028            libc::c_ulong,
21029        >(Some(RM_MallocSizeString as unsafe extern "C" fn(*mut robj) -> size_t))
21030            as *mut libc::c_void,
21031    );
21032    moduleRegisterApi(
21033        b"RedisModule_MallocSizeDict\0" as *const u8 as *const libc::c_char,
21034        core::mem::transmute::<
21035            Option::<unsafe extern "C" fn(*mut RedisModuleDict) -> size_t>,
21036            libc::c_ulong,
21037        >(
21038            Some(
21039                RM_MallocSizeDict as unsafe extern "C" fn(*mut RedisModuleDict) -> size_t,
21040            ),
21041        ) as *mut libc::c_void,
21042    );
21043    moduleRegisterApi(
21044        b"RedisModule_ScanCursorCreate\0" as *const u8 as *const libc::c_char,
21045        core::mem::transmute::<
21046            Option::<unsafe extern "C" fn() -> *mut RedisModuleScanCursor>,
21047            libc::c_ulong,
21048        >(
21049            Some(
21050                core::mem::transmute::<
21051                    unsafe extern "C" fn() -> *mut RedisModuleScanCursor,
21052                    unsafe extern "C" fn() -> *mut RedisModuleScanCursor,
21053                >(RM_ScanCursorCreate),
21054            ),
21055        ) as *mut libc::c_void,
21056    );
21057    moduleRegisterApi(
21058        b"RedisModule_ScanCursorDestroy\0" as *const u8 as *const libc::c_char,
21059        core::mem::transmute::<
21060            Option::<unsafe extern "C" fn(*mut RedisModuleScanCursor) -> ()>,
21061            libc::c_ulong,
21062        >(
21063            Some(
21064                RM_ScanCursorDestroy
21065                    as unsafe extern "C" fn(*mut RedisModuleScanCursor) -> (),
21066            ),
21067        ) as *mut libc::c_void,
21068    );
21069    moduleRegisterApi(
21070        b"RedisModule_ScanCursorRestart\0" as *const u8 as *const libc::c_char,
21071        core::mem::transmute::<
21072            Option::<unsafe extern "C" fn(*mut RedisModuleScanCursor) -> ()>,
21073            libc::c_ulong,
21074        >(
21075            Some(
21076                RM_ScanCursorRestart
21077                    as unsafe extern "C" fn(*mut RedisModuleScanCursor) -> (),
21078            ),
21079        ) as *mut libc::c_void,
21080    );
21081    moduleRegisterApi(
21082        b"RedisModule_Scan\0" as *const u8 as *const libc::c_char,
21083        core::mem::transmute::<
21084            Option::<
21085                unsafe extern "C" fn(
21086                    *mut RedisModuleCtx,
21087                    *mut RedisModuleScanCursor,
21088                    RedisModuleScanCB,
21089                    *mut libc::c_void,
21090                ) -> libc::c_int,
21091            >,
21092            libc::c_ulong,
21093        >(
21094            Some(
21095                RM_Scan
21096                    as unsafe extern "C" fn(
21097                        *mut RedisModuleCtx,
21098                        *mut RedisModuleScanCursor,
21099                        RedisModuleScanCB,
21100                        *mut libc::c_void,
21101                    ) -> libc::c_int,
21102            ),
21103        ) as *mut libc::c_void,
21104    );
21105    moduleRegisterApi(
21106        b"RedisModule_ScanKey\0" as *const u8 as *const libc::c_char,
21107        core::mem::transmute::<
21108            Option::<
21109                unsafe extern "C" fn(
21110                    *mut RedisModuleKey,
21111                    *mut RedisModuleScanCursor,
21112                    RedisModuleScanKeyCB,
21113                    *mut libc::c_void,
21114                ) -> libc::c_int,
21115            >,
21116            libc::c_ulong,
21117        >(
21118            Some(
21119                RM_ScanKey
21120                    as unsafe extern "C" fn(
21121                        *mut RedisModuleKey,
21122                        *mut RedisModuleScanCursor,
21123                        RedisModuleScanKeyCB,
21124                        *mut libc::c_void,
21125                    ) -> libc::c_int,
21126            ),
21127        ) as *mut libc::c_void,
21128    );
21129    moduleRegisterApi(
21130        b"RedisModule_CreateModuleUser\0" as *const u8 as *const libc::c_char,
21131        core::mem::transmute::<
21132            Option::<unsafe extern "C" fn(*const libc::c_char) -> *mut RedisModuleUser>,
21133            libc::c_ulong,
21134        >(
21135            Some(
21136                RM_CreateModuleUser
21137                    as unsafe extern "C" fn(*const libc::c_char) -> *mut RedisModuleUser,
21138            ),
21139        ) as *mut libc::c_void,
21140    );
21141    moduleRegisterApi(
21142        b"RedisModule_SetContextUser\0" as *const u8 as *const libc::c_char,
21143        core::mem::transmute::<
21144            Option::<
21145                unsafe extern "C" fn(*mut RedisModuleCtx, *const RedisModuleUser) -> (),
21146            >,
21147            libc::c_ulong,
21148        >(
21149            Some(
21150                RM_SetContextUser
21151                    as unsafe extern "C" fn(
21152                        *mut RedisModuleCtx,
21153                        *const RedisModuleUser,
21154                    ) -> (),
21155            ),
21156        ) as *mut libc::c_void,
21157    );
21158    moduleRegisterApi(
21159        b"RedisModule_SetModuleUserACL\0" as *const u8 as *const libc::c_char,
21160        core::mem::transmute::<
21161            Option::<
21162                unsafe extern "C" fn(
21163                    *mut RedisModuleUser,
21164                    *const libc::c_char,
21165                ) -> libc::c_int,
21166            >,
21167            libc::c_ulong,
21168        >(
21169            Some(
21170                RM_SetModuleUserACL
21171                    as unsafe extern "C" fn(
21172                        *mut RedisModuleUser,
21173                        *const libc::c_char,
21174                    ) -> libc::c_int,
21175            ),
21176        ) as *mut libc::c_void,
21177    );
21178    moduleRegisterApi(
21179        b"RedisModule_SetModuleUserACLString\0" as *const u8 as *const libc::c_char,
21180        core::mem::transmute::<
21181            Option::<
21182                unsafe extern "C" fn(
21183                    *mut RedisModuleCtx,
21184                    *mut RedisModuleUser,
21185                    *const libc::c_char,
21186                    *mut *mut robj,
21187                ) -> libc::c_int,
21188            >,
21189            libc::c_ulong,
21190        >(
21191            Some(
21192                RM_SetModuleUserACLString
21193                    as unsafe extern "C" fn(
21194                        *mut RedisModuleCtx,
21195                        *mut RedisModuleUser,
21196                        *const libc::c_char,
21197                        *mut *mut robj,
21198                    ) -> libc::c_int,
21199            ),
21200        ) as *mut libc::c_void,
21201    );
21202    moduleRegisterApi(
21203        b"RedisModule_GetModuleUserACLString\0" as *const u8 as *const libc::c_char,
21204        core::mem::transmute::<
21205            Option::<unsafe extern "C" fn(*mut RedisModuleUser) -> *mut robj>,
21206            libc::c_ulong,
21207        >(
21208            Some(
21209                RM_GetModuleUserACLString
21210                    as unsafe extern "C" fn(*mut RedisModuleUser) -> *mut robj,
21211            ),
21212        ) as *mut libc::c_void,
21213    );
21214    moduleRegisterApi(
21215        b"RedisModule_GetCurrentUserName\0" as *const u8 as *const libc::c_char,
21216        core::mem::transmute::<
21217            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut robj>,
21218            libc::c_ulong,
21219        >(
21220            Some(
21221                RM_GetCurrentUserName
21222                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> *mut robj,
21223            ),
21224        ) as *mut libc::c_void,
21225    );
21226    moduleRegisterApi(
21227        b"RedisModule_GetModuleUserFromUserName\0" as *const u8 as *const libc::c_char,
21228        core::mem::transmute::<
21229            Option::<unsafe extern "C" fn(*mut robj) -> *mut RedisModuleUser>,
21230            libc::c_ulong,
21231        >(
21232            Some(
21233                RM_GetModuleUserFromUserName
21234                    as unsafe extern "C" fn(*mut robj) -> *mut RedisModuleUser,
21235            ),
21236        ) as *mut libc::c_void,
21237    );
21238    moduleRegisterApi(
21239        b"RedisModule_ACLCheckCommandPermissions\0" as *const u8 as *const libc::c_char,
21240        core::mem::transmute::<
21241            Option::<
21242                unsafe extern "C" fn(
21243                    *mut RedisModuleUser,
21244                    *mut *mut robj,
21245                    libc::c_int,
21246                ) -> libc::c_int,
21247            >,
21248            libc::c_ulong,
21249        >(
21250            Some(
21251                RM_ACLCheckCommandPermissions
21252                    as unsafe extern "C" fn(
21253                        *mut RedisModuleUser,
21254                        *mut *mut robj,
21255                        libc::c_int,
21256                    ) -> libc::c_int,
21257            ),
21258        ) as *mut libc::c_void,
21259    );
21260    moduleRegisterApi(
21261        b"RedisModule_ACLCheckKeyPermissions\0" as *const u8 as *const libc::c_char,
21262        core::mem::transmute::<
21263            Option::<
21264                unsafe extern "C" fn(
21265                    *mut RedisModuleUser,
21266                    *mut robj,
21267                    libc::c_int,
21268                ) -> libc::c_int,
21269            >,
21270            libc::c_ulong,
21271        >(
21272            Some(
21273                RM_ACLCheckKeyPermissions
21274                    as unsafe extern "C" fn(
21275                        *mut RedisModuleUser,
21276                        *mut robj,
21277                        libc::c_int,
21278                    ) -> libc::c_int,
21279            ),
21280        ) as *mut libc::c_void,
21281    );
21282    moduleRegisterApi(
21283        b"RedisModule_ACLCheckChannelPermissions\0" as *const u8 as *const libc::c_char,
21284        core::mem::transmute::<
21285            Option::<
21286                unsafe extern "C" fn(
21287                    *mut RedisModuleUser,
21288                    *mut robj,
21289                    libc::c_int,
21290                ) -> libc::c_int,
21291            >,
21292            libc::c_ulong,
21293        >(
21294            Some(
21295                RM_ACLCheckChannelPermissions
21296                    as unsafe extern "C" fn(
21297                        *mut RedisModuleUser,
21298                        *mut robj,
21299                        libc::c_int,
21300                    ) -> libc::c_int,
21301            ),
21302        ) as *mut libc::c_void,
21303    );
21304    moduleRegisterApi(
21305        b"RedisModule_ACLAddLogEntry\0" as *const u8 as *const libc::c_char,
21306        core::mem::transmute::<
21307            Option::<
21308                unsafe extern "C" fn(
21309                    *mut RedisModuleCtx,
21310                    *mut RedisModuleUser,
21311                    *mut robj,
21312                    RedisModuleACLLogEntryReason,
21313                ) -> libc::c_int,
21314            >,
21315            libc::c_ulong,
21316        >(
21317            Some(
21318                RM_ACLAddLogEntry
21319                    as unsafe extern "C" fn(
21320                        *mut RedisModuleCtx,
21321                        *mut RedisModuleUser,
21322                        *mut robj,
21323                        RedisModuleACLLogEntryReason,
21324                    ) -> libc::c_int,
21325            ),
21326        ) as *mut libc::c_void,
21327    );
21328    moduleRegisterApi(
21329        b"RedisModule_FreeModuleUser\0" as *const u8 as *const libc::c_char,
21330        core::mem::transmute::<
21331            Option::<unsafe extern "C" fn(*mut RedisModuleUser) -> libc::c_int>,
21332            libc::c_ulong,
21333        >(
21334            Some(
21335                RM_FreeModuleUser
21336                    as unsafe extern "C" fn(*mut RedisModuleUser) -> libc::c_int,
21337            ),
21338        ) as *mut libc::c_void,
21339    );
21340    moduleRegisterApi(
21341        b"RedisModule_DeauthenticateAndCloseClient\0" as *const u8
21342            as *const libc::c_char,
21343        core::mem::transmute::<
21344            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> libc::c_int>,
21345            libc::c_ulong,
21346        >(
21347            Some(
21348                RM_DeauthenticateAndCloseClient
21349                    as unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> libc::c_int,
21350            ),
21351        ) as *mut libc::c_void,
21352    );
21353    moduleRegisterApi(
21354        b"RedisModule_AuthenticateClientWithACLUser\0" as *const u8
21355            as *const libc::c_char,
21356        core::mem::transmute::<
21357            Option::<
21358                unsafe extern "C" fn(
21359                    *mut RedisModuleCtx,
21360                    *const libc::c_char,
21361                    size_t,
21362                    RedisModuleUserChangedFunc,
21363                    *mut libc::c_void,
21364                    *mut uint64_t,
21365                ) -> libc::c_int,
21366            >,
21367            libc::c_ulong,
21368        >(
21369            Some(
21370                RM_AuthenticateClientWithACLUser
21371                    as unsafe extern "C" fn(
21372                        *mut RedisModuleCtx,
21373                        *const libc::c_char,
21374                        size_t,
21375                        RedisModuleUserChangedFunc,
21376                        *mut libc::c_void,
21377                        *mut uint64_t,
21378                    ) -> libc::c_int,
21379            ),
21380        ) as *mut libc::c_void,
21381    );
21382    moduleRegisterApi(
21383        b"RedisModule_AuthenticateClientWithUser\0" as *const u8 as *const libc::c_char,
21384        core::mem::transmute::<
21385            Option::<
21386                unsafe extern "C" fn(
21387                    *mut RedisModuleCtx,
21388                    *mut RedisModuleUser,
21389                    RedisModuleUserChangedFunc,
21390                    *mut libc::c_void,
21391                    *mut uint64_t,
21392                ) -> libc::c_int,
21393            >,
21394            libc::c_ulong,
21395        >(
21396            Some(
21397                RM_AuthenticateClientWithUser
21398                    as unsafe extern "C" fn(
21399                        *mut RedisModuleCtx,
21400                        *mut RedisModuleUser,
21401                        RedisModuleUserChangedFunc,
21402                        *mut libc::c_void,
21403                        *mut uint64_t,
21404                    ) -> libc::c_int,
21405            ),
21406        ) as *mut libc::c_void,
21407    );
21408    moduleRegisterApi(
21409        b"RedisModule_GetContextFlagsAll\0" as *const u8 as *const libc::c_char,
21410        core::mem::transmute::<
21411            Option::<unsafe extern "C" fn() -> libc::c_int>,
21412            libc::c_ulong,
21413        >(
21414            Some(
21415                core::mem::transmute::<
21416                    unsafe extern "C" fn() -> libc::c_int,
21417                    unsafe extern "C" fn() -> libc::c_int,
21418                >(RM_GetContextFlagsAll),
21419            ),
21420        ) as *mut libc::c_void,
21421    );
21422    moduleRegisterApi(
21423        b"RedisModule_GetKeyspaceNotificationFlagsAll\0" as *const u8
21424            as *const libc::c_char,
21425        core::mem::transmute::<
21426            Option::<unsafe extern "C" fn() -> libc::c_int>,
21427            libc::c_ulong,
21428        >(
21429            Some(
21430                core::mem::transmute::<
21431                    unsafe extern "C" fn() -> libc::c_int,
21432                    unsafe extern "C" fn() -> libc::c_int,
21433                >(RM_GetKeyspaceNotificationFlagsAll),
21434            ),
21435        ) as *mut libc::c_void,
21436    );
21437    moduleRegisterApi(
21438        b"RedisModule_IsSubEventSupported\0" as *const u8 as *const libc::c_char,
21439        core::mem::transmute::<
21440            Option::<unsafe extern "C" fn(RedisModuleEvent, int64_t) -> libc::c_int>,
21441            libc::c_ulong,
21442        >(
21443            Some(
21444                RM_IsSubEventSupported
21445                    as unsafe extern "C" fn(RedisModuleEvent, int64_t) -> libc::c_int,
21446            ),
21447        ) as *mut libc::c_void,
21448    );
21449    moduleRegisterApi(
21450        b"RedisModule_GetServerVersion\0" as *const u8 as *const libc::c_char,
21451        core::mem::transmute::<
21452            Option::<unsafe extern "C" fn() -> libc::c_int>,
21453            libc::c_ulong,
21454        >(
21455            Some(
21456                core::mem::transmute::<
21457                    unsafe extern "C" fn() -> libc::c_int,
21458                    unsafe extern "C" fn() -> libc::c_int,
21459                >(RM_GetServerVersion),
21460            ),
21461        ) as *mut libc::c_void,
21462    );
21463    moduleRegisterApi(
21464        b"RedisModule_GetClientCertificate\0" as *const u8 as *const libc::c_char,
21465        core::mem::transmute::<
21466            Option::<unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> *mut robj>,
21467            libc::c_ulong,
21468        >(
21469            Some(
21470                RM_GetClientCertificate
21471                    as unsafe extern "C" fn(*mut RedisModuleCtx, uint64_t) -> *mut robj,
21472            ),
21473        ) as *mut libc::c_void,
21474    );
21475    moduleRegisterApi(
21476        b"RedisModule_RedactClientCommandArgument\0" as *const u8 as *const libc::c_char,
21477        core::mem::transmute::<
21478            Option::<
21479                unsafe extern "C" fn(*mut RedisModuleCtx, libc::c_int) -> libc::c_int,
21480            >,
21481            libc::c_ulong,
21482        >(
21483            Some(
21484                RM_RedactClientCommandArgument
21485                    as unsafe extern "C" fn(
21486                        *mut RedisModuleCtx,
21487                        libc::c_int,
21488                    ) -> libc::c_int,
21489            ),
21490        ) as *mut libc::c_void,
21491    );
21492    moduleRegisterApi(
21493        b"RedisModule_GetCommandKeys\0" as *const u8 as *const libc::c_char,
21494        core::mem::transmute::<
21495            Option::<
21496                unsafe extern "C" fn(
21497                    *mut RedisModuleCtx,
21498                    *mut *mut robj,
21499                    libc::c_int,
21500                    *mut libc::c_int,
21501                ) -> *mut libc::c_int,
21502            >,
21503            libc::c_ulong,
21504        >(
21505            Some(
21506                RM_GetCommandKeys
21507                    as unsafe extern "C" fn(
21508                        *mut RedisModuleCtx,
21509                        *mut *mut robj,
21510                        libc::c_int,
21511                        *mut libc::c_int,
21512                    ) -> *mut libc::c_int,
21513            ),
21514        ) as *mut libc::c_void,
21515    );
21516    moduleRegisterApi(
21517        b"RedisModule_GetCommandKeysWithFlags\0" as *const u8 as *const libc::c_char,
21518        core::mem::transmute::<
21519            Option::<
21520                unsafe extern "C" fn(
21521                    *mut RedisModuleCtx,
21522                    *mut *mut robj,
21523                    libc::c_int,
21524                    *mut libc::c_int,
21525                    *mut *mut libc::c_int,
21526                ) -> *mut libc::c_int,
21527            >,
21528            libc::c_ulong,
21529        >(
21530            Some(
21531                RM_GetCommandKeysWithFlags
21532                    as unsafe extern "C" fn(
21533                        *mut RedisModuleCtx,
21534                        *mut *mut robj,
21535                        libc::c_int,
21536                        *mut libc::c_int,
21537                        *mut *mut libc::c_int,
21538                    ) -> *mut libc::c_int,
21539            ),
21540        ) as *mut libc::c_void,
21541    );
21542    moduleRegisterApi(
21543        b"RedisModule_GetCurrentCommandName\0" as *const u8 as *const libc::c_char,
21544        core::mem::transmute::<
21545            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> *const libc::c_char>,
21546            libc::c_ulong,
21547        >(
21548            Some(
21549                RM_GetCurrentCommandName
21550                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> *const libc::c_char,
21551            ),
21552        ) as *mut libc::c_void,
21553    );
21554    moduleRegisterApi(
21555        b"RedisModule_GetTypeMethodVersion\0" as *const u8 as *const libc::c_char,
21556        core::mem::transmute::<
21557            Option::<unsafe extern "C" fn() -> libc::c_int>,
21558            libc::c_ulong,
21559        >(
21560            Some(
21561                core::mem::transmute::<
21562                    unsafe extern "C" fn() -> libc::c_int,
21563                    unsafe extern "C" fn() -> libc::c_int,
21564                >(RM_GetTypeMethodVersion),
21565            ),
21566        ) as *mut libc::c_void,
21567    );
21568    moduleRegisterApi(
21569        b"RedisModule_RegisterDefragFunc\0" as *const u8 as *const libc::c_char,
21570        core::mem::transmute::<
21571            Option::<
21572                unsafe extern "C" fn(
21573                    *mut RedisModuleCtx,
21574                    RedisModuleDefragFunc,
21575                ) -> libc::c_int,
21576            >,
21577            libc::c_ulong,
21578        >(
21579            Some(
21580                RM_RegisterDefragFunc
21581                    as unsafe extern "C" fn(
21582                        *mut RedisModuleCtx,
21583                        RedisModuleDefragFunc,
21584                    ) -> libc::c_int,
21585            ),
21586        ) as *mut libc::c_void,
21587    );
21588    moduleRegisterApi(
21589        b"RedisModule_DefragAlloc\0" as *const u8 as *const libc::c_char,
21590        core::mem::transmute::<
21591            Option::<
21592                unsafe extern "C" fn(
21593                    *mut RedisModuleDefragCtx,
21594                    *mut libc::c_void,
21595                ) -> *mut libc::c_void,
21596            >,
21597            libc::c_ulong,
21598        >(
21599            Some(
21600                RM_DefragAlloc
21601                    as unsafe extern "C" fn(
21602                        *mut RedisModuleDefragCtx,
21603                        *mut libc::c_void,
21604                    ) -> *mut libc::c_void,
21605            ),
21606        ) as *mut libc::c_void,
21607    );
21608    moduleRegisterApi(
21609        b"RedisModule_DefragRedisModuleString\0" as *const u8 as *const libc::c_char,
21610        core::mem::transmute::<
21611            Option::<
21612                unsafe extern "C" fn(*mut RedisModuleDefragCtx, *mut robj) -> *mut robj,
21613            >,
21614            libc::c_ulong,
21615        >(
21616            Some(
21617                RM_DefragRedisModuleString
21618                    as unsafe extern "C" fn(
21619                        *mut RedisModuleDefragCtx,
21620                        *mut robj,
21621                    ) -> *mut robj,
21622            ),
21623        ) as *mut libc::c_void,
21624    );
21625    moduleRegisterApi(
21626        b"RedisModule_DefragShouldStop\0" as *const u8 as *const libc::c_char,
21627        core::mem::transmute::<
21628            Option::<unsafe extern "C" fn(*mut RedisModuleDefragCtx) -> libc::c_int>,
21629            libc::c_ulong,
21630        >(
21631            Some(
21632                RM_DefragShouldStop
21633                    as unsafe extern "C" fn(*mut RedisModuleDefragCtx) -> libc::c_int,
21634            ),
21635        ) as *mut libc::c_void,
21636    );
21637    moduleRegisterApi(
21638        b"RedisModule_DefragCursorSet\0" as *const u8 as *const libc::c_char,
21639        core::mem::transmute::<
21640            Option::<
21641                unsafe extern "C" fn(
21642                    *mut RedisModuleDefragCtx,
21643                    libc::c_ulong,
21644                ) -> libc::c_int,
21645            >,
21646            libc::c_ulong,
21647        >(
21648            Some(
21649                RM_DefragCursorSet
21650                    as unsafe extern "C" fn(
21651                        *mut RedisModuleDefragCtx,
21652                        libc::c_ulong,
21653                    ) -> libc::c_int,
21654            ),
21655        ) as *mut libc::c_void,
21656    );
21657    moduleRegisterApi(
21658        b"RedisModule_DefragCursorGet\0" as *const u8 as *const libc::c_char,
21659        core::mem::transmute::<
21660            Option::<
21661                unsafe extern "C" fn(
21662                    *mut RedisModuleDefragCtx,
21663                    *mut libc::c_ulong,
21664                ) -> libc::c_int,
21665            >,
21666            libc::c_ulong,
21667        >(
21668            Some(
21669                RM_DefragCursorGet
21670                    as unsafe extern "C" fn(
21671                        *mut RedisModuleDefragCtx,
21672                        *mut libc::c_ulong,
21673                    ) -> libc::c_int,
21674            ),
21675        ) as *mut libc::c_void,
21676    );
21677    moduleRegisterApi(
21678        b"RedisModule_EventLoopAdd\0" as *const u8 as *const libc::c_char,
21679        core::mem::transmute::<
21680            Option::<
21681                unsafe extern "C" fn(
21682                    libc::c_int,
21683                    libc::c_int,
21684                    RedisModuleEventLoopFunc,
21685                    *mut libc::c_void,
21686                ) -> libc::c_int,
21687            >,
21688            libc::c_ulong,
21689        >(
21690            Some(
21691                RM_EventLoopAdd
21692                    as unsafe extern "C" fn(
21693                        libc::c_int,
21694                        libc::c_int,
21695                        RedisModuleEventLoopFunc,
21696                        *mut libc::c_void,
21697                    ) -> libc::c_int,
21698            ),
21699        ) as *mut libc::c_void,
21700    );
21701    moduleRegisterApi(
21702        b"RedisModule_EventLoopDel\0" as *const u8 as *const libc::c_char,
21703        core::mem::transmute::<
21704            Option::<unsafe extern "C" fn(libc::c_int, libc::c_int) -> libc::c_int>,
21705            libc::c_ulong,
21706        >(
21707            Some(
21708                RM_EventLoopDel
21709                    as unsafe extern "C" fn(libc::c_int, libc::c_int) -> libc::c_int,
21710            ),
21711        ) as *mut libc::c_void,
21712    );
21713    moduleRegisterApi(
21714        b"RedisModule_EventLoopAddOneShot\0" as *const u8 as *const libc::c_char,
21715        core::mem::transmute::<
21716            Option::<
21717                unsafe extern "C" fn(
21718                    RedisModuleEventLoopOneShotFunc,
21719                    *mut libc::c_void,
21720                ) -> libc::c_int,
21721            >,
21722            libc::c_ulong,
21723        >(
21724            Some(
21725                RM_EventLoopAddOneShot
21726                    as unsafe extern "C" fn(
21727                        RedisModuleEventLoopOneShotFunc,
21728                        *mut libc::c_void,
21729                    ) -> libc::c_int,
21730            ),
21731        ) as *mut libc::c_void,
21732    );
21733    moduleRegisterApi(
21734        b"RedisModule_Yield\0" as *const u8 as *const libc::c_char,
21735        core::mem::transmute::<
21736            Option::<
21737                unsafe extern "C" fn(
21738                    *mut RedisModuleCtx,
21739                    libc::c_int,
21740                    *const libc::c_char,
21741                ) -> (),
21742            >,
21743            libc::c_ulong,
21744        >(
21745            Some(
21746                RM_Yield
21747                    as unsafe extern "C" fn(
21748                        *mut RedisModuleCtx,
21749                        libc::c_int,
21750                        *const libc::c_char,
21751                    ) -> (),
21752            ),
21753        ) as *mut libc::c_void,
21754    );
21755    moduleRegisterApi(
21756        b"RedisModule_RegisterBoolConfig\0" as *const u8 as *const libc::c_char,
21757        core::mem::transmute::<
21758            Option::<
21759                unsafe extern "C" fn(
21760                    *mut RedisModuleCtx,
21761                    *const libc::c_char,
21762                    libc::c_int,
21763                    libc::c_uint,
21764                    RedisModuleConfigGetBoolFunc,
21765                    RedisModuleConfigSetBoolFunc,
21766                    RedisModuleConfigApplyFunc,
21767                    *mut libc::c_void,
21768                ) -> libc::c_int,
21769            >,
21770            libc::c_ulong,
21771        >(
21772            Some(
21773                RM_RegisterBoolConfig
21774                    as unsafe extern "C" fn(
21775                        *mut RedisModuleCtx,
21776                        *const libc::c_char,
21777                        libc::c_int,
21778                        libc::c_uint,
21779                        RedisModuleConfigGetBoolFunc,
21780                        RedisModuleConfigSetBoolFunc,
21781                        RedisModuleConfigApplyFunc,
21782                        *mut libc::c_void,
21783                    ) -> libc::c_int,
21784            ),
21785        ) as *mut libc::c_void,
21786    );
21787    moduleRegisterApi(
21788        b"RedisModule_RegisterNumericConfig\0" as *const u8 as *const libc::c_char,
21789        core::mem::transmute::<
21790            Option::<
21791                unsafe extern "C" fn(
21792                    *mut RedisModuleCtx,
21793                    *const libc::c_char,
21794                    libc::c_longlong,
21795                    libc::c_uint,
21796                    libc::c_longlong,
21797                    libc::c_longlong,
21798                    RedisModuleConfigGetNumericFunc,
21799                    RedisModuleConfigSetNumericFunc,
21800                    RedisModuleConfigApplyFunc,
21801                    *mut libc::c_void,
21802                ) -> libc::c_int,
21803            >,
21804            libc::c_ulong,
21805        >(
21806            Some(
21807                RM_RegisterNumericConfig
21808                    as unsafe extern "C" fn(
21809                        *mut RedisModuleCtx,
21810                        *const libc::c_char,
21811                        libc::c_longlong,
21812                        libc::c_uint,
21813                        libc::c_longlong,
21814                        libc::c_longlong,
21815                        RedisModuleConfigGetNumericFunc,
21816                        RedisModuleConfigSetNumericFunc,
21817                        RedisModuleConfigApplyFunc,
21818                        *mut libc::c_void,
21819                    ) -> libc::c_int,
21820            ),
21821        ) as *mut libc::c_void,
21822    );
21823    moduleRegisterApi(
21824        b"RedisModule_RegisterStringConfig\0" as *const u8 as *const libc::c_char,
21825        core::mem::transmute::<
21826            Option::<
21827                unsafe extern "C" fn(
21828                    *mut RedisModuleCtx,
21829                    *const libc::c_char,
21830                    *const libc::c_char,
21831                    libc::c_uint,
21832                    RedisModuleConfigGetStringFunc,
21833                    RedisModuleConfigSetStringFunc,
21834                    RedisModuleConfigApplyFunc,
21835                    *mut libc::c_void,
21836                ) -> libc::c_int,
21837            >,
21838            libc::c_ulong,
21839        >(
21840            Some(
21841                RM_RegisterStringConfig
21842                    as unsafe extern "C" fn(
21843                        *mut RedisModuleCtx,
21844                        *const libc::c_char,
21845                        *const libc::c_char,
21846                        libc::c_uint,
21847                        RedisModuleConfigGetStringFunc,
21848                        RedisModuleConfigSetStringFunc,
21849                        RedisModuleConfigApplyFunc,
21850                        *mut libc::c_void,
21851                    ) -> libc::c_int,
21852            ),
21853        ) as *mut libc::c_void,
21854    );
21855    moduleRegisterApi(
21856        b"RedisModule_RegisterEnumConfig\0" as *const u8 as *const libc::c_char,
21857        core::mem::transmute::<
21858            Option::<
21859                unsafe extern "C" fn(
21860                    *mut RedisModuleCtx,
21861                    *const libc::c_char,
21862                    libc::c_int,
21863                    libc::c_uint,
21864                    *mut *const libc::c_char,
21865                    *const libc::c_int,
21866                    libc::c_int,
21867                    RedisModuleConfigGetEnumFunc,
21868                    RedisModuleConfigSetEnumFunc,
21869                    RedisModuleConfigApplyFunc,
21870                    *mut libc::c_void,
21871                ) -> libc::c_int,
21872            >,
21873            libc::c_ulong,
21874        >(
21875            Some(
21876                RM_RegisterEnumConfig
21877                    as unsafe extern "C" fn(
21878                        *mut RedisModuleCtx,
21879                        *const libc::c_char,
21880                        libc::c_int,
21881                        libc::c_uint,
21882                        *mut *const libc::c_char,
21883                        *const libc::c_int,
21884                        libc::c_int,
21885                        RedisModuleConfigGetEnumFunc,
21886                        RedisModuleConfigSetEnumFunc,
21887                        RedisModuleConfigApplyFunc,
21888                        *mut libc::c_void,
21889                    ) -> libc::c_int,
21890            ),
21891        ) as *mut libc::c_void,
21892    );
21893    moduleRegisterApi(
21894        b"RedisModule_LoadConfigs\0" as *const u8 as *const libc::c_char,
21895        core::mem::transmute::<
21896            Option::<unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int>,
21897            libc::c_ulong,
21898        >(
21899            Some(
21900                RM_LoadConfigs
21901                    as unsafe extern "C" fn(*mut RedisModuleCtx) -> libc::c_int,
21902            ),
21903        ) as *mut libc::c_void,
21904    );
21905}