// File: /workspace/github_c_makefile_star2_O1/redis-force[P]rpm/module/rpm_redis.c
// Function: redis_format_command
chained_buffer *redis_format_command(allocator *allocator, uint32_t argc, const char **argv, const size_t *argvlen) {
  uint32_t wr, total, idx, len;
  char *realbuffer;
  chained_buffer *buffer;

  total = 1 + redis_integer_digits(argc) + 2;
  for (idx = 0; idx < argc; idx++) {
    total += redis_bulk_length(argvlen[idx]);
  }

  if ((buffer = chained_buffer_create(allocator, total + 1)) == NULL) {
    return NULL;
  }
  realbuffer = (char *) buffer->buffer;

  wr = sprintf(realbuffer, "*%d\r\n", argc);
  for (idx = 0; idx < argc; idx++) {
    len = argvlen[idx];
    wr += sprintf(realbuffer + wr, "$%u\r\n", len);
    memcpy(realbuffer + wr, argv[idx], len);
    wr += len;
    realbuffer[wr++] = '\r';
    realbuffer[wr++] = '\n';
  }
  realbuffer[wr] = '\0';
  buffer->size = wr;

  return buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %r13d
movl $0x1, %esi
movl %r13d, %r15d
movabsq $0x346dc5d63886594b, %r8 # imm = 0x346DC5D63886594B
cmpl $0xa, %r13d
jb 0x8674
movl $0x4, %esi
movq %r15, %rcx
cmpq $0x63, %rcx
jbe 0x866d
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x8672
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x8674
movq %rcx, %rax
mulq %r8
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x8637
addl $-0x3, %esi
jmp 0x8674
addl $-0x2, %esi
jmp 0x8674
decl %esi
addl $0x3, %esi
testl %r13d, %r13d
je 0x86ea
xorl %r9d, %r9d
movq (%r14,%r9,8), %r10
movl $0x1, %r11d
cmpl $0xa, %r10d
jb 0x86d9
movl %r10d, %ecx
movl $0x4, %r11d
cmpq $0x63, %rcx
jbe 0x86d0
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x86d6
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x86d9
movq %rcx, %rax
mulq %r8
shrq $0xb, %rdx
addl $0x4, %r11d
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x8698
addl $-0x3, %r11d
jmp 0x86d9
addl $-0x2, %r11d
jmp 0x86d9
decl %r11d
addl %r10d, %esi
addl %r11d, %esi
addl $0x5, %esi
incq %r9
cmpq %r15, %r9
jne 0x867f
incl %esi
callq 0x5370
testq %rax, %rax
je 0x87ad
movq %rax, 0x8(%rsp)
movq %rax, %r12
addq $0x20, %r12
leaq 0x2be7(%rip), %rsi      # 0xb2f4
movq %r12, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x5380
movl %eax, %ebp
testl %r13d, %r13d
je 0x8799
movq %rbx, 0x10(%rsp)
xorl %ebx, %ebx
movq %r14, 0x20(%rsp)
movq %r15, 0x18(%rsp)
movq (%r14,%rbx,8), %r15
movl %r15d, %r14d
movl %ebp, %edi
addq %r12, %rdi
leaq 0x2bb5(%rip), %rsi      # 0xb2fa
movl %r15d, %edx
xorl %eax, %eax
callq 0x5380
movl %eax, %r13d
addl %ebp, %r13d
leaq (%r12,%r13), %rdi
movq 0x10(%rsp), %rax
movq (%rax,%rbx,8), %rsi
movq %r14, %rdx
movq 0x20(%rsp), %r14
callq 0x5210
movl %r13d, %eax
addl %r15d, %eax
leal (%r15,%r13), %ecx
incl %ecx
movb $0xd, (%r12,%rax)
leal (%r15,%r13), %ebp
addl $0x2, %ebp
movq 0x18(%rsp), %r15
movb $0xa, (%r12,%rcx)
incq %rbx
cmpq %rbx, %r15
jne 0x8732
movl %ebp, %eax
movq 0x8(%rsp), %rcx
movb $0x0, 0x20(%rcx,%rax)
movq %rcx, %rax
movl %ebp, 0xc(%rcx)
jmp 0x87af
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq