// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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 0x1936b
leaq 0x28992(%rip), %rdx     # 0x41c38
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
testl %esi, %esi
jle 0x193ff
addl %esi, %eax
cmpl $0x20, %eax
jb 0x1940e
jmp 0x1944f
testl %esi, %esi
js 0x19372
movq -0x11(%rdi), %rcx
movq -0x9(%rdi), %rax
subq %rcx, %rax
movl %esi, %edx
cmpq %rdx, %rax
jb 0x19383
movslq %esi, %rax
addq %rcx, %rax
movq %rax, -0x11(%rdi)
jmp 0x1941a
testl %esi, %esi
js 0x193a2
movzwl -0x3(%rdi), %ecx
movzwl -0x5(%rdi), %eax
subl %eax, %ecx
cmpl %esi, %ecx
jl 0x193b2
addl %esi, %eax
movw %ax, -0x5(%rdi)
movzwl %ax, %eax
jmp 0x1941a
testl %esi, %esi
js 0x193d1
movl -0x9(%rdi), %eax
movl -0x5(%rdi), %ecx
subl %eax, %ecx
cmpl %esi, %ecx
jb 0x193e0
addl %esi, %eax
movl %eax, -0x9(%rdi)
jmp 0x1941a
testl %esi, %esi
js 0x19420
movzbl -0x2(%rdi), %ecx
movzbl -0x3(%rdi), %eax
subl %eax, %ecx
cmpl %esi, %ecx
jl 0x19430
addb %al, %sil
movb %sil, -0x3(%rdi)
movzbl %sil, %eax
jmp 0x1941a
xorl %eax, %eax
jmp 0x1941a
movq -0x11(%rdi), %rcx
movl %esi, %eax
negl %eax
cmpq %rax, %rcx
jae 0x192e8
leaq 0x28aaa(%rip), %rdi     # 0x41e34
leaq 0x289bf(%rip), %rsi     # 0x41d50
leaq 0x289be(%rip), %rcx     # 0x41d56
movl $0x158, %edx            # imm = 0x158
callq 0x10250
movzwl -0x5(%rdi), %eax
movl %esi, %ecx
negl %ecx
cmpl %ecx, %eax
jae 0x19311
leaq 0x289b7(%rip), %rdi     # 0x41d70
leaq 0x28990(%rip), %rsi     # 0x41d50
leaq 0x2898f(%rip), %rcx     # 0x41d56
movl $0x14c, %edx            # imm = 0x14C
callq 0x10250
movl -0x9(%rdi), %eax
movl %esi, %ecx
negl %ecx
cmpl %ecx, %eax
jae 0x19337
leaq 0x289e4(%rip), %rdi     # 0x41dcb
leaq 0x28962(%rip), %rsi     # 0x41d50
leaq 0x28961(%rip), %rcx     # 0x41d56
movl $0x152, %edx            # imm = 0x152
callq 0x10250
jns 0x1944f
movzbl %al, %eax
movl %esi, %ecx
negl %ecx
cmpl %ecx, %eax
jb 0x1944f
addl %esi, %eax
leal (,%rax,8), %ecx
movb %cl, -0x1(%rdi)
cltq
movb $0x0, (%rdi,%rax)
popq %rax
retq
movzbl -0x3(%rdi), %eax
movl %esi, %ecx
negl %ecx
cmpl %ecx, %eax
jae 0x1935b
leaq 0x28939(%rip), %rdi     # 0x41d70
leaq 0x28912(%rip), %rsi     # 0x41d50
leaq 0x28911(%rip), %rcx     # 0x41d56
movl $0x146, %edx            # imm = 0x146
callq 0x10250
leaq 0x288aa(%rip), %rdi     # 0x41d00
leaq 0x288f3(%rip), %rsi     # 0x41d50
leaq 0x288f2(%rip), %rcx     # 0x41d56
movl $0x13f, %edx            # imm = 0x13F
callq 0x10250