// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/lstrlib.c
// Function: unpackint
static lua_Integer unpackint (lua_State *L, const char *str,
                              int islittle, int size, int issigned) {
  lua_Unsigned res = 0;
  int i;
  int limit = (size  <= SZINT) ? size : SZINT;
  for (i = limit - 1; i >= 0; i--) {
    res <<= NB;
    res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i];
  }
  if (size < SZINT) {  /* real size smaller than lua_Integer? */
    if (issigned) {  /* needs sign extension? */
      lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1);
      res = ((res ^ mask) - mask);  /* do sign extension */
    }
  }
  else if (size > SZINT) {  /* must check unread bytes */
    int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC;
    for (i = limit; i < size; i++) {
      if ((unsigned char)str[islittle ? i : size - 1 - i] != mask)
        luaL_error(L, "%d-byte integer does not fit into Lua Integer", size);
    }
  }
  return (lua_Integer)res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
cmpl $0x8, -0x18(%rbp)
jg 0x30530
movl -0x18(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x3053a
movl $0x8, %eax
movl %eax, -0x40(%rbp)
jmp 0x3053a
movl -0x40(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x3059e
movq -0x28(%rbp), %rax
shlq $0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x30571
movl -0x2c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x3057d
movl -0x18(%rbp), %eax
subl $0x1, %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x30549
cmpl $0x8, -0x18(%rbp)
jge 0x305d8
cmpl $0x0, -0x1c(%rbp)
je 0x305d3
movl -0x18(%rbp), %eax
shll $0x3, %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
xorq -0x38(%rbp), %rax
subq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x30674
cmpl $0x8, -0x18(%rbp)
jle 0x30672
movb $0x1, %al
cmpl $0x0, -0x1c(%rbp)
movb %al, -0x4d(%rbp)
je 0x305f8
cmpq $0x0, -0x28(%rbp)
setge %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %dl
movl $0xff, %eax
xorl %ecx, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x30670
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x3062f
movl -0x2c(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0x3063b
movl -0x18(%rbp), %eax
subl $0x1, %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rax
movl -0x5c(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl -0x3c(%rbp), %eax
je 0x30663
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %edx
leaq 0x6c0a(%rip), %rsi      # 0x37266
movb $0x0, %al
callq 0x1fbf0
jmp 0x30665
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x30611
jmp 0x30672
jmp 0x30674
movq -0x28(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop