// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2038, %rsp           # imm = 0x2038
movq %rdi, %rbx
leaq 0x74fa(%rip), %rdx      # 0x2120d
pushq $0x1
popq %rsi
xorl %ecx, %ecx
callq 0x130d8
movq %rax, %r14
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x5d12
testl %eax, %eax
jle 0x19d3c
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x13252
jmp 0x19d43
xorl %edi, %edi
callq 0x5320
movq %rbx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
cmpb $0x21, (%r14)
jne 0x19d65
leaq 0x10(%rsp), %rdi
callq 0x5430
movq %rax, %r15
incq %r14
jmp 0x19d72
leaq 0x10(%rsp), %rdi
callq 0x5070
movq %rax, %r15
testq %r15, %r15
jne 0x19d8a
leaq 0x7492(%rip), %rsi      # 0x21210
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x12bd6
cmpb $0x2a, (%r14)
jne 0x19da2
cmpb $0x74, 0x1(%r14)
jne 0x19da2
cmpb $0x0, 0x2(%r14)
je 0x19ed1
leaq 0x5(%rsp), %rax
movb $0x25, -0x1(%rax)
leaq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x13589
movzbl (%r14), %eax
cmpl $0x25, %eax
je 0x19e02
testl %eax, %eax
je 0x19eb2
movq 0x28(%rsp), %rcx
cmpq 0x20(%rsp), %rcx
jb 0x19dec
leaq 0x18(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x132de
movb (%r14), %al
movq 0x28(%rsp), %rcx
incq %r14
movq 0x18(%rsp), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x28(%rsp)
movb %al, (%rdx,%rcx)
jmp 0x19dba
movl $0xfa, %esi
leaq 0x18(%rsp), %rdi
callq 0x132de
movq %rax, %rbp
incq %r14
leaq 0x744d(%rip), %r12      # 0x2126b
pushq $0x1
popq %r13
movzbl (%r12), %eax
cmpl $0x7c, %eax
je 0x19e47
testl %eax, %eax
je 0x19e52
movslq %r13d, %rbx
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5370
testl %eax, %eax
jne 0x19e4d
jmp 0x19e7b
incl %r13d
movslq %r13d, %rbx
addq %rbx, %r12
jmp 0x19e22
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x7458(%rip), %rsi      # 0x212b9
movq %r14, %rdx
xorl %eax, %eax
callq 0x6261
movq %rbx, %rdi
pushq $0x1
popq %rsi
movq %rax, %rdx
callq 0x12af2
jmp 0x19e93
leaq 0x5(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5300
movb $0x0, 0x5(%rsp,%rbx)
addq %rbx, %r14
movl $0xfa, %esi
movq %rbp, %rdi
leaq 0x4(%rsp), %rdx
movq %r15, %rcx
callq 0x5410
addq %rax, 0x28(%rsp)
jmp 0x19dba
leaq 0x18(%rsp), %rdi
callq 0x134ba
pushq $0x1
popq %rax
addq $0x2038, %rsp           # imm = 0x2038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x9
popq %rdx
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x665a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1a25e
jmp 0x19ebc