#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 pow(float, float);
float calculafx(float x2, float *f3, float *f4, int m) {
  float fx1 = 0;
  for (int j = 1; j <= m; j++) {
    fx1 += f3[j] * pow(x2, f4[j]);
  }
  return fx1;
}


x86 assembly (clang, -O0):
<calculafx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1194 <calculafx+0x84>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movss  -0x28(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1137 <calculafx+0x27>
movss  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculafx>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %edx,%edx
jle    114e <calculafx+0x3e>
mov    %rsi,%r14
mov    %rdi,%r12
movss  %xmm0,0xc(%rsp)
mov    %edx,%r13d
lea    -0x1(%r13),%rax
mov    %r13d,%r15d
and    $0x3,%r15d
cmp    $0x3,%rax
jae    1156 <calculafx+0x46>
xorps  %xmm0,%xmm0
mov    $0x1,%ebx
jmp    1235 <calculafx+0x125>
xorps  %xmm0,%xmm0
jmp    129b <calculafx+0x18b>
and    $0xfffffffc,%r13d
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
nop
movss  %xmm0,0x4(%rsp)
movss  0x4(%r12,%rbx,4),%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x4(%r14,%rbx,4),%xmm1
movss  0xc(%rsp),%xmm0
call   1030 <pow@plt>
mulss  0x8(%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%r12,%rbx,4),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x8(%r14,%rbx,4),%xmm1
movss  0xc(%rsp),%xmm0
call   1030 <pow@plt>
mulss  0x8(%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0xc(%r12,%rbx,4),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%r14,%rbx,4),%xmm1
movss  0xc(%rsp),%xmm0
call   1030 <pow@plt>
mulss  0x8(%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x10(%r12,%rbx,4),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x10(%r14,%rbx,4),%xmm1
movss  0xc(%rsp),%xmm0
call   1030 <pow@plt>
mulss  0x8(%rsp),%xmm0
addss  0x4(%rsp),%xmm0
add    $0x4,%rbx
cmp    %rbx,%r13
jne    1160 <calculafx+0x50>
add    $0x1,%rbx
test   %r15,%r15
movss  0xc(%rsp),%xmm2
je     129b <calculafx+0x18b>
lea    (%r14,%rbx,4),%r14
lea    (%r12,%rbx,4),%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movss  %xmm0,0x4(%rsp)
movss  (%r12,%rbx,4),%xmm0
movss  %xmm0,0x8(%rsp)
movss  (%r14,%rbx,4),%xmm1
movaps %xmm2,%xmm0
call   1030 <pow@plt>
movss  0xc(%rsp),%xmm2
mulss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x4(%rsp),%xmm0
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1250 <calculafx+0x140>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @calculafx(float %0, float* %1, float* %2, i32 %3) {
%5 = alloca float
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca float
%10 = alloca i32
store float %0, float* %5
store float* %1, float** %6
store float* %2, float** %7
store i32 %3, i32* %8
store float 0.000000e+00, float* %9
store i32 1, i32* %10
br label %11
11: ; preds = %30, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %8
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = load float*, float** %6
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %16, i64 %18
%20 = load float, float* %19
%21 = load float, float* %5
%22 = load float*, float** %7
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds float, float* %22, i64 %24
%26 = load float, float* %25
%27 = call float @pow(float %21, float %26)
%28 = load float, float* %9
%29 = call float @llvm.fmuladd.f32(float %20, float %27, float %28)
store float %29, float* %9
br label %30
30: ; preds = %15
%31 = load i32, i32* %10
%32 = add nsw i32 %31, 1
store i32 %32, i32* %10
br label %11
33: ; preds = %11
%34 = load float, float* %9
ret float %34
}

LLVM IR (-O2):
define float @calculafx(float %0, float* nocapture %1, float* nocapture %2, i32 %3) {
%5 = icmp slt i32 %3, 1
br i1 %5, label %33, label %6
6: ; preds = %4
%7 = add nuw i32 %3, 1
%8 = zext i32 %7 to i64
%9 = add nsw i64 %8, -1
%10 = add nsw i64 %8, -2
%11 = and i64 %9, 3
%12 = icmp ult i64 %10, 3
br i1 %12, label %15, label %13
13: ; preds = %6
%14 = and i64 %9, -4
br label %35
15: ; preds = %35, %6
%16 = phi float [ undef, %6 ], [ %65, %35 ]
%17 = phi i64 [ 1, %6 ], [ %66, %35 ]
%18 = phi float [ 0.000000e+00, %6 ], [ %65, %35 ]
%19 = icmp eq i64 %11, 0
br i1 %19, label %33, label %20
20: ; preds = %15, %20
%21 = phi i64 [ %30, %20 ], [ %17, %15 ]
%22 = phi float [ %29, %20 ], [ %18, %15 ]
%23 = phi i64 [ %31, %20 ], [ 0, %15 ]
%24 = getelementptr inbounds float, float* %1, i64 %21
%25 = load float, float* %24
%26 = getelementptr inbounds float, float* %2, i64 %21
%27 = load float, float* %26
%28 = tail call float @pow(float %0, float %27)
%29 = tail call float @llvm.fmuladd.f32(float %25, float %28, float %22)
%30 = add nuw nsw i64 %21, 1
%31 = add i64 %23, 1
%32 = icmp eq i64 %31, %11
br i1 %32, label %33, label %20
33: ; preds = %15, %20, %4
%34 = phi float [ 0.000000e+00, %4 ], [ %16, %15 ], [ %29, %20 ]
ret float %34
35: ; preds = %35, %13
%36 = phi i64 [ 1, %13 ], [ %66, %35 ]
%37 = phi float [ 0.000000e+00, %13 ], [ %65, %35 ]
%38 = phi i64 [ 0, %13 ], [ %67, %35 ]
%39 = getelementptr inbounds float, float* %1, i64 %36
%40 = load float, float* %39
%41 = getelementptr inbounds float, float* %2, i64 %36
%42 = load float, float* %41
%43 = tail call float @pow(float %0, float %42)
%44 = tail call float @llvm.fmuladd.f32(float %40, float %43, float %37)
%45 = add nuw nsw i64 %36, 1
%46 = getelementptr inbounds float, float* %1, i64 %45
%47 = load float, float* %46
%48 = getelementptr inbounds float, float* %2, i64 %45
%49 = load float, float* %48
%50 = tail call float @pow(float %0, float %49)
%51 = tail call float @llvm.fmuladd.f32(float %47, float %50, float %44)
%52 = add nuw nsw i64 %36, 2
%53 = getelementptr inbounds float, float* %1, i64 %52
%54 = load float, float* %53
%55 = getelementptr inbounds float, float* %2, i64 %52
%56 = load float, float* %55
%57 = tail call float @pow(float %0, float %56)
%58 = tail call float @llvm.fmuladd.f32(float %54, float %57, float %51)
%59 = add nuw nsw i64 %36, 3
%60 = getelementptr inbounds float, float* %1, i64 %59
%61 = load float, float* %60
%62 = getelementptr inbounds float, float* %2, i64 %59
%63 = load float, float* %62
%64 = tail call float @pow(float %0, float %63)
%65 = tail call float @llvm.fmuladd.f32(float %61, float %64, float %58)
%66 = add nuw nsw i64 %36, 4
%67 = add i64 %38, 4
%68 = icmp eq i64 %67, %14
br i1 %68, label %15, label %35
}