// File: /workspace/github_c_makefile_star2_O2/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 0xf075(%rip), %rdx      # 0x1f263
pushq $0x1
popq %rsi
xorl %ecx, %ecx
callq 0x920b
movq %rax, %r13
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x7624
testl %eax, %eax
jle 0x1021c
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x9364
cvttsd2si %xmm0, %rax
jmp 0x10223
xorl %edi, %edi
callq 0x6380
movq %rax, 0x10(%rsp)
cmpb $0x21, (%r13)
jne 0x10246
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x61d0
movq %rax, %r14
incq %r13
jmp 0x10258
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x60b0
movq %rax, %r14
testq %r14, %r14
je 0x103df
cmpb $0x2a, (%r13)
jne 0x1027a
cmpb $0x74, 0x1(%r13)
jne 0x1027a
cmpb $0x0, 0x2(%r13)
je 0x103fc
leaq 0xc(%rsp), %rax
movb $0x25, (%rax)
leaq 0x128(%rsp), %rsi
movq %rbx, 0x18(%rsp)
movq %rbx, %rdi
callq 0x9657
leaq 0x1c3d2(%rip), %rbx     # 0x2c670
movq %r14, 0x20(%rsp)
movzbl (%r13), %eax
cmpl $0x25, %eax
je 0x102ff
testl %eax, %eax
je 0x103d0
movq 0x138(%rsp), %rcx
cmpq 0x130(%rsp), %rcx
jb 0x102e3
leaq 0x128(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x94ad
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 0x102a3
leaq 0x1(%r13), %r12
leaq 0x2(%r13), %r15
xorl %ebp, %ebp
cmpq $0x5, %rbp
ja 0x10355
movsbl (%r12), %r14d
testl %r14d, %r14d
je 0x1034f
movq (%rbx,%rbp,8), %rdi
movl %r14d, %esi
callq 0x6190
testq %rax, %rax
je 0x1034f
movb %r14b, 0xd(%rsp)
movq 0x8(%rbx,%rbp,8), %rdi
cmpb $0x0, (%rdi)
je 0x10381
movsbl (%r15), %r14d
testl %r14d, %r14d
je 0x1034f
movl %r14d, %esi
callq 0x6190
testq %rax, %rax
jne 0x10388
addq $0x2, %rbp
jmp 0x10309
movq 0x18(%rsp), %r14
movq %r14, %rdi
leaq 0xef63(%rip), %rsi      # 0x1f2c7
movq %r12, %rdx
xorl %eax, %eax
callq 0x7c0d
movq %r14, %rdi
pushq $0x1
popq %rsi
movq %rax, %rdx
callq 0x8c84
movq %r12, %r15
jmp 0x10399
movb $0x0, 0xe(%rsp)
jmp 0x10399
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 0x6490
leaq 0x128(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x9559
movq %r15, %r13
jmp 0x102a3
leaq 0x128(%rsp), %rdi
callq 0x95ae
jmp 0x103e7
movq %rbx, %rdi
callq 0x7acb
pushq $0x1
popq %rax
addq $0x2148, %rsp           # imm = 0x2148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x9
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7f1a
movl (%r14), %edx
leaq 0xee53(%rip), %rsi      # 0x1f266
movq %rbx, %rdi
callq 0x10837
movl 0x4(%r14), %edx
leaq 0xe868(%rip), %rsi      # 0x1ec8e
movq %rbx, %rdi
callq 0x10837
movl 0x8(%r14), %edx
leaq 0xee31(%rip), %rsi      # 0x1f26a
movq %rbx, %rdi
callq 0x10837
movl 0xc(%r14), %edx
leaq 0xee2f(%rip), %rsi      # 0x1f27b
movq %rbx, %rdi
callq 0x10837
movl 0x10(%r14), %edx
incl %edx
leaq 0xee0e(%rip), %rsi      # 0x1f26f
movq %rbx, %rdi
callq 0x10837
movl $0x76c, %edx            # imm = 0x76C
addl 0x14(%r14), %edx
leaq 0xedfc(%rip), %rsi      # 0x1f275
movq %rbx, %rdi
callq 0x10837
movl 0x18(%r14), %edx
incl %edx
leaq 0xedec(%rip), %rsi      # 0x1f27a
movq %rbx, %rdi
callq 0x10837
movl 0x1c(%r14), %edx
incl %edx
leaq 0xeddc(%rip), %rsi      # 0x1f27f
movq %rbx, %rdi
callq 0x10837
movl 0x20(%r14), %esi
testl %esi, %esi
js 0x103e7
movq %rbx, %rdi
callq 0x7d3d
leaq 0xedbe(%rip), %rdx      # 0x1f284
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0x809d
jmp 0x103e7