#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 */
scalar_t__ env_fini();
scalar_t__ env_init();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    perror("no action specified (create or remove?)");
    return 1;
  }
  if (!strcmp(argv[1], "create")) {
    if (env_init()) {
      fprintf(stderr, "ULCC environment creation error\n");
      return 1;
    }
    printf("ULCC environment created\n");
  } else if (!strcmp(argv[1], "remove")) {
    if (env_fini() < 0) {
      fprintf(stderr, "ULCC environment remove error\n");
      return 1;
    }
    printf("ULCC environment removed\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1198 <main+0x38>
lea    0xe79(%rip),%rdi
call   1070 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    125f <main+0xff>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11f8 <main+0x98>
mov    $0x0,%al
call   1080 <env_init@plt>
cmp    $0x0,%rax
je     11e7 <main+0x87>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe59(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    125f <main+0xff>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
jmp    1258 <main+0xf8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe63(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1253 <main+0xf3>
mov    $0x0,%al
call   1060 <env_fini@plt>
cmp    $0x0,%rax
jge    1247 <main+0xe7>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
lea    0xe3b(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    125f <main+0xff>
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
jmp    1258 <main+0xf8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    11f9 <main+0x99>
mov    0x8(%rsi),%rbx
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11ad <main+0x4d>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
jne    11f5 <main+0x95>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <env_fini@plt>
test   %rax,%rax
js     11db <main+0x7b>
lea    0xee4(%rip),%rdi
jmp    11d4 <main+0x74>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <env_init@plt>
test   %rax,%rax
je     11cd <main+0x6d>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
jmp    11eb <main+0x8b>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
jmp    11f5 <main+0x95>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe00(%rip),%rdi
call   1070 <perror@plt>
jmp    11f0 <main+0x90>

LLVM IR (-O0):
@.str = [40 x i8] c"no action specified (create or remove?)\00"
@.str.1 = [7 x i8] c"create\00"
@stderr = global i32 0
@.str.2 = [33 x i8] c"ULCC environment creation error\0A\00"
@.str.3 = [26 x i8] c"ULCC environment created\0A\00"
@.str.4 = [7 x i8] c"remove\00"
@.str.5 = [31 x i8] c"ULCC environment remove error\0A\00"
@.str.6 = [26 x i8] c"ULCC environment removed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %40
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %24, label %16
16: ; preds = %10
%17 = call i64 (...) @env_init()
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %40
22: ; preds = %16
%23 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %39
24: ; preds = %10
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %38, label %30
30: ; preds = %24
%31 = call i64 (...) @env_fini()
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %40
36: ; preds = %30
%37 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %38
38: ; preds = %36, %24
br label %39
39: ; preds = %38, %22
store i32 0, i32* %3
br label %40
40: ; preds = %39, %33, %19, %8
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [40 x i8] c"no action specified (create or remove?)\00"
@.str.1 = [7 x i8] c"create\00"
@stderr = global i32 0
@.str.2 = [33 x i8] c"ULCC environment creation error\0A\00"
@.str.4 = [7 x i8] c"remove\00"
@.str.5 = [31 x i8] c"ULCC environment remove error\0A\00"
@str = [25 x i8] c"ULCC environment created\00"
@str.7 = [25 x i8] c"ULCC environment removed\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %30
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %6
%12 = tail call i64 (...) @env_init()
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %30
17: ; preds = %11
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %30
19: ; preds = %6
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = tail call i64 (...) @env_fini()
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %30
28: ; preds = %22
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
br label %30
30: ; preds = %17, %28, %19, %25, %14, %4
%31 = phi i32 [ 1, %4 ], [ 1, %25 ], [ 1, %14 ], [ 0, %19 ], [ 0, %28 ], [ 0, %17 ]
ret i32 %31
}