// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/deps/lua/src/lstrlib.c
// Function: str_format
static int str_format (lua_State *L) {
  int top = lua_gettop(L);
  int arg = 1;
  size_t sfl;
  const char *strfrmt = luaL_checklstring(L, arg, &sfl);
  const char *strfrmt_end = strfrmt+sfl;
  luaL_Buffer b;
  luaL_buffinit(L, &b);
  while (strfrmt < strfrmt_end) {
    if (*strfrmt != L_ESC)
      luaL_addchar(&b, *strfrmt++);
    else if (*++strfrmt == L_ESC)
      luaL_addchar(&b, *strfrmt++);  /* %% */
    else { /* format item */
      char form[MAX_FORMAT];  /* to store the format (`%...') */
      char buff[MAX_ITEM];  /* to store the formatted item */
      if (++arg > top)
        luaL_argerror(L, arg, "no value");
      strfrmt = scanformat(L, strfrmt, form);
      switch (*strfrmt++) {
        case 'c': {
          sprintf(buff, form, (int)luaL_checknumber(L, arg));
          break;
        }
        case 'd':  case 'i': {
          addintlen(form);
          sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg));
          break;
        }
        case 'o':  case 'u':  case 'x':  case 'X': {
          addintlen(form);
          sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
          break;
        }
        case 'e':  case 'E': case 'f':
        case 'g': case 'G': {
          sprintf(buff, form, (double)luaL_checknumber(L, arg));
          break;
        }
        case 'q': {
          addquoted(L, &b, arg);
          continue;  /* skip the 'addsize' at the end */
        }
        case 's': {
          size_t l;
          const char *s = luaL_checklstring(L, arg, &l);
          if (!strchr(form, '.') && l >= 100) {
            /* no precision and string is too long to be formatted;
               keep original string */
            lua_pushvalue(L, arg);
            luaL_addvalue(&b);
            continue;  /* skip the `addsize' at the end */
          }
          else {
            sprintf(buff, form, s);
            break;
          }
        }
        default: {  /* also treat cases `pnLlh' */
          return luaL_error(L, "invalid option " LUA_QL("%%%c") " to "
                               LUA_QL("format"), *(strfrmt - 1));
        }
      }
      luaL_addlstring(&b, buff, strlen(buff));
    }
  }
  luaL_pushresult(&b);
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2268, %rsp           # imm = 0x2268
movq %rdi, %rbx
callq 0x54dc
movl %eax, 0x3c(%rsp)
leaq 0x40(%rsp), %r14
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x10b24
movq %rax, %rbp
movq (%r14), %r12
leaq 0x48(%rsp), %rsi
movq %rbx, 0x8(%rsp)
movq %rbx, %rdi
callq 0x1121c
testq %r12, %r12
jle 0x18dfe
addq %rbp, %r12
movl $0x1, %ebx
movb (%rbp), %al
cmpb $0x25, %al
jne 0x18984
movq %r12, %r15
leaq 0x1(%rbp), %r13
movb 0x1(%rbp), %r12b
cmpb $0x25, %r12b
jne 0x189be
movq 0x48(%rsp), %rax
movb $0x25, %cl
leaq 0x2060(%rsp), %rdx
cmpq %rdx, %rax
movq %r15, %r12
jb 0x18973
leaq 0x48(%rsp), %rdi
callq 0x112d0
movb (%r13), %cl
movq 0x48(%rsp), %rax
addq $0x2, %rbp
leaq 0x1(%rax), %rdx
movq %rdx, 0x48(%rsp)
movb %cl, (%rax)
jmp 0x189b6
movq 0x48(%rsp), %rcx
leaq 0x2060(%rsp), %rdx
cmpq %rdx, %rcx
jb 0x189a8
leaq 0x48(%rsp), %rdi
callq 0x112d0
movb (%rbp), %al
movq 0x48(%rsp), %rcx
incq %rbp
leaq 0x1(%rcx), %rdx
movq %rdx, 0x48(%rsp)
movb %al, (%rcx)
movl %ebx, %r14d
jmp 0x18bf2
leal 0x1(%rbx), %r14d
cmpl 0x3c(%rsp), %ebx
jl 0x189e0
movq 0x8(%rsp), %rdi
movl %r14d, %esi
leaq 0x29bd(%rip), %rdx      # 0x1b394
callq 0x10820
movb (%r13), %r12b
testb %r12b, %r12b
leaq 0x449e(%rip), %rbx      # 0x1ce88
je 0x18a16
movq %r13, %rbp
movsbl %r12b, %esi
movl $0x6, %edx
movq %rbx, %rdi
callq 0x4220
testq %rax, %rax
je 0x18a1c
movb 0x1(%rbp), %r12b
incq %rbp
testb %r12b, %r12b
jne 0x189ef
xorl %r12d, %r12d
jmp 0x18a1c
xorl %r12d, %r12d
movq %r13, %rbp
movq %rbp, %rax
subq %r13, %rax
cmpq $0x6, %rax
jb 0x18a3f
movq 0x8(%rsp), %rdi
leaq 0x445a(%rip), %rsi      # 0x1ce8e
xorl %eax, %eax
callq 0x108d7
movb (%rbp), %r12b
callq 0x4580
movq (%rax), %rax
movzbl %r12b, %ecx
movzwl (%rax,%rcx,2), %ecx
shrl $0xb, %ecx
andl $0x1, %ecx
movzbl (%rbp,%rcx), %edx
movzwl (%rax,%rdx,2), %edx
btl $0xb, %edx
adcq %rcx, %rbp
movb (%rbp), %cl
cmpb $0x2e, %cl
jne 0x18aa1
leaq 0x1(%rbp), %rcx
movzbl 0x1(%rbp), %edx
xorl %esi, %esi
testb $0x8, 0x1(%rax,%rdx,2)
leaq 0x2(%rbp), %rdx
sete %sil
cmoveq %rcx, %rdx
negq %rsi
movzbl 0x2(%rbp,%rsi), %ecx
movzwl (%rax,%rcx,2), %ecx
btl $0xb, %ecx
adcq $0x0, %rdx
movb (%rdx), %cl
movq %rdx, %rbp
movq %r15, %r12
movzbl %cl, %ecx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x18ac1
movq 0x8(%rsp), %rdi
leaq 0x43f4(%rip), %rsi      # 0x1ceae
xorl %eax, %eax
callq 0x108d7
movb $0x25, 0x10(%rsp)
movq %rbp, %rbx
subq %r13, %rbx
leaq 0x1(%rbx), %rdx
leaq 0x11(%rsp), %rdi
movq %r13, %rsi
callq 0x4090
movb $0x0, 0x12(%rsp,%rbx)
movzbl (%rbp), %eax
incq %rbp
cmpl $0x62, %eax
jle 0x18b47
leal -0x63(%rax), %ecx
cmpl $0x15, %ecx
leaq 0x2060(%rsp), %rbx
ja 0x18e1f
leaq 0x4177(%rip), %rdx      # 0x1cc80
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x4140
movb 0xf(%rsp,%rax), %cl
movw $0x6c, 0xf(%rsp,%rax)
movb %cl, 0x10(%rsp,%rax)
movb $0x0, 0x11(%rsp,%rax)
movq 0x8(%rsp), %rdi
movl %r14d, %esi
callq 0x10ce6
cvttsd2si %xmm0, %rdx
jmp 0x18baf
cmpl $0x45, %eax
leaq 0x2060(%rsp), %rbx
je 0x18bbe
cmpl $0x47, %eax
je 0x18bbe
cmpl $0x58, %eax
jne 0x18e1f
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x4140
movb 0xf(%rsp,%rax), %cl
movw $0x6c, 0xf(%rsp,%rax)
movb %cl, 0x10(%rsp,%rax)
movb $0x0, 0x11(%rsp,%rax)
movq 0x8(%rsp), %rdi
movl %r14d, %esi
callq 0x10ce6
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x40d4(%rip), %xmm0     # 0x1cc78
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x44c0
jmp 0x18bda
movq 0x8(%rsp), %rdi
movl %r14d, %esi
callq 0x10ce6
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
movb $0x1, %al
callq 0x44c0
movq %rbx, %rdi
callq 0x4140
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1122f
movl %r14d, %ebx
cmpq %r12, %rbp
jb 0x18931
jmp 0x18dfe
movq 0x8(%rsp), %rdi
movl %r14d, %esi
leaq 0x30(%rsp), %rdx
callq 0x10b24
movq %rax, %r13
leaq 0x10(%rsp), %rdi
movl $0x2e, %esi
callq 0x4160
testq %rax, %rax
jne 0x18dee
cmpq $0x63, 0x30(%rsp)
jbe 0x18dee
movq 0x8(%rsp), %rdi
movl %r14d, %esi
callq 0x582a
leaq 0x48(%rsp), %rdi
callq 0x113c6
jmp 0x18bf2
movq 0x8(%rsp), %rdi
movl %r14d, %esi
callq 0x10ce6
cvttsd2si %xmm0, %edx
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x44c0
jmp 0x18bda
movq 0x8(%rsp), %rdi
movl %r14d, %esi
leaq 0x30(%rsp), %rdx
callq 0x10b24
movq %rax, %r13
movq 0x48(%rsp), %rax
leaq 0x2060(%rsp), %rcx
cmpq %rcx, %rax
jb 0x18cb0
leaq 0x48(%rsp), %rdi
callq 0x112d0
movq 0x48(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%rsp)
movb $0x22, (%rax)
subq $0x1, 0x30(%rsp)
leaq 0x4215(%rip), %rbx      # 0x1cede
jb 0x18dbc
movb (%r13), %al
movzbl %al, %ecx
cmpl $0xc, %ecx
jle 0x18d4d
cmpl $0xd, %ecx
je 0x18d88
cmpl $0x5c, %ecx
je 0x18cee
cmpl $0x22, %ecx
jne 0x18d56
movq 0x48(%rsp), %rax
leaq 0x2060(%rsp), %rcx
cmpq %rcx, %rax
jb 0x18d0f
leaq 0x48(%rsp), %rdi
callq 0x112d0
movq 0x48(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%rsp)
movb $0x5c, (%rax)
movq 0x48(%rsp), %rax
leaq 0x2060(%rsp), %rcx
cmpq %rcx, %rax
jb 0x18d3c
leaq 0x48(%rsp), %rdi
callq 0x112d0
movq 0x48(%rsp), %rax
movb (%r13), %cl
leaq 0x1(%rax), %rdx
movq %rdx, 0x48(%rsp)
movb %cl, (%rax)
jmp 0x18dad
testl %ecx, %ecx
je 0x18d9b
cmpl $0xa, %ecx
je 0x18cee
movq 0x48(%rsp), %rcx
leaq 0x2060(%rsp), %rdx
cmpq %rdx, %rcx
jb 0x18d7b
leaq 0x48(%rsp), %rdi
callq 0x112d0
movb (%r13), %al
movq 0x48(%rsp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x48(%rsp)
movb %al, (%rcx)
jmp 0x18dad
movl $0x2, %edx
leaq 0x48(%rsp), %rdi
leaq 0x4142(%rip), %rsi      # 0x1cedb
jmp 0x18da8
movl $0x4, %edx
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x1122f
incq %r13
subq $0x1, 0x30(%rsp)
jae 0x18ccf
movq 0x48(%rsp), %rax
leaq 0x2060(%rsp), %rcx
cmpq %rcx, %rax
jb 0x18ddd
leaq 0x48(%rsp), %rdi
callq 0x112d0
movq 0x48(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x48(%rsp)
movb $0x22, (%rax)
jmp 0x18bf2
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
movq %r13, %rdx
jmp 0x18bb5
leaq 0x48(%rsp), %rdi
callq 0x112b2
movl $0x1, %eax
addq $0x2268, %rsp           # imm = 0x2268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsbl %al, %edx
leaq 0x403d(%rip), %rsi      # 0x1ce66
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x108d7
jmp 0x18e0d