#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 */
struct Delay {
  int dummy;
};

/* Variables and functions */
float Delay_get(struct Delay *);
int /*<<< orphan*/ Delay_put(struct Delay *, float);
float Lattice_process(struct Delay *delay, float x, double d) {
  float y = Delay_get(delay);
  x -= d * y;
  Delay_put(delay, x);
  return d * x + y;
}


x86 assembly (clang, -O0):
<Lattice_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <Delay_get@plt>
movss  %xmm0,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
call   1040 <Delay_put@plt>
movsd  -0x18(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lattice_process>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
mov    %rdi,%rbx
call   1030 <Delay_get@plt>
cvtss2sd %xmm0,%xmm2
movsd  %xmm2,0x18(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
mov    %rbx,%rdi
call   1040 <Delay_put@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.Delay = type { i32 }
define float @Lattice_process(%struct.Delay* %0, float %1, double %2) {
%4 = alloca %struct.Delay*
%5 = alloca float
%6 = alloca double
%7 = alloca float
store %struct.Delay* %0, %struct.Delay** %4
store float %1, float* %5
store double %2, double* %6
%8 = load %struct.Delay*, %struct.Delay** %4
%9 = call float @Delay_get(%struct.Delay* %8)
store float %9, float* %7
%10 = load double, double* %6
%11 = load float, float* %7
%12 = fpext float %11 to double
%13 = load float, float* %5
%14 = fpext float %13 to double
%15 = fneg double %10
%16 = call double @llvm.fmuladd.f64(double %15, double %12, double %14)
%17 = fptrunc double %16 to float
store float %17, float* %5
%18 = load %struct.Delay*, %struct.Delay** %4
%19 = load float, float* %5
%20 = call i32 @Delay_put(%struct.Delay* %18, float %19)
%21 = load double, double* %6
%22 = load float, float* %5
%23 = fpext float %22 to double
%24 = load float, float* %7
%25 = fpext float %24 to double
%26 = call double @llvm.fmuladd.f64(double %21, double %23, double %25)
%27 = fptrunc double %26 to float
ret float %27
}

LLVM IR (-O2):
%struct.Delay = type { i32 }
define float @Lattice_process(%struct.Delay* %0, float %1, double %2) {
%4 = tail call float @Delay_get(%struct.Delay* %0)
%5 = fpext float %4 to double
%6 = fpext float %1 to double
%7 = fneg double %2
%8 = tail call double @llvm.fmuladd.f64(double %7, double %5, double %6)
%9 = fptrunc double %8 to float
%10 = tail call i32 @Delay_put(%struct.Delay* %0, float %9)
%11 = fpext float %9 to double
%12 = tail call double @llvm.fmuladd.f64(double %2, double %11, double %5)
%13 = fptrunc double %12 to float
ret float %13
}