// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/loslib.c
// Function: os_date
static int os_date (lua_State *L) {
  const char *s = luaL_optstring(L, 1, "%c");
  time_t t = luaL_opt(L, l_checktime, 2, time(NULL));
  struct tm tmr, *stm;
  if (*s == '!') {  /* UTC? */
    stm = l_gmtime(&t, &tmr);
    s++;  /* skip '!' */
  }
  else
    stm = l_localtime(&t, &tmr);
  if (stm == NULL)  /* invalid date? */
    luaL_error(L, "time result cannot be represented in this installation");
  if (strcmp(s, "*t") == 0) {
    lua_createtable(L, 0, 9);  /* 9 = number of fields */
    setallfields(L, stm);
  }
  else {
    char cc[4];  /* buffer for individual conversion specifiers */
    luaL_Buffer b;
    cc[0] = '%';
    luaL_buffinit(L, &b);
    while (*s) {
      if (*s != '%')  /* not a conversion specifier? */
        luaL_addchar(&b, *s++);
      else {
        size_t reslen;
        char *buff = luaL_prepbuffsize(&b, SIZETIMEFMT);
        s = checkoption(L, s + 1, cc + 1);  /* copy specifier to 'cc' */
        reslen = strftime(buff, SIZETIMEFMT, cc, stm);
        luaL_addsize(&b, reslen);
      }
    }
    luaL_pushresult(&b);
  }
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20a0, %rsp           # imm = 0x20A0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
leaq 0xb21e(%rip), %rdx      # 0x368fd
xorl %eax, %eax
movl %eax, %ecx
callq 0x20310
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x61f0
cmpl $0x0, %eax
jg 0x2b711
xorl %eax, %eax
movl %eax, %edi
callq 0x5320
movq %rax, -0x2098(%rbp)
jmp 0x2b726
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x2bda0
movq %rax, -0x2098(%rbp)
movq -0x2098(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x21, %eax
jne 0x2b758
leaq -0x18(%rbp), %rdi
callq 0x5420
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x2b765
leaq -0x18(%rbp), %rdi
callq 0x5060
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x2b77e
movq -0x8(%rbp), %rdi
leaq 0xb189(%rip), %rsi      # 0x36900
movb $0x0, %al
callq 0x1fbf0
movq -0x10(%rbp), %rdi
leaq 0xb1ae(%rip), %rsi      # 0x36937
callq 0x5270
cmpl $0x0, %eax
jne 0x2b7b5
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x75e0
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x2be00
jmp 0x2b8cb
movb $0x25, -0x5c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x2080(%rbp), %rsi
callq 0x20aa0
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2b8bf
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
je 0x2b850
movq -0x2070(%rbp), %rcx
movb $0x1, %al
cmpq -0x2078(%rbp), %rcx
movb %al, -0x2099(%rbp)
jb 0x2b818
leaq -0x2080(%rbp), %rdi
movl $0x1, %esi
callq 0x20630
cmpq $0x0, %rax
setne %al
movb %al, -0x2099(%rbp)
movb -0x2099(%rbp), %al
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %dl
movq -0x2080(%rbp), %rax
movq -0x2070(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x2070(%rbp)
movb %dl, (%rax,%rcx)
jmp 0x2b8ba
leaq -0x2080(%rbp), %rdi
movl $0xfa, %esi
callq 0x20630
movq %rax, -0x2090(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
leaq -0x5c(%rbp), %rdx
addq $0x1, %rdx
callq 0x2bf00
movq %rax, -0x10(%rbp)
movq -0x2090(%rbp), %rdi
leaq -0x5c(%rbp), %rdx
movq -0x58(%rbp), %rcx
movl $0xfa, %esi
callq 0x5400
movq %rax, -0x2088(%rbp)
movq -0x2088(%rbp), %rax
addq -0x2070(%rbp), %rax
movq %rax, -0x2070(%rbp)
jmp 0x2b7c9
leaq -0x2080(%rbp), %rdi
callq 0x20940
movl $0x1, %eax
addq $0x20a0, %rsp           # imm = 0x20A0
popq %rbp
retq
nopl (%rax)