// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x22d0, %rsp           # imm = 0x22D0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6a80
movl %eax, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
leaq -0x20(%rbp), %rdx
callq 0x1abe0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x2048(%rbp), %rsi
callq 0x1b530
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x26b7a
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
je 0x2684e
movq -0x2048(%rbp), %rcx
leaq -0x2048(%rbp), %rdx
addq $0x18, %rdx
addq $0x2000, %rdx           # imm = 0x2000
movb $0x1, %al
cmpq %rdx, %rcx
movb %al, -0x2271(%rbp)
jb 0x2681b
leaq -0x2048(%rbp), %rdi
callq 0x1b680
cmpq $0x0, %rax
setne %al
movb %al, -0x2271(%rbp)
movb -0x2271(%rbp), %al
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x2048(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x2048(%rbp)
movb %cl, (%rax)
jmp 0x26b75
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x25, %eax
jne 0x268d8
movq -0x2048(%rbp), %rcx
leaq -0x2048(%rbp), %rdx
addq $0x18, %rdx
addq $0x2000, %rdx           # imm = 0x2000
movb $0x1, %al
cmpq %rdx, %rcx
movb %al, -0x2272(%rbp)
jb 0x268a5
leaq -0x2048(%rbp), %rdi
callq 0x1b680
cmpq $0x0, %rax
setne %al
movb %al, -0x2272(%rbp)
movb -0x2272(%rbp), %al
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x2048(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x2048(%rbp)
movb %cl, (%rax)
jmp 0x26b73
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl -0x14(%rbp), %eax
jle 0x268f9
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
leaq 0x4a70(%rip), %rdx      # 0x2b364
callq 0x1a7b0
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x2060(%rbp), %rdx
callq 0x286c0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, -0x28(%rbp)
movsbl (%rax), %eax
addl $-0x45, %eax
movl %eax, %ecx
movq %rcx, -0x2280(%rbp)
subl $0x33, %eax
ja 0x26b24
movq -0x2280(%rbp), %rax
leaq 0x630b(%rip), %rcx      # 0x2cc50
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x2260(%rbp), %rax
movq %rax, -0x2290(%rbp)
leaq -0x2060(%rbp), %rax
movq %rax, -0x2288(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x1ae80
movq -0x2290(%rbp), %rdi
movq -0x2288(%rbp), %rsi
cvttsd2si %xmm0, %edx
movb $0x0, %al
callq 0x54c0
jmp 0x26b43
leaq -0x2060(%rbp), %rdi
callq 0x288a0
leaq -0x2260(%rbp), %rax
movq %rax, -0x22a0(%rbp)
leaq -0x2060(%rbp), %rax
movq %rax, -0x2298(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x1ae80
movq -0x22a0(%rbp), %rdi
movq -0x2298(%rbp), %rsi
cvttsd2si %xmm0, %rdx
movb $0x0, %al
callq 0x54c0
jmp 0x26b43
leaq -0x2060(%rbp), %rdi
movq %rdi, -0x22a8(%rbp)
callq 0x288a0
leaq -0x2260(%rbp), %rax
movq %rax, -0x22b0(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x1ae80
movq -0x22b0(%rbp), %rdi
movq -0x22a8(%rbp), %rsi
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rdx
movq %rdx, %rcx
sarq $0x3f, %rcx
movsd 0x620f(%rip), %xmm1     # 0x2cc48
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andq %rcx, %rax
orq %rax, %rdx
movb $0x0, %al
callq 0x54c0
jmp 0x26b43
leaq -0x2260(%rbp), %rax
movq %rax, -0x22c0(%rbp)
leaq -0x2060(%rbp), %rax
movq %rax, -0x22b8(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x1ae80
movq -0x22c0(%rbp), %rdi
movq -0x22b8(%rbp), %rsi
movb $0x1, %al
callq 0x54c0
jmp 0x26b43
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
leaq -0x2048(%rbp), %rsi
callq 0x28920
jmp 0x267c2
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
leaq -0x2268(%rbp), %rdx
callq 0x1abe0
movq %rax, -0x2270(%rbp)
leaq -0x2060(%rbp), %rdi
movl $0x2e, %esi
callq 0x5170
cmpq $0x0, %rax
jne 0x26b06
cmpq $0x64, -0x2268(%rbp)
jb 0x26b06
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x6f80
leaq -0x2048(%rbp), %rdi
callq 0x1b800
jmp 0x267c2
leaq -0x2260(%rbp), %rdi
leaq -0x2060(%rbp), %rsi
movq -0x2270(%rbp), %rdx
movb $0x0, %al
callq 0x54c0
jmp 0x26b43
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movsbl -0x1(%rax), %edx
leaq 0x64a3(%rip), %rsi      # 0x2cfda
movb $0x0, %al
callq 0x1a8b0
movl %eax, -0x4(%rbp)
jmp 0x26b8d
leaq -0x2260(%rbp), %rax
movq %rax, -0x22c8(%rbp)
leaq -0x2260(%rbp), %rdi
callq 0x5150
movq -0x22c8(%rbp), %rsi
movq %rax, %rdx
leaq -0x2048(%rbp), %rdi
callq 0x1b570
jmp 0x26b75
jmp 0x267c2
leaq -0x2048(%rbp), %rdi
callq 0x1b640
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x22d0, %rsp           # imm = 0x22D0
popq %rbp
retq
nopl (%rax)