#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 */
int AF_INET;
int AF_NETLINK;
char *read_string(char *, char *);
scalar_t__ strcmp(char const *, char *);
int get_domain() {
  const char *platform = read_string("DEFAULT", "platform");
  if (platform &&
      (strcmp(platform, "dpdk") == 0 || strcmp(platform, "nic") == 0)) {
    return AF_INET;
  }
  return AF_NETLINK;
}


x86 assembly (clang, -O0):
<get_domain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1040 <read_string@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118f <get_domain+0x6f>
mov    -0x10(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     117e <get_domain+0x5e>
mov    -0x10(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118f <get_domain+0x6f>
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    119b <get_domain+0x7b>
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_domain>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1040 <read_string@plt>
test   %rax,%rax
je     116e <get_domain+0x4e>
mov    %rax,%rbx
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
mov    0x2e93(%rip),%r14
test   %rax,%rax
je     1175 <get_domain+0x55>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1175 <get_domain+0x55>
mov    0x2e6b(%rip),%r14
mov    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"DEFAULT\00"
@.str.1 = [9 x i8] c"platform\00"
@.str.2 = [5 x i8] c"dpdk\00"
@.str.3 = [4 x i8] c"nic\00"
@AF_INET = global i32 0
@AF_NETLINK = global i32 0
define i32 @get_domain() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i8* @read_string(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %16
6: ; preds = %0
%7 = load i8*, i8** %2
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10, %6
%15 = load i32, i32* @AF_INET
store i32 %15, i32* %1
br label %18
16: ; preds = %10, %0
%17 = load i32, i32* @AF_NETLINK
store i32 %17, i32* %1
br label %18
18: ; preds = %16, %14
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [8 x i8] c"DEFAULT\00"
@.str.1 = [9 x i8] c"platform\00"
@.str.2 = [5 x i8] c"dpdk\00"
@.str.3 = [4 x i8] c"nic\00"
@AF_INET = global i32 0
@AF_NETLINK = global i32 0
define i32 @get_domain() {
%1 = tail call i8* @read_string(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %6, %0
br label %10
10: ; preds = %3, %6, %9
%11 = phi i32* [ @AF_NETLINK, %9 ], [ @AF_INET, %6 ], [ @AF_INET, %3 ]
%12 = load i32, i32* %11
ret i32 %12
}