#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
unsigned long strtoul(char *, int /*<<< orphan*/, int);
unsigned long processCommandLine(int argc, char **argv) {
  if (argc == 2) {
    return strtoul(argv[1], 0, 10);
  } else if (argc == 1) {
    return 1;
  } else {
    fprintf(stderr, "\nUsage: ./forkJoin2 [numThreads]\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<processCommandLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    1166 <processCommandLine+0x36>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,-0x8(%rbp)
jmp    119c <processCommandLine+0x6c>
cmpl   $0x1,-0xc(%rbp)
jne    117d <processCommandLine+0x4d>
movq   $0x1,-0x8(%rbp)
jmp    119c <processCommandLine+0x6c>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processCommandLine>:
push   %rax
cmp    $0x1,%edi
je     114c <processCommandLine+0x1c>
cmp    $0x2,%edi
jne    1153 <processCommandLine+0x23>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
pop    %rax
jmp    1040 <strtoul@plt>
mov    $0x1,%eax
pop    %rcx
ret
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"\0AUsage: ./forkJoin2 [numThreads]\0A\00"
define i64 @processCommandLine(i32 %0, i8** %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strtoul(i8* %11, i32 0, i32 10)
store i64 %12, i64* %3
br label %21
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %13
store i64 1, i64* %3
br label %21
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %16, %8
%22 = load i64, i64* %3
ret i64 %22
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"\0AUsage: ./forkJoin2 [numThreads]\0A\00"
define i64 @processCommandLine(i32 %0, i8** nocapture %1) {
switch i32 %0, label %7 [
i32 2, label %3
i32 1, label %11
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i64 @strtoul(i8* %5, i32 0, i32 10)
br label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2, %3
%12 = phi i64 [ %6, %3 ], [ 1, %2 ]
ret i64 %12
}