// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0xc06a0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq -0x20(%rbp), %rdx
callq 0xc06a0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3, %esi
movl $0x1, %edx
callq 0xc0a50
subq $0x1, %rax
movq %rax, -0x30(%rbp)
movsbl 0x80937(%rip), %eax     # 0x14be84
movl %eax, -0x10(%rbp)
movl $0x1, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0xac570
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0xcb83e
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movsbl (%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %eax
leaq -0x18(%rbp), %rdx
movsbl %al, %esi
callq 0xcb9a0
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
movl -0x34(%rbp), %edx
movq -0x40(%rbp), %rcx
leaq -0x10(%rbp), %rsi
callq 0xcbaa0
cltq
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
addq -0x40(%rbp), %rcx
movb $0x1, %al
cmpq -0x20(%rbp), %rcx
movb %al, -0x69(%rbp)
jbe 0xcb5ed
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x80928(%rip), %rdx     # 0x14bf07
callq 0xc0270
cmpl $0x0, %eax
setne %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
movq -0x8(%rbp), %rdi
leaq 0x80922(%rip), %rdx     # 0x14bf1d
movl $0x1, %esi
callq 0xc0830
movl -0x34(%rbp), %eax
addl $-0x42, %eax
movl %eax, %ecx
movq %rcx, -0x78(%rbp)
subl $0x36, %eax
ja 0xcb819
movq -0x78(%rbp), %rax
leaq 0x8062b(%rip), %rcx     # 0x14bc50
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x26550
movq (%rax), %rax
movslq -0x34(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x200, %eax            # imm = 0x200
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rdi
addq -0x30(%rbp), %rdi
movl -0x10(%rbp), %esi
movl -0x44(%rbp), %edx
movq -0x40(%rbp), %rax
movl %eax, %ecx
callq 0xcbe60
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movsd -0x50(%rbp), %xmm0
callq 0xad2f0
jmp 0xcb82d
jmp 0xcb82d
movq -0x28(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x54(%rbp), %rdi
callq 0x26c60
movl -0x10(%rbp), %edx
leaq -0x54(%rbp), %rdi
movl $0x4, %esi
callq 0xcbc20
movq -0x8(%rbp), %rdi
movss -0x54(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0xad2f0
jmp 0xcb82d
movq -0x28(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x26c60
movl -0x10(%rbp), %edx
leaq -0x60(%rbp), %rdi
movl $0x8, %esi
callq 0xcbc20
movq -0x8(%rbp), %rdi
movsd -0x60(%rbp), %xmm0
callq 0xad2f0
jmp 0xcb82d
cmpq $0x0, -0x40(%rbp)
jne 0xcb79c
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xacb80
cmpl $0x0, %eax
jne 0xcb722
movq -0x8(%rbp), %rdi
leaq 0x80813(%rip), %rsi     # 0x14bf2e
movb $0x0, %al
callq 0xc0370
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xace10
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x7c051(%rip), %xmm1    # 0x147798
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xac570
movq -0x30(%rbp), %rcx
addq -0x40(%rbp), %rcx
movb $0x1, %al
cmpq -0x20(%rbp), %rcx
movb %al, -0x79(%rbp)
jbe 0xcb799
movq -0x8(%rbp), %rdi
movl $0x2, %esi
leaq 0x8077c(%rip), %rdx     # 0x14bf07
callq 0xc0270
cmpl $0x0, %eax
setne %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0xad390
jmp 0xcb82d
movq -0x28(%rbp), %rdi
addq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rdx
subq -0x30(%rbp), %rdx
xorl %esi, %esi
callq 0x261f0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0xcb7e7
movq -0x8(%rbp), %rdi
leaq 0x80770(%rip), %rsi     # 0x14bf50
movb $0x0, %al
callq 0xc0370
movq -0x68(%rbp), %rax
movq -0x28(%rbp), %rcx
addq -0x30(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
subq $0x1, %rdx
callq 0xad390
jmp 0xcb82d
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
leaq -0x18(%rbp), %rdx
leaq -0x10(%rbp), %rcx
callq 0xcbca0
movq -0x40(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xcb565
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x1, %rsi
callq 0xad340
movq -0x8(%rbp), %rdi
callq 0xac540
subl $0x2, %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)