#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 tanh(float);
void hidden_layer_1_D(int N_hidden, float x_pi, float *w_ji, float *y_pj,
                      int actFunc) {
  int n = 0;
  for (n = 0; n < N_hidden; n++) {
    switch (actFunc) {
    case 0: {
      y_pj[n] = tanh(x_pi / 12.0 * w_ji[n]);
    }
    case 1: {
      y_pj[n] = x_pi * w_ji[n];
    }
    default: {
      y_pj[n] = tanh(x_pi / 12.0 * w_ji[n]);
    }
    }
  }
}


x86 assembly (clang, -O0):
<hidden_layer_1_D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    121b <hidden_layer_1_D+0x10b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
test   %eax,%eax
je     1169 <hidden_layer_1_D+0x59>
jmp    1158 <hidden_layer_1_D+0x48>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
je     11a9 <hidden_layer_1_D+0x99>
jmp    11c8 <hidden_layer_1_D+0xb8>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe86(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <tanh@plt>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mulss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe27(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <tanh@plt>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    120d <hidden_layer_1_D+0xfd>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1139 <hidden_layer_1_D+0x29>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hidden_layer_1_D>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0x4(%rsp)
test   %edi,%edi
jle    11c6 <hidden_layer_1_D+0xb6>
mov    %ecx,%r14d
mov    %rdx,%r12
mov    %rsi,%rbp
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xebb(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %edi,%r15d
xor    %ebx,%ebx
jmp    119a <hidden_layer_1_D+0x8a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  0x0(%rbp,%rbx,4),%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,(%r12,%rbx,4)
movss  0x0(%rbp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <tanh@plt>
movss  %xmm0,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
je     11c6 <hidden_layer_1_D+0xb6>
cmp    $0x1,%r14d
je     1160 <hidden_layer_1_D+0x50>
test   %r14d,%r14d
jne    1172 <hidden_layer_1_D+0x62>
movss  0x0(%rbp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <tanh@plt>
movss  %xmm0,(%r12,%rbx,4)
jmp    1160 <hidden_layer_1_D+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @hidden_layer_1_D(i32 %0, float %1, float* %2, float* %3, i32 %4) {
%6 = alloca i32
%7 = alloca float
%8 = alloca float*
%9 = alloca float*
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store float %1, float* %7
store float* %2, float** %8
store float* %3, float** %9
store i32 %4, i32* %10
store i32 0, i32* %11
store i32 0, i32* %11
br label %12
12: ; preds = %65, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %68
16: ; preds = %12
%17 = load i32, i32* %10
switch i32 %17, label %47 [
i32 0, label %18
i32 1, label %35
]
18: ; preds = %16
%19 = load float, float* %7
%20 = fpext float %19 to double
%21 = fdiv double %20, 1.200000e+01
%22 = load float*, float** %8
%23 = load i32, i32* %11
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds float, float* %22, i64 %24
%26 = load float, float* %25
%27 = fpext float %26 to double
%28 = fmul double %21, %27
%29 = fptrunc double %28 to float
%30 = call float @tanh(float %29)
%31 = load float*, float** %9
%32 = load i32, i32* %11
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds float, float* %31, i64 %33
store float %30, float* %34
br label %35
35: ; preds = %16, %18
%36 = load float, float* %7
%37 = load float*, float** %8
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float, float* %37, i64 %39
%41 = load float, float* %40
%42 = fmul float %36, %41
%43 = load float*, float** %9
%44 = load i32, i32* %11
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds float, float* %43, i64 %45
store float %42, float* %46
br label %47
47: ; preds = %16, %35
%48 = load float, float* %7
%49 = fpext float %48 to double
%50 = fdiv double %49, 1.200000e+01
%51 = load float*, float** %8
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds float, float* %51, i64 %53
%55 = load float, float* %54
%56 = fpext float %55 to double
%57 = fmul double %50, %56
%58 = fptrunc double %57 to float
%59 = call float @tanh(float %58)
%60 = load float*, float** %9
%61 = load i32, i32* %11
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds float, float* %60, i64 %62
store float %59, float* %63
br label %64
64: ; preds = %47
br label %65
65: ; preds = %64
%66 = load i32, i32* %11
%67 = add nsw i32 %66, 1
store i32 %67, i32* %11
br label %12
68: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @hidden_layer_1_D(i32 %0, float %1, float* nocapture %2, float* nocapture writeonly %3, i32 %4) {
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %36
7: ; preds = %5
%8 = fpext float %1 to double
%9 = fdiv double %8, 1.200000e+01
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %7, %26
%12 = phi i64 [ 0, %7 ], [ %34, %26 ]
switch i32 %4, label %26 [
i32 0, label %13
i32 1, label %21
]
13: ; preds = %11
%14 = getelementptr inbounds float, float* %2, i64 %12
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = fmul double %9, %16
%18 = fptrunc double %17 to float
%19 = tail call float @tanh(float %18)
%20 = getelementptr inbounds float, float* %3, i64 %12
store float %19, float* %20
br label %21
21: ; preds = %11, %13
%22 = getelementptr inbounds float, float* %2, i64 %12
%23 = load float, float* %22
%24 = fmul float %23, %1
%25 = getelementptr inbounds float, float* %3, i64 %12
store float %24, float* %25
br label %26
26: ; preds = %11, %21
%27 = getelementptr inbounds float, float* %2, i64 %12
%28 = load float, float* %27
%29 = fpext float %28 to double
%30 = fmul double %9, %29
%31 = fptrunc double %30 to float
%32 = tail call float @tanh(float %31)
%33 = getelementptr inbounds float, float* %3, i64 %12
store float %32, float* %33
%34 = add nuw nsw i64 %12, 1
%35 = icmp eq i64 %34, %10
br i1 %35, label %36, label %11
36: ; preds = %26, %5
ret void
}