// File: /workspace/github_c_makefile_star2_O3/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, %rbx
leaq 0x10133(%rip), %rdx     # 0x21293
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x9637
movq %rax, %r13
movq %rbx, %rdi
movl $0x2, %esi
callq 0x7992
testl %eax, %eax
jle 0x11194
movq %rbx, %rdi
movl $0x2, %esi
callq 0x9787
cvttsd2si %xmm0, %rax
jmp 0x1119b
xorl %edi, %edi
callq 0x6390
movq %rax, 0x10(%rsp)
cmpb $0x21, (%r13)
jne 0x111be
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x61d0
movq %rax, %r14
incq %r13
jmp 0x111d0
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x60b0
movq %rax, %r14
testq %r14, %r14
je 0x1135f
cmpb $0x2a, (%r13)
jne 0x111f2
cmpb $0x74, 0x1(%r13)
jne 0x111f2
cmpb $0x0, 0x2(%r13)
je 0x1137e
leaq 0xc(%rsp), %rax
movb $0x25, (%rax)
leaq 0x128(%rsp), %rsi
movq %rbx, 0x18(%rsp)
movq %rbx, %rdi
callq 0x9ad7
leaq 0x1b45a(%rip), %rbx     # 0x2c670
movq %r14, 0x20(%rsp)
movzbl (%r13), %eax
cmpl $0x25, %eax
je 0x11279
testl %eax, %eax
je 0x11350
movq 0x138(%rsp), %rcx
cmpq 0x130(%rsp), %rcx
jb 0x1125d
movl $0x1, %esi
leaq 0x128(%rsp), %rdi
callq 0x98f7
movb (%r13), %al
movq 0x138(%rsp), %rcx
incq %r13
movq 0x128(%rsp), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x138(%rsp)
movb %al, (%rdx,%rcx)
jmp 0x1121b
leaq 0x1(%r13), %r12
leaq 0x2(%r13), %r15
movq $-0x2, %rbp
movsbl (%r12), %r14d
testl %r14d, %r14d
je 0x112c9
movq 0x10(%rbx,%rbp,8), %rdi
movl %r14d, %esi
callq 0x6190
testq %rax, %rax
je 0x112c9
movb %r14b, 0xd(%rsp)
movq 0x18(%rbx,%rbp,8), %rdi
cmpb $0x0, (%rdi)
je 0x11301
movsbl (%r15), %r14d
testl %r14d, %r14d
je 0x112c9
movl %r14d, %esi
callq 0x6190
testq %rax, %rax
jne 0x11308
addq $0x2, %rbp
cmpq $0x4, %rbp
jb 0x11288
movq 0x18(%rsp), %r14
movq %r14, %rdi
leaq 0x10015(%rip), %rsi     # 0x212f7
movq %r12, %rdx
xorl %eax, %eax
callq 0x7fb4
movq %r14, %rdi
movl $0x1, %esi
movq %rax, %rdx
callq 0x905e
movq %r12, %r15
jmp 0x11319
movb $0x0, 0xe(%rsp)
jmp 0x11319
movb %r14b, 0xe(%rsp)
movb $0x0, 0xf(%rsp)
addq $0x3, %r13
movq %r13, %r15
movl $0xc8, %esi
leaq 0x60(%rsp), %r12
movq %r12, %rdi
leaq 0xc(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x64a0
leaq 0x128(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x99a5
movq %r15, %r13
jmp 0x1121b
leaq 0x128(%rsp), %rdi
callq 0x9a0c
jmp 0x11367
movq %rbx, %rdi
callq 0x7e6c
movl $0x1, %eax
addq $0x2148, %rsp           # imm = 0x2148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x82c4
movslq (%r14), %rsi
movq %rbx, %rdi
callq 0x7e95
leaq 0xfef7(%rip), %rdx      # 0x21296
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
movslq 0x4(%r14), %rsi
movq %rbx, %rdi
callq 0x7e95
leaq 0xf8ff(%rip), %rdx      # 0x20cbe
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
movslq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x7e95
leaq 0xfebb(%rip), %rdx      # 0x2129a
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
movslq 0xc(%r14), %rsi
movq %rbx, %rdi
callq 0x7e95
leaq 0xfeac(%rip), %rdx      # 0x212ab
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
movslq 0x10(%r14), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x7e95
leaq 0xfe7d(%rip), %rdx      # 0x2129f
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
movslq 0x14(%r14), %rsi
addq $0x76c, %rsi            # imm = 0x76C
movq %rbx, %rdi
callq 0x7e95
leaq 0xfe5c(%rip), %rdx      # 0x212a5
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
movslq 0x18(%r14), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x7e95
leaq 0xfe3e(%rip), %rdx      # 0x212aa
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
movslq 0x1c(%r14), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x7e95
leaq 0xfe20(%rip), %rdx      # 0x212af
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
movl 0x20(%r14), %esi
testl %esi, %esi
js 0x11367
movq %rbx, %rdi
callq 0x80e5
leaq 0xfdfd(%rip), %rdx      # 0x212b4
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x844e
jmp 0x11367