#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 MAX(double, float);
double MIN(double, float);
void vb_to_lr(float volume, float balance, float *left, float *right) {
  *left = volume * (1.0 - MAX(0.0, balance));
  *right = volume * (1.0 + MIN(0.0, balance));
}


x86 assembly (clang, -O0):
<vb_to_lr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm1
xorps  %xmm0,%xmm0
call   1040 <MAX@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  0xe9b(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm1
xorps  %xmm0,%xmm0
call   1030 <MIN@plt>
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
movsd  0xe5c(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vb_to_lr>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movss  %xmm1,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
call   1040 <MAX@plt>
movsd  0xeb3(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,(%rbx)
xorps  %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
call   1030 <MIN@plt>
addsd  0xe88(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @vb_to_lr(float %0, float %1, float* %2, float* %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float*
%8 = alloca float*
store float %0, float* %5
store float %1, float* %6
store float* %2, float** %7
store float* %3, float** %8
%9 = load float, float* %5
%10 = fpext float %9 to double
%11 = load float, float* %6
%12 = call double @MAX(double 0.000000e+00, float %11)
%13 = fsub double 1.000000e+00, %12
%14 = fmul double %10, %13
%15 = fptrunc double %14 to float
%16 = load float*, float** %7
store float %15, float* %16
%17 = load float, float* %5
%18 = fpext float %17 to double
%19 = load float, float* %6
%20 = call double @MIN(double 0.000000e+00, float %19)
%21 = fadd double 1.000000e+00, %20
%22 = fmul double %18, %21
%23 = fptrunc double %22 to float
%24 = load float*, float** %8
store float %23, float* %24
ret void
}

LLVM IR (-O2):
define void @vb_to_lr(float %0, float %1, float* nocapture writeonly %2, float* nocapture writeonly %3) {
%5 = fpext float %0 to double
%6 = tail call double @MAX(double 0.000000e+00, float %1)
%7 = fsub double 1.000000e+00, %6
%8 = fmul double %7, %5
%9 = fptrunc double %8 to float
store float %9, float* %2
%10 = tail call double @MIN(double 0.000000e+00, float %1)
%11 = fadd double %10, 1.000000e+00
%12 = fmul double %11, %5
%13 = fptrunc double %12 to float
store float %13, float* %3
ret void
}