// File: /workspace/github_c_makefile_star2_O1/andyfighting[P]hiredis_timer_cmpt/hiredis.c
// Function: redisFormatSdsCommandArgv
int redisFormatSdsCommandArgv(sds *target, int argc, const char **argv,
                              const size_t *argvlen)
{
    sds cmd;
    unsigned long long totlen;
    int j;
    size_t len;

    /* Abort on a NULL target */
    if (target == NULL)
        return -1;

    /* Calculate our total size */
    totlen = 1+countDigits(argc)+2;
    for (j = 0; j < argc; j++) {
        len = argvlen ? argvlen[j] : strlen(argv[j]);
        totlen += bulklen(len);
    }

    /* Use an SDS string for command construction */
    cmd = sdsempty();
    if (cmd == NULL)
        return -1;

    /* We already know how much storage we need */
    cmd = sdsMakeRoomFor(cmd, totlen);
    if (cmd == NULL)
        return -1;

    /* Construct command */
    cmd = sdscatfmt(cmd, "*%i\r\n", argc);
    for (j=0; j < argc; j++) {
        len = argvlen ? argvlen[j] : strlen(argv[j]);
        cmd = sdscatfmt(cmd, "$%T\r\n", len);
        cmd = sdscatlen(cmd, argv[j], len);
        cmd = sdscatlen(cmd, "\r\n", sizeof("\r\n")-1);
    }

    assert(sdslen(cmd)==totlen);

    *target = cmd;
    return totlen;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x4a21
movq %rcx, %r15
movq %rdx, %r8
movl %esi, %r13d
movl $0x1, %r14d
cmpl $0xa, %esi
jb 0x491c
movslq %r13d, %rcx
movl $0x4, %r14d
movabsq $0x346dc5d63886594b, %rsi # imm = 0x346DC5D63886594B
cmpq $0x63, %rcx
jbe 0x4913
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x4919
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x491c
movq %rcx, %rax
mulq %rsi
shrq $0xb, %rdx
addl $0x4, %r14d
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x48db
addl $-0x3, %r14d
jmp 0x491c
addl $-0x2, %r14d
jmp 0x491c
decl %r14d
movq %r8, (%rsp)
addl $0x3, %r14d
testl %r13d, %r13d
movq %rdi, 0x8(%rsp)
jle 0x495f
movl %r13d, %ebx
xorl %r12d, %r12d
testq %r15, %r15
je 0x493f
movq (%r15,%r12,8), %rdi
jmp 0x494f
movq (%rsp), %rax
movq (%rax,%r12,8), %rdi
callq 0x3130
movq %rax, %rdi
callq 0x47a4
addq %rax, %r14
incq %r12
cmpq %r12, %rbx
jne 0x4934
callq 0x3490
testq %rax, %rax
je 0x4a21
movq %rax, %rdi
movq %r14, %rsi
callq 0x31c0
testq %rax, %rax
je 0x4a21
leaq 0x47bb(%rip), %rsi      # 0x9143
movq %rax, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x3500
movq %rax, %rbx
testl %r13d, %r13d
jle 0x4a0d
movl %r13d, %eax
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
testq %r15, %r15
je 0x49b7
movq (%r15,%r12,8), %r13
movq (%rsp), %rbp
jmp 0x49c8
movq (%rsp), %rbp
movq (%rbp,%r12,8), %rdi
callq 0x3130
movq %rax, %r13
movq %rbx, %rdi
leaq 0x4777(%rip), %rsi      # 0x9149
movq %r13, %rdx
xorl %eax, %eax
callq 0x3500
movq (%rbp,%r12,8), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x3420
movl $0x2, %edx
movq %rax, %rdi
leaq 0x4751(%rip), %rsi      # 0x914c
callq 0x3420
movq %rax, %rbx
incq %r12
cmpq %r12, 0x10(%rsp)
jne 0x49a8
movslq -0x8(%rbx), %rax
cmpq %rax, %r14
jne 0x4a32
movq 0x8(%rsp), %rax
movq %rbx, (%rax)
movl %r14d, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4716(%rip), %rdi      # 0x914f
leaq 0x46b2(%rip), %rsi      # 0x90f2
leaq 0x471c(%rip), %rcx      # 0x9163
movl $0x203, %edx            # imm = 0x203
callq 0x31b0