#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 getOperation();
int install();
int /*<<< orphan*/ printf(char *);
int system(char *);
int uninstall();
int main(int argc, char **argv) {
  printf("SLICLoader Installer\n\n");
  int op = getOperation();
  if (op == 0) {
    int res = install();
    if (res) {
      printf("\nThe installation failed.\n");
    } else {
      printf("\nThe installation succeeded.\n");
    }
  } else {
    int res = uninstall();
    if (res) {
      printf("\nThe uninstall failed.\n");
    } else {
      printf("\nUninstall complete.\n");
    }
  }
  int res = system("PAUSE");
  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)
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getOperation@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11bc <main+0x6c>
mov    $0x0,%al
call   1050 <install@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11ab <main+0x5b>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
jmp    11b7 <main+0x67>
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
jmp    11f2 <main+0xa2>
mov    $0x0,%al
call   1070 <uninstall@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11e1 <main+0x91>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
jmp    11ed <main+0x9d>
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
jmp    11f2 <main+0xa2>
lea    0xe85(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getOperation@plt>
test   %eax,%eax
je     1181 <main+0x31>
xor    %eax,%eax
call   1070 <uninstall@plt>
test   %eax,%eax
lea    0xea4(%rip),%rax
lea    0xeb2(%rip),%rdi
jmp    1198 <main+0x48>
xor    %eax,%eax
call   1050 <install@plt>
test   %eax,%eax
lea    0xeb7(%rip),%rax
lea    0xecd(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xe58(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"SLICLoader Installer\0A\0A\00"
@.str.1 = [27 x i8] c"\0AThe installation failed.\0A\00"
@.str.2 = [30 x i8] c"\0AThe installation succeeded.\0A\00"
@.str.3 = [24 x i8] c"\0AThe uninstall failed.\0A\00"
@.str.4 = [22 x i8] c"\0AUninstall complete.\0A\00"
@.str.5 = [6 x i8] c"PAUSE\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @getOperation()
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %2
%15 = call i32 (...) @install()
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %22
20: ; preds = %14
%21 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
br label %32
23: ; preds = %2
%24 = call i32 (...) @uninstall()
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
br label %31
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
br label %32
32: ; preds = %31, %22
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 %33, i32* %9
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [6 x i8] c"PAUSE\00"
@str = [22 x i8] c"SLICLoader Installer\0A\00"
@str.6 = [21 x i8] c"\0AUninstall complete.\00"
@str.7 = [23 x i8] c"\0AThe uninstall failed.\00"
@str.8 = [29 x i8] c"\0AThe installation succeeded.\00"
@str.9 = [26 x i8] c"\0AThe installation failed.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @getOperation()
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 (...) @install()
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0)
br label %14
10: ; preds = %2
%11 = tail call i32 (...) @uninstall()
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.7, i64 0, i64 0)
br label %14
14: ; preds = %10, %6
%15 = phi i8* [ %9, %6 ], [ %13, %10 ]
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
%17 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}