#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 compute_square(int);
int /*<<< orphan*/ test1();
int test2();
int /*<<< orphan*/ test3(int);
int main(void) {
  int x;
  int tmp;
  int tmp___0;
  {
    {
      x = 2;
      test1();
      test2();
      tmp = test2();
    }
    if (tmp) {
      goto ERROR;
    } else {
    }
    {
      test3(x);
      compute_square(x);
      tmp___0 = compute_square(x);
      x = tmp___0 + 2;
    }
    if (x != 7) {
      goto ERROR;
    } else {
    }
    return (0);
  ERROR:
    return (-1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test1@plt>
mov    $0x0,%al
call   1060 <test2@plt>
mov    $0x0,%al
call   1060 <test2@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     117d <main+0x3d>
jmp    11c6 <main+0x86>
jmp    1182 <main+0x42>
mov    -0x8(%rbp),%edi
call   1030 <test3@plt>
mov    -0x8(%rbp),%edi
call   1050 <compute_square@plt>
mov    -0x8(%rbp),%edi
call   1050 <compute_square@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
je     11b5 <main+0x75>
jmp    11c6 <main+0x86>
jmp    11ba <main+0x7a>
movl   $0x0,-0x4(%rbp)
jmp    11cd <main+0x8d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <test1@plt>
xor    %eax,%eax
call   1060 <test2@plt>
xor    %eax,%eax
call   1060 <test2@plt>
test   %eax,%eax
jne    117f <main+0x3f>
mov    $0x2,%edi
call   1030 <test3@plt>
mov    $0x2,%edi
call   1050 <compute_square@plt>
mov    $0x2,%edi
call   1050 <compute_square@plt>
cmp    $0x5,%eax
je     1184 <main+0x44>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
%5 = call i32 (...) @test1()
%6 = call i32 (...) @test2()
%7 = call i32 (...) @test2()
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %0
br label %26
11: ; preds = %0
br label %12
12: ; preds = %11
%13 = load i32, i32* %2
%14 = call i32 @test3(i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @compute_square(i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @compute_square(i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 2
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = icmp ne i32 %21, 7
br i1 %22, label %23, label %24
23: ; preds = %12
br label %26
24: ; preds = %12
br label %25
25: ; preds = %24
store i32 0, i32* %1
br label %27
26: ; preds = %23, %10
store i32 -1, i32* %1
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test1()
%2 = tail call i32 (...) @test2()
%3 = tail call i32 (...) @test2()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = tail call i32 @test3(i32 2)
%7 = tail call i32 @compute_square(i32 2)
%8 = tail call i32 @compute_square(i32 2)
%9 = icmp eq i32 %8, 5
br i1 %9, label %11, label %10
10: ; preds = %5, %0
br label %11
11: ; preds = %5, %10
%12 = phi i32 [ -1, %10 ], [ 0, %5 ]
ret i32 %12
}