// File: /workspace/github_c_makefile_star2_O0/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lvm.c
// Function: luaV_concat
void luaV_concat (lua_State *L, int total) {
  lua_assert(total >= 2);
  do {
    StkId top = L->top;
    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 operand is empty? */
      (void)tostring(L, top - 2);  /* result is first operand */
    else if (ttisstring(top-2) && tsvalue(top-2)->len == 0) {
      setobjs2s(L, top - 2, top - 1);  /* result is second op. */
    }
    else {
      /* at least two non-empty string values; get as many as possible */
      size_t tl = tsvalue(top-1)->len;
      char *buffer;
      int i;
      /* collect total length */
      for (i = 1; i < total && tostring(L, top-i-1); i++) {
        size_t l = tsvalue(top-i-1)->len;
        if (l >= (MAX_SIZET/sizeof(char)) - tl)
          luaG_runerror(L, "string length overflow");
        tl += l;
      }
      buffer = luaZ_openspace(L, &G(L)->buff, tl);
      tl = 0;
      n = i;
      do {  /* concat all strings */
        size_t l = tsvalue(top-i)->len;
        memcpy(buffer+tl, svalue(top-i), l * sizeof(char));
        tl += l;
      } while (--i > 0);
      setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
    }
    total -= n-1;  /* got 'n' strings to create 1 new */
    L->top -= n-1;  /* popped 'n' strings and pushed one */
  } while (total > 1);  /* repeat until only 1 result left */
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movl %esi, 0x6c(%rsp)
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x60(%rsp)
movl $0x2, 0x5c(%rsp)
movq 0x60(%rsp), %rax
movl -0x18(%rax), %eax
andl $0xf, %eax
cmpl $0x4, %eax
je 0x282be
movq 0x60(%rsp), %rax
cmpl $0x3, -0x18(%rax)
jne 0x282e6
movq 0x60(%rsp), %rax
movl -0x8(%rax), %eax
andl $0xf, %eax
cmpl $0x4, %eax
je 0x28337
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $-0x10, %rsi
callq 0x273c0
cmpl $0x0, %eax
jne 0x28337
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $-0x20, %rsi
movq 0x60(%rsp), %rdx
addq $-0x10, %rdx
movq 0x60(%rsp), %rcx
addq $-0x20, %rcx
movl $0xf, %r8d
callq 0x28630
cmpl $0x0, %eax
jne 0x28332
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $-0x20, %rsi
movq 0x60(%rsp), %rdx
addq $-0x10, %rdx
callq 0xf440
jmp 0x285e4
movq 0x60(%rsp), %rax
movq -0x10(%rax), %rax
cmpq $0x0, 0x10(%rax)
jne 0x28383
movq 0x60(%rsp), %rax
movl -0x18(%rax), %ecx
andl $0xf, %ecx
movb $0x1, %al
cmpl $0x4, %ecx
movb %al, 0xf(%rsp)
je 0x2837a
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $-0x20, %rsi
callq 0x273c0
cmpl $0x0, %eax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
jmp 0x285e2
movq 0x60(%rsp), %rax
movl -0x18(%rax), %eax
andl $0xf, %eax
cmpl $0x4, %eax
jne 0x283e4
movq 0x60(%rsp), %rax
movq -0x20(%rax), %rax
cmpq $0x0, 0x10(%rax)
jne 0x283e4
movq 0x60(%rsp), %rax
addq $-0x10, %rax
movq %rax, 0x50(%rsp)
movq 0x60(%rsp), %rax
addq $-0x20, %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq 0x50(%rsp), %rax
movl 0x8(%rax), %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x8(%rax)
jmp 0x285e0
movq 0x60(%rsp), %rax
movq -0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x40(%rsp)
movl $0x1, 0x34(%rsp)
movl 0x34(%rsp), %ecx
xorl %eax, %eax
cmpl 0x6c(%rsp), %ecx
movb %al, 0xe(%rsp)
jge 0x2846b
movq 0x60(%rsp), %rax
movslq 0x34(%rsp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl -0x8(%rax), %ecx
andl $0xf, %ecx
movb $0x1, %al
cmpl $0x4, %ecx
movb %al, 0xd(%rsp)
je 0x28463
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
movslq 0x34(%rsp), %rcx
xorl %eax, %eax
subq %rcx, %rax
shlq $0x4, %rax
addq %rax, %rsi
addq $-0x10, %rsi
callq 0x273c0
cmpl $0x0, %eax
setne %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x28475
jmp 0x284e0
movq 0x60(%rsp), %rax
movslq 0x34(%rsp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq $-0x3, %rcx
subq 0x40(%rsp), %rcx
cmpq %rcx, %rax
jb 0x284c1
movq 0x70(%rsp), %rdi
leaq 0xed14(%rip), %rsi      # 0x371ce
movb $0x0, %al
callq 0xf360
movq 0x28(%rsp), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x283fe
movq 0x70(%rsp), %rdi
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rsi
addq $0xd8, %rsi
movq 0x40(%rsp), %rdx
callq 0x2c5c0
movq %rax, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x5c(%rsp)
movq 0x60(%rsp), %rax
movslq 0x34(%rsp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x38(%rsp), %rdi
addq 0x40(%rsp), %rdi
movq 0x60(%rsp), %rax
movslq 0x34(%rsp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
addq $0x18, %rsi
movq 0x20(%rsp), %rdx
shlq $0x0, %rdx
callq 0x7350
movq 0x20(%rsp), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x34(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x34(%rsp)
cmpl $0x0, %eax
jg 0x28515
movq 0x60(%rsp), %rax
movslq 0x5c(%rsp), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
callq 0x20780
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rax
movzbl 0x8(%rax), %ecx
orl $0x40, %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x8(%rax)
jmp 0x285e2
jmp 0x285e4
movl 0x5c(%rsp), %ecx
subl $0x1, %ecx
movl 0x6c(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x6c(%rsp)
movl 0x5c(%rsp), %edx
subl $0x1, %edx
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rcx
movslq %edx, %rsi
xorl %edx, %edx
subq %rsi, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
cmpl $0x1, 0x6c(%rsp)
jg 0x2828d
addq $0x78, %rsp
retq
nopl (%rax,%rax)