// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/deps/hiredis/sds.c
// Function: sdsIncrLen
void sdsIncrLen(sds s, int incr) {
    unsigned char flags = s[-1];
    size_t len;
    switch(flags&SDS_TYPE_MASK) {
        case SDS_TYPE_5: {
            unsigned char *fp = ((unsigned char*)s)-1;
            unsigned char oldlen = SDS_TYPE_5_LEN(flags);
            assert((incr > 0 && oldlen+incr < 32) || (incr < 0 && oldlen >= (unsigned int)(-incr)));
            *fp = SDS_TYPE_5 | ((oldlen+incr) << SDS_TYPE_BITS);
            len = oldlen+incr;
            break;
        }
        case SDS_TYPE_8: {
            SDS_HDR_VAR(8,s);
            assert((incr >= 0 && sh->alloc-sh->len >= incr) || (incr < 0 && sh->len >= (unsigned int)(-incr)));
            len = (sh->len += incr);
            break;
        }
        case SDS_TYPE_16: {
            SDS_HDR_VAR(16,s);
            assert((incr >= 0 && sh->alloc-sh->len >= incr) || (incr < 0 && sh->len >= (unsigned int)(-incr)));
            len = (sh->len += incr);
            break;
        }
        case SDS_TYPE_32: {
            SDS_HDR_VAR(32,s);
            assert((incr >= 0 && sh->alloc-sh->len >= (unsigned int)incr) || (incr < 0 && sh->len >= (unsigned int)(-incr)));
            len = (sh->len += incr);
            break;
        }
        case SDS_TYPE_64: {
            SDS_HDR_VAR(64,s);
            assert((incr >= 0 && sh->alloc-sh->len >= (uint64_t)incr) || (incr < 0 && sh->len >= (uint64_t)(-incr)));
            len = (sh->len += incr);
            break;
        }
        default: len = 0; /* Just to avoid compilation warnings. */
    }
    s[len] = '\0';
}

// Assembly:
pushq %rax
movzbl -0x1(%rdi), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x18b2b
leaq 0x21e04(%rip), %rdx     # 0x3a818
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
testl %esi, %esi
jle 0x18a2c
leal (%rax,%rsi), %ecx
cmpl $0x20, %ecx
jl 0x18a43
testl %esi, %esi
jns 0x18b90
movzbl %al, %ecx
movl %esi, %edx
negl %edx
cmpl %edx, %ecx
jb 0x18b90
movslq %esi, %rsi
addq %rax, %rsi
leal (,%rsi,8), %eax
movb %al, -0x1(%rdi)
jmp 0x18b2d
testl %esi, %esi
js 0x18a6b
movq -0x9(%rdi), %rax
subq -0x11(%rdi), %rax
movl %esi, %ecx
cmpq %rcx, %rax
jae 0x18a81
testl %esi, %esi
jns 0x18b33
movl %esi, %eax
negl %eax
cmpq %rax, -0x11(%rdi)
jb 0x18b33
movslq %esi, %rsi
addq -0x11(%rdi), %rsi
movq %rsi, -0x11(%rdi)
jmp 0x18b2d
testl %esi, %esi
js 0x18aa3
movzwl -0x3(%rdi), %eax
movzwl -0x5(%rdi), %ecx
subl %ecx, %eax
cmpl %esi, %eax
jge 0x18abb
testl %esi, %esi
jns 0x18b52
movzwl -0x5(%rdi), %eax
movl %esi, %ecx
negl %ecx
cmpl %ecx, %eax
jb 0x18b52
addw -0x5(%rdi), %si
movw %si, -0x5(%rdi)
movzwl %si, %esi
jmp 0x18b2d
testl %esi, %esi
js 0x18ad6
movl -0x5(%rdi), %eax
subl -0x9(%rdi), %eax
cmpl %esi, %eax
jae 0x18aeb
testl %esi, %esi
jns 0x18b71
movl %esi, %eax
negl %eax
cmpl %eax, -0x9(%rdi)
jb 0x18b71
addl -0x9(%rdi), %esi
movl %esi, -0x9(%rdi)
jmp 0x18b2d
testl %esi, %esi
js 0x18b05
movzbl -0x2(%rdi), %eax
movzbl -0x3(%rdi), %ecx
subl %ecx, %eax
cmpl %esi, %eax
jge 0x18b1d
testl %esi, %esi
jns 0x18baf
movzbl -0x3(%rdi), %eax
movl %esi, %ecx
negl %ecx
cmpl %ecx, %eax
jb 0x18baf
addb -0x3(%rdi), %sil
movb %sil, -0x3(%rdi)
movzbl %sil, %esi
jmp 0x18b2d
xorl %esi, %esi
movb $0x0, (%rdi,%rsi)
popq %rax
retq
leaq 0x22122(%rip), %rdi     # 0x3ac5c
leaq 0x22037(%rip), %rsi     # 0x3ab78
leaq 0x22036(%rip), %rcx     # 0x3ab7e
movl $0x158, %edx            # imm = 0x158
callq 0xb210
leaq 0x2203f(%rip), %rdi     # 0x3ab98
leaq 0x22018(%rip), %rsi     # 0x3ab78
leaq 0x22017(%rip), %rcx     # 0x3ab7e
movl $0x14c, %edx            # imm = 0x14C
callq 0xb210
leaq 0x2207b(%rip), %rdi     # 0x3abf3
leaq 0x21ff9(%rip), %rsi     # 0x3ab78
leaq 0x21ff8(%rip), %rcx     # 0x3ab7e
movl $0x152, %edx            # imm = 0x152
callq 0xb210
leaq 0x21f91(%rip), %rdi     # 0x3ab28
leaq 0x21fda(%rip), %rsi     # 0x3ab78
leaq 0x21fd9(%rip), %rcx     # 0x3ab7e
movl $0x13f, %edx            # imm = 0x13F
callq 0xb210
leaq 0x21fe2(%rip), %rdi     # 0x3ab98
leaq 0x21fbb(%rip), %rsi     # 0x3ab78
leaq 0x21fba(%rip), %rcx     # 0x3ab7e
movl $0x146, %edx            # imm = 0x146
callq 0xb210