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


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

x86 assembly (clang, -O2):
<get_protocol>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1040 <read_string@plt>
test   %rax,%rax
je     1168 <get_protocol+0x48>
mov    %rax,%rbx
lea    0xecc(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1171 <get_protocol+0x51>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1171 <get_protocol+0x51>
mov    0x2e71(%rip),%rax
mov    (%rax),%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"
@NETLINK_GENERIC = global i32 0
define i32 @get_protocol() {
%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 0, i32* %1
br label %17
15: ; preds = %10, %0
%16 = load i32, i32* @NETLINK_GENERIC
store i32 %16, i32* %1
br label %17
17: ; preds = %15, %14
%18 = load i32, i32* %1
ret i32 %18
}

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"
@NETLINK_GENERIC = global i32 0
define i32 @get_protocol() {
%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 %11, 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 %11, label %9
9: ; preds = %6, %0
%10 = load i32, i32* @NETLINK_GENERIC
br label %11
11: ; preds = %3, %6, %9
%12 = phi i32 [ %10, %9 ], [ 0, %6 ], [ 0, %3 ]
ret i32 %12
}