#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 EXIT_SUCCESS;
int atoi(int /*<<< orphan*/);
char getopt(int, char **, char *);
double longrunning_rotation();
int /*<<< orphan*/ optarg;
scalar_t__ opterr;
int /*<<< orphan*/ parse_and_run_tests(int /*<<< orphan*/, int);
int /*<<< orphan*/ print_usage(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int retval = EXIT_SUCCESS;
  char optchar;
  opterr = 0;
  int selected_test = -1;
  while ((optchar = getopt(argc, argv, "n:t:r")) != -1) {
    switch (optchar) {
    case 'n':
      selected_test = atoi(optarg);
      break;
    case 't':
      parse_and_run_tests(optarg, selected_test);
      retval = EXIT_SUCCESS;
      goto cleanup;
    case 'r':
      printf("---- RESULTS ----\n");
      printf("Elapsed execution time: %.6fs\n", longrunning_rotation());
      printf("---- END RESULTS ----\n");
      retval = EXIT_SUCCESS;
      goto cleanup;
    }
  }
  print_usage(argv[0]);
  retval = EXIT_SUCCESS;
cleanup:
  return retval;
}


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)
mov    0x2e53(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e4f(%rip),%rax
movq   $0x0,(%rax)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe5b(%rip),%rdx
call   1060 <getopt@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     126f <main+0x10f>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x6e,%eax
je     11f0 <main+0x90>
jmp    11ce <main+0x6e>
mov    -0x20(%rbp),%eax
sub    $0x72,%eax
je     1228 <main+0xc8>
jmp    11df <main+0x7f>
mov    -0x20(%rbp),%eax
sub    $0x74,%eax
je     1206 <main+0xa6>
jmp    126a <main+0x10a>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    126a <main+0x10a>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%esi
call   1040 <parse_and_run_tests@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    1287 <main+0x127>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <longrunning_rotation@plt>
lea    0xdd5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    1287 <main+0x127>
jmp    1197 <main+0x37>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <print_usage@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e54(%rip),%rax
movq   $0x0,(%rax)
lea    0xe6e(%rip),%rdx
call   1070 <getopt@plt>
cmp    $0xff,%al
je     11fd <main+0x8d>
mov    $0xffffffff,%r15d
mov    0x2e50(%rip),%r12
lea    0xe51(%rip),%r14
jmp    11dd <main+0x6d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12),%edi
call   1080 <atoi@plt>
mov    %eax,%r15d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <getopt@plt>
cmp    $0xff,%al
je     11fd <main+0x8d>
movsbl %al,%eax
cmp    $0x6e,%eax
je     11c0 <main+0x50>
cmp    $0x72,%eax
je     1207 <main+0x97>
cmp    $0x74,%eax
jne    11cc <main+0x5c>
mov    (%r12),%edi
mov    %r15d,%esi
call   1050 <parse_and_run_tests@plt>
jmp    1234 <main+0xc4>
mov    (%rbx),%rdi
call   1090 <print_usage@plt>
jmp    1234 <main+0xc4>
lea    0xe17(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <longrunning_rotation@plt>
lea    0xde5(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe08(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@opterr = global i64 0
@.str = [6 x i8] c"n:t:r\00"
@optarg = global i32 0
@.str.1 = [19 x i8] c"---- RESULTS ----\0A\00"
@.str.2 = [31 x i8] c"Elapsed execution time: %.6fs\0A\00"
@.str.3 = [23 x i8] c"---- END RESULTS ----\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @EXIT_SUCCESS
store i32 %9, i32* %6
store i64 0, i64* @opterr
store i32 -1, i32* %8
br label %10
10: ; preds = %33, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call signext i8 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8 %13, i8* %7
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %34
16: ; preds = %10
%17 = load i8, i8* %7
%18 = sext i8 %17 to i32
switch i32 %18, label %33 [
i32 110, label %19
i32 116, label %22
i32 114, label %27
]
19: ; preds = %16
%20 = load i32, i32* @optarg
%21 = call i32 @atoi(i32 %20)
store i32 %21, i32* %8
br label %33
22: ; preds = %16
%23 = load i32, i32* @optarg
%24 = load i32, i32* %8
%25 = call i32 @parse_and_run_tests(i32 %23, i32 %24)
%26 = load i32, i32* @EXIT_SUCCESS
store i32 %26, i32* %6
br label %40
27: ; preds = %16
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%29 = call double (...) @longrunning_rotation()
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), double %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%32 = load i32, i32* @EXIT_SUCCESS
store i32 %32, i32* %6
br label %40
33: ; preds = %16, %19
br label %10
34: ; preds = %10
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 0
%37 = load i8*, i8** %36
%38 = call i32 @print_usage(i8* %37)
%39 = load i32, i32* @EXIT_SUCCESS
store i32 %39, i32* %6
br label %40
40: ; preds = %34, %27, %22
%41 = load i32, i32* %6
ret i32 %41
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@opterr = global i64 0
@.str = [6 x i8] c"n:t:r\00"
@optarg = global i32 0
@.str.2 = [31 x i8] c"Elapsed execution time: %.6fs\0A\00"
@str = [18 x i8] c"---- RESULTS ----\00"
@str.4 = [22 x i8] c"---- END RESULTS ----\00"
define i32 @main(i32 %0, i8** %1) {
store i64 0, i64* @opterr
%3 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8 %3, -1
br i1 %4, label %24, label %5
5: ; preds = %2, %20
%6 = phi i8 [ %22, %20 ], [ %3, %2 ]
%7 = phi i32 [ %21, %20 ], [ -1, %2 ]
%8 = sext i8 %6 to i32
switch i32 %8, label %20 [
i32 110, label %9
i32 116, label %12
i32 114, label %15
]
9: ; preds = %5
%10 = load i32, i32* @optarg
%11 = tail call i32 @atoi(i32 %10)
br label %20
12: ; preds = %5
%13 = load i32, i32* @optarg
%14 = tail call i32 @parse_and_run_tests(i32 %13, i32 %7)
br label %27
15: ; preds = %5
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%17 = tail call double (...) @longrunning_rotation()
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), double %17)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
br label %27
20: ; preds = %5, %9
%21 = phi i32 [ %7, %5 ], [ %11, %9 ]
%22 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i8 %22, -1
br i1 %23, label %24, label %5
24: ; preds = %20, %2
%25 = load i8*, i8** %1
%26 = tail call i32 @print_usage(i8* %25)
br label %27
27: ; preds = %24, %15, %12
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
}