// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/luaserialize.c
// Function: format_scalar
static int format_scalar(lua_State *L, GtStr *out, int index, bool table_key,
                         GtError *err)
{
  int had_err = 0;
  gt_error_check(err);
  gt_assert(!lua_istable(L, index));
  if (lua_isboolean(L, index))
  {
    int val;
    val = lua_toboolean(L, index);
    if (val)
      gt_str_append_cstr(out, "true");
    else
      gt_str_append_cstr(out, "false");
  }
  else if (lua_isnumber(L, index))
  {
    double val;
    val = lua_tonumber(L, index);
    gt_str_append_double(out, val, 10);
  }
  else if (lua_isstring(L, index))
  {
    const char *str;
    str = lua_tostring(L, index);
    /* use Lua's own "string.format() function to escape string */
    lua_getglobal(L, "string");
    lua_pushliteral(L, "format");
    lua_gettable(L, -2);
    lua_pushstring(L, "%q");
    lua_pushstring(L, str);
    lua_call(L, 2 ,1);
    str = lua_tostring(L, -1);
    lua_pop(L,2);
    /* table keys must be enclosed in square brackets */
    if (table_key)
      gt_str_append_cstr(out, "[");
    gt_str_append_cstr(out, str);
    if (table_key)
      gt_str_append_cstr(out, "]");
  }
  else {
    lua_pop(L, 2);
    gt_error_set(err, "expected boolean, number, or string");
    had_err = -1;
  }
  return had_err;
}

// Assembly:
subq $0x38, %rsp
movb %cl, %al
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
andb $0x1, %al
movb %al, 0x23(%rsp)
movq %r8, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0xa8cc7
movq 0x18(%rsp), %rdi
callq 0xc270
testb $0x1, %al
jne 0xa8c8f
jmp 0xa8cc7
movq 0x10b342(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xb53c6(%rip), %rsi     # 0x15e066
leaq 0xb59a1(%rip), %rdx     # 0x15e648
leaq 0xca0e3(%rip), %rcx     # 0x172d91
leaq 0xc9f3f(%rip), %r8      # 0x172bf4
movl $0x1f, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0xa8cc9
jmp 0xa8ccb
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x4f800
cmpl $0x5, %eax
jne 0xa8d16
movq 0x10b2f3(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xb5377(%rip), %rsi     # 0x15e066
leaq 0xca0a9(%rip), %rdx     # 0x172d9f
leaq 0xca094(%rip), %rcx     # 0x172d91
leaq 0xc9ef0(%rip), %r8      # 0x172bf4
movl $0x20, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0xa8d18
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x4f800
cmpl $0x1, %eax
jne 0xa8d6d
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x50110
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x10(%rsp)
je 0xa8d57
movq 0x28(%rsp), %rdi
leaq 0xe58fa(%rip), %rsi     # 0x18e64a
callq 0x18fb0
jmp 0xa8d68
movq 0x28(%rsp), %rdi
leaq 0xca003(%rip), %rsi     # 0x172d66
callq 0x18fb0
jmp 0xa8edd
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x4f8f0
cmpl $0x0, %eax
je 0xa8dae
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x50020
movsd %xmm0, 0x8(%rsp)
movq 0x28(%rsp), %rdi
movsd 0x8(%rsp), %xmm0
movl $0xa, %esi
callq 0x19690
jmp 0xa8edb
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x4f9e0
cmpl $0x0, %eax
je 0xa8eaf
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x50180
movq %rax, (%rsp)
movq 0x30(%rsp), %rdi
movl $0xffffd8ee, %esi       # imm = 0xFFFFD8EE
leaq 0xb72c1(%rip), %rdx     # 0x1600ad
callq 0x51640
movq 0x30(%rsp), %rdi
leaq 0xb5399(%rip), %rsi     # 0x15e196
movl $0x6, %edx
callq 0x50770
movq 0x30(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x51440
movq 0x30(%rsp), %rdi
leaq 0xc9f94(%rip), %rsi     # 0x172db6
callq 0x50970
movq 0x30(%rsp), %rdi
movq (%rsp), %rsi
callq 0x50970
movq 0x30(%rsp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x52690
movq 0x30(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x50180
movq %rax, (%rsp)
movq 0x30(%rsp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x4f100
testb $0x1, 0x23(%rsp)
je 0xa8e87
movq 0x28(%rsp), %rdi
leaq 0xc9f37(%rip), %rsi     # 0x172db9
callq 0x18fb0
movq 0x28(%rsp), %rdi
movq (%rsp), %rsi
callq 0x18fb0
testb $0x1, 0x23(%rsp)
je 0xa8ead
movq 0x28(%rsp), %rdi
leaq 0xc2281(%rip), %rsi     # 0x16b129
callq 0x18fb0
jmp 0xa8ed9
movq 0x30(%rsp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x4f100
movq 0x18(%rsp), %rdi
leaq 0xc9ef1(%rip), %rsi     # 0x172dbb
movb $0x0, %al
callq 0xc0d0
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0xa8edb
jmp 0xa8edd
movl 0x14(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)