#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__ inCircle(unsigned long long, unsigned long long, unsigned long long);
int /*<<< orphan*/ printf(char *, double);
void circleD(unsigned long long size) {
  unsigned long long in = 0;
  unsigned long long tot = (size + 1) * (size + 1);
  unsigned long long x = 0;
  unsigned long long y = 0;
  while (1) {
    if (inCircle(x, y, size) && (x <= size)) {
      in++;
      x++;
    } else {
      y++;
      if (y == size)
        break;
      x = 0;
    }
  }
  double pi = (((double)in / (double)tot) * 4);
  printf("%e\n", pi);
}


x86 assembly (clang, -O0):
<circleD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    -0x8(%rbp),%rcx
add    $0x1,%rcx
imul   %rcx,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1040 <inCircle@plt>
cmp    $0x0,%rax
je     11a2 <circleD+0x82>
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
ja     11a2 <circleD+0x82>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11c9 <circleD+0xa9>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
jne    11c1 <circleD+0xa1>
jmp    11ce <circleD+0xae>
movq   $0x0,-0x20(%rbp)
jmp    115c <circleD+0x3c>
movq   -0x10(%rbp),%xmm0
movaps 0xe36(%rip),%xmm3
punpckldq %xmm3,%xmm0
movapd 0xe3a(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0x18(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xde7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe02(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<circleD>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
xor    %r14d,%r14d
xor    %eax,%eax
jmp    114d <circleD+0x2d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r14
lea    (%r12,%rbx,1),%rax
cmp    %r15,%r14
je     117e <circleD+0x5e>
mov    %rax,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <inCircle@plt>
cmp    %r15,%rbx
ja     1140 <circleD+0x20>
test   %rax,%rax
je     1140 <circleD+0x20>
add    $0x1,%rbx
jmp    1160 <circleD+0x40>
add    $0x1,%r15
imul   %r15,%r15
add    %rbx,%r12
movq   %r12,%xmm1
movdqa 0xe6a(%rip),%xmm2
punpckldq %xmm2,%xmm1
movapd 0xe6e(%rip),%xmm3
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movq   %r15,%xmm1
punpckldq %xmm2,%xmm1
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xe49(%rip),%xmm0
lea    0xe4a(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%e\0A\00"
define void @circleD(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca double
store i64 %0, i64* %2
store i64 0, i64* %3
%8 = load i64, i64* %2
%9 = add i64 %8, 1
%10 = load i64, i64* %2
%11 = add i64 %10, 1
%12 = mul i64 %9, %11
store i64 %12, i64* %4
store i64 0, i64* %5
store i64 0, i64* %6
br label %13
13: ; preds = %1, %36
%14 = load i64, i64* %5
%15 = load i64, i64* %6
%16 = load i64, i64* %2
%17 = call i64 @inCircle(i64 %14, i64 %15, i64 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %13
%20 = load i64, i64* %5
%21 = load i64, i64* %2
%22 = icmp ule i64 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i64, i64* %3
%25 = add i64 %24, 1
store i64 %25, i64* %3
%26 = load i64, i64* %5
%27 = add i64 %26, 1
store i64 %27, i64* %5
br label %36
28: ; preds = %19, %13
%29 = load i64, i64* %6
%30 = add i64 %29, 1
store i64 %30, i64* %6
%31 = load i64, i64* %6
%32 = load i64, i64* %2
%33 = icmp eq i64 %31, %32
br i1 %33, label %34, label %35
34: ; preds = %28
br label %37
35: ; preds = %28
store i64 0, i64* %5
br label %36
36: ; preds = %35, %23
br label %13
37: ; preds = %34
%38 = load i64, i64* %3
%39 = uitofp i64 %38 to double
%40 = load i64, i64* %4
%41 = uitofp i64 %40 to double
%42 = fdiv double %39, %41
%43 = fmul double %42, 4.000000e+00
store double %43, double* %7
%44 = load double, double* %7
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %44)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%e\0A\00"
define void @circleD(i64 %0) {
br label %2
2: ; preds = %15, %1
%3 = phi i64 [ %16, %15 ], [ 0, %1 ]
%4 = phi i64 [ %7, %15 ], [ 0, %1 ]
br label %5
5: ; preds = %2, %12
%6 = phi i64 [ %14, %12 ], [ 0, %2 ]
%7 = phi i64 [ %13, %12 ], [ %4, %2 ]
%8 = tail call i64 @inCircle(i64 %6, i64 %3, i64 %0)
%9 = icmp eq i64 %8, 0
%10 = icmp ugt i64 %6, %0
%11 = or i1 %10, %9
br i1 %11, label %15, label %12
12: ; preds = %5
%13 = add i64 %7, 1
%14 = add i64 %6, 1
br label %5
15: ; preds = %5
%16 = add i64 %3, 1
%17 = icmp eq i64 %16, %0
br i1 %17, label %18, label %2
18: ; preds = %15
%19 = add i64 %0, 1
%20 = mul i64 %19, %19
%21 = uitofp i64 %7 to double
%22 = uitofp i64 %20 to double
%23 = fdiv double %21, %22
%24 = fmul double %23, 4.000000e+00
%25 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %24)
ret void
}