#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 */

/* Variables and functions */
char const *scout_dec_octet(char const *);
const char *scout_ipv4address(const char *c) {
  if ((c = scout_dec_octet(c)) == NULL)
    return NULL;
  if (*(++c) != '.')
    return NULL;
  if ((c = scout_dec_octet(c + 1)) == NULL)
    return NULL;
  if (*(++c) != '.')
    return NULL;
  if ((c = scout_dec_octet(c + 1)) == NULL)
    return NULL;
  if (*(++c) != '.')
    return NULL;
  return scout_dec_octet(c + 1);
}


x86 assembly (clang, -O0):
<scout_ipv4address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <scout_dec_octet@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1140 <scout_ipv4address+0x30>
movq   $0x0,-0x8(%rbp)
jmp    121c <scout_ipv4address+0x10c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
je     1169 <scout_ipv4address+0x59>
movq   $0x0,-0x8(%rbp)
jmp    121c <scout_ipv4address+0x10c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <scout_dec_octet@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1191 <scout_ipv4address+0x81>
movq   $0x0,-0x8(%rbp)
jmp    121c <scout_ipv4address+0x10c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
je     11ba <scout_ipv4address+0xaa>
movq   $0x0,-0x8(%rbp)
jmp    121c <scout_ipv4address+0x10c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <scout_dec_octet@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11e2 <scout_ipv4address+0xd2>
movq   $0x0,-0x8(%rbp)
jmp    121c <scout_ipv4address+0x10c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
je     120b <scout_ipv4address+0xfb>
movq   $0x0,-0x8(%rbp)
jmp    121c <scout_ipv4address+0x10c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <scout_dec_octet@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scout_ipv4address>:
push   %rax
call   1030 <scout_dec_octet@plt>
test   %rax,%rax
je     115c <scout_ipv4address+0x4c>
cmpb   $0x2e,0x1(%rax)
jne    115c <scout_ipv4address+0x4c>
add    $0x2,%rax
mov    %rax,%rdi
call   1030 <scout_dec_octet@plt>
test   %rax,%rax
je     115c <scout_ipv4address+0x4c>
cmpb   $0x2e,0x1(%rax)
jne    115c <scout_ipv4address+0x4c>
add    $0x2,%rax
mov    %rax,%rdi
call   1030 <scout_dec_octet@plt>
test   %rax,%rax
je     115c <scout_ipv4address+0x4c>
cmpb   $0x2e,0x1(%rax)
jne    115c <scout_ipv4address+0x4c>
add    $0x2,%rax
mov    %rax,%rdi
pop    %rax
jmp    1030 <scout_dec_octet@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @scout_ipv4address(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i8* @scout_dec_octet(i8* %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* null, i8** %2
br label %45
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 46
br i1 %13, label %14, label %15
14: ; preds = %8
store i8* null, i8** %2
br label %45
15: ; preds = %8
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = call i8* @scout_dec_octet(i8* %17)
store i8* %18, i8** %3
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %21
20: ; preds = %15
store i8* null, i8** %2
br label %45
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 46
br i1 %26, label %27, label %28
27: ; preds = %21
store i8* null, i8** %2
br label %45
28: ; preds = %21
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = call i8* @scout_dec_octet(i8* %30)
store i8* %31, i8** %3
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %34
33: ; preds = %28
store i8* null, i8** %2
br label %45
34: ; preds = %28
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %3
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 46
br i1 %39, label %40, label %41
40: ; preds = %34
store i8* null, i8** %2
br label %45
41: ; preds = %34
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i64 1
%44 = call i8* @scout_dec_octet(i8* %43)
store i8* %44, i8** %2
br label %45
45: ; preds = %41, %40, %33, %27, %20, %14, %7
%46 = load i8*, i8** %2
ret i8* %46
}

LLVM IR (-O2):
define i8* @scout_ipv4address(i8* %0) {
%2 = tail call i8* @scout_dec_octet(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %27, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 46
br i1 %7, label %8, label %27
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %2, i64 2
%10 = tail call i8* @scout_dec_octet(i8* %9)
%11 = icmp eq i8* %10, null
br i1 %11, label %27, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 46
br i1 %15, label %16, label %27
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %10, i64 2
%18 = tail call i8* @scout_dec_octet(i8* %17)
%19 = icmp eq i8* %18, null
br i1 %19, label %27, label %20
20: ; preds = %16
%21 = getelementptr inbounds i8, i8* %18, i64 1
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 46
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = getelementptr inbounds i8, i8* %18, i64 2
%26 = tail call i8* @scout_dec_octet(i8* %25)
br label %27
27: ; preds = %20, %16, %12, %8, %4, %1, %24
%28 = phi i8* [ %26, %24 ], [ null, %1 ], [ null, %4 ], [ null, %8 ], [ null, %12 ], [ null, %16 ], [ null, %20 ]
ret i8* %28
}