// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3GetInt32
SQLITE_PRIVATE int sqlite3GetInt32(const char *zNum, int *pValue){
  sqlite_int64 v = 0;
  int i, c;
  int neg = 0;
  if( zNum[0]=='-' ){
    neg = 1;
    zNum++;
  }else if( zNum[0]=='+' ){
    zNum++;
  }
#ifndef SQLITE_OMIT_HEX_INTEGER
  else if( zNum[0]=='0'
        && (zNum[1]=='x' || zNum[1]=='X')
        && sqlite3Isxdigit(zNum[2])
  ){
    u32 u = 0;
    zNum += 2;
    while( zNum[0]=='0' ) zNum++;
    for(i=0; sqlite3Isxdigit(zNum[i]) && i<8; i++){
      u = u*16 + sqlite3HexToInt(zNum[i]);
    }
    if( (u&0x80000000)==0 && sqlite3Isxdigit(zNum[i])==0 ){
      memcpy(pValue, &u, 4);
      return 1;
    }else{
      return 0;
    }
  }
#endif
  if( !sqlite3Isdigit(zNum[0]) ) return 0;
  while( zNum[0]=='0' ) zNum++;
  for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
    v = v*10 + c;
  }

  /* The longest decimal representation of a 32 bit integer is 10 digits:
  **
  **             1234567890
  **     2^31 -> 2147483648
  */
  testcase( i==10 );
  if( i>10 ){
    return 0;
  }
  testcase( v-neg==2147483647 );
  if( v-neg>2147483647 ){
    return 0;
  }
  if( neg ){
    v = -v;
  }
  *pValue = (int)v;
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x40c343
movl $0x1, -0x2c(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x40c4a1
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x40c360
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x40c49f
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x40c49d
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0x40c38e
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0x40c49d
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
movl %eax, %ecx
leaq 0x19a831(%rip), %rax    # 0x5a6bd0
movzbl (%rax,%rcx), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x40c49d
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x40c3dc
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x40c3c2
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x19a7d8(%rip), %rax    # 0x5a6bd0
movzbl (%rax,%rcx), %ecx
andl $0x8, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x31(%rbp)
je 0x40c413
cmpl $0x8, -0x24(%rbp)
setl %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x40c41c
jmp 0x40c44e
movl -0x30(%rbp), %eax
shll $0x4, %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x40c5a0
movb %al, %cl
movl -0x38(%rbp), %eax
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x30(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x40c3e3
movl -0x30(%rbp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
jne 0x40c491
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x19a760(%rip), %rax    # 0x5a6bd0
movzbl (%rax,%rcx), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x40c491
movq -0x18(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x40c58f
movl $0x0, -0x4(%rbp)
jmp 0x40c58f
jmp 0x40c49f
jmp 0x40c4a1
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x19a71f(%rip), %rax    # 0x5a6bd0
movzbl (%rax,%rcx), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x40c4c9
movl $0x0, -0x4(%rbp)
jmp 0x40c58f
jmp 0x40c4cb
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x40c4e5
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x40c4cb
movl $0x0, -0x24(%rbp)
xorl %eax, %eax
cmpl $0xb, -0x24(%rbp)
movb %al, -0x39(%rbp)
jge 0x40c51d
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
subl $0x30, %ecx
movl %ecx, -0x28(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
jl 0x40c51d
cmpl $0x9, -0x28(%rbp)
setle %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x40c526
jmp 0x40c541
imulq $0xa, -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x40c4ec
cmpl $0xa, -0x24(%rbp)
jle 0x40c550
movl $0x0, -0x4(%rbp)
jmp 0x40c58f
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
subq %rcx, %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jle 0x40c56c
movl $0x0, -0x4(%rbp)
jmp 0x40c58f
cmpl $0x0, -0x2c(%rbp)
je 0x40c57c
xorl %eax, %eax
subq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)