#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 uint16_t;

/* Variables and functions */
char *read_string(char *, char *);
scalar_t__ strcmp(char const *, char *);
uint16_t get_port() {
  const char *platform = read_string("DEFAULT", "platform");
  if (platform &&
      (strcmp(platform, "dpdk") == 0 || strcmp(platform, "nic") == 0)) {
    return 20914;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_port>:
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     118a <get_port+0x6a>
mov    -0x10(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     117e <get_port+0x5e>
mov    -0x10(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118a <get_port+0x6a>
movl   $0x51b2,-0x4(%rbp)
jmp    1191 <get_port+0x71>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_port>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1040 <read_string@plt>
test   %rax,%rax
je     116b <get_port+0x4b>
mov    %rax,%rbx
lea    0xecc(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
mov    $0x51b2,%ebp
test   %rax,%rax
je     116d <get_port+0x4d>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     116d <get_port+0x4d>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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"
define i32 @get_port() {
%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 %15
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 %15
14: ; preds = %10, %6
store i32 20914, i32* %1
br label %16
15: ; preds = %10, %0
store i32 0, i32* %1
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %1
ret i32 %17
}

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"
define i32 @get_port() {
%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 [ 0, %9 ], [ 20914, %6 ], [ 20914, %3 ]
ret i32 %11
}