redrust/
bitops.rs

1extern crate c2rust_bitfields;
2extern crate libc;
3extern crate core;
4extern "C" {
5    pub type RedisModuleCommand;
6    pub type clusterSlotToKeyMapping;
7    pub type clusterState;
8    fn printf(_: *const libc::c_char, _: ...) -> libc::c_int;
9    fn sdsnewlen(init: *const libc::c_void, initlen: size_t) -> sds;
10    fn sdsgrowzero(s: sds, len: size_t) -> sds;
11    fn memcpy(
12        _: *mut libc::c_void,
13        _: *const libc::c_void,
14        _: libc::c_ulong,
15    ) -> *mut libc::c_void;
16    fn memset(
17        _: *mut libc::c_void,
18        _: libc::c_int,
19        _: libc::c_ulong,
20    ) -> *mut libc::c_void;
21    fn strlen(_: *const libc::c_char) -> libc::c_ulong;
22    fn strcasecmp(__s1: *const libc::c_char, __s2: *const libc::c_char) -> libc::c_int;
23    fn zmalloc(size: size_t) -> *mut libc::c_void;
24    fn zrealloc(ptr: *mut libc::c_void, size: size_t) -> *mut libc::c_void;
25    fn zfree(ptr: *mut libc::c_void);
26    fn ll2string(
27        s: *mut libc::c_char,
28        len: size_t,
29        value: libc::c_longlong,
30    ) -> libc::c_int;
31    fn string2ll(
32        s: *const libc::c_char,
33        slen: size_t,
34        value: *mut libc::c_longlong,
35    ) -> libc::c_int;
36    static mut server: redisServer;
37    static mut shared: sharedObjectsStruct;
38    fn addReplyNull(c: *mut client);
39    fn addReply(c: *mut client, obj: *mut robj);
40    fn addReplyErrorObject(c: *mut client, err: *mut robj);
41    fn addReplyError(c: *mut client, err: *const libc::c_char);
42    fn addReplyLongLong(c: *mut client, ll: libc::c_longlong);
43    fn addReplyArrayLen(c: *mut client, length: libc::c_long);
44    fn getLongLongFromObjectOrReply(
45        c: *mut client,
46        o: *mut robj,
47        target: *mut libc::c_longlong,
48        msg: *const libc::c_char,
49    ) -> libc::c_int;
50    fn checkType(c: *mut client, o: *mut robj, type_0: libc::c_int) -> libc::c_int;
51    fn getLongFromObjectOrReply(
52        c: *mut client,
53        o: *mut robj,
54        target: *mut libc::c_long,
55        msg: *const libc::c_char,
56    ) -> libc::c_int;
57    fn getDecodedObject(o: *mut robj) -> *mut robj;
58    fn createObject(type_0: libc::c_int, ptr: *mut libc::c_void) -> *mut robj;
59    fn mustObeyClient(c: *mut client) -> libc::c_int;
60    fn notifyKeyspaceEvent(
61        type_0: libc::c_int,
62        event: *mut libc::c_char,
63        key: *mut robj,
64        dbid: libc::c_int,
65    );
66    fn lookupKeyRead(db: *mut redisDb, key: *mut robj) -> *mut robj;
67    fn lookupKeyWrite(db: *mut redisDb, key: *mut robj) -> *mut robj;
68    fn lookupKeyReadOrReply(
69        c: *mut client,
70        key: *mut robj,
71        reply: *mut robj,
72    ) -> *mut robj;
73    fn dbAdd(db: *mut redisDb, key: *mut robj, val: *mut robj);
74    fn setKey(
75        c: *mut client,
76        db: *mut redisDb,
77        key: *mut robj,
78        val: *mut robj,
79        flags: libc::c_int,
80    );
81    fn dbDelete(db: *mut redisDb, key: *mut robj) -> libc::c_int;
82    fn dbUnshareStringValue(db: *mut redisDb, key: *mut robj, o: *mut robj) -> *mut robj;
83    fn signalModifiedKey(c: *mut client, db: *mut redisDb, key: *mut robj);
84    fn decrRefCount(o: *mut robj);
85    fn _serverAssert(
86        estr: *const libc::c_char,
87        file: *const libc::c_char,
88        line: libc::c_int,
89    );
90    fn _serverPanic(
91        file: *const libc::c_char,
92        line: libc::c_int,
93        msg: *const libc::c_char,
94        _: ...
95    );
96}
97pub type __uint8_t = libc::c_uchar;
98pub type __int16_t = libc::c_short;
99pub type __uint16_t = libc::c_ushort;
100pub type __int32_t = libc::c_int;
101pub type __uint32_t = libc::c_uint;
102pub type __int64_t = libc::c_long;
103pub type __uint64_t = libc::c_ulong;
104pub type __uint_least64_t = __uint64_t;
105pub type __mode_t = libc::c_uint;
106pub type __off64_t = libc::c_long;
107pub type __pid_t = libc::c_int;
108pub type __time_t = libc::c_long;
109pub type __ssize_t = libc::c_long;
110pub type __sig_atomic_t = libc::c_int;
111pub type size_t = libc::c_ulong;
112#[derive(Copy, Clone)]
113#[repr(C)]
114pub struct iovec {
115    pub iov_base: *mut libc::c_void,
116    pub iov_len: size_t,
117}
118pub type mode_t = __mode_t;
119pub type off_t = __off64_t;
120pub type pid_t = __pid_t;
121pub type ssize_t = __ssize_t;
122pub type time_t = __time_t;
123pub type int16_t = __int16_t;
124pub type int32_t = __int32_t;
125pub type int64_t = __int64_t;
126pub type pthread_t = libc::c_ulong;
127pub type uint8_t = __uint8_t;
128pub type uint16_t = __uint16_t;
129pub type uint32_t = __uint32_t;
130pub type uint64_t = __uint64_t;
131pub type uint_least64_t = __uint_least64_t;
132pub type sds = *mut libc::c_char;
133#[derive(Copy, Clone)]
134#[repr(C, packed)]
135pub struct sdshdr8 {
136    pub len: uint8_t,
137    pub alloc: uint8_t,
138    pub flags: libc::c_uchar,
139    pub buf: [libc::c_char; 0],
140}
141#[derive(Copy, Clone)]
142#[repr(C, packed)]
143pub struct sdshdr16 {
144    pub len: uint16_t,
145    pub alloc: uint16_t,
146    pub flags: libc::c_uchar,
147    pub buf: [libc::c_char; 0],
148}
149#[derive(Copy, Clone)]
150#[repr(C, packed)]
151pub struct sdshdr32 {
152    pub len: uint32_t,
153    pub alloc: uint32_t,
154    pub flags: libc::c_uchar,
155    pub buf: [libc::c_char; 0],
156}
157#[derive(Copy, Clone)]
158#[repr(C, packed)]
159pub struct sdshdr64 {
160    pub len: uint64_t,
161    pub alloc: uint64_t,
162    pub flags: libc::c_uchar,
163    pub buf: [libc::c_char; 0],
164}
165#[derive(Copy, Clone)]
166#[repr(C)]
167pub struct aeEventLoop {
168    pub maxfd: libc::c_int,
169    pub setsize: libc::c_int,
170    pub timeEventNextId: libc::c_longlong,
171    pub events: *mut aeFileEvent,
172    pub fired: *mut aeFiredEvent,
173    pub timeEventHead: *mut aeTimeEvent,
174    pub stop: libc::c_int,
175    pub apidata: *mut libc::c_void,
176    pub beforesleep: Option::<aeBeforeSleepProc>,
177    pub aftersleep: Option::<aeBeforeSleepProc>,
178    pub flags: libc::c_int,
179}
180pub type aeBeforeSleepProc = unsafe extern "C" fn(*mut aeEventLoop) -> ();
181#[derive(Copy, Clone)]
182#[repr(C)]
183pub struct aeTimeEvent {
184    pub id: libc::c_longlong,
185    pub when: monotime,
186    pub timeProc: Option::<aeTimeProc>,
187    pub finalizerProc: Option::<aeEventFinalizerProc>,
188    pub clientData: *mut libc::c_void,
189    pub prev: *mut aeTimeEvent,
190    pub next: *mut aeTimeEvent,
191    pub refcount: libc::c_int,
192}
193pub type aeEventFinalizerProc = unsafe extern "C" fn(
194    *mut aeEventLoop,
195    *mut libc::c_void,
196) -> ();
197pub type aeTimeProc = unsafe extern "C" fn(
198    *mut aeEventLoop,
199    libc::c_longlong,
200    *mut libc::c_void,
201) -> libc::c_int;
202pub type monotime = uint64_t;
203#[derive(Copy, Clone)]
204#[repr(C)]
205pub struct aeFiredEvent {
206    pub fd: libc::c_int,
207    pub mask: libc::c_int,
208}
209#[derive(Copy, Clone)]
210#[repr(C)]
211pub struct aeFileEvent {
212    pub mask: libc::c_int,
213    pub rfileProc: Option::<aeFileProc>,
214    pub wfileProc: Option::<aeFileProc>,
215    pub clientData: *mut libc::c_void,
216}
217pub type aeFileProc = unsafe extern "C" fn(
218    *mut aeEventLoop,
219    libc::c_int,
220    *mut libc::c_void,
221    libc::c_int,
222) -> ();
223#[derive(Copy, Clone)]
224#[repr(C)]
225pub struct connection {
226    pub type_0: *mut ConnectionType,
227    pub state: ConnectionState,
228    pub flags: libc::c_short,
229    pub refs: libc::c_short,
230    pub last_errno: libc::c_int,
231    pub private_data: *mut libc::c_void,
232    pub conn_handler: ConnectionCallbackFunc,
233    pub write_handler: ConnectionCallbackFunc,
234    pub read_handler: ConnectionCallbackFunc,
235    pub fd: libc::c_int,
236}
237pub type ConnectionCallbackFunc = Option::<unsafe extern "C" fn(*mut connection) -> ()>;
238pub type ConnectionState = libc::c_uint;
239pub const CONN_STATE_ERROR: ConnectionState = 5;
240pub const CONN_STATE_CLOSED: ConnectionState = 4;
241pub const CONN_STATE_CONNECTED: ConnectionState = 3;
242pub const CONN_STATE_ACCEPTING: ConnectionState = 2;
243pub const CONN_STATE_CONNECTING: ConnectionState = 1;
244pub const CONN_STATE_NONE: ConnectionState = 0;
245#[derive(Copy, Clone)]
246#[repr(C)]
247pub struct ConnectionType {
248    pub ae_handler: Option::<
249        unsafe extern "C" fn(
250            *mut aeEventLoop,
251            libc::c_int,
252            *mut libc::c_void,
253            libc::c_int,
254        ) -> (),
255    >,
256    pub connect: Option::<
257        unsafe extern "C" fn(
258            *mut connection,
259            *const libc::c_char,
260            libc::c_int,
261            *const libc::c_char,
262            ConnectionCallbackFunc,
263        ) -> libc::c_int,
264    >,
265    pub write: Option::<
266        unsafe extern "C" fn(*mut connection, *const libc::c_void, size_t) -> libc::c_int,
267    >,
268    pub writev: Option::<
269        unsafe extern "C" fn(*mut connection, *const iovec, libc::c_int) -> libc::c_int,
270    >,
271    pub read: Option::<
272        unsafe extern "C" fn(*mut connection, *mut libc::c_void, size_t) -> libc::c_int,
273    >,
274    pub close: Option::<unsafe extern "C" fn(*mut connection) -> ()>,
275    pub accept: Option::<
276        unsafe extern "C" fn(*mut connection, ConnectionCallbackFunc) -> libc::c_int,
277    >,
278    pub set_write_handler: Option::<
279        unsafe extern "C" fn(
280            *mut connection,
281            ConnectionCallbackFunc,
282            libc::c_int,
283        ) -> libc::c_int,
284    >,
285    pub set_read_handler: Option::<
286        unsafe extern "C" fn(*mut connection, ConnectionCallbackFunc) -> libc::c_int,
287    >,
288    pub get_last_error: Option::<
289        unsafe extern "C" fn(*mut connection) -> *const libc::c_char,
290    >,
291    pub blocking_connect: Option::<
292        unsafe extern "C" fn(
293            *mut connection,
294            *const libc::c_char,
295            libc::c_int,
296            libc::c_longlong,
297        ) -> libc::c_int,
298    >,
299    pub sync_write: Option::<
300        unsafe extern "C" fn(
301            *mut connection,
302            *mut libc::c_char,
303            ssize_t,
304            libc::c_longlong,
305        ) -> ssize_t,
306    >,
307    pub sync_read: Option::<
308        unsafe extern "C" fn(
309            *mut connection,
310            *mut libc::c_char,
311            ssize_t,
312            libc::c_longlong,
313        ) -> ssize_t,
314    >,
315    pub sync_readline: Option::<
316        unsafe extern "C" fn(
317            *mut connection,
318            *mut libc::c_char,
319            ssize_t,
320            libc::c_longlong,
321        ) -> ssize_t,
322    >,
323    pub get_type: Option::<unsafe extern "C" fn(*mut connection) -> libc::c_int>,
324}
325#[derive(Copy, Clone, c2rust_bitfields::BitfieldStruct)]
326#[repr(C)]
327pub struct redisObject {
328    #[bitfield(name = "type_0", ty = "libc::c_uint", bits = "0..=3")]
329    #[bitfield(name = "encoding", ty = "libc::c_uint", bits = "4..=7")]
330    #[bitfield(name = "lru", ty = "libc::c_uint", bits = "8..=31")]
331    pub type_0_encoding_lru: [u8; 4],
332    pub refcount: libc::c_int,
333    pub ptr: *mut libc::c_void,
334}
335pub type atomic_int = libc::c_int;
336pub type atomic_uint = libc::c_uint;
337pub type atomic_llong = libc::c_longlong;
338pub type sig_atomic_t = __sig_atomic_t;
339#[derive(Copy, Clone)]
340#[repr(C)]
341pub struct hdr_histogram {
342    pub lowest_discernible_value: int64_t,
343    pub highest_trackable_value: int64_t,
344    pub unit_magnitude: int32_t,
345    pub significant_figures: int32_t,
346    pub sub_bucket_half_count_magnitude: int32_t,
347    pub sub_bucket_half_count: int32_t,
348    pub sub_bucket_mask: int64_t,
349    pub sub_bucket_count: int32_t,
350    pub bucket_count: int32_t,
351    pub min_value: int64_t,
352    pub max_value: int64_t,
353    pub normalizing_index_offset: int32_t,
354    pub conversion_ratio: libc::c_double,
355    pub counts_len: int32_t,
356    pub total_count: int64_t,
357    pub counts: *mut int64_t,
358}
359pub type mstime_t = libc::c_longlong;
360pub type ustime_t = libc::c_longlong;
361#[derive(Copy, Clone)]
362#[repr(C)]
363pub struct dictEntry {
364    pub key: *mut libc::c_void,
365    pub v: C2RustUnnamed,
366    pub next: *mut dictEntry,
367    pub metadata: [*mut libc::c_void; 0],
368}
369#[derive(Copy, Clone)]
370#[repr(C)]
371pub union C2RustUnnamed {
372    pub val: *mut libc::c_void,
373    pub u64_0: uint64_t,
374    pub s64: int64_t,
375    pub d: libc::c_double,
376}
377#[derive(Copy, Clone)]
378#[repr(C)]
379pub struct dict {
380    pub type_0: *mut dictType,
381    pub ht_table: [*mut *mut dictEntry; 2],
382    pub ht_used: [libc::c_ulong; 2],
383    pub rehashidx: libc::c_long,
384    pub pauserehash: int16_t,
385    pub ht_size_exp: [libc::c_schar; 2],
386}
387#[derive(Copy, Clone)]
388#[repr(C)]
389pub struct dictType {
390    pub hashFunction: Option::<unsafe extern "C" fn(*const libc::c_void) -> uint64_t>,
391    pub keyDup: Option::<
392        unsafe extern "C" fn(*mut dict, *const libc::c_void) -> *mut libc::c_void,
393    >,
394    pub valDup: Option::<
395        unsafe extern "C" fn(*mut dict, *const libc::c_void) -> *mut libc::c_void,
396    >,
397    pub keyCompare: Option::<
398        unsafe extern "C" fn(
399            *mut dict,
400            *const libc::c_void,
401            *const libc::c_void,
402        ) -> libc::c_int,
403    >,
404    pub keyDestructor: Option::<
405        unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
406    >,
407    pub valDestructor: Option::<
408        unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
409    >,
410    pub expandAllowed: Option::<
411        unsafe extern "C" fn(size_t, libc::c_double) -> libc::c_int,
412    >,
413    pub dictEntryMetadataBytes: Option::<unsafe extern "C" fn(*mut dict) -> size_t>,
414}
415#[derive(Copy, Clone)]
416#[repr(C)]
417pub struct listNode {
418    pub prev: *mut listNode,
419    pub next: *mut listNode,
420    pub value: *mut libc::c_void,
421}
422#[derive(Copy, Clone)]
423#[repr(C)]
424pub struct list {
425    pub head: *mut listNode,
426    pub tail: *mut listNode,
427    pub dup: Option::<unsafe extern "C" fn(*mut libc::c_void) -> *mut libc::c_void>,
428    pub free: Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>,
429    pub match_0: Option::<
430        unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> libc::c_int,
431    >,
432    pub len: libc::c_ulong,
433}
434#[derive(Copy, Clone, c2rust_bitfields::BitfieldStruct)]
435#[repr(C)]
436pub struct raxNode {
437    #[bitfield(name = "iskey", ty = "uint32_t", bits = "0..=0")]
438    #[bitfield(name = "isnull", ty = "uint32_t", bits = "1..=1")]
439    #[bitfield(name = "iscompr", ty = "uint32_t", bits = "2..=2")]
440    #[bitfield(name = "size", ty = "uint32_t", bits = "3..=31")]
441    pub iskey_isnull_iscompr_size: [u8; 4],
442    pub data: [libc::c_uchar; 0],
443}
444#[derive(Copy, Clone)]
445#[repr(C)]
446pub struct rax {
447    pub head: *mut raxNode,
448    pub numele: uint64_t,
449    pub numnodes: uint64_t,
450}
451pub type pause_type = libc::c_uint;
452pub const CLIENT_PAUSE_ALL: pause_type = 2;
453pub const CLIENT_PAUSE_WRITE: pause_type = 1;
454pub const CLIENT_PAUSE_OFF: pause_type = 0;
455#[derive(Copy, Clone)]
456#[repr(C)]
457pub struct pause_event {
458    pub type_0: pause_type,
459    pub end: mstime_t,
460}
461pub type robj = redisObject;
462pub type RedisModuleUserChangedFunc = Option::<
463    unsafe extern "C" fn(uint64_t, *mut libc::c_void) -> (),
464>;
465#[derive(Copy, Clone)]
466#[repr(C)]
467pub struct redisDb {
468    pub dict: *mut dict,
469    pub expires: *mut dict,
470    pub blocking_keys: *mut dict,
471    pub ready_keys: *mut dict,
472    pub watched_keys: *mut dict,
473    pub id: libc::c_int,
474    pub avg_ttl: libc::c_longlong,
475    pub expires_cursor: libc::c_ulong,
476    pub defrag_later: *mut list,
477    pub slots_to_keys: *mut clusterSlotToKeyMapping,
478}
479#[derive(Copy, Clone)]
480#[repr(C)]
481pub struct multiCmd {
482    pub argv: *mut *mut robj,
483    pub argv_len: libc::c_int,
484    pub argc: libc::c_int,
485    pub cmd: *mut redisCommand,
486}
487#[derive(Copy, Clone)]
488#[repr(C)]
489pub struct redisCommand {
490    pub declared_name: *const libc::c_char,
491    pub summary: *const libc::c_char,
492    pub complexity: *const libc::c_char,
493    pub since: *const libc::c_char,
494    pub doc_flags: libc::c_int,
495    pub replaced_by: *const libc::c_char,
496    pub deprecated_since: *const libc::c_char,
497    pub group: redisCommandGroup,
498    pub history: *mut commandHistory,
499    pub tips: *mut *const libc::c_char,
500    pub proc_0: Option::<redisCommandProc>,
501    pub arity: libc::c_int,
502    pub flags: uint64_t,
503    pub acl_categories: uint64_t,
504    pub key_specs_static: [keySpec; 4],
505    pub getkeys_proc: Option::<redisGetKeysProc>,
506    pub subcommands: *mut redisCommand,
507    pub args: *mut redisCommandArg,
508    pub microseconds: libc::c_longlong,
509    pub calls: libc::c_longlong,
510    pub rejected_calls: libc::c_longlong,
511    pub failed_calls: libc::c_longlong,
512    pub id: libc::c_int,
513    pub fullname: sds,
514    pub latency_histogram: *mut hdr_histogram,
515    pub key_specs: *mut keySpec,
516    pub legacy_range_key_spec: keySpec,
517    pub num_args: libc::c_int,
518    pub num_history: libc::c_int,
519    pub num_tips: libc::c_int,
520    pub key_specs_num: libc::c_int,
521    pub key_specs_max: libc::c_int,
522    pub subcommands_dict: *mut dict,
523    pub parent: *mut redisCommand,
524    pub module_cmd: *mut RedisModuleCommand,
525}
526#[derive(Copy, Clone)]
527#[repr(C)]
528pub struct keySpec {
529    pub notes: *const libc::c_char,
530    pub flags: uint64_t,
531    pub begin_search_type: kspec_bs_type,
532    pub bs: C2RustUnnamed_3,
533    pub find_keys_type: kspec_fk_type,
534    pub fk: C2RustUnnamed_0,
535}
536#[derive(Copy, Clone)]
537#[repr(C)]
538pub union C2RustUnnamed_0 {
539    pub range: C2RustUnnamed_2,
540    pub keynum: C2RustUnnamed_1,
541}
542#[derive(Copy, Clone)]
543#[repr(C)]
544pub struct C2RustUnnamed_1 {
545    pub keynumidx: libc::c_int,
546    pub firstkey: libc::c_int,
547    pub keystep: libc::c_int,
548}
549#[derive(Copy, Clone)]
550#[repr(C)]
551pub struct C2RustUnnamed_2 {
552    pub lastkey: libc::c_int,
553    pub keystep: libc::c_int,
554    pub limit: libc::c_int,
555}
556pub type kspec_fk_type = libc::c_uint;
557pub const KSPEC_FK_KEYNUM: kspec_fk_type = 3;
558pub const KSPEC_FK_RANGE: kspec_fk_type = 2;
559pub const KSPEC_FK_UNKNOWN: kspec_fk_type = 1;
560pub const KSPEC_FK_INVALID: kspec_fk_type = 0;
561#[derive(Copy, Clone)]
562#[repr(C)]
563pub union C2RustUnnamed_3 {
564    pub index: C2RustUnnamed_5,
565    pub keyword: C2RustUnnamed_4,
566}
567#[derive(Copy, Clone)]
568#[repr(C)]
569pub struct C2RustUnnamed_4 {
570    pub keyword: *const libc::c_char,
571    pub startfrom: libc::c_int,
572}
573#[derive(Copy, Clone)]
574#[repr(C)]
575pub struct C2RustUnnamed_5 {
576    pub pos: libc::c_int,
577}
578pub type kspec_bs_type = libc::c_uint;
579pub const KSPEC_BS_KEYWORD: kspec_bs_type = 3;
580pub const KSPEC_BS_INDEX: kspec_bs_type = 2;
581pub const KSPEC_BS_UNKNOWN: kspec_bs_type = 1;
582pub const KSPEC_BS_INVALID: kspec_bs_type = 0;
583#[derive(Copy, Clone)]
584#[repr(C)]
585pub struct redisCommandArg {
586    pub name: *const libc::c_char,
587    pub type_0: redisCommandArgType,
588    pub key_spec_index: libc::c_int,
589    pub token: *const libc::c_char,
590    pub summary: *const libc::c_char,
591    pub since: *const libc::c_char,
592    pub flags: libc::c_int,
593    pub deprecated_since: *const libc::c_char,
594    pub subargs: *mut redisCommandArg,
595    pub num_args: libc::c_int,
596}
597pub type redisCommandArgType = libc::c_uint;
598pub const ARG_TYPE_BLOCK: redisCommandArgType = 8;
599pub const ARG_TYPE_ONEOF: redisCommandArgType = 7;
600pub const ARG_TYPE_PURE_TOKEN: redisCommandArgType = 6;
601pub const ARG_TYPE_UNIX_TIME: redisCommandArgType = 5;
602pub const ARG_TYPE_PATTERN: redisCommandArgType = 4;
603pub const ARG_TYPE_KEY: redisCommandArgType = 3;
604pub const ARG_TYPE_DOUBLE: redisCommandArgType = 2;
605pub const ARG_TYPE_INTEGER: redisCommandArgType = 1;
606pub const ARG_TYPE_STRING: redisCommandArgType = 0;
607pub type redisGetKeysProc = unsafe extern "C" fn(
608    *mut redisCommand,
609    *mut *mut robj,
610    libc::c_int,
611    *mut getKeysResult,
612) -> libc::c_int;
613#[derive(Copy, Clone)]
614#[repr(C)]
615pub struct getKeysResult {
616    pub keysbuf: [keyReference; 256],
617    pub keys: *mut keyReference,
618    pub numkeys: libc::c_int,
619    pub size: libc::c_int,
620}
621#[derive(Copy, Clone)]
622#[repr(C)]
623pub struct keyReference {
624    pub pos: libc::c_int,
625    pub flags: libc::c_int,
626}
627pub type redisCommandProc = unsafe extern "C" fn(*mut client) -> ();
628#[derive(Copy, Clone)]
629#[repr(C)]
630pub struct client {
631    pub id: uint64_t,
632    pub flags: uint64_t,
633    pub conn: *mut connection,
634    pub resp: libc::c_int,
635    pub db: *mut redisDb,
636    pub name: *mut robj,
637    pub querybuf: sds,
638    pub qb_pos: size_t,
639    pub querybuf_peak: size_t,
640    pub argc: libc::c_int,
641    pub argv: *mut *mut robj,
642    pub argv_len: libc::c_int,
643    pub original_argc: libc::c_int,
644    pub original_argv: *mut *mut robj,
645    pub argv_len_sum: size_t,
646    pub cmd: *mut redisCommand,
647    pub lastcmd: *mut redisCommand,
648    pub realcmd: *mut redisCommand,
649    pub user: *mut user,
650    pub reqtype: libc::c_int,
651    pub multibulklen: libc::c_int,
652    pub bulklen: libc::c_long,
653    pub reply: *mut list,
654    pub reply_bytes: libc::c_ulonglong,
655    pub deferred_reply_errors: *mut list,
656    pub sentlen: size_t,
657    pub ctime: time_t,
658    pub duration: libc::c_long,
659    pub slot: libc::c_int,
660    pub cur_script: *mut dictEntry,
661    pub lastinteraction: time_t,
662    pub obuf_soft_limit_reached_time: time_t,
663    pub authenticated: libc::c_int,
664    pub replstate: libc::c_int,
665    pub repl_start_cmd_stream_on_ack: libc::c_int,
666    pub repldbfd: libc::c_int,
667    pub repldboff: off_t,
668    pub repldbsize: off_t,
669    pub replpreamble: sds,
670    pub read_reploff: libc::c_longlong,
671    pub reploff: libc::c_longlong,
672    pub repl_applied: libc::c_longlong,
673    pub repl_ack_off: libc::c_longlong,
674    pub repl_ack_time: libc::c_longlong,
675    pub repl_last_partial_write: libc::c_longlong,
676    pub psync_initial_offset: libc::c_longlong,
677    pub replid: [libc::c_char; 41],
678    pub slave_listening_port: libc::c_int,
679    pub slave_addr: *mut libc::c_char,
680    pub slave_capa: libc::c_int,
681    pub slave_req: libc::c_int,
682    pub mstate: multiState,
683    pub btype: libc::c_int,
684    pub bpop: blockingState,
685    pub woff: libc::c_longlong,
686    pub watched_keys: *mut list,
687    pub pubsub_channels: *mut dict,
688    pub pubsub_patterns: *mut list,
689    pub pubsubshard_channels: *mut dict,
690    pub peerid: sds,
691    pub sockname: sds,
692    pub client_list_node: *mut listNode,
693    pub postponed_list_node: *mut listNode,
694    pub pending_read_list_node: *mut listNode,
695    pub auth_callback: RedisModuleUserChangedFunc,
696    pub auth_callback_privdata: *mut libc::c_void,
697    pub auth_module: *mut libc::c_void,
698    pub client_tracking_redirection: uint64_t,
699    pub client_tracking_prefixes: *mut rax,
700    pub last_memory_usage: size_t,
701    pub last_memory_type: libc::c_int,
702    pub mem_usage_bucket_node: *mut listNode,
703    pub mem_usage_bucket: *mut clientMemUsageBucket,
704    pub ref_repl_buf_node: *mut listNode,
705    pub ref_block_pos: size_t,
706    pub buf_peak: size_t,
707    pub buf_peak_last_reset_time: mstime_t,
708    pub bufpos: libc::c_int,
709    pub buf_usable_size: size_t,
710    pub buf: *mut libc::c_char,
711}
712#[derive(Copy, Clone)]
713#[repr(C)]
714pub struct clientMemUsageBucket {
715    pub clients: *mut list,
716    pub mem_usage_sum: size_t,
717}
718#[derive(Copy, Clone)]
719#[repr(C)]
720pub struct blockingState {
721    pub count: libc::c_long,
722    pub timeout: mstime_t,
723    pub keys: *mut dict,
724    pub target: *mut robj,
725    pub blockpos: blockPos,
726    pub xread_count: size_t,
727    pub xread_group: *mut robj,
728    pub xread_consumer: *mut robj,
729    pub xread_group_noack: libc::c_int,
730    pub numreplicas: libc::c_int,
731    pub reploffset: libc::c_longlong,
732    pub module_blocked_handle: *mut libc::c_void,
733}
734#[derive(Copy, Clone)]
735#[repr(C)]
736pub struct blockPos {
737    pub wherefrom: libc::c_int,
738    pub whereto: libc::c_int,
739}
740#[derive(Copy, Clone)]
741#[repr(C)]
742pub struct multiState {
743    pub commands: *mut multiCmd,
744    pub count: libc::c_int,
745    pub cmd_flags: libc::c_int,
746    pub cmd_inv_flags: libc::c_int,
747    pub argv_len_sums: size_t,
748    pub alloc_count: libc::c_int,
749}
750#[derive(Copy, Clone)]
751#[repr(C)]
752pub struct user {
753    pub name: sds,
754    pub flags: uint32_t,
755    pub passwords: *mut list,
756    pub selectors: *mut list,
757    pub acl_string: *mut robj,
758}
759#[derive(Copy, Clone)]
760#[repr(C)]
761pub struct commandHistory {
762    pub since: *const libc::c_char,
763    pub changes: *const libc::c_char,
764}
765pub type redisCommandGroup = libc::c_uint;
766pub const COMMAND_GROUP_MODULE: redisCommandGroup = 17;
767pub const COMMAND_GROUP_BITMAP: redisCommandGroup = 16;
768pub const COMMAND_GROUP_STREAM: redisCommandGroup = 15;
769pub const COMMAND_GROUP_GEO: redisCommandGroup = 14;
770pub const COMMAND_GROUP_SENTINEL: redisCommandGroup = 13;
771pub const COMMAND_GROUP_CLUSTER: redisCommandGroup = 12;
772pub const COMMAND_GROUP_HYPERLOGLOG: redisCommandGroup = 11;
773pub const COMMAND_GROUP_SCRIPTING: redisCommandGroup = 10;
774pub const COMMAND_GROUP_SERVER: redisCommandGroup = 9;
775pub const COMMAND_GROUP_CONNECTION: redisCommandGroup = 8;
776pub const COMMAND_GROUP_TRANSACTIONS: redisCommandGroup = 7;
777pub const COMMAND_GROUP_PUBSUB: redisCommandGroup = 6;
778pub const COMMAND_GROUP_HASH: redisCommandGroup = 5;
779pub const COMMAND_GROUP_SORTED_SET: redisCommandGroup = 4;
780pub const COMMAND_GROUP_SET: redisCommandGroup = 3;
781pub const COMMAND_GROUP_LIST: redisCommandGroup = 2;
782pub const COMMAND_GROUP_STRING: redisCommandGroup = 1;
783pub const COMMAND_GROUP_GENERIC: redisCommandGroup = 0;
784#[derive(Copy, Clone)]
785#[repr(C)]
786pub struct replBacklog {
787    pub ref_repl_buf_node: *mut listNode,
788    pub unindexed_count: size_t,
789    pub blocks_index: *mut rax,
790    pub histlen: libc::c_longlong,
791    pub offset: libc::c_longlong,
792}
793#[derive(Copy, Clone)]
794#[repr(C)]
795pub struct saveparam {
796    pub seconds: time_t,
797    pub changes: libc::c_int,
798}
799#[derive(Copy, Clone)]
800#[repr(C)]
801pub struct sentinelConfig {
802    pub pre_monitor_cfg: *mut list,
803    pub monitor_cfg: *mut list,
804    pub post_monitor_cfg: *mut list,
805}
806#[derive(Copy, Clone)]
807#[repr(C)]
808pub struct sharedObjectsStruct {
809    pub crlf: *mut robj,
810    pub ok: *mut robj,
811    pub err: *mut robj,
812    pub emptybulk: *mut robj,
813    pub czero: *mut robj,
814    pub cone: *mut robj,
815    pub pong: *mut robj,
816    pub space: *mut robj,
817    pub queued: *mut robj,
818    pub null: [*mut robj; 4],
819    pub nullarray: [*mut robj; 4],
820    pub emptymap: [*mut robj; 4],
821    pub emptyset: [*mut robj; 4],
822    pub emptyarray: *mut robj,
823    pub wrongtypeerr: *mut robj,
824    pub nokeyerr: *mut robj,
825    pub syntaxerr: *mut robj,
826    pub sameobjecterr: *mut robj,
827    pub outofrangeerr: *mut robj,
828    pub noscripterr: *mut robj,
829    pub loadingerr: *mut robj,
830    pub slowevalerr: *mut robj,
831    pub slowscripterr: *mut robj,
832    pub slowmoduleerr: *mut robj,
833    pub bgsaveerr: *mut robj,
834    pub masterdownerr: *mut robj,
835    pub roslaveerr: *mut robj,
836    pub execaborterr: *mut robj,
837    pub noautherr: *mut robj,
838    pub noreplicaserr: *mut robj,
839    pub busykeyerr: *mut robj,
840    pub oomerr: *mut robj,
841    pub plus: *mut robj,
842    pub messagebulk: *mut robj,
843    pub pmessagebulk: *mut robj,
844    pub subscribebulk: *mut robj,
845    pub unsubscribebulk: *mut robj,
846    pub psubscribebulk: *mut robj,
847    pub punsubscribebulk: *mut robj,
848    pub del: *mut robj,
849    pub unlink: *mut robj,
850    pub rpop: *mut robj,
851    pub lpop: *mut robj,
852    pub lpush: *mut robj,
853    pub rpoplpush: *mut robj,
854    pub lmove: *mut robj,
855    pub blmove: *mut robj,
856    pub zpopmin: *mut robj,
857    pub zpopmax: *mut robj,
858    pub emptyscan: *mut robj,
859    pub multi: *mut robj,
860    pub exec: *mut robj,
861    pub left: *mut robj,
862    pub right: *mut robj,
863    pub hset: *mut robj,
864    pub srem: *mut robj,
865    pub xgroup: *mut robj,
866    pub xclaim: *mut robj,
867    pub script: *mut robj,
868    pub replconf: *mut robj,
869    pub eval: *mut robj,
870    pub persist: *mut robj,
871    pub set: *mut robj,
872    pub pexpireat: *mut robj,
873    pub pexpire: *mut robj,
874    pub time: *mut robj,
875    pub pxat: *mut robj,
876    pub absttl: *mut robj,
877    pub retrycount: *mut robj,
878    pub force: *mut robj,
879    pub justid: *mut robj,
880    pub entriesread: *mut robj,
881    pub lastid: *mut robj,
882    pub ping: *mut robj,
883    pub setid: *mut robj,
884    pub keepttl: *mut robj,
885    pub load: *mut robj,
886    pub createconsumer: *mut robj,
887    pub getack: *mut robj,
888    pub special_asterick: *mut robj,
889    pub special_equals: *mut robj,
890    pub default_username: *mut robj,
891    pub redacted: *mut robj,
892    pub ssubscribebulk: *mut robj,
893    pub sunsubscribebulk: *mut robj,
894    pub smessagebulk: *mut robj,
895    pub select: [*mut robj; 10],
896    pub integers: [*mut robj; 10000],
897    pub mbulkhdr: [*mut robj; 32],
898    pub bulkhdr: [*mut robj; 32],
899    pub maphdr: [*mut robj; 32],
900    pub sethdr: [*mut robj; 32],
901    pub minstring: sds,
902    pub maxstring: sds,
903}
904#[derive(Copy, Clone)]
905#[repr(C)]
906pub struct clientBufferLimitsConfig {
907    pub hard_limit_bytes: libc::c_ulonglong,
908    pub soft_limit_bytes: libc::c_ulonglong,
909    pub soft_limit_seconds: time_t,
910}
911#[derive(Copy, Clone)]
912#[repr(C)]
913pub struct redisOp {
914    pub argv: *mut *mut robj,
915    pub argc: libc::c_int,
916    pub dbid: libc::c_int,
917    pub target: libc::c_int,
918}
919#[derive(Copy, Clone)]
920#[repr(C)]
921pub struct redisOpArray {
922    pub ops: *mut redisOp,
923    pub numops: libc::c_int,
924    pub capacity: libc::c_int,
925}
926#[derive(Copy, Clone)]
927#[repr(C)]
928pub struct malloc_stats {
929    pub zmalloc_used: size_t,
930    pub process_rss: size_t,
931    pub allocator_allocated: size_t,
932    pub allocator_active: size_t,
933    pub allocator_resident: size_t,
934}
935#[derive(Copy, Clone)]
936#[repr(C)]
937pub struct socketFds {
938    pub fd: [libc::c_int; 16],
939    pub count: libc::c_int,
940}
941#[derive(Copy, Clone)]
942#[repr(C)]
943pub struct redisTLSContextConfig {
944    pub cert_file: *mut libc::c_char,
945    pub key_file: *mut libc::c_char,
946    pub key_file_pass: *mut libc::c_char,
947    pub client_cert_file: *mut libc::c_char,
948    pub client_key_file: *mut libc::c_char,
949    pub client_key_file_pass: *mut libc::c_char,
950    pub dh_params_file: *mut libc::c_char,
951    pub ca_cert_file: *mut libc::c_char,
952    pub ca_cert_dir: *mut libc::c_char,
953    pub protocols: *mut libc::c_char,
954    pub ciphers: *mut libc::c_char,
955    pub ciphersuites: *mut libc::c_char,
956    pub prefer_server_ciphers: libc::c_int,
957    pub session_caching: libc::c_int,
958    pub session_cache_size: libc::c_int,
959    pub session_cache_timeout: libc::c_int,
960}
961pub type aof_file_type = libc::c_uint;
962pub const AOF_FILE_TYPE_INCR: aof_file_type = 105;
963pub const AOF_FILE_TYPE_HIST: aof_file_type = 104;
964pub const AOF_FILE_TYPE_BASE: aof_file_type = 98;
965#[derive(Copy, Clone)]
966#[repr(C)]
967pub struct aofInfo {
968    pub file_name: sds,
969    pub file_seq: libc::c_longlong,
970    pub file_type: aof_file_type,
971}
972#[derive(Copy, Clone)]
973#[repr(C)]
974pub struct aofManifest {
975    pub base_aof_info: *mut aofInfo,
976    pub incr_aof_list: *mut list,
977    pub history_aof_list: *mut list,
978    pub curr_base_file_seq: libc::c_longlong,
979    pub curr_incr_file_seq: libc::c_longlong,
980    pub dirty: libc::c_int,
981}
982#[derive(Copy, Clone)]
983#[repr(C)]
984pub struct redisServer {
985    pub pid: pid_t,
986    pub main_thread_id: pthread_t,
987    pub configfile: *mut libc::c_char,
988    pub executable: *mut libc::c_char,
989    pub exec_argv: *mut *mut libc::c_char,
990    pub dynamic_hz: libc::c_int,
991    pub config_hz: libc::c_int,
992    pub umask: mode_t,
993    pub hz: libc::c_int,
994    pub in_fork_child: libc::c_int,
995    pub db: *mut redisDb,
996    pub commands: *mut dict,
997    pub orig_commands: *mut dict,
998    pub el: *mut aeEventLoop,
999    pub errors: *mut rax,
1000    pub lruclock: atomic_uint,
1001    pub shutdown_asap: sig_atomic_t,
1002    pub shutdown_mstime: mstime_t,
1003    pub last_sig_received: libc::c_int,
1004    pub shutdown_flags: libc::c_int,
1005    pub activerehashing: libc::c_int,
1006    pub active_defrag_running: libc::c_int,
1007    pub pidfile: *mut libc::c_char,
1008    pub arch_bits: libc::c_int,
1009    pub cronloops: libc::c_int,
1010    pub runid: [libc::c_char; 41],
1011    pub sentinel_mode: libc::c_int,
1012    pub initial_memory_usage: size_t,
1013    pub always_show_logo: libc::c_int,
1014    pub in_exec: libc::c_int,
1015    pub busy_module_yield_flags: libc::c_int,
1016    pub busy_module_yield_reply: *const libc::c_char,
1017    pub core_propagates: libc::c_int,
1018    pub propagate_no_multi: libc::c_int,
1019    pub module_ctx_nesting: libc::c_int,
1020    pub ignore_warnings: *mut libc::c_char,
1021    pub client_pause_in_transaction: libc::c_int,
1022    pub thp_enabled: libc::c_int,
1023    pub page_size: size_t,
1024    pub moduleapi: *mut dict,
1025    pub sharedapi: *mut dict,
1026    pub module_configs_queue: *mut dict,
1027    pub loadmodule_queue: *mut list,
1028    pub module_pipe: [libc::c_int; 2],
1029    pub child_pid: pid_t,
1030    pub child_type: libc::c_int,
1031    pub port: libc::c_int,
1032    pub tls_port: libc::c_int,
1033    pub tcp_backlog: libc::c_int,
1034    pub bindaddr: [*mut libc::c_char; 16],
1035    pub bindaddr_count: libc::c_int,
1036    pub bind_source_addr: *mut libc::c_char,
1037    pub unixsocket: *mut libc::c_char,
1038    pub unixsocketperm: libc::c_uint,
1039    pub ipfd: socketFds,
1040    pub tlsfd: socketFds,
1041    pub sofd: libc::c_int,
1042    pub socket_mark_id: uint32_t,
1043    pub cfd: socketFds,
1044    pub clients: *mut list,
1045    pub clients_to_close: *mut list,
1046    pub clients_pending_write: *mut list,
1047    pub clients_pending_read: *mut list,
1048    pub slaves: *mut list,
1049    pub monitors: *mut list,
1050    pub current_client: *mut client,
1051    pub client_mem_usage_buckets: *mut clientMemUsageBucket,
1052    pub clients_timeout_table: *mut rax,
1053    pub fixed_time_expire: libc::c_long,
1054    pub in_nested_call: libc::c_int,
1055    pub clients_index: *mut rax,
1056    pub client_pause_type: pause_type,
1057    pub postponed_clients: *mut list,
1058    pub client_pause_end_time: mstime_t,
1059    pub client_pause_per_purpose: [*mut pause_event; 3],
1060    pub neterr: [libc::c_char; 256],
1061    pub migrate_cached_sockets: *mut dict,
1062    pub next_client_id: uint_least64_t,
1063    pub protected_mode: libc::c_int,
1064    pub io_threads_num: libc::c_int,
1065    pub io_threads_do_reads: libc::c_int,
1066    pub io_threads_active: libc::c_int,
1067    pub events_processed_while_blocked: libc::c_longlong,
1068    pub enable_protected_configs: libc::c_int,
1069    pub enable_debug_cmd: libc::c_int,
1070    pub enable_module_cmd: libc::c_int,
1071    pub loading: sig_atomic_t,
1072    pub async_loading: sig_atomic_t,
1073    pub loading_total_bytes: off_t,
1074    pub loading_rdb_used_mem: off_t,
1075    pub loading_loaded_bytes: off_t,
1076    pub loading_start_time: time_t,
1077    pub loading_process_events_interval_bytes: off_t,
1078    pub stat_starttime: time_t,
1079    pub stat_numcommands: libc::c_longlong,
1080    pub stat_numconnections: libc::c_longlong,
1081    pub stat_expiredkeys: libc::c_longlong,
1082    pub stat_expired_stale_perc: libc::c_double,
1083    pub stat_expired_time_cap_reached_count: libc::c_longlong,
1084    pub stat_expire_cycle_time_used: libc::c_longlong,
1085    pub stat_evictedkeys: libc::c_longlong,
1086    pub stat_evictedclients: libc::c_longlong,
1087    pub stat_total_eviction_exceeded_time: libc::c_longlong,
1088    pub stat_last_eviction_exceeded_time: monotime,
1089    pub stat_keyspace_hits: libc::c_longlong,
1090    pub stat_keyspace_misses: libc::c_longlong,
1091    pub stat_active_defrag_hits: libc::c_longlong,
1092    pub stat_active_defrag_misses: libc::c_longlong,
1093    pub stat_active_defrag_key_hits: libc::c_longlong,
1094    pub stat_active_defrag_key_misses: libc::c_longlong,
1095    pub stat_active_defrag_scanned: libc::c_longlong,
1096    pub stat_total_active_defrag_time: libc::c_longlong,
1097    pub stat_last_active_defrag_time: monotime,
1098    pub stat_peak_memory: size_t,
1099    pub stat_aof_rewrites: libc::c_longlong,
1100    pub stat_aofrw_consecutive_failures: libc::c_longlong,
1101    pub stat_rdb_saves: libc::c_longlong,
1102    pub stat_fork_time: libc::c_longlong,
1103    pub stat_fork_rate: libc::c_double,
1104    pub stat_total_forks: libc::c_longlong,
1105    pub stat_rejected_conn: libc::c_longlong,
1106    pub stat_sync_full: libc::c_longlong,
1107    pub stat_sync_partial_ok: libc::c_longlong,
1108    pub stat_sync_partial_err: libc::c_longlong,
1109    pub slowlog: *mut list,
1110    pub slowlog_entry_id: libc::c_longlong,
1111    pub slowlog_log_slower_than: libc::c_longlong,
1112    pub slowlog_max_len: libc::c_ulong,
1113    pub cron_malloc_stats: malloc_stats,
1114    pub stat_net_input_bytes: atomic_llong,
1115    pub stat_net_output_bytes: atomic_llong,
1116    pub stat_net_repl_input_bytes: atomic_llong,
1117    pub stat_net_repl_output_bytes: atomic_llong,
1118    pub stat_current_cow_peak: size_t,
1119    pub stat_current_cow_bytes: size_t,
1120    pub stat_current_cow_updated: monotime,
1121    pub stat_current_save_keys_processed: size_t,
1122    pub stat_current_save_keys_total: size_t,
1123    pub stat_rdb_cow_bytes: size_t,
1124    pub stat_aof_cow_bytes: size_t,
1125    pub stat_module_cow_bytes: size_t,
1126    pub stat_module_progress: libc::c_double,
1127    pub stat_clients_type_memory: [size_t; 4],
1128    pub stat_cluster_links_memory: size_t,
1129    pub stat_unexpected_error_replies: libc::c_longlong,
1130    pub stat_total_error_replies: libc::c_longlong,
1131    pub stat_dump_payload_sanitizations: libc::c_longlong,
1132    pub stat_io_reads_processed: libc::c_longlong,
1133    pub stat_io_writes_processed: libc::c_longlong,
1134    pub stat_total_reads_processed: atomic_llong,
1135    pub stat_total_writes_processed: atomic_llong,
1136    pub inst_metric: [C2RustUnnamed_6; 5],
1137    pub stat_reply_buffer_shrinks: libc::c_longlong,
1138    pub stat_reply_buffer_expands: libc::c_longlong,
1139    pub verbosity: libc::c_int,
1140    pub maxidletime: libc::c_int,
1141    pub tcpkeepalive: libc::c_int,
1142    pub active_expire_enabled: libc::c_int,
1143    pub active_expire_effort: libc::c_int,
1144    pub active_defrag_enabled: libc::c_int,
1145    pub sanitize_dump_payload: libc::c_int,
1146    pub skip_checksum_validation: libc::c_int,
1147    pub jemalloc_bg_thread: libc::c_int,
1148    pub active_defrag_ignore_bytes: size_t,
1149    pub active_defrag_threshold_lower: libc::c_int,
1150    pub active_defrag_threshold_upper: libc::c_int,
1151    pub active_defrag_cycle_min: libc::c_int,
1152    pub active_defrag_cycle_max: libc::c_int,
1153    pub active_defrag_max_scan_fields: libc::c_ulong,
1154    pub client_max_querybuf_len: size_t,
1155    pub dbnum: libc::c_int,
1156    pub supervised: libc::c_int,
1157    pub supervised_mode: libc::c_int,
1158    pub daemonize: libc::c_int,
1159    pub set_proc_title: libc::c_int,
1160    pub proc_title_template: *mut libc::c_char,
1161    pub client_obuf_limits: [clientBufferLimitsConfig; 3],
1162    pub pause_cron: libc::c_int,
1163    pub latency_tracking_enabled: libc::c_int,
1164    pub latency_tracking_info_percentiles: *mut libc::c_double,
1165    pub latency_tracking_info_percentiles_len: libc::c_int,
1166    pub aof_enabled: libc::c_int,
1167    pub aof_state: libc::c_int,
1168    pub aof_fsync: libc::c_int,
1169    pub aof_filename: *mut libc::c_char,
1170    pub aof_dirname: *mut libc::c_char,
1171    pub aof_no_fsync_on_rewrite: libc::c_int,
1172    pub aof_rewrite_perc: libc::c_int,
1173    pub aof_rewrite_min_size: off_t,
1174    pub aof_rewrite_base_size: off_t,
1175    pub aof_current_size: off_t,
1176    pub aof_last_incr_size: off_t,
1177    pub aof_fsync_offset: off_t,
1178    pub aof_flush_sleep: libc::c_int,
1179    pub aof_rewrite_scheduled: libc::c_int,
1180    pub aof_buf: sds,
1181    pub aof_fd: libc::c_int,
1182    pub aof_selected_db: libc::c_int,
1183    pub aof_flush_postponed_start: time_t,
1184    pub aof_last_fsync: time_t,
1185    pub aof_rewrite_time_last: time_t,
1186    pub aof_rewrite_time_start: time_t,
1187    pub aof_cur_timestamp: time_t,
1188    pub aof_timestamp_enabled: libc::c_int,
1189    pub aof_lastbgrewrite_status: libc::c_int,
1190    pub aof_delayed_fsync: libc::c_ulong,
1191    pub aof_rewrite_incremental_fsync: libc::c_int,
1192    pub rdb_save_incremental_fsync: libc::c_int,
1193    pub aof_last_write_status: libc::c_int,
1194    pub aof_last_write_errno: libc::c_int,
1195    pub aof_load_truncated: libc::c_int,
1196    pub aof_use_rdb_preamble: libc::c_int,
1197    pub aof_bio_fsync_status: atomic_int,
1198    pub aof_bio_fsync_errno: atomic_int,
1199    pub aof_manifest: *mut aofManifest,
1200    pub aof_disable_auto_gc: libc::c_int,
1201    pub dirty: libc::c_longlong,
1202    pub dirty_before_bgsave: libc::c_longlong,
1203    pub rdb_last_load_keys_expired: libc::c_longlong,
1204    pub rdb_last_load_keys_loaded: libc::c_longlong,
1205    pub saveparams: *mut saveparam,
1206    pub saveparamslen: libc::c_int,
1207    pub rdb_filename: *mut libc::c_char,
1208    pub rdb_compression: libc::c_int,
1209    pub rdb_checksum: libc::c_int,
1210    pub rdb_del_sync_files: libc::c_int,
1211    pub lastsave: time_t,
1212    pub lastbgsave_try: time_t,
1213    pub rdb_save_time_last: time_t,
1214    pub rdb_save_time_start: time_t,
1215    pub rdb_bgsave_scheduled: libc::c_int,
1216    pub rdb_child_type: libc::c_int,
1217    pub lastbgsave_status: libc::c_int,
1218    pub stop_writes_on_bgsave_err: libc::c_int,
1219    pub rdb_pipe_read: libc::c_int,
1220    pub rdb_child_exit_pipe: libc::c_int,
1221    pub rdb_pipe_conns: *mut *mut connection,
1222    pub rdb_pipe_numconns: libc::c_int,
1223    pub rdb_pipe_numconns_writing: libc::c_int,
1224    pub rdb_pipe_buff: *mut libc::c_char,
1225    pub rdb_pipe_bufflen: libc::c_int,
1226    pub rdb_key_save_delay: libc::c_int,
1227    pub key_load_delay: libc::c_int,
1228    pub child_info_pipe: [libc::c_int; 2],
1229    pub child_info_nread: libc::c_int,
1230    pub also_propagate: redisOpArray,
1231    pub replication_allowed: libc::c_int,
1232    pub logfile: *mut libc::c_char,
1233    pub syslog_enabled: libc::c_int,
1234    pub syslog_ident: *mut libc::c_char,
1235    pub syslog_facility: libc::c_int,
1236    pub crashlog_enabled: libc::c_int,
1237    pub memcheck_enabled: libc::c_int,
1238    pub use_exit_on_panic: libc::c_int,
1239    pub shutdown_timeout: libc::c_int,
1240    pub shutdown_on_sigint: libc::c_int,
1241    pub shutdown_on_sigterm: libc::c_int,
1242    pub replid: [libc::c_char; 41],
1243    pub replid2: [libc::c_char; 41],
1244    pub master_repl_offset: libc::c_longlong,
1245    pub second_replid_offset: libc::c_longlong,
1246    pub slaveseldb: libc::c_int,
1247    pub repl_ping_slave_period: libc::c_int,
1248    pub repl_backlog: *mut replBacklog,
1249    pub repl_backlog_size: libc::c_longlong,
1250    pub repl_backlog_time_limit: time_t,
1251    pub repl_no_slaves_since: time_t,
1252    pub repl_min_slaves_to_write: libc::c_int,
1253    pub repl_min_slaves_max_lag: libc::c_int,
1254    pub repl_good_slaves_count: libc::c_int,
1255    pub repl_diskless_sync: libc::c_int,
1256    pub repl_diskless_load: libc::c_int,
1257    pub repl_diskless_sync_delay: libc::c_int,
1258    pub repl_diskless_sync_max_replicas: libc::c_int,
1259    pub repl_buffer_mem: size_t,
1260    pub repl_buffer_blocks: *mut list,
1261    pub masteruser: *mut libc::c_char,
1262    pub masterauth: sds,
1263    pub masterhost: *mut libc::c_char,
1264    pub masterport: libc::c_int,
1265    pub repl_timeout: libc::c_int,
1266    pub master: *mut client,
1267    pub cached_master: *mut client,
1268    pub repl_syncio_timeout: libc::c_int,
1269    pub repl_state: libc::c_int,
1270    pub repl_transfer_size: off_t,
1271    pub repl_transfer_read: off_t,
1272    pub repl_transfer_last_fsync_off: off_t,
1273    pub repl_transfer_s: *mut connection,
1274    pub repl_transfer_fd: libc::c_int,
1275    pub repl_transfer_tmpfile: *mut libc::c_char,
1276    pub repl_transfer_lastio: time_t,
1277    pub repl_serve_stale_data: libc::c_int,
1278    pub repl_slave_ro: libc::c_int,
1279    pub repl_slave_ignore_maxmemory: libc::c_int,
1280    pub repl_down_since: time_t,
1281    pub repl_disable_tcp_nodelay: libc::c_int,
1282    pub slave_priority: libc::c_int,
1283    pub replica_announced: libc::c_int,
1284    pub slave_announce_port: libc::c_int,
1285    pub slave_announce_ip: *mut libc::c_char,
1286    pub propagation_error_behavior: libc::c_int,
1287    pub repl_ignore_disk_write_error: libc::c_int,
1288    pub master_replid: [libc::c_char; 41],
1289    pub master_initial_offset: libc::c_longlong,
1290    pub repl_slave_lazy_flush: libc::c_int,
1291    pub clients_waiting_acks: *mut list,
1292    pub get_ack_from_slaves: libc::c_int,
1293    pub maxclients: libc::c_uint,
1294    pub maxmemory: libc::c_ulonglong,
1295    pub maxmemory_clients: ssize_t,
1296    pub maxmemory_policy: libc::c_int,
1297    pub maxmemory_samples: libc::c_int,
1298    pub maxmemory_eviction_tenacity: libc::c_int,
1299    pub lfu_log_factor: libc::c_int,
1300    pub lfu_decay_time: libc::c_int,
1301    pub proto_max_bulk_len: libc::c_longlong,
1302    pub oom_score_adj_values: [libc::c_int; 3],
1303    pub oom_score_adj: libc::c_int,
1304    pub disable_thp: libc::c_int,
1305    pub blocked_clients: libc::c_uint,
1306    pub blocked_clients_by_type: [libc::c_uint; 8],
1307    pub unblocked_clients: *mut list,
1308    pub ready_keys: *mut list,
1309    pub tracking_clients: libc::c_uint,
1310    pub tracking_table_max_keys: size_t,
1311    pub tracking_pending_keys: *mut list,
1312    pub sort_desc: libc::c_int,
1313    pub sort_alpha: libc::c_int,
1314    pub sort_bypattern: libc::c_int,
1315    pub sort_store: libc::c_int,
1316    pub hash_max_listpack_entries: size_t,
1317    pub hash_max_listpack_value: size_t,
1318    pub set_max_intset_entries: size_t,
1319    pub zset_max_listpack_entries: size_t,
1320    pub zset_max_listpack_value: size_t,
1321    pub hll_sparse_max_bytes: size_t,
1322    pub stream_node_max_bytes: size_t,
1323    pub stream_node_max_entries: libc::c_longlong,
1324    pub list_max_listpack_size: libc::c_int,
1325    pub list_compress_depth: libc::c_int,
1326    pub unixtime: atomic_int,
1327    pub timezone: time_t,
1328    pub daylight_active: libc::c_int,
1329    pub mstime: mstime_t,
1330    pub ustime: ustime_t,
1331    pub blocking_op_nesting: size_t,
1332    pub blocked_last_cron: libc::c_longlong,
1333    pub pubsub_channels: *mut dict,
1334    pub pubsub_patterns: *mut dict,
1335    pub notify_keyspace_events: libc::c_int,
1336    pub pubsubshard_channels: *mut dict,
1337    pub cluster_enabled: libc::c_int,
1338    pub cluster_port: libc::c_int,
1339    pub cluster_node_timeout: mstime_t,
1340    pub cluster_configfile: *mut libc::c_char,
1341    pub cluster: *mut clusterState,
1342    pub cluster_migration_barrier: libc::c_int,
1343    pub cluster_allow_replica_migration: libc::c_int,
1344    pub cluster_slave_validity_factor: libc::c_int,
1345    pub cluster_require_full_coverage: libc::c_int,
1346    pub cluster_slave_no_failover: libc::c_int,
1347    pub cluster_announce_ip: *mut libc::c_char,
1348    pub cluster_announce_hostname: *mut libc::c_char,
1349    pub cluster_preferred_endpoint_type: libc::c_int,
1350    pub cluster_announce_port: libc::c_int,
1351    pub cluster_announce_tls_port: libc::c_int,
1352    pub cluster_announce_bus_port: libc::c_int,
1353    pub cluster_module_flags: libc::c_int,
1354    pub cluster_allow_reads_when_down: libc::c_int,
1355    pub cluster_config_file_lock_fd: libc::c_int,
1356    pub cluster_link_sendbuf_limit_bytes: libc::c_ulonglong,
1357    pub cluster_drop_packet_filter: libc::c_int,
1358    pub script_caller: *mut client,
1359    pub busy_reply_threshold: mstime_t,
1360    pub pre_command_oom_state: libc::c_int,
1361    pub script_disable_deny_script: libc::c_int,
1362    pub lazyfree_lazy_eviction: libc::c_int,
1363    pub lazyfree_lazy_expire: libc::c_int,
1364    pub lazyfree_lazy_server_del: libc::c_int,
1365    pub lazyfree_lazy_user_del: libc::c_int,
1366    pub lazyfree_lazy_user_flush: libc::c_int,
1367    pub latency_monitor_threshold: libc::c_longlong,
1368    pub latency_events: *mut dict,
1369    pub acl_filename: *mut libc::c_char,
1370    pub acllog_max_len: libc::c_ulong,
1371    pub requirepass: sds,
1372    pub acl_pubsub_default: libc::c_int,
1373    pub watchdog_period: libc::c_int,
1374    pub system_memory_size: size_t,
1375    pub tls_cluster: libc::c_int,
1376    pub tls_replication: libc::c_int,
1377    pub tls_auth_clients: libc::c_int,
1378    pub tls_ctx_config: redisTLSContextConfig,
1379    pub server_cpulist: *mut libc::c_char,
1380    pub bio_cpulist: *mut libc::c_char,
1381    pub aof_rewrite_cpulist: *mut libc::c_char,
1382    pub bgsave_cpulist: *mut libc::c_char,
1383    pub sentinel_config: *mut sentinelConfig,
1384    pub failover_end_time: mstime_t,
1385    pub force_failover: libc::c_int,
1386    pub target_replica_host: *mut libc::c_char,
1387    pub target_replica_port: libc::c_int,
1388    pub failover_state: libc::c_int,
1389    pub cluster_allow_pubsubshard_when_down: libc::c_int,
1390    pub reply_buffer_peak_reset_time: libc::c_long,
1391    pub reply_buffer_resizing_enabled: libc::c_int,
1392}
1393#[derive(Copy, Clone)]
1394#[repr(C)]
1395pub struct C2RustUnnamed_6 {
1396    pub last_sample_time: libc::c_longlong,
1397    pub last_sample_count: libc::c_longlong,
1398    pub samples: [libc::c_longlong; 16],
1399    pub idx: libc::c_int,
1400}
1401#[derive(Copy, Clone)]
1402#[repr(C)]
1403pub struct bitfieldOp {
1404    pub offset: uint64_t,
1405    pub i64_0: int64_t,
1406    pub opcode: libc::c_int,
1407    pub owtype: libc::c_int,
1408    pub bits: libc::c_int,
1409    pub sign: libc::c_int,
1410}
1411#[derive(Copy, Clone)]
1412#[repr(C)]
1413pub union C2RustUnnamed_7 {
1414    pub u: uint64_t,
1415    pub i: int64_t,
1416}
1417#[inline]
1418unsafe extern "C" fn sdslen(s: sds) -> size_t {
1419    let mut flags: libc::c_uchar = *s.offset(-(1 as libc::c_int) as isize)
1420        as libc::c_uchar;
1421    match flags as libc::c_int & 7 as libc::c_int {
1422        0 => return (flags as libc::c_int >> 3 as libc::c_int) as size_t,
1423        1 => {
1424            return (*(s
1425                .offset(-(core::mem::size_of::<sdshdr8>() as libc::c_ulong as isize))
1426                as *mut sdshdr8))
1427                .len as size_t;
1428        }
1429        2 => {
1430            return (*(s
1431                .offset(-(core::mem::size_of::<sdshdr16>() as libc::c_ulong as isize))
1432                as *mut sdshdr16))
1433                .len as size_t;
1434        }
1435        3 => {
1436            return (*(s
1437                .offset(-(core::mem::size_of::<sdshdr32>() as libc::c_ulong as isize))
1438                as *mut sdshdr32))
1439                .len as size_t;
1440        }
1441        4 => {
1442            return (*(s
1443                .offset(-(core::mem::size_of::<sdshdr64>() as libc::c_ulong as isize))
1444                as *mut sdshdr64))
1445                .len;
1446        }
1447        _ => {}
1448    }
1449    return 0 as libc::c_int as size_t;
1450}
1451#[no_mangle]
1452pub unsafe extern "C" fn redisPopcount(
1453    mut s: *mut libc::c_void,
1454    mut count: libc::c_long,
1455) -> libc::c_longlong {
1456    let mut bits: libc::c_longlong = 0 as libc::c_int as libc::c_longlong;
1457    let mut p: *mut libc::c_uchar = s as *mut libc::c_uchar;
1458    let mut p4: *mut uint32_t = 0 as *mut uint32_t;
1459    static mut bitsinbyte: [libc::c_uchar; 256] = [
1460        0 as libc::c_int as libc::c_uchar,
1461        1 as libc::c_int as libc::c_uchar,
1462        1 as libc::c_int as libc::c_uchar,
1463        2 as libc::c_int as libc::c_uchar,
1464        1 as libc::c_int as libc::c_uchar,
1465        2 as libc::c_int as libc::c_uchar,
1466        2 as libc::c_int as libc::c_uchar,
1467        3 as libc::c_int as libc::c_uchar,
1468        1 as libc::c_int as libc::c_uchar,
1469        2 as libc::c_int as libc::c_uchar,
1470        2 as libc::c_int as libc::c_uchar,
1471        3 as libc::c_int as libc::c_uchar,
1472        2 as libc::c_int as libc::c_uchar,
1473        3 as libc::c_int as libc::c_uchar,
1474        3 as libc::c_int as libc::c_uchar,
1475        4 as libc::c_int as libc::c_uchar,
1476        1 as libc::c_int as libc::c_uchar,
1477        2 as libc::c_int as libc::c_uchar,
1478        2 as libc::c_int as libc::c_uchar,
1479        3 as libc::c_int as libc::c_uchar,
1480        2 as libc::c_int as libc::c_uchar,
1481        3 as libc::c_int as libc::c_uchar,
1482        3 as libc::c_int as libc::c_uchar,
1483        4 as libc::c_int as libc::c_uchar,
1484        2 as libc::c_int as libc::c_uchar,
1485        3 as libc::c_int as libc::c_uchar,
1486        3 as libc::c_int as libc::c_uchar,
1487        4 as libc::c_int as libc::c_uchar,
1488        3 as libc::c_int as libc::c_uchar,
1489        4 as libc::c_int as libc::c_uchar,
1490        4 as libc::c_int as libc::c_uchar,
1491        5 as libc::c_int as libc::c_uchar,
1492        1 as libc::c_int as libc::c_uchar,
1493        2 as libc::c_int as libc::c_uchar,
1494        2 as libc::c_int as libc::c_uchar,
1495        3 as libc::c_int as libc::c_uchar,
1496        2 as libc::c_int as libc::c_uchar,
1497        3 as libc::c_int as libc::c_uchar,
1498        3 as libc::c_int as libc::c_uchar,
1499        4 as libc::c_int as libc::c_uchar,
1500        2 as libc::c_int as libc::c_uchar,
1501        3 as libc::c_int as libc::c_uchar,
1502        3 as libc::c_int as libc::c_uchar,
1503        4 as libc::c_int as libc::c_uchar,
1504        3 as libc::c_int as libc::c_uchar,
1505        4 as libc::c_int as libc::c_uchar,
1506        4 as libc::c_int as libc::c_uchar,
1507        5 as libc::c_int as libc::c_uchar,
1508        2 as libc::c_int as libc::c_uchar,
1509        3 as libc::c_int as libc::c_uchar,
1510        3 as libc::c_int as libc::c_uchar,
1511        4 as libc::c_int as libc::c_uchar,
1512        3 as libc::c_int as libc::c_uchar,
1513        4 as libc::c_int as libc::c_uchar,
1514        4 as libc::c_int as libc::c_uchar,
1515        5 as libc::c_int as libc::c_uchar,
1516        3 as libc::c_int as libc::c_uchar,
1517        4 as libc::c_int as libc::c_uchar,
1518        4 as libc::c_int as libc::c_uchar,
1519        5 as libc::c_int as libc::c_uchar,
1520        4 as libc::c_int as libc::c_uchar,
1521        5 as libc::c_int as libc::c_uchar,
1522        5 as libc::c_int as libc::c_uchar,
1523        6 as libc::c_int as libc::c_uchar,
1524        1 as libc::c_int as libc::c_uchar,
1525        2 as libc::c_int as libc::c_uchar,
1526        2 as libc::c_int as libc::c_uchar,
1527        3 as libc::c_int as libc::c_uchar,
1528        2 as libc::c_int as libc::c_uchar,
1529        3 as libc::c_int as libc::c_uchar,
1530        3 as libc::c_int as libc::c_uchar,
1531        4 as libc::c_int as libc::c_uchar,
1532        2 as libc::c_int as libc::c_uchar,
1533        3 as libc::c_int as libc::c_uchar,
1534        3 as libc::c_int as libc::c_uchar,
1535        4 as libc::c_int as libc::c_uchar,
1536        3 as libc::c_int as libc::c_uchar,
1537        4 as libc::c_int as libc::c_uchar,
1538        4 as libc::c_int as libc::c_uchar,
1539        5 as libc::c_int as libc::c_uchar,
1540        2 as libc::c_int as libc::c_uchar,
1541        3 as libc::c_int as libc::c_uchar,
1542        3 as libc::c_int as libc::c_uchar,
1543        4 as libc::c_int as libc::c_uchar,
1544        3 as libc::c_int as libc::c_uchar,
1545        4 as libc::c_int as libc::c_uchar,
1546        4 as libc::c_int as libc::c_uchar,
1547        5 as libc::c_int as libc::c_uchar,
1548        3 as libc::c_int as libc::c_uchar,
1549        4 as libc::c_int as libc::c_uchar,
1550        4 as libc::c_int as libc::c_uchar,
1551        5 as libc::c_int as libc::c_uchar,
1552        4 as libc::c_int as libc::c_uchar,
1553        5 as libc::c_int as libc::c_uchar,
1554        5 as libc::c_int as libc::c_uchar,
1555        6 as libc::c_int as libc::c_uchar,
1556        2 as libc::c_int as libc::c_uchar,
1557        3 as libc::c_int as libc::c_uchar,
1558        3 as libc::c_int as libc::c_uchar,
1559        4 as libc::c_int as libc::c_uchar,
1560        3 as libc::c_int as libc::c_uchar,
1561        4 as libc::c_int as libc::c_uchar,
1562        4 as libc::c_int as libc::c_uchar,
1563        5 as libc::c_int as libc::c_uchar,
1564        3 as libc::c_int as libc::c_uchar,
1565        4 as libc::c_int as libc::c_uchar,
1566        4 as libc::c_int as libc::c_uchar,
1567        5 as libc::c_int as libc::c_uchar,
1568        4 as libc::c_int as libc::c_uchar,
1569        5 as libc::c_int as libc::c_uchar,
1570        5 as libc::c_int as libc::c_uchar,
1571        6 as libc::c_int as libc::c_uchar,
1572        3 as libc::c_int as libc::c_uchar,
1573        4 as libc::c_int as libc::c_uchar,
1574        4 as libc::c_int as libc::c_uchar,
1575        5 as libc::c_int as libc::c_uchar,
1576        4 as libc::c_int as libc::c_uchar,
1577        5 as libc::c_int as libc::c_uchar,
1578        5 as libc::c_int as libc::c_uchar,
1579        6 as libc::c_int as libc::c_uchar,
1580        4 as libc::c_int as libc::c_uchar,
1581        5 as libc::c_int as libc::c_uchar,
1582        5 as libc::c_int as libc::c_uchar,
1583        6 as libc::c_int as libc::c_uchar,
1584        5 as libc::c_int as libc::c_uchar,
1585        6 as libc::c_int as libc::c_uchar,
1586        6 as libc::c_int as libc::c_uchar,
1587        7 as libc::c_int as libc::c_uchar,
1588        1 as libc::c_int as libc::c_uchar,
1589        2 as libc::c_int as libc::c_uchar,
1590        2 as libc::c_int as libc::c_uchar,
1591        3 as libc::c_int as libc::c_uchar,
1592        2 as libc::c_int as libc::c_uchar,
1593        3 as libc::c_int as libc::c_uchar,
1594        3 as libc::c_int as libc::c_uchar,
1595        4 as libc::c_int as libc::c_uchar,
1596        2 as libc::c_int as libc::c_uchar,
1597        3 as libc::c_int as libc::c_uchar,
1598        3 as libc::c_int as libc::c_uchar,
1599        4 as libc::c_int as libc::c_uchar,
1600        3 as libc::c_int as libc::c_uchar,
1601        4 as libc::c_int as libc::c_uchar,
1602        4 as libc::c_int as libc::c_uchar,
1603        5 as libc::c_int as libc::c_uchar,
1604        2 as libc::c_int as libc::c_uchar,
1605        3 as libc::c_int as libc::c_uchar,
1606        3 as libc::c_int as libc::c_uchar,
1607        4 as libc::c_int as libc::c_uchar,
1608        3 as libc::c_int as libc::c_uchar,
1609        4 as libc::c_int as libc::c_uchar,
1610        4 as libc::c_int as libc::c_uchar,
1611        5 as libc::c_int as libc::c_uchar,
1612        3 as libc::c_int as libc::c_uchar,
1613        4 as libc::c_int as libc::c_uchar,
1614        4 as libc::c_int as libc::c_uchar,
1615        5 as libc::c_int as libc::c_uchar,
1616        4 as libc::c_int as libc::c_uchar,
1617        5 as libc::c_int as libc::c_uchar,
1618        5 as libc::c_int as libc::c_uchar,
1619        6 as libc::c_int as libc::c_uchar,
1620        2 as libc::c_int as libc::c_uchar,
1621        3 as libc::c_int as libc::c_uchar,
1622        3 as libc::c_int as libc::c_uchar,
1623        4 as libc::c_int as libc::c_uchar,
1624        3 as libc::c_int as libc::c_uchar,
1625        4 as libc::c_int as libc::c_uchar,
1626        4 as libc::c_int as libc::c_uchar,
1627        5 as libc::c_int as libc::c_uchar,
1628        3 as libc::c_int as libc::c_uchar,
1629        4 as libc::c_int as libc::c_uchar,
1630        4 as libc::c_int as libc::c_uchar,
1631        5 as libc::c_int as libc::c_uchar,
1632        4 as libc::c_int as libc::c_uchar,
1633        5 as libc::c_int as libc::c_uchar,
1634        5 as libc::c_int as libc::c_uchar,
1635        6 as libc::c_int as libc::c_uchar,
1636        3 as libc::c_int as libc::c_uchar,
1637        4 as libc::c_int as libc::c_uchar,
1638        4 as libc::c_int as libc::c_uchar,
1639        5 as libc::c_int as libc::c_uchar,
1640        4 as libc::c_int as libc::c_uchar,
1641        5 as libc::c_int as libc::c_uchar,
1642        5 as libc::c_int as libc::c_uchar,
1643        6 as libc::c_int as libc::c_uchar,
1644        4 as libc::c_int as libc::c_uchar,
1645        5 as libc::c_int as libc::c_uchar,
1646        5 as libc::c_int as libc::c_uchar,
1647        6 as libc::c_int as libc::c_uchar,
1648        5 as libc::c_int as libc::c_uchar,
1649        6 as libc::c_int as libc::c_uchar,
1650        6 as libc::c_int as libc::c_uchar,
1651        7 as libc::c_int as libc::c_uchar,
1652        2 as libc::c_int as libc::c_uchar,
1653        3 as libc::c_int as libc::c_uchar,
1654        3 as libc::c_int as libc::c_uchar,
1655        4 as libc::c_int as libc::c_uchar,
1656        3 as libc::c_int as libc::c_uchar,
1657        4 as libc::c_int as libc::c_uchar,
1658        4 as libc::c_int as libc::c_uchar,
1659        5 as libc::c_int as libc::c_uchar,
1660        3 as libc::c_int as libc::c_uchar,
1661        4 as libc::c_int as libc::c_uchar,
1662        4 as libc::c_int as libc::c_uchar,
1663        5 as libc::c_int as libc::c_uchar,
1664        4 as libc::c_int as libc::c_uchar,
1665        5 as libc::c_int as libc::c_uchar,
1666        5 as libc::c_int as libc::c_uchar,
1667        6 as libc::c_int as libc::c_uchar,
1668        3 as libc::c_int as libc::c_uchar,
1669        4 as libc::c_int as libc::c_uchar,
1670        4 as libc::c_int as libc::c_uchar,
1671        5 as libc::c_int as libc::c_uchar,
1672        4 as libc::c_int as libc::c_uchar,
1673        5 as libc::c_int as libc::c_uchar,
1674        5 as libc::c_int as libc::c_uchar,
1675        6 as libc::c_int as libc::c_uchar,
1676        4 as libc::c_int as libc::c_uchar,
1677        5 as libc::c_int as libc::c_uchar,
1678        5 as libc::c_int as libc::c_uchar,
1679        6 as libc::c_int as libc::c_uchar,
1680        5 as libc::c_int as libc::c_uchar,
1681        6 as libc::c_int as libc::c_uchar,
1682        6 as libc::c_int as libc::c_uchar,
1683        7 as libc::c_int as libc::c_uchar,
1684        3 as libc::c_int as libc::c_uchar,
1685        4 as libc::c_int as libc::c_uchar,
1686        4 as libc::c_int as libc::c_uchar,
1687        5 as libc::c_int as libc::c_uchar,
1688        4 as libc::c_int as libc::c_uchar,
1689        5 as libc::c_int as libc::c_uchar,
1690        5 as libc::c_int as libc::c_uchar,
1691        6 as libc::c_int as libc::c_uchar,
1692        4 as libc::c_int as libc::c_uchar,
1693        5 as libc::c_int as libc::c_uchar,
1694        5 as libc::c_int as libc::c_uchar,
1695        6 as libc::c_int as libc::c_uchar,
1696        5 as libc::c_int as libc::c_uchar,
1697        6 as libc::c_int as libc::c_uchar,
1698        6 as libc::c_int as libc::c_uchar,
1699        7 as libc::c_int as libc::c_uchar,
1700        4 as libc::c_int as libc::c_uchar,
1701        5 as libc::c_int as libc::c_uchar,
1702        5 as libc::c_int as libc::c_uchar,
1703        6 as libc::c_int as libc::c_uchar,
1704        5 as libc::c_int as libc::c_uchar,
1705        6 as libc::c_int as libc::c_uchar,
1706        6 as libc::c_int as libc::c_uchar,
1707        7 as libc::c_int as libc::c_uchar,
1708        5 as libc::c_int as libc::c_uchar,
1709        6 as libc::c_int as libc::c_uchar,
1710        6 as libc::c_int as libc::c_uchar,
1711        7 as libc::c_int as libc::c_uchar,
1712        6 as libc::c_int as libc::c_uchar,
1713        7 as libc::c_int as libc::c_uchar,
1714        7 as libc::c_int as libc::c_uchar,
1715        8 as libc::c_int as libc::c_uchar,
1716    ];
1717    while p as libc::c_ulong & 3 as libc::c_int as libc::c_ulong != 0 && count != 0 {
1718        let fresh0 = p;
1719        p = p.offset(1);
1720        bits += bitsinbyte[*fresh0 as usize] as libc::c_longlong;
1721        count -= 1;
1722    }
1723    p4 = p as *mut uint32_t;
1724    while count >= 28 as libc::c_int as libc::c_long {
1725        let mut aux1: uint32_t = 0;
1726        let mut aux2: uint32_t = 0;
1727        let mut aux3: uint32_t = 0;
1728        let mut aux4: uint32_t = 0;
1729        let mut aux5: uint32_t = 0;
1730        let mut aux6: uint32_t = 0;
1731        let mut aux7: uint32_t = 0;
1732        let fresh1 = p4;
1733        p4 = p4.offset(1);
1734        aux1 = *fresh1;
1735        let fresh2 = p4;
1736        p4 = p4.offset(1);
1737        aux2 = *fresh2;
1738        let fresh3 = p4;
1739        p4 = p4.offset(1);
1740        aux3 = *fresh3;
1741        let fresh4 = p4;
1742        p4 = p4.offset(1);
1743        aux4 = *fresh4;
1744        let fresh5 = p4;
1745        p4 = p4.offset(1);
1746        aux5 = *fresh5;
1747        let fresh6 = p4;
1748        p4 = p4.offset(1);
1749        aux6 = *fresh6;
1750        let fresh7 = p4;
1751        p4 = p4.offset(1);
1752        aux7 = *fresh7;
1753        count -= 28 as libc::c_int as libc::c_long;
1754        aux1 = aux1
1755            .wrapping_sub(
1756                aux1 >> 1 as libc::c_int & 0x55555555 as libc::c_int as libc::c_uint,
1757            );
1758        aux1 = (aux1 & 0x33333333 as libc::c_int as libc::c_uint)
1759            .wrapping_add(
1760                aux1 >> 2 as libc::c_int & 0x33333333 as libc::c_int as libc::c_uint,
1761            );
1762        aux2 = aux2
1763            .wrapping_sub(
1764                aux2 >> 1 as libc::c_int & 0x55555555 as libc::c_int as libc::c_uint,
1765            );
1766        aux2 = (aux2 & 0x33333333 as libc::c_int as libc::c_uint)
1767            .wrapping_add(
1768                aux2 >> 2 as libc::c_int & 0x33333333 as libc::c_int as libc::c_uint,
1769            );
1770        aux3 = aux3
1771            .wrapping_sub(
1772                aux3 >> 1 as libc::c_int & 0x55555555 as libc::c_int as libc::c_uint,
1773            );
1774        aux3 = (aux3 & 0x33333333 as libc::c_int as libc::c_uint)
1775            .wrapping_add(
1776                aux3 >> 2 as libc::c_int & 0x33333333 as libc::c_int as libc::c_uint,
1777            );
1778        aux4 = aux4
1779            .wrapping_sub(
1780                aux4 >> 1 as libc::c_int & 0x55555555 as libc::c_int as libc::c_uint,
1781            );
1782        aux4 = (aux4 & 0x33333333 as libc::c_int as libc::c_uint)
1783            .wrapping_add(
1784                aux4 >> 2 as libc::c_int & 0x33333333 as libc::c_int as libc::c_uint,
1785            );
1786        aux5 = aux5
1787            .wrapping_sub(
1788                aux5 >> 1 as libc::c_int & 0x55555555 as libc::c_int as libc::c_uint,
1789            );
1790        aux5 = (aux5 & 0x33333333 as libc::c_int as libc::c_uint)
1791            .wrapping_add(
1792                aux5 >> 2 as libc::c_int & 0x33333333 as libc::c_int as libc::c_uint,
1793            );
1794        aux6 = aux6
1795            .wrapping_sub(
1796                aux6 >> 1 as libc::c_int & 0x55555555 as libc::c_int as libc::c_uint,
1797            );
1798        aux6 = (aux6 & 0x33333333 as libc::c_int as libc::c_uint)
1799            .wrapping_add(
1800                aux6 >> 2 as libc::c_int & 0x33333333 as libc::c_int as libc::c_uint,
1801            );
1802        aux7 = aux7
1803            .wrapping_sub(
1804                aux7 >> 1 as libc::c_int & 0x55555555 as libc::c_int as libc::c_uint,
1805            );
1806        aux7 = (aux7 & 0x33333333 as libc::c_int as libc::c_uint)
1807            .wrapping_add(
1808                aux7 >> 2 as libc::c_int & 0x33333333 as libc::c_int as libc::c_uint,
1809            );
1810        bits
1811            += ((aux1.wrapping_add(aux1 >> 4 as libc::c_int)
1812                & 0xf0f0f0f as libc::c_int as libc::c_uint)
1813                .wrapping_add(
1814                    aux2.wrapping_add(aux2 >> 4 as libc::c_int)
1815                        & 0xf0f0f0f as libc::c_int as libc::c_uint,
1816                )
1817                .wrapping_add(
1818                    aux3.wrapping_add(aux3 >> 4 as libc::c_int)
1819                        & 0xf0f0f0f as libc::c_int as libc::c_uint,
1820                )
1821                .wrapping_add(
1822                    aux4.wrapping_add(aux4 >> 4 as libc::c_int)
1823                        & 0xf0f0f0f as libc::c_int as libc::c_uint,
1824                )
1825                .wrapping_add(
1826                    aux5.wrapping_add(aux5 >> 4 as libc::c_int)
1827                        & 0xf0f0f0f as libc::c_int as libc::c_uint,
1828                )
1829                .wrapping_add(
1830                    aux6.wrapping_add(aux6 >> 4 as libc::c_int)
1831                        & 0xf0f0f0f as libc::c_int as libc::c_uint,
1832                )
1833                .wrapping_add(
1834                    aux7.wrapping_add(aux7 >> 4 as libc::c_int)
1835                        & 0xf0f0f0f as libc::c_int as libc::c_uint,
1836                )
1837                .wrapping_mul(0x1010101 as libc::c_int as libc::c_uint)
1838                >> 24 as libc::c_int) as libc::c_longlong;
1839    }
1840    p = p4 as *mut libc::c_uchar;
1841    loop {
1842        let fresh8 = count;
1843        count = count - 1;
1844        if !(fresh8 != 0) {
1845            break;
1846        }
1847        let fresh9 = p;
1848        p = p.offset(1);
1849        bits += bitsinbyte[*fresh9 as usize] as libc::c_longlong;
1850    }
1851    return bits;
1852}
1853#[no_mangle]
1854pub unsafe extern "C" fn redisBitpos(
1855    mut s: *mut libc::c_void,
1856    mut count: libc::c_ulong,
1857    mut bit: libc::c_int,
1858) -> libc::c_longlong {
1859    let mut l: *mut libc::c_ulong = 0 as *mut libc::c_ulong;
1860    let mut c: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
1861    let mut skipval: libc::c_ulong = 0;
1862    let mut word: libc::c_ulong = 0 as libc::c_int as libc::c_ulong;
1863    let mut one: libc::c_ulong = 0;
1864    let mut pos: libc::c_longlong = 0 as libc::c_int as libc::c_longlong;
1865    let mut j: libc::c_ulong = 0;
1866    let mut found: libc::c_int = 0;
1867    skipval = (if bit != 0 {
1868        0 as libc::c_int
1869    } else {
1870        127 as libc::c_int * 2 as libc::c_int + 1 as libc::c_int
1871    }) as libc::c_ulong;
1872    c = s as *mut libc::c_uchar;
1873    found = 0 as libc::c_int;
1874    while c as libc::c_ulong
1875        & (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
1876            .wrapping_sub(1 as libc::c_int as libc::c_ulong) != 0 && count != 0
1877    {
1878        if *c as libc::c_ulong != skipval {
1879            found = 1 as libc::c_int;
1880            break;
1881        } else {
1882            c = c.offset(1);
1883            count = count.wrapping_sub(1);
1884            pos += 8 as libc::c_int as libc::c_longlong;
1885        }
1886    }
1887    l = c as *mut libc::c_ulong;
1888    if found == 0 {
1889        skipval = if bit != 0 {
1890            0 as libc::c_int as libc::c_ulong
1891        } else {
1892            (9223372036854775807 as libc::c_long as libc::c_ulong)
1893                .wrapping_mul(2 as libc::c_ulong)
1894                .wrapping_add(1 as libc::c_ulong)
1895        };
1896        while count >= core::mem::size_of::<libc::c_ulong>() as libc::c_ulong {
1897            if *l != skipval {
1898                break;
1899            }
1900            l = l.offset(1);
1901            count = count
1902                .wrapping_sub(core::mem::size_of::<libc::c_ulong>() as libc::c_ulong);
1903            pos = (pos as libc::c_ulonglong)
1904                .wrapping_add(
1905                    (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
1906                        .wrapping_mul(8 as libc::c_int as libc::c_ulong)
1907                        as libc::c_ulonglong,
1908                ) as libc::c_longlong as libc::c_longlong;
1909        }
1910    }
1911    c = l as *mut libc::c_uchar;
1912    j = 0 as libc::c_int as libc::c_ulong;
1913    while j < core::mem::size_of::<libc::c_ulong>() as libc::c_ulong {
1914        word <<= 8 as libc::c_int;
1915        if count != 0 {
1916            word |= *c as libc::c_ulong;
1917            c = c.offset(1);
1918            count = count.wrapping_sub(1);
1919        }
1920        j = j.wrapping_add(1);
1921    }
1922    if bit == 1 as libc::c_int && word == 0 as libc::c_int as libc::c_ulong {
1923        return -(1 as libc::c_int) as libc::c_longlong;
1924    }
1925    one = (9223372036854775807 as libc::c_long as libc::c_ulong)
1926        .wrapping_mul(2 as libc::c_ulong)
1927        .wrapping_add(1 as libc::c_ulong);
1928    one >>= 1 as libc::c_int;
1929    one = !one;
1930    while one != 0 {
1931        if (one & word != 0 as libc::c_int as libc::c_ulong) as libc::c_int == bit {
1932            return pos;
1933        }
1934        pos += 1;
1935        one >>= 1 as libc::c_int;
1936    }
1937    _serverPanic(
1938        b"bitops.c\0" as *const u8 as *const libc::c_char,
1939        184 as libc::c_int,
1940        b"End of redisBitpos() reached.\0" as *const u8 as *const libc::c_char,
1941    );
1942    unreachable!();
1943    return 0 as libc::c_int as libc::c_longlong;
1944}
1945#[no_mangle]
1946pub unsafe extern "C" fn setUnsignedBitfield(
1947    mut p: *mut libc::c_uchar,
1948    mut offset: uint64_t,
1949    mut bits: uint64_t,
1950    mut value: uint64_t,
1951) {
1952    let mut byte: uint64_t = 0;
1953    let mut bit: uint64_t = 0;
1954    let mut byteval: uint64_t = 0;
1955    let mut bitval: uint64_t = 0;
1956    let mut j: uint64_t = 0;
1957    j = 0 as libc::c_int as uint64_t;
1958    while j < bits {
1959        bitval = (value
1960            & (1 as libc::c_int as uint64_t)
1961                << bits.wrapping_sub(1 as libc::c_int as libc::c_ulong).wrapping_sub(j)
1962            != 0 as libc::c_int as libc::c_ulong) as libc::c_int as uint64_t;
1963        byte = offset >> 3 as libc::c_int;
1964        bit = (7 as libc::c_int as libc::c_ulong)
1965            .wrapping_sub(offset & 0x7 as libc::c_int as libc::c_ulong);
1966        byteval = *p.offset(byte as isize) as uint64_t;
1967        byteval &= !((1 as libc::c_int) << bit) as libc::c_ulong;
1968        byteval |= bitval << bit;
1969        *p
1970            .offset(
1971                byte as isize,
1972            ) = (byteval & 0xff as libc::c_int as libc::c_ulong) as libc::c_uchar;
1973        offset = offset.wrapping_add(1);
1974        j = j.wrapping_add(1);
1975    }
1976}
1977#[no_mangle]
1978pub unsafe extern "C" fn setSignedBitfield(
1979    mut p: *mut libc::c_uchar,
1980    mut offset: uint64_t,
1981    mut bits: uint64_t,
1982    mut value: int64_t,
1983) {
1984    let mut uv: uint64_t = value as uint64_t;
1985    setUnsignedBitfield(p, offset, bits, uv);
1986}
1987#[no_mangle]
1988pub unsafe extern "C" fn getUnsignedBitfield(
1989    mut p: *mut libc::c_uchar,
1990    mut offset: uint64_t,
1991    mut bits: uint64_t,
1992) -> uint64_t {
1993    let mut byte: uint64_t = 0;
1994    let mut bit: uint64_t = 0;
1995    let mut byteval: uint64_t = 0;
1996    let mut bitval: uint64_t = 0;
1997    let mut j: uint64_t = 0;
1998    let mut value: uint64_t = 0 as libc::c_int as uint64_t;
1999    j = 0 as libc::c_int as uint64_t;
2000    while j < bits {
2001        byte = offset >> 3 as libc::c_int;
2002        bit = (7 as libc::c_int as libc::c_ulong)
2003            .wrapping_sub(offset & 0x7 as libc::c_int as libc::c_ulong);
2004        byteval = *p.offset(byte as isize) as uint64_t;
2005        bitval = byteval >> bit & 1 as libc::c_int as libc::c_ulong;
2006        value = value << 1 as libc::c_int | bitval;
2007        offset = offset.wrapping_add(1);
2008        j = j.wrapping_add(1);
2009    }
2010    return value;
2011}
2012#[no_mangle]
2013pub unsafe extern "C" fn getSignedBitfield(
2014    mut p: *mut libc::c_uchar,
2015    mut offset: uint64_t,
2016    mut bits: uint64_t,
2017) -> int64_t {
2018    let mut value: int64_t = 0;
2019    let mut conv: C2RustUnnamed_7 = C2RustUnnamed_7 { u: 0 };
2020    conv.u = getUnsignedBitfield(p, offset, bits);
2021    value = conv.i;
2022    if bits < 64 as libc::c_int as libc::c_ulong
2023        && value as libc::c_ulong
2024            & (1 as libc::c_int as uint64_t)
2025                << bits.wrapping_sub(1 as libc::c_int as libc::c_ulong) != 0
2026    {
2027        value = (value as libc::c_ulong | (-(1 as libc::c_int) as uint64_t) << bits)
2028            as int64_t;
2029    }
2030    return value;
2031}
2032#[no_mangle]
2033pub unsafe extern "C" fn checkUnsignedBitfieldOverflow(
2034    mut value: uint64_t,
2035    mut incr: int64_t,
2036    mut bits: uint64_t,
2037    mut owtype: libc::c_int,
2038    mut limit: *mut uint64_t,
2039) -> libc::c_int {
2040    let mut current_block: u64;
2041    let mut max: uint64_t = if bits == 64 as libc::c_int as libc::c_ulong {
2042        18446744073709551615 as libc::c_ulong
2043    } else {
2044        ((1 as libc::c_int as uint64_t) << bits)
2045            .wrapping_sub(1 as libc::c_int as libc::c_ulong)
2046    };
2047    let mut maxincr: int64_t = max.wrapping_sub(value) as int64_t;
2048    let mut minincr: int64_t = value.wrapping_neg() as int64_t;
2049    if value > max || incr > 0 as libc::c_int as libc::c_long && incr > maxincr {
2050        if !limit.is_null() {
2051            if owtype == 0 as libc::c_int {
2052                current_block = 1855159724523092465;
2053            } else {
2054                if owtype == 1 as libc::c_int {
2055                    *limit = max;
2056                }
2057                current_block = 11006700562992250127;
2058            }
2059        } else {
2060            current_block = 11006700562992250127;
2061        }
2062        match current_block {
2063            1855159724523092465 => {}
2064            _ => return 1 as libc::c_int,
2065        }
2066    } else if incr < 0 as libc::c_int as libc::c_long && incr < minincr {
2067        if !limit.is_null() {
2068            if owtype == 0 as libc::c_int {
2069                current_block = 1855159724523092465;
2070            } else {
2071                if owtype == 1 as libc::c_int {
2072                    *limit = 0 as libc::c_int as uint64_t;
2073                }
2074                current_block = 4166486009154926805;
2075            }
2076        } else {
2077            current_block = 4166486009154926805;
2078        }
2079        match current_block {
2080            1855159724523092465 => {}
2081            _ => return -(1 as libc::c_int),
2082        }
2083    } else {
2084        return 0 as libc::c_int
2085    }
2086    let mut mask: uint64_t = (-(1 as libc::c_int) as uint64_t) << bits;
2087    let mut res: uint64_t = value.wrapping_add(incr as libc::c_ulong);
2088    res &= !mask;
2089    *limit = res;
2090    return 1 as libc::c_int;
2091}
2092#[no_mangle]
2093pub unsafe extern "C" fn checkSignedBitfieldOverflow(
2094    mut value: int64_t,
2095    mut incr: int64_t,
2096    mut bits: uint64_t,
2097    mut owtype: libc::c_int,
2098    mut limit: *mut int64_t,
2099) -> libc::c_int {
2100    let mut current_block: u64;
2101    let mut max: int64_t = if bits == 64 as libc::c_int as libc::c_ulong {
2102        9223372036854775807 as libc::c_long
2103    } else {
2104        ((1 as libc::c_int as int64_t)
2105            << bits.wrapping_sub(1 as libc::c_int as libc::c_ulong))
2106            - 1 as libc::c_int as libc::c_long
2107    };
2108    let mut min: int64_t = -max - 1 as libc::c_int as libc::c_long;
2109    let mut maxincr: int64_t = (max as uint64_t).wrapping_sub(value as libc::c_ulong)
2110        as int64_t;
2111    let mut minincr: int64_t = min - value;
2112    if value > max || bits != 64 as libc::c_int as libc::c_ulong && incr > maxincr
2113        || value >= 0 as libc::c_int as libc::c_long
2114            && incr > 0 as libc::c_int as libc::c_long && incr > maxincr
2115    {
2116        if !limit.is_null() {
2117            if owtype == 0 as libc::c_int {
2118                current_block = 90460017421671848;
2119            } else {
2120                if owtype == 1 as libc::c_int {
2121                    *limit = max;
2122                }
2123                current_block = 7815301370352969686;
2124            }
2125        } else {
2126            current_block = 7815301370352969686;
2127        }
2128        match current_block {
2129            90460017421671848 => {}
2130            _ => return 1 as libc::c_int,
2131        }
2132    } else if value < min || bits != 64 as libc::c_int as libc::c_ulong && incr < minincr
2133        || value < 0 as libc::c_int as libc::c_long
2134            && incr < 0 as libc::c_int as libc::c_long && incr < minincr
2135    {
2136        if !limit.is_null() {
2137            if owtype == 0 as libc::c_int {
2138                current_block = 90460017421671848;
2139            } else {
2140                if owtype == 1 as libc::c_int {
2141                    *limit = min;
2142                }
2143                current_block = 12599329904712511516;
2144            }
2145        } else {
2146            current_block = 12599329904712511516;
2147        }
2148        match current_block {
2149            90460017421671848 => {}
2150            _ => return -(1 as libc::c_int),
2151        }
2152    } else {
2153        return 0 as libc::c_int
2154    }
2155    let mut msb: uint64_t = (1 as libc::c_int as uint64_t)
2156        << bits.wrapping_sub(1 as libc::c_int as libc::c_ulong);
2157    let mut a: uint64_t = value as uint64_t;
2158    let mut b: uint64_t = incr as uint64_t;
2159    let mut c: uint64_t = 0;
2160    c = a.wrapping_add(b);
2161    if bits < 64 as libc::c_int as libc::c_ulong {
2162        let mut mask: uint64_t = (-(1 as libc::c_int) as uint64_t) << bits;
2163        if c & msb != 0 {
2164            c |= mask;
2165        } else {
2166            c &= !mask;
2167        }
2168    }
2169    *limit = c as int64_t;
2170    return 1 as libc::c_int;
2171}
2172#[no_mangle]
2173pub unsafe extern "C" fn printBits(mut p: *mut libc::c_uchar, mut count: libc::c_ulong) {
2174    let mut j: libc::c_ulong = 0;
2175    let mut i: libc::c_ulong = 0;
2176    let mut byte: libc::c_ulong = 0;
2177    j = 0 as libc::c_int as libc::c_ulong;
2178    while j < count {
2179        byte = *p.offset(j as isize) as libc::c_ulong;
2180        i = 0x80 as libc::c_int as libc::c_ulong;
2181        while i > 0 as libc::c_int as libc::c_ulong {
2182            printf(
2183                b"%c\0" as *const u8 as *const libc::c_char,
2184                if byte & i != 0 { '1' as i32 } else { '0' as i32 },
2185            );
2186            i = i.wrapping_div(2 as libc::c_int as libc::c_ulong);
2187        }
2188        printf(b"|\0" as *const u8 as *const libc::c_char);
2189        j = j.wrapping_add(1);
2190    }
2191    printf(b"\n\0" as *const u8 as *const libc::c_char);
2192}
2193#[no_mangle]
2194pub unsafe extern "C" fn getBitOffsetFromArgument(
2195    mut c: *mut client,
2196    mut o: *mut robj,
2197    mut offset: *mut uint64_t,
2198    mut hash: libc::c_int,
2199    mut bits: libc::c_int,
2200) -> libc::c_int {
2201    let mut loffset: libc::c_longlong = 0;
2202    let mut err: *mut libc::c_char = b"bit offset is not an integer or out of range\0"
2203        as *const u8 as *const libc::c_char as *mut libc::c_char;
2204    let mut p: *mut libc::c_char = (*o).ptr as *mut libc::c_char;
2205    let mut plen: size_t = sdslen(p);
2206    let mut usehash: libc::c_int = 0 as libc::c_int;
2207    if *p.offset(0 as libc::c_int as isize) as libc::c_int == '#' as i32 && hash != 0
2208        && bits > 0 as libc::c_int
2209    {
2210        usehash = 1 as libc::c_int;
2211    }
2212    if string2ll(
2213        p.offset(usehash as isize),
2214        plen.wrapping_sub(usehash as libc::c_ulong),
2215        &mut loffset,
2216    ) == 0 as libc::c_int
2217    {
2218        addReplyError(c, err);
2219        return -(1 as libc::c_int);
2220    }
2221    if usehash != 0 {
2222        loffset *= bits as libc::c_longlong;
2223    }
2224    if loffset < 0 as libc::c_int as libc::c_longlong
2225        || mustObeyClient(c) == 0
2226            && loffset >> 3 as libc::c_int >= server.proto_max_bulk_len
2227    {
2228        addReplyError(c, err);
2229        return -(1 as libc::c_int);
2230    }
2231    *offset = loffset as uint64_t;
2232    return 0 as libc::c_int;
2233}
2234#[no_mangle]
2235pub unsafe extern "C" fn getBitfieldTypeFromArgument(
2236    mut c: *mut client,
2237    mut o: *mut robj,
2238    mut sign: *mut libc::c_int,
2239    mut bits: *mut libc::c_int,
2240) -> libc::c_int {
2241    let mut p: *mut libc::c_char = (*o).ptr as *mut libc::c_char;
2242    let mut err: *mut libc::c_char = b"Invalid bitfield type. Use something like i16 u8. Note that u64 is not supported but i64 is.\0"
2243        as *const u8 as *const libc::c_char as *mut libc::c_char;
2244    let mut llbits: libc::c_longlong = 0;
2245    if *p.offset(0 as libc::c_int as isize) as libc::c_int == 'i' as i32 {
2246        *sign = 1 as libc::c_int;
2247    } else if *p.offset(0 as libc::c_int as isize) as libc::c_int == 'u' as i32 {
2248        *sign = 0 as libc::c_int;
2249    } else {
2250        addReplyError(c, err);
2251        return -(1 as libc::c_int);
2252    }
2253    if string2ll(
2254        p.offset(1 as libc::c_int as isize),
2255        strlen(p.offset(1 as libc::c_int as isize)),
2256        &mut llbits,
2257    ) == 0 as libc::c_int || llbits < 1 as libc::c_int as libc::c_longlong
2258        || *sign == 1 as libc::c_int && llbits > 64 as libc::c_int as libc::c_longlong
2259        || *sign == 0 as libc::c_int && llbits > 63 as libc::c_int as libc::c_longlong
2260    {
2261        addReplyError(c, err);
2262        return -(1 as libc::c_int);
2263    }
2264    *bits = llbits as libc::c_int;
2265    return 0 as libc::c_int;
2266}
2267#[no_mangle]
2268pub unsafe extern "C" fn lookupStringForBitCommand(
2269    mut c: *mut client,
2270    mut maxbit: uint64_t,
2271    mut dirty: *mut libc::c_int,
2272) -> *mut robj {
2273    let mut byte: size_t = maxbit >> 3 as libc::c_int;
2274    let mut o: *mut robj = lookupKeyWrite(
2275        (*c).db,
2276        *((*c).argv).offset(1 as libc::c_int as isize),
2277    );
2278    if checkType(c, o, 0 as libc::c_int) != 0 {
2279        return 0 as *mut robj;
2280    }
2281    if !dirty.is_null() {
2282        *dirty = 0 as libc::c_int;
2283    }
2284    if o.is_null() {
2285        o = createObject(
2286            0 as libc::c_int,
2287            sdsnewlen(
2288                0 as *const libc::c_void,
2289                byte.wrapping_add(1 as libc::c_int as libc::c_ulong),
2290            ) as *mut libc::c_void,
2291        );
2292        dbAdd((*c).db, *((*c).argv).offset(1 as libc::c_int as isize), o);
2293        if !dirty.is_null() {
2294            *dirty = 1 as libc::c_int;
2295        }
2296    } else {
2297        o = dbUnshareStringValue(
2298            (*c).db,
2299            *((*c).argv).offset(1 as libc::c_int as isize),
2300            o,
2301        );
2302        let mut oldlen: size_t = sdslen((*o).ptr as sds);
2303        (*o)
2304            .ptr = sdsgrowzero(
2305            (*o).ptr as sds,
2306            byte.wrapping_add(1 as libc::c_int as libc::c_ulong),
2307        ) as *mut libc::c_void;
2308        if !dirty.is_null() && oldlen != sdslen((*o).ptr as sds) {
2309            *dirty = 1 as libc::c_int;
2310        }
2311    }
2312    return o;
2313}
2314#[no_mangle]
2315pub unsafe extern "C" fn getObjectReadOnlyString(
2316    mut o: *mut robj,
2317    mut len: *mut libc::c_long,
2318    mut llbuf: *mut libc::c_char,
2319) -> *mut libc::c_uchar {
2320    if o.is_null() || (*o).type_0() as libc::c_int == 0 as libc::c_int {} else {
2321        _serverAssert(
2322            b"!o || o->type == OBJ_STRING\0" as *const u8 as *const libc::c_char,
2323            b"bitops.c\0" as *const u8 as *const libc::c_char,
2324            514 as libc::c_int,
2325        );
2326        unreachable!();
2327    };
2328    let mut p: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2329    if !o.is_null() && (*o).encoding() as libc::c_int == 1 as libc::c_int {
2330        p = llbuf as *mut libc::c_uchar;
2331        if !len.is_null() {
2332            *len = ll2string(
2333                llbuf,
2334                21 as libc::c_int as size_t,
2335                (*o).ptr as libc::c_long as libc::c_longlong,
2336            ) as libc::c_long;
2337        }
2338    } else if !o.is_null() {
2339        p = (*o).ptr as *mut libc::c_uchar;
2340        if !len.is_null() {
2341            *len = sdslen((*o).ptr as sds) as libc::c_long;
2342        }
2343    } else if !len.is_null() {
2344        *len = 0 as libc::c_int as libc::c_long;
2345    }
2346    return p;
2347}
2348#[no_mangle]
2349pub unsafe extern "C" fn setbitCommand(mut c: *mut client) {
2350    let mut o: *mut robj = 0 as *mut robj;
2351    let mut err: *mut libc::c_char = b"bit is not an integer or out of range\0"
2352        as *const u8 as *const libc::c_char as *mut libc::c_char;
2353    let mut bitoffset: uint64_t = 0;
2354    let mut byte: ssize_t = 0;
2355    let mut bit: ssize_t = 0;
2356    let mut byteval: libc::c_int = 0;
2357    let mut bitval: libc::c_int = 0;
2358    let mut on: libc::c_long = 0;
2359    if getBitOffsetFromArgument(
2360        c,
2361        *((*c).argv).offset(2 as libc::c_int as isize),
2362        &mut bitoffset,
2363        0 as libc::c_int,
2364        0 as libc::c_int,
2365    ) != 0 as libc::c_int
2366    {
2367        return;
2368    }
2369    if getLongFromObjectOrReply(
2370        c,
2371        *((*c).argv).offset(3 as libc::c_int as isize),
2372        &mut on,
2373        err,
2374    ) != 0 as libc::c_int
2375    {
2376        return;
2377    }
2378    if on & !(1 as libc::c_int) as libc::c_long != 0 {
2379        addReplyError(c, err);
2380        return;
2381    }
2382    let mut dirty: libc::c_int = 0;
2383    o = lookupStringForBitCommand(c, bitoffset, &mut dirty);
2384    if o.is_null() {
2385        return;
2386    }
2387    byte = (bitoffset >> 3 as libc::c_int) as ssize_t;
2388    byteval = *((*o).ptr as *mut uint8_t).offset(byte as isize) as libc::c_int;
2389    bit = (7 as libc::c_int as libc::c_ulong)
2390        .wrapping_sub(bitoffset & 0x7 as libc::c_int as libc::c_ulong) as ssize_t;
2391    bitval = byteval & (1 as libc::c_int) << bit;
2392    if dirty != 0 || (bitval != 0) as libc::c_int as libc::c_long != on {
2393        byteval &= !((1 as libc::c_int) << bit);
2394        byteval = (byteval as libc::c_long
2395            | (on & 0x1 as libc::c_int as libc::c_long) << bit) as libc::c_int;
2396        *((*o).ptr as *mut uint8_t).offset(byte as isize) = byteval as uint8_t;
2397        signalModifiedKey(c, (*c).db, *((*c).argv).offset(1 as libc::c_int as isize));
2398        notifyKeyspaceEvent(
2399            (1 as libc::c_int) << 3 as libc::c_int,
2400            b"setbit\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
2401            *((*c).argv).offset(1 as libc::c_int as isize),
2402            (*(*c).db).id,
2403        );
2404        server.dirty += 1;
2405    }
2406    addReply(c, if bitval != 0 { shared.cone } else { shared.czero });
2407}
2408#[no_mangle]
2409pub unsafe extern "C" fn getbitCommand(mut c: *mut client) {
2410    let mut o: *mut robj = 0 as *mut robj;
2411    let mut llbuf: [libc::c_char; 32] = [0; 32];
2412    let mut bitoffset: uint64_t = 0;
2413    let mut byte: size_t = 0;
2414    let mut bit: size_t = 0;
2415    let mut bitval: size_t = 0 as libc::c_int as size_t;
2416    if getBitOffsetFromArgument(
2417        c,
2418        *((*c).argv).offset(2 as libc::c_int as isize),
2419        &mut bitoffset,
2420        0 as libc::c_int,
2421        0 as libc::c_int,
2422    ) != 0 as libc::c_int
2423    {
2424        return;
2425    }
2426    o = lookupKeyReadOrReply(
2427        c,
2428        *((*c).argv).offset(1 as libc::c_int as isize),
2429        shared.czero,
2430    );
2431    if o.is_null() || checkType(c, o, 0 as libc::c_int) != 0 {
2432        return;
2433    }
2434    byte = bitoffset >> 3 as libc::c_int;
2435    bit = (7 as libc::c_int as libc::c_ulong)
2436        .wrapping_sub(bitoffset & 0x7 as libc::c_int as libc::c_ulong);
2437    if (*o).encoding() as libc::c_int == 0 as libc::c_int
2438        || (*o).encoding() as libc::c_int == 8 as libc::c_int
2439    {
2440        if byte < sdslen((*o).ptr as sds) {
2441            bitval = (*((*o).ptr as *mut uint8_t).offset(byte as isize) as libc::c_int
2442                & (1 as libc::c_int) << bit) as size_t;
2443        }
2444    } else if byte
2445        < ll2string(
2446            llbuf.as_mut_ptr(),
2447            core::mem::size_of::<[libc::c_char; 32]>() as libc::c_ulong,
2448            (*o).ptr as libc::c_long as libc::c_longlong,
2449        ) as size_t
2450    {
2451        bitval = (llbuf[byte as usize] as libc::c_int & (1 as libc::c_int) << bit)
2452            as size_t;
2453    }
2454    addReply(c, if bitval != 0 { shared.cone } else { shared.czero });
2455}
2456#[no_mangle]
2457pub unsafe extern "C" fn bitopCommand(mut c: *mut client) {
2458    let mut opname: *mut libc::c_char = (**((*c).argv).offset(1 as libc::c_int as isize))
2459        .ptr as *mut libc::c_char;
2460    let mut o: *mut robj = 0 as *mut robj;
2461    let mut targetkey: *mut robj = *((*c).argv).offset(2 as libc::c_int as isize);
2462    let mut op: libc::c_ulong = 0;
2463    let mut j: libc::c_ulong = 0;
2464    let mut numkeys: libc::c_ulong = 0;
2465    let mut objects: *mut *mut robj = 0 as *mut *mut robj;
2466    let mut src: *mut *mut libc::c_uchar = 0 as *mut *mut libc::c_uchar;
2467    let mut len: *mut libc::c_ulong = 0 as *mut libc::c_ulong;
2468    let mut maxlen: libc::c_ulong = 0 as libc::c_int as libc::c_ulong;
2469    let mut minlen: libc::c_ulong = 0 as libc::c_int as libc::c_ulong;
2470    let mut res: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2471    if (*opname.offset(0 as libc::c_int as isize) as libc::c_int == 'a' as i32
2472        || *opname.offset(0 as libc::c_int as isize) as libc::c_int == 'A' as i32)
2473        && strcasecmp(opname, b"and\0" as *const u8 as *const libc::c_char) == 0
2474    {
2475        op = 0 as libc::c_int as libc::c_ulong;
2476    } else if (*opname.offset(0 as libc::c_int as isize) as libc::c_int == 'o' as i32
2477        || *opname.offset(0 as libc::c_int as isize) as libc::c_int == 'O' as i32)
2478        && strcasecmp(opname, b"or\0" as *const u8 as *const libc::c_char) == 0
2479    {
2480        op = 1 as libc::c_int as libc::c_ulong;
2481    } else if (*opname.offset(0 as libc::c_int as isize) as libc::c_int == 'x' as i32
2482        || *opname.offset(0 as libc::c_int as isize) as libc::c_int == 'X' as i32)
2483        && strcasecmp(opname, b"xor\0" as *const u8 as *const libc::c_char) == 0
2484    {
2485        op = 2 as libc::c_int as libc::c_ulong;
2486    } else if (*opname.offset(0 as libc::c_int as isize) as libc::c_int == 'n' as i32
2487        || *opname.offset(0 as libc::c_int as isize) as libc::c_int == 'N' as i32)
2488        && strcasecmp(opname, b"not\0" as *const u8 as *const libc::c_char) == 0
2489    {
2490        op = 3 as libc::c_int as libc::c_ulong;
2491    } else {
2492        addReplyErrorObject(c, shared.syntaxerr);
2493        return;
2494    }
2495    if op == 3 as libc::c_int as libc::c_ulong && (*c).argc != 4 as libc::c_int {
2496        addReplyError(
2497            c,
2498            b"BITOP NOT must be called with a single source key.\0" as *const u8
2499                as *const libc::c_char,
2500        );
2501        return;
2502    }
2503    numkeys = ((*c).argc - 3 as libc::c_int) as libc::c_ulong;
2504    src = zmalloc(
2505        (core::mem::size_of::<*mut libc::c_uchar>() as libc::c_ulong)
2506            .wrapping_mul(numkeys),
2507    ) as *mut *mut libc::c_uchar;
2508    len = zmalloc(
2509        (core::mem::size_of::<libc::c_long>() as libc::c_ulong).wrapping_mul(numkeys),
2510    ) as *mut libc::c_ulong;
2511    objects = zmalloc(
2512        (core::mem::size_of::<*mut robj>() as libc::c_ulong).wrapping_mul(numkeys),
2513    ) as *mut *mut robj;
2514    j = 0 as libc::c_int as libc::c_ulong;
2515    while j < numkeys {
2516        o = lookupKeyRead(
2517            (*c).db,
2518            *((*c).argv)
2519                .offset(j.wrapping_add(3 as libc::c_int as libc::c_ulong) as isize),
2520        );
2521        if o.is_null() {
2522            let ref mut fresh10 = *objects.offset(j as isize);
2523            *fresh10 = 0 as *mut robj;
2524            let ref mut fresh11 = *src.offset(j as isize);
2525            *fresh11 = 0 as *mut libc::c_uchar;
2526            *len.offset(j as isize) = 0 as libc::c_int as libc::c_ulong;
2527            minlen = 0 as libc::c_int as libc::c_ulong;
2528        } else {
2529            if checkType(c, o, 0 as libc::c_int) != 0 {
2530                let mut i: libc::c_ulong = 0;
2531                i = 0 as libc::c_int as libc::c_ulong;
2532                while i < j {
2533                    if !(*objects.offset(i as isize)).is_null() {
2534                        decrRefCount(*objects.offset(i as isize));
2535                    }
2536                    i = i.wrapping_add(1);
2537                }
2538                zfree(src as *mut libc::c_void);
2539                zfree(len as *mut libc::c_void);
2540                zfree(objects as *mut libc::c_void);
2541                return;
2542            }
2543            let ref mut fresh12 = *objects.offset(j as isize);
2544            *fresh12 = getDecodedObject(o);
2545            let ref mut fresh13 = *src.offset(j as isize);
2546            *fresh13 = (**objects.offset(j as isize)).ptr as *mut libc::c_uchar;
2547            *len.offset(j as isize) = sdslen((**objects.offset(j as isize)).ptr as sds);
2548            if *len.offset(j as isize) > maxlen {
2549                maxlen = *len.offset(j as isize);
2550            }
2551            if j == 0 as libc::c_int as libc::c_ulong || *len.offset(j as isize) < minlen
2552            {
2553                minlen = *len.offset(j as isize);
2554            }
2555        }
2556        j = j.wrapping_add(1);
2557    }
2558    if maxlen != 0 {
2559        res = sdsnewlen(0 as *const libc::c_void, maxlen) as *mut libc::c_uchar;
2560        let mut output: libc::c_uchar = 0;
2561        let mut byte: libc::c_uchar = 0;
2562        let mut i_0: libc::c_ulong = 0;
2563        j = 0 as libc::c_int as libc::c_ulong;
2564        if minlen
2565            >= (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2566                .wrapping_mul(4 as libc::c_int as libc::c_ulong)
2567            && numkeys <= 16 as libc::c_int as libc::c_ulong
2568        {
2569            let mut lp: [*mut libc::c_ulong; 16] = [0 as *mut libc::c_ulong; 16];
2570            let mut lres: *mut libc::c_ulong = res as *mut libc::c_ulong;
2571            memcpy(
2572                lp.as_mut_ptr() as *mut libc::c_void,
2573                src as *const libc::c_void,
2574                (core::mem::size_of::<*mut libc::c_ulong>() as libc::c_ulong)
2575                    .wrapping_mul(numkeys),
2576            );
2577            memcpy(
2578                res as *mut libc::c_void,
2579                *src.offset(0 as libc::c_int as isize) as *const libc::c_void,
2580                minlen,
2581            );
2582            if op == 0 as libc::c_int as libc::c_ulong {
2583                while minlen
2584                    >= (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2585                        .wrapping_mul(4 as libc::c_int as libc::c_ulong)
2586                {
2587                    i_0 = 1 as libc::c_int as libc::c_ulong;
2588                    while i_0 < numkeys {
2589                        *lres.offset(0 as libc::c_int as isize)
2590                            &= *(lp[i_0 as usize]).offset(0 as libc::c_int as isize);
2591                        *lres.offset(1 as libc::c_int as isize)
2592                            &= *(lp[i_0 as usize]).offset(1 as libc::c_int as isize);
2593                        *lres.offset(2 as libc::c_int as isize)
2594                            &= *(lp[i_0 as usize]).offset(2 as libc::c_int as isize);
2595                        *lres.offset(3 as libc::c_int as isize)
2596                            &= *(lp[i_0 as usize]).offset(3 as libc::c_int as isize);
2597                        lp[i_0
2598                            as usize] = (lp[i_0 as usize])
2599                            .offset(4 as libc::c_int as isize);
2600                        i_0 = i_0.wrapping_add(1);
2601                    }
2602                    lres = lres.offset(4 as libc::c_int as isize);
2603                    j = j
2604                        .wrapping_add(
2605                            (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2606                                .wrapping_mul(4 as libc::c_int as libc::c_ulong),
2607                        );
2608                    minlen = minlen
2609                        .wrapping_sub(
2610                            (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2611                                .wrapping_mul(4 as libc::c_int as libc::c_ulong),
2612                        );
2613                }
2614            } else if op == 1 as libc::c_int as libc::c_ulong {
2615                while minlen
2616                    >= (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2617                        .wrapping_mul(4 as libc::c_int as libc::c_ulong)
2618                {
2619                    i_0 = 1 as libc::c_int as libc::c_ulong;
2620                    while i_0 < numkeys {
2621                        *lres.offset(0 as libc::c_int as isize)
2622                            |= *(lp[i_0 as usize]).offset(0 as libc::c_int as isize);
2623                        *lres.offset(1 as libc::c_int as isize)
2624                            |= *(lp[i_0 as usize]).offset(1 as libc::c_int as isize);
2625                        *lres.offset(2 as libc::c_int as isize)
2626                            |= *(lp[i_0 as usize]).offset(2 as libc::c_int as isize);
2627                        *lres.offset(3 as libc::c_int as isize)
2628                            |= *(lp[i_0 as usize]).offset(3 as libc::c_int as isize);
2629                        lp[i_0
2630                            as usize] = (lp[i_0 as usize])
2631                            .offset(4 as libc::c_int as isize);
2632                        i_0 = i_0.wrapping_add(1);
2633                    }
2634                    lres = lres.offset(4 as libc::c_int as isize);
2635                    j = j
2636                        .wrapping_add(
2637                            (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2638                                .wrapping_mul(4 as libc::c_int as libc::c_ulong),
2639                        );
2640                    minlen = minlen
2641                        .wrapping_sub(
2642                            (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2643                                .wrapping_mul(4 as libc::c_int as libc::c_ulong),
2644                        );
2645                }
2646            } else if op == 2 as libc::c_int as libc::c_ulong {
2647                while minlen
2648                    >= (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2649                        .wrapping_mul(4 as libc::c_int as libc::c_ulong)
2650                {
2651                    i_0 = 1 as libc::c_int as libc::c_ulong;
2652                    while i_0 < numkeys {
2653                        *lres.offset(0 as libc::c_int as isize)
2654                            ^= *(lp[i_0 as usize]).offset(0 as libc::c_int as isize);
2655                        *lres.offset(1 as libc::c_int as isize)
2656                            ^= *(lp[i_0 as usize]).offset(1 as libc::c_int as isize);
2657                        *lres.offset(2 as libc::c_int as isize)
2658                            ^= *(lp[i_0 as usize]).offset(2 as libc::c_int as isize);
2659                        *lres.offset(3 as libc::c_int as isize)
2660                            ^= *(lp[i_0 as usize]).offset(3 as libc::c_int as isize);
2661                        lp[i_0
2662                            as usize] = (lp[i_0 as usize])
2663                            .offset(4 as libc::c_int as isize);
2664                        i_0 = i_0.wrapping_add(1);
2665                    }
2666                    lres = lres.offset(4 as libc::c_int as isize);
2667                    j = j
2668                        .wrapping_add(
2669                            (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2670                                .wrapping_mul(4 as libc::c_int as libc::c_ulong),
2671                        );
2672                    minlen = minlen
2673                        .wrapping_sub(
2674                            (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2675                                .wrapping_mul(4 as libc::c_int as libc::c_ulong),
2676                        );
2677                }
2678            } else if op == 3 as libc::c_int as libc::c_ulong {
2679                while minlen
2680                    >= (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2681                        .wrapping_mul(4 as libc::c_int as libc::c_ulong)
2682                {
2683                    *lres
2684                        .offset(
2685                            0 as libc::c_int as isize,
2686                        ) = !*lres.offset(0 as libc::c_int as isize);
2687                    *lres
2688                        .offset(
2689                            1 as libc::c_int as isize,
2690                        ) = !*lres.offset(1 as libc::c_int as isize);
2691                    *lres
2692                        .offset(
2693                            2 as libc::c_int as isize,
2694                        ) = !*lres.offset(2 as libc::c_int as isize);
2695                    *lres
2696                        .offset(
2697                            3 as libc::c_int as isize,
2698                        ) = !*lres.offset(3 as libc::c_int as isize);
2699                    lres = lres.offset(4 as libc::c_int as isize);
2700                    j = j
2701                        .wrapping_add(
2702                            (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2703                                .wrapping_mul(4 as libc::c_int as libc::c_ulong),
2704                        );
2705                    minlen = minlen
2706                        .wrapping_sub(
2707                            (core::mem::size_of::<libc::c_ulong>() as libc::c_ulong)
2708                                .wrapping_mul(4 as libc::c_int as libc::c_ulong),
2709                        );
2710                }
2711            }
2712        }
2713        while j < maxlen {
2714            output = (if *len.offset(0 as libc::c_int as isize) <= j {
2715                0 as libc::c_int
2716            } else {
2717                *(*src.offset(0 as libc::c_int as isize)).offset(j as isize)
2718                    as libc::c_int
2719            }) as libc::c_uchar;
2720            if op == 3 as libc::c_int as libc::c_ulong {
2721                output = !(output as libc::c_int) as libc::c_uchar;
2722            }
2723            i_0 = 1 as libc::c_int as libc::c_ulong;
2724            while i_0 < numkeys {
2725                let mut skip: libc::c_int = 0 as libc::c_int;
2726                byte = (if *len.offset(i_0 as isize) <= j {
2727                    0 as libc::c_int
2728                } else {
2729                    *(*src.offset(i_0 as isize)).offset(j as isize) as libc::c_int
2730                }) as libc::c_uchar;
2731                match op {
2732                    0 => {
2733                        output = (output as libc::c_int & byte as libc::c_int)
2734                            as libc::c_uchar;
2735                        skip = (output as libc::c_int == 0 as libc::c_int)
2736                            as libc::c_int;
2737                    }
2738                    1 => {
2739                        output = (output as libc::c_int | byte as libc::c_int)
2740                            as libc::c_uchar;
2741                        skip = (output as libc::c_int == 0xff as libc::c_int)
2742                            as libc::c_int;
2743                    }
2744                    2 => {
2745                        output = (output as libc::c_int ^ byte as libc::c_int)
2746                            as libc::c_uchar;
2747                    }
2748                    _ => {}
2749                }
2750                if skip != 0 {
2751                    break;
2752                }
2753                i_0 = i_0.wrapping_add(1);
2754            }
2755            *res.offset(j as isize) = output;
2756            j = j.wrapping_add(1);
2757        }
2758    }
2759    j = 0 as libc::c_int as libc::c_ulong;
2760    while j < numkeys {
2761        if !(*objects.offset(j as isize)).is_null() {
2762            decrRefCount(*objects.offset(j as isize));
2763        }
2764        j = j.wrapping_add(1);
2765    }
2766    zfree(src as *mut libc::c_void);
2767    zfree(len as *mut libc::c_void);
2768    zfree(objects as *mut libc::c_void);
2769    if maxlen != 0 {
2770        o = createObject(0 as libc::c_int, res as *mut libc::c_void);
2771        setKey(c, (*c).db, targetkey, o, 0 as libc::c_int);
2772        notifyKeyspaceEvent(
2773            (1 as libc::c_int) << 3 as libc::c_int,
2774            b"set\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
2775            targetkey,
2776            (*(*c).db).id,
2777        );
2778        decrRefCount(o);
2779        server.dirty += 1;
2780    } else if dbDelete((*c).db, targetkey) != 0 {
2781        signalModifiedKey(c, (*c).db, targetkey);
2782        notifyKeyspaceEvent(
2783            (1 as libc::c_int) << 2 as libc::c_int,
2784            b"del\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
2785            targetkey,
2786            (*(*c).db).id,
2787        );
2788        server.dirty += 1;
2789    }
2790    addReplyLongLong(c, maxlen as libc::c_longlong);
2791}
2792#[no_mangle]
2793pub unsafe extern "C" fn bitcountCommand(mut c: *mut client) {
2794    let mut o: *mut robj = 0 as *mut robj;
2795    let mut start: libc::c_longlong = 0;
2796    let mut end: libc::c_longlong = 0;
2797    let mut strlen_0: libc::c_long = 0;
2798    let mut p: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2799    let mut llbuf: [libc::c_char; 21] = [0; 21];
2800    let mut isbit: libc::c_int = 0 as libc::c_int;
2801    let mut first_byte_neg_mask: libc::c_uchar = 0 as libc::c_int as libc::c_uchar;
2802    let mut last_byte_neg_mask: libc::c_uchar = 0 as libc::c_int as libc::c_uchar;
2803    o = lookupKeyReadOrReply(
2804        c,
2805        *((*c).argv).offset(1 as libc::c_int as isize),
2806        shared.czero,
2807    );
2808    if o.is_null() || checkType(c, o, 0 as libc::c_int) != 0 {
2809        return;
2810    }
2811    p = getObjectReadOnlyString(o, &mut strlen_0, llbuf.as_mut_ptr());
2812    if (*c).argc == 4 as libc::c_int || (*c).argc == 5 as libc::c_int {
2813        let mut totlen: libc::c_longlong = strlen_0 as libc::c_longlong;
2814        if totlen <= 9223372036854775807 as libc::c_longlong >> 3 as libc::c_int
2815        {} else {
2816            _serverAssert(
2817                b"totlen <= LLONG_MAX >> 3\0" as *const u8 as *const libc::c_char,
2818                b"bitops.c\0" as *const u8 as *const libc::c_char,
2819                814 as libc::c_int,
2820            );
2821            unreachable!();
2822        };
2823        if getLongLongFromObjectOrReply(
2824            c,
2825            *((*c).argv).offset(2 as libc::c_int as isize),
2826            &mut start,
2827            0 as *const libc::c_char,
2828        ) != 0 as libc::c_int
2829        {
2830            return;
2831        }
2832        if getLongLongFromObjectOrReply(
2833            c,
2834            *((*c).argv).offset(3 as libc::c_int as isize),
2835            &mut end,
2836            0 as *const libc::c_char,
2837        ) != 0 as libc::c_int
2838        {
2839            return;
2840        }
2841        if start < 0 as libc::c_int as libc::c_longlong
2842            && end < 0 as libc::c_int as libc::c_longlong && start > end
2843        {
2844            addReply(c, shared.czero);
2845            return;
2846        }
2847        if (*c).argc == 5 as libc::c_int {
2848            if strcasecmp(
2849                (**((*c).argv).offset(4 as libc::c_int as isize)).ptr
2850                    as *const libc::c_char,
2851                b"bit\0" as *const u8 as *const libc::c_char,
2852            ) == 0
2853            {
2854                isbit = 1 as libc::c_int;
2855            } else if strcasecmp(
2856                (**((*c).argv).offset(4 as libc::c_int as isize)).ptr
2857                    as *const libc::c_char,
2858                b"byte\0" as *const u8 as *const libc::c_char,
2859            ) == 0
2860            {
2861                isbit = 0 as libc::c_int;
2862            } else {
2863                addReplyErrorObject(c, shared.syntaxerr);
2864                return;
2865            }
2866        }
2867        if isbit != 0 {
2868            totlen <<= 3 as libc::c_int;
2869        }
2870        if start < 0 as libc::c_int as libc::c_longlong {
2871            start = totlen + start;
2872        }
2873        if end < 0 as libc::c_int as libc::c_longlong {
2874            end = totlen + end;
2875        }
2876        if start < 0 as libc::c_int as libc::c_longlong {
2877            start = 0 as libc::c_int as libc::c_longlong;
2878        }
2879        if end < 0 as libc::c_int as libc::c_longlong {
2880            end = 0 as libc::c_int as libc::c_longlong;
2881        }
2882        if end >= totlen {
2883            end = totlen - 1 as libc::c_int as libc::c_longlong;
2884        }
2885        if isbit != 0 && start <= end {
2886            first_byte_neg_mask = (!(((1 as libc::c_int)
2887                << 8 as libc::c_int as libc::c_longlong
2888                    - (start & 7 as libc::c_int as libc::c_longlong)) - 1 as libc::c_int)
2889                & 0xff as libc::c_int) as libc::c_uchar;
2890            last_byte_neg_mask = (((1 as libc::c_int)
2891                << 7 as libc::c_int as libc::c_longlong
2892                    - (end & 7 as libc::c_int as libc::c_longlong)) - 1 as libc::c_int)
2893                as libc::c_uchar;
2894            start >>= 3 as libc::c_int;
2895            end >>= 3 as libc::c_int;
2896        }
2897    } else if (*c).argc == 2 as libc::c_int {
2898        start = 0 as libc::c_int as libc::c_longlong;
2899        end = (strlen_0 - 1 as libc::c_int as libc::c_long) as libc::c_longlong;
2900    } else {
2901        addReplyErrorObject(c, shared.syntaxerr);
2902        return;
2903    }
2904    if start > end {
2905        addReply(c, shared.czero);
2906    } else {
2907        let mut bytes: libc::c_long = (end - start
2908            + 1 as libc::c_int as libc::c_longlong) as libc::c_long;
2909        let mut count: libc::c_longlong = redisPopcount(
2910            p.offset(start as isize) as *mut libc::c_void,
2911            bytes,
2912        );
2913        if first_byte_neg_mask as libc::c_int != 0 as libc::c_int
2914            || last_byte_neg_mask as libc::c_int != 0 as libc::c_int
2915        {
2916            let mut firstlast: [libc::c_uchar; 2] = [
2917                0 as libc::c_int as libc::c_uchar,
2918                0 as libc::c_int as libc::c_uchar,
2919            ];
2920            if first_byte_neg_mask as libc::c_int != 0 as libc::c_int {
2921                firstlast[0 as libc::c_int
2922                    as usize] = (*p.offset(start as isize) as libc::c_int
2923                    & first_byte_neg_mask as libc::c_int) as libc::c_uchar;
2924            }
2925            if last_byte_neg_mask as libc::c_int != 0 as libc::c_int {
2926                firstlast[1 as libc::c_int
2927                    as usize] = (*p.offset(end as isize) as libc::c_int
2928                    & last_byte_neg_mask as libc::c_int) as libc::c_uchar;
2929            }
2930            count
2931                -= redisPopcount(
2932                    firstlast.as_mut_ptr() as *mut libc::c_void,
2933                    2 as libc::c_int as libc::c_long,
2934                );
2935        }
2936        addReplyLongLong(c, count);
2937    };
2938}
2939#[no_mangle]
2940pub unsafe extern "C" fn bitposCommand(mut c: *mut client) {
2941    let mut curbytes: libc::c_long = 0;
2942    let mut current_block: u64;
2943    let mut o: *mut robj = 0 as *mut robj;
2944    let mut start: libc::c_longlong = 0;
2945    let mut end: libc::c_longlong = 0;
2946    let mut bit: libc::c_long = 0;
2947    let mut strlen_0: libc::c_long = 0;
2948    let mut p: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2949    let mut llbuf: [libc::c_char; 21] = [0; 21];
2950    let mut isbit: libc::c_int = 0 as libc::c_int;
2951    let mut end_given: libc::c_int = 0 as libc::c_int;
2952    let mut first_byte_neg_mask: libc::c_uchar = 0 as libc::c_int as libc::c_uchar;
2953    let mut last_byte_neg_mask: libc::c_uchar = 0 as libc::c_int as libc::c_uchar;
2954    if getLongFromObjectOrReply(
2955        c,
2956        *((*c).argv).offset(2 as libc::c_int as isize),
2957        &mut bit,
2958        0 as *const libc::c_char,
2959    ) != 0 as libc::c_int
2960    {
2961        return;
2962    }
2963    if bit != 0 as libc::c_int as libc::c_long && bit != 1 as libc::c_int as libc::c_long
2964    {
2965        addReplyError(
2966            c,
2967            b"The bit argument must be 1 or 0.\0" as *const u8 as *const libc::c_char,
2968        );
2969        return;
2970    }
2971    o = lookupKeyRead((*c).db, *((*c).argv).offset(1 as libc::c_int as isize));
2972    if o.is_null() {
2973        addReplyLongLong(
2974            c,
2975            (if bit != 0 { -(1 as libc::c_int) } else { 0 as libc::c_int })
2976                as libc::c_longlong,
2977        );
2978        return;
2979    }
2980    if checkType(c, o, 0 as libc::c_int) != 0 {
2981        return;
2982    }
2983    p = getObjectReadOnlyString(o, &mut strlen_0, llbuf.as_mut_ptr());
2984    if (*c).argc == 4 as libc::c_int || (*c).argc == 5 as libc::c_int
2985        || (*c).argc == 6 as libc::c_int
2986    {
2987        let mut totlen: libc::c_longlong = strlen_0 as libc::c_longlong;
2988        if totlen <= 9223372036854775807 as libc::c_longlong >> 3 as libc::c_int
2989        {} else {
2990            _serverAssert(
2991                b"totlen <= LLONG_MAX >> 3\0" as *const u8 as *const libc::c_char,
2992                b"bitops.c\0" as *const u8 as *const libc::c_char,
2993                909 as libc::c_int,
2994            );
2995            unreachable!();
2996        };
2997        if getLongLongFromObjectOrReply(
2998            c,
2999            *((*c).argv).offset(3 as libc::c_int as isize),
3000            &mut start,
3001            0 as *const libc::c_char,
3002        ) != 0 as libc::c_int
3003        {
3004            return;
3005        }
3006        if (*c).argc == 6 as libc::c_int {
3007            if strcasecmp(
3008                (**((*c).argv).offset(5 as libc::c_int as isize)).ptr
3009                    as *const libc::c_char,
3010                b"bit\0" as *const u8 as *const libc::c_char,
3011            ) == 0
3012            {
3013                isbit = 1 as libc::c_int;
3014            } else if strcasecmp(
3015                (**((*c).argv).offset(5 as libc::c_int as isize)).ptr
3016                    as *const libc::c_char,
3017                b"byte\0" as *const u8 as *const libc::c_char,
3018            ) == 0
3019            {
3020                isbit = 0 as libc::c_int;
3021            } else {
3022                addReplyErrorObject(c, shared.syntaxerr);
3023                return;
3024            }
3025        }
3026        if (*c).argc >= 5 as libc::c_int {
3027            if getLongLongFromObjectOrReply(
3028                c,
3029                *((*c).argv).offset(4 as libc::c_int as isize),
3030                &mut end,
3031                0 as *const libc::c_char,
3032            ) != 0 as libc::c_int
3033            {
3034                return;
3035            }
3036            end_given = 1 as libc::c_int;
3037        } else if isbit != 0 {
3038            end = (totlen << 3 as libc::c_int) + 7 as libc::c_int as libc::c_longlong;
3039        } else {
3040            end = totlen - 1 as libc::c_int as libc::c_longlong;
3041        }
3042        if isbit != 0 {
3043            totlen <<= 3 as libc::c_int;
3044        }
3045        if start < 0 as libc::c_int as libc::c_longlong {
3046            start = totlen + start;
3047        }
3048        if end < 0 as libc::c_int as libc::c_longlong {
3049            end = totlen + end;
3050        }
3051        if start < 0 as libc::c_int as libc::c_longlong {
3052            start = 0 as libc::c_int as libc::c_longlong;
3053        }
3054        if end < 0 as libc::c_int as libc::c_longlong {
3055            end = 0 as libc::c_int as libc::c_longlong;
3056        }
3057        if end >= totlen {
3058            end = totlen - 1 as libc::c_int as libc::c_longlong;
3059        }
3060        if isbit != 0 && start <= end {
3061            first_byte_neg_mask = (!(((1 as libc::c_int)
3062                << 8 as libc::c_int as libc::c_longlong
3063                    - (start & 7 as libc::c_int as libc::c_longlong)) - 1 as libc::c_int)
3064                & 0xff as libc::c_int) as libc::c_uchar;
3065            last_byte_neg_mask = (((1 as libc::c_int)
3066                << 7 as libc::c_int as libc::c_longlong
3067                    - (end & 7 as libc::c_int as libc::c_longlong)) - 1 as libc::c_int)
3068                as libc::c_uchar;
3069            start >>= 3 as libc::c_int;
3070            end >>= 3 as libc::c_int;
3071        }
3072    } else if (*c).argc == 3 as libc::c_int {
3073        start = 0 as libc::c_int as libc::c_longlong;
3074        end = (strlen_0 - 1 as libc::c_int as libc::c_long) as libc::c_longlong;
3075    } else {
3076        addReplyErrorObject(c, shared.syntaxerr);
3077        return;
3078    }
3079    if start > end {
3080        addReplyLongLong(c, -(1 as libc::c_int) as libc::c_longlong);
3081    } else {
3082        let mut bytes: libc::c_long = (end - start
3083            + 1 as libc::c_int as libc::c_longlong) as libc::c_long;
3084        let mut pos: libc::c_longlong = 0;
3085        let mut tmpchar: libc::c_uchar = 0;
3086        if first_byte_neg_mask != 0 {
3087            if bit != 0 {
3088                tmpchar = (*p.offset(start as isize) as libc::c_int
3089                    & !(first_byte_neg_mask as libc::c_int)) as libc::c_uchar;
3090            } else {
3091                tmpchar = (*p.offset(start as isize) as libc::c_int
3092                    | first_byte_neg_mask as libc::c_int) as libc::c_uchar;
3093            }
3094            if last_byte_neg_mask as libc::c_int != 0
3095                && bytes == 1 as libc::c_int as libc::c_long
3096            {
3097                if bit != 0 {
3098                    tmpchar = (tmpchar as libc::c_int
3099                        & !(last_byte_neg_mask as libc::c_int)) as libc::c_uchar;
3100                } else {
3101                    tmpchar = (tmpchar as libc::c_int
3102                        | last_byte_neg_mask as libc::c_int) as libc::c_uchar;
3103                }
3104            }
3105            pos = redisBitpos(
3106                &mut tmpchar as *mut libc::c_uchar as *mut libc::c_void,
3107                1 as libc::c_int as libc::c_ulong,
3108                bit as libc::c_int,
3109            );
3110            if bytes == 1 as libc::c_int as libc::c_long
3111                || pos != -(1 as libc::c_int) as libc::c_longlong
3112                    && pos != 8 as libc::c_int as libc::c_longlong
3113            {
3114                current_block = 288816968937153605;
3115            } else {
3116                start += 1;
3117                bytes -= 1;
3118                current_block = 4888910987971495881;
3119            }
3120        } else {
3121            current_block = 4888910987971495881;
3122        }
3123        match current_block {
3124            4888910987971495881 => {
3125                curbytes = bytes
3126                    - (if last_byte_neg_mask as libc::c_int != 0 {
3127                        1 as libc::c_int
3128                    } else {
3129                        0 as libc::c_int
3130                    }) as libc::c_long;
3131                if curbytes > 0 as libc::c_int as libc::c_long {
3132                    pos = redisBitpos(
3133                        p.offset(start as isize) as *mut libc::c_void,
3134                        curbytes as libc::c_ulong,
3135                        bit as libc::c_int,
3136                    );
3137                    if bytes == curbytes
3138                        || pos != -(1 as libc::c_int) as libc::c_longlong
3139                            && pos != (curbytes as libc::c_longlong) << 3 as libc::c_int
3140                    {
3141                        current_block = 288816968937153605;
3142                    } else {
3143                        start += curbytes as libc::c_longlong;
3144                        bytes -= curbytes;
3145                        current_block = 15669289850109000831;
3146                    }
3147                } else {
3148                    current_block = 15669289850109000831;
3149                }
3150                match current_block {
3151                    288816968937153605 => {}
3152                    _ => {
3153                        if bit != 0 {
3154                            tmpchar = (*p.offset(end as isize) as libc::c_int
3155                                & !(last_byte_neg_mask as libc::c_int)) as libc::c_uchar;
3156                        } else {
3157                            tmpchar = (*p.offset(end as isize) as libc::c_int
3158                                | last_byte_neg_mask as libc::c_int) as libc::c_uchar;
3159                        }
3160                        pos = redisBitpos(
3161                            &mut tmpchar as *mut libc::c_uchar as *mut libc::c_void,
3162                            1 as libc::c_int as libc::c_ulong,
3163                            bit as libc::c_int,
3164                        );
3165                    }
3166                }
3167            }
3168            _ => {}
3169        }
3170        if end_given != 0 && bit == 0 as libc::c_int as libc::c_long
3171            && pos == (bytes as libc::c_longlong) << 3 as libc::c_int
3172        {
3173            addReplyLongLong(c, -(1 as libc::c_int) as libc::c_longlong);
3174            return;
3175        }
3176        if pos != -(1 as libc::c_int) as libc::c_longlong {
3177            pos += start << 3 as libc::c_int;
3178        }
3179        addReplyLongLong(c, pos);
3180    };
3181}
3182#[no_mangle]
3183pub unsafe extern "C" fn bitfieldGeneric(mut c: *mut client, mut flags: libc::c_int) {
3184    let mut o: *mut robj = 0 as *mut robj;
3185    let mut bitoffset: uint64_t = 0;
3186    let mut j: libc::c_int = 0;
3187    let mut numops: libc::c_int = 0 as libc::c_int;
3188    let mut changes: libc::c_int = 0 as libc::c_int;
3189    let mut dirty: libc::c_int = 0 as libc::c_int;
3190    let mut ops: *mut bitfieldOp = 0 as *mut bitfieldOp;
3191    let mut owtype: libc::c_int = 0 as libc::c_int;
3192    let mut readonly: libc::c_int = 1 as libc::c_int;
3193    let mut highest_write_offset: uint64_t = 0 as libc::c_int as uint64_t;
3194    let mut current_block_44: u64;
3195    j = 2 as libc::c_int;
3196    while j < (*c).argc {
3197        let mut remargs: libc::c_int = (*c).argc - j - 1 as libc::c_int;
3198        let mut subcmd: *mut libc::c_char = (**((*c).argv).offset(j as isize)).ptr
3199            as *mut libc::c_char;
3200        let mut opcode: libc::c_int = 0;
3201        let mut i64: libc::c_longlong = 0 as libc::c_int as libc::c_longlong;
3202        let mut sign: libc::c_int = 0 as libc::c_int;
3203        let mut bits: libc::c_int = 0 as libc::c_int;
3204        if strcasecmp(subcmd, b"get\0" as *const u8 as *const libc::c_char) == 0
3205            && remargs >= 2 as libc::c_int
3206        {
3207            opcode = 0 as libc::c_int;
3208            current_block_44 = 11194104282611034094;
3209        } else if strcasecmp(subcmd, b"set\0" as *const u8 as *const libc::c_char) == 0
3210            && remargs >= 3 as libc::c_int
3211        {
3212            opcode = 1 as libc::c_int;
3213            current_block_44 = 11194104282611034094;
3214        } else if strcasecmp(subcmd, b"incrby\0" as *const u8 as *const libc::c_char)
3215            == 0 && remargs >= 3 as libc::c_int
3216        {
3217            opcode = 2 as libc::c_int;
3218            current_block_44 = 11194104282611034094;
3219        } else {
3220            if strcasecmp(subcmd, b"overflow\0" as *const u8 as *const libc::c_char) == 0
3221                && remargs >= 1 as libc::c_int
3222            {
3223                let mut owtypename: *mut libc::c_char = (**((*c).argv)
3224                    .offset((j + 1 as libc::c_int) as isize))
3225                    .ptr as *mut libc::c_char;
3226                j += 1;
3227                if strcasecmp(owtypename, b"wrap\0" as *const u8 as *const libc::c_char)
3228                    == 0
3229                {
3230                    owtype = 0 as libc::c_int;
3231                } else if strcasecmp(
3232                    owtypename,
3233                    b"sat\0" as *const u8 as *const libc::c_char,
3234                ) == 0
3235                {
3236                    owtype = 1 as libc::c_int;
3237                } else if strcasecmp(
3238                    owtypename,
3239                    b"fail\0" as *const u8 as *const libc::c_char,
3240                ) == 0
3241                {
3242                    owtype = 2 as libc::c_int;
3243                } else {
3244                    addReplyError(
3245                        c,
3246                        b"Invalid OVERFLOW type specified\0" as *const u8
3247                            as *const libc::c_char,
3248                    );
3249                    zfree(ops as *mut libc::c_void);
3250                    return;
3251                }
3252            } else {
3253                addReplyErrorObject(c, shared.syntaxerr);
3254                zfree(ops as *mut libc::c_void);
3255                return;
3256            }
3257            current_block_44 = 16658872821858055392;
3258        }
3259        match current_block_44 {
3260            11194104282611034094 => {
3261                if getBitfieldTypeFromArgument(
3262                    c,
3263                    *((*c).argv).offset((j + 1 as libc::c_int) as isize),
3264                    &mut sign,
3265                    &mut bits,
3266                ) != 0 as libc::c_int
3267                {
3268                    zfree(ops as *mut libc::c_void);
3269                    return;
3270                }
3271                if getBitOffsetFromArgument(
3272                    c,
3273                    *((*c).argv).offset((j + 2 as libc::c_int) as isize),
3274                    &mut bitoffset,
3275                    1 as libc::c_int,
3276                    bits,
3277                ) != 0 as libc::c_int
3278                {
3279                    zfree(ops as *mut libc::c_void);
3280                    return;
3281                }
3282                if opcode != 0 as libc::c_int {
3283                    readonly = 0 as libc::c_int;
3284                    if highest_write_offset
3285                        < bitoffset
3286                            .wrapping_add(bits as libc::c_ulong)
3287                            .wrapping_sub(1 as libc::c_int as libc::c_ulong)
3288                    {
3289                        highest_write_offset = bitoffset
3290                            .wrapping_add(bits as libc::c_ulong)
3291                            .wrapping_sub(1 as libc::c_int as libc::c_ulong);
3292                    }
3293                    if getLongLongFromObjectOrReply(
3294                        c,
3295                        *((*c).argv).offset((j + 3 as libc::c_int) as isize),
3296                        &mut i64,
3297                        0 as *const libc::c_char,
3298                    ) != 0 as libc::c_int
3299                    {
3300                        zfree(ops as *mut libc::c_void);
3301                        return;
3302                    }
3303                }
3304                ops = zrealloc(
3305                    ops as *mut libc::c_void,
3306                    (core::mem::size_of::<bitfieldOp>() as libc::c_ulong)
3307                        .wrapping_mul((numops + 1 as libc::c_int) as libc::c_ulong),
3308                ) as *mut bitfieldOp;
3309                (*ops.offset(numops as isize)).offset = bitoffset;
3310                (*ops.offset(numops as isize)).i64_0 = i64 as int64_t;
3311                (*ops.offset(numops as isize)).opcode = opcode;
3312                (*ops.offset(numops as isize)).owtype = owtype;
3313                (*ops.offset(numops as isize)).bits = bits;
3314                (*ops.offset(numops as isize)).sign = sign;
3315                numops += 1;
3316                j += 3 as libc::c_int - (opcode == 0 as libc::c_int) as libc::c_int;
3317            }
3318            _ => {}
3319        }
3320        j += 1;
3321    }
3322    if readonly != 0 {
3323        o = lookupKeyRead((*c).db, *((*c).argv).offset(1 as libc::c_int as isize));
3324        if !o.is_null() && checkType(c, o, 0 as libc::c_int) != 0 {
3325            zfree(ops as *mut libc::c_void);
3326            return;
3327        }
3328    } else {
3329        if flags & (1 as libc::c_int) << 0 as libc::c_int != 0 {
3330            zfree(ops as *mut libc::c_void);
3331            addReplyError(
3332                c,
3333                b"BITFIELD_RO only supports the GET subcommand\0" as *const u8
3334                    as *const libc::c_char,
3335            );
3336            return;
3337        }
3338        o = lookupStringForBitCommand(c, highest_write_offset, &mut dirty);
3339        if o.is_null() {
3340            zfree(ops as *mut libc::c_void);
3341            return;
3342        }
3343    }
3344    addReplyArrayLen(c, numops as libc::c_long);
3345    j = 0 as libc::c_int;
3346    while j < numops {
3347        let mut thisop: *mut bitfieldOp = ops.offset(j as isize);
3348        if (*thisop).opcode == 1 as libc::c_int || (*thisop).opcode == 2 as libc::c_int {
3349            if (*thisop).sign != 0 {
3350                let mut oldval: int64_t = 0;
3351                let mut newval: int64_t = 0;
3352                let mut wrapped: int64_t = 0;
3353                let mut retval: int64_t = 0;
3354                let mut overflow: libc::c_int = 0;
3355                oldval = getSignedBitfield(
3356                    (*o).ptr as *mut libc::c_uchar,
3357                    (*thisop).offset,
3358                    (*thisop).bits as uint64_t,
3359                );
3360                if (*thisop).opcode == 2 as libc::c_int {
3361                    overflow = checkSignedBitfieldOverflow(
3362                        oldval,
3363                        (*thisop).i64_0,
3364                        (*thisop).bits as uint64_t,
3365                        (*thisop).owtype,
3366                        &mut wrapped,
3367                    );
3368                    newval = if overflow != 0 {
3369                        wrapped
3370                    } else {
3371                        oldval + (*thisop).i64_0
3372                    };
3373                    retval = newval;
3374                } else {
3375                    newval = (*thisop).i64_0;
3376                    overflow = checkSignedBitfieldOverflow(
3377                        newval,
3378                        0 as libc::c_int as int64_t,
3379                        (*thisop).bits as uint64_t,
3380                        (*thisop).owtype,
3381                        &mut wrapped,
3382                    );
3383                    if overflow != 0 {
3384                        newval = wrapped;
3385                    }
3386                    retval = oldval;
3387                }
3388                if !(overflow != 0 && (*thisop).owtype == 2 as libc::c_int) {
3389                    addReplyLongLong(c, retval as libc::c_longlong);
3390                    setSignedBitfield(
3391                        (*o).ptr as *mut libc::c_uchar,
3392                        (*thisop).offset,
3393                        (*thisop).bits as uint64_t,
3394                        newval,
3395                    );
3396                    if dirty != 0 || oldval != newval {
3397                        changes += 1;
3398                    }
3399                } else {
3400                    addReplyNull(c);
3401                }
3402            } else {
3403                let mut oldval_0: uint64_t = 0;
3404                let mut newval_0: uint64_t = 0;
3405                let mut wrapped_0: uint64_t = 0;
3406                let mut retval_0: uint64_t = 0;
3407                let mut overflow_0: libc::c_int = 0;
3408                oldval_0 = getUnsignedBitfield(
3409                    (*o).ptr as *mut libc::c_uchar,
3410                    (*thisop).offset,
3411                    (*thisop).bits as uint64_t,
3412                );
3413                if (*thisop).opcode == 2 as libc::c_int {
3414                    newval_0 = oldval_0.wrapping_add((*thisop).i64_0 as libc::c_ulong);
3415                    overflow_0 = checkUnsignedBitfieldOverflow(
3416                        oldval_0,
3417                        (*thisop).i64_0,
3418                        (*thisop).bits as uint64_t,
3419                        (*thisop).owtype,
3420                        &mut wrapped_0,
3421                    );
3422                    if overflow_0 != 0 {
3423                        newval_0 = wrapped_0;
3424                    }
3425                    retval_0 = newval_0;
3426                } else {
3427                    newval_0 = (*thisop).i64_0 as uint64_t;
3428                    overflow_0 = checkUnsignedBitfieldOverflow(
3429                        newval_0,
3430                        0 as libc::c_int as int64_t,
3431                        (*thisop).bits as uint64_t,
3432                        (*thisop).owtype,
3433                        &mut wrapped_0,
3434                    );
3435                    if overflow_0 != 0 {
3436                        newval_0 = wrapped_0;
3437                    }
3438                    retval_0 = oldval_0;
3439                }
3440                if !(overflow_0 != 0 && (*thisop).owtype == 2 as libc::c_int) {
3441                    addReplyLongLong(c, retval_0 as libc::c_longlong);
3442                    setUnsignedBitfield(
3443                        (*o).ptr as *mut libc::c_uchar,
3444                        (*thisop).offset,
3445                        (*thisop).bits as uint64_t,
3446                        newval_0,
3447                    );
3448                    if dirty != 0 || oldval_0 != newval_0 {
3449                        changes += 1;
3450                    }
3451                } else {
3452                    addReplyNull(c);
3453                }
3454            }
3455        } else {
3456            let mut buf: [libc::c_uchar; 9] = [0; 9];
3457            let mut strlen_0: libc::c_long = 0 as libc::c_int as libc::c_long;
3458            let mut src: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
3459            let mut llbuf: [libc::c_char; 21] = [0; 21];
3460            if !o.is_null() {
3461                src = getObjectReadOnlyString(o, &mut strlen_0, llbuf.as_mut_ptr());
3462            }
3463            memset(
3464                buf.as_mut_ptr() as *mut libc::c_void,
3465                0 as libc::c_int,
3466                9 as libc::c_int as libc::c_ulong,
3467            );
3468            let mut i: libc::c_int = 0;
3469            let mut byte: uint64_t = (*thisop).offset >> 3 as libc::c_int;
3470            i = 0 as libc::c_int;
3471            while i < 9 as libc::c_int {
3472                if src.is_null()
3473                    || (i as libc::c_ulong).wrapping_add(byte) >= strlen_0 as uint64_t
3474                {
3475                    break;
3476                }
3477                buf[i
3478                    as usize] = *src
3479                    .offset((i as libc::c_ulong).wrapping_add(byte) as isize);
3480                i += 1;
3481            }
3482            if (*thisop).sign != 0 {
3483                let mut val: int64_t = getSignedBitfield(
3484                    buf.as_mut_ptr(),
3485                    ((*thisop).offset)
3486                        .wrapping_sub(
3487                            byte.wrapping_mul(8 as libc::c_int as libc::c_ulong),
3488                        ),
3489                    (*thisop).bits as uint64_t,
3490                );
3491                addReplyLongLong(c, val as libc::c_longlong);
3492            } else {
3493                let mut val_0: uint64_t = getUnsignedBitfield(
3494                    buf.as_mut_ptr(),
3495                    ((*thisop).offset)
3496                        .wrapping_sub(
3497                            byte.wrapping_mul(8 as libc::c_int as libc::c_ulong),
3498                        ),
3499                    (*thisop).bits as uint64_t,
3500                );
3501                addReplyLongLong(c, val_0 as libc::c_longlong);
3502            }
3503        }
3504        j += 1;
3505    }
3506    if changes != 0 {
3507        signalModifiedKey(c, (*c).db, *((*c).argv).offset(1 as libc::c_int as isize));
3508        notifyKeyspaceEvent(
3509            (1 as libc::c_int) << 3 as libc::c_int,
3510            b"setbit\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
3511            *((*c).argv).offset(1 as libc::c_int as isize),
3512            (*(*c).db).id,
3513        );
3514        server.dirty += changes as libc::c_longlong;
3515    }
3516    zfree(ops as *mut libc::c_void);
3517}
3518#[no_mangle]
3519pub unsafe extern "C" fn bitfieldCommand(mut c: *mut client) {
3520    bitfieldGeneric(c, 0 as libc::c_int);
3521}
3522#[no_mangle]
3523pub unsafe extern "C" fn bitfieldroCommand(mut c: *mut client) {
3524    bitfieldGeneric(c, (1 as libc::c_int) << 0 as libc::c_int);
3525}