// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/lua-5.1.5/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 *stm;
  if (*s == '!') {  /* UTC? */
    stm = gmtime(&t);
    s++;  /* skip `!' */
  }
  else
    stm = localtime(&t);
  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[3];
    luaL_Buffer b;
    cc[0] = '%'; cc[2] = '\0';
    luaL_buffinit(L, &b);
    for (; *s; s++) {
      if (*s != '%' || *(s + 1) == '\0')  /* no conversion specifier? */
        luaL_addchar(&b, *s);
      else {
        size_t reslen;
        char buff[200];  /* should be big enough for any conversion result */
        cc[1] = *(++s);
        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 $0x20f8, %rsp           # imm = 0x20F8
movq %rdi, %rbx
leaq 0x8ef51(%rip), %rdx     # 0xfa75b
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x5b14f
movq %rax, %r15
movq 0x18(%rbx), %rax
leaq 0x10(%rax), %rcx
cmpq 0x10(%rbx), %rcx
setae %dl
cmpq 0xe57a1(%rip), %rcx     # 0x150fd0
sete %cl
orb %dl, %cl
jne 0x6b850
cmpl $0x0, 0x18(%rax)
jle 0x6b850
movq %rbx, %rdi
movl $0x2, %esi
callq 0x5b394
cvttsd2si %xmm0, %rax
jmp 0x6b857
xorl %edi, %edi
callq 0xb5e0
movq %rax, 0x8(%rsp)
cmpb $0x21, (%r15)
jne 0x6b874
leaq 0x8(%rsp), %rdi
callq 0xb580
movq %rax, %r14
incq %r15
jmp 0x6b881
leaq 0x8(%rsp), %rdi
callq 0xb460
movq %rax, %r14
testq %r14, %r14
je 0x6b97d
leaq 0x833d5(%rip), %rsi     # 0xeec66
movq %r15, %rdi
callq 0xb890
testl %eax, %eax
je 0x6b995
leaq 0x5(%rsp), %r12
movb $0x25, (%r12)
movb $0x0, 0x2(%r12)
leaq 0xf8(%rsp), %rax
movq %rbx, -0x8(%rax)
movq %rax, -0x18(%rax)
movl $0x0, -0x10(%rax)
leaq 0x20f8(%rsp), %rbp
leaq 0x10(%rsp), %rbx
leaq 0xe0(%rsp), %r13
movzbl (%r15), %eax
cmpl $0x25, %eax
je 0x6b8ec
testl %eax, %eax
jne 0x6b920
jmp 0x6b95c
cmpb $0x0, 0x1(%r15)
je 0x6b920
incq %r15
movb (%r15), %al
movb %al, 0x6(%rsp)
movl $0xc8, %esi
movq %rbx, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0xb510
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x5b99f
jmp 0x6b957
cmpq %rbp, 0xe0(%rsp)
jb 0x6b93e
movq %r13, %rdi
callq 0x5ba5e
testl %eax, %eax
je 0x6b93e
movq %r13, %rdi
callq 0x5ba94
movb (%r15), %al
movq 0xe0(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0xe0(%rsp)
movb %al, (%rcx)
incq %r15
jmp 0x6b8dd
leaq 0xe0(%rsp), %rbx
movq %rbx, %rdi
callq 0x5ba5e
movq 0x10(%rbx), %rdi
movl 0x8(%rbx), %esi
callq 0x59be2
jmp 0x6bb56
movq 0x10(%rbx), %rax
movl $0x0, 0x8(%rax)
addq $0x10, %rax
movq %rax, 0x10(%rbx)
jmp 0x6bb56
movq %rbx, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x58da0
movq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdl (%r14), %xmm0
movsd %xmm0, (%rax)
movl $0x3, %ebp
movl %ebp, 0x8(%rax)
addq $0x10, 0x10(%rbx)
leaq 0x9e81a(%rip), %rdx     # 0x10a1e2
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%r14), %xmm0
movsd %xmm0, (%rax)
movl %ebp, 0x8(%rax)
addq $0x10, 0x10(%rbx)
leaq 0x83046(%rip), %rdx     # 0xeea3b
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0x8(%r14), %xmm0
movsd %xmm0, (%rax)
movl %ebp, 0x8(%rax)
addq $0x10, 0x10(%rbx)
leaq 0x83247(%rip), %rdx     # 0xeec69
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2sdl 0xc(%r14), %xmm0
movsd %xmm0, (%rax)
movl %ebp, 0x8(%rax)
addq $0x10, 0x10(%rbx)
leaq 0x8322b(%rip), %rdx     # 0xeec7a
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movl 0x10(%r14), %eax
incl %eax
movq 0x10(%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rcx)
movl %ebp, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
leaq 0x831ee(%rip), %rdx     # 0xeec6e
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movl $0x76c, %eax            # imm = 0x76C
addl 0x14(%r14), %eax
movq 0x10(%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rcx)
movl %ebp, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
leaq 0x831c0(%rip), %rdx     # 0xeec74
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movl 0x18(%r14), %eax
incl %eax
movq 0x10(%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rcx)
movl %ebp, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
leaq 0x83194(%rip), %rdx     # 0xeec79
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movl 0x1c(%r14), %eax
incl %eax
movq 0x10(%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rcx)
movl %ebp, 0x8(%rcx)
addq $0x10, 0x10(%rbx)
leaq 0x83168(%rip), %rdx     # 0xeec7e
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
cmpl $0x0, 0x20(%r14)
js 0x6bb56
movq 0x10(%rbx), %rax
setne %cl
movzbl %cl, %ecx
movl %ecx, (%rax)
movl $0x1, 0x8(%rax)
addq $0x10, 0x10(%rbx)
leaq 0x8313a(%rip), %rdx     # 0xeec83
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movl $0x1, %eax
addq $0x20f8, %rsp           # imm = 0x20F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq