// File: /workspace/github_c_makefile_star2_O3/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 0x4d2b(%rip), %rdx      # 0x1c272
movl $0x1, %esi
xorl %ecx, %ecx
callq 0x10acb
movq %rax, %r15
movq %rbx, %rdi
movl $0x2, %esi
callq 0x584a
testl %eax, %eax
jle 0x1757b
movq %rbx, %rdi
movl $0x2, %esi
callq 0x10ce6
cvttsd2si %xmm0, %rax
jmp 0x17582
xorl %edi, %edi
callq 0x4320
movq %rax, 0x8(%rsp)
cmpb $0x21, (%r15)
jne 0x1759f
leaq 0x8(%rsp), %rdi
callq 0x4450
movq %rax, %r14
incq %r15
jmp 0x175ac
leaq 0x8(%rsp), %rdi
callq 0x4060
movq %rax, %r14
testq %r14, %r14
je 0x17680
cmpb $0x2a, (%r15)
jne 0x175cd
cmpb $0x74, 0x1(%r15)
jne 0x175cd
cmpb $0x0, 0x2(%r15)
je 0x1769f
leaq 0x5(%rsp), %r12
movb $0x25, (%r12)
movb $0x0, 0x2(%r12)
leaq 0xe0(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1121c
leaq 0x20f8(%rsp), %rbp
leaq 0x10(%rsp), %rbx
movzbl (%r15), %eax
cmpl $0x25, %eax
je 0x1760c
testl %eax, %eax
jne 0x1763e
jmp 0x17671
movb 0x1(%r15), %cl
testb %cl, %cl
je 0x1763e
incq %r15
movb %cl, 0x6(%rsp)
movl $0xc8, %esi
movq %rbx, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4420
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1122f
jmp 0x1766c
movq 0xe0(%rsp), %rcx
cmpq %rbp, %rcx
jb 0x1765e
movq %r13, %rdi
callq 0x112d0
movb (%r15), %al
movq 0xe0(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0xe0(%rsp)
movb %al, (%rcx)
incq %r15
jmp 0x175fd
leaq 0xe0(%rsp), %rdi
callq 0x112b2
jmp 0x17688
movq %rbx, %rdi
callq 0x5c17
movl $0x1, %eax
addq $0x20f8, %rsp           # imm = 0x20F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x5fa8
movslq (%r14), %rsi
movq %rbx, %rdi
callq 0x5c40
leaq 0x5450(%rip), %rdx      # 0x1cb10
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
movslq 0x4(%r14), %rsi
movq %rbx, %rdi
callq 0x5c40
leaq 0x5384(%rip), %rdx      # 0x1ca64
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
movslq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x5c40
leaq 0x5414(%rip), %rdx      # 0x1cb14
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
movslq 0xc(%r14), %rsi
movq %rbx, %rdi
callq 0x5c40
leaq 0x5405(%rip), %rdx      # 0x1cb25
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
movslq 0x10(%r14), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x5c40
leaq 0x53d6(%rip), %rdx      # 0x1cb19
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
movslq 0x14(%r14), %rsi
addq $0x76c, %rsi            # imm = 0x76C
movq %rbx, %rdi
callq 0x5c40
leaq 0x53b5(%rip), %rdx      # 0x1cb1f
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
movslq 0x18(%r14), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x5c40
leaq 0x5397(%rip), %rdx      # 0x1cb24
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
movslq 0x1c(%r14), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x5c40
leaq 0x5379(%rip), %rdx      # 0x1cb29
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
movl 0x20(%r14), %esi
testl %esi, %esi
js 0x17688
movq %rbx, %rdi
callq 0x5e7d
leaq 0x5356(%rip), %rdx      # 0x1cb2e
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x60cb
jmp 0x17688