// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %rdi, %rbx
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x8293c
movq %rax, %r15
pushq $0x2
popq %rbp
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8293c
movq %rax, %r14
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x82bb5
movq %rax, %r12
decq %r12
movabsq $0x100000001, %rax      # imm = 0x100000001
leaq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x78478
movq %r14, 0x8(%rsp)
leaq -0x1(%r14), %rax
movq %rax, 0x30(%rsp)
movsbl (%r15), %ebp
testl %ebp, %ebp
je 0x89c51
incq %r15
movq %r15, 0x28(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x28(%rsp), %rdx
callq 0x89d82
movq %rax, %r14
testq %rax, %rax
sete %al
cmpb $0x63, %bpl
sete %cl
orb %al, %cl
je 0x899a3
xorl %r13d, %r13d
jmp 0x899be
movslq 0x14(%rsp), %rax
cmpq %r14, %rax
cmovaeq %r14, %rax
leal -0x1(%rax), %ecx
movl %r12d, %edx
andl %ecx, %edx
subl %edx, %eax
andl %ecx, %eax
movslq %eax, %r13
addq %r12, %r13
leaq (%r14,%r13), %rax
cmpq 0x20(%rsp), %rax
jbe 0x899de
movq %rbx, %rdi
pushq $0x2
popq %rsi
leaq 0x38e76(%rip), %rdx     # 0xc284f
callq 0x82650
movq %rbx, %rdi
pushq $0x1
popq %rsi
leaq 0x38e7a(%rip), %rdx     # 0xc2865
callq 0x82a46
movzbl %bpl, %eax
leal -0x62(%rax), %ecx
cmpl $0x11, %ecx
ja 0x89a9c
leaq 0x38d55(%rip), %rdx     # 0xc275c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
testq %r14, %r14
pushq $-0x1
popq %rbp
jne 0x89a88
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7870f
testl %eax, %eax
jne 0x89a37
movq %rbx, %rdi
leaq 0x38e46(%rip), %rsi     # 0xc2876
xorl %eax, %eax
callq 0x82707
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7885f
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x34b53(%rip), %xmm0    # 0xbe5a8
cvttsd2si %xmm0, %r14
andq %rcx, %r14
orq %rax, %r14
movq %rbx, %rdi
pushq $-0x2
popq %rsi
callq 0x78478
leaq (%r14,%r13), %rax
cmpq 0x20(%rsp), %rax
jbe 0x89a88
movq %rbx, %rdi
pushq $0x2
popq %rsi
leaq 0x38dcc(%rip), %rdx     # 0xc284f
callq 0x82650
movq 0x8(%rsp), %rax
leaq (%rax,%r13), %rsi
movq %rbx, %rdi
movq %r14, %rdx
jmp 0x89c14
leal -0x48(%rax), %ecx
cmpl $0x2, %ecx
jb 0x89ac0
cmpl $0x42, %eax
je 0x89ac0
cmpl $0x4c, %eax
je 0x89ac0
cmpl $0x78, %eax
je 0x89b79
cmpl $0x54, %eax
jne 0x89b89
callq 0x26560
cmpl $0x0, 0x10(%rsp)
je 0x89aee
movl %r14d, %ecx
movq 0x30(%rsp), %rdx
leaq (%rdx,%r13), %rsi
xorl %edx, %edx
testl %ecx, %ecx
jle 0x89b1c
shlq $0x8, %rdx
movzbl (%rsi,%rcx), %edi
decq %rcx
orq %rdi, %rdx
jmp 0x89ada
movq 0x8(%rsp), %rcx
addq %r13, %rcx
testl %r14d, %r14d
movl $0x0, %esi
cmovgl %r14d, %esi
xorl %edi, %edi
xorl %edx, %edx
cmpq %rdi, %rsi
je 0x89b1c
shlq $0x8, %rdx
movzbl (%rcx,%rdi), %r8d
orq %r8, %rdx
incq %rdi
jmp 0x89b06
movslq %ebp, %rcx
movq (%rax), %rax
movzwl (%rax,%rcx,2), %eax
btl $0x9, %eax
jb 0x89b4f
movq %rdx, %xmm1
punpckldq 0x2a4e7(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2a4ef(%rip), %xmm1    # 0xb4030
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
jmp 0x89b71
leal (,%r14,8), %ecx
decb %cl
pushq $-0x1
popq %rax
shlq %cl, %rax
movq %rdx, %rcx
andq %rax, %rcx
cmovneq %rax, %rcx
orq %rdx, %rcx
cvtsi2sd %rcx, %xmm0
movq %rbx, %rdi
callq 0x78a66
addq %r13, %r14
movq 0x28(%rsp), %r15
movq %r14, %r12
jmp 0x89967
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x28(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x89e46
jmp 0x89b79
movq 0x8(%rsp), %rax
leaq (%rax,%r13), %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0x26c50
movl 0x10(%rsp), %edx
movq %r15, %rdi
pushq $0x8
popq %rsi
callq 0x89e1d
movsd 0x18(%rsp), %xmm0
jmp 0x89b71
movq 0x8(%rsp), %rax
leaq (%rax,%r13), %r15
movq 0x20(%rsp), %rdx
subq %r13, %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x261f0
movq %rax, %r12
testq %rax, %rax
jne 0x89c03
movq %rbx, %rdi
leaq 0x38c9c(%rip), %rsi     # 0xc2898
xorl %eax, %eax
callq 0x82707
subq %r15, %r12
leaq 0x1(%r12), %r14
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x78a95
jmp 0x89b79
movq 0x8(%rsp), %rax
leaq (%rax,%r13), %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0x26c50
movl 0x10(%rsp), %edx
movq %r15, %rdi
pushq $0x4
popq %rsi
callq 0x89e1d
cvtss2sd 0x18(%rsp), %xmm0
jmp 0x89b71
incq %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x78a7b
movq %rbx, %rdi
callq 0x7846b
addl $-0x2, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq