#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 atoi(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ load_idx();
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ start_predict(int, int /*<<< orphan*/, int, int, int, int,
                                 int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int c;
  int thread = 1;
  while ((c = getopt(argc, argv, "t:")) != -1) {
    switch (c) {
    case 't':
      thread = atoi(optarg);
      break;
    default:
      fprintf(stderr, "Usage: %s <-t> thread\n", argv[0]);
      return 1;
    }
  }
  load_idx();
  printf("thread = %d\n", thread);
  start_predict(thread, 0, 50000, 50000, 60000, 60000, 70000);
  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)
movl   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe75(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11f0 <main+0x90>
mov    -0x14(%rbp),%eax
sub    $0x74,%eax
jne    11c3 <main+0x63>
jmp    11ad <main+0x4d>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11eb <main+0x8b>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe29(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    122e <main+0xce>
jmp    117d <main+0x1d>
mov    $0x0,%al
call   1080 <load_idx@plt>
mov    -0x18(%rbp),%esi
lea    0xe19(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
xor    %esi,%esi
mov    $0xc350,%ecx
mov    $0xea60,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
movl   $0x11170,(%rsp)
call   1030 <start_predict@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%r14d
lea    0xe82(%rip),%r15
mov    0x2e73(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
cmp    $0x74,%eax
jne    11b0 <main+0x50>
mov    (%r12),%edi
call   1070 <atoi@plt>
mov    %eax,%r14d
jmp    1190 <main+0x30>
cmp    $0xffffffff,%eax
jne    11f6 <main+0x96>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <load_idx@plt>
lea    0xe55(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
movl   $0x11170,(%rsp)
mov    %r14d,%edi
xor    %esi,%esi
mov    $0xc350,%edx
mov    $0xc350,%ecx
mov    $0xea60,%r8d
mov    $0xea60,%r9d
call   1030 <start_predict@plt>
jmp    1213 <main+0xb3>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdfa(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"t:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Usage: %s <-t> thread\0A\00"
@.str.2 = [13 x i8] c"thread = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %18 [
i32 116, label %15
]
15: ; preds = %13
%16 = load i32, i32* @optarg
%17 = call i32 @atoi(i32 %16)
store i32 %17, i32* %7
br label %24
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %22)
store i32 1, i32* %3
br label %31
24: ; preds = %15
br label %8
25: ; preds = %8
%26 = call i32 (...) @load_idx()
%27 = load i32, i32* %7
%28 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %7
%30 = call i32 @start_predict(i32 %29, i32 0, i32 50000, i32 50000, i32 60000, i32 60000, i32 70000)
store i32 0, i32* %3
br label %31
31: ; preds = %25, %18
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"t:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Usage: %s <-t> thread\0A\00"
@.str.2 = [13 x i8] c"thread = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %6, %2
%4 = phi i32 [ 1, %2 ], [ %8, %6 ]
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %9 [
i32 -1, label %13
i32 116, label %6
]
6: ; preds = %3
%7 = load i32, i32* @optarg
%8 = tail call i32 @atoi(i32 %7)
br label %3
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %17
13: ; preds = %3
%14 = tail call i32 (...) @load_idx()
%15 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%16 = tail call i32 @start_predict(i32 %4, i32 0, i32 50000, i32 50000, i32 60000, i32 60000, i32 70000)
br label %17
17: ; preds = %13, %9
%18 = phi i32 [ 1, %9 ], [ 0, %13 ]
ret i32 %18
}