float ec_cscore(eci, firstpos, plainchar)
struct ecinfox *eci;
int firstpos;
int plainchar;
{
  extern float logvar;
  float score;
  int pvec[256 + 1];
  int ccount;
  if (decode_class(eci, firstpos, plainchar, pvec) == (-1)) {
    return (0.0);
  }
  score = pvec_1score(pvec);
  if (score < 0.0)
    return (0.0);
  score = exp(-(score * score) / 2.0);
  for (ccount = 0; pvec[ccount] != (-1); ccount++)
    ;
  score = score / sqrt(2 * (3.1415926) * logvar / ccount);
  return (score);
}


x86 assembly (clang, -O0):
<ec_cscore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0x420(%rbp),%rcx
mov    $0x0,%al
call   1030 <decode_class@plt>
cmp    $0xffffffff,%eax
jne    1183 <ec_cscore+0x43>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1289 <ec_cscore+0x149>
lea    -0x420(%rbp),%rdi
mov    $0x0,%al
call   1040 <pvec_1score@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11bd <ec_cscore+0x7d>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1289 <ec_cscore+0x149>
movss  -0x1c(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe20(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <exp@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x424(%rbp)
movslq -0x424(%rbp),%rax
cmpl   $0xffffffff,-0x420(%rbp,%rax,4)
ff
je     122a <ec_cscore+0xea>
jmp    1216 <ec_cscore+0xd6>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    11fc <ec_cscore+0xbc>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x430(%rbp)
ff
mov    0x2d96(%rip),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdb6(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x424(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x430(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ec_cscore>:
push   %rbx
sub    $0x420,%rsp
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   1030 <decode_class@plt>
xorps  %xmm0,%xmm0
cmp    $0xffffffff,%eax
je     11ff <ec_cscore+0xbf>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <pvec_1score@plt>
xorps  %xmm0,%xmm0
test   %eax,%eax
js     11ff <ec_cscore+0xbf>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe6f(%rip),%xmm0
call   1050 <exp@plt>
mov    $0xffffffff,%eax
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpl   $0xffffffff,(%rbx)
lea    0x4(%rbx),%rbx
jne    11a0 <ec_cscore+0x60>
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm2
mov    0x2e1d(%rip),%rcx
movss  (%rcx),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe3d(%rip),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11e3 <ec_cscore+0xa3>
sqrtsd %xmm0,%xmm0
jmp    11f4 <ec_cscore+0xb4>
movsd  %xmm2,0x8(%rsp)
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
divsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
add    $0x420,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.ecinfox = type opaque
@logvar = external global float
define float @ec_cscore(%struct.ecinfox* %0, i32 %1, i32 %2) {
%4 = alloca float
%5 = alloca %struct.ecinfox*
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca [257 x i32]
%10 = alloca i32
store %struct.ecinfox* %0, %struct.ecinfox** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%11 = load %struct.ecinfox*, %struct.ecinfox** %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = getelementptr inbounds [257 x i32], [257 x i32]* %9, i64 0, i64 0
%15 = call i32 (%struct.ecinfox*, i32, i32, i32*, ...) bitcast (i32 (...)* @decode_class to i32 (%struct.ecinfox*, i32, i32, i32*, ...)*)(%struct.ecinfox* %11, i32 %12, i32 %13, i32* %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %18
17: ; preds = %3
store float 0.000000e+00, float* %4
br label %58
18: ; preds = %3
%19 = getelementptr inbounds [257 x i32], [257 x i32]* %9, i64 0, i64 0
%20 = call i32 (i32*, ...) bitcast (i32 (...)* @pvec_1score to i32 (i32*, ...)*)(i32* %19)
%21 = sitofp i32 %20 to float
store float %21, float* %8
%22 = load float, float* %8
%23 = fpext float %22 to double
%24 = fcmp olt double %23, 0.000000e+00
br i1 %24, label %25, label %26
25: ; preds = %18
store float 0.000000e+00, float* %4
br label %58
26: ; preds = %18
%27 = load float, float* %8
%28 = load float, float* %8
%29 = fmul float %27, %28
%30 = fneg float %29
%31 = fpext float %30 to double
%32 = fdiv double %31, 2.000000e+00
%33 = call double @exp(double %32)
%34 = fptrunc double %33 to float
store float %34, float* %8
store i32 0, i32* %10
br label %35
35: ; preds = %42, %26
%36 = load i32, i32* %10
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [257 x i32], [257 x i32]* %9, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = icmp ne i32 %39, -1
br i1 %40, label %41, label %45
41: ; preds = %35
br label %42
42: ; preds = %41
%43 = load i32, i32* %10
%44 = add nsw i32 %43, 1
store i32 %44, i32* %10
br label %35
45: ; preds = %35
%46 = load float, float* %8
%47 = fpext float %46 to double
%48 = load float, float* @logvar
%49 = fpext float %48 to double
%50 = fmul double 0x401921FB4D12D84A, %49
%51 = load i32, i32* %10
%52 = sitofp i32 %51 to double
%53 = fdiv double %50, %52
%54 = call double @sqrt(double %53)
%55 = fdiv double %47, %54
%56 = fptrunc double %55 to float
store float %56, float* %8
%57 = load float, float* %8
store float %57, float* %4
br label %58
58: ; preds = %45, %25, %17
%59 = load float, float* %4
ret float %59
}

LLVM IR (-O2):
%struct.ecinfox = type opaque
@logvar = external global float
define float @ec_cscore(%struct.ecinfox* %0, i32 %1, i32 %2) {
%4 = alloca [257 x i32]
%5 = bitcast [257 x i32]* %4 to i8*
%6 = getelementptr inbounds [257 x i32], [257 x i32]* %4, i64 0, i64 0
%7 = call i32 (%struct.ecinfox*, i32, i32, i32*, ...) bitcast (i32 (...)* @decode_class to i32 (%struct.ecinfox*, i32, i32, i32*, ...)*)(%struct.ecinfox* %0, i32 %1, i32 %2, i32* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %37, label %9
9: ; preds = %3
%10 = call i32 (i32*, ...) bitcast (i32 (...)* @pvec_1score to i32 (i32*, ...)*)(i32* %6)
%11 = icmp slt i32 %10, 0
br i1 %11, label %37, label %12
12: ; preds = %9
%13 = sitofp i32 %10 to float
%14 = fneg float %13
%15 = fmul float %14, %13
%16 = fpext float %15 to double
%17 = fmul double %16, 5.000000e-01
%18 = call double @exp(double %17)
br label %19
19: ; preds = %19, %12
%20 = phi i64 [ %24, %19 ], [ 0, %12 ]
%21 = getelementptr inbounds [257 x i32], [257 x i32]* %4, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, -1
%24 = add nuw i64 %20, 1
br i1 %23, label %25, label %19
25: ; preds = %19
%26 = fptrunc double %18 to float
%27 = trunc i64 %20 to i32
%28 = fpext float %26 to double
%29 = load float, float* @logvar
%30 = fpext float %29 to double
%31 = fmul double %30, 0x401921FB4D12D84A
%32 = sitofp i32 %27 to double
%33 = fdiv double %31, %32
%34 = call double @sqrt(double %33)
%35 = fdiv double %28, %34
%36 = fptrunc double %35 to float
br label %37
37: ; preds = %9, %3, %25
%38 = phi float [ %36, %25 ], [ 0.000000e+00, %3 ], [ 0.000000e+00, %9 ]
ret float %38
}