#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 DC_initMaster(char *);
int /*<<< orphan*/ fail(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int strtol(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ t(int);
int main(int argc, char *argv[]) {
  int i;
  if ((i = DC_initMaster("t.conf")) != 0)
    fail("DC_initMaster", i);
  if (argc < 2) {
    printf("Calling all tests...\n");
    t(1);
    t(2);
    t(3);
    t(4);
    printf("WU serialized, now wait a bit...\n");
    sleep(5);
    printf("Trying to deserialize...\n");
    t(5);
  }
  for (i = 1; i < argc; i++) {
    int l;
    l = strtol(argv[i], 0, 0);
    printf("Calling test %d...\n", l);
    t(l);
  }
  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)
lea    0xe83(%rip),%rdi
call   1030 <DC_initMaster@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     119d <main+0x3d>
mov    -0x14(%rbp),%esi
lea    0xe6f(%rip),%rdi
call   1040 <fail@plt>
cmpl   $0x2,-0x8(%rbp)
jge    120d <main+0xad>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1050 <t@plt>
mov    $0x2,%edi
call   1050 <t@plt>
mov    $0x3,%edi
call   1050 <t@plt>
mov    $0x4,%edi
call   1050 <t@plt>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x5,%edi
call   1080 <sleep@plt>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x5,%edi
call   1050 <t@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    125f <main+0xff>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1070 <strtol@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%edi
call   1050 <t@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1214 <main+0xb4>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xe7c(%rip),%rdi
call   1040 <DC_initMaster@plt>
test   %eax,%eax
je     119b <main+0x2b>
lea    0xe73(%rip),%rdi
mov    %eax,%esi
call   1050 <fail@plt>
cmp    $0x1,%ebp
jg     1202 <main+0x92>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <t@plt>
mov    $0x2,%edi
call   1060 <t@plt>
mov    $0x3,%edi
call   1060 <t@plt>
mov    $0x4,%edi
call   1060 <t@plt>
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1090 <sleep@plt>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1060 <t@plt>
jmp    124b <main+0xdb>
mov    %ebp,%r12d
mov    $0x1,%ebx
lea    0xe04(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1060 <t@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1220 <main+0xb0>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"t.conf\00"
@.str.1 = [14 x i8] c"DC_initMaster\00"
@.str.2 = [22 x i8] c"Calling all tests...\0A\00"
@.str.3 = [34 x i8] c"WU serialized, now wait a bit...\0A\00"
@.str.4 = [26 x i8] c"Trying to deserialize...\0A\00"
@.str.5 = [20 x i8] c"Calling test %d...\0A\00"
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
%8 = call i32 @DC_initMaster(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %8, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* %6
%12 = call i32 @fail(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %2
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @t(i32 1)
%19 = call i32 @t(i32 2)
%20 = call i32 @t(i32 3)
%21 = call i32 @t(i32 4)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @sleep(i32 5)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @t(i32 5)
br label %26
26: ; preds = %16, %13
store i32 1, i32* %6
br label %27
27: ; preds = %42, %26
%28 = load i32, i32* %6
%29 = load i32, i32* %4
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %45
31: ; preds = %27
%32 = load i8**, i8*** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @strtol(i8* %36, i32 0, i32 0)
store i32 %37, i32* %7
%38 = load i32, i32* %7
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %7
%41 = call i32 @t(i32 %40)
br label %42
42: ; preds = %31
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %27
45: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"t.conf\00"
@.str.1 = [14 x i8] c"DC_initMaster\00"
@.str.5 = [20 x i8] c"Calling test %d...\0A\00"
@str = [21 x i8] c"Calling all tests...\00"
@str.6 = [33 x i8] c"WU serialized, now wait a bit...\00"
@str.7 = [25 x i8] c"Trying to deserialize...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @DC_initMaster(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @fail(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %7
7: ; preds = %5, %2
%8 = icmp slt i32 %0, 2
br i1 %8, label %9, label %19
9: ; preds = %7
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @t(i32 1)
%12 = tail call i32 @t(i32 2)
%13 = tail call i32 @t(i32 3)
%14 = tail call i32 @t(i32 4)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0))
%16 = tail call i32 @sleep(i32 5)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
%18 = tail call i32 @t(i32 5)
br label %30
19: ; preds = %7
%20 = zext i32 %0 to i64
br label %21
21: ; preds = %19, %21
%22 = phi i64 [ 1, %19 ], [ %28, %21 ]
%23 = getelementptr inbounds i8*, i8** %1, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32 @strtol(i8* %24, i32 0, i32 0)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = tail call i32 @t(i32 %25)
%28 = add nuw nsw i64 %22, 1
%29 = icmp eq i64 %28, %20
br i1 %29, label %30, label %21
30: ; preds = %21, %9
ret i32 0
}