#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 */
double pow(double, double);
void alam_C(double *fhat, int n, double gm, double aval, double *output) {
  int i;
  double numerator, power;
  for (i = 0; i < n; i++) {
    numerator = fhat[i] / gm;
    power = 0.0 - aval;
    output[i] = pow(numerator, power);
  }
}


x86 assembly (clang, -O0):
<alam_C>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118e <alam_C+0x7e>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
call   1030 <pow@plt>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1134 <alam_C+0x24>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alam_C>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    11cf <alam_C+0xbf>
mov    %rdx,%r14
mov    %rdi,%r15
xorpd  %xmm2,%xmm2
subsd  %xmm1,%xmm2
mov    %esi,%r12d
cmp    $0x1,%esi
movsd  %xmm0,(%rsp)
jne    1144 <alam_C+0x34>
xor    %ebx,%ebx
jmp    11a7 <alam_C+0x97>
mov    %r12d,%r13d
and    $0xfffffffe,%r13d
xor    %ebx,%ebx
movsd  %xmm2,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%r15,%rbx,8),%xmm0
divsd  (%rsp),%xmm0
movapd %xmm2,%xmm1
call   1030 <pow@plt>
movsd  %xmm0,(%r14,%rbx,8)
movsd  0x8(%r15,%rbx,8),%xmm0
divsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm2
movsd  %xmm0,0x8(%r14,%rbx,8)
add    $0x2,%rbx
cmp    %rbx,%r13
jne    1160 <alam_C+0x50>
test   $0x1,%r12b
movsd  (%rsp),%xmm0
je     11cf <alam_C+0xbf>
movapd %xmm0,%xmm1
movsd  (%r15,%rbx,8),%xmm0
divsd  %xmm1,%xmm0
movapd %xmm2,%xmm1
call   1030 <pow@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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