#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 get_f(float x, float f[][2], size_t size) {
  float result = 0.0;
  unsigned int i;
  for (i = 0; i < size; i++) {
    result += f[i][0] * pow(x, f[i][1]);
  }
  return result;
}


x86 assembly (clang, -O0):
<get_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%rax
jae    1191 <get_f+0x81>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movss  (%rax,%rcx,8),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movss  0x4(%rax,%rcx,8),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movss  -0x24(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1134 <get_f+0x24>
movss  -0x1c(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_f>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %rsi,%rsi
je     118d <get_f+0x7d>
mov    %rsi,%r14
mov    %rdi,%r15
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
movss  %xmm2,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  %xmm0,0x4(%rsp)
movss  (%r15,%rbx,8),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x4(%r15,%rbx,8),%xmm1
movaps %xmm2,%xmm0
call   1030 <pow@plt>
movss  0x8(%rsp),%xmm2
mulss  0xc(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x4(%rsp),%xmm0
add    $0x1,%ebx
cmp    %r14,%rbx
jb     1140 <get_f+0x30>
jmp    1190 <get_f+0x80>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define float @get_f(float %0, [2 x float]* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %17, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %15, %5 ], [ 0, %3 ]
%7 = phi float [ %13, %5 ], [ 0.000000e+00, %3 ]
%8 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 %6, i64 0
%9 = load float, float* %8
%10 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 %6, i64 1
%11 = load float, float* %10
%12 = tail call float @pow(float %0, float %11)
%13 = tail call float @llvm.fmuladd.f32(float %9, float %12, float %7)
%14 = add nuw nsw i64 %6, 1
%15 = and i64 %14, 4294967295
%16 = icmp ult i64 %15, %2
br i1 %16, label %5, label %17
17: ; preds = %5, %3
%18 = phi float [ 0.000000e+00, %3 ], [ %13, %5 ]
ret float %18
}