#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_h16(char const *);
char *scout_ipv4address(char const *);
const char *scout_ls32(const char *c) {
  const char *p = scout_ipv4address(c);
  if (p == NULL) {
    p = scout_h16(c);
    if (p != NULL) {
      c = p + 1;
      if (*c == ':')
        return scout_h16(c + 1);
      else
        return NULL;
    } else
      return NULL;
  }
  return p;
}


x86 assembly (clang, -O0):
<scout_ls32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <scout_ipv4address@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a8 <scout_ls32+0x88>
mov    -0x10(%rbp),%rdi
call   1030 <scout_h16@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     119b <scout_ls32+0x7b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    118e <scout_ls32+0x6e>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <scout_h16@plt>
mov    %rax,-0x8(%rbp)
jmp    11b0 <scout_ls32+0x90>
movq   $0x0,-0x8(%rbp)
jmp    11b0 <scout_ls32+0x90>
movq   $0x0,-0x8(%rbp)
jmp    11b0 <scout_ls32+0x90>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scout_ls32>:
push   %rbx
mov    %rdi,%rbx
call   1040 <scout_ipv4address@plt>
test   %rax,%rax
je     1130 <scout_ls32+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <scout_h16@plt>
test   %rax,%rax
je     1150 <scout_ls32+0x30>
cmpb   $0x3a,0x1(%rax)
jne    1150 <scout_ls32+0x30>
add    $0x2,%rax
mov    %rax,%rdi
pop    %rbx
jmp    1030 <scout_h16@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @scout_ls32(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @scout_ipv4address(i8* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %27
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i8* @scout_h16(i8* %10)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %3
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 58
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = call i8* @scout_h16(i8* %23)
store i8* %24, i8** %2
br label %29
25: ; preds = %14
store i8* null, i8** %2
br label %29
26: ; preds = %9
store i8* null, i8** %2
br label %29
27: ; preds = %1
%28 = load i8*, i8** %4
store i8* %28, i8** %2
br label %29
29: ; preds = %27, %26, %25, %21
%30 = load i8*, i8** %2
ret i8* %30
}

LLVM IR (-O2):
define i8* @scout_ls32(i8* %0) {
%2 = tail call i8* @scout_ipv4address(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = tail call i8* @scout_h16(i8* %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 58
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %5, i64 2
%13 = tail call i8* @scout_h16(i8* %12)
br label %14
14: ; preds = %1, %4, %7, %11
%15 = phi i8* [ %13, %11 ], [ null, %7 ], [ null, %4 ], [ %2, %1 ]
ret i8* %15
}