#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 G(float);
float myFunc(const int vIndex, const float *restrict p,
             const float *restrict ex, const int nExamples, float *pred) {
  register float h1;
  register float o;
  float in[2];
  in[0] = ex[(0 * nExamples + vIndex)];
  in[1] = ex[(1 * nExamples + vIndex)];
  h1 = p[0];
  o = p[1];
  h1 += in[0] * p[2];
  h1 += in[1] * p[3];
  h1 = G(h1);
  o += in[0] * p[4];
  o += in[1] * p[5];
  o += h1 * p[6];
  return o - ex[((0 + 2) * nExamples + vIndex)];
}


x86 assembly (clang, -O0):
<myFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rax
imul   $0x0,-0x1c(%rbp),%ecx
add    -0x4(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x0,%ecx
add    -0x4(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm2
movss  -0x2c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x34(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm2
movss  -0x2c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
call   1030 <G@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  0x10(%rax),%xmm2
movss  -0x30(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x34(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  0x14(%rax),%xmm2
movss  -0x30(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x2c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  0x18(%rax),%xmm2
movss  -0x30(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    -0x4(%rbp),%ecx
movslq %ecx,%rcx
subss  (%rax,%rcx,4),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myFunc>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbx
movslq %edi,%r12
movss  (%rdx,%r12,4),%xmm0
movss  %xmm0,0x10(%rsp)
lea    (%r14,%r12,1),%eax
cltq
movss  (%rdx,%rax,4),%xmm2
movss  %xmm2,0xc(%rsp)
movss  0x8(%rsi),%xmm1
mulss  %xmm0,%xmm1
addss  (%rsi),%xmm1
movss  0x4(%rsi),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0xc(%rsi),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <G@plt>
movss  0x10(%rsp),%xmm1
mulss  0x10(%rbx),%xmm1
addss  0x14(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
mulss  0x14(%rbx),%xmm2
addss  %xmm1,%xmm2
mulss  0x18(%rbx),%xmm0
addss  %xmm2,%xmm0
lea    (%r12,%r14,2),%eax
cltq
subss  (%r15,%rax,4),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @myFunc(i32 %0, float* noalias %1, float* noalias %2, i32 %3, float* %4) {
%6 = alloca i32
%7 = alloca float*
%8 = alloca float*
%9 = alloca i32
%10 = alloca float*
%11 = alloca float
%12 = alloca float
%13 = alloca [2 x float]
store i32 %0, i32* %6
store float* %1, float** %7
store float* %2, float** %8
store i32 %3, i32* %9
store float* %4, float** %10
%14 = load float*, float** %8
%15 = load i32, i32* %9
%16 = mul nsw i32 0, %15
%17 = load i32, i32* %6
%18 = add nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds float, float* %14, i64 %19
%21 = load float, float* %20
%22 = getelementptr inbounds [2 x float], [2 x float]* %13, i64 0, i64 0
store float %21, float* %22
%23 = load float*, float** %8
%24 = load i32, i32* %9
%25 = mul nsw i32 1, %24
%26 = load i32, i32* %6
%27 = add nsw i32 %25, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %23, i64 %28
%30 = load float, float* %29
%31 = getelementptr inbounds [2 x float], [2 x float]* %13, i64 0, i64 1
store float %30, float* %31
%32 = load float*, float** %7
%33 = getelementptr inbounds float, float* %32, i64 0
%34 = load float, float* %33
store float %34, float* %11
%35 = load float*, float** %7
%36 = getelementptr inbounds float, float* %35, i64 1
%37 = load float, float* %36
store float %37, float* %12
%38 = getelementptr inbounds [2 x float], [2 x float]* %13, i64 0, i64 0
%39 = load float, float* %38
%40 = load float*, float** %7
%41 = getelementptr inbounds float, float* %40, i64 2
%42 = load float, float* %41
%43 = load float, float* %11
%44 = call float @llvm.fmuladd.f32(float %39, float %42, float %43)
store float %44, float* %11
%45 = getelementptr inbounds [2 x float], [2 x float]* %13, i64 0, i64 1
%46 = load float, float* %45
%47 = load float*, float** %7
%48 = getelementptr inbounds float, float* %47, i64 3
%49 = load float, float* %48
%50 = load float, float* %11
%51 = call float @llvm.fmuladd.f32(float %46, float %49, float %50)
store float %51, float* %11
%52 = load float, float* %11
%53 = call float @G(float %52)
store float %53, float* %11
%54 = getelementptr inbounds [2 x float], [2 x float]* %13, i64 0, i64 0
%55 = load float, float* %54
%56 = load float*, float** %7
%57 = getelementptr inbounds float, float* %56, i64 4
%58 = load float, float* %57
%59 = load float, float* %12
%60 = call float @llvm.fmuladd.f32(float %55, float %58, float %59)
store float %60, float* %12
%61 = getelementptr inbounds [2 x float], [2 x float]* %13, i64 0, i64 1
%62 = load float, float* %61
%63 = load float*, float** %7
%64 = getelementptr inbounds float, float* %63, i64 5
%65 = load float, float* %64
%66 = load float, float* %12
%67 = call float @llvm.fmuladd.f32(float %62, float %65, float %66)
store float %67, float* %12
%68 = load float, float* %11
%69 = load float*, float** %7
%70 = getelementptr inbounds float, float* %69, i64 6
%71 = load float, float* %70
%72 = load float, float* %12
%73 = call float @llvm.fmuladd.f32(float %68, float %71, float %72)
store float %73, float* %12
%74 = load float, float* %12
%75 = load float*, float** %8
%76 = load i32, i32* %9
%77 = mul nsw i32 2, %76
%78 = load i32, i32* %6
%79 = add nsw i32 %77, %78
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds float, float* %75, i64 %80
%82 = load float, float* %81
%83 = fsub float %74, %82
ret float %83
}

LLVM IR (-O2):
define float @myFunc(i32 %0, float* noalias nocapture %1, float* noalias nocapture %2, i32 %3, float* nocapture readnone %4) {
%6 = sext i32 %0 to i64
%7 = getelementptr inbounds float, float* %2, i64 %6
%8 = load float, float* %7
%9 = add nsw i32 %3, %0
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds float, float* %2, i64 %10
%12 = load float, float* %11
%13 = load float, float* %1
%14 = getelementptr inbounds float, float* %1, i64 1
%15 = load float, float* %14
%16 = getelementptr inbounds float, float* %1, i64 2
%17 = load float, float* %16
%18 = tail call float @llvm.fmuladd.f32(float %8, float %17, float %13)
%19 = getelementptr inbounds float, float* %1, i64 3
%20 = load float, float* %19
%21 = tail call float @llvm.fmuladd.f32(float %12, float %20, float %18)
%22 = tail call float @G(float %21)
%23 = getelementptr inbounds float, float* %1, i64 4
%24 = load float, float* %23
%25 = tail call float @llvm.fmuladd.f32(float %8, float %24, float %15)
%26 = getelementptr inbounds float, float* %1, i64 5
%27 = load float, float* %26
%28 = tail call float @llvm.fmuladd.f32(float %12, float %27, float %25)
%29 = getelementptr inbounds float, float* %1, i64 6
%30 = load float, float* %29
%31 = tail call float @llvm.fmuladd.f32(float %22, float %30, float %28)
%32 = shl nsw i32 %3, 1
%33 = add nsw i32 %32, %0
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float, float* %2, i64 %34
%36 = load float, float* %35
%37 = fsub float %31, %36
ret float %37
}