#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 sin(double);
double pj_authlat(double beta, double *APA) {
  double t = beta + beta;
  return (beta + APA[0] * sin(t) + APA[1] * sin(t + t) +
          APA[2] * sin(t + t + t));
}


x86 assembly (clang, -O0):
<pj_authlat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pj_authlat>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
addsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rdi),%xmm1
movsd  %xmm1,(%rsp)
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @pj_authlat(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca double
store double %0, double* %3
store double* %1, double** %4
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fadd double %6, %7
store double %8, double* %5
%9 = load double, double* %3
%10 = load double*, double** %4
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = load double, double* %5
%14 = call double @sin(double %13)
%15 = call double @llvm.fmuladd.f64(double %12, double %14, double %9)
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = load double, double* %5
%20 = load double, double* %5
%21 = fadd double %19, %20
%22 = call double @sin(double %21)
%23 = call double @llvm.fmuladd.f64(double %18, double %22, double %15)
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 2
%26 = load double, double* %25
%27 = load double, double* %5
%28 = load double, double* %5
%29 = fadd double %27, %28
%30 = load double, double* %5
%31 = fadd double %29, %30
%32 = call double @sin(double %31)
%33 = call double @llvm.fmuladd.f64(double %26, double %32, double %23)
ret double %33
}

LLVM IR (-O2):
define double @pj_authlat(double %0, double* nocapture %1) {
%3 = fadd double %0, %0
%4 = load double, double* %1
%5 = tail call double @sin(double %3)
%6 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %0)
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fadd double %3, %3
%10 = tail call double @sin(double %9)
%11 = tail call double @llvm.fmuladd.f64(double %8, double %10, double %6)
%12 = getelementptr inbounds double, double* %1, i64 2
%13 = load double, double* %12
%14 = fadd double %3, %9
%15 = tail call double @sin(double %14)
%16 = tail call double @llvm.fmuladd.f64(double %13, double %15, double %11)
ret double %16
}