#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);
int /*<<< orphan*/ start_predict(int, int, int /*<<< orphan*/, int, int, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int c;
  int thread = 1;
  int k = 1;
  while ((c = getopt(argc, argv, "t:k:")) != -1) {
    switch (c) {
    case 't':
      thread = atoi(optarg);
      break;
    case 'k':
      k = atoi(optarg);
      break;
    default:
      fprintf(stderr, "Usage: %s <-k K> <-t> thread\n", argv[0]);
      return 1;
    }
  }
  load_idx();
  printf("k = %d, thread = %d\n", k, thread);
  start_predict(k, thread, 0, 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)
movl   $0x1,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6e(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1221 <main+0xc1>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x6b,%eax
je     11de <main+0x7e>
jmp    11b7 <main+0x57>
mov    -0x20(%rbp),%eax
sub    $0x74,%eax
jne    11f4 <main+0x94>
jmp    11c8 <main+0x68>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    121c <main+0xbc>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    121c <main+0xbc>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdfa(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    125d <main+0xfd>
jmp    1184 <main+0x24>
mov    $0x0,%al
call   1080 <load_idx@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xdee(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
xor    %edx,%edx
mov    $0xea60,%r8d
mov    $0x11170,%r9d
mov    %r8d,%ecx
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   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%r14d
lea    0xe83(%rip),%r12
mov    0x2e74(%rip),%r13
mov    $0x1,%r15d
jmp    119c <main+0x3c>
nopl   0x0(%rax)
mov    0x0(%r13),%edi
call   1070 <atoi@plt>
mov    %eax,%r15d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1060 <getopt@plt>
cmp    $0x6b,%eax
je     1190 <main+0x30>
cmp    $0xffffffff,%eax
je     11c6 <main+0x66>
cmp    $0x74,%eax
jne    1201 <main+0xa1>
mov    0x0(%r13),%edi
call   1070 <atoi@plt>
mov    %eax,%r14d
jmp    119c <main+0x3c>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <load_idx@plt>
lea    0xe4d(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1040 <printf@plt>
mov    %r15d,%edi
mov    %r14d,%esi
xor    %edx,%edx
mov    $0xea60,%ecx
mov    $0xea60,%r8d
mov    $0x11170,%r9d
call   1030 <start_predict@plt>
jmp    121e <main+0xbe>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdf1(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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