#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 sqrt(float);
float blendSoftLight(float base, float blend) {
  return (blend < 0.5f)
             ? (2.0f * base * blend + base * base * (1.0f - 2.0f * blend))
             : (sqrt(base) * (2.0f * blend - 1.0f) +
                2.0f * base * (1.0f - blend));
}


x86 assembly (clang, -O0):
<blendSoftLight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  0xed6(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    117b <blendSoftLight+0x6b>
movss  0xecc(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
mulss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm4
addss  %xmm4,%xmm4
movss  0xea3(%rip),%xmm3
subss  %xmm4,%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11c5 <blendSoftLight+0xb5>
movss  -0x4(%rbp),%xmm0
call   1030 <sqrt@plt>
movss  -0x8(%rbp),%xmm2
addss  %xmm2,%xmm2
movss  0xe76(%rip),%xmm1
addss  %xmm1,%xmm2
movss  0xe66(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
movss  0xe55(%rip),%xmm3
subss  -0x8(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blendSoftLight>:
push   %rax
movaps %xmm0,%xmm2
movss  0xee4(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    1136 <blendSoftLight+0x26>
movaps %xmm2,%xmm3
addss  %xmm2,%xmm3
mulss  %xmm2,%xmm2
mulss  %xmm1,%xmm3
addss  %xmm1,%xmm1
jmp    117c <blendSoftLight+0x6c>
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jb     1147 <blendSoftLight+0x37>
xorps  %xmm0,%xmm0
sqrtss %xmm2,%xmm0
jmp    1165 <blendSoftLight+0x55>
movaps %xmm2,%xmm0
movss  %xmm2,0x4(%rsp)
movss  %xmm1,(%rsp)
call   1030 <sqrt@plt>
movss  (%rsp),%xmm1
movss  0x4(%rsp),%xmm2
movaps %xmm1,%xmm3
addss  %xmm1,%xmm3
addss  0xe90(%rip),%xmm3
mulss  %xmm0,%xmm3
addss  %xmm2,%xmm2
movss  0xe84(%rip),%xmm0
subss  %xmm1,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm3,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @blendSoftLight(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 = fcmp olt float %5, 5.000000e-01
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = load float, float* %3
%9 = fmul float 2.000000e+00, %8
%10 = load float, float* %4
%11 = load float, float* %3
%12 = load float, float* %3
%13 = fmul float %11, %12
%14 = load float, float* %4
%15 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %14, float 1.000000e+00)
%16 = fmul float %13, %15
%17 = call float @llvm.fmuladd.f32(float %9, float %10, float %16)
br label %29
18: ; preds = %2
%19 = load float, float* %3
%20 = call float @sqrt(float %19)
%21 = load float, float* %4
%22 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %21, float -1.000000e+00)
%23 = load float, float* %3
%24 = fmul float 2.000000e+00, %23
%25 = load float, float* %4
%26 = fsub float 1.000000e+00, %25
%27 = fmul float %24, %26
%28 = call float @llvm.fmuladd.f32(float %20, float %22, float %27)
br label %29
29: ; preds = %18, %7
%30 = phi float [ %17, %7 ], [ %28, %18 ]
ret float %30
}

LLVM IR (-O2):
define float @blendSoftLight(float %0, float %1) {
%3 = fcmp olt float %1, 5.000000e-01
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = fmul float %0, 2.000000e+00
%6 = fmul float %0, %0
%7 = tail call float @llvm.fmuladd.f32(float %1, float -2.000000e+00, float 1.000000e+00)
%8 = fmul float %6, %7
%9 = tail call float @llvm.fmuladd.f32(float %5, float %1, float %8)
br label %17
10: ; preds = %2
%11 = tail call float @sqrt(float %0)
%12 = tail call float @llvm.fmuladd.f32(float %1, float 2.000000e+00, float -1.000000e+00)
%13 = fmul float %0, 2.000000e+00
%14 = fsub float 1.000000e+00, %1
%15 = fmul float %13, %14
%16 = tail call float @llvm.fmuladd.f32(float %11, float %12, float %15)
br label %17
17: ; preds = %10, %4
%18 = phi float [ %9, %4 ], [ %16, %10 ]
ret float %18
}