// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x45841(%rip), %rdx     # 0x55852
callq 0xff00
cmpl $0x0, %eax
je 0x10045
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x7660
cmpl $0x0, %eax
jne 0x10040
movq -0x8(%rbp), %rdi
leaq 0x45824(%rip), %rsi     # 0x5585d
movb $0x0, %al
callq 0xe880
jmp 0x10201
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x7400
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x4, %eax
ja 0x10142
movq -0x30(%rbp), %rax
leaq 0x4428d(%rip), %rcx     # 0x542f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x74d0
cmpl $0x0, %eax
je 0x100b4
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x8490
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0x457d4(%rip), %rsi     # 0x5587f
movb $0x0, %al
callq 0x9840
jmp 0x100de
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x8400
movq -0x40(%rbp), %rdi
leaq 0x45855(%rip), %rsi     # 0x5592c
movb $0x1, %al
callq 0x9840
jmp 0x101ff
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x7340
jmp 0x101ff
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x86a0
movq -0x48(%rbp), %rdi
movl %eax, %ecx
leaq 0x45772(%rip), %rsi     # 0x55887
leaq 0x45766(%rip), %rax     # 0x55882
cmpl $0x0, %ecx
cmovneq %rax, %rsi
callq 0x9100
jmp 0x101ff
movq -0x8(%rbp), %rdi
leaq 0x45ce3(%rip), %rsi     # 0x55e1b
callq 0x9100
jmp 0x101ff
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x45679(%rip), %rdx     # 0x557c9
callq 0xfe60
movl %eax, -0x1c(%rbp)
cmpl $0x4, -0x1c(%rbp)
jne 0x10176
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x8700
movq %rax, -0x50(%rbp)
jmp 0x10199
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x7400
movq -0x58(%rbp), %rdi
movl %eax, %esi
callq 0x7450
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x8cc0
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq %rax, %rcx
leaq 0x456be(%rip), %rsi     # 0x5588d
movb $0x0, %al
callq 0x9840
cmpl $0x0, -0x1c(%rbp)
je 0x101fd
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6e30
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6d90
jmp 0x101ff
jmp 0x10201
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x8700
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)