// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/deps/hiredis/sds.c
// Function: sdscatfmt
sds sdscatfmt(sds s, char const *fmt, ...) {
    size_t initlen = sdslen(s);
    const char *f = fmt;
    int i;
    va_list ap;

    va_start(ap,fmt);
    f = fmt;    /* Next format specifier byte to process. */
    i = initlen; /* Position of the next byte to write to dest str. */
    while(*f) {
        char next, *str;
        size_t l;
        long long num;
        unsigned long long unum;

        /* Make sure there is always space for at least 1 char. */
        if (sdsavail(s)==0) {
            s = sdsMakeRoomFor(s,1);
        }

        switch(*f) {
        case '%':
            next = *(f+1);
            f++;
            switch(next) {
            case 's':
            case 'S':
                str = va_arg(ap,char*);
                l = (next == 's') ? strlen(str) : sdslen(str);
                if (sdsavail(s) < l) {
                    s = sdsMakeRoomFor(s,l);
                }
                memcpy(s+i,str,l);
                sdsinclen(s,l);
                i += l;
                break;
            case 'i':
            case 'I':
                if (next == 'i')
                    num = va_arg(ap,int);
                else
                    num = va_arg(ap,long long);
                {
                    char buf[SDS_LLSTR_SIZE];
                    l = sdsll2str(buf,num);
                    if (sdsavail(s) < l) {
                        s = sdsMakeRoomFor(s,l);
                    }
                    memcpy(s+i,buf,l);
                    sdsinclen(s,l);
                    i += l;
                }
                break;
            case 'u':
            case 'U':
                if (next == 'u')
                    unum = va_arg(ap,unsigned int);
                else
                    unum = va_arg(ap,unsigned long long);
                {
                    char buf[SDS_LLSTR_SIZE];
                    l = sdsull2str(buf,unum);
                    if (sdsavail(s) < l) {
                        s = sdsMakeRoomFor(s,l);
                    }
                    memcpy(s+i,buf,l);
                    sdsinclen(s,l);
                    i += l;
                }
                break;
            default: /* Handle %% and generally %<unknown>. */
                s[i++] = next;
                sdsinclen(s,1);
                break;
            }
            break;
        default:
            s[i++] = *f;
            sdsinclen(s,1);
            break;
        }
        f++;
    }
    va_end(ap);

    /* Add null-term */
    s[i] = '\0';
    return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %r9, 0x68(%rsp)
testb %al, %al
je 0x191df
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm2, 0x90(%rsp)
movaps %xmm3, 0xa0(%rsp)
movaps %xmm4, 0xb0(%rsp)
movaps %xmm5, 0xc0(%rsp)
movaps %xmm6, 0xd0(%rsp)
movaps %xmm7, 0xe0(%rsp)
movq %r8, 0x60(%rsp)
movq %rcx, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movzbl -0x1(%rdi), %ebp
movl %ebp, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x1922b
leaq 0x216c9(%rip), %rcx     # 0x3a8cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %ebp
jmp 0x1922d
movq -0x11(%r14), %rbp
jmp 0x1922d
movzwl -0x5(%r14), %ebp
jmp 0x1922d
movl -0x9(%r14), %ebp
jmp 0x1922d
movzbl -0x3(%r14), %ebp
jmp 0x1922d
xorl %ebp, %ebp
leaq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
cmpb $0x0, (%rbx)
je 0x1985b
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
movabsq $0x100000000, %r9       # imm = 0x100000000
leaq 0x2167a(%rip), %r15     # 0x3a8f0
leaq 0x21663(%rip), %r13     # 0x3a8e0
movzbl -0x1(%r14), %eax
andl $0x7, %eax
decl %eax
cmpl $0x3, %eax
ja 0x192c5
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movzbl -0x2(%r14), %eax
movzbl -0x3(%r14), %ecx
jmp 0x192c0
movl -0x5(%r14), %eax
subl -0x9(%r14), %eax
jmp 0x192c7
movq -0x9(%r14), %rax
subq -0x11(%r14), %rax
jmp 0x192c7
movzwl -0x3(%r14), %eax
movzwl -0x5(%r14), %ecx
subq %rcx, %rax
jmp 0x192c7
xorl %eax, %eax
testq %rax, %rax
jne 0x192f0
movl $0x1, %esi
movq %r14, %rdi
callq 0x185b5
movabsq $0x100000000, %r9       # imm = 0x100000000
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
movq %rax, %r14
movb (%rbx), %al
cmpb $0x25, %al
jne 0x1933b
movb 0x1(%rbx), %al
incq %rbx
movzbl %al, %ecx
cmpl $0x68, %ecx
jg 0x19371
cmpl $0x49, %ecx
je 0x193a4
cmpl $0x53, %ecx
je 0x19384
cmpl $0x55, %ecx
jne 0x193e4
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x19535
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x19543
movslq %ebp, %rcx
movb %al, (%r14,%rcx)
movzbl -0x1(%r14), %eax
movl %eax, %ecx
andl $0x7, %ecx
movl $0x1, %r12d
cmpl $0x4, %ecx
ja 0x1981a
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
andb $-0x8, %al
addb $0x8, %al
movb %al, -0x1(%r14)
jmp 0x1981a
cmpl $0x69, %ecx
je 0x193c4
cmpl $0x75, %ecx
je 0x194b5
cmpl $0x73, %ecx
jne 0x193e4
movl (%rsp), %edx
cmpq $0x28, %rdx
ja 0x19439
movq %rdx, %rcx
addq 0x10(%rsp), %rcx
addl $0x8, %edx
movl %edx, (%rsp)
jmp 0x19447
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x194d5
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x194e3
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x194e8
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x194f6
movslq %ebp, %rcx
movb %al, (%r14,%rcx)
movzbl -0x1(%r14), %eax
movl %eax, %ecx
andl $0x7, %ecx
movl $0x1, %r12d
cmpl $0x4, %ecx
ja 0x1981a
leaq 0x21579(%rip), %rdx     # 0x3a984
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
incb -0x3(%r14)
jmp 0x1981a
incq -0x11(%r14)
jmp 0x1981a
incw -0x5(%r14)
jmp 0x1981a
incl -0x9(%r14)
jmp 0x1981a
movq 0x8(%rsp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq (%rcx), %r13
cmpb $0x73, %al
jne 0x1948b
movq %r13, %rdi
callq 0xb190
movq %rax, %r12
movzbl -0x1(%r14), %eax
andl $0x7, %eax
decl %eax
cmpl $0x3, %eax
ja 0x196dc
leaq 0x214ed(%rip), %rcx     # 0x3a960
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl -0x2(%r14), %eax
movzbl -0x3(%r14), %ecx
jmp 0x19663
movzbl -0x1(%r13), %r12d
movl %r12d, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x19853
leaq 0x214a6(%rip), %rcx     # 0x3a94c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %r12d
jmp 0x19459
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x19548
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x19556
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rsi
jmp 0x194f9
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movslq (%rax), %rsi
leaq 0x20(%rsp), %rdi
callq 0x18f04
movzbl -0x1(%r14), %ecx
andl $0x7, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x1967a
leaq 0x2140b(%rip), %rdx     # 0x3a928
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movzbl -0x2(%r14), %ecx
movzbl -0x3(%r14), %edx
jmp 0x19620
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rcx
jmp 0x19558
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl (%rax), %ecx
xorl %r13d, %r13d
leaq 0x1f(%rsp), %rax
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rax, %rsi
addq %r9, %r13
movq %rcx, %rax
mulq %r8
shrq $0x3, %rdx
leal (%rdx,%rdx), %eax
leal (%rax,%rax,4), %eax
movl %ecx, %edi
subl %eax, %edi
orb $0x30, %dil
movb %dil, 0x20(%rsp,%r12)
incq %r12
addb $0x8, %r15b
leaq 0x1(%rsi), %rax
cmpq $0x9, %rcx
movq %rdx, %rcx
ja 0x19566
movb $0x0, 0x20(%rsp,%r12)
leaq 0x1f(%rsp), %rax
addq %r12, %rax
leaq 0x20(%rsp), %rcx
cmpq %rcx, %rax
jbe 0x195d3
leaq 0x20(%rsp), %rax
movb (%rax), %cl
movb 0x1(%rsi), %dl
movb %dl, (%rax)
movb %cl, 0x1(%rsi)
incq %rax
leaq -0x1(%rsi), %rcx
cmpq %rsi, %rax
movq %rcx, %rsi
jb 0x195ba
movzbl -0x1(%r14), %eax
andl $0x7, %eax
decl %eax
cmpl $0x3, %eax
ja 0x1977b
leaq 0x21317(%rip), %rcx     # 0x3a904
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl -0x2(%r14), %eax
movzbl -0x3(%r14), %ecx
jmp 0x19672
movl -0x5(%r14), %ecx
subl -0x9(%r14), %ecx
jmp 0x1967c
movq -0x9(%r14), %rcx
subq -0x11(%r14), %rcx
jmp 0x1967c
movzwl -0x3(%r14), %ecx
movzwl -0x5(%r14), %edx
subq %rdx, %rcx
jmp 0x1967c
movl -0x5(%r14), %eax
subl -0x9(%r14), %eax
jmp 0x196de
movl -0x5(%r14), %eax
subl -0x9(%r14), %eax
jmp 0x1977d
movq -0x9(%r14), %rax
subq -0x11(%r14), %rax
jmp 0x196de
movq -0x9(%r14), %rax
subq -0x11(%r14), %rax
jmp 0x1977d
movzwl -0x3(%r14), %eax
movzwl -0x5(%r14), %ecx
subq %rcx, %rax
jmp 0x196de
movzwl -0x3(%r14), %eax
movzwl -0x5(%r14), %ecx
subq %rcx, %rax
jmp 0x1977d
xorl %ecx, %ecx
movslq %eax, %r12
cmpq %r12, %rcx
jae 0x19692
movq %r14, %rdi
movq %r12, %rsi
callq 0x185b5
movq %rax, %r14
movslq %ebp, %rdi
addq %r14, %rdi
leaq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0xb340
movzbl -0x1(%r14), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
movabsq $0x100000000, %r9       # imm = 0x100000000
ja 0x1981a
leaq 0x21265(%rip), %rdx     # 0x3a938
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %eax, %eax
cmpq %r12, %rax
jae 0x196f1
movq %r14, %rdi
movq %r12, %rsi
callq 0x185b5
movq %rax, %r14
movslq %ebp, %rdi
addq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xb340
movzbl -0x1(%r14), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
movabsq $0x100000000, %r9       # imm = 0x100000000
leaq 0x211b6(%rip), %r13     # 0x3a8e0
ja 0x1981a
leaq 0x21239(%rip), %rdx     # 0x3a970
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leal (,%r12,8), %ecx
addb %al, %cl
andb $-0x8, %cl
movb %cl, -0x1(%r14)
jmp 0x1981a
addq %r12, -0x11(%r14)
jmp 0x1981a
addw %r12w, -0x5(%r14)
jmp 0x1981a
addl %r12d, -0x9(%r14)
jmp 0x1981a
addb %r12b, -0x3(%r14)
jmp 0x1981a
xorl %eax, %eax
sarq $0x20, %r13
cmpq %r13, %rax
jae 0x19794
movq %r14, %rdi
movq %r13, %rsi
callq 0x185b5
movq %rax, %r14
movslq %ebp, %rdi
addq %r14, %rdi
leaq 0x20(%rsp), %rsi
movq %r13, %rdx
callq 0xb340
movzbl -0x1(%r14), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
movabsq $0x100000000, %r9       # imm = 0x100000000
ja 0x1980c
leaq 0x21143(%rip), %rdx     # 0x3a914
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
addb %r15b, %al
andb $-0x8, %al
movb %al, -0x1(%r14)
jmp 0x1980c
addq %r13, -0x11(%r14)
jmp 0x1980c
movzwl -0x5(%r14), %eax
addl %r12d, %eax
movw %ax, -0x5(%r14)
jmp 0x1980c
addl %r12d, -0x9(%r14)
jmp 0x1980c
movzbl -0x3(%r14), %eax
addl %r12d, %eax
movb %al, -0x3(%r14)
leaq 0x210dd(%rip), %r15     # 0x3a8f0
leaq 0x210c6(%rip), %r13     # 0x3a8e0
addl %r12d, %ebp
cmpb $0x0, 0x1(%rbx)
leaq 0x1(%rbx), %rbx
jne 0x1927d
jmp 0x1985b
movq -0x11(%r13), %r12
jmp 0x19459
movzwl -0x5(%r13), %r12d
jmp 0x19459
movl -0x9(%r13), %r12d
jmp 0x19459
movzbl -0x3(%r13), %r12d
jmp 0x19459
xorl %r12d, %r12d
jmp 0x19459
movslq %ebp, %rax
movb $0x0, (%r14,%rax)
movq %r14, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq