// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/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 0x71043
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x71043
movq %rax, 0x8(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x712db
movq %rax, %rbp
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x660a2
movq 0x10(%rsp), %rax
movb (%rax), %r14b
testb %r14b, %r14b
je 0x78983
decq %rbp
incq %rax
movq %rax, 0x10(%rsp)
movsbl %r14b, %r12d
movq %rbx, %rdi
movl %r12d, %esi
leaq 0x10(%rsp), %rdx
callq 0x78aca
movq %rax, %r13
testq %rax, %rax
sete %al
cmpb $0x63, %r12b
sete %cl
orb %al, %cl
je 0x78676
xorl %r15d, %r15d
jmp 0x78690
movslq 0x1c(%rsp), %rax
cmpq %r13, %rax
cmovaeq %r13, %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,%r13), %rax
cmpq 0x20(%rsp), %rax
jbe 0x786b2
movq %rbx, %rdi
movl $0x2, %esi
leaq 0x2a03b(%rip), %rdx     # 0xa26e8
callq 0x70d3c
movq %rbx, %rdi
movl $0x1, %esi
leaq 0x2a03d(%rip), %rdx     # 0xa26fe
callq 0x71168
movzbl %r14b, %eax
cmpl $0x53, %eax
jle 0x78782
leal -0x62(%rax), %ecx
cmpl $0x11, %ecx
ja 0x78880
leaq 0x29f26(%rip), %rdx     # 0xa260c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
testq %r13, %r13
jne 0x7876e
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x66349
testl %eax, %eax
jne 0x78716
movq %rbx, %rdi
leaq 0x2a000(%rip), %rsi     # 0xa270f
xorl %eax, %eax
callq 0x70df6
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x664aa
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x27989(%rip), %xmm0    # 0xa00c0
cvttsd2si %xmm0, %r13
andq %rcx, %r13
orq %rax, %r13
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x660a2
leaq (%r15,%r13), %rax
cmpq 0x20(%rsp), %rax
jbe 0x7876e
movq %rbx, %rdi
movl $0x2, %esi
leaq 0x29f7f(%rip), %rdx     # 0xa26e8
callq 0x70d3c
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %rsi
movq %rbx, %rdi
movq %r13, %rdx
jmp 0x7892e
leal -0x48(%rax), %ecx
cmpl $0x2, %ecx
jb 0x78798
cmpl $0x42, %eax
je 0x78798
cmpl $0x4c, %eax
jne 0x7888e
callq 0x1f550
movq 0x8(%rsp), %rcx
addq %r15, %rcx
cmpl $0x0, 0x18(%rsp)
je 0x787d6
testl %r13d, %r13d
jle 0x787fe
movl %r13d, %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
jg 0x787bf
jmp 0x78800
testl %r13d, %r13d
jle 0x787fe
movl %r13d, %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 0x787e8
jmp 0x78800
xorl %edx, %edx
movq (%rax), %rax
movslq %r12d, %rcx
movzwl (%rax,%rcx,2), %eax
btl $0x9, %eax
jb 0x78833
movq %rdx, %xmm1
punpckldq 0x28743(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2874b(%rip), %xmm1    # 0xa0f70
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
jmp 0x7885c
leal (,%r13,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 0x666d1
movq %r13, %rbp
addq %r15, %rbp
movq 0x10(%rsp), %rax
movb (%rax), %r14b
testb %r14b, %r14b
jne 0x78641
jmp 0x78980
cmpl $0x78, %eax
je 0x78864
cmpl $0x54, %eax
je 0x78798
movq %rbx, %rdi
movl %r12d, %esi
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
callq 0x78b77
jmp 0x78864
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %rsi
movq %rsp, %rdi
movq %r13, %rdx
callq 0x1fbd0
cmpl $0x1, 0x18(%rsp)
je 0x788e0
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 0x788c8
movsd (%rsp), %xmm0
jmp 0x7885c
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %r12
movq 0x20(%rsp), %rdx
subq %r15, %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x1f1e0
movq %rax, %rbp
testq %rax, %rax
jne 0x7891e
movq %rbx, %rdi
leaq 0x29e1a(%rip), %rsi     # 0xa2731
xorl %eax, %eax
callq 0x70df6
subq %r12, %rbp
leaq 0x1(%rbp), %r13
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x66700
jmp 0x78864
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %rsi
movq %rsp, %rdi
movq %r13, %rdx
callq 0x1fbd0
cmpl $0x1, 0x18(%rsp)
je 0x78973
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 0x7895b
xorps %xmm0, %xmm0
cvtss2sd (%rsp), %xmm0
jmp 0x7885c
incq %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x666e6
movq %rbx, %rdi
callq 0x66095
addl $-0x2, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq