// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/deps/lua/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 0x48ef(%rip), %rdx      # 0x1a232
pushq $0x1
popq %rsi
xorl %ecx, %ecx
callq 0xf667
movq %rax, %r15
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x543c
testl %eax, %eax
jle 0x15971
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0xf87d
cvttsd2si %xmm0, %rax
jmp 0x15978
xorl %edi, %edi
callq 0x4310
movq %rax, 0x8(%rsp)
cmpb $0x21, (%r15)
jne 0x15995
leaq 0x8(%rsp), %rdi
callq 0x4440
movq %rax, %r14
incq %r15
jmp 0x159a2
leaq 0x8(%rsp), %rdi
callq 0x4060
movq %rax, %r14
testq %r14, %r14
je 0x15a76
cmpb $0x2a, (%r15)
jne 0x159c3
cmpb $0x74, 0x1(%r15)
jne 0x159c3
cmpb $0x0, 0x2(%r15)
je 0x15a93
leaq 0x5(%rsp), %r12
movb $0x25, (%r12)
movb $0x0, 0x2(%r12)
leaq 0xe0(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0xfd2b
leaq 0x20f8(%rsp), %rbp
leaq 0x10(%rsp), %rbx
movzbl (%r15), %eax
cmpl $0x25, %eax
je 0x15a02
testl %eax, %eax
jne 0x15a34
jmp 0x15a67
movb 0x1(%r15), %cl
testb %cl, %cl
je 0x15a34
incq %r15
movb %cl, 0x6(%rsp)
movl $0xc8, %esi
movq %rbx, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4410
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0xfd3b
jmp 0x15a62
movq 0xe0(%rsp), %rcx
cmpq %rbp, %rcx
jb 0x15a54
movq %r13, %rdi
callq 0xfdd0
movb (%r15), %al
movq 0xe0(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0xe0(%rsp)
movb %al, (%rcx)
incq %r15
jmp 0x159f3
leaq 0xe0(%rsp), %rdi
callq 0xfdb2
jmp 0x15a7e
movq %rbx, %rdi
callq 0x57d9
pushq $0x1
popq %rax
addq $0x20f8, %rsp           # imm = 0x20F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x9
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5b5f
movl (%r14), %edx
leaq 0x5026(%rip), %rsi      # 0x1aad0
movq %rbx, %rdi
callq 0x15e5a
movl 0x4(%r14), %edx
leaq 0x4f67(%rip), %rsi      # 0x1aa24
movq %rbx, %rdi
callq 0x15e5a
movl 0x8(%r14), %edx
leaq 0x5004(%rip), %rsi      # 0x1aad4
movq %rbx, %rdi
callq 0x15e5a
movl 0xc(%r14), %edx
leaq 0x5002(%rip), %rsi      # 0x1aae5
movq %rbx, %rdi
callq 0x15e5a
movl 0x10(%r14), %edx
incl %edx
leaq 0x4fe1(%rip), %rsi      # 0x1aad9
movq %rbx, %rdi
callq 0x15e5a
movl $0x76c, %edx            # imm = 0x76C
addl 0x14(%r14), %edx
leaq 0x4fcf(%rip), %rsi      # 0x1aadf
movq %rbx, %rdi
callq 0x15e5a
movl 0x18(%r14), %edx
incl %edx
leaq 0x4fbf(%rip), %rsi      # 0x1aae4
movq %rbx, %rdi
callq 0x15e5a
movl 0x1c(%r14), %edx
incl %edx
leaq 0x4faf(%rip), %rsi      # 0x1aae9
movq %rbx, %rdi
callq 0x15e5a
movl 0x20(%r14), %esi
testl %esi, %esi
js 0x15a7e
movq %rbx, %rdi
callq 0x5a34
leaq 0x4f91(%rip), %rdx      # 0x1aaee
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0x5c7e
jmp 0x15a7e