#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 */
scalar_t__ M_PI;
double fabs(scalar_t__);
scalar_t__ pi(int);
int test_pi() {
  return 0.1 > fabs(M_PI - pi(1000000)) && 0.01 > fabs(M_PI - pi(10000000)) &&
         0.001 > fabs(M_PI - pi(100000000));
  ;
}


x86 assembly (clang, -O0):
<test_pi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    $0xf4240,%edi
call   1040 <pi@plt>
mov    -0x10(%rbp),%rdi
sub    %rax,%rdi
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xea7(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x1(%rbp)
jbe    11dd <test_pi+0xbd>
mov    0x2e7b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    $0x989680,%edi
call   1040 <pi@plt>
mov    -0x18(%rbp),%rdi
sub    %rax,%rdi
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe71(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x1(%rbp)
jbe    11dd <test_pi+0xbd>
mov    0x2e3d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x5f5e100,%edi
call   1040 <pi@plt>
mov    -0x20(%rbp),%rdi
sub    %rax,%rdi
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  0xe3d(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_pi>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ebd(%rip),%r14
mov    (%r14),%rbx
mov    $0xf4240,%edi
call   1040 <pi@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
call   1030 <fabs@plt>
xor    %ebp,%ebp
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a3 <test_pi+0x83>
mov    (%r14),%rbx
mov    $0x989680,%edi
call   1040 <pi@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
call   1030 <fabs@plt>
movsd  0xe95(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a3 <test_pi+0x83>
mov    (%r14),%rbx
mov    $0x5f5e100,%edi
call   1040 <pi@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
call   1030 <fabs@plt>
movsd  0xe77(%rip),%xmm1
xor    %ebp,%ebp
ucomisd %xmm0,%xmm1
seta   %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i64 0
define i32 @test_pi() {
%1 = load i64, i64* @M_PI
%2 = call i64 @pi(i32 1000000)
%3 = sub nsw i64 %1, %2
%4 = call double @fabs(i64 %3)
%5 = fcmp ogt double 1.000000e-01, %4
br i1 %5, label %6, label %18
6: ; preds = %0
%7 = load i64, i64* @M_PI
%8 = call i64 @pi(i32 10000000)
%9 = sub nsw i64 %7, %8
%10 = call double @fabs(i64 %9)
%11 = fcmp ogt double 1.000000e-02, %10
br i1 %11, label %12, label %18
12: ; preds = %6
%13 = load i64, i64* @M_PI
%14 = call i64 @pi(i32 100000000)
%15 = sub nsw i64 %13, %14
%16 = call double @fabs(i64 %15)
%17 = fcmp ogt double 1.000000e-03, %16
br label %18
18: ; preds = %12, %6, %0
%19 = phi i1 [ false, %6 ], [ false, %0 ], [ %17, %12 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
@M_PI = global i64 0
define i32 @test_pi() {
%1 = load i64, i64* @M_PI
%2 = tail call i64 @pi(i32 1000000)
%3 = sub nsw i64 %1, %2
%4 = tail call double @fabs(i64 %3)
%5 = fcmp olt double %4, 1.000000e-01
br i1 %5, label %6, label %19
6: ; preds = %0
%7 = load i64, i64* @M_PI
%8 = tail call i64 @pi(i32 10000000)
%9 = sub nsw i64 %7, %8
%10 = tail call double @fabs(i64 %9)
%11 = fcmp olt double %10, 1.000000e-02
br i1 %11, label %12, label %19
12: ; preds = %6
%13 = load i64, i64* @M_PI
%14 = tail call i64 @pi(i32 100000000)
%15 = sub nsw i64 %13, %14
%16 = tail call double @fabs(i64 %15)
%17 = fcmp olt double %16, 1.000000e-03
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %12, %6, %0
%20 = phi i32 [ 0, %6 ], [ 0, %0 ], [ %18, %12 ]
ret i32 %20
}