#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 psnd_scale_xref(float, float, float, int);
float psnd_ppm2chan(float ppm, float sp, float sw, int n, float xref,
                    float aref, float bref, int irc) {
  xref = psnd_scale_xref(xref, aref, bref, irc);
  if (sw != 0.0)
    return (xref - (ppm * sp * ((float)(n - 1)) / sw));
  return 0.0;
}


x86 assembly (clang, -O0):
<psnd_ppm2chan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movss  %xmm4,-0x1c(%rbp)
movss  %xmm5,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
mov    -0x24(%rbp),%edi
call   1030 <psnd_scale_xref@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1179 <psnd_ppm2chan+0x69>
jp     1179 <psnd_ppm2chan+0x69>
jmp    11a9 <psnd_ppm2chan+0x99>
movss  -0x18(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm2
mulss  %xmm2,%xmm1
divss  -0x10(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b1 <psnd_ppm2chan+0xa1>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psnd_ppm2chan>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x4(%rsp)
movss  %xmm0,0x8(%rsp)
movaps %xmm3,%xmm0
movaps %xmm4,%xmm1
movaps %xmm5,%xmm2
mov    %esi,%edi
call   1030 <psnd_scale_xref@plt>
movss  0xc(%rsp),%xmm2
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm2
jne    1149 <psnd_ppm2chan+0x39>
jnp    116e <psnd_ppm2chan+0x5e>
add    $0xffffffff,%ebx
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
movss  0x8(%rsp),%xmm3
mulss  0x4(%rsp),%xmm3
mulss  %xmm3,%xmm1
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @psnd_ppm2chan(float %0, float %1, float %2, i32 %3, float %4, float %5, float %6, i32 %7) {
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca i32
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca i32
store float %0, float* %10
store float %1, float* %11
store float %2, float* %12
store i32 %3, i32* %13
store float %4, float* %14
store float %5, float* %15
store float %6, float* %16
store i32 %7, i32* %17
%18 = load float, float* %14
%19 = load float, float* %15
%20 = load float, float* %16
%21 = load i32, i32* %17
%22 = call float @psnd_scale_xref(float %18, float %19, float %20, i32 %21)
store float %22, float* %14
%23 = load float, float* %12
%24 = fpext float %23 to double
%25 = fcmp une double %24, 0.000000e+00
br i1 %25, label %26, label %38
26: ; preds = %8
%27 = load float, float* %14
%28 = load float, float* %10
%29 = load float, float* %11
%30 = fmul float %28, %29
%31 = load i32, i32* %13
%32 = sub nsw i32 %31, 1
%33 = sitofp i32 %32 to float
%34 = fmul float %30, %33
%35 = load float, float* %12
%36 = fdiv float %34, %35
%37 = fsub float %27, %36
store float %37, float* %9
br label %39
38: ; preds = %8
store float 0.000000e+00, float* %9
br label %39
39: ; preds = %38, %26
%40 = load float, float* %9
ret float %40
}

LLVM IR (-O2):
define float @psnd_ppm2chan(float %0, float %1, float %2, i32 %3, float %4, float %5, float %6, i32 %7) {
%9 = tail call float @psnd_scale_xref(float %4, float %5, float %6, i32 %7)
%10 = fcmp une float %2, 0.000000e+00
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = fmul float %0, %1
%13 = add nsw i32 %3, -1
%14 = sitofp i32 %13 to float
%15 = fmul float %12, %14
%16 = fdiv float %15, %2
%17 = fsub float %9, %16
br label %18
18: ; preds = %8, %11
%19 = phi float [ %17, %11 ], [ 0.000000e+00, %8 ]
ret float %19
}