#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 execute(int, char **);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ help();
int reTrain(int, char **);
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int testCandidate(int);
int train(int, char **);
int main(int argc, char *argv[]) {
  int n;
  for (n = 0; n < argc; n++) {
    if (1) {
      fprintf(stdout, "\"%s\" ", argv[n]);
      fflush(stdout);
    }
  }
  if (1) {
    fprintf(stdout, "\n");
    fflush(stdout);
  }
  int result;
  if (argc < 2) {
    help();
    result = 1;
  } else {
    char *command = argv[1];
    if (strcmp(command, "-t") == 0) {
      result = train(argc - 2, &argv[2]);
    } else if (strcmp(command, "-r") == 0) {
      result = reTrain(argc - 2, &argv[2]);
    } else if (strcmp(command, "-e") == 0) {
      result = execute(argc - 2, &argv[2]);
    } else if (strcmp(command, "-c") == 0) {
      return testCandidate(4);
    } else {
      help();
      if (strcmp(command, "-h") == 0) {
        result = 1;
      }
      result = 0;
    }
  }
  return result;
}


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)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e8 <main+0x68>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe3b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119d <main+0x1d>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
cmpl   $0x2,-0x8(%rbp)
jge    122a <main+0xaa>
mov    $0x0,%al
call   10a0 <help@plt>
movl   $0x1,-0x18(%rbp)
jmp    1344 <main+0x1c4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdc7(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    126b <main+0xeb>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1070 <train@plt>
mov    %eax,-0x18(%rbp)
jmp    133f <main+0x1bf>
mov    -0x20(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12a0 <main+0x120>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1090 <reTrain@plt>
mov    %eax,-0x18(%rbp)
jmp    133a <main+0x1ba>
mov    -0x20(%rbp),%rdi
lea    0xd63(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12d5 <main+0x155>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1040 <execute@plt>
mov    %eax,-0x18(%rbp)
jmp    1335 <main+0x1b5>
mov    -0x20(%rbp),%rdi
lea    0xd31(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1301 <main+0x181>
mov    $0x4,%edi
call   1030 <testCandidate@plt>
mov    %eax,-0x4(%rbp)
jmp    134a <main+0x1ca>
mov    $0x0,%al
call   10a0 <help@plt>
mov    -0x20(%rbp),%rdi
lea    0xd01(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1329 <main+0x1a9>
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    1335 <main+0x1b5>
jmp    133a <main+0x1ba>
jmp    133f <main+0x1bf>
jmp    1344 <main+0x1c4>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%r15d
test   %edi,%edi
jle    11d2 <main+0x52>
mov    %r15d,%r13d
mov    0x2e41(%rip),%rbp
lea    0xe5a(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
mov    (%r12,%rbx,8),%rdx
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x0(%rbp),%edi
call   1080 <fflush@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11b0 <main+0x30>
mov    0x2e07(%rip),%rbx
mov    (%rbx),%edi
lea    0xe24(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
call   1080 <fflush@plt>
cmp    $0x1,%r15d
jg     1213 <main+0x93>
xor    %eax,%eax
call   10a0 <help@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%r12),%r14
lea    0xde9(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1282 <main+0x102>
lea    0xdd8(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12a3 <main+0x123>
lea    0xdc7(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12c4 <main+0x144>
lea    0xdb6(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12e5 <main+0x165>
xor    %ebx,%ebx
xor    %eax,%eax
call   10a0 <help@plt>
lea    0xd9c(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
jmp    1202 <main+0x82>
add    $0xfffffffe,%r15d
add    $0x10,%r12
mov    %r15d,%edi
mov    %r12,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <train@plt>
add    $0xfffffffe,%r15d
add    $0x10,%r12
mov    %r15d,%edi
mov    %r12,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <reTrain@plt>
add    $0xfffffffe,%r15d
add    $0x10,%r12
mov    %r15d,%edi
mov    %r12,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <execute@plt>
mov    $0x4,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <testCandidate@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [6 x i8] c"\22%s\22 \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"-t\00"
@.str.3 = [3 x i8] c"-r\00"
@.str.4 = [3 x i8] c"-e\00"
@.str.5 = [3 x i8] c"-c\00"
@.str.6 = [3 x i8] c"-h\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 i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %23, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load i32, i32* @stdout
%15 = load i8**, i8*** %5
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @stdout
%22 = call i32 @fflush(i32 %21)
br label %23
23: ; preds = %13
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %9
26: ; preds = %9
%27 = load i32, i32* @stdout
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32, i32* @stdout
%30 = call i32 @fflush(i32 %29)
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 2
br i1 %32, label %33, label %35
33: ; preds = %26
%34 = call i32 (...) @help()
store i32 1, i32* %7
br label %85
35: ; preds = %26
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
store i8* %38, i8** %8
%39 = load i8*, i8** %8
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %35
%43 = load i32, i32* %4
%44 = sub nsw i32 %43, 2
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = call i32 @train(i32 %44, i8** %46)
store i32 %47, i32* %7
br label %84
48: ; preds = %35
%49 = load i8*, i8** %8
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %48
%53 = load i32, i32* %4
%54 = sub nsw i32 %53, 2
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = call i32 @reTrain(i32 %54, i8** %56)
store i32 %57, i32* %7
br label %83
58: ; preds = %48
%59 = load i8*, i8** %8
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %68
62: ; preds = %58
%63 = load i32, i32* %4
%64 = sub nsw i32 %63, 2
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = call i32 @execute(i32 %64, i8** %66)
store i32 %67, i32* %7
br label %82
68: ; preds = %58
%69 = load i8*, i8** %8
%70 = call i64 @strcmp(i8* %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %68
%73 = call i32 @testCandidate(i32 4)
store i32 %73, i32* %3
br label %87
74: ; preds = %68
%75 = call i32 (...) @help()
%76 = load i8*, i8** %8
%77 = call i64 @strcmp(i8* %76, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %74
store i32 1, i32* %7
br label %80
80: ; preds = %79, %74
store i32 0, i32* %7
br label %81
81: ; preds = %80
br label %82
82: ; preds = %81, %62
br label %83
83: ; preds = %82, %52
br label %84
84: ; preds = %83, %42
br label %85
85: ; preds = %84, %33
%86 = load i32, i32* %7
store i32 %86, i32* %3
br label %87
87: ; preds = %85, %72
%88 = load i32, i32* %3
ret i32 %88
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [6 x i8] c"\22%s\22 \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"-t\00"
@.str.3 = [3 x i8] c"-r\00"
@.str.4 = [3 x i8] c"-e\00"
@.str.5 = [3 x i8] c"-c\00"
@.str.6 = [3 x i8] c"-h\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %14, %6 ]
%8 = load i32, i32* @stdout
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @stdout
%13 = tail call i32 @fflush(i32 %12)
%14 = add nuw nsw i64 %7, 1
%15 = icmp eq i64 %14, %5
br i1 %15, label %16, label %6
16: ; preds = %6, %2
%17 = load i32, i32* @stdout
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @stdout
%20 = tail call i32 @fflush(i32 %19)
%21 = icmp slt i32 %0, 2
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = tail call i32 (...) @help()
br label %55
24: ; preds = %16
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %24
%30 = add nsw i32 %0, -2
%31 = getelementptr inbounds i8*, i8** %1, i64 2
%32 = tail call i32 @train(i32 %30, i8** %31)
br label %55
33: ; preds = %24
%34 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = add nsw i32 %0, -2
%38 = getelementptr inbounds i8*, i8** %1, i64 2
%39 = tail call i32 @reTrain(i32 %37, i8** %38)
br label %55
40: ; preds = %33
%41 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = add nsw i32 %0, -2
%45 = getelementptr inbounds i8*, i8** %1, i64 2
%46 = tail call i32 @execute(i32 %44, i8** %45)
br label %55
47: ; preds = %40
%48 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = tail call i32 (...) @help()
%52 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %55
53: ; preds = %47
%54 = tail call i32 @testCandidate(i32 4)
br label %55
55: ; preds = %29, %43, %50, %36, %22, %53
%56 = phi i32 [ %54, %53 ], [ 1, %22 ], [ 0, %50 ], [ %46, %43 ], [ %39, %36 ], [ %32, %29 ]
ret i32 %56
}