#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 pow(double, double);
unsigned char BL(int i, int j) {
  double a = 0, b = 0, c, d, n = 0;
  while ((c = a * a) + (d = b * b) < 4 && n++ < 880) {
    b = 2 * a * b + j * 8e-9 - .645411;
    a = c - d + i * 8e-9 + .356888;
  }
  return 255 * pow((n - 80) / 800, .5);
}


x86 assembly (clang, -O0):
<BL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  %xmm1,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
addsd  %xmm0,%xmm1
xor    %eax,%eax
movsd  0xe9e(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x31(%rbp)
jbe    119a <BL+0x8a>
movsd  -0x30(%rbp),%xmm1
movsd  0xe94(%rip),%xmm2
movaps %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe78(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11aa <BL+0x9a>
jmp    121b <BL+0x10b>
movsd  0xe96(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe6f(%rip),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe63(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe3b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe23(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1136 <BL+0x26>
movsd  -0x30(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdec(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdd8(%rip),%xmm1
call   1030 <pow@plt>
imul   $0xff,%eax,%eax
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BL>:
push   %rax
cvtsi2sd %esi,%xmm1
mulsd  0xee3(%rip),%xmm1
cvtsi2sd %edi,%xmm0
unpcklpd %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movsd  0xed6(%rip),%xmm10
movsd  0xed5(%rip),%xmm12
movapd 0xefc(%rip),%xmm8
movapd 0xf03(%rip),%xmm9
movsd  0xec2(%rip),%xmm11
xorpd  %xmm4,%xmm4
xorpd  %xmm0,%xmm0
xorpd  %xmm5,%xmm5
xorpd  %xmm7,%xmm7
cs nopw 0x0(%rax,%rax,1)
ucomisd %xmm0,%xmm12
addsd  %xmm10,%xmm0
jbe    11cb <BL+0xbb>
addsd  %xmm5,%xmm5
shufpd $0x2,%xmm2,%xmm5
subsd  %xmm3,%xmm4
shufpd $0x2,%xmm8,%xmm7
mulpd  %xmm5,%xmm7
movapd %xmm1,%xmm3
unpcklpd %xmm4,%xmm3
addpd  %xmm7,%xmm3
addpd  %xmm9,%xmm3
movapd %xmm3,%xmm5
movapd %xmm3,%xmm7
mulpd  %xmm3,%xmm3
movapd %xmm3,%xmm4
unpckhpd %xmm3,%xmm4
movapd %xmm4,%xmm6
addsd  %xmm3,%xmm6
ucomisd %xmm6,%xmm11
unpckhpd %xmm5,%xmm5
ja     1170 <BL+0x60>
addsd  0xe4d(%rip),%xmm0
divsd  0xe4d(%rip),%xmm0
movsd  0xe4d(%rip),%xmm1
call   1030 <pow@plt>
neg    %al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @BL(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %9
br label %10
10: ; preds = %25, %2
%11 = load double, double* %5
%12 = load double, double* %5
%13 = fmul double %11, %12
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %6
%16 = fmul double %14, %15
store double %16, double* %8
%17 = fadd double %13, %16
%18 = fcmp olt double %17, 4.000000e+00
br i1 %18, label %19, label %23
19: ; preds = %10
%20 = load double, double* %9
%21 = fadd double %20, 1.000000e+00
store double %21, double* %9
%22 = fcmp olt double %20, 8.800000e+02
br label %23
23: ; preds = %19, %10
%24 = phi i1 [ false, %10 ], [ %22, %19 ]
br i1 %24, label %25, label %41
25: ; preds = %23
%26 = load double, double* %5
%27 = fmul double 2.000000e+00, %26
%28 = load double, double* %6
%29 = load i32, i32* %4
%30 = sitofp i32 %29 to double
%31 = fmul double %30, 8.000000e-09
%32 = call double @llvm.fmuladd.f64(double %27, double %28, double %31)
%33 = fsub double %32, 0x3FE4A734F82F5126
store double %33, double* %6
%34 = load double, double* %7
%35 = load double, double* %8
%36 = fsub double %34, %35
%37 = load i32, i32* %3
%38 = sitofp i32 %37 to double
%39 = call double @llvm.fmuladd.f64(double %38, double 8.000000e-09, double %36)
%40 = fadd double %39, 3.568880e-01
store double %40, double* %5
br label %10
41: ; preds = %23
%42 = load double, double* %9
%43 = fsub double %42, 8.000000e+01
%44 = fdiv double %43, 8.000000e+02
%45 = call i32 @pow(double %44, double 5.000000e-01)
%46 = mul nsw i32 255, %45
%47 = trunc i32 %46 to i8
ret i8 %47
}

LLVM IR (-O2):
define zeroext i8 @BL(i32 %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fmul double %3, 8.000000e-09
%5 = sitofp i32 %0 to double
%6 = insertelement <2 x double> poison, double %5, i64 1
%7 = insertelement <2 x double> poison, double %4, i64 0
br label %8
8: ; preds = %2, %16
%9 = phi double [ 0.000000e+00, %2 ], [ %25, %16 ]
%10 = phi double [ 0.000000e+00, %2 ], [ %26, %16 ]
%11 = phi double [ 0.000000e+00, %2 ], [ %14, %16 ]
%12 = phi double [ 0.000000e+00, %2 ], [ %30, %16 ]
%13 = phi double [ 0.000000e+00, %2 ], [ %29, %16 ]
%14 = fadd double %11, 1.000000e+00
%15 = fcmp olt double %11, 8.800000e+02
br i1 %15, label %16, label %31
16: ; preds = %8
%17 = fmul double %12, 2.000000e+00
%18 = fsub double %10, %9
%19 = insertelement <2 x double> %6, double %17, i64 0
%20 = insertelement <2 x double> <double poison, double 8.000000e-09>, double %13, i64 0
%21 = insertelement <2 x double> %7, double %18, i64 1
%22 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %19, <2 x double> %20, <2 x double> %21)
%23 = fadd <2 x double> %22, <double 0xBFE4A734F82F5126, double 3.568880e-01>
%24 = fmul <2 x double> %23, %23
%25 = extractelement <2 x double> %24, i64 0
%26 = extractelement <2 x double> %24, i64 1
%27 = fadd double %25, %26
%28 = fcmp olt double %27, 4.000000e+00
%29 = extractelement <2 x double> %23, i64 0
%30 = extractelement <2 x double> %23, i64 1
br i1 %28, label %8, label %31
31: ; preds = %16, %8
%32 = fadd double %14, -8.000000e+01
%33 = fdiv double %32, 8.000000e+02
%34 = tail call i32 @pow(double %33, double 5.000000e-01)
%35 = trunc i32 %34 to i8
%36 = sub i8 0, %35
ret i8 %36
}