#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 */
long double sqrtl(long double);
bool __attribute__((const))
mandelbrot_in_cardioid(long double x, long double y, long double y2) {
  if (x < -0.75L || x > 0.38L)
    return false;
  long double lx = x - 0.25L;
  long double modulus = sqrtl(lx * lx + y2);
  long double cosi = lx / modulus;
  long double polar = 2 * 0.25L * (1 - cosi);
  return modulus < polar;
}


x86 assembly (clang, -O0):
<mandelbrot_in_cardioid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
fldt   0x30(%rbp)
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fstpt  -0x40(%rbp)
fldt   -0x20(%rbp)
flds   0xeca(%rip)
fucomip %st(1),%st
fstp   %st(0)
ja     115f <mandelbrot_in_cardioid+0x4f>
jmp    1145 <mandelbrot_in_cardioid+0x35>
fldt   -0x20(%rbp)
fldt   0xec2(%rip)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    116b <mandelbrot_in_cardioid+0x5b>
jmp    115f <mandelbrot_in_cardioid+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    11c4 <mandelbrot_in_cardioid+0xb4>
fldt   -0x20(%rbp)
flds   0xe90(%rip)
faddp  %st,%st(1)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
fldt   -0x40(%rbp)
fxch   %st(1)
fmul   %st,%st(0)
faddp  %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <sqrtl@plt>
fstpt  -0x60(%rbp)
fldt   -0x50(%rbp)
fldt   -0x60(%rbp)
fdivrp %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x70(%rbp)
fld1
fsubp  %st,%st(1)
flds   0xe5e(%rip)
fmulp  %st,%st(1)
fstpt  -0x80(%rbp)
fldt   -0x60(%rbp)
fldt   -0x80(%rbp)
fucomip %st(1),%st
fstp   %st(0)
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mandelbrot_in_cardioid>:
sub    $0x28,%rsp
fldt   0x50(%rsp)
fldt   0x30(%rsp)
xor    %eax,%eax
flds   0xedc(%rip)
fucomip %st(1),%st
ja     1169 <mandelbrot_in_cardioid+0x59>
fldt   0xee2(%rip)
fxch   %st(1)
fucomi %st(1),%st
fstp   %st(1)
ja     1171 <mandelbrot_in_cardioid+0x61>
fadds  0xec8(%rip)
fld    %st(0)
fstpt  0x1c(%rsp)
fmul   %st,%st(0)
faddp  %st,%st(1)
fstpt  (%rsp)
call   1030 <sqrtl@plt>
fldt   0x1c(%rsp)
fdiv   %st(1),%st
fld1
fsubp  %st,%st(1)
fmuls  0xeaa(%rip)
xor    %eax,%eax
fucomip %st(1),%st
fstp   %st(0)
seta   %al
jmp    116d <mandelbrot_in_cardioid+0x5d>
fstp   %st(1)
fstp   %st(0)
fldz
fldz
fstp   %st(1)
fstp   %st(0)
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @mandelbrot_in_cardioid(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2) {
%4 = alloca i32
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca x86_fp80
%9 = alloca x86_fp80
%10 = alloca x86_fp80
%11 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %5
store x86_fp80 %1, x86_fp80* %6
store x86_fp80 %2, x86_fp80* %7
%12 = load x86_fp80, x86_fp80* %5
%13 = fcmp olt x86_fp80 %12, 0xKBFFEC000000000000000
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = load x86_fp80, x86_fp80* %5
%16 = fcmp ogt x86_fp80 %15, 0xK3FFDC28F5C28F5C28F5C
br i1 %16, label %17, label %18
17: ; preds = %14, %3
store i32 0, i32* %4
br label %36
18: ; preds = %14
%19 = load x86_fp80, x86_fp80* %5
%20 = fsub x86_fp80 %19, 0xK3FFD8000000000000000
store x86_fp80 %20, x86_fp80* %8
%21 = load x86_fp80, x86_fp80* %8
%22 = load x86_fp80, x86_fp80* %8
%23 = load x86_fp80, x86_fp80* %7
%24 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %21, x86_fp80 %22, x86_fp80 %23)
%25 = call x86_fp80 @sqrtl(x86_fp80 %24)
store x86_fp80 %25, x86_fp80* %9
%26 = load x86_fp80, x86_fp80* %8
%27 = load x86_fp80, x86_fp80* %9
%28 = fdiv x86_fp80 %26, %27
store x86_fp80 %28, x86_fp80* %10
%29 = load x86_fp80, x86_fp80* %10
%30 = fsub x86_fp80 0xK3FFF8000000000000000, %29
%31 = fmul x86_fp80 0xK3FFE8000000000000000, %30
store x86_fp80 %31, x86_fp80* %11
%32 = load x86_fp80, x86_fp80* %9
%33 = load x86_fp80, x86_fp80* %11
%34 = fcmp olt x86_fp80 %32, %33
%35 = zext i1 %34 to i32
store i32 %35, i32* %4
br label %36
36: ; preds = %18, %17
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
define i32 @mandelbrot_in_cardioid(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2) {
%4 = fcmp olt x86_fp80 %0, 0xKBFFEC000000000000000
%5 = fcmp ogt x86_fp80 %0, 0xK3FFDC28F5C28F5C28F5C
%6 = or i1 %4, %5
br i1 %6, label %16, label %7
7: ; preds = %3
%8 = fadd x86_fp80 %0, 0xKBFFD8000000000000000
%9 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %8, x86_fp80 %8, x86_fp80 %2)
%10 = tail call x86_fp80 @sqrtl(x86_fp80 %9)
%11 = fdiv x86_fp80 %8, %10
%12 = fsub x86_fp80 0xK3FFF8000000000000000, %11
%13 = fmul x86_fp80 %12, 0xK3FFE8000000000000000
%14 = fcmp olt x86_fp80 %10, %13
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %3, %7
%17 = phi i32 [ %15, %7 ], [ 0, %3 ]
ret i32 %17
}