// File: /workspace/github_c_makefile_star2_O0/hermantb[P]fast_convert/fast_convert.c
// Function: fast_strtos32
int32_t
fast_strtos32 (const char *str, char **endptr, int base)
{
  uint32_t n;
  unsigned int sign = 0;
  unsigned char *cp = (unsigned char *) str;
#define	M(x)	(2147483647u / (x))
  static const uint32_t maxp[37] = {
    0, 0, M (2), M (3), M (4), M (5), M (6), M (7), M (8), M (9), M (10),
    M (11), M (12), M (13), M (14), M (15), M (16), M (17), M (18),
    M (19), M (20), M (21), M (22), M (23), M (24), M (25), M (26),
    M (27), M (28), M (29), M (30), M (31), M (32), M (33), M (34),
    M (35), M (36)
  };
#undef M
#define	M(x)	(2147483648u / (x))
  static const uint32_t maxn[37] = {
    0, 0, M (2), M (3), M (4), M (5), M (6), M (7), M (8), M (9), M (10),
    M (11), M (12), M (13), M (14), M (15), M (16), M (17), M (18),
    M (19), M (20), M (21), M (22), M (23), M (24), M (25), M (26),
    M (27), M (28), M (29), M (30), M (31), M (32), M (33), M (34),
    M (35), M (36)
  };
#undef M
#define	R(x)	(2147483647u % (x))
  static const uint32_t remp[37] = {
    0, 0, R (2), R (3), R (4), R (5), R (6), R (7), R (8), R (9), R (10),
    R (11), R (12), R (13), R (14), R (15), R (16), R (17), R (18),
    R (19), R (20), R (21), R (22), R (23), R (24), R (25), R (26),
    R (27), R (28), R (29), R (30), R (31), R (32), R (33), R (34),
    R (35), R (36)
  };
#undef R
#define	R(x)	(2147483648u % (x))
  static const uint32_t remn[37] = {
    0, 0, R (2), R (3), R (4), R (5), R (6), R (7), R (8), R (9), R (10),
    R (11), R (12), R (13), R (14), R (15), R (16), R (17), R (18),
    R (19), R (20), R (21), R (22), R (23), R (24), R (25), R (26),
    R (27), R (28), R (29), R (30), R (31), R (32), R (33), R (34),
    R (35), R (36)
  };
#undef R

  while (isspace (*cp)) {
    cp++;
  }
  if (*cp == '+') {
    cp++;
  }
  else if (*cp == '-') {
    sign = 1;
    cp++;
  }
  n = 0;
  if (UNLIKELY (base) &&
      (base != 10 || *cp < '1') &&
      (base != 8 || *cp != '0' || cp[1] < '0' || cp[1] > '7') &&
      (base != 16 || *cp != '0' || (cp[1] != 'x' && cp[1] != 'X'))) {
    if (base >= 2 && base <= 36) {
      uint32_t max = sign ? maxn[base] : maxp[base];
      uint32_t rem = sign ? remn[base] : remp[base];

      if (base <= 10) {
	unsigned char u = *cp;
	unsigned char end = '0' + base;

	if (u >= '0' && u < end) {
	  do {
	    uint32_t v = convert_num[u];

	    if (UNLIKELY (n >= max) && (n > max || (n == max && v > rem))) {
	      break;
	    }
	    n = n * base + v;
	    u = *++cp;
	  } while (u >= '0' && u < end);
	}
	else {
	  cp = (unsigned char *) str;
	}
      }
      else {
	unsigned char u = uppercase[*cp];
	unsigned char end = 'A' + base - 10;

	if (valid_num[u] && u < end) {
	  do {
	    uint32_t v = convert_num[u];

	    if (UNLIKELY (n >= max) && (n > max || (n == max && v > rem))) {
	      break;
	    }
	    n = n * base + v;
	    u = uppercase[*++cp];
	  } while (valid_num[u] && u < end);
	}
	else {
	  cp = (unsigned char *) str;
	}
      }
    }
    else {
      cp = (unsigned char *) str;
    }
  }
  else if (*cp == '0') {
    cp++;
    if ((*cp == 'x' || *cp == 'X') && isxdigit (cp[1])) {
      uint32_t max = sign ? maxn[16] : maxp[16];
      uint32_t rem = sign ? remn[16] : remp[16];
      unsigned char u = *++cp;

      do {
	uint32_t v = convert_num[u];

	if (UNLIKELY (n >= max) && (n > max || (n == max && v > rem))) {
	  break;
	}
	n = n * 16 + v;
	u = *++cp;
      } while (isxdigit (u));
    }
    else {
      uint32_t max = sign ? maxn[8] : maxp[8];
      uint32_t rem = sign ? remn[8] : remp[8];
      unsigned char u = *cp;

      while (u >= '0' && u <= '7') {
	uint32_t v = convert_num[u];

	if (UNLIKELY (n >= max) && (n > max || (n == max && v > rem))) {
	  break;
	}
	n = n * 8 + v;
	u = *++cp;
      }
    }
  }
  else if (isdigit (*cp)) {
    uint32_t max = sign ? maxn[10] : maxp[10];
    uint32_t rem = sign ? remn[10] : remp[10];
    unsigned char u = *cp;

    do {
      uint32_t v = convert_num[u];

      if (UNLIKELY (n >= max) && (n > max || (n == max && v > rem))) {
	break;
      }
      n = n * 10 + v;
      u = *++cp;
    } while (isdigit (u));
  }
  else {
    cp = (unsigned char *) str;
  }
  if (endptr) {
    *endptr = (char *) cp;
  }
  return sign ? -(int32_t) n : (int32_t) n;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movl %edx, 0x74(%rsp)
movl $0x0, 0x6c(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x60(%rsp)
callq 0x1160
movq (%rax), %rax
movq 0x60(%rsp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x561e
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x55ed
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x563b
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x5660
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x565e
movl $0x1, 0x6c(%rsp)
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x5660
movl $0x0, 0x70(%rsp)
movslq 0x74(%rsp), %rax
cmpq $0x0, %rax
je 0x59ae
cmpl $0xa, 0x74(%rsp)
jne 0x568f
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x31, %eax
jge 0x59ae
cmpl $0x8, 0x74(%rsp)
jne 0x56c3
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x30, %eax
jne 0x56c3
movq 0x60(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x30, %eax
jl 0x56c3
movq 0x60(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x37, %eax
jle 0x59ae
cmpl $0x10, 0x74(%rsp)
jne 0x56fb
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x30, %eax
jne 0x56fb
movq 0x60(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0x59ae
movq 0x60(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x58, %eax
je 0x59ae
cmpl $0x2, 0x74(%rsp)
jl 0x599c
cmpl $0x24, 0x74(%rsp)
jg 0x599c
cmpl $0x0, 0x6c(%rsp)
je 0x572d
movslq 0x74(%rsp), %rcx
leaq 0xd77c(%rip), %rax      # 0x12ea0
movl (%rax,%rcx,4), %eax
movl %eax, 0x14(%rsp)
jmp 0x5740
movslq 0x74(%rsp), %rcx
leaq 0xd6c7(%rip), %rax      # 0x12e00
movl (%rax,%rcx,4), %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x5c(%rsp)
cmpl $0x0, 0x6c(%rsp)
je 0x5764
movslq 0x74(%rsp), %rcx
leaq 0xd885(%rip), %rax      # 0x12fe0
movl (%rax,%rcx,4), %eax
movl %eax, 0x10(%rsp)
jmp 0x5777
movslq 0x74(%rsp), %rcx
leaq 0xd7d0(%rip), %rax      # 0x12f40
movl (%rax,%rcx,4), %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0x58(%rsp)
cmpl $0xa, 0x74(%rsp)
jg 0x587b
movq 0x60(%rsp), %rax
movb (%rax), %al
movb %al, 0x57(%rsp)
movl 0x74(%rsp), %eax
addl $0x30, %eax
movb %al, 0x56(%rsp)
movzbl 0x57(%rsp), %eax
cmpl $0x30, %eax
jl 0x5869
movzbl 0x57(%rsp), %eax
movzbl 0x56(%rsp), %ecx
cmpl %ecx, %eax
jge 0x5869
jmp 0x57c2
movzbl 0x57(%rsp), %eax
movl %eax, %ecx
leaq 0x1d910(%rip), %rax     # 0x230e0
movl (%rax,%rcx,4), %eax
movl %eax, 0x50(%rsp)
movl 0x70(%rsp), %eax
cmpl 0x5c(%rsp), %eax
setae %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x580f
movl 0x70(%rsp), %eax
cmpl 0x5c(%rsp), %eax
ja 0x580d
movl 0x70(%rsp), %eax
cmpl 0x5c(%rsp), %eax
jne 0x580f
movl 0x50(%rsp), %eax
cmpl 0x58(%rsp), %eax
jbe 0x580f
jmp 0x5867
movl 0x70(%rsp), %eax
imull 0x74(%rsp), %eax
addl 0x50(%rsp), %eax
movl %eax, 0x70(%rsp)
movq 0x60(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rsp)
movb 0x1(%rax), %al
movb %al, 0x57(%rsp)
movzbl 0x57(%rsp), %ecx
xorl %eax, %eax
cmpl $0x30, %ecx
movb %al, 0xf(%rsp)
jl 0x585b
movzbl 0x57(%rsp), %eax
movzbl 0x56(%rsp), %ecx
cmpl %ecx, %eax
setl %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x57c2
jmp 0x5876
movq 0x80(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x599a
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1da54(%rip), %rax     # 0x232e0
movb (%rax,%rcx), %al
movb %al, 0x4f(%rsp)
movl 0x74(%rsp), %eax
addl $0x41, %eax
subl $0xa, %eax
movb %al, 0x4e(%rsp)
movzbl 0x4f(%rsp), %eax
movl %eax, %ecx
leaq 0x1db91(%rip), %rax     # 0x23440
cmpl $0x0, (%rax,%rcx,4)
je 0x598b
movzbl 0x4f(%rsp), %eax
movzbl 0x4e(%rsp), %ecx
cmpl %ecx, %eax
jge 0x598b
jmp 0x58cd
movzbl 0x4f(%rsp), %eax
movl %eax, %ecx
leaq 0x1d805(%rip), %rax     # 0x230e0
movl (%rax,%rcx,4), %eax
movl %eax, 0x48(%rsp)
movl 0x70(%rsp), %eax
cmpl 0x5c(%rsp), %eax
setae %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x591a
movl 0x70(%rsp), %eax
cmpl 0x5c(%rsp), %eax
ja 0x5918
movl 0x70(%rsp), %eax
cmpl 0x5c(%rsp), %eax
jne 0x591a
movl 0x48(%rsp), %eax
cmpl 0x58(%rsp), %eax
jbe 0x591a
jmp 0x5989
movl 0x70(%rsp), %eax
imull 0x74(%rsp), %eax
addl 0x48(%rsp), %eax
movl %eax, 0x70(%rsp)
movq 0x60(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rsp)
movzbl 0x1(%rax), %eax
movl %eax, %ecx
leaq 0x1d997(%rip), %rax     # 0x232e0
movb (%rax,%rcx), %al
movb %al, 0x4f(%rsp)
movzbl 0x4f(%rsp), %eax
movl %eax, %edx
xorl %eax, %eax
leaq 0x1dae0(%rip), %rcx     # 0x23440
cmpl $0x0, (%rcx,%rdx,4)
movb %al, 0xe(%rsp)
je 0x597d
movzbl 0x4f(%rsp), %eax
movzbl 0x4e(%rsp), %ecx
cmpl %ecx, %eax
setl %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x58cd
jmp 0x5998
movq 0x80(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x599a
jmp 0x59a9
movq 0x80(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x5cdf
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x30, %eax
jne 0x5bd8
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x78, %eax
je 0x59eb
movq 0x60(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x58, %eax
jne 0x5af4
callq 0x1160
movq (%rax), %rax
movq 0x60(%rsp), %rcx
movzbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x5af4
movl 0x6c(%rsp), %ecx
movl 0xd4c5(%rip), %eax      # 0x12ee0
cmpl $0x0, %ecx
cmovel 0xd41b(%rip), %eax      # 0x12e40
movl %eax, 0x44(%rsp)
movl 0x6c(%rsp), %ecx
movl 0xd5ed(%rip), %eax      # 0x13020
cmpl $0x0, %ecx
cmovel 0xd543(%rip), %eax      # 0x12f80
movl %eax, 0x40(%rsp)
movq 0x60(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rsp)
movb 0x1(%rax), %al
movb %al, 0x3f(%rsp)
movzbl 0x3f(%rsp), %eax
movl %eax, %ecx
leaq 0x1d679(%rip), %rax     # 0x230e0
movl (%rax,%rcx,4), %eax
movl %eax, 0x38(%rsp)
movl 0x70(%rsp), %eax
cmpl 0x44(%rsp), %eax
setae %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5aa6
movl 0x70(%rsp), %eax
cmpl 0x44(%rsp), %eax
ja 0x5aa4
movl 0x70(%rsp), %eax
cmpl 0x44(%rsp), %eax
jne 0x5aa6
movl 0x38(%rsp), %eax
cmpl 0x40(%rsp), %eax
jbe 0x5aa6
jmp 0x5aef
movl 0x70(%rsp), %eax
shll $0x4, %eax
addl 0x38(%rsp), %eax
movl %eax, 0x70(%rsp)
movq 0x60(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rsp)
movb 0x1(%rax), %al
movb %al, 0x3f(%rsp)
callq 0x1160
movq (%rax), %rax
movzbl 0x3f(%rsp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
jne 0x5a59
jmp 0x5bd3
movl 0x6c(%rsp), %ecx
movl 0xd3c2(%rip), %eax      # 0x12ec0
cmpl $0x0, %ecx
cmovel 0xd318(%rip), %eax      # 0x12e20
movl %eax, 0x34(%rsp)
movl 0x6c(%rsp), %ecx
movl 0xd4ea(%rip), %eax      # 0x13000
cmpl $0x0, %ecx
cmovel 0xd440(%rip), %eax      # 0x12f60
movl %eax, 0x30(%rsp)
movq 0x60(%rsp), %rax
movb (%rax), %al
movb %al, 0x2f(%rsp)
movzbl 0x2f(%rsp), %ecx
xorl %eax, %eax
cmpl $0x30, %ecx
movb %al, 0xd(%rsp)
jl 0x5b4e
movzbl 0x2f(%rsp), %eax
cmpl $0x37, %eax
setle %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %al
testb $0x1, %al
jne 0x5b58
jmp 0x5bd1
movzbl 0x2f(%rsp), %eax
movl %eax, %ecx
leaq 0x1d57a(%rip), %rax     # 0x230e0
movl (%rax,%rcx,4), %eax
movl %eax, 0x28(%rsp)
movl 0x70(%rsp), %eax
cmpl 0x34(%rsp), %eax
setae %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5ba5
movl 0x70(%rsp), %eax
cmpl 0x34(%rsp), %eax
ja 0x5ba3
movl 0x70(%rsp), %eax
cmpl 0x34(%rsp), %eax
jne 0x5ba5
movl 0x28(%rsp), %eax
cmpl 0x30(%rsp), %eax
jbe 0x5ba5
jmp 0x5bd1
movl 0x70(%rsp), %eax
shll $0x3, %eax
addl 0x28(%rsp), %eax
movl %eax, 0x70(%rsp)
movq 0x60(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rsp)
movb 0x1(%rax), %al
movb %al, 0x2f(%rsp)
jmp 0x5b2f
jmp 0x5bd3
jmp 0x5cdd
callq 0x1160
movq (%rax), %rax
movq 0x60(%rsp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x5cce
movl 0x6c(%rsp), %ecx
movl 0xd2c1(%rip), %eax      # 0x12ec8
cmpl $0x0, %ecx
cmovel 0xd217(%rip), %eax      # 0x12e28
movl %eax, 0x24(%rsp)
movl 0x6c(%rsp), %ecx
movl 0xd3e9(%rip), %eax      # 0x13008
cmpl $0x0, %ecx
cmovel 0xd33f(%rip), %eax      # 0x12f68
movl %eax, 0x20(%rsp)
movq 0x60(%rsp), %rax
movb (%rax), %al
movb %al, 0x1f(%rsp)
movzbl 0x1f(%rsp), %eax
movl %eax, %ecx
leaq 0x1d49a(%rip), %rax     # 0x230e0
movl (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
movl 0x70(%rsp), %eax
cmpl 0x24(%rsp), %eax
setae %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5c85
movl 0x70(%rsp), %eax
cmpl 0x24(%rsp), %eax
ja 0x5c83
movl 0x70(%rsp), %eax
cmpl 0x24(%rsp), %eax
jne 0x5c85
movl 0x18(%rsp), %eax
cmpl 0x20(%rsp), %eax
jbe 0x5c85
jmp 0x5ccc
imull $0xa, 0x70(%rsp), %eax
addl 0x18(%rsp), %eax
movl %eax, 0x70(%rsp)
movq 0x60(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rsp)
movb 0x1(%rax), %al
movb %al, 0x1f(%rsp)
callq 0x1160
movq (%rax), %rax
movzbl 0x1f(%rsp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x5c38
jmp 0x5cdb
movq 0x80(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x5cdd
jmp 0x5cdf
cmpq $0x0, 0x78(%rsp)
je 0x5cf4
movq 0x60(%rsp), %rcx
movq 0x78(%rsp), %rax
movq %rcx, (%rax)
cmpl $0x0, 0x6c(%rsp)
je 0x5d07
xorl %eax, %eax
subl 0x70(%rsp), %eax
movl %eax, 0x8(%rsp)
jmp 0x5d0f
movl 0x70(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
addq $0x88, %rsp
retq
nopl (%rax,%rax)