#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int u_long;

/* Variables and functions */
unsigned long ip_aton(const char *cp) {
  int dots = 0;
  register u_long acc = 0, addr = 0;
  do {
    register char cc = *cp;
    switch (cc) {
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      acc = acc * 10 + (cc - '0');
      break;
    case '.':
      if (++dots > 3) {
        return 0;
      }
    case '\0':
      if (acc > 255) {
        return 0;
      }
      addr = addr << 8 | acc;
      acc = 0;
      break;
    default:
      return 0;
    }
  } while (*cp++);
  if (dots < 3) {
    addr <<= 8 * (3 - dots);
  }
  return 0;
}


x86 assembly (clang, -O0):
<ip_aton>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1d(%rbp)
movsbl -0x1d(%rbp),%eax
mov    %eax,-0x24(%rbp)
test   %eax,%eax
je     1198 <ip_aton+0x98>
jmp    113a <ip_aton+0x3a>
mov    -0x24(%rbp),%eax
sub    $0x2e,%eax
je     1174 <ip_aton+0x74>
jmp    114b <ip_aton+0x4b>
mov    -0x24(%rbp),%eax
add    $0xffffffd0,%eax
sub    $0x9,%eax
ja     11ca <ip_aton+0xca>
jmp    115f <ip_aton+0x5f>
imul   $0xa,-0x18(%rbp),%eax
movsbl -0x1d(%rbp),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
jmp    11d7 <ip_aton+0xd7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x3,%eax
jle    1193 <ip_aton+0x93>
movq   $0x0,-0x8(%rbp)
jmp    1219 <ip_aton+0x119>
jmp    1198 <ip_aton+0x98>
cmpl   $0xff,-0x18(%rbp)
jle    11b2 <ip_aton+0xb2>
movq   $0x0,-0x8(%rbp)
jmp    1219 <ip_aton+0x119>
mov    -0x1c(%rbp),%eax
shl    $0x8,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    11d7 <ip_aton+0xd7>
movq   $0x0,-0x8(%rbp)
jmp    1219 <ip_aton+0x119>
jmp    11dc <ip_aton+0xdc>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    111d <ip_aton+0x1d>
cmpl   $0x3,-0x14(%rbp)
jge    1211 <ip_aton+0x111>
mov    $0x3,%ecx
sub    -0x14(%rbp),%ecx
shl    $0x3,%ecx
mov    -0x1c(%rbp),%eax
shl    %cl,%eax
mov    %eax,-0x1c(%rbp)
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip_aton>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @ip_aton(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %8
8: ; preds = %37, %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
store i8 %10, i8* %7
%11 = load i8, i8* %7
%12 = sext i8 %11 to i32
switch i32 %12, label %35 [
i32 48, label %13
i32 49, label %13
i32 50, label %13
i32 51, label %13
i32 52, label %13
i32 53, label %13
i32 54, label %13
i32 55, label %13
i32 56, label %13
i32 57, label %13
i32 46, label %20
i32 0, label %26
]
13: ; preds = %8, %8, %8, %8, %8, %8, %8, %8, %8, %8
%14 = load i32, i32* %5
%15 = mul nsw i32 %14, 10
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
%18 = sub nsw i32 %17, 48
%19 = add nsw i32 %15, %18
store i32 %19, i32* %5
br label %36
20: ; preds = %8
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
%23 = icmp sgt i32 %22, 3
br i1 %23, label %24, label %25
24: ; preds = %20
store i64 0, i64* %2
br label %52
25: ; preds = %20
br label %26
26: ; preds = %8, %25
%27 = load i32, i32* %5
%28 = icmp sgt i32 %27, 255
br i1 %28, label %29, label %30
29: ; preds = %26
store i64 0, i64* %2
br label %52
30: ; preds = %26
%31 = load i32, i32* %6
%32 = shl i32 %31, 8
%33 = load i32, i32* %5
%34 = or i32 %32, %33
store i32 %34, i32* %6
store i32 0, i32* %5
br label %36
35: ; preds = %8
store i64 0, i64* %2
br label %52
36: ; preds = %30, %13
br label %37
37: ; preds = %36
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %3
%40 = load i8, i8* %38
%41 = icmp ne i8 %40, 0
br i1 %41, label %8, label %42
42: ; preds = %37
%43 = load i32, i32* %4
%44 = icmp slt i32 %43, 3
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = load i32, i32* %4
%47 = sub nsw i32 3, %46
%48 = mul nsw i32 8, %47
%49 = load i32, i32* %6
%50 = shl i32 %49, %48
store i32 %50, i32* %6
br label %51
51: ; preds = %45, %42
store i64 0, i64* %2
br label %52
52: ; preds = %51, %35, %29, %24
%53 = load i64, i64* %2
ret i64 %53
}

LLVM IR (-O2):
define i64 @ip_aton(i8* nocapture %0) {
ret i64 0
}