// File: /workspace/github_c_makefile_star2_O2/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 0x1e63e(%rip), %rdx     # 0x29fa2
callq 0xb8be
testl %eax, %eax
je 0xb996
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x6e3b
testl %eax, %eax
je 0xbad1
pushq $-0x1
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x7901
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6d43
cmpl $0x4, %eax
ja 0xba32
movl %eax, %eax
leaq 0x1d7b6(%rip), %rcx     # 0x29168
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1eb94(%rip), %rsi     # 0x2a556
jmp 0xba16
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6d8e
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
testl %eax, %eax
je 0xbab6
callq 0x779c
leaq 0x1e5e6(%rip), %rsi     # 0x29fcf
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x822d
jmp 0xb980
movq %rbx, %rdi
movl %ebp, %esi
callq 0x78dd
testl %eax, %eax
leaq 0x1e5cc(%rip), %rax     # 0x29fd7
leaq 0x1e5c0(%rip), %rsi     # 0x29fd2
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x7e73
jmp 0xb980
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6d1f
jmp 0xb980
leaq 0x1e4e0(%rip), %rdx     # 0x29f19
movq %rbx, %rdi
movl %ebp, %esi
callq 0xb869
movl %eax, %r15d
cmpl $0x4, %eax
jne 0xba5d
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7901
movq %rax, %r12
jmp 0xba74
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6d43
incl %eax
leaq 0x2e300(%rip), %rcx     # 0x39d70
movq (%rcx,%rax,8), %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7cbe
leaq 0x1e558(%rip), %rsi     # 0x29fdd
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x822d
testl %r15d, %r15d
je 0xb980
pushq $-0x2
popq %rsi
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x6b97
addq $-0x10, 0x10(%rbx)
jmp 0xb980
callq 0x774c
leaq 0x1e5ba(%rip), %rsi     # 0x2a07c
movq %rbx, %rdi
movb $0x1, %al
callq 0x822d
jmp 0xb980
leaq 0x1e4d5(%rip), %rsi     # 0x29fad
movq %rbx, %rdi
xorl %eax, %eax
callq 0xaa53