#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) {
  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,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xebb(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
movss  -0x80(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
movss  -0x7c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x90(%rbp)
ff
cvtsi2ssl -0xc(%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 -0x8(%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    123b <logreg_score_aren+0x10b>
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    11de <logreg_score_aren+0xae>
movss  -0x84(%rbp),%xmm0
ff
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1050 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xda0(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xd94(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xd88(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logreg_score_aren>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mulss  0xed0(%rip),%xmm0
mov    %rdx,%rbx
mov    %edi,%ebp
cvtsi2ss %esi,%xmm1
addss  0xec3(%rip),%xmm0
movss  %xmm0,(%rsp)
cvttss2si %xmm1,%edi
call   1030 <mlog@plt>
mulss  0xeb1(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %ebp,%xmm1
addss  (%rsp),%xmm0
movss  %xmm0,(%rsp)
cvttss2si %xmm1,%edi
call   1030 <mlog@plt>
mulss  0xe93(%rip),%xmm0
addss  (%rsp),%xmm0
xor    %ebp,%ebp
lea    0xea9(%rip),%r14
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    1190 <logreg_score_aren+0x70>
xorps  0xe4c(%rip),%xmm0
call   1040 <exp@plt>
movsd  0xe4f(%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 i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca [24 x float]
%10 = alloca float
%11 = alloca i32
store float %0, float* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%12 = bitcast [24 x float]* %9 to i8*
%13 = getelementptr inbounds [24 x float], [24 x float]* %9, i64 0, i64 0
%14 = load float, float* %13
%15 = load float, float* %5
%16 = getelementptr inbounds [24 x float], [24 x float]* %9, i64 0, i64 1
%17 = load float, float* %16
%18 = call float @llvm.fmuladd.f32(float %15, float %17, float %14)
%19 = load i32, i32* %7
%20 = sitofp i32 %19 to float
%21 = fptosi float %20 to i32
%22 = call float @mlog(i32 %21)
%23 = getelementptr inbounds [24 x float], [24 x float]* %9, i64 0, i64 2
%24 = load float, float* %23
%25 = call float @llvm.fmuladd.f32(float %22, float %24, float %18)
%26 = load i32, i32* %6
%27 = sitofp i32 %26 to float
%28 = fptosi float %27 to i32
%29 = call float @mlog(i32 %28)
%30 = getelementptr inbounds [24 x float], [24 x float]* %9, i64 0, i64 3
%31 = load float, float* %30
%32 = call float @llvm.fmuladd.f32(float %29, float %31, float %25)
store float %32, float* %10
store i32 0, i32* %11
br label %33
33: ; preds = %50, %4
%34 = load i32, i32* %11
%35 = icmp slt i32 %34, 20
br i1 %35, label %36, label %53
36: ; preds = %33
%37 = load i32*, i32** %8
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
%41 = load i32, i32* %40
%42 = call float @mlog(i32 %41)
%43 = load i32, i32* %11
%44 = add nsw i32 %43, 4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [24 x float], [24 x float]* %9, i64 0, i64 %45
%47 = load float, float* %46
%48 = load float, float* %10
%49 = call float @llvm.fmuladd.f32(float %42, float %47, float %48)
store float %49, float* %10
br label %50
50: ; preds = %36
%51 = load i32, i32* %11
%52 = add nsw i32 %51, 1
store i32 %52, i32* %11
br label %33
53: ; preds = %33
%54 = load float, float* %10
%55 = fneg float %54
%56 = call double @exp(float %55)
%57 = fadd double 1.000000e+00, %56
%58 = fdiv double 1.000000e+00, %57
%59 = fsub double 1.000000e+00, %58
%60 = fptrunc double %59 to float
ret float %60
}

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 = tail call float @llvm.fmuladd.f32(float %0, float 0xC03C152BE0000000, float 0x40407EC220000000)
%6 = sitofp i32 %2 to float
%7 = fptosi float %6 to i32
%8 = tail call float @mlog(i32 %7)
%9 = tail call float @llvm.fmuladd.f32(float %8, float 0xC00C8F5C20000000, float %5)
%10 = sitofp i32 %1 to float
%11 = fptosi float %10 to i32
%12 = tail call float @mlog(i32 %11)
%13 = tail call float @llvm.fmuladd.f32(float %12, float 0xBFBB50B100000000, float %9)
br label %21
14: ; preds = %21
%15 = fneg float %30
%16 = tail call double @exp(float %15)
%17 = fadd double %16, 1.000000e+00
%18 = fdiv double 1.000000e+00, %17
%19 = fsub double 1.000000e+00, %18
%20 = fptrunc double %19 to float
ret float %20
21: ; preds = %4, %21
%22 = phi i64 [ 0, %4 ], [ %31, %21 ]
%23 = phi float [ %13, %4 ], [ %30, %21 ]
%24 = getelementptr inbounds i32, i32* %3, i64 %22
%25 = load i32, i32* %24
%26 = tail call float @mlog(i32 %25)
%27 = add nuw nsw i64 %22, 4
%28 = getelementptr inbounds [24 x float], [24 x float]* @__const.logreg_score_aren.params, i64 0, i64 %27
%29 = load float, float* %28
%30 = tail call float @llvm.fmuladd.f32(float %26, float %29, float %23)
%31 = add nuw nsw i64 %22, 1
%32 = icmp eq i64 %31, 20
br i1 %32, label %14, label %21
}