#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 */
float blend_screen(float, double);
float blend_hard_light(float A, float B) {
  return (B <= 0.5) ? A * 2.0 * B : blend_screen(A, 2.0 * B - 1.0);
}


x86 assembly (clang, -O0):
<blend_hard_light>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xecd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1169 <blend_hard_light+0x59>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1195 <blend_hard_light+0x85>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm1
movsd  0xe85(%rip),%xmm2
addsd  %xmm2,%xmm1
call   1030 <blend_screen@plt>
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blend_hard_light>:
push   %rax
movaps %xmm1,%xmm2
cvtss2sd %xmm1,%xmm1
movss  0xee0(%rip),%xmm3
ucomiss %xmm2,%xmm3
jae    113c <blend_hard_light+0x2c>
addsd  %xmm1,%xmm1
addsd  0xed7(%rip),%xmm1
call   1030 <blend_screen@plt>
cvtss2sd %xmm0,%xmm0
jmp    1148 <blend_hard_light+0x38>
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @blend_hard_light(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = fpext float %5 to double
%7 = fcmp ole double %6, 5.000000e-01
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fmul double %10, 2.000000e+00
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = fmul double %11, %13
br label %22
15: ; preds = %2
%16 = load float, float* %3
%17 = load float, float* %4
%18 = fpext float %17 to double
%19 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %18, double -1.000000e+00)
%20 = call float @blend_screen(float %16, double %19)
%21 = fpext float %20 to double
br label %22
22: ; preds = %15, %8
%23 = phi double [ %14, %8 ], [ %21, %15 ]
%24 = fptrunc double %23 to float
ret float %24
}

LLVM IR (-O2):
define float @blend_hard_light(float %0, float %1) {
%3 = fpext float %1 to double
%4 = fcmp ugt float %1, 5.000000e-01
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = fpext float %0 to double
%7 = fmul double %6, 2.000000e+00
%8 = fmul double %7, %3
br label %13
9: ; preds = %2
%10 = tail call double @llvm.fmuladd.f64(double %3, double 2.000000e+00, double -1.000000e+00)
%11 = tail call float @blend_screen(float %0, double %10)
%12 = fpext float %11 to double
br label %13
13: ; preds = %9, %5
%14 = phi double [ %8, %5 ], [ %12, %9 ]
%15 = fptrunc double %14 to float
ret float %15
}