#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 /*<<< orphan*/ caculateNB_classify(char *);
int /*<<< orphan*/ caculateNB_train(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *ifn = NULL, *argument = NULL;
  if (argc < 3) {
    printf("Wrong command format! usage:COMMAND ARGUMENT "
           "INPUTFILENAME\nARGUMENT:\n\ttrain:\ttrain the "
           "classifier\n\tclassify:\tclassify the dataset\n");
    return 0;
  } else {
    ifn = argv[2];
    argument = argv[1];
    if (!strcmp(argument, "train")) {
      caculateNB_train(ifn);
    } else if (!strcmp(argument, "classify")) {
      caculateNB_classify(ifn);
    } else {
      printf("Error command!\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)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1188 <main+0x48>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1206 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xed8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c7 <main+0x87>
mov    -0x18(%rbp),%rdi
call   1050 <caculateNB_train@plt>
jmp    11ff <main+0xbf>
mov    -0x20(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ee <main+0xae>
mov    -0x18(%rbp),%rdi
call   1060 <caculateNB_classify@plt>
jmp    11fa <main+0xba>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
jmp    11ff <main+0xbf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jg     1152 <main+0x12>
lea    0xece(%rip),%rdi
jmp    1187 <main+0x47>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     118e <main+0x4e>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1198 <main+0x58>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
jmp    11a0 <main+0x60>
mov    %r14,%rdi
call   1050 <caculateNB_train@plt>
jmp    11a0 <main+0x60>
mov    %r14,%rdi
call   1060 <caculateNB_classify@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [131 x i8] c"Wrong command format! usage:COMMAND ARGUMENT INPUTFILENAME\0AARGUMENT:\0A\09train:\09train the classifier\0A\09classify:\09classify the dataset\0A\00"
@.str.1 = [6 x i8] c"train\00"
@.str.2 = [9 x i8] c"classify\00"
@.str.3 = [16 x i8] c"Error command!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %36
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
store i8* %15, i8** %6
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
store i8* %18, i8** %7
%19 = load i8*, i8** %7
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %12
%23 = load i8*, i8** %6
%24 = call i32 @caculateNB_train(i8* %23)
br label %35
25: ; preds = %12
%26 = load i8*, i8** %7
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %25
%30 = load i8*, i8** %6
%31 = call i32 @caculateNB_classify(i8* %30)
br label %34
32: ; preds = %25
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
br label %35
35: ; preds = %34, %22
store i32 0, i32* %3
br label %36
36: ; preds = %35, %10
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"train\00"
@.str.2 = [9 x i8] c"classify\00"
@str = [15 x i8] c"Error command!\00"
@str.4 = [130 x i8] c"Wrong command format! usage:COMMAND ARGUMENT INPUTFILENAME\0AARGUMENT:\0A\09train:\09train the classifier\0A\09classify:\09classify the dataset\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([130 x i8], [130 x i8]* @str.4, i64 0, i64 0))
br label %22
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %6
%14 = tail call i32 @caculateNB_train(i8* %8)
br label %22
15: ; preds = %6
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @caculateNB_classify(i8* %8)
br label %22
20: ; preds = %15
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %13, %20, %18, %4
ret i32 0
}