// File: /workspace/github_c_makefile_star2_O3/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 0x7eac(%rip), %rdx      # 0x2417d
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x14fa6
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x608f
testl %eax, %eax
jle 0x1c300
movq %rbx, %rdi
movl $0x2, %esi
callq 0x15124
jmp 0x1c307
xorl %edi, %edi
callq 0x5330
movq %rbx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
cmpb $0x21, (%r14)
jne 0x1c329
leaq 0x10(%rsp), %rdi
callq 0x5440
movq %rax, %r15
incq %r14
jmp 0x1c336
leaq 0x10(%rsp), %rdi
callq 0x5070
movq %rax, %r15
testq %r15, %r15
jne 0x1c34e
leaq 0x7e3e(%rip), %rsi      # 0x24180
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x14a62
cmpb $0x2a, (%r14)
jne 0x1c366
cmpb $0x74, 0x1(%r14)
jne 0x1c366
cmpb $0x0, 0x2(%r14)
je 0x1c49d
leaq 0x5(%rsp), %rax
movb $0x25, -0x1(%rax)
leaq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x154c8
movzbl (%r14), %eax
cmpl $0x25, %eax
je 0x1c3c8
testl %eax, %eax
je 0x1c47c
movq 0x28(%rsp), %rcx
cmpq 0x20(%rsp), %rcx
jb 0x1c3b2
movl $0x1, %esi
leaq 0x18(%rsp), %rdi
callq 0x151bd
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 0x1c37e
movl $0xfa, %esi
leaq 0x18(%rsp), %rdi
callq 0x151bd
movq %rax, %rbp
incq %r14
movl $0x1, %r13d
leaq 0x7df1(%rip), %r12      # 0x241db
movzbl (%r12), %eax
cmpl $0x7c, %eax
je 0x1c40f
testl %eax, %eax
je 0x1c41a
movslq %r13d, %rbx
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5380
testl %eax, %eax
jne 0x1c415
jmp 0x1c445
incl %r13d
movslq %r13d, %rbx
addq %rbx, %r12
jmp 0x1c3ea
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x7e00(%rip), %rsi      # 0x24229
movq %r14, %rdx
xorl %eax, %eax
callq 0x65ff
movq %rbx, %rdi
movl $0x1, %esi
movq %rax, %rdx
callq 0x1497c
jmp 0x1c45d
leaq 0x5(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5310
movb $0x0, 0x5(%rsp,%rbx)
addq %rbx, %r14
movl $0xfa, %esi
movq %rbp, %rdi
leaq 0x4(%rsp), %rdx
movq %r15, %rcx
callq 0x5420
addq %rax, 0x28(%rsp)
jmp 0x1c37e
leaq 0x18(%rsp), %rdi
callq 0x153c0
movl $0x1, %eax
addq $0x2038, %rsp           # imm = 0x2038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x69fb
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1c864
jmp 0x1c486