#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 /*<<< orphan*/ enable_eth(char *, int);
int get_netlink_status(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int ret;
  if (!strcmp(argv[1], "down")) {
    enable_eth("eth0", 0);
    return 0;
  } else if (!strcmp(argv[1], "up")) {
    enable_eth("eth0", 1);
    return 0;
  }
  ret = get_netlink_status("eth0");
  printf("link status = %d\n", ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    118d <main+0x4d>
lea    0xe8b(%rip),%rdi
xor    %esi,%esi
call   1030 <enable_eth@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11c7 <main+0x87>
lea    0xe54(%rip),%rdi
mov    $0x1,%esi
call   1030 <enable_eth@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <main+0xb1>
jmp    11cc <main+0x8c>
lea    0xe32(%rip),%rdi
call   1040 <get_netlink_status@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rbx
lea    0xeb4(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1187 <main+0x47>
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
lea    0xe97(%rip),%rdi
test   %eax,%eax
je     1192 <main+0x52>
call   1040 <get_netlink_status@plt>
lea    0xe8f(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
jmp    119c <main+0x5c>
lea    0xe77(%rip),%rdi
xor    %esi,%esi
jmp    1197 <main+0x57>
mov    $0x1,%esi
call   1030 <enable_eth@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"down\00"
@.str.1 = [5 x i8] c"eth0\00"
@.str.2 = [3 x i8] c"up\00"
@.str.3 = [18 x i8] c"link status = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 @enable_eth(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
store i32 0, i32* %3
br label %27
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = call i32 @enable_eth(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 1)
store i32 0, i32* %3
br label %27
22: ; preds = %14
br label %23
23: ; preds = %22
%24 = call i32 @get_netlink_status(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %25)
store i32 0, i32* %3
br label %27
27: ; preds = %23, %20, %12
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [5 x i8] c"down\00"
@.str.1 = [5 x i8] c"eth0\00"
@.str.2 = [3 x i8] c"up\00"
@.str.3 = [18 x i8] c"link status = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @enable_eth(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
br label %17
9: ; preds = %2
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @enable_eth(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %17
14: ; preds = %9
%15 = tail call i32 @get_netlink_status(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %12, %7
ret i32 0
}