#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 main_process(int, char **);
int /*<<< orphan*/ printf(char *, int, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  int code = main_process(argc, argv);
  if (code != 0) {
    char errmsg[256];
    switch (code) {
    case 10:
      strcpy(errmsg, "FILE_ERROR");
      break;
    default:
      strcpy(errmsg, "UNKNOWN_ERROR");
    }
    printf("\nERROR: Program exited with code: %d [%s]", code, errmsg);
  }
  return code;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <main_process@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11b4 <main+0x84>
mov    -0x14(%rbp),%eax
sub    $0xa,%eax
jne    118b <main+0x5b>
jmp    1173 <main+0x43>
lea    -0x120(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    119e <main+0x6e>
lea    -0x120(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x14(%rbp),%esi
lea    -0x120(%rbp),%rdx
lea    0xe6a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
call   1040 <main_process@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1176 <main+0x46>
cmp    $0xa,%ebx
lea    0xeb1(%rip),%rax
lea    0xeb5(%rip),%rsi
cmove  %rax,%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xead(%rip),%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1050 <printf@plt>
mov    %ebx,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"FILE_ERROR\00"
@.str.1 = [14 x i8] c"UNKNOWN_ERROR\00"
@.str.2 = [42 x i8] c"\0AERROR: Program exited with code: %d [%s]\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @main_process(i32 %8, i8** %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %2
%14 = load i32, i32* %6
switch i32 %14, label %18 [
i32 10, label %15
]
15: ; preds = %13
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %21
18: ; preds = %13
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %6
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %22, i8* %23)
br label %25
25: ; preds = %21, %2
%26 = load i32, i32* %6
ret i32 %26
}

LLVM IR (-O2):
@.str = [11 x i8] c"FILE_ERROR\00"
@.str.1 = [14 x i8] c"UNKNOWN_ERROR\00"
@.str.2 = [42 x i8] c"\0AERROR: Program exited with code: %d [%s]\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [256 x i8]
%4 = tail call i32 @main_process(i32 %0, i8** %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = icmp eq i32 %4, 10
%9 = select i1 %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0)
%10 = call i32 @strcpy(i8* %7, i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %4, i8* %7)
br label %12
12: ; preds = %6, %2
ret i32 %4
}