#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 test_empty();
int test_numbers();
int test_objects();
int test_simple_array();
int test_simple_object();
int main() {
  const int error_addition = 20;
  int result = test_empty();
  if (0 != result) {
    return result;
  }
  result = test_simple_object();
  if (0 != result) {
    return (1 * error_addition) + result;
  }
  result = test_objects();
  if (0 != result) {
    return (2 * error_addition) + result;
  }
  result = test_simple_array();
  if (0 != result) {
    return (3 * error_addition) + result;
  }
  result = test_numbers();
  if (0 != result) {
    return (4 * error_addition) + result;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
mov    $0x0,%al
call   1060 <test_empty@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
je     1186 <main+0x36>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <main+0xc9>
mov    $0x0,%al
call   1070 <test_simple_object@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
je     11a9 <main+0x59>
mov    -0xc(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <main+0xc9>
mov    $0x0,%al
call   1050 <test_objects@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
je     11cc <main+0x7c>
mov    -0xc(%rbp),%eax
add    $0x28,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <main+0xc9>
mov    $0x0,%al
call   1040 <test_simple_array@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
je     11ef <main+0x9f>
mov    -0xc(%rbp),%eax
add    $0x3c,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <main+0xc9>
mov    $0x0,%al
call   1030 <test_numbers@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
je     1212 <main+0xc2>
mov    -0xc(%rbp),%eax
add    $0x50,%eax
mov    %eax,-0x4(%rbp)
jmp    1219 <main+0xc9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <test_empty@plt>
test   %eax,%eax
je     115e <main+0xe>
pop    %rcx
ret
xor    %eax,%eax
call   1070 <test_simple_object@plt>
test   %eax,%eax
je     116e <main+0x1e>
add    $0x14,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1050 <test_objects@plt>
test   %eax,%eax
je     117e <main+0x2e>
add    $0x28,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1040 <test_simple_array@plt>
test   %eax,%eax
je     118e <main+0x3e>
add    $0x3c,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <test_numbers@plt>
mov    %eax,%ecx
lea    0x50(%rcx),%eax
test   %ecx,%ecx
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 20, i32* %2
%4 = call i32 (...) @test_empty()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 0, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = load i32, i32* %3
store i32 %8, i32* %1
br label %38
9: ; preds = %0
%10 = call i32 (...) @test_simple_object()
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp ne i32 0, %11
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 20, %14
store i32 %15, i32* %1
br label %38
16: ; preds = %9
%17 = call i32 (...) @test_objects()
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = icmp ne i32 0, %18
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* %3
%22 = add nsw i32 40, %21
store i32 %22, i32* %1
br label %38
23: ; preds = %16
%24 = call i32 (...) @test_simple_array()
store i32 %24, i32* %3
%25 = load i32, i32* %3
%26 = icmp ne i32 0, %25
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* %3
%29 = add nsw i32 60, %28
store i32 %29, i32* %1
br label %38
30: ; preds = %23
%31 = call i32 (...) @test_numbers()
store i32 %31, i32* %3
%32 = load i32, i32* %3
%33 = icmp ne i32 0, %32
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %3
%36 = add nsw i32 80, %35
store i32 %36, i32* %1
br label %38
37: ; preds = %30
store i32 0, i32* %1
br label %38
38: ; preds = %37, %34, %27, %20, %13, %7
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_empty()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %23
3: ; preds = %0
%4 = tail call i32 (...) @test_simple_object()
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = add nsw i32 %4, 20
br label %23
8: ; preds = %3
%9 = tail call i32 (...) @test_objects()
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = add nsw i32 %9, 40
br label %23
13: ; preds = %8
%14 = tail call i32 (...) @test_simple_array()
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = add nsw i32 %14, 60
br label %23
18: ; preds = %13
%19 = tail call i32 (...) @test_numbers()
%20 = icmp eq i32 %19, 0
%21 = add nsw i32 %19, 80
%22 = select i1 %20, i32 0, i32 %21
br label %23
23: ; preds = %18, %0, %16, %11, %6
%24 = phi i32 [ %7, %6 ], [ %12, %11 ], [ %17, %16 ], [ %1, %0 ], [ %22, %18 ]
ret i32 %24
}