#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 */
double fabs(double);
unsigned int ct_raise(double n) {
  double c = fabs(n);
  if (c == 0.0)
    c = 3.14592653;
  double z = c;
  double mutate = 1.61803;
  while (z < 3049213.103) {
    z = z * mutate + c;
    mutate = mutate * 1.314;
  }
  return z;
}


x86 assembly (clang, -O0):
<ct_raise>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xeeb(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1143 <ct_raise+0x43>
jp     1143 <ct_raise+0x43>
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xebe(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11a0 <ct_raise+0xa0>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe97(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    115a <ct_raise+0x5a>
cvttsd2si -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ct_raise>:
movapd 0xef8(%rip),%xmm2
andpd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
cmpeqsd %xmm0,%xmm1
movsd  0xef3(%rip),%xmm0
andpd  %xmm1,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm0,%xmm1
movsd  0xee7(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1168 <ct_raise+0x68>
movsd  0xee1(%rip),%xmm3
movsd  0xee1(%rip),%xmm4
movapd %xmm1,%xmm2
nopl   0x0(%rax,%rax,1)
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm4,%xmm3
ucomisd %xmm2,%xmm0
ja     1150 <ct_raise+0x50>
cvttsd2si %xmm2,%rax
ret
cvttsd2si %xmm1,%rax
ret

LLVM IR (-O0):
define i32 @ct_raise(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
%6 = load double, double* %2
%7 = call double @llvm.fabs.f64(double %6)
store double %7, double* %3
%8 = load double, double* %3
%9 = fcmp oeq double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %1
store double 0x40092ADB874FC007, double* %3
br label %11
11: ; preds = %10, %1
%12 = load double, double* %3
store double %12, double* %4
store double 1.618030e+00, double* %5
br label %13
13: ; preds = %16, %11
%14 = load double, double* %4
%15 = fcmp olt double %14, 0x4147437E8D2F1AA0
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load double, double* %4
%18 = load double, double* %5
%19 = load double, double* %3
%20 = call double @llvm.fmuladd.f64(double %17, double %18, double %19)
store double %20, double* %4
%21 = load double, double* %5
%22 = fmul double %21, 1.314000e+00
store double %22, double* %5
br label %13
23: ; preds = %13
%24 = load double, double* %4
%25 = fptoui double %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @ct_raise(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp oeq double %0, 0.000000e+00
%4 = select i1 %3, double 0x40092ADB874FC007, double %2
%5 = fcmp olt double %4, 0x4147437E8D2F1AA0
br i1 %5, label %6, label %12
6: ; preds = %1, %6
%7 = phi double [ %10, %6 ], [ 1.618030e+00, %1 ]
%8 = phi double [ %9, %6 ], [ %4, %1 ]
%9 = tail call double @llvm.fmuladd.f64(double %8, double %7, double %4)
%10 = fmul double %7, 1.314000e+00
%11 = fcmp olt double %9, 0x4147437E8D2F1AA0
br i1 %11, label %6, label %12
12: ; preds = %6, %1
%13 = phi double [ %4, %1 ], [ %9, %6 ]
%14 = fptoui double %13 to i32
ret i32 %14
}