#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 atoi(char *);
int /*<<< orphan*/ printf(char *, char *);
char *run_all_tests();
char *run_test(int);
int main(int argc, char **argv) {
  char *result;
  int test_id;
  if (argc > 1) {
    test_id = atoi(argv[1]);
    result = run_test(test_id);
  } else {
    result = run_all_tests();
  }
  if (result != 0) {
    printf("%s\n", result);
  }
  return result != 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)
jle    1181 <main+0x41>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <run_test@plt>
mov    %rax,-0x18(%rbp)
jmp    118c <main+0x4c>
mov    $0x0,%al
call   1050 <run_all_tests@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11a7 <main+0x67>
mov    -0x18(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jl     1158 <main+0x18>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1040 <run_test@plt>
jmp    115f <main+0x1f>
xor    %eax,%eax
call   1050 <run_all_tests@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1176 <main+0x36>
lea    0xe92(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = call i8* @run_test(i32 %15)
store i8* %16, i8** %6
br label %19
17: ; preds = %2
%18 = call i8* (...) @run_all_tests()
store i8* %18, i8** %6
br label %19
19: ; preds = %17, %10
%20 = load i8*, i8** %6
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i8*, i8** %6
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %22, %19
%26 = load i8*, i8** %6
%27 = icmp ne i8* %26, null
%28 = zext i1 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = tail call i8* @run_test(i32 %7)
br label %11
9: ; preds = %2
%10 = tail call i8* (...) @run_all_tests()
br label %11
11: ; preds = %9, %4
%12 = phi i8* [ %8, %4 ], [ %10, %9 ]
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %16
16: ; preds = %14, %11
%17 = zext i1 %13 to i32
ret i32 %17
}