#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*/ classify();
int /*<<< orphan*/ cprintf(char *, int);
int /*<<< orphan*/ getc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ train();
int main(int argc, char **argv) {
  int options = 999;
  char msg[100];
  while (options != 0) {
    system("clear");
    printf("=====================================\n");
    cprintf("\tEmotion Detection\n", 32);
    printf("=====================================");
    printf("\nEnter \n\t1 to train.");
    printf("\n\t2 to test.");
    printf("\n\t3 to clean.");
    printf("\n\t0 to quit.\n:]");
    scanf("%d", &options);
    switch (options) {
    case 1:
      train();
      break;
    case 2:
      classify();
      break;
    case 3:
      sprintf(msg, "rm %s*.gmm", "data/features/");
      system(msg);
      sprintf(msg, "rm %s*.csv", "data/features/");
      system(msg);
      sprintf(msg, "rm %s*.txt", "data/features/");
      system(msg);
      break;
    case 0:
      printf("\n\rBye bye.\n");
      break;
    default:
      printf("\n\rwrong options");
      break;
    }
    getc(stdin);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3e7,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12f7 <main+0x177>
lea    0xe5f(%rip),%rdi
call   1030 <system@plt>
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0x20,%esi
call   1050 <cprintf@plt>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %rax,-0x88(%rbp)
sub    $0x3,%rax
ja     12d8 <main+0x158>
mov    -0x88(%rbp),%rax
lea    0xdbf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <train@plt>
jmp    12e4 <main+0x164>
mov    $0x0,%al
call   1060 <classify@plt>
jmp    12e4 <main+0x164>
lea    -0x80(%rbp),%rdi
lea    0xe4d(%rip),%rsi
lea    0xe51(%rip),%rdx
call   1090 <sprintf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <system@plt>
lea    -0x80(%rbp),%rdi
lea    0xe47(%rip),%rsi
lea    0xe31(%rip),%rdx
call   1090 <sprintf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <system@plt>
lea    -0x80(%rbp),%rdi
lea    0xe32(%rip),%rsi
lea    0xe11(%rip),%rdx
call   1090 <sprintf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <system@plt>
jmp    12e4 <main+0x164>
lea    0xe1c(%rip),%rdi
call   1040 <printf@plt>
jmp    12e4 <main+0x164>
lea    0xe17(%rip),%rdi
call   1040 <printf@plt>
mov    0x2cfd(%rip),%rax
mov    (%rax),%edi
call   10a0 <getc@plt>
jmp    11a0 <main+0x20>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movl   $0x3e7,0xc(%rsp)
lea    0xf00(%rip),%rbx
lea    0xeb6(%rip),%r13
lea    0xc(%rsp),%r12
mov    0x2e28(%rip),%r15
lea    0xe39(%rip),%rbp
jmp    11f3 <main+0x63>
nopl   0x0(%rax)
lea    0xec6(%rip),%rdi
call   1050 <printf@plt>
nopl   0x0(%rax)
mov    (%r15),%edi
call   10b0 <getc@plt>
cmpl   $0x0,0xc(%rsp)
je     1329 <main+0x199>
lea    0xe16(%rip),%rdi
call   1040 <system@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe08(%rip),%rdi
mov    $0x20,%esi
call   1060 <cprintf@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
lea    0xe03(%rip),%rdi
call   1050 <printf@plt>
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe0d(%rip),%rdi
call   1050 <printf@plt>
lea    0xe0f(%rip),%rdi
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1090 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x3,%rax
ja     11d0 <main+0x40>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
jmp    11e0 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1080 <train@plt>
jmp    11e0 <main+0x50>
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <classify@plt>
jmp    11e0 <main+0x50>
nopl   0x0(%rax)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
lea    0xdae(%rip),%rsi
mov    %r13,%rbp
mov    %r15,%r13
lea    0xdac(%rip),%r15
mov    %r15,%rdx
call   10a0 <sprintf@plt>
mov    %r14,%rdi
call   1040 <system@plt>
mov    %r14,%rdi
lea    0xda1(%rip),%rsi
mov    %r15,%rdx
call   10a0 <sprintf@plt>
mov    %r14,%rdi
call   1040 <system@plt>
mov    %r14,%rdi
lea    0xd92(%rip),%rsi
mov    %r15,%rdx
mov    %r13,%r15
mov    %rbp,%r13
call   10a0 <sprintf@plt>
mov    %r14,%rdi
lea    0xd95(%rip),%rbx
lea    0xce1(%rip),%rbp
call   1040 <system@plt>
jmp    11e0 <main+0x50>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [39 x i8] c"=====================================\0A\00"
@.str.2 = [20 x i8] c"\09Emotion Detection\0A\00"
@.str.3 = [38 x i8] c"=====================================\00"
@.str.4 = [21 x i8] c"\0AEnter \0A\091 to train.\00"
@.str.5 = [13 x i8] c"\0A\092 to test.\00"
@.str.6 = [14 x i8] c"\0A\093 to clean.\00"
@.str.7 = [16 x i8] c"\0A\090 to quit.\0A:]\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [11 x i8] c"rm %s*.gmm\00"
@.str.10 = [15 x i8] c"data/features/\00"
@.str.11 = [11 x i8] c"rm %s*.csv\00"
@.str.12 = [11 x i8] c"rm %s*.txt\00"
@.str.13 = [12 x i8] c"\0A\0DBye bye.\0A\00"
@.str.14 = [16 x i8] c"\0A\0Dwrong options\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 999, i32* %6
br label %8
8: ; preds = %43, %2
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %46
11: ; preds = %8
%12 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @cprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 32)
%15 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %6)
%21 = load i32, i32* %6
switch i32 %21, label %41 [
i32 1, label %22
i32 2, label %24
i32 3, label %26
i32 0, label %39
]
22: ; preds = %11
%23 = call i32 (...) @train()
br label %43
24: ; preds = %11
%25 = call i32 (...) @classify()
br label %43
26: ; preds = %11
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%28 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%30 = call i32 @system(i8* %29)
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%32 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%34 = call i32 @system(i8* %33)
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%36 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%38 = call i32 @system(i8* %37)
br label %43
39: ; preds = %11
%40 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
br label %43
41: ; preds = %11
%42 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
br label %43
43: ; preds = %41, %39, %26, %24, %22
%44 = load i32, i32* @stdin
%45 = call i32 @getc(i32 %44)
br label %8
46: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.2 = [20 x i8] c"\09Emotion Detection\0A\00"
@.str.4 = [21 x i8] c"\0AEnter \0A\091 to train.\00"
@.str.5 = [13 x i8] c"\0A\092 to test.\00"
@.str.6 = [14 x i8] c"\0A\093 to clean.\00"
@.str.7 = [16 x i8] c"\0A\090 to quit.\0A:]\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [11 x i8] c"rm %s*.gmm\00"
@.str.10 = [15 x i8] c"data/features/\00"
@.str.11 = [11 x i8] c"rm %s*.csv\00"
@.str.12 = [11 x i8] c"rm %s*.txt\00"
@.str.14 = [16 x i8] c"\0A\0Dwrong options\00"
@stdin = global i32 0
@str = [38 x i8] c"=====================================\00"
@str.15 = [11 x i8] c"\0A\0DBye bye.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = bitcast i32* %3 to i8*
store i32 999, i32* %3
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %2, %33
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%10 = call i32 @cprintf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 32)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
switch i32 %17, label %31 [
i32 1, label %18
i32 2, label %20
i32 3, label %22
i32 0, label %29
]
18: ; preds = %7
%19 = call i32 (...) @train()
br label %33
20: ; preds = %7
%21 = call i32 (...) @classify()
br label %33
22: ; preds = %7
%23 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%24 = call i32 @system(i8* %6)
%25 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%26 = call i32 @system(i8* %6)
%27 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%28 = call i32 @system(i8* %6)
br label %33
29: ; preds = %7
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.15, i64 0, i64 0))
br label %33
31: ; preds = %7
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
br label %33
33: ; preds = %31, %29, %22, %20, %18
%34 = load i32, i32* @stdin
%35 = call i32 @getc(i32 %34)
%36 = load i32, i32* %3
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %7
38: ; preds = %33
ret i32 0
}