// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movb (%rax), %al
movb %al, -0x1e(%rbp)
callq 0x2250
movq (%rax), %rax
movzbl -0x1e(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x1a2ea
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
movl $0x0, -0x1c(%rbp)
movb $0xa, -0x1d(%rbp)
movsbl -0x1e(%rbp), %eax
cmpl $0x30, %eax
jne 0x1a346
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb 0x1(%rax), %al
movb %al, -0x1e(%rbp)
movsbl -0x1e(%rbp), %eax
cmpl $0x78, %eax
je 0x1a325
movsbl -0x1e(%rbp), %eax
cmpl $0x58, %eax
jne 0x1a340
movb $0x10, -0x1d(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb 0x1(%rax), %al
movb %al, -0x1e(%rbp)
jmp 0x1a344
movb $0x8, -0x1d(%rbp)
jmp 0x1a346
jmp 0x1a348
callq 0x2250
movq (%rax), %rax
movzbl -0x1e(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x1a395
movl -0x1c(%rbp), %eax
movzbl -0x1d(%rbp), %ecx
imull %ecx, %eax
movsbl -0x1e(%rbp), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb 0x1(%rax), %al
movb %al, -0x1e(%rbp)
jmp 0x1a426
movzbl -0x1d(%rbp), %eax
cmpl $0x10, %eax
jne 0x1a422
callq 0x2250
movq (%rax), %rax
movzbl -0x1e(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x1a422
movl -0x1c(%rbp), %eax
shll $0x4, %eax
movl %eax, -0x3c(%rbp)
movsbl -0x1e(%rbp), %eax
addl $0xa, %eax
movl %eax, -0x40(%rbp)
callq 0x2250
movl -0x40(%rbp), %ecx
movq %rax, %rdx
movl -0x3c(%rbp), %eax
movq (%rdx), %rdx
movzbl -0x1e(%rbp), %esi
movslq %esi, %rsi
movzwl (%rdx,%rsi,2), %edi
andl $0x200, %edi            # imm = 0x200
movl $0x41, %edx
movl $0x61, %esi
cmpl $0x0, %edi
cmovnel %esi, %edx
subl %edx, %ecx
orl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb 0x1(%rax), %al
movb %al, -0x1e(%rbp)
jmp 0x1a424
jmp 0x1a42b
jmp 0x1a426
jmp 0x1a348
movsbl -0x1e(%rbp), %eax
cmpl $0x2e, %eax
jne 0x1a47c
movq -0x38(%rbp), %rax
leaq -0x30(%rbp), %rcx
addq $0xc, %rcx
cmpq %rcx, %rax
jb 0x1a451
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
movl -0x1c(%rbp), %ecx
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x38(%rbp)
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb 0x1(%rax), %al
movb %al, -0x1e(%rbp)
jmp 0x1a47e
jmp 0x1a483
jmp 0x1a2c1
movsbl -0x1e(%rbp), %eax
cmpl $0x0, %eax
je 0x1a4b5
callq 0x2250
movq (%rax), %rax
movzbl -0x1e(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x1a4b5
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
movq -0x38(%rbp), %rax
leaq -0x30(%rbp), %rcx
subq %rcx, %rax
sarq $0x2, %rax
incq %rax
movq %rax, -0x48(%rbp)
subq $0x4, %rax
ja 0x1a5da
movq -0x48(%rbp), %rax
leaq 0xf258(%rip), %rcx      # 0x29738
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
jmp 0x1a60d
movl -0x1c(%rbp), %eax
cmpq $0xffffff, %rax         # imm = 0xFFFFFF
jbe 0x1a511
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
cmpl $0xff, -0x30(%rbp)
jbe 0x1a526
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
movl -0x30(%rbp), %eax
shll $0x18, %eax
orl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x1a60d
cmpl $0xffff, -0x1c(%rbp)    # imm = 0xFFFF
jbe 0x1a54c
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
cmpl $0xff, -0x30(%rbp)
ja 0x1a55e
cmpl $0xff, -0x2c(%rbp)
jbe 0x1a56a
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
movl -0x30(%rbp), %eax
shll $0x18, %eax
movl -0x2c(%rbp), %ecx
shll $0x10, %ecx
orl %ecx, %eax
orl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x1a60d
cmpl $0xff, -0x1c(%rbp)
jbe 0x1a598
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
cmpl $0xff, -0x30(%rbp)
ja 0x1a5b3
cmpl $0xff, -0x2c(%rbp)
ja 0x1a5b3
cmpl $0xff, -0x28(%rbp)
jbe 0x1a5bc
movl $0x0, -0x4(%rbp)
jmp 0x1a62b
movl -0x30(%rbp), %eax
shll $0x18, %eax
movl -0x2c(%rbp), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl -0x28(%rbp), %ecx
shll $0x8, %ecx
orl %ecx, %eax
orl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x1a60d
jmp 0x1a5dc
jmp 0x1a5de
leaq 0xcce7(%rip), %rdi      # 0x272cc
leaq 0xf190(%rip), %rsi      # 0x2977c
movl $0xf9, %edx
leaq 0xf18e(%rip), %rcx      # 0x29786
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
cmpq $0x0, -0x18(%rbp)
je 0x1a624
movl -0x1c(%rbp), %edi
callq 0x251f0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)