#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*/ generate(int, int, int);
int getopt(int, char **, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ run_tests();
int /*<<< orphan*/ solve();
int /*<<< orphan*/ srand(int);
int time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  srand(time(NULL) ^ (int)&main);
  run_tests();
  int option = getopt(argc, argv, "hsl");
  switch (option) {
  case -1:
    solve();
    break;
  case 's':
    generate(10, 3, 100);
    break;
  case 'l':
    generate(50, 3, 2000);
    break;
  case 'h':
  default:
    printf("usage: store_credit -s  # random generate small input\n"
           "       store_credit -l  # random generate large input\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)
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
mov    0x2e4e(%rip),%eax
xor    %eax,%edi
call   1050 <srand@plt>
mov    -0x1c(%rbp),%eax
call   1080 <run_tests@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe49(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0xffffffff,%eax
je     1206 <main+0x96>
jmp    11d3 <main+0x63>
mov    -0x18(%rbp),%eax
sub    $0x68,%eax
je     1244 <main+0xd4>
jmp    11e4 <main+0x74>
mov    -0x18(%rbp),%eax
sub    $0x6c,%eax
je     122b <main+0xbb>
jmp    11f5 <main+0x85>
mov    -0x18(%rbp),%eax
sub    $0x73,%eax
je     1212 <main+0xa2>
jmp    1249 <main+0xd9>
mov    $0x0,%al
call   1030 <solve@plt>
jmp    1255 <main+0xe5>
mov    $0xa,%edi
mov    $0x3,%esi
mov    $0x64,%edx
call   1090 <generate@plt>
jmp    1255 <main+0xe5>
mov    $0x32,%edi
mov    $0x3,%esi
mov    $0x7d0,%edx
call   1090 <generate@plt>
jmp    1255 <main+0xe5>
jmp    1249 <main+0xd9>
lea    0xdb4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
call   1060 <time@plt>
xor    0x2e63(%rip),%eax
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <run_tests@plt>
lea    0xe66(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <getopt@plt>
cmp    $0x73,%eax
je     11bc <main+0x4c>
cmp    $0x6c,%eax
je     11d2 <main+0x62>
cmp    $0xffffffff,%eax
jne    11e8 <main+0x78>
xor    %eax,%eax
call   1030 <solve@plt>
jmp    11f4 <main+0x84>
mov    $0xa,%edi
mov    $0x3,%esi
mov    $0x64,%edx
call   1090 <generate@plt>
jmp    11f4 <main+0x84>
mov    $0x32,%edi
mov    $0x3,%esi
mov    $0x7d0,%edx
call   1090 <generate@plt>
jmp    11f4 <main+0x84>
lea    0xe15(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"hsl\00"
@.str.1 = [109 x i8] c"usage: store_credit -s # random generate small input\0A store_credit -l # random generate large input\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 = call i32 @time(i32* null)
%8 = xor i32 %7, ptrtoint (i32 (i32, i8**)* @main to i32)
%9 = call i32 @srand(i32 %8)
%10 = call i32 (...) @run_tests()
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %6
%14 = load i32, i32* %6
switch i32 %14, label %22 [
i32 -1, label %15
i32 115, label %17
i32 108, label %19
i32 104, label %21
]
15: ; preds = %2
%16 = call i32 (...) @solve()
br label %24
17: ; preds = %2
%18 = call i32 @generate(i32 10, i32 3, i32 100)
br label %24
19: ; preds = %2
%20 = call i32 @generate(i32 50, i32 3, i32 2000)
br label %24
21: ; preds = %2
br label %22
22: ; preds = %2, %21
%23 = call i32 @printf(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %19, %17, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"hsl\00"
@str = [108 x i8] c"usage: store_credit -s # random generate small input\0A store_credit -l # random generate large input\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @time(i32* null)
%4 = xor i32 %3, ptrtoint (i32 (i32, i8**)* @main to i32)
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 (...) @run_tests()
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %7, label %14 [
i32 -1, label %8
i32 115, label %10
i32 108, label %12
]
8: ; preds = %2
%9 = tail call i32 (...) @solve()
br label %16
10: ; preds = %2
%11 = tail call i32 @generate(i32 10, i32 3, i32 100)
br label %16
12: ; preds = %2
%13 = tail call i32 @generate(i32 50, i32 3, i32 2000)
br label %16
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %14, %12, %10, %8
ret i32 0
}