// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x55ba
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5772
movslq -0x14(%rbp), %rdi
callq 0x5450
addl $0x1, %eax
addl $0x2, %eax
movl %eax, %eax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x5630
cmpq $0x0, -0x28(%rbp)
je 0x55f7
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
jmp 0x560c
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3140
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5420
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x55d6
callq 0x34a0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x564c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5772
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x31d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x5670
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5772
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq 0x7aea(%rip), %rsi      # 0xd168
movb $0x0, %al
callq 0x3520
movq %rax, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x5730
cmpq $0x0, -0x28(%rbp)
je 0x56b5
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
jmp 0x56ca
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3140
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq 0x7a8d(%rip), %rsi      # 0xd16e
movb $0x0, %al
callq 0x3520
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x48(%rbp), %rdx
callq 0x3420
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x7a5d(%rip), %rsi      # 0xd171
movl $0x2, %edx
callq 0x3420
movq %rax, -0x30(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5690
movq -0x30(%rbp), %rdi
callq 0x46b0
cmpq -0x38(%rbp), %rax
jne 0x5741
jmp 0x5760
leaq 0x7a2c(%rip), %rdi      # 0xd174
leaq 0x79c8(%rip), %rsi      # 0xd117
movl $0x203, %edx            # imm = 0x203
leaq 0x7a2d(%rip), %rcx      # 0xd188
callq 0x31c0
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)