#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 */
struct iphdr {
  int /*<<< orphan*/ saddr;
};
struct in_addr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ inet_ntoa(struct in_addr);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
char *get_name_with_ip_address(struct iphdr *iphdr) {
  char *name;
  if (strcmp(inet_ntoa(*(struct in_addr *)&iphdr->saddr), "10.0.0.2") == 0) {
    name = "staff_1";
  } else if (strcmp(inet_ntoa(*(struct in_addr *)&iphdr->saddr), "10.0.0.3") ==
             0) {
    name = "staff_2";
  } else if (strcmp(inet_ntoa(*(struct in_addr *)&iphdr->saddr), "10.0.0.14") ==
             0) {
    name = "manager";
  } else if (strcmp(inet_ntoa(*(struct in_addr *)&iphdr->saddr), "10.0.0.24") ==
             0) {
    name = "president";
  } else {
    name = "None";
  }
  return name;
}


x86 assembly (clang, -O0):
<get_name_with_ip_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    115f <get_name_with_ip_address+0x3f>
lea    0xeb3(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1212 <get_name_with_ip_address+0xf2>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,%edi
lea    0xe9e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1192 <get_name_with_ip_address+0x72>
lea    0xe91(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    120d <get_name_with_ip_address+0xed>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,%edi
lea    0xe7c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c5 <get_name_with_ip_address+0xa5>
lea    0xe70(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1208 <get_name_with_ip_address+0xe8>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %eax,%edi
lea    0xe5b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f8 <get_name_with_ip_address+0xd8>
lea    0xe4f(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1203 <get_name_with_ip_address+0xe3>
lea    0xe49(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1208 <get_name_with_ip_address+0xe8>
jmp    120d <get_name_with_ip_address+0xed>
jmp    1212 <get_name_with_ip_address+0xf2>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name_with_ip_address>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <inet_ntoa@plt>
lea    0xece(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
je     119e <get_name_with_ip_address+0x7e>
mov    (%rbx),%edi
call   1030 <inet_ntoa@plt>
lea    0xec5(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11a7 <get_name_with_ip_address+0x87>
mov    (%rbx),%edi
call   1030 <inet_ntoa@plt>
lea    0xebc(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b0 <get_name_with_ip_address+0x90>
mov    (%rbx),%edi
call   1030 <inet_ntoa@plt>
lea    0xeb4(%rip),%rsi
mov    %eax,%edi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xead(%rip),%rcx
lea    0xeb0(%rip),%rax
cmove  %rcx,%rax
pop    %rbx
ret
lea    0xe64(%rip),%rax
pop    %rbx
ret
lea    0xe6c(%rip),%rax
pop    %rbx
ret
lea    0xe75(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.iphdr = type { i32 }
%struct.in_addr = type { i32 }
@.str = [9 x i8] c"10.0.0.2\00"
@.str.1 = [8 x i8] c"staff_1\00"
@.str.2 = [9 x i8] c"10.0.0.3\00"
@.str.3 = [8 x i8] c"staff_2\00"
@.str.4 = [10 x i8] c"10.0.0.14\00"
@.str.5 = [8 x i8] c"manager\00"
@.str.6 = [10 x i8] c"10.0.0.24\00"
@.str.7 = [10 x i8] c"president\00"
@.str.8 = [5 x i8] c"None\00"
define i8* @get_name_with_ip_address(%struct.iphdr* %0) {
%2 = alloca %struct.iphdr*
%3 = alloca i8*
store %struct.iphdr* %0, %struct.iphdr** %2
%4 = load %struct.iphdr*, %struct.iphdr** %2
%5 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %4, i32 0, i32 0
%6 = bitcast i32* %5 to %struct.in_addr*
%7 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @inet_ntoa(i32 %8)
%10 = call i64 @strcmp(i32 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %47
13: ; preds = %1
%14 = load %struct.iphdr*, %struct.iphdr** %2
%15 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %14, i32 0, i32 0
%16 = bitcast i32* %15 to %struct.in_addr*
%17 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 @inet_ntoa(i32 %18)
%20 = call i64 @strcmp(i32 %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %13
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %46
23: ; preds = %13
%24 = load %struct.iphdr*, %struct.iphdr** %2
%25 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %24, i32 0, i32 0
%26 = bitcast i32* %25 to %struct.in_addr*
%27 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = call i32 @inet_ntoa(i32 %28)
%30 = call i64 @strcmp(i32 %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %23
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %45
33: ; preds = %23
%34 = load %struct.iphdr*, %struct.iphdr** %2
%35 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %34, i32 0, i32 0
%36 = bitcast i32* %35 to %struct.in_addr*
%37 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %36, i32 0, i32 0
%38 = load i32, i32* %37
%39 = call i32 @inet_ntoa(i32 %38)
%40 = call i64 @strcmp(i32 %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %33
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %44
43: ; preds = %33
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %44
44: ; preds = %43, %42
br label %45
45: ; preds = %44, %32
br label %46
46: ; preds = %45, %22
br label %47
47: ; preds = %46, %12
%48 = load i8*, i8** %3
ret i8* %48
}

LLVM IR (-O2):
%struct.iphdr = type { i32 }
@.str = [9 x i8] c"10.0.0.2\00"
@.str.1 = [8 x i8] c"staff_1\00"
@.str.2 = [9 x i8] c"10.0.0.3\00"
@.str.3 = [8 x i8] c"staff_2\00"
@.str.4 = [10 x i8] c"10.0.0.14\00"
@.str.5 = [8 x i8] c"manager\00"
@.str.6 = [10 x i8] c"10.0.0.24\00"
@.str.7 = [10 x i8] c"president\00"
@.str.8 = [5 x i8] c"None\00"
define i8* @get_name_with_ip_address(%struct.iphdr* nocapture %0) {
%2 = getelementptr %struct.iphdr, %struct.iphdr* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32 @inet_ntoa(i32 %3)
%5 = tail call i64 @strcmp(i32 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %23, label %7
7: ; preds = %1
%8 = load i32, i32* %2
%9 = tail call i32 @inet_ntoa(i32 %8)
%10 = tail call i64 @strcmp(i32 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %23, label %12
12: ; preds = %7
%13 = load i32, i32* %2
%14 = tail call i32 @inet_ntoa(i32 %13)
%15 = tail call i64 @strcmp(i32 %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %12
%18 = load i32, i32* %2
%19 = tail call i32 @inet_ntoa(i32 %18)
%20 = tail call i64 @strcmp(i32 %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0)
br label %23
23: ; preds = %17, %12, %7, %1
%24 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %12 ], [ %22, %17 ]
ret i8* %24
}