#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 /*<<< orphan*/ fflush(int /*<<< orphan*/);
double pow(long, double);
int /*<<< orphan*/ printf(char *, long, long, ...);
long round(double);
int /*<<< orphan*/ stdout;
int main(void) {
  double Sqrt3 = pow(3, 0.5);
  int veryVerbose = 0;
  int verboseEvery = 0;
  int verboseDist = 10;
  long DistSqrd_s = 3;
  long DistSqrd_n = 64151555;
  long DistSqrdStart = DistSqrd_n * DistSqrd_n * DistSqrd_s;
  long DistSqrdEnd = 22346266026754075;
  long DistanceSqrd = DistSqrdStart;
  long DistanceSqrd12;
  long firstLayer;
  long lastLayer;
  long layer;
  long layerSqrd;
  long ct;
  long ctmax = 0;
  long DstSqrdMax;
  long delta;
  long i;
  float eps;
  float erro;
  double i_float;
  float p;
  eps = 1.e-8;
  do {
    DistanceSqrd12 = 12 * DistanceSqrd;
    firstLayer = pow(DistanceSqrd, 0.5) / Sqrt3;
    lastLayer = 2. / 3 * pow(DistanceSqrd, 0.5);
    ct = 0;
    layer = firstLayer;
    do {
      layerSqrd = layer * layer;
      delta = DistanceSqrd12 - 27 * layerSqrd;
      i_float = (3.0 * layer - pow(delta, 0.5)) / 6.0;
      i = round(i_float);
      erro = i - i_float;
      if (erro < 0)
        erro = -erro;
      if (erro < eps & i >= 0) {
        if (DistanceSqrd == 3 * (layerSqrd - layer * i + i * i)) {
          if (i == 0) {
            ct += 6;
            if (veryVerbose)
              printf("found 6 hexagons at layer=%li and i=%li, ct=%li\n", layer,
                     i, ct);
          } else if (!(layer & 1) & i == layer >> 1) {
            ct += 6;
            if (veryVerbose)
              printf("found 6 hexagons at layer=%li and i=%li, ct=%li\n", layer,
                     i, ct);
          } else {
            ct += 12;
            if (veryVerbose)
              printf("found 12 hexagons at layer=%li and i=%li, ct=%li\n",
                     layer, i, ct);
          }
        }
      }
      if (verboseEvery)
        if (!(layer % verboseEvery)) {
          p = 1. * (layer - firstLayer) / (lastLayer - firstLayer);
          printf("Found %li so far - %.2f%% done\r", ct, 100 * p);
          fflush(stdout);
        }
      layer += 1;
    } while (layer <= lastLayer);
    if (ct > ctmax) {
      ctmax = ct;
      DstSqrdMax = DistanceSqrd;
    }
    if (ct == 450)
      printf("!!! Fount %li hexagons found for a distance^2= %li !!!\n", ct,
             DistanceSqrd);
    if (verboseDist)
      if (!((DistanceSqrd - DistSqrdStart) % verboseDist)) {
        p = 1. * (DistanceSqrd - DistSqrdStart) / (DistSqrdEnd - DistSqrdStart);
        printf("A maximum of %li hexagons found for a distance^2= %li - %.4f%% "
               "done\r",
               ctmax, DstSqrdMax, 100 * p);
        fflush(stdout);
      }
    if (!verboseDist & verboseEvery)
      printf("A total of %li hexagons found for a distance^2= %li\n", ct,
             DistanceSqrd);
    DistanceSqrd += (2 * (DistSqrd_n++) + 1) * DistSqrd_s;
  } while (DistanceSqrd < DistSqrdEnd);
  printf("Maximum number of hexagons found was %li for a distance^2=%li\n",
         ctmax, DstSqrdMax);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
movsd  0xea9(%rip),%xmm0
call   1050 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0xa,-0x1c(%rbp)
movq   $0x3,-0x28(%rbp)
movq   $0x3d2e003,-0x30(%rbp)
03
mov    -0x30(%rbp),%rax
imul   -0x30(%rbp),%rax
imul   -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
movabs $0x4f63cf8094c01b,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
movq   $0x0,-0x80(%rbp)
movss  0xe3a(%rip),%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
imul   $0xc,-0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
movsd  0xe25(%rip),%xmm0
call   1050 <pow@plt>
divsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x58(%rbp)
mov    -0x48(%rbp),%rdi
movsd  0xe06(%rip),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xdfe(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x60(%rbp)
movq   $0x0,-0x78(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
imul   -0x68(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x50(%rbp),%rax
imul   $0x1b,-0x70(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x90(%rbp)
cvtsi2sdq -0x68(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x90(%rbp),%rdi
movsd  0xd9c(%rip),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xd85(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd6d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
call   1060 <round@plt>
mov    %rax,-0x98(%rbp)
cvtsi2sdq -0x98(%rbp),%xmm0
ff ff
subsd  -0xa8(%rbp),%xmm0
ff
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xa0(%rbp)
ff
xorps  %xmm0,%xmm0
ucomiss -0xa0(%rbp),%xmm0
jbe    1315 <main+0x1d5>
movss  -0xa0(%rbp),%xmm0
ff
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xa0(%rbp)
ff
movss  -0xa0(%rbp),%xmm1
ff
movss  -0x9c(%rbp),%xmm0
ff
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
cmpq   $0x0,-0x98(%rbp)
setge  %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1483 <main+0x343>
mov    -0x48(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    -0x68(%rbp),%rdx
imul   -0x98(%rbp),%rdx
ff
sub    %rdx,%rcx
mov    -0x98(%rbp),%rdx
imul   -0x98(%rbp),%rdx
ff
add    %rdx,%rcx
imul   $0x3,%rcx,%rcx
cmp    %rcx,%rax
jne    147e <main+0x33e>
cmpq   $0x0,-0x98(%rbp)
jne    13c8 <main+0x288>
mov    -0x78(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x78(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     13c3 <main+0x283>
mov    -0x68(%rbp),%rsi
mov    -0x98(%rbp),%rdx
mov    -0x78(%rbp),%rcx
lea    0xc74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1479 <main+0x339>
mov    -0x68(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x98(%rbp),%rcx
mov    -0x68(%rbp),%rdx
sar    $0x1,%rdx
cmp    %rdx,%rcx
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     143c <main+0x2fc>
mov    -0x78(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x78(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1437 <main+0x2f7>
mov    -0x68(%rbp),%rsi
mov    -0x98(%rbp),%rdx
mov    -0x78(%rbp),%rcx
lea    0xc00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1474 <main+0x334>
mov    -0x78(%rbp),%rax
add    $0xc,%rax
mov    %rax,-0x78(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     146f <main+0x32f>
mov    -0x68(%rbp),%rsi
mov    -0x98(%rbp),%rdx
mov    -0x78(%rbp),%rcx
lea    0xbf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1474 <main+0x334>
jmp    1479 <main+0x339>
jmp    147e <main+0x33e>
jmp    1483 <main+0x343>
cmpl   $0x0,-0x18(%rbp)
je     1514 <main+0x3d4>
mov    -0x68(%rbp),%rax
movslq -0x18(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    150f <main+0x3cf>
mov    -0x68(%rbp),%rax
sub    -0x58(%rbp),%rax
cvtsi2sd %rax,%xmm1
movsd  0xb6f(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x60(%rbp),%rax
sub    -0x58(%rbp),%rax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xac(%rbp)
ff
mov    -0x78(%rbp),%rsi
movss  0xb1e(%rip),%xmm0
mulss  -0xac(%rbp),%xmm0
ff
cvttss2si %xmm0,%rdx
lea    0xb99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ad8(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    1514 <main+0x3d4>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
cmp    -0x60(%rbp),%rax
jle    122f <main+0xef>
mov    -0x78(%rbp),%rax
cmp    -0x80(%rbp),%rax
jle    154f <main+0x40f>
mov    -0x78(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x88(%rbp)
cmpq   $0x1c2,-0x78(%rbp)
jne    1573 <main+0x433>
mov    -0x78(%rbp),%rsi
mov    -0x48(%rbp),%rdx
lea    0xb47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
je     160e <main+0x4ce>
mov    -0x48(%rbp),%rax
sub    -0x38(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    1609 <main+0x4c9>
mov    -0x48(%rbp),%rax
sub    -0x38(%rbp),%rax
cvtsi2sd %rax,%xmm1
movsd  0xa7b(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
sub    -0x38(%rbp),%rax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xac(%rbp)
ff
mov    -0x80(%rbp),%rsi
mov    -0x88(%rbp),%rdx
movss  0xa23(%rip),%xmm0
mulss  -0xac(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xaf7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x29de(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    160e <main+0x4ce>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
and    -0x18(%rbp),%eax
cmp    $0x0,%eax
je     163e <main+0x4fe>
mov    -0x78(%rbp),%rsi
mov    -0x48(%rbp),%rdx
lea    0xaf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
shl    $0x1,%rax
add    $0x1,%rax
imul   -0x28(%rbp),%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
jl     11ce <main+0x8e>
mov    -0x80(%rbp),%rsi
mov    -0x88(%rbp),%rdx
lea    0xae3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movsd  0xeaa(%rip),%xmm0
mov    $0x3,%edi
call   1050 <pow@plt>
movsd  %xmm0,0x18(%rsp)
mov    $0x3d2e003,%ecx
movabs $0x2bdcdd10d3c01b,%rbx
xor    %ebp,%ebp
jmp    11e2 <main+0xa2>
nopl   0x0(%rax)
movabs $0xffd42322ef2c3fe5,%rax
23 d4 ff
add    %rbx,%rax
mov    %rax,%rcx
movabs $0xcccccccccccccccd,%rdx
cc cc cc
imul   %rdx,%rcx
movabs $0x1999999999999998,%rdx
99 99 19
add    %rdx,%rcx
ror    %rcx
cmp    %rdx,%rcx
jbe    13b0 <main+0x270>
mov    0x30(%rsp),%rcx
lea    (%rcx,%rcx,1),%rax
add    $0x1,%rax
add    $0x1,%rcx
lea    (%rax,%rax,2),%rax
add    %rax,%rbx
movabs $0x4f63cf8094c01b,%rax
cmp    %rax,%rbx
jae    13f7 <main+0x2b7>
mov    %r14,0x20(%rsp)
mov    %rbp,0x28(%rsp)
mov    %rcx,0x30(%rsp)
lea    0x0(,%rbx,4),%rax
lea    (%rax,%rax,2),%r14
mov    %rbx,%rdi
movsd  0xdf8(%rip),%xmm0
call   1050 <pow@plt>
divsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%r15
mov    %rbx,0x10(%rsp)
mov    %rbx,%rdi
movsd  0xdd8(%rip),%xmm0
call   1050 <pow@plt>
mulsd  0xdd3(%rip),%xmm0
cvttsd2si %xmm0,%r12
mov    %r15,%rbp
neg    %rbp
mov    %r15d,%ebx
not    %ebx
xor    %eax,%eax
mov    %rax,(%rsp)
jmp    126c <main+0x12c>
nopl   (%rax)
addq   $0x6,(%rsp)
lea    0x1(%r15),%rax
add    $0xffffffffffffffff,%rbp
add    $0xffffffff,%ebx
cmp    %r12,%r15
mov    %rax,%r15
jge    1360 <main+0x220>
mov    %r15,%r13
imul   %r15,%r13
imul   $0xffffffffffffffe5,%r13,%rdi
add    %r14,%rdi
xorps  %xmm0,%xmm0
cvtsi2sd %r15,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xd70(%rip),%xmm0
call   1050 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xd6d(%rip),%xmm1
subsd  %xmm0,%xmm1
divsd  0xd69(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
call   1060 <round@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
subsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,%xmm1
xorps  0xd56(%rip),%xmm1
movaps %xmm0,%xmm2
cmpltss 0xd62(%rip),%xmm2
andps  %xmm2,%xmm1
andnps %xmm0,%xmm2
orps   %xmm1,%xmm2
xor    %ecx,%ecx
movss  0xd47(%rip),%xmm0
ucomiss %xmm2,%xmm0
seta   %cl
mov    %rax,%rdx
shr    $0x3f,%rdx
not    %edx
test   %edx,%ecx
je     1255 <main+0x115>
lea    (%rax,%rbp,1),%rcx
imul   %rax,%rcx
add    %r13,%rcx
lea    (%rcx,%rcx,2),%rcx
cmp    %rcx,0x10(%rsp)
jne    1255 <main+0x115>
test   %rax,%rax
je     1250 <main+0x110>
mov    %r15,%rcx
sar    %rcx
xor    %edx,%edx
cmp    %rcx,%rax
sete   %dl
test   %ebx,%edx
jne    1250 <main+0x110>
addq   $0xc,(%rsp)
jmp    1255 <main+0x115>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x28(%rsp),%rbp
mov    (%rsp),%rax
cmp    %rbp,%rax
cmovg  %rax,%rbp
mov    0x10(%rsp),%rbx
mov    0x20(%rsp),%r14
cmovg  %rbx,%r14
cmp    $0x1c2,%rax
jne    1180 <main+0x40>
mov    $0x1c2,%esi
lea    0xcb6(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0xc60(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mulss  0xc78(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcad(%rip),%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2bf5(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    11b7 <main+0x77>
lea    0xccb(%rip),%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"found 6 hexagons at layer=%li and i=%li, ct=%li\0A\00"
@.str.1 = [50 x i8] c"found 12 hexagons at layer=%li and i=%li, ct=%li\0A\00"
@.str.2 = [32 x i8] c"Found %li so far - %.2f%% done\0D\00"
@stdout = global i32 0
@.str.3 = [56 x i8] c"!!! Fount %li hexagons found for a distance^2= %li !!!\0A\00"
@.str.4 = [69 x i8] c"A maximum of %li hexagons found for a distance^2= %li - %.4f%% done\0D\00"
@.str.5 = [53 x i8] c"A total of %li hexagons found for a distance^2= %li\0A\00"
@.str.6 = [63 x i8] c"Maximum number of hexagons found was %li for a distance^2=%li\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca float
%22 = alloca float
%23 = alloca double
%24 = alloca float
store i32 0, i32* %1
%25 = call double @pow(i64 3, double 5.000000e-01)
store double %25, double* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 10, i32* %5
store i64 3, i64* %6
store i64 64151555, i64* %7
%26 = load i64, i64* %7
%27 = load i64, i64* %7
%28 = mul nsw i64 %26, %27
%29 = load i64, i64* %6
%30 = mul nsw i64 %28, %29
store i64 %30, i64* %8
store i64 22346266026754075, i64* %9
%31 = load i64, i64* %8
store i64 %31, i64* %10
store i64 0, i64* %17
store float 0x3E45798EE0000000, float* %21
br label %32
32: ; preds = %250, %0
%33 = load i64, i64* %10
%34 = mul nsw i64 12, %33
store i64 %34, i64* %11
%35 = load i64, i64* %10
%36 = call double @pow(i64 %35, double 5.000000e-01)
%37 = load double, double* %2
%38 = fdiv double %36, %37
%39 = fptosi double %38 to i64
store i64 %39, i64* %12
%40 = load i64, i64* %10
%41 = call double @pow(i64 %40, double 5.000000e-01)
%42 = fmul double 0x3FE5555555555555, %41
%43 = fptosi double %42 to i64
store i64 %43, i64* %13
store i64 0, i64* %16
%44 = load i64, i64* %12
store i64 %44, i64* %14
br label %45
45: ; preds = %179, %32
%46 = load i64, i64* %14
%47 = load i64, i64* %14
%48 = mul nsw i64 %46, %47
store i64 %48, i64* %15
%49 = load i64, i64* %11
%50 = load i64, i64* %15
%51 = mul nsw i64 27, %50
%52 = sub nsw i64 %49, %51
store i64 %52, i64* %19
%53 = load i64, i64* %14
%54 = sitofp i64 %53 to double
%55 = load i64, i64* %19
%56 = call double @pow(i64 %55, double 5.000000e-01)
%57 = fneg double %56
%58 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %54, double %57)
%59 = fdiv double %58, 6.000000e+00
store double %59, double* %23
%60 = load double, double* %23
%61 = call i64 @round(double %60)
store i64 %61, i64* %20
%62 = load i64, i64* %20
%63 = sitofp i64 %62 to double
%64 = load double, double* %23
%65 = fsub double %63, %64
%66 = fptrunc double %65 to float
store float %66, float* %22
%67 = load float, float* %22
%68 = fcmp olt float %67, 0.000000e+00
br i1 %68, label %69, label %72
69: ; preds = %45
%70 = load float, float* %22
%71 = fneg float %70
store float %71, float* %22
br label %72
72: ; preds = %69, %45
%73 = load float, float* %22
%74 = load float, float* %21
%75 = fcmp olt float %73, %74
%76 = zext i1 %75 to i32
%77 = load i64, i64* %20
%78 = icmp sge i64 %77, 0
%79 = zext i1 %78 to i32
%80 = and i32 %76, %79
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %147
82: ; preds = %72
%83 = load i64, i64* %10
%84 = load i64, i64* %15
%85 = load i64, i64* %14
%86 = load i64, i64* %20
%87 = mul nsw i64 %85, %86
%88 = sub nsw i64 %84, %87
%89 = load i64, i64* %20
%90 = load i64, i64* %20
%91 = mul nsw i64 %89, %90
%92 = add nsw i64 %88, %91
%93 = mul nsw i64 3, %92
%94 = icmp eq i64 %83, %93
br i1 %94, label %95, label %146
95: ; preds = %82
%96 = load i64, i64* %20
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %109
98: ; preds = %95
%99 = load i64, i64* %16
%100 = add nsw i64 %99, 6
store i64 %100, i64* %16
%101 = load i32, i32* %3
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %108
103: ; preds = %98
%104 = load i64, i64* %14
%105 = load i64, i64* %20
%106 = load i64, i64* %16
%107 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i64 %104, i64 %105, i64 %106)
br label %108
108: ; preds = %103, %98
br label %145
109: ; preds = %95
%110 = load i64, i64* %14
%111 = and i64 %110, 1
%112 = icmp ne i64 %111, 0
%113 = xor i1 %112, true
%114 = zext i1 %113 to i32
%115 = load i64, i64* %20
%116 = load i64, i64* %14
%117 = ashr i64 %116, 1
%118 = icmp eq i64 %115, %117
%119 = zext i1 %118 to i32
%120 = and i32 %114, %119
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %133
122: ; preds = %109
%123 = load i64, i64* %16
%124 = add nsw i64 %123, 6
store i64 %124, i64* %16
%125 = load i32, i32* %3
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %132
127: ; preds = %122
%128 = load i64, i64* %14
%129 = load i64, i64* %20
%130 = load i64, i64* %16
%131 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i64 %128, i64 %129, i64 %130)
br label %132
132: ; preds = %127, %122
br label %144
133: ; preds = %109
%134 = load i64, i64* %16
%135 = add nsw i64 %134, 12
store i64 %135, i64* %16
%136 = load i32, i32* %3
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %143
138: ; preds = %133
%139 = load i64, i64* %14
%140 = load i64, i64* %20
%141 = load i64, i64* %16
%142 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i64 %139, i64 %140, i64 %141)
br label %143
143: ; preds = %138, %133
br label %144
144: ; preds = %143, %132
br label %145
145: ; preds = %144, %108
br label %146
146: ; preds = %145, %82
br label %147
147: ; preds = %146, %72
%148 = load i32, i32* %4
%149 = icmp ne i32 %148, 0
br i1 %149, label %150, label %176
150: ; preds = %147
%151 = load i64, i64* %14
%152 = load i32, i32* %4
%153 = sext i32 %152 to i64
%154 = srem i64 %151, %153
%155 = icmp ne i64 %154, 0
br i1 %155, label %175, label %156
156: ; preds = %150
%157 = load i64, i64* %14
%158 = load i64, i64* %12
%159 = sub nsw i64 %157, %158
%160 = sitofp i64 %159 to double
%161 = fmul double 1.000000e+00, %160
%162 = load i64, i64* %13
%163 = load i64, i64* %12
%164 = sub nsw i64 %162, %163
%165 = sitofp i64 %164 to double
%166 = fdiv double %161, %165
%167 = fptrunc double %166 to float
store float %167, float* %24
%168 = load i64, i64* %16
%169 = load float, float* %24
%170 = fmul float 1.000000e+02, %169
%171 = fptosi float %170 to i64
%172 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i64 %168, i64 %171)
%173 = load i32, i32* @stdout
%174 = call i32 @fflush(i32 %173)
br label %175
175: ; preds = %156, %150
br label %176
176: ; preds = %175, %147
%177 = load i64, i64* %14
%178 = add nsw i64 %177, 1
store i64 %178, i64* %14
br label %179
179: ; preds = %176
%180 = load i64, i64* %14
%181 = load i64, i64* %13
%182 = icmp sle i64 %180, %181
br i1 %182, label %45, label %183
183: ; preds = %179
%184 = load i64, i64* %16
%185 = load i64, i64* %17
%186 = icmp sgt i64 %184, %185
br i1 %186, label %187, label %190
187: ; preds = %183
%188 = load i64, i64* %16
store i64 %188, i64* %17
%189 = load i64, i64* %10
store i64 %189, i64* %18
br label %190
190: ; preds = %187, %183
%191 = load i64, i64* %16
%192 = icmp eq i64 %191, 450
br i1 %192, label %193, label %197
193: ; preds = %190
%194 = load i64, i64* %16
%195 = load i64, i64* %10
%196 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i64 %194, i64 %195)
br label %197
197: ; preds = %193, %190
%198 = load i32, i32* %5
%199 = icmp ne i32 %198, 0
br i1 %199, label %200, label %229
200: ; preds = %197
%201 = load i64, i64* %10
%202 = load i64, i64* %8
%203 = sub nsw i64 %201, %202
%204 = load i32, i32* %5
%205 = sext i32 %204 to i64
%206 = srem i64 %203, %205
%207 = icmp ne i64 %206, 0
br i1 %207, label %228, label %208
208: ; preds = %200
%209 = load i64, i64* %10
%210 = load i64, i64* %8
%211 = sub nsw i64 %209, %210
%212 = sitofp i64 %211 to double
%213 = fmul double 1.000000e+00, %212
%214 = load i64, i64* %9
%215 = load i64, i64* %8
%216 = sub nsw i64 %214, %215
%217 = sitofp i64 %216 to double
%218 = fdiv double %213, %217
%219 = fptrunc double %218 to float
store float %219, float* %24
%220 = load i64, i64* %17
%221 = load i64, i64* %18
%222 = load float, float* %24
%223 = fmul float 1.000000e+02, %222
%224 = fpext float %223 to double
%225 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.4, i64 0, i64 0), i64 %220, i64 %221, double %224)
%226 = load i32, i32* @stdout
%227 = call i32 @fflush(i32 %226)
br label %228
228: ; preds = %208, %200
br label %229
229: ; preds = %228, %197
%230 = load i32, i32* %5
%231 = icmp ne i32 %230, 0
%232 = xor i1 %231, true
%233 = zext i1 %232 to i32
%234 = load i32, i32* %4
%235 = and i32 %233, %234
%236 = icmp ne i32 %235, 0
br i1 %236, label %237, label %241
237: ; preds = %229
%238 = load i64, i64* %16
%239 = load i64, i64* %10
%240 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0), i64 %238, i64 %239)
br label %241
241: ; preds = %237, %229
%242 = load i64, i64* %7
%243 = add nsw i64 %242, 1
store i64 %243, i64* %7
%244 = mul nsw i64 2, %242
%245 = add nsw i64 %244, 1
%246 = load i64, i64* %6
%247 = mul nsw i64 %245, %246
%248 = load i64, i64* %10
%249 = add nsw i64 %248, %247
store i64 %249, i64* %10
br label %250
250: ; preds = %241
%251 = load i64, i64* %10
%252 = load i64, i64* %9
%253 = icmp slt i64 %251, %252
br i1 %253, label %32, label %254
254: ; preds = %250
%255 = load i64, i64* %17
%256 = load i64, i64* %18
%257 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i64 %255, i64 %256)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str.3 = [56 x i8] c"!!! Fount %li hexagons found for a distance^2= %li !!!\0A\00"
@.str.4 = [69 x i8] c"A maximum of %li hexagons found for a distance^2= %li - %.4f%% done\0D\00"
@.str.6 = [63 x i8] c"Maximum number of hexagons found was %li for a distance^2=%li\0A\00"
define i32 @main() {
%1 = tail call double @pow(i64 3, double 5.000000e-01)
br label %2
2: ; preds = %85, %0
%3 = phi i64 [ 0, %0 ], [ %67, %85 ]
%4 = phi i64 [ undef, %0 ], [ %68, %85 ]
%5 = phi i64 [ 12346266026754075, %0 ], [ %90, %85 ]
%6 = phi i64 [ 64151555, %0 ], [ %86, %85 ]
%7 = mul nuw nsw i64 %5, 12
%8 = tail call double @pow(i64 %5, double 5.000000e-01)
%9 = fdiv double %8, %1
%10 = fptosi double %9 to i64
%11 = tail call double @pow(i64 %5, double 5.000000e-01)
%12 = fmul double %11, 0x3FE5555555555555
%13 = fptosi double %12 to i64
br label %14
14: ; preds = %61, %2
%15 = phi i64 [ 0, %2 ], [ %62, %61 ]
%16 = phi i64 [ %10, %2 ], [ %63, %61 ]
%17 = mul nsw i64 %16, %16
%18 = mul i64 %17, -27
%19 = add i64 %18, %7
%20 = sitofp i64 %16 to double
%21 = tail call double @pow(i64 %19, double 5.000000e-01)
%22 = fneg double %21
%23 = tail call double @llvm.fmuladd.f64(double %20, double 3.000000e+00, double %22)
%24 = fdiv double %23, 6.000000e+00
%25 = tail call i64 @round(double %24)
%26 = sitofp i64 %25 to double
%27 = fsub double %26, %24
%28 = fptrunc double %27 to float
%29 = fcmp olt float %28, 0.000000e+00
%30 = fneg float %28
%31 = select i1 %29, float %30, float %28
%32 = fcmp olt float %31, 0x3E45798EE0000000
%33 = zext i1 %32 to i32
%34 = lshr i64 %25, 63
%35 = trunc i64 %34 to i32
%36 = xor i32 %35, -1
%37 = and i32 %33, %36
%38 = icmp eq i32 %37, 0
br i1 %38, label %61, label %39
39: ; preds = %14
%40 = sub i64 %25, %16
%41 = mul i64 %40, %25
%42 = add i64 %41, %17
%43 = mul nsw i64 %42, 3
%44 = icmp eq i64 %5, %43
br i1 %44, label %45, label %61
45: ; preds = %39
%46 = icmp eq i64 %25, 0
br i1 %46, label %47, label %49
47: ; preds = %45
%48 = add nsw i64 %15, 6
br label %61
49: ; preds = %45
%50 = trunc i64 %16 to i32
%51 = xor i32 %50, -1
%52 = ashr i64 %16, 1
%53 = icmp eq i64 %25, %52
%54 = zext i1 %53 to i32
%55 = and i32 %54, %51
%56 = icmp eq i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %49
%58 = add nsw i64 %15, 6
br label %61
59: ; preds = %49
%60 = add nsw i64 %15, 12
br label %61
61: ; preds = %14, %39, %47, %57, %59
%62 = phi i64 [ %48, %47 ], [ %58, %57 ], [ %60, %59 ], [ %15, %39 ], [ %15, %14 ]
%63 = add nsw i64 %16, 1
%64 = icmp slt i64 %16, %13
br i1 %64, label %14, label %65
65: ; preds = %61
%66 = icmp sgt i64 %62, %3
%67 = select i1 %66, i64 %62, i64 %3
%68 = select i1 %66, i64 %5, i64 %4
%69 = icmp eq i64 %62, 450
br i1 %69, label %70, label %72
70: ; preds = %65
%71 = tail call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i64 450, i64 %5)
br label %72
72: ; preds = %65, %70
%73 = add nsw i64 %5, -12346266026754075
%74 = srem i64 %73, 10
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %85
76: ; preds = %72
%77 = sitofp i64 %73 to double
%78 = fdiv double %77, 1.000000e+16
%79 = fptrunc double %78 to float
%80 = fmul float %79, 1.000000e+02
%81 = fpext float %80 to double
%82 = tail call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.4, i64 0, i64 0), i64 %67, i64 %68, double %81)
%83 = load i32, i32* @stdout
%84 = tail call i32 @fflush(i32 %83)
br label %85
85: ; preds = %76, %72
%86 = add nuw nsw i64 %6, 1
%87 = shl nuw nsw i64 %6, 1
%88 = or i64 %87, 1
%89 = mul nsw i64 %88, 3
%90 = add nuw nsw i64 %89, %5
%91 = icmp ult i64 %90, 22346266026754075
br i1 %91, label %2, label %92
92: ; preds = %85
%93 = tail call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i64 %67, i64 %68)
ret i32 0
}