#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 turbine_discharge(unsigned long, float, float);
void arr_turbine_q(unsigned long int uTurb, float h, float *pFlo,
                   float *pPowStates, unsigned long int n) {
  float fTol = 1E-6;
  unsigned long int i = 0;
  float p;
  for (i = 0; i < n; i++) {
    p = pPowStates[i];
    pFlo[i] = (p < fTol) ? 0 : turbine_discharge(uTurb, h, p);
  }
}


x86 assembly (clang, -O0):
<arr_turbine_q>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movss  0xecb(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11c5 <arr_turbine_q+0xb5>
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    118a <arr_turbine_q+0x7a>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
jmp    11a2 <arr_turbine_q+0x92>
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm1
call   1030 <turbine_discharge@plt>
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    114a <arr_turbine_q+0x3a>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arr_turbine_q>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
test   %rcx,%rcx
je     1175 <arr_turbine_q+0x65>
mov    %rcx,%r13
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
movss  0xec2(%rip),%xmm2
jmp    114f <arr_turbine_q+0x3f>
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r13
je     1175 <arr_turbine_q+0x65>
movss  (%r14,%rbx,4),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm2
ja     1140 <arr_turbine_q+0x30>
mov    %r12,%rdi
movss  0xc(%rsp),%xmm0
call   1030 <turbine_discharge@plt>
movss  0xe8d(%rip),%xmm2
jmp    1140 <arr_turbine_q+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @arr_turbine_q(i64 %0, float %1, float* %2, float* %3, i64 %4) {
%6 = alloca i64
%7 = alloca float
%8 = alloca float*
%9 = alloca float*
%10 = alloca i64
%11 = alloca float
%12 = alloca i64
%13 = alloca float
store i64 %0, i64* %6
store float %1, float* %7
store float* %2, float** %8
store float* %3, float** %9
store i64 %4, i64* %10
store float 0x3EB0C6F7A0000000, float* %11
store i64 0, i64* %12
store i64 0, i64* %12
br label %14
14: ; preds = %37, %5
%15 = load i64, i64* %12
%16 = load i64, i64* %10
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %40
18: ; preds = %14
%19 = load float*, float** %9
%20 = load i64, i64* %12
%21 = getelementptr inbounds float, float* %19, i64 %20
%22 = load float, float* %21
store float %22, float* %13
%23 = load float, float* %13
%24 = load float, float* %11
%25 = fcmp olt float %23, %24
br i1 %25, label %26, label %27
26: ; preds = %18
br label %32
27: ; preds = %18
%28 = load i64, i64* %6
%29 = load float, float* %7
%30 = load float, float* %13
%31 = call float @turbine_discharge(i64 %28, float %29, float %30)
br label %32
32: ; preds = %27, %26
%33 = phi float [ 0.000000e+00, %26 ], [ %31, %27 ]
%34 = load float*, float** %8
%35 = load i64, i64* %12
%36 = getelementptr inbounds float, float* %34, i64 %35
store float %33, float* %36
br label %37
37: ; preds = %32
%38 = load i64, i64* %12
%39 = add i64 %38, 1
store i64 %39, i64* %12
br label %14
40: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @arr_turbine_q(i64 %0, float %1, float* nocapture writeonly %2, float* nocapture %3, i64 %4) {
%6 = icmp eq i64 %4, 0
br i1 %6, label %19, label %7
7: ; preds = %5, %14
%8 = phi i64 [ %17, %14 ], [ 0, %5 ]
%9 = getelementptr inbounds float, float* %3, i64 %8
%10 = load float, float* %9
%11 = fcmp olt float %10, 0x3EB0C6F7A0000000
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = tail call float @turbine_discharge(i64 %0, float %1, float %10)
br label %14
14: ; preds = %7, %12
%15 = phi float [ %13, %12 ], [ 0.000000e+00, %7 ]
%16 = getelementptr inbounds float, float* %2, i64 %8
store float %15, float* %16
%17 = add nuw i64 %8, 1
%18 = icmp eq i64 %17, %4
br i1 %18, label %19, label %7
19: ; preds = %14, %5
ret void
}