// File: /workspace/github_c_makefile_star2_O2/tylerneylon[P]APIsWithLua/lua/ldblib.c
// Function: db_getinfo
static int db_getinfo (lua_State *L) {
  lua_Debug ar;
  int arg;
  lua_State *L1 = getthread(L, &arg);
  const char *options = luaL_optstring(L, arg+2, "flnStu");
  checkstack(L, L1, 3);
  if (lua_isfunction(L, arg + 1)) {  /* info about a function? */
    options = lua_pushfstring(L, ">%s", options);  /* add '>' to 'options' */
    lua_pushvalue(L, arg + 1);  /* move function to 'L1' stack */
    lua_xmove(L, L1, 1);
  }
  else {  /* stack level */
    if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) {
      lua_pushnil(L);  /* level out of range */
      return 1;
    }
  }
  if (!lua_getinfo(L1, options, &ar))
    return luaL_argerror(L, arg+2, "invalid option");
  lua_newtable(L);  /* table to collect results */
  if (strchr(options, 'S')) {
    settabss(L, "source", ar.source);
    settabss(L, "short_src", ar.short_src);
    settabsi(L, "linedefined", ar.linedefined);
    settabsi(L, "lastlinedefined", ar.lastlinedefined);
    settabss(L, "what", ar.what);
  }
  if (strchr(options, 'l'))
    settabsi(L, "currentline", ar.currentline);
  if (strchr(options, 'u')) {
    settabsi(L, "nups", ar.nups);
    settabsi(L, "nparams", ar.nparams);
    settabsb(L, "isvararg", ar.isvararg);
  }
  if (strchr(options, 'n')) {
    settabss(L, "name", ar.name);
    settabss(L, "namewhat", ar.namewhat);
  }
  if (strchr(options, 't'))
    settabsb(L, "istailcall", ar.istailcall);
  if (strchr(options, 'L'))
    treatstackoption(L, L1, "activelines");
  if (strchr(options, 'f'))
    treatstackoption(L, L1, "func");
  return 1;  /* return table */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %r15
movq %r15, %rsi
callq 0x181a6
movq %rax, %r14
movl (%r15), %r12d
leal 0x2(%r12), %ebp
leaq 0x951e(%rip), %rdx      # 0x20e6c
movq %rbx, %rdi
movl %ebp, %esi
xorl %ecx, %ecx
callq 0x130d8
movq %rax, %r15
pushq $0x3
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1826a
incl %r12d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x5d12
cmpl $0x6, %eax
jne 0x179b0
leaq 0x94ee(%rip), %rsi      # 0x20e73
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6261
movq %rax, %r15
movq %rbx, %rdi
movl %r12d, %esi
callq 0x5cee
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5a91
jmp 0x179d2
movq %rbx, %rdi
movl %r12d, %esi
callq 0x13252
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movl %eax, %esi
callq 0x7336
testl %eax, %eax
je 0x17b96
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x7562
testl %eax, %eax
je 0x17b81
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x665a
pushq $0x53
popq %rsi
movq %r15, %rdi
callq 0x5160
testq %rax, %rax
je 0x17a6d
leaq 0x48(%rsp), %r12
movq -0x18(%r12), %rdx
leaq 0x946f(%rip), %rsi      # 0x20e86
movq %rbx, %rdi
callq 0x18295
leaq 0x9467(%rip), %rsi      # 0x20e8d
movq %rbx, %rdi
movq %r12, %rdx
callq 0x18295
movl -0xc(%r12), %edx
leaq 0x945e(%rip), %rsi      # 0x20e9b
movq %rbx, %rdi
callq 0x182bc
movl -0x8(%r12), %edx
leaq 0x9446(%rip), %rsi      # 0x20e97
movq %rbx, %rdi
callq 0x182bc
movq -0x20(%r12), %rdx
leaq 0x9468(%rip), %rsi      # 0x20ecd
movq %rbx, %rdi
callq 0x18295
pushq $0x6c
popq %rsi
movq %r15, %rdi
callq 0x5160
testq %rax, %rax
je 0x17a90
movl 0x38(%rsp), %edx
leaq 0x941f(%rip), %rsi      # 0x20ea7
movq %rbx, %rdi
callq 0x182bc
pushq $0x75
popq %rsi
movq %r15, %rdi
callq 0x5160
testq %rax, %rax
je 0x17adc
movzbl 0x44(%rsp), %edx
leaq 0x9407(%rip), %rsi      # 0x20eb3
movq %rbx, %rdi
callq 0x182bc
movzbl 0x45(%rsp), %edx
leaq 0x93f8(%rip), %rsi      # 0x20eb8
movq %rbx, %rdi
callq 0x182bc
movsbl 0x46(%rsp), %edx
leaq 0x93ec(%rip), %rsi      # 0x20ec0
movq %rbx, %rdi
callq 0x182e3
pushq $0x6e
popq %rsi
movq %r15, %rdi
callq 0x5160
testq %rax, %rax
je 0x17b14
movq 0x18(%rsp), %rdx
leaq 0x830f(%rip), %rsi      # 0x1fe07
movq %rbx, %rdi
callq 0x18295
movq 0x20(%rsp), %rdx
leaq 0x93bd(%rip), %rsi      # 0x20ec9
movq %rbx, %rdi
callq 0x18295
pushq $0x74
popq %rsi
movq %r15, %rdi
callq 0x5160
testq %rax, %rax
je 0x17b38
movsbl 0x47(%rsp), %edx
leaq 0x93a2(%rip), %rsi      # 0x20ed2
movq %rbx, %rdi
callq 0x182e3
pushq $0x4c
popq %rsi
movq %r15, %rdi
callq 0x5160
testq %rax, %rax
je 0x17b5a
leaq 0x938e(%rip), %rdx      # 0x20edd
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18309
pushq $0x66
popq %rsi
movq %r15, %rdi
callq 0x5160
pushq $0x1
popq %rbp
testq %rax, %rax
je 0x17ba1
leaq 0x9375(%rip), %rdx      # 0x20ee9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18309
jmp 0x17ba1
leaq 0x92ef(%rip), %rdx      # 0x20e77
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12af2
movl %eax, %ebp
jmp 0x17ba1
movq %rbx, %rdi
callq 0x6135
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq