#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 atoi(char *);
scalar_t__ create_Data_file();
scalar_t__ create_Result_file();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc > 1) {
    switch (atoi(argv[1])) {
    case 1:
      if (create_Data_file() == 0)
        printf("Data file created\n");
      else
        printf("problem during acos data file creation\n");
      break;
    case 2:
      if (create_Result_file() == 0)
        printf("Result file created\n");
      else
        printf("problem during acos result file creation\n");
      break;
    default:
      printf("Bad arglist code for: '%s'\n", argv[0]);
      return -1;
      break;
    }
  } else {
    if (create_Data_file() != 0)
      printf("problem during acos data file creation\n");
    if (create_Result_file() != 0)
      printf("problem during acos result file creation\n");
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jle    1225 <main+0xe5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x1,%eax
je     1191 <main+0x51>
jmp    1180 <main+0x40>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11c8 <main+0x88>
jmp    11ff <main+0xbf>
mov    $0x0,%al
call   1030 <create_Data_file@plt>
cmp    $0x0,%rax
jne    11b5 <main+0x75>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11c3 <main+0x83>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1220 <main+0xe0>
mov    $0x0,%al
call   1040 <create_Result_file@plt>
cmp    $0x0,%rax
jne    11ec <main+0xac>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11fa <main+0xba>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1220 <main+0xe0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    126f <main+0x12f>
jmp    1268 <main+0x128>
mov    $0x0,%al
call   1030 <create_Data_file@plt>
cmp    $0x0,%rax
je     1244 <main+0x104>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <create_Result_file@plt>
cmp    $0x0,%rax
je     1263 <main+0x123>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1268 <main+0x128>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jl     1183 <main+0x33>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
cmp    $0x2,%eax
je     11ab <main+0x5b>
cmp    $0x1,%eax
jne    11c7 <main+0x77>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <create_Data_file@plt>
test   %rax,%rax
je     11e1 <main+0x91>
lea    0xed8(%rip),%rdi
jmp    11c0 <main+0x70>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <create_Data_file@plt>
test   %rax,%rax
je     119d <main+0x4d>
lea    0xec1(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1040 <create_Result_file@plt>
test   %rax,%rax
jne    11b9 <main+0x69>
jmp    11dd <main+0x8d>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <create_Result_file@plt>
test   %rax,%rax
je     11ea <main+0x9a>
lea    0xe5c(%rip),%rdi
call   1050 <puts@plt>
jmp    11dd <main+0x8d>
mov    (%rbx),%rsi
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe98(%rip),%rdi
jmp    11c0 <main+0x70>
lea    0xe54(%rip),%rdi
jmp    11c0 <main+0x70>

LLVM IR (-O0):
@.str = [19 x i8] c"Data file created\0A\00"
@.str.1 = [40 x i8] c"problem during acos data file creation\0A\00"
@.str.2 = [21 x i8] c"Result file created\0A\00"
@.str.3 = [42 x i8] c"problem during acos result file creation\0A\00"
@.str.4 = [28 x i8] c"Bad arglist code for: '%s'\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 sgt i32 %6, 1
br i1 %7, label %8, label %35
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
switch i32 %12, label %29 [
i32 1, label %13
i32 2, label %21
]
13: ; preds = %8
%14 = call i64 (...) @create_Data_file()
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %20
18: ; preds = %13
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %34
21: ; preds = %8
%22 = call i64 (...) @create_Result_file()
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %28
26: ; preds = %21
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
br label %34
29: ; preds = %8
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %32)
store i32 -1, i32* %3
br label %47
34: ; preds = %28, %20
br label %46
35: ; preds = %2
%36 = call i64 (...) @create_Data_file()
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %35
%41 = call i64 (...) @create_Result_file()
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
br label %46
46: ; preds = %45, %34
store i32 0, i32* %3
br label %47
47: ; preds = %46, %29
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str.4 = [28 x i8] c"Bad arglist code for: '%s'\0A\00"
@str.6 = [41 x i8] c"problem during acos result file creation\00"
@str.7 = [20 x i8] c"Result file created\00"
@str.8 = [39 x i8] c"problem during acos data file creation\00"
@str.9 = [18 x i8] c"Data file created\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %25
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
switch i32 %7, label %22 [
i32 1, label %8
i32 2, label %15
]
8: ; preds = %4
%9 = tail call i64 (...) @create_Data_file()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.9, i64 0, i64 0))
br label %35
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.8, i64 0, i64 0))
br label %35
15: ; preds = %4
%16 = tail call i64 (...) @create_Result_file()
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
br label %35
20: ; preds = %15
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.6, i64 0, i64 0))
br label %35
22: ; preds = %4
%23 = load i8*, i8** %1
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %23)
br label %35
25: ; preds = %2
%26 = tail call i64 (...) @create_Data_file()
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.8, i64 0, i64 0))
br label %30
30: ; preds = %28, %25
%31 = tail call i64 (...) @create_Result_file()
%32 = icmp eq i64 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.6, i64 0, i64 0))
br label %35
35: ; preds = %18, %20, %11, %13, %33, %30, %22
%36 = phi i32 [ -1, %22 ], [ 0, %30 ], [ 0, %33 ], [ 0, %13 ], [ 0, %11 ], [ 0, %20 ], [ 0, %18 ]
ret i32 %36
}