// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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
leaq 0x40(%rsp), %r15
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x198a1
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)
callq 0x18f08
movq %rax, %r13
movq %r15, 0x10(%rsp)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
pushq $0x1
popq %r15
movb (%rbx), %bpl
movslq %r13d, %r13
testb %bpl, %bpl
je 0x19b09
movq %r14, %rdi
callq 0x190d7
testq %rax, %rax
jne 0x198fa
movq %r14, %rdi
movq %r15, %rsi
callq 0x18fbb
movq %rax, %r14
movb (%rbx), %bpl
cmpb $0x25, %bpl
jne 0x19951
movzbl 0x1(%rbx), %eax
incq %rbx
cmpl $0x49, %eax
je 0x19a4b
cmpl $0x53, %eax
je 0x19931
cmpl $0x55, %eax
je 0x1996c
cmpl $0x69, %eax
je 0x199ac
cmpl $0x75, %eax
je 0x1998c
cmpl $0x73, %eax
jne 0x199cc
movl (%rsp), %edx
cmpq $0x28, %rdx
ja 0x199e7
movq %rdx, %rcx
addq 0x10(%rsp), %rcx
addl $0x8, %edx
movl %edx, (%rsp)
jmp 0x199f5
leal 0x1(%r13), %r12d
movb %bpl, (%r14,%r13)
movq %r14, %rdi
movq %r15, %rsi
callq 0x19b23
movl %r12d, %r13d
jmp 0x19b01
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x19a64
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x19a72
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x19a77
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x19a85
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x19a93
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x19aa1
leal 0x1(%r13), %ebp
movb %al, (%r14,%r13)
movq %r14, %rdi
movq %r15, %rsi
callq 0x19b23
movl %ebp, %r13d
jmp 0x19b01
movq 0x8(%rsp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq (%rcx), %rbp
movq %rbp, %rdi
cmpb $0x73, %al
jne 0x19a06
callq 0x101c0
jmp 0x19a0b
callq 0x18f08
movq %rax, %r12
movq %r14, %rdi
callq 0x190d7
cmpq %r12, %rax
jae 0x19a29
movq %r14, %rdi
movq %r12, %rsi
callq 0x18fbb
movq %rax, %r14
leaq (%r14,%r13), %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x10400
movq %r14, %rdi
movq %r12, %rsi
callq 0x19b23
addl %r12d, %r13d
jmp 0x19b01
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x19aa6
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x19ab4
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rsi
jmp 0x19a87
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl (%rax), %esi
leaq 0x20(%rsp), %rdi
callq 0x19662
jmp 0x19ac1
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movslq (%rax), %rsi
jmp 0x19ab7
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rsi
leaq 0x20(%rsp), %rdi
callq 0x19605
movslq %eax, %r12
movq %r14, %rdi
callq 0x190d7
cmpq %r12, %rax
jae 0x19adf
movq %r14, %rdi
movq %r12, %rsi
callq 0x18fbb
movq %rax, %r14
leaq (%r14,%r13), %rdi
leaq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x10400
movq %r14, %rdi
movq %r12, %rsi
callq 0x19b23
addl %r13d, %r12d
movl %r12d, %r13d
incq %rbx
jmp 0x198cd
movb $0x0, (%r14,%r13)
movq %r14, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq