// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/deps/lua/src/lua_struct.c
// Function: b_unpack
static int b_unpack (lua_State *L) {
  Header h;
  const char *fmt = luaL_checkstring(L, 1);
  size_t ld;
  const char *data = luaL_checklstring(L, 2, &ld);
  size_t pos = luaL_optinteger(L, 3, 1) - 1;
  defaultoptions(&h);
  lua_settop(L, 2);
  while (*fmt) {
    int opt = *fmt++;
    size_t size = optsize(L, opt, &fmt);
    pos += gettoalign(pos, &h, opt, size);
    luaL_argcheck(L, pos+size <= ld, 2, "data string too short");
    luaL_checkstack(L, 1, "too many results");
    switch (opt) {
      case 'b': case 'B': case 'h': case 'H':
      case 'l': case 'L': case 'T': case 'i':  case 'I': {  /* integer types */
        int issigned = islower(opt);
        lua_Number res = getinteger(data+pos, h.endian, issigned, size);
        lua_pushnumber(L, res);
        break;
      }
      case 'x': {
        break;
      }
      case 'f': {
        float f;
        memcpy(&f, data+pos, size);
        correctbytes((char *)&f, sizeof(f), h.endian);
        lua_pushnumber(L, f);
        break;
      }
      case 'd': {
        double d;
        memcpy(&d, data+pos, size);
        correctbytes((char *)&d, sizeof(d), h.endian);
        lua_pushnumber(L, d);
        break;
      }
      case 'c': {
        if (size == 0) {
          if (!lua_isnumber(L, -1))
            luaL_error(L, "format `c0' needs a previous size");
          size = lua_tonumber(L, -1);
          lua_pop(L, 1);
          luaL_argcheck(L, pos+size <= ld, 2, "data string too short");
        }
        lua_pushlstring(L, data+pos, size);
        break;
      }
      case 's': {
        const char *e = (const char *)memchr(data+pos, '\0', ld - pos);
        if (e == NULL)
          luaL_error(L, "unfinished string in data");
        size = (e - (data+pos)) + 1;
        lua_pushlstring(L, data+pos, size - 1);
        break;
      }
      default: controloptions(L, opt, &fmt, &h);
    }
    pos += size;
  }
  lua_pushinteger(L, pos + 1);
  return lua_gettop(L) - 2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
callq 0x91394
movq %rax, %r12
leaq 0x18(%rsp), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x91394
movq %rax, 0x8(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x9162c
movq %rax, %rbp
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x85d59
movb (%r12), %r14b
testb %r14b, %r14b
je 0x98ed7
decq %rbp
incq %r12
movq %r12, 0x20(%rsp)
movsbl %r14b, %r13d
movq %rbx, %rdi
movl %r13d, %esi
leaq 0x20(%rsp), %rdx
callq 0x99012
movq %rax, %r12
testq %rax, %rax
sete %al
cmpb $0x63, %r13b
sete %cl
orb %al, %cl
je 0x98bcc
xorl %r15d, %r15d
jmp 0x98be6
movslq 0x14(%rsp), %rax
cmpq %r12, %rax
cmovaeq %r12, %rax
leal -0x1(%rax), %ecx
movl %ebp, %edx
andl %ecx, %edx
subl %edx, %eax
andl %ecx, %eax
movslq %eax, %r15
addq %rbp, %r15
leaq (%r15,%r12), %rax
cmpq 0x18(%rsp), %rax
jbe 0x98c08
movq %rbx, %rdi
movl $0x2, %esi
leaq 0x39188(%rip), %rdx     # 0xd1d8b
callq 0x91090
movq %rbx, %rdi
movl $0x1, %esi
leaq 0x3918a(%rip), %rdx     # 0xd1da1
callq 0x914b9
movzbl %r14b, %ebp
cmpl $0x53, %ebp
jle 0x98cd8
leal -0x62(%rbp), %eax
cmpl $0x11, %eax
ja 0x98dd4
leaq 0x3905c(%rip), %rcx     # 0xd1c98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testq %r12, %r12
jne 0x98cc4
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x86113
testl %eax, %eax
jne 0x98c6c
movq %rbx, %rdi
leaq 0x3914d(%rip), %rsi     # 0xd1db2
xorl %eax, %eax
callq 0x91147
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x86274
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x34d73(%rip), %xmm0    # 0xcda00
cvttsd2si %xmm0, %r12
andq %rcx, %r12
orq %rax, %r12
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x85d59
leaq (%r15,%r12), %rax
cmpq 0x18(%rsp), %rax
jbe 0x98cc4
movq %rbx, %rdi
movl $0x2, %esi
leaq 0x390cc(%rip), %rdx     # 0xd1d8b
callq 0x91090
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %rsi
movq %rbx, %rdi
movq %r12, %rdx
jmp 0x98e82
leal -0x48(%rbp), %eax
cmpl $0x2, %eax
jb 0x98cee
cmpl $0x42, %ebp
je 0x98cee
cmpl $0x4c, %ebp
jne 0x98de2
callq 0x26560
movq 0x8(%rsp), %rcx
addq %r15, %rcx
cmpl $0x0, 0x10(%rsp)
je 0x98d2c
testl %r12d, %r12d
jle 0x98d54
movl %r12d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
incq %rsi
xorl %edx, %edx
shlq $0x8, %rdx
movzbl -0x2(%rcx,%rsi), %edi
orq %rdi, %rdx
decq %rsi
cmpq $0x1, %rsi
ja 0x98d15
jmp 0x98d56
testl %r12d, %r12d
jle 0x98d54
movl %r12d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %edi, %edi
xorl %edx, %edx
shlq $0x8, %rdx
movzbl (%rcx,%rdi), %r8d
orq %r8, %rdx
incq %rdi
cmpq %rdi, %rsi
jne 0x98d3e
jmp 0x98d56
xorl %edx, %edx
movq (%rax), %rax
movzwl (%rax,%rbp,2), %eax
btl $0x9, %eax
jb 0x98d86
movq %rdx, %xmm1
punpckldq 0x29bf0(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x29bf8(%rip), %xmm1    # 0xc2970
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
jmp 0x98daf
leal (,%r12,8), %ecx
decb %cl
movq $-0x1, %rax
shlq %cl, %rax
movq %rdx, %rcx
andq %rax, %rcx
cmovneq %rax, %rcx
orq %rdx, %rcx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
movq %rbx, %rdi
callq 0x8649b
movq %r12, %rbp
addq %r15, %rbp
movq 0x20(%rsp), %r12
movb (%r12), %r14b
testb %r14b, %r14b
jne 0x98b97
jmp 0x98ed4
cmpl $0x78, %ebp
je 0x98db7
cmpl $0x54, %ebp
je 0x98cee
movq %rbx, %rdi
movl %r13d, %esi
leaq 0x20(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x990c5
jmp 0x98db7
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %rsi
movq %rsp, %rdi
movq %r12, %rdx
callq 0x26c50
cmpl $0x1, 0x10(%rsp)
je 0x98e34
movl $0x7, %eax
movq %rsp, %rcx
movb (%rcx), %dl
movb (%rsp,%rax), %sil
movb %sil, (%rcx)
movb %dl, (%rsp,%rax)
decq %rax
incq %rcx
cmpq $0x3, %rax
jne 0x98e1c
movsd (%rsp), %xmm0
jmp 0x98daf
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %r13
movq 0x18(%rsp), %rdx
subq %r15, %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x261f0
movq %rax, %rbp
testq %rax, %rax
jne 0x98e72
movq %rbx, %rdi
leaq 0x38f69(%rip), %rsi     # 0xd1dd4
xorl %eax, %eax
callq 0x91147
subq %r13, %rbp
leaq 0x1(%rbp), %r12
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x864ca
jmp 0x98db7
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %rsi
movq %rsp, %rdi
movq %r12, %rdx
callq 0x26c50
cmpl $0x1, 0x10(%rsp)
je 0x98ec7
movl $0x3, %eax
movq %rsp, %rcx
movb (%rcx), %dl
movb (%rsp,%rax), %sil
movb %sil, (%rcx)
movb %dl, (%rsp,%rax)
decq %rax
incq %rcx
cmpq $0x1, %rax
jne 0x98eaf
xorps %xmm0, %xmm0
cvtss2sd (%rsp), %xmm0
jmp 0x98daf
incq %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x864b0
movq %rbx, %rdi
callq 0x85d4c
addl $-0x2, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq