// File: /workspace/github_c_makefile_star2_O3/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv4/ip4_addr.c
// Function: ip4addr_aton
int
ip4addr_aton(const char *cp, ip4_addr_t *addr)
{
  u32_t val;
  u8_t base;
  char c;
  u32_t parts[4];
  u32_t *pp = parts;

  c = *cp;
  for (;;) {
    /*
     * Collect number up to ``.''.
     * Values are specified as for C:
     * 0x=hex, 0=octal, 1-9=decimal.
     */
    if (!lwip_isdigit(c)) {
      return 0;
    }
    val = 0;
    base = 10;
    if (c == '0') {
      c = *++cp;
      if (c == 'x' || c == 'X') {
        base = 16;
        c = *++cp;
      } else {
        base = 8;
      }
    }
    for (;;) {
      if (lwip_isdigit(c)) {
        val = (val * base) + (u32_t)(c - '0');
        c = *++cp;
      } else if (base == 16 && lwip_isxdigit(c)) {
        val = (val << 4) | (u32_t)(c + 10 - (lwip_islower(c) ? 'a' : 'A'));
        c = *++cp;
      } else {
        break;
      }
    }
    if (c == '.') {
      /*
       * Internet format:
       *  a.b.c.d
       *  a.b.c   (with c treated as 16 bits)
       *  a.b (with b treated as 24 bits)
       */
      if (pp >= parts + 3) {
        return 0;
      }
      *pp++ = val;
      c = *++cp;
    } else {
      break;
    }
  }
  /*
   * Check for trailing characters.
   */
  if (c != '\0' && !lwip_isspace(c)) {
    return 0;
  }
  /*
   * Concoct the address according to
   * the number of parts specified.
   */
  switch (pp - parts + 1) {

    case 0:
      return 0;       /* initial nondigit */

    case 1:             /* a -- 32 bits */
      break;

    case 2:             /* a.b -- 8.24 bits */
      if (val > 0xffffffUL) {
        return 0;
      }
      if (parts[0] > 0xff) {
        return 0;
      }
      val |= parts[0] << 24;
      break;

    case 3:             /* a.b.c -- 8.8.16 bits */
      if (val > 0xffff) {
        return 0;
      }
      if ((parts[0] > 0xff) || (parts[1] > 0xff)) {
        return 0;
      }
      val |= (parts[0] << 24) | (parts[1] << 16);
      break;

    case 4:             /* a.b.c.d -- 8.8.8.8 bits */
      if (val > 0xff) {
        return 0;
      }
      if ((parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff)) {
        return 0;
      }
      val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
      break;
    default:
      LWIP_ASSERT("unhandled", 0);
      break;
  }
  if (addr) {
    ip4_addr_set_u32(addr, lwip_htonl(val));
  }
  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2250
movq (%rax), %rcx
movzbl (%r14), %edx
testb $0x8, 0x1(%rcx,%rdx,2)
jne 0xe6a1
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
xorl %ebp, %ebp
movl $0xa, %r8d
movb $0x1, %sil
cmpb $0x30, %dl
jne 0xe6de
movb 0x1(%r14), %dl
movl %edx, %edi
andb $-0x21, %dil
cmpb $0x58, %dil
jne 0xe6d5
movb 0x2(%r14), %dl
addq $0x2, %r14
movl $0x10, %r8d
xorl %esi, %esi
jmp 0xe6de
incq %r14
movl $0x8, %r8d
incq %r14
xorl %edi, %edi
movzbl %dl, %r10d
movzwl (%rcx,%r10,2), %r9d
btl $0xb, %r9d
jb 0xe723
btl $0xc, %r9d
setae %r11b
orb %sil, %r11b
jne 0xe737
shll $0x4, %edi
movsbl %dl, %edx
xorl %r10d, %r10d
btl $0x9, %r9d
setae %r10b
shll $0x5, %r10d
addl %r10d, %edx
addl $-0x57, %edx
orl %edi, %edx
movl %edx, %edi
jmp 0xe72f
imull %r8d, %edi
movsbl %dl, %edx
addl %edx, %edi
addl $-0x30, %edi
movb (%r14), %dl
incq %r14
jmp 0xe6e3
cmpb $0x2e, %dl
jne 0xe761
cmpq $0xb, %rax
ja 0xe696
movl %edi, (%rsp,%rax)
addq $0x4, %rax
movzbl (%r14), %edx
testb $0x8, 0x1(%rcx,%rdx,2)
jne 0xe6a5
jmp 0xe696
testl %r10d, %r10d
je 0xe771
btl $0xd, %r9d
jae 0xe694
shrq $0x2, %rax
cmpq $0x3, %rax
ja 0xe852
leaq 0x7bca(%rip), %rcx      # 0x16350
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebp, %ebp
cmpl $0xffffff, %edi         # imm = 0xFFFFFF
ja 0xe696
movl (%rsp), %eax
cmpl $0xff, %eax
ja 0xe696
shll $0x18, %eax
jmp 0xe7e6
xorl %ebp, %ebp
cmpl $0xffff, %edi           # imm = 0xFFFF
ja 0xe696
movl (%rsp), %ecx
movl 0x4(%rsp), %eax
movl $0x100, %edx            # imm = 0x100
cmpl %edx, %ecx
setae %sil
cmpl %edx, %eax
setae %dl
orb %sil, %dl
jne 0xe696
shll $0x18, %ecx
shll $0x10, %eax
orl %ecx, %eax
orl %edi, %eax
movl %eax, %edi
jmp 0xe838
xorl %ebp, %ebp
cmpl $0xff, %edi
ja 0xe696
movl (%rsp), %ecx
movl 0x4(%rsp), %eax
movl $0x100, %esi            # imm = 0x100
cmpl %esi, %ecx
setae %dl
cmpl %esi, %eax
setae %r8b
orb %dl, %r8b
movl 0x8(%rsp), %edx
cmpl %esi, %edx
setae %sil
orb %r8b, %sil
jne 0xe696
shll $0x18, %ecx
shll $0x10, %eax
orl %ecx, %eax
shll $0x8, %edx
orl %edi, %edx
orl %eax, %edx
movl %edx, %edi
movl $0x1, %ebp
testq %rbx, %rbx
je 0xe696
callq 0x135bb
movl %eax, (%rbx)
jmp 0xe696
leaq 0x5a73(%rip), %rdi      # 0x142cc
leaq 0x7b30(%rip), %rsi      # 0x16390
leaq 0x7b33(%rip), %rcx      # 0x1639a
movl $0xf9, %edx
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050