#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 cos(double);
double sundis(double time) {
  double A0 = 1.000140, CS = 1.49597870E11;
  double A[] = {16706.0E-6, 139.0E-6, 31.0E-6, 16.0E-6,
                16.0E-6,    5.0E-6,   5.0E-6};
  double B[] = {35999.05E0, 71998.0E0,  445267.0E0, 32964.0E0,
                45038.0E0,  22519.00E0, 33718.0E0};
  double C[] = {177.53E0, 175.0E0, 298.0E0, 68.0E0, 164.0E0, 233.0E0, 226.0E0};
  double au = 0, temp;
  int i;
  A[0] = 0.016706 - 0.000042 * time;
  for (i = 0; i < 7; i++) {
    temp = (B[i] * time + C[i]) * 0.0174532925199433;
    au += A[i] * cos(temp);
  }
  return ((A0 + au) * CS);
}


x86 assembly (clang, -O0):
<sundis>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee0(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecb(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xedb(%rip),%rsi
mov    $0x38,%edx
call   1030 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xf03(%rip),%rsi
mov    $0x38,%edx
call   1030 <memcpy@plt>
lea    -0xd0(%rbp),%rdi
lea    0xf2b(%rip),%rsi
mov    $0x38,%edx
call   1030 <memcpy@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  0xe59(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe55(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0xe4(%rbp)
cmpl   $0x7,-0xe4(%rbp)
jge    126d <sundis+0x14d>
movslq -0xe4(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movsd  -0x8(%rbp),%xmm2
movslq -0xe4(%rbp),%rax
movsd  -0xd0(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe18(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movslq -0xe4(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
call   1040 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0xf0(%rbp),%xmm0
ff
movsd  -0xd8(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    11c6 <sundis+0xa6>
movsd  -0x10(%rbp),%xmm0
addsd  -0xd8(%rbp),%xmm0
ff
mulsd  -0x18(%rbp),%xmm0
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sundis>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
movsd  0xeda(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xed6(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xed0(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xecc(%rip),%xmm0
mulsd  0xecc(%rip),%xmm0
call   1030 <cos@plt>
mulsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xeb3(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xead(%rip),%xmm0
mulsd  0xe95(%rip),%xmm0
call   1030 <cos@plt>
mulsd  0xea0(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe94(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xe8e(%rip),%xmm0
mulsd  0xe5e(%rip),%xmm0
call   1030 <cos@plt>
mulsd  0xe81(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe75(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xe6f(%rip),%xmm0
mulsd  0xe27(%rip),%xmm0
call   1030 <cos@plt>
mulsd  0xe62(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe56(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xe50(%rip),%xmm0
mulsd  0xdf0(%rip),%xmm0
call   1030 <cos@plt>
mulsd  0xe2b(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe2f(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0xe29(%rip),%xmm0
mulsd  0xdb9(%rip),%xmm0
call   1030 <cos@plt>
mulsd  0xe1c(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0xe16(%rip),%xmm1
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
addsd  0xe0a(%rip),%xmm1
mulsd  0xd82(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  0xde1(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0xdeb(%rip),%xmm0
mulsd  0xdeb(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.sundis.A = [7 x double] [double 1.670600e-02, double 1.390000e-04, double 3.100000e-05, double 1.600000e-05, double 1.600000e-05, double 5.000000e-06, double 5.000000e-06]
@__const.sundis.B = [7 x double] [double 0x40E193E19999999A, double 7.199800e+04, double 4.452670e+05, double 3.296400e+04, double 4.503800e+04, double 2.251900e+04, double 3.371800e+04]
@__const.sundis.C = [7 x double] [double 1.775300e+02, double 1.750000e+02, double 2.980000e+02, double 6.800000e+01, double 1.640000e+02, double 2.330000e+02, double 2.260000e+02]
define double @sundis(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca [7 x double]
%6 = alloca [7 x double]
%7 = alloca [7 x double]
%8 = alloca double
%9 = alloca double
%10 = alloca i32
store double %0, double* %2
store double 1.000140e+00, double* %3
store double 0x42416A5D2BD80000, double* %4
%11 = bitcast [7 x double]* %5 to i8*
%12 = bitcast [7 x double]* %6 to i8*
%13 = bitcast [7 x double]* %7 to i8*
store double 0.000000e+00, double* %8
%14 = load double, double* %2
%15 = call double @llvm.fmuladd.f64(double -4.200000e-05, double %14, double 1.670600e-02)
%16 = getelementptr inbounds [7 x double], [7 x double]* %5, i64 0, i64 0
store double %15, double* %16
store i32 0, i32* %10
br label %17
17: ; preds = %40, %1
%18 = load i32, i32* %10
%19 = icmp slt i32 %18, 7
br i1 %19, label %20, label %43
20: ; preds = %17
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [7 x double], [7 x double]* %6, i64 0, i64 %22
%24 = load double, double* %23
%25 = load double, double* %2
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [7 x double], [7 x double]* %7, i64 0, i64 %27
%29 = load double, double* %28
%30 = call double @llvm.fmuladd.f64(double %24, double %25, double %29)
%31 = fmul double %30, 0x3F91DF46A2529D3A
store double %31, double* %9
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [7 x double], [7 x double]* %5, i64 0, i64 %33
%35 = load double, double* %34
%36 = load double, double* %9
%37 = call double @cos(double %36)
%38 = load double, double* %8
%39 = call double @llvm.fmuladd.f64(double %35, double %37, double %38)
store double %39, double* %8
br label %40
40: ; preds = %20
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %17
43: ; preds = %17
%44 = load double, double* %3
%45 = load double, double* %8
%46 = fadd double %44, %45
%47 = load double, double* %4
%48 = fmul double %46, %47
ret double %48
}

LLVM IR (-O2):
define double @sundis(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double -4.200000e-05, double 1.670600e-02)
%3 = tail call double @llvm.fmuladd.f64(double %0, double 0x40E193E19999999A, double 1.775300e+02)
%4 = fmul double %3, 0x3F91DF46A2529D3A
%5 = tail call double @cos(double %4)
%6 = tail call double @llvm.fmuladd.f64(double %2, double %5, double 0.000000e+00)
%7 = tail call double @llvm.fmuladd.f64(double %0, double 7.199800e+04, double 1.750000e+02)
%8 = fmul double %7, 0x3F91DF46A2529D3A
%9 = tail call double @cos(double %8)
%10 = tail call double @llvm.fmuladd.f64(double %9, double 1.390000e-04, double %6)
%11 = tail call double @llvm.fmuladd.f64(double %0, double 4.452670e+05, double 2.980000e+02)
%12 = fmul double %11, 0x3F91DF46A2529D3A
%13 = tail call double @cos(double %12)
%14 = tail call double @llvm.fmuladd.f64(double %13, double 3.100000e-05, double %10)
%15 = tail call double @llvm.fmuladd.f64(double %0, double 3.296400e+04, double 6.800000e+01)
%16 = fmul double %15, 0x3F91DF46A2529D3A
%17 = tail call double @cos(double %16)
%18 = tail call double @llvm.fmuladd.f64(double %17, double 1.600000e-05, double %14)
%19 = tail call double @llvm.fmuladd.f64(double %0, double 4.503800e+04, double 1.640000e+02)
%20 = fmul double %19, 0x3F91DF46A2529D3A
%21 = tail call double @cos(double %20)
%22 = tail call double @llvm.fmuladd.f64(double %21, double 1.600000e-05, double %18)
%23 = tail call double @llvm.fmuladd.f64(double %0, double 2.251900e+04, double 2.330000e+02)
%24 = fmul double %23, 0x3F91DF46A2529D3A
%25 = tail call double @cos(double %24)
%26 = tail call double @llvm.fmuladd.f64(double %25, double 5.000000e-06, double %22)
%27 = tail call double @llvm.fmuladd.f64(double %0, double 3.371800e+04, double 2.260000e+02)
%28 = fmul double %27, 0x3F91DF46A2529D3A
%29 = tail call double @cos(double %28)
%30 = tail call double @llvm.fmuladd.f64(double %29, double 5.000000e-06, double %26)
%31 = fadd double %30, 1.000140e+00
%32 = fmul double %31, 0x42416A5D2BD80000
ret double %32
}