#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 */
scalar_t__ errno;
scalar_t__ isdigit(char);
int strtol(char *, char **, int);
int /*<<< orphan*/ test(int);
int test_all();
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  int t;
  if (argc == 1) {
    return test_all();
  } else if (argc == 2 && isdigit(argv[1][0])) {
    errno = 0;
    t = strtol(argv[1], (char **)NULL, 10);
    if (errno != 0) {
      usage(argv[0]);
    } else {
      test(t);
    }
  } else {
    usage(argv[0]);
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jne    117f <main+0x2f>
mov    $0x0,%al
call   1060 <test_all@plt>
mov    %eax,-0x4(%rbp)
jmp    1211 <main+0xc1>
cmpl   $0x2,-0x8(%rbp)
jne    11f9 <main+0xa9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11f9 <main+0xa9>
mov    0x2e36(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e0f(%rip),%rax
cmpq   $0x0,(%rax)
je     11ec <main+0x9c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
jmp    11f4 <main+0xa4>
mov    -0x14(%rbp),%edi
call   1070 <test@plt>
jmp    1205 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
jmp    120a <main+0xba>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
je     116f <main+0x1f>
cmp    $0x1,%edi
jne    11a4 <main+0x54>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <test_all@plt>
mov    0x8(%rbx),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     11a4 <main+0x54>
mov    0x2e59(%rip),%r14
movq   $0x0,(%r14)
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
cmpq   $0x0,(%r14)
je     11b6 <main+0x66>
mov    (%rbx),%rdi
call   1050 <usage@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %eax,%edi
call   1070 <test@plt>
jmp    11ac <main+0x5c>

LLVM IR (-O0):
@errno = global i64 0
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 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @test_all()
store i32 %10, i32* %3
br label %45
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %38
14: ; preds = %11
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = call i64 @isdigit(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %38
22: ; preds = %14
store i64 0, i64* @errno
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strtol(i8* %25, i8** null, i32 10)
store i32 %26, i32* %6
%27 = load i64, i64* @errno
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %22
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 @usage(i8* %32)
br label %37
34: ; preds = %22
%35 = load i32, i32* %6
%36 = call i32 @test(i32 %35)
br label %37
37: ; preds = %34, %29
br label %43
38: ; preds = %14, %11
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 @usage(i8* %41)
br label %43
43: ; preds = %38, %37
br label %44
44: ; preds = %43
store i32 0, i32* %3
br label %45
45: ; preds = %44, %9
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@errno = global i64 0
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %21 [
i32 1, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = tail call i32 (...) @test_all()
br label %24
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = tail call i64 @isdigit(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %5
store i64 0, i64* @errno
%12 = load i8*, i8** %6
%13 = tail call i32 @strtol(i8* nocapture %12, i8** null, i32 10)
%14 = load i64, i64* @errno
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %11
%17 = load i8*, i8** %1
%18 = tail call i32 @usage(i8* %17)
br label %24
19: ; preds = %11
%20 = tail call i32 @test(i32 %13)
br label %24
21: ; preds = %2, %5
%22 = load i8*, i8** %1
%23 = tail call i32 @usage(i8* %22)
br label %24
24: ; preds = %16, %19, %21, %3
%25 = phi i32 [ %4, %3 ], [ 0, %21 ], [ 0, %19 ], [ 0, %16 ]
ret i32 %25
}