float PDNormal(float CDataYr[], float CDataYE[], float CDataYG[], int Channel,
               float SampleTime) {
  float EP = 0;
  float ED = 0;
  float ControlOut = 0;
  EP = CDataYr[0] - CDataYE[0];
  ED = -CDataYG[0];
  if (Channel == 2) {
    ControlOut = (24.2393f) * (EP + (0.17004f) * ED);
  } else if (Channel == 1) {
    ControlOut = (24.2393f) * (EP + (0.17004f) * ED);
  } else if (Channel == 3) {
    ControlOut = (20.3175f) * (EP + 0 * ED);
  } else {
    ControlOut = 0;
  }
  return ControlOut;
}


x86 assembly (clang, -O0):
<PDNormal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jne    1199 <PDNormal+0x99>
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  0xe8d(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xe79(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    121a <PDNormal+0x11a>
cmpl   $0x1,-0x1c(%rbp)
jne    11d3 <PDNormal+0xd3>
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  0xe53(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xe3f(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1215 <PDNormal+0x115>
cmpl   $0x3,-0x1c(%rbp)
jne    1208 <PDNormal+0x108>
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
xorps  %xmm2,%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xe06(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1210 <PDNormal+0x110>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1215 <PDNormal+0x115>
jmp    121a <PDNormal+0x11a>
movss  -0x2c(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDNormal>:
movss  (%rdi),%xmm2
subss  (%rsi),%xmm2
movss  (%rdx),%xmm1
xorps  0xeed(%rip),%xmm1
cmp    $0x1,%ecx
je     1125 <PDNormal+0x25>
xorps  %xmm0,%xmm0
cmp    $0x3,%ecx
je     113b <PDNormal+0x3b>
cmp    $0x2,%ecx
jne    114e <PDNormal+0x4e>
mulss  0xee7(%rip),%xmm1
addss  %xmm2,%xmm1
mulss  0xedf(%rip),%xmm1
jmp    114b <PDNormal+0x4b>
mulss  %xmm0,%xmm1
addss  %xmm2,%xmm1
mulss  0xec5(%rip),%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @PDNormal(float* %0, float* %1, float* %2, i32 %3, float %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store i32 %3, i32* %9
store float %4, float* %10
store float 0.000000e+00, float* %11
store float 0.000000e+00, float* %12
store float 0.000000e+00, float* %13
%14 = load float*, float** %6
%15 = getelementptr inbounds float, float* %14, i64 0
%16 = load float, float* %15
%17 = load float*, float** %7
%18 = getelementptr inbounds float, float* %17, i64 0
%19 = load float, float* %18
%20 = fsub float %16, %19
store float %20, float* %11
%21 = load float*, float** %8
%22 = getelementptr inbounds float, float* %21, i64 0
%23 = load float, float* %22
%24 = fneg float %23
store float %24, float* %12
%25 = load i32, i32* %9
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %32
27: ; preds = %5
%28 = load float, float* %11
%29 = load float, float* %12
%30 = call float @llvm.fmuladd.f32(float 0x3FC5C3DEE0000000, float %29, float %28)
%31 = fmul float 0x40383D42C0000000, %30
store float %31, float* %13
br label %51
32: ; preds = %5
%33 = load i32, i32* %9
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load float, float* %11
%37 = load float, float* %12
%38 = call float @llvm.fmuladd.f32(float 0x3FC5C3DEE0000000, float %37, float %36)
%39 = fmul float 0x40383D42C0000000, %38
store float %39, float* %13
br label %50
40: ; preds = %32
%41 = load i32, i32* %9
%42 = icmp eq i32 %41, 3
br i1 %42, label %43, label %48
43: ; preds = %40
%44 = load float, float* %11
%45 = load float, float* %12
%46 = call float @llvm.fmuladd.f32(float 0.000000e+00, float %45, float %44)
%47 = fmul float 0x40345147A0000000, %46
store float %47, float* %13
br label %49
48: ; preds = %40
store float 0.000000e+00, float* %13
br label %49
49: ; preds = %48, %43
br label %50
50: ; preds = %49, %35
br label %51
51: ; preds = %50, %27
%52 = load float, float* %13
ret float %52
}

LLVM IR (-O2):
define float @PDNormal(float* nocapture %0, float* nocapture %1, float* nocapture %2, i32 %3, float %4) {
%6 = load float, float* %0
%7 = load float, float* %1
%8 = fsub float %6, %7
%9 = load float, float* %2
%10 = fneg float %9
switch i32 %3, label %20 [
i32 2, label %11
i32 1, label %14
i32 3, label %17
]
11: ; preds = %5
%12 = tail call float @llvm.fmuladd.f32(float %10, float 0x3FC5C3DEE0000000, float %8)
%13 = fmul float %12, 0x40383D42C0000000
br label %20
14: ; preds = %5
%15 = tail call float @llvm.fmuladd.f32(float %10, float 0x3FC5C3DEE0000000, float %8)
%16 = fmul float %15, 0x40383D42C0000000
br label %20
17: ; preds = %5
%18 = tail call float @llvm.fmuladd.f32(float %10, float 0.000000e+00, float %8)
%19 = fmul float %18, 0x40345147A0000000
br label %20
20: ; preds = %5, %14, %17, %11
%21 = phi float [ %13, %11 ], [ %16, %14 ], [ %19, %17 ], [ 0.000000e+00, %5 ]
ret float %21
}