// File: /workspace/github_c_makefile_star2_O1/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 0x7978(%rip), %rdx      # 0x230ed
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x144dc
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x5f7f
testl %eax, %eax
jle 0x1b7a4
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1465a
jmp 0x1b7ab
xorl %edi, %edi
callq 0x5340
movq %rbx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
cmpb $0x21, (%r14)
jne 0x1b7cd
leaq 0x10(%rsp), %rdi
callq 0x5450
movq %rax, %r15
incq %r14
jmp 0x1b7da
leaq 0x10(%rsp), %rdi
callq 0x5070
movq %rax, %r15
testq %r15, %r15
jne 0x1b7f2
leaq 0x790a(%rip), %rsi      # 0x230f0
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x13f8e
leaq 0x792e(%rip), %rsi      # 0x23127
movq %r14, %rdi
callq 0x5290
testl %eax, %eax
je 0x1b92b
leaq 0x5(%rsp), %rax
movb $0x25, -0x1(%rax)
leaq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x149f7
movzbl (%r14), %eax
cmpl $0x25, %eax
je 0x1b86b
testl %eax, %eax
je 0x1b91f
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
jb 0x1b84d
movl $0x1, %esi
leaq 0x18(%rsp), %rdi
callq 0x146f3
movb (%r14), %al
incq %r14
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x28(%rsp)
movb %al, (%rcx,%rdx)
jmp 0x1b821
movl $0xfa, %esi
leaq 0x18(%rsp), %rdi
callq 0x146f3
movq %rax, %rbp
incq %r14
movl $0x1, %r13d
leaq 0x78c1(%rip), %r12      # 0x2314e
movzbl (%r12), %eax
cmpl $0x7c, %eax
je 0x1b8b2
testl %eax, %eax
je 0x1b8bd
movslq %r13d, %rbx
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5390
testl %eax, %eax
jne 0x1b8b5
jmp 0x1b8e8
incl %r13d
movslq %r13d, %rax
addq %rax, %r12
jmp 0x1b88d
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x78d0(%rip), %rsi      # 0x2319c
movq %r14, %rdx
xorl %eax, %eax
callq 0x64e8
movq %rbx, %rdi
movl $0x1, %esi
movq %rax, %rdx
callq 0x13ea8
jmp 0x1b900
leaq 0x5(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5320
movb $0x0, 0x5(%rsp,%rbx)
addq %rbx, %r14
movl $0xfa, %esi
movq %rbp, %rdi
leaq 0x4(%rsp), %rdx
movq %r15, %rcx
callq 0x5430
addq %rax, 0x28(%rsp)
jmp 0x1b821
leaq 0x18(%rsp), %rdi
callq 0x148ef
jmp 0x1b94a
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x68d6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1bd07
movl $0x1, %eax
addq $0x2038, %rsp           # imm = 0x2038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq