#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 exp(float);
float mlog(int);
float logreg_score_aren(float dtwscore, int totdots, int pathcnt, int *dotvec) {
  if (dtwscore < 0.85)
    return 0;
  float params[] = {32.9903, -28.0827, -3.5700, -0.1067, 0.2485, 0.9177,
                    0.0142,  -0.0622,  -0.2242, -0.1991, 0.3158, 0.1314,
                    0.0683,  -0.0029,  -0.2071, 0.0646,  0.4886, -0.0684,
                    -0.1257, -0.0754,  0.2565,  -0.0815, 1.0162, -1.1894};
  float z = params[0] + dtwscore * params[1] +
            mlog((float)pathcnt) * params[2] + mlog((float)totdots) * params[3];
  for (int n = 0; n < 20; n++) {
    z += mlog(dotvec[n]) * params[n + 4];
  }
  return 1.0 - 1.0 / (1.0 + exp(-z));
}


x86 assembly (clang, -O0):
<logreg_score_aren>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea5(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1172 <logreg_score_aren+0x42>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12ad <logreg_score_aren+0x17d>
lea    -0x80(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
movss  -0x80(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
movss  -0x7c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x90(%rbp)
ff
cvtsi2ssl -0x10(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <mlog@plt>
movss  -0x90(%rbp),%xmm1
ff
movss  -0x78(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
cvtsi2ssl -0xc(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <mlog@plt>
movss  -0x8c(%rbp),%xmm1
ff
movss  -0x74(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movl   $0x0,-0x88(%rbp)
cmpl   $0x14,-0x88(%rbp)
jge    1263 <logreg_score_aren+0x133>
mov    -0x18(%rbp),%rax
movslq -0x88(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <mlog@plt>
mov    -0x88(%rbp),%eax
add    $0x4,%eax
cltq
movss  -0x80(%rbp,%rax,4),%xmm2
movss  -0x84(%rbp),%xmm1
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1206 <logreg_score_aren+0xd6>
movss  -0x84(%rbp),%xmm0
ff
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1050 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xd80(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xd74(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xd68(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logreg_score_aren>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movaps %xmm0,%xmm3
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
movsd  0xec6(%rip),%xmm2
ucomisd %xmm1,%xmm2
ja     1208 <logreg_score_aren+0xe8>
mov    %rdx,%rbx
mov    %edi,%ebp
mulss  0xebf(%rip),%xmm3
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
addss  0xeb4(%rip),%xmm3
movss  %xmm3,(%rsp)
cvttss2si %xmm0,%edi
call   1030 <mlog@plt>
mulss  0xea2(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %ebp,%xmm1
addss  (%rsp),%xmm0
movss  %xmm0,(%rsp)
cvttss2si %xmm1,%edi
call   1030 <mlog@plt>
mulss  0xe84(%rip),%xmm0
addss  (%rsp),%xmm0
xor    %ebp,%ebp
lea    0xe8a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movaps %xmm0,(%rsp)
mov    (%rbx,%rbp,4),%edi
call   1030 <mlog@plt>
mulss  0x10(%r14,%rbp,4),%xmm0
movaps (%rsp),%xmm1
addss  %xmm0,%xmm1
movaps %xmm1,(%rsp)
movaps (%rsp),%xmm0
add    $0x1,%rbp
cmp    $0x14,%rbp
jne    11b0 <logreg_score_aren+0x90>
xorps  0xe3c(%rip),%xmm0
call   1040 <exp@plt>
movsd  0xe17(%rip),%xmm1
addsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
subsd  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.logreg_score_aren.params = [24 x float] [float 0x40407EC220000000, float 0xC03C152BE0000000, float 0xC00C8F5C20000000, float 0xBFBB50B100000000, float 0x3FCFCED920000000, float 0x3FED5DCC60000000, float 0x3F8D14E3C0000000, float 0xBFAFD8ADA0000000, float 0xBFCCB295E0000000, float 0xBFC97C1BE0000000, float 0x3FD4361140000000, float 0x3FC0D1B720000000, float 0x3FB17C1BE0000000, float 0xBF67C1BDA0000000, float 0xBFCA8240C0000000, float 0x3FB089A020000000, float 0x3FDF4538E0000000, float 0xBFB182A9A0000000, float 0xBFC016F000000000, float 0xBFB34D6A20000000, float 0x3FD06A7F00000000, float 0xBFB4DD2F20000000, float 0x3FF0425AE0000000, float 0xBFF307C840000000]
define float @logreg_score_aren(float %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca [24 x float]
%11 = alloca float
%12 = alloca i32
store float %0, float* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%13 = load float, float* %6
%14 = fpext float %13 to double
%15 = fcmp olt double %14, 8.500000e-01
br i1 %15, label %16, label %17
16: ; preds = %4
store float 0.000000e+00, float* %5
br label %67
17: ; preds = %4
%18 = bitcast [24 x float]* %10 to i8*
%19 = getelementptr inbounds [24 x float], [24 x float]* %10, i64 0, i64 0
%20 = load float, float* %19
%21 = load float, float* %6
%22 = getelementptr inbounds [24 x float], [24 x float]* %10, i64 0, i64 1
%23 = load float, float* %22
%24 = call float @llvm.fmuladd.f32(float %21, float %23, float %20)
%25 = load i32, i32* %8
%26 = sitofp i32 %25 to float
%27 = fptosi float %26 to i32
%28 = call float @mlog(i32 %27)
%29 = getelementptr inbounds [24 x float], [24 x float]* %10, i64 0, i64 2
%30 = load float, float* %29
%31 = call float @llvm.fmuladd.f32(float %28, float %30, float %24)
%32 = load i32, i32* %7
%33 = sitofp i32 %32 to float
%34 = fptosi float %33 to i32
%35 = call float @mlog(i32 %34)
%36 = getelementptr inbounds [24 x float], [24 x float]* %10, i64 0, i64 3
%37 = load float, float* %36
%38 = call float @llvm.fmuladd.f32(float %35, float %37, float %31)
store float %38, float* %11
store i32 0, i32* %12
br label %39
39: ; preds = %56, %17
%40 = load i32, i32* %12
%41 = icmp slt i32 %40, 20
br i1 %41, label %42, label %59
42: ; preds = %39
%43 = load i32*, i32** %9
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = call float @mlog(i32 %47)
%49 = load i32, i32* %12
%50 = add nsw i32 %49, 4
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [24 x float], [24 x float]* %10, i64 0, i64 %51
%53 = load float, float* %52
%54 = load float, float* %11
%55 = call float @llvm.fmuladd.f32(float %48, float %53, float %54)
store float %55, float* %11
br label %56
56: ; preds = %42
%57 = load i32, i32* %12
%58 = add nsw i32 %57, 1
store i32 %58, i32* %12
br label %39
59: ; preds = %39
%60 = load float, float* %11
%61 = fneg float %60
%62 = call double @exp(float %61)
%63 = fadd double 1.000000e+00, %62
%64 = fdiv double 1.000000e+00, %63
%65 = fsub double 1.000000e+00, %64
%66 = fptrunc double %65 to float
store float %66, float* %5
br label %67
67: ; preds = %59, %16
%68 = load float, float* %5
ret float %68
}

LLVM IR (-O2):
@__const.logreg_score_aren.params = [24 x float] [float 0x40407EC220000000, float 0xC03C152BE0000000, float 0xC00C8F5C20000000, float 0xBFBB50B100000000, float 0x3FCFCED920000000, float 0x3FED5DCC60000000, float 0x3F8D14E3C0000000, float 0xBFAFD8ADA0000000, float 0xBFCCB295E0000000, float 0xBFC97C1BE0000000, float 0x3FD4361140000000, float 0x3FC0D1B720000000, float 0x3FB17C1BE0000000, float 0xBF67C1BDA0000000, float 0xBFCA8240C0000000, float 0x3FB089A020000000, float 0x3FDF4538E0000000, float 0xBFB182A9A0000000, float 0xBFC016F000000000, float 0xBFB34D6A20000000, float 0x3FD06A7F00000000, float 0xBFB4DD2F20000000, float 0x3FF0425AE0000000, float 0xBFF307C840000000]
define float @logreg_score_aren(float %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = fpext float %0 to double
%6 = fcmp olt double %5, 8.500000e-01
br i1 %6, label %36, label %7
7: ; preds = %4
%8 = tail call float @llvm.fmuladd.f32(float %0, float 0xC03C152BE0000000, float 0x40407EC220000000)
%9 = sitofp i32 %2 to float
%10 = fptosi float %9 to i32
%11 = tail call float @mlog(i32 %10)
%12 = tail call float @llvm.fmuladd.f32(float %11, float 0xC00C8F5C20000000, float %8)
%13 = sitofp i32 %1 to float
%14 = fptosi float %13 to i32
%15 = tail call float @mlog(i32 %14)
%16 = tail call float @llvm.fmuladd.f32(float %15, float 0xBFBB50B100000000, float %12)
br label %24
17: ; preds = %24
%18 = fneg float %33
%19 = tail call double @exp(float %18)
%20 = fadd double %19, 1.000000e+00
%21 = fdiv double 1.000000e+00, %20
%22 = fsub double 1.000000e+00, %21
%23 = fptrunc double %22 to float
br label %36
24: ; preds = %7, %24
%25 = phi i64 [ 0, %7 ], [ %34, %24 ]
%26 = phi float [ %16, %7 ], [ %33, %24 ]
%27 = getelementptr inbounds i32, i32* %3, i64 %25
%28 = load i32, i32* %27
%29 = tail call float @mlog(i32 %28)
%30 = add nuw nsw i64 %25, 4
%31 = getelementptr inbounds [24 x float], [24 x float]* @__const.logreg_score_aren.params, i64 0, i64 %30
%32 = load float, float* %31
%33 = tail call float @llvm.fmuladd.f32(float %29, float %32, float %26)
%34 = add nuw nsw i64 %25, 1
%35 = icmp eq i64 %34, 20
br i1 %35, label %17, label %24
36: ; preds = %4, %17
%37 = phi float [ %23, %17 ], [ 0.000000e+00, %4 ]
ret float %37
}