#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_ken(int totdots, int pathcnt, int *dotvec) {
  float params[] = {-12.7,  9.56,   -1.66,   -1.28,   -0.549,
                    -0.421, -0.214, -0.0987, -0.0484, -0.0207};
  float z = params[0] + mlog((float)pathcnt) * params[1] +
            mlog((float)totdots) * params[2];
  for (int n = 0; n < 7; n++) {
    z += mlog(dotvec[n]) * params[n + 3];
  }
  return 1.0 / (1.0 + exp(-z));
}


x86 assembly (clang, -O0):
<logreg_score_ken>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec3(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <mlog@plt>
movss  -0x50(%rbp),%xmm1
movss  -0x3c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <mlog@plt>
movss  -0x4c(%rbp),%xmm1
movss  -0x38(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0x7,-0x48(%rbp)
jge    11fa <logreg_score_ken+0xca>
mov    -0x10(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <mlog@plt>
mov    -0x48(%rbp),%eax
add    $0x3,%eax
cltq
movss  -0x40(%rbp,%rax,4),%xmm2
movss  -0x44(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11b2 <logreg_score_ken+0x82>
movss  -0x44(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1050 <exp@plt>
movsd  0xde7(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xddb(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logreg_score_ken>:
push   %rbp
push   %rbx
push   %rax
cvtsi2ss %esi,%xmm0
mov    %rdx,%rbx
mov    %edi,%ebp
cvttss2si %xmm0,%edi
call   1030 <mlog@plt>
mulss  0xec3(%rip),%xmm0
cvtsi2ss %ebp,%xmm1
addss  0xebb(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
cvttss2si %xmm1,%edi
call   1030 <mlog@plt>
mulss  0xea8(%rip),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    (%rbx),%edi
call   1030 <mlog@plt>
mulss  0xe91(%rip),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    0x4(%rbx),%edi
call   1030 <mlog@plt>
mulss  0xe79(%rip),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    0x8(%rbx),%edi
call   1030 <mlog@plt>
mulss  0xe61(%rip),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    0xc(%rbx),%edi
call   1030 <mlog@plt>
mulss  0xe49(%rip),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    0x10(%rbx),%edi
call   1030 <mlog@plt>
mulss  0xe31(%rip),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    0x14(%rbx),%edi
call   1030 <mlog@plt>
mulss  0xe19(%rip),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    0x18(%rbx),%edi
call   1030 <mlog@plt>
mulss  0xe01(%rip),%xmm0
addss  0x4(%rsp),%xmm0
xorps  0xe00(%rip),%xmm0
call   1040 <exp@plt>
movsd  0xe03(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.logreg_score_ken.params = [10 x float] [float 0xC029666660000000, float 0x40231EB860000000, float 0xBFFA8F5C20000000, float 0xBFF47AE140000000, float 0xBFE1916880000000, float 0xBFDAF1AA00000000, float 0xBFCB645A20000000, float 0xBFB9446740000000, float 0xBFA8C7E280000000, float 0xBF95326180000000]
define float @logreg_score_ken(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [10 x float]
%8 = alloca float
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%10 = bitcast [10 x float]* %7 to i8*
%11 = getelementptr inbounds [10 x float], [10 x float]* %7, i64 0, i64 0
%12 = load float, float* %11
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to float
%15 = fptosi float %14 to i32
%16 = call float @mlog(i32 %15)
%17 = getelementptr inbounds [10 x float], [10 x float]* %7, i64 0, i64 1
%18 = load float, float* %17
%19 = call float @llvm.fmuladd.f32(float %16, float %18, float %12)
%20 = load i32, i32* %4
%21 = sitofp i32 %20 to float
%22 = fptosi float %21 to i32
%23 = call float @mlog(i32 %22)
%24 = getelementptr inbounds [10 x float], [10 x float]* %7, i64 0, i64 2
%25 = load float, float* %24
%26 = call float @llvm.fmuladd.f32(float %23, float %25, float %19)
store float %26, float* %8
store i32 0, i32* %9
br label %27
27: ; preds = %44, %3
%28 = load i32, i32* %9
%29 = icmp slt i32 %28, 7
br i1 %29, label %30, label %47
30: ; preds = %27
%31 = load i32*, i32** %6
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = call float @mlog(i32 %35)
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [10 x float], [10 x float]* %7, i64 0, i64 %39
%41 = load float, float* %40
%42 = load float, float* %8
%43 = call float @llvm.fmuladd.f32(float %36, float %41, float %42)
store float %43, float* %8
br label %44
44: ; preds = %30
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %27
47: ; preds = %27
%48 = load float, float* %8
%49 = fneg float %48
%50 = call double @exp(float %49)
%51 = fadd double 1.000000e+00, %50
%52 = fdiv double 1.000000e+00, %51
%53 = fptrunc double %52 to float
ret float %53
}

LLVM IR (-O2):
define float @logreg_score_ken(i32 %0, i32 %1, i32* nocapture %2) {
%4 = sitofp i32 %1 to float
%5 = fptosi float %4 to i32
%6 = tail call float @mlog(i32 %5)
%7 = tail call float @llvm.fmuladd.f32(float %6, float 0x40231EB860000000, float 0xC029666660000000)
%8 = sitofp i32 %0 to float
%9 = fptosi float %8 to i32
%10 = tail call float @mlog(i32 %9)
%11 = tail call float @llvm.fmuladd.f32(float %10, float 0xBFFA8F5C20000000, float %7)
%12 = load i32, i32* %2
%13 = tail call float @mlog(i32 %12)
%14 = tail call float @llvm.fmuladd.f32(float %13, float 0xBFF47AE140000000, float %11)
%15 = getelementptr inbounds i32, i32* %2, i64 1
%16 = load i32, i32* %15
%17 = tail call float @mlog(i32 %16)
%18 = tail call float @llvm.fmuladd.f32(float %17, float 0xBFE1916880000000, float %14)
%19 = getelementptr inbounds i32, i32* %2, i64 2
%20 = load i32, i32* %19
%21 = tail call float @mlog(i32 %20)
%22 = tail call float @llvm.fmuladd.f32(float %21, float 0xBFDAF1AA00000000, float %18)
%23 = getelementptr inbounds i32, i32* %2, i64 3
%24 = load i32, i32* %23
%25 = tail call float @mlog(i32 %24)
%26 = tail call float @llvm.fmuladd.f32(float %25, float 0xBFCB645A20000000, float %22)
%27 = getelementptr inbounds i32, i32* %2, i64 4
%28 = load i32, i32* %27
%29 = tail call float @mlog(i32 %28)
%30 = tail call float @llvm.fmuladd.f32(float %29, float 0xBFB9446740000000, float %26)
%31 = getelementptr inbounds i32, i32* %2, i64 5
%32 = load i32, i32* %31
%33 = tail call float @mlog(i32 %32)
%34 = tail call float @llvm.fmuladd.f32(float %33, float 0xBFA8C7E280000000, float %30)
%35 = getelementptr inbounds i32, i32* %2, i64 6
%36 = load i32, i32* %35
%37 = tail call float @mlog(i32 %36)
%38 = tail call float @llvm.fmuladd.f32(float %37, float 0xBF95326180000000, float %34)
%39 = fneg float %38
%40 = tail call double @exp(float %39)
%41 = fadd double %40, 1.000000e+00
%42 = fdiv double 1.000000e+00, %41
%43 = fptrunc double %42 to float
ret float %43
}