// File: /workspace/github_c_makefile_star2_O1/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/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, (time_t)luaL_checknumber, 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? */
    lua_pushnil(L);
  else if (strcmp(s, "*t") == 0) {
    lua_createtable(L, 0, 9);  /* 9 = number of fields */
    setfield(L, "sec", stm->tm_sec);
    setfield(L, "min", stm->tm_min);
    setfield(L, "hour", stm->tm_hour);
    setfield(L, "day", stm->tm_mday);
    setfield(L, "month", stm->tm_mon+1);
    setfield(L, "year", stm->tm_year+1900);
    setfield(L, "wday", stm->tm_wday+1);
    setfield(L, "yday", stm->tm_yday+1);
    setboolfield(L, "isdst", stm->tm_isdst);
  }
  else {
    char cc[4];
    luaL_Buffer b;
    cc[0] = '%';
    luaL_buffinit(L, &b);
    while (*s) {
      if (*s != '%')  /* no conversion specifier? */
        luaL_addchar(&b, *s++);
      else {
        size_t reslen;
        char buff[200];  /* should be big enough for any conversion result */
        s = checkoption(L, s + 1, cc);
        reslen = strftime(buff, sizeof(buff), cc, stm);
        luaL_addlstring(&b, buff, reslen);
      }
    }
    luaL_pushresult(&b);
  }
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2148, %rsp           # imm = 0x2148
movq %rdi, %r14
leaq 0x1027f(%rip), %rdx     # 0x21293
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x9500
movq %rax, %rbx
movq %r14, %rdi
movl $0x2, %esi
callq 0x7889
testl %eax, %eax
jle 0x11048
movq %r14, %rdi
movl $0x2, %esi
callq 0x9650
cvttsd2si %xmm0, %rax
jmp 0x1104f
xorl %edi, %edi
callq 0x6390
movq %rax, 0x10(%rsp)
cmpb $0x21, (%rbx)
jne 0x11070
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x61d0
movq %rax, %r12
incq %rbx
jmp 0x11082
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x60b0
movq %rax, %r12
testq %r12, %r12
je 0x1120e
leaq 0x10204(%rip), %rsi     # 0x21296
movq %rbx, %rdi
callq 0x62e0
testl %eax, %eax
je 0x1121b
leaq 0xc(%rsp), %rax
movb $0x25, (%rax)
leaq 0x128(%rsp), %rsi
movq %r14, 0x18(%rsp)
movq %r14, %rdi
callq 0x999b
leaq 0x1b5aa(%rip), %r13     # 0x2c670
movq %r12, 0x20(%rsp)
movzbl (%rbx), %eax
cmpl $0x25, %eax
je 0x11125
testl %eax, %eax
je 0x111fc
movq 0x138(%rsp), %rax
cmpq 0x130(%rsp), %rax
jb 0x110ff
movl $0x1, %esi
leaq 0x128(%rsp), %rdi
callq 0x97c0
movb (%rbx), %al
incq %rbx
movq 0x128(%rsp), %rcx
movq 0x138(%rsp), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x138(%rsp)
movb %al, (%rcx,%rdx)
jmp 0x110cb
leaq 0x1(%rbx), %r12
leaq 0x2(%rbx), %r15
movq $-0x2, %rbp
movsbl (%r12), %r14d
testl %r14d, %r14d
je 0x11175
movq 0x10(%r13,%rbp,8), %rdi
movl %r14d, %esi
callq 0x6190
testq %rax, %rax
je 0x11175
movb %r14b, 0xd(%rsp)
movq 0x18(%r13,%rbp,8), %rdi
cmpb $0x0, (%rdi)
je 0x111ad
movsbl (%r15), %r14d
testl %r14d, %r14d
je 0x11175
movl %r14d, %esi
callq 0x6190
testq %rax, %rax
jne 0x111b4
addq $0x2, %rbp
cmpq $0x4, %rbp
jb 0x11134
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1016c(%rip), %rsi     # 0x212fa
movq %r12, %rdx
xorl %eax, %eax
callq 0x7eb0
movq %rbx, %rdi
movl $0x1, %esi
movq %rax, %rdx
callq 0x8f3e
movq %r12, %r15
jmp 0x111c5
movb $0x0, 0xe(%rsp)
jmp 0x111c5
movb %r14b, 0xe(%rsp)
movb $0x0, 0xf(%rsp)
addq $0x3, %rbx
movq %rbx, %r15
movl $0xc8, %esi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x64a0
leaq 0x128(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x9869
movq %r15, %rbx
jmp 0x110cb
leaq 0x128(%rsp), %rdi
callq 0x98d0
jmp 0x11366
movq %r14, %rdi
callq 0x7d5e
jmp 0x11366
movq %r14, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x81c0
movslq (%r12), %rsi
movq %r14, %rdi
callq 0x7d87
leaq 0x1005c(%rip), %rdx     # 0x21299
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movslq 0x4(%r12), %rsi
movq %r14, %rdi
callq 0x7d87
leaq 0xfa60(%rip), %rdx      # 0x20cbe
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movslq 0x8(%r12), %rsi
movq %r14, %rdi
callq 0x7d87
leaq 0x1001e(%rip), %rdx     # 0x2129d
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movslq 0xc(%r12), %rsi
movq %r14, %rdi
callq 0x7d87
leaq 0x1000e(%rip), %rdx     # 0x212ae
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movslq 0x10(%r12), %rsi
incq %rsi
movq %r14, %rdi
callq 0x7d87
leaq 0xffde(%rip), %rdx      # 0x212a2
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movslq 0x14(%r12), %rsi
addq $0x76c, %rsi            # imm = 0x76C
movq %r14, %rdi
callq 0x7d87
leaq 0xffbc(%rip), %rdx      # 0x212a8
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movslq 0x18(%r12), %rsi
incq %rsi
movq %r14, %rdi
callq 0x7d87
leaq 0xff9d(%rip), %rdx      # 0x212ad
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movslq 0x1c(%r12), %rsi
incq %rsi
movq %r14, %rdi
callq 0x7d87
leaq 0xff7e(%rip), %rdx      # 0x212b2
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movl 0x20(%r12), %esi
testl %esi, %esi
js 0x11366
movq %r14, %rdi
callq 0x7fe1
leaq 0xff5e(%rip), %rdx      # 0x212b7
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x833f
movl $0x1, %eax
addq $0x2148, %rsp           # imm = 0x2148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq