#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 */
float const calc_hidden_output(float const *, float const *, float, float,
                               float, float);
double exp(float);
float alpha_NN(float Lqnorm, float Ltnorm, float Nqnorm, float Ntnorm) {
  const int inputs = 4;
  const int hidden = 4;
  const float biases[] = {7.89636, 3.68944, 2.05448, 3.69149};
  const float alpha_bias = 1.33439;
  const float weights[] = {-6.72336, -4.73393,  -2.15446, -4.75140, -14.54957,
                           4.05462,  0.57951,   3.55780,  2.08289,  -1.81976,
                           -1.19936, -17.35097, 1.53268,  -8.13514, -2.50677,
                           1.51106,  6.37397,   -0.36254, 0.16279,  -1.32174};
  float alpha = 0.0;
  for (int h = 0; h < hidden; h++) {
    alpha += calc_hidden_output(weights + inputs * h, biases + h, Lqnorm,
                                Ltnorm, Nqnorm, Ntnorm) *
             weights[hidden * inputs + h];
  }
  alpha = 1.0 / (1.0 + exp(-(alpha + alpha_bias)));
  return alpha;
}


x86 assembly (clang, -O0):
<alpha_NN>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0x4,-0x18(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x28(%rbp)
movss  0xe85(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe92(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x94(%rbp)
ff
movl   $0x0,-0x98(%rbp)
cmpl   $0x4,-0x98(%rbp)
jge    123e <alpha_NN+0x10e>
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%eax
shl    $0x2,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x30(%rbp),%rsi
movslq -0x98(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1030 <calc_hidden_output@plt>
mov    -0x98(%rbp),%eax
add    $0x10,%eax
cltq
movss  -0x90(%rbp,%rax,4),%xmm2
ff ff
movss  -0x94(%rbp),%xmm1
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x94(%rbp)
ff
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    11ad <alpha_NN+0x7d>
movss  0xdba(%rip),%xmm0
addss  -0x94(%rbp),%xmm0
ff
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1050 <exp@plt>
movsd  0xda0(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xd94(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x94(%rbp)
ff
movss  -0x94(%rbp),%xmm0
ff
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alpha_NN>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
movss  %xmm3,0x1c(%rsp)
movss  %xmm2,0x18(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x10(%rsp)
movaps 0xed5(%rip),%xmm4
movaps %xmm4,0x20(%rsp)
movaps 0xf29(%rip),%xmm4
movaps %xmm4,0x70(%rsp)
movaps 0xf0d(%rip),%xmm4
movaps %xmm4,0x60(%rsp)
movaps 0xef1(%rip),%xmm4
movaps %xmm4,0x50(%rsp)
movaps 0xed5(%rip),%xmm4
movaps %xmm4,0x40(%rsp)
movaps 0xeb9(%rip),%xmm4
movaps %xmm4,0x30(%rsp)
lea    0x60(%rsp),%r14
lea    0x50(%rsp),%r15
lea    0x40(%rsp),%rbx
lea    0x30(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1030 <calc_hidden_output@plt>
mulss  0x70(%rsp),%xmm0
xorps  %xmm1,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
movss  0x1c(%rsp),%xmm3
call   1030 <calc_hidden_output@plt>
mulss  0x74(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x28(%rsp),%rsi
mov    %r15,%rdi
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
movss  0x1c(%rsp),%xmm3
call   1030 <calc_hidden_output@plt>
mulss  0x78(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x2c(%rsp),%rsi
mov    %r14,%rdi
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
movss  0x1c(%rsp),%xmm3
call   1030 <calc_hidden_output@plt>
mulss  0x7c(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
addss  0xd9c(%rip),%xmm0
xorps  0xda5(%rip),%xmm0
call   1040 <exp@plt>
movsd  0xdb8(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.alpha_NN.biases = [4 x float] [float 0x401F95DF60000000, float 0x400D83F920000000, float 0x40006F9340000000, float 0x400D882BE0000000]
@__const.alpha_NN.weights = [20 x float] [float 0xC01AE4B880000000, float 0xC012EF8B60000000, float 0xC0013C5580000000, float 0xC013016F00000000, float 0xC02D196140000000, float 0x401037EE40000000, float 0x3FE28B5880000000, float 0x400C765FE0000000, float 0x4000A9C240000000, float 0xBFFD1DBCA0000000, float 0xBFF3309420000000, float 0xC03159D920000000, float 0x3FF885DB80000000, float 0xC020453120000000, float 0xC0040DDD60000000, float 0x3FF82D4D40000000, float 0x40197EF200000000, float 0xBFD733DB00000000, float 0x3FC4D64D80000000, float 0xBFF525D8E0000000]
define float @alpha_NN(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
%11 = alloca [4 x float]
%12 = alloca float
%13 = alloca [20 x float]
%14 = alloca float
%15 = alloca i32
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
store i32 4, i32* %9
store i32 4, i32* %10
%16 = bitcast [4 x float]* %11 to i8*
store float 0x3FF559A960000000, float* %12
%17 = bitcast [20 x float]* %13 to i8*
store float 0.000000e+00, float* %14
store i32 0, i32* %15
br label %18
18: ; preds = %43, %4
%19 = load i32, i32* %15
%20 = icmp slt i32 %19, 4
br i1 %20, label %21, label %46
21: ; preds = %18
%22 = getelementptr inbounds [20 x float], [20 x float]* %13, i64 0, i64 0
%23 = load i32, i32* %15
%24 = mul nsw i32 4, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds float, float* %22, i64 %25
%27 = getelementptr inbounds [4 x float], [4 x float]* %11, i64 0, i64 0
%28 = load i32, i32* %15
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %27, i64 %29
%31 = load float, float* %5
%32 = load float, float* %6
%33 = load float, float* %7
%34 = load float, float* %8
%35 = call float @calc_hidden_output(float* %26, float* %30, float %31, float %32, float %33, float %34)
%36 = load i32, i32* %15
%37 = add nsw i32 16, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [20 x float], [20 x float]* %13, i64 0, i64 %38
%40 = load float, float* %39
%41 = load float, float* %14
%42 = call float @llvm.fmuladd.f32(float %35, float %40, float %41)
store float %42, float* %14
br label %43
43: ; preds = %21
%44 = load i32, i32* %15
%45 = add nsw i32 %44, 1
store i32 %45, i32* %15
br label %18
46: ; preds = %18
%47 = load float, float* %14
%48 = fadd float %47, 0x3FF559A960000000
%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
store float %53, float* %14
%54 = load float, float* %14
ret float %54
}

LLVM IR (-O2):
@__const.alpha_NN.biases = [4 x float] [float 0x401F95DF60000000, float 0x400D83F920000000, float 0x40006F9340000000, float 0x400D882BE0000000]
@__const.alpha_NN.weights = [20 x float] [float 0xC01AE4B880000000, float 0xC012EF8B60000000, float 0xC0013C5580000000, float 0xC013016F00000000, float 0xC02D196140000000, float 0x401037EE40000000, float 0x3FE28B5880000000, float 0x400C765FE0000000, float 0x4000A9C240000000, float 0xBFFD1DBCA0000000, float 0xBFF3309420000000, float 0xC03159D920000000, float 0x3FF885DB80000000, float 0xC020453120000000, float 0xC0040DDD60000000, float 0x3FF82D4D40000000, float 0x40197EF200000000, float 0xBFD733DB00000000, float 0x3FC4D64D80000000, float 0xBFF525D8E0000000]
define float @alpha_NN(float %0, float %1, float %2, float %3) {
%5 = alloca [4 x float]
%6 = alloca [20 x float]
%7 = bitcast [4 x float]* %5 to i8*
%8 = bitcast [20 x float]* %6 to i8*
%9 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%10 = getelementptr inbounds [4 x float], [4 x float]* %5, i64 0, i64 0
%11 = call float @calc_hidden_output(float* %9, float* %10, float %0, float %1, float %2, float %3)
%12 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 16
%13 = load float, float* %12
%14 = call float @llvm.fmuladd.f32(float %11, float %13, float 0.000000e+00)
%15 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 4
%16 = getelementptr inbounds [4 x float], [4 x float]* %5, i64 0, i64 1
%17 = call float @calc_hidden_output(float* %15, float* %16, float %0, float %1, float %2, float %3)
%18 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 17
%19 = load float, float* %18
%20 = call float @llvm.fmuladd.f32(float %17, float %19, float %14)
%21 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 8
%22 = getelementptr inbounds [4 x float], [4 x float]* %5, i64 0, i64 2
%23 = call float @calc_hidden_output(float* %21, float* %22, float %0, float %1, float %2, float %3)
%24 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 18
%25 = load float, float* %24
%26 = call float @llvm.fmuladd.f32(float %23, float %25, float %20)
%27 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 12
%28 = getelementptr inbounds [4 x float], [4 x float]* %5, i64 0, i64 3
%29 = call float @calc_hidden_output(float* %27, float* %28, float %0, float %1, float %2, float %3)
%30 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 19
%31 = load float, float* %30
%32 = call float @llvm.fmuladd.f32(float %29, float %31, float %26)
%33 = fadd float %32, 0x3FF559A960000000
%34 = fneg float %33
%35 = call double @exp(float %34)
%36 = fadd double %35, 1.000000e+00
%37 = fdiv double 1.000000e+00, %36
%38 = fptrunc double %37 to float
ret float %38
}