#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 mySqrt1(int);
int mySqrt2(int);
int mySqrt3(int);
int /*<<< orphan*/ printf(char *, int, ...);
bool test(int x) {
  int r1 = mySqrt1(x);
  int r2 = mySqrt2(x);
  int r3 = mySqrt3(x);
  printf("test %d\n", x);
  if (r1 != r3) {
    printf("%d->%d : %d\n", x, r1, r3);
    return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <mySqrt1@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <mySqrt2@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <mySqrt3@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     11ac <test+0x6c>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <test+0x73>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
call   1030 <mySqrt1@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1060 <mySqrt2@plt>
mov    %ebx,%edi
call   1040 <mySqrt3@plt>
mov    %eax,%ebp
lea    0xe9b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
cmp    %ebp,%r14d
je     118f <test+0x4f>
lea    0xe8a(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"test %d\0A\00"
@.str.1 = [13 x i8] c"%d->%d : %d\0A\00"
define i32 @test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @mySqrt1(i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = call i32 @mySqrt2(i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = call i32 @mySqrt3(i32 %11)
store i32 %12, i32* %6
%13 = load i32, i32* %3
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %4
%16 = load i32, i32* %6
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %1
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = load i32, i32* %6
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20, i32 %21)
store i32 0, i32* %2
br label %24
23: ; preds = %1
store i32 1, i32* %2
br label %24
24: ; preds = %23, %18
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [9 x i8] c"test %d\0A\00"
@.str.1 = [13 x i8] c"%d->%d : %d\0A\00"
define i32 @test(i32 %0) {
%2 = tail call i32 @mySqrt1(i32 %0)
%3 = tail call i32 @mySqrt2(i32 %0)
%4 = tail call i32 @mySqrt3(i32 %0)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = icmp eq i32 %2, %4
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %2, i32 %4)
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ 0, %7 ], [ 1, %1 ]
ret i32 %10
}