// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/deps/lua/src/lvm.c
// Function: luaV_concat
void luaV_concat (lua_State *L, int total, int last) {
  do {
    StkId top = L->base + last + 1;
    int n = 2;  /* number of elements handled in this pass (at least 2) */
    if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {
      if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))
        luaG_concaterror(L, top-2, top-1);
    } else if (tsvalue(top-1)->len == 0)  /* second op is empty? */
      (void)tostring(L, top - 2);  /* result is first op (as string) */
    else {
      /* at least two string values; get as many as possible */
      size_t tl = tsvalue(top-1)->len;
      char *buffer;
      int i;
      /* collect total length */
      for (n = 1; n < total && tostring(L, top-n-1); n++) {
        size_t l = tsvalue(top-n-1)->len;
        if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow");
        tl += l;
      }
      buffer = luaZ_openspace(L, &G(L)->buff, tl);
      tl = 0;
      for (i=n; i>0; i--) {  /* concat all strings */
        size_t l = tsvalue(top-i)->len;
        memcpy(buffer+tl, svalue(top-i), l);
        tl += l;
      }
      setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
    }
    total -= n-1;  /* got `n' strings to create 1 new */
    last -= n-1;
  } while (total > 1);  /* repeat until only 1 result left */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rcx
movslq %ebp, %rbx
shlq $0x4, %rbx
leaq (%rcx,%rbx), %r15
leaq (%rcx,%rbx), %r13
addq $-0x10, %r13
movl 0x8(%r13), %eax
addl $-0x3, %eax
cmpl $0x1, %eax
ja 0xdfa8
cmpl $0x4, 0x8(%r15)
je 0xdf0e
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %rcx, %r14
callq 0xd84d
movq %r14, %rcx
testl %eax, %eax
je 0xdfa8
movl %r12d, 0x14(%rsp)
movq (%r15), %rax
movq 0x10(%rax), %r12
testq %r12, %r12
je 0xdfe5
movl %ebp, 0x24(%rsp)
movq %rcx, 0x28(%rsp)
leaq (%rcx,%rbx), %rax
addq $0x10, %rax
movq %rax, 0x30(%rsp)
movl 0x14(%rsp), %eax
movslq %eax, %r15
cmpl $0x2, %r15d
pushq $0x1
popq %rcx
cmovgel %eax, %ecx
movl %ecx, 0x18(%rsp)
pushq $0x1
popq %rbp
cmpq %r15, %rbp
jge 0xdfdf
cmpl $0x4, 0x8(%r13)
je 0xdf76
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0xd84d
testl %eax, %eax
je 0xe013
movq (%r13), %rax
movq 0x10(%rax), %r14
pushq $-0x3
popq %rax
subq %r12, %rax
cmpq %rax, %r14
jb 0xdf9c
movq 0x8(%rsp), %rdi
leaq 0xbed3(%rip), %rsi      # 0x19e68
xorl %eax, %eax
callq 0x7165
addq %r14, %r12
incq %rbp
addq $-0x10, %r13
jmp 0xdf51
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r13, %rcx
pushq $0xf
popq %r8
callq 0xe0c6
pushq $0x1
popq %rcx
movl %ecx, %r14d
testl %eax, %eax
jne 0xe0a7
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x726c
jmp 0xe008
movl 0x18(%rsp), %ebp
jmp 0xe013
cmpl $0x4, -0x8(%r15)
pushq $0x1
popq %rax
movl %eax, %r14d
movl 0x14(%rsp), %r12d
je 0xe0a7
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0xd84d
pushq $0x1
popq %rax
movl %eax, %r14d
jmp 0xe0a7
movq 0x8(%rsp), %rdi
movq 0x20(%rdi), %rsi
addq $0x58, %rsi
movq %r12, %rdx
callq 0xf383
movq %rax, %r15
movl %ebp, %r14d
movq %r14, %rax
shlq $0x4, %rax
movq %rax, 0x18(%rsp)
subq %rax, %rbx
movq 0x28(%rsp), %rax
addq %rax, %rbx
addq $0x10, %rbx
movq %r14, %rbp
xorl %r12d, %r12d
testq %rbp, %rbp
jle 0xe077
movq (%rbx), %rsi
movq 0x10(%rsi), %r13
leaq (%r15,%r12), %rdi
addq $0x18, %rsi
movq %r13, %rdx
callq 0x42f0
addq %r13, %r12
decq %rbp
addq $0x10, %rbx
jmp 0xe04f
movq 0x30(%rsp), %rbx
subq 0x18(%rsp), %rbx
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xc466
movq %rax, (%rbx)
movl $0x4, 0x8(%rbx)
decl %r14d
movl 0x24(%rsp), %ebp
movl 0x14(%rsp), %r12d
subl %r14d, %r12d
subl %r14d, %ebp
cmpl $0x1, %r12d
jg 0xdec0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq