// File: /workspace/github_c_makefile_star2_O1/kieselsteini[P]PiXL-old/lua53.c
// Function: luaL_tolstring
LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
  if (luaL_callmeta(L, idx, "__tostring")) {  /* metafield? */
    if (!lua_isstring(L, -1))
      luaL_error(L, "'__tostring' must return a string");
  }
  else {
    switch (lua_type(L, idx)) {
      case LUA_TNUMBER: {
        if (lua_isinteger(L, idx))
          lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx));
        else
          lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx));
        break;
      }
      case LUA_TSTRING:
        lua_pushvalue(L, idx);
        break;
      case LUA_TBOOLEAN:
        lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false"));
        break;
      case LUA_TNIL:
        lua_pushliteral(L, "nil");
        break;
      default: {
        int tt = luaL_getmetafield(L, idx, "__name");  /* try name */
        const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) :
                                                 luaL_typename(L, idx);
        lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx));
        if (tt != LUA_TNIL)
          lua_remove(L, -2);  /* remove '__name' */
        break;
      }
    }
  }
  return lua_tolstring(L, -1, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x22ea3(%rip), %rdx     # 0x2fed2
callq 0xcf2c
testl %eax, %eax
je 0xd066
movq 0x10(%rbx), %rax
movl -0x8(%rax), %eax
andl $0xf, %eax
addl $-0x5, %eax
cmpl $-0x3, %eax
jbe 0xd202
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r14, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x8296
movq %rbx, %rdi
movl %ebp, %esi
callq 0x736a
leaq 0x228e9(%rip), %r12     # 0x2f960
cmpq %r12, %rax
je 0xd084
movl 0x8(%rax), %ecx
andl $0xf, %ecx
jmp 0xd089
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x4, %ecx
ja 0xd12c
movl %ecx, %ecx
leaq 0x220cd(%rip), %rdx     # 0x2f168
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x233db(%rip), %rsi     # 0x30486
jmp 0xd1a2
cmpl $0x13, 0x8(%rax)
jne 0xd159
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x8126
leaq 0x22e32(%rip), %rsi     # 0x2feff
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x8dcc
jmp 0xd04e
movl 0x8(%rax), %ecx
testl %ecx, %ecx
je 0xd192
cmpl $0x1, %ecx
jne 0xd19b
cmpl $0x0, (%rax)
leaq 0x22e0a(%rip), %rax     # 0x2ff07
leaq 0x22dfe(%rip), %rsi     # 0x2ff02
cmoveq %rax, %rsi
jmp 0xd1a2
movq 0x10(%rbx), %r15
movq %rbx, %rdi
movl %ebp, %esi
callq 0x736a
movups (%rax), %xmm0
movups %xmm0, (%r15)
addq $0x10, 0x10(%rbx)
jmp 0xd04e
leaq 0x22d16(%rip), %rdx     # 0x2fe49
movq %rbx, %rdi
movl %ebp, %esi
callq 0xceba
movl %eax, %r15d
movq %rbx, %rdi
cmpl $0x4, %eax
jne 0xd17b
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x8296
movq %rax, %r12
jmp 0xd1bc
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x80d5
leaq 0x22e40(%rip), %rsi     # 0x2ffac
movq %rbx, %rdi
movb $0x1, %al
callq 0x8dcc
jmp 0xd04e
movl %ebp, %esi
callq 0x736a
cmpq %r12, %rax
je 0xd1af
movl 0x8(%rax), %eax
andl $0xf, %eax
incq %rax
jmp 0xd1b1
leaq 0x22d6e(%rip), %rsi     # 0x2ff07
jmp 0xd1a2
leaq 0x22d60(%rip), %rsi     # 0x2ff02
movq %rbx, %rdi
callq 0x8927
jmp 0xd04e
xorl %eax, %eax
leaq 0x30bb8(%rip), %rcx     # 0x3dd70
movq (%rcx,%rax,8), %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8701
leaq 0x22d40(%rip), %rsi     # 0x2ff0d
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x8dcc
testl %r15d, %r15d
je 0xd04e
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x72c6
addq $-0x10, 0x10(%rbx)
jmp 0xd04e
leaq 0x22cd4(%rip), %rsi     # 0x2fedd
movq %rbx, %rdi
xorl %eax, %eax
callq 0xbda0