#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 create_main(int, char **);
int denoise_main(int, char **);
int dmodel_main(int, char **);
int est_dmodel_main(int, char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int histo_main(int, char **);
int htest_main(int, char **);
int lrdmodel_main(int, char **);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int usage(char **);
int view_main(int, char **);
int main(int argc, char **argv) {
  if (argc < 2)
    return usage(argv);
  int ret = 0;
  if (strcmp(argv[1], "create") == 0)
    ret = create_main(argc - 1, argv + 1);
  else if (strcmp(argv[1], "view") == 0)
    ret = view_main(argc - 1, argv + 1);
  else if (strcmp(argv[1], "denoise") == 0)
    ret = denoise_main(argc - 1, argv + 1);
  else if (strcmp(argv[1], "histo") == 0)
    ret = histo_main(argc - 1, argv + 1);
  else if (strcmp(argv[1], "histotest") == 0)
    ret = htest_main(argc - 1, argv + 1);
  else if (strcmp(argv[1], "modeltest") == 0)
    ret = dmodel_main(argc - 1, argv + 1);
  else if (strcmp(argv[1], "estmodel") == 0)
    ret = est_dmodel_main(argc - 1, argv + 1);
  else if (strcmp(argv[1], "lrdmodel") == 0)
    ret = lrdmodel_main(argc - 1, argv + 1);
  else {
    fprintf(stderr, "Unknown command %s\n", argv[1]);
    usage(argv);
  }
  return ret;
}


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   $0x2,-0x8(%rbp)
jge    11e1 <main+0x31>
mov    -0x10(%rbp),%rdi
call   10b0 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    13ff <main+0x24f>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe09(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1221 <main+0x71>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   10a0 <create_main@plt>
mov    %eax,-0x14(%rbp)
jmp    13f9 <main+0x249>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd7(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    125a <main+0xaa>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1090 <view_main@plt>
mov    %eax,-0x14(%rbp)
jmp    13f4 <main+0x244>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xda3(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1293 <main+0xe3>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1050 <denoise_main@plt>
mov    %eax,-0x14(%rbp)
jmp    13ef <main+0x23f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd72(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12cc <main+0x11c>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1030 <histo_main@plt>
mov    %eax,-0x14(%rbp)
jmp    13ea <main+0x23a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd3f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1305 <main+0x155>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   10c0 <htest_main@plt>
mov    %eax,-0x14(%rbp)
jmp    13e5 <main+0x235>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd10(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    133e <main+0x18e>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   10d0 <dmodel_main@plt>
mov    %eax,-0x14(%rbp)
jmp    13e0 <main+0x230>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xce1(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1377 <main+0x1c7>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1080 <est_dmodel_main@plt>
mov    %eax,-0x14(%rbp)
jmp    13db <main+0x22b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcb1(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    13b0 <main+0x200>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <lrdmodel_main@plt>
mov    %eax,-0x14(%rbp)
jmp    13d6 <main+0x226>
mov    0x2c29(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xc78(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <usage@plt>
jmp    13db <main+0x22b>
jmp    13e0 <main+0x230>
jmp    13e5 <main+0x235>
jmp    13ea <main+0x23a>
jmp    13ef <main+0x23f>
jmp    13f4 <main+0x244>
jmp    13f9 <main+0x249>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     11c8 <main+0x18>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    10b0 <usage@plt>
mov    %edi,%ebp
lea    0x8(%rbx),%r14
mov    0x8(%rbx),%rdi
lea    0xe27(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12b7 <main+0x107>
mov    (%r14),%rdi
lea    0xe16(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12c8 <main+0x118>
mov    (%r14),%rdi
lea    0xe03(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12d9 <main+0x129>
mov    (%r14),%rdi
lea    0xdf3(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12ea <main+0x13a>
mov    (%r14),%rdi
lea    0xde1(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12fb <main+0x14b>
mov    (%r14),%rdi
lea    0xdd3(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     130c <main+0x15c>
mov    (%r14),%rdi
lea    0xdc5(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     131d <main+0x16d>
mov    (%r14),%rdi
lea    0xdb6(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     132e <main+0x17e>
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xd9d(%rip),%rsi
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   10b0 <usage@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    10a0 <create_main@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1090 <view_main@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <denoise_main@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <histo_main@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    10c0 <htest_main@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    10d0 <dmodel_main@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1080 <est_dmodel_main@plt>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <lrdmodel_main@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"create\00"
@.str.1 = [5 x i8] c"view\00"
@.str.2 = [8 x i8] c"denoise\00"
@.str.3 = [6 x i8] c"histo\00"
@.str.4 = [10 x i8] c"histotest\00"
@.str.5 = [10 x i8] c"modeltest\00"
@.str.6 = [9 x i8] c"estmodel\00"
@.str.7 = [9 x i8] c"lrdmodel\00"
@stderr = global i32 0
@.str.8 = [20 x i8] c"Unknown command %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = call i32 @usage(i8** %10)
store i32 %11, i32* %3
br label %125
12: ; preds = %2
store i32 0, i32* %6
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = call i32 @create_main(i32 %20, i8** %22)
store i32 %23, i32* %6
br label %123
24: ; preds = %12
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %24
%31 = load i32, i32* %4
%32 = sub nsw i32 %31, 1
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = call i32 @view_main(i32 %32, i8** %34)
store i32 %35, i32* %6
br label %122
36: ; preds = %24
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %36
%43 = load i32, i32* %4
%44 = sub nsw i32 %43, 1
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = call i32 @denoise_main(i32 %44, i8** %46)
store i32 %47, i32* %6
br label %121
48: ; preds = %36
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %48
%55 = load i32, i32* %4
%56 = sub nsw i32 %55, 1
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = call i32 @histo_main(i32 %56, i8** %58)
store i32 %59, i32* %6
br label %120
60: ; preds = %48
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 1
%63 = load i8*, i8** %62
%64 = call i64 @strcmp(i8* %63, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %72
66: ; preds = %60
%67 = load i32, i32* %4
%68 = sub nsw i32 %67, 1
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 1
%71 = call i32 @htest_main(i32 %68, i8** %70)
store i32 %71, i32* %6
br label %119
72: ; preds = %60
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
%76 = call i64 @strcmp(i8* %75, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %84
78: ; preds = %72
%79 = load i32, i32* %4
%80 = sub nsw i32 %79, 1
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 1
%83 = call i32 @dmodel_main(i32 %80, i8** %82)
store i32 %83, i32* %6
br label %118
84: ; preds = %72
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 1
%87 = load i8*, i8** %86
%88 = call i64 @strcmp(i8* %87, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %96
90: ; preds = %84
%91 = load i32, i32* %4
%92 = sub nsw i32 %91, 1
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 1
%95 = call i32 @est_dmodel_main(i32 %92, i8** %94)
store i32 %95, i32* %6
br label %117
96: ; preds = %84
%97 = load i8**, i8*** %5
%98 = getelementptr inbounds i8*, i8** %97, i64 1
%99 = load i8*, i8** %98
%100 = call i64 @strcmp(i8* %99, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %108
102: ; preds = %96
%103 = load i32, i32* %4
%104 = sub nsw i32 %103, 1
%105 = load i8**, i8*** %5
%106 = getelementptr inbounds i8*, i8** %105, i64 1
%107 = call i32 @lrdmodel_main(i32 %104, i8** %106)
store i32 %107, i32* %6
br label %116
108: ; preds = %96
%109 = load i32, i32* @stderr
%110 = load i8**, i8*** %5
%111 = getelementptr inbounds i8*, i8** %110, i64 1
%112 = load i8*, i8** %111
%113 = call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %112)
%114 = load i8**, i8*** %5
%115 = call i32 @usage(i8** %114)
br label %116
116: ; preds = %108, %102
br label %117
117: ; preds = %116, %90
br label %118
118: ; preds = %117, %78
br label %119
119: ; preds = %118, %66
br label %120
120: ; preds = %119, %54
br label %121
121: ; preds = %120, %42
br label %122
122: ; preds = %121, %30
br label %123
123: ; preds = %122, %18
%124 = load i32, i32* %6
store i32 %124, i32* %3
br label %125
125: ; preds = %123, %9
%126 = load i32, i32* %3
ret i32 %126
}

LLVM IR (-O2):
@.str = [7 x i8] c"create\00"
@.str.1 = [5 x i8] c"view\00"
@.str.2 = [8 x i8] c"denoise\00"
@.str.3 = [6 x i8] c"histo\00"
@.str.4 = [10 x i8] c"histotest\00"
@.str.5 = [10 x i8] c"modeltest\00"
@.str.6 = [9 x i8] c"estmodel\00"
@.str.7 = [9 x i8] c"lrdmodel\00"
@stderr = global i32 0
@.str.8 = [20 x i8] c"Unknown command %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @usage(i8** %1)
br label %68
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = add nsw i32 %0, -1
%13 = tail call i32 @create_main(i32 %12, i8** %7)
br label %68
14: ; preds = %6
%15 = load i8*, i8** %7
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = add nsw i32 %0, -1
%20 = tail call i32 @view_main(i32 %19, i8** %7)
br label %68
21: ; preds = %14
%22 = load i8*, i8** %7
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = add nsw i32 %0, -1
%27 = tail call i32 @denoise_main(i32 %26, i8** %7)
br label %68
28: ; preds = %21
%29 = load i8*, i8** %7
%30 = tail call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = add nsw i32 %0, -1
%34 = tail call i32 @histo_main(i32 %33, i8** %7)
br label %68
35: ; preds = %28
%36 = load i8*, i8** %7
%37 = tail call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = add nsw i32 %0, -1
%41 = tail call i32 @htest_main(i32 %40, i8** %7)
br label %68
42: ; preds = %35
%43 = load i8*, i8** %7
%44 = tail call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = add nsw i32 %0, -1
%48 = tail call i32 @dmodel_main(i32 %47, i8** %7)
br label %68
49: ; preds = %42
%50 = load i8*, i8** %7
%51 = tail call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = add nsw i32 %0, -1
%55 = tail call i32 @est_dmodel_main(i32 %54, i8** %7)
br label %68
56: ; preds = %49
%57 = load i8*, i8** %7
%58 = tail call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %56
%61 = add nsw i32 %0, -1
%62 = tail call i32 @lrdmodel_main(i32 %61, i8** %7)
br label %68
63: ; preds = %56
%64 = load i32, i32* @stderr
%65 = load i8*, i8** %7
%66 = tail call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %65)
%67 = tail call i32 @usage(i8** %1)
br label %68
68: ; preds = %11, %25, %39, %53, %63, %60, %46, %32, %18, %4
%69 = phi i32 [ %5, %4 ], [ %13, %11 ], [ %20, %18 ], [ %27, %25 ], [ %34, %32 ], [ %41, %39 ], [ %48, %46 ], [ %55, %53 ], [ %62, %60 ], [ 0, %63 ]
ret i32 %69
}