#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 EOF;
int /*<<< orphan*/ EXIT_SUCCESS;
int atoi(int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int run_test(int);
int /*<<< orphan*/ usage(char *, int /*<<< orphan*/);
int main(int ac, char *av[]) {
  int c, nthreads = 1;
  while ((c = getopt(ac, av, "n:")) != EOF) {
    switch (c) {
    case 'n':
      nthreads = atoi(optarg);
      break;
    case 'h':
      usage(av[0], EXIT_SUCCESS);
    }
  }
  return run_test(nthreads);
}


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    0xe95(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%eax
je     11d7 <main+0x97>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x68,%eax
je     11bd <main+0x7d>
jmp    1196 <main+0x56>
mov    -0x1c(%rbp),%eax
sub    $0x6e,%eax
jne    11d2 <main+0x92>
jmp    11a7 <main+0x67>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11d2 <main+0x92>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2e05(%rip),%rax
mov    (%rax),%esi
call   1040 <usage@plt>
jmp    115d <main+0x1d>
mov    -0x18(%rbp),%edi
call   1030 <run_test@plt>
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
lea    0xea9(%rip),%rdx
call   1050 <getopt@plt>
mov    0x2e7d(%rip),%r12
mov    $0x1,%r14d
cmp    (%r12),%eax
jne    1185 <main+0x45>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <run_test@plt>
mov    $0x1,%r14d
lea    0xe6e(%rip),%r15
mov    0x2e5f(%rip),%r13
jmp    11c4 <main+0x84>
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
mov    0x2e26(%rip),%rax
mov    (%rax),%esi
call   1040 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <getopt@plt>
cmp    (%r12),%eax
je     116f <main+0x2f>
cmp    $0x68,%eax
je     11a0 <main+0x60>
cmp    $0x6e,%eax
jne    11b1 <main+0x71>
mov    0x0(%r13),%edi
call   1060 <atoi@plt>
mov    %eax,%r14d
jmp    11b1 <main+0x71>

LLVM IR (-O0):
@.str = [3 x i8] c"n:\00"
@EOF = global i32 0
@optarg = global i32 0
@EXIT_SUCCESS = global i32 0
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 = %25, %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 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %26
14: ; preds = %8
%15 = load i32, i32* %6
switch i32 %15, label %25 [
i32 110, label %16
i32 104, label %19
]
16: ; preds = %14
%17 = load i32, i32* @optarg
%18 = call i32 @atoi(i32 %17)
store i32 %18, i32* %7
br label %25
19: ; preds = %14
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = load i32, i32* @EXIT_SUCCESS
%24 = call i32 @usage(i8* %22, i32 %23)
br label %25
25: ; preds = %19, %14, %16
br label %8
26: ; preds = %8
%27 = load i32, i32* %7
%28 = call i32 @run_test(i32 %27)
ret i32 %28
}

LLVM IR (-O2):
@.str = [3 x i8] c"n:\00"
@EOF = global i32 0
@optarg = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %21, label %6
6: ; preds = %2, %16
%7 = phi i32 [ %18, %16 ], [ %3, %2 ]
%8 = phi i32 [ %17, %16 ], [ 1, %2 ]
switch i32 %7, label %16 [
i32 110, label %9
i32 104, label %12
]
9: ; preds = %6
%10 = load i32, i32* @optarg
%11 = tail call i32 @atoi(i32 %10)
br label %16
12: ; preds = %6
%13 = load i8*, i8** %1
%14 = load i32, i32* @EXIT_SUCCESS
%15 = tail call i32 @usage(i8* %13, i32 %14)
br label %16
16: ; preds = %12, %6, %9
%17 = phi i32 [ %8, %6 ], [ %8, %12 ], [ %11, %9 ]
%18 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %6
21: ; preds = %16, %2
%22 = phi i32 [ 1, %2 ], [ %17, %16 ]
%23 = tail call i32 @run_test(i32 %22)
ret i32 %23
}