#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 tan(double);
double rotatetrace(double expstart, double mjd, double degperyr,
                   double *a2displ, int nelem) {
  int i;
  double temp;
  double angle = degperyr * (expstart - mjd) / 365.25;
  double radians_coef = 3.14159265358979323846 / 180;
  temp = tan(angle * radians_coef);
  for (i = 0; i < nelem; i++) {
    a2displ[i] -= (i - nelem / 2) * temp;
  }
  return angle;
}


x86 assembly (clang, -O0):
<rotatetrace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1030 <tan@plt>
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11e6 <rotatetrace+0xd6>
mov    -0x28(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117a <rotatetrace+0x6a>
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotatetrace>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm3
divsd  0xed4(%rip),%xmm3
movsd  0xed4(%rip),%xmm0
movsd  %xmm3,(%rsp)
mulsd  %xmm3,%xmm0
call   1030 <tan@plt>
test   %ebp,%ebp
jle    1215 <rotatetrace+0x105>
mov    %ebp,%eax
shr    %eax
mov    %ebp,%ecx
cmp    $0x4,%ebp
jae    115c <rotatetrace+0x4c>
xor    %edx,%edx
jmp    11ee <rotatetrace+0xde>
mov    %ecx,%edx
and    $0xfffffffc,%edx
movd   %eax,%xmm1
pshufd $0x50,%xmm1,%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
lea    0x0(,%rcx,8),%rsi
and    $0xffffffffffffffe0,%rsi
movdqa 0xe8a(%rip),%xmm3
xor    %edi,%edi
movdqa 0xe8f(%rip),%xmm8
movdqa 0xe96(%rip),%xmm9
nopw   0x0(%rax,%rax,1)
movdqa %xmm3,%xmm6
psubd  %xmm1,%xmm6
cvtdq2pd %xmm6,%xmm7
paddd  %xmm8,%xmm6
cvtdq2pd %xmm6,%xmm6
movupd (%rbx,%rdi,1),%xmm4
movupd 0x10(%rbx,%rdi,1),%xmm5
mulpd  %xmm2,%xmm7
subpd  %xmm7,%xmm4
mulpd  %xmm2,%xmm6
subpd  %xmm6,%xmm5
movupd %xmm4,(%rbx,%rdi,1)
movupd %xmm5,0x10(%rbx,%rdi,1)
paddd  %xmm9,%xmm3
add    $0x20,%rdi
cmp    %rdi,%rsi
jne    11a0 <rotatetrace+0x90>
cmp    %rcx,%rdx
je     1215 <rotatetrace+0x105>
neg    %eax
lea    (%rax,%rdx,1),%esi
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
movsd  (%rbx,%rdx,8),%xmm2
mulsd  %xmm0,%xmm1
subsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    11f0 <rotatetrace+0xe0>
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @rotatetrace(double %0, double %1, double %2, double* %3, i32 %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
store i32 %4, i32* %10
%15 = load double, double* %8
%16 = load double, double* %6
%17 = load double, double* %7
%18 = fsub double %16, %17
%19 = fmul double %15, %18
%20 = fdiv double %19, 3.652500e+02
store double %20, double* %13
store double 0x3F91DF46A2529D39, double* %14
%21 = load double, double* %13
%22 = load double, double* %14
%23 = fmul double %21, %22
%24 = call double @tan(double %23)
store double %24, double* %12
store i32 0, i32* %11
br label %25
25: ; preds = %43, %5
%26 = load i32, i32* %11
%27 = load i32, i32* %10
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %46
29: ; preds = %25
%30 = load i32, i32* %11
%31 = load i32, i32* %10
%32 = sdiv i32 %31, 2
%33 = sub nsw i32 %30, %32
%34 = sitofp i32 %33 to double
%35 = load double, double* %12
%36 = load double*, double** %9
%37 = load i32, i32* %11
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = fneg double %34
%42 = call double @llvm.fmuladd.f64(double %41, double %35, double %40)
store double %42, double* %39
br label %43
43: ; preds = %29
%44 = load i32, i32* %11
%45 = add nsw i32 %44, 1
store i32 %45, i32* %11
br label %25
46: ; preds = %25
%47 = load double, double* %13
ret double %47
}

LLVM IR (-O2):
define double @rotatetrace(double %0, double %1, double %2, double* nocapture %3, i32 %4) {
%6 = fsub double %0, %1
%7 = fmul double %6, %2
%8 = fdiv double %7, 3.652500e+02
%9 = fmul double %8, 0x3F91DF46A2529D39
%10 = tail call double @tan(double %9)
%11 = icmp sgt i32 %4, 0
br i1 %11, label %12, label %64
12: ; preds = %5
%13 = lshr i32 %4, 1
%14 = zext i32 %4 to i64
%15 = icmp ult i32 %4, 4
br i1 %15, label %51, label %16
16: ; preds = %12
%17 = and i64 %14, 4294967292
%18 = insertelement <2 x i32> poison, i32 %13, i64 0
%19 = shufflevector <2 x i32> %18, <2 x i32> poison, <2 x i32> zeroinitializer
%20 = insertelement <2 x i32> poison, i32 %13, i64 0
%21 = shufflevector <2 x i32> %20, <2 x i32> poison, <2 x i32> zeroinitializer
%22 = insertelement <2 x double> poison, double %10, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = insertelement <2 x double> poison, double %10, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
br label %26
26: ; preds = %26, %16
%27 = phi i64 [ 0, %16 ], [ %46, %26 ]
%28 = phi <2 x i32> [ <i32 0, i32 1>, %16 ], [ %47, %26 ]
%29 = add <2 x i32> %28, <i32 2, i32 2>
%30 = sub <2 x i32> %28, %19
%31 = sub <2 x i32> %29, %21
%32 = sitofp <2 x i32> %30 to <2 x double>
%33 = sitofp <2 x i32> %31 to <2 x double>
%34 = getelementptr inbounds double, double* %3, i64 %27
%35 = bitcast double* %34 to <2 x double>*
%36 = load <2 x double>, <2 x double>* %35
%37 = getelementptr inbounds double, double* %34, i64 2
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = fneg <2 x double> %32
%41 = fneg <2 x double> %33
%42 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %40, <2 x double> %23, <2 x double> %36)
%43 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %41, <2 x double> %25, <2 x double> %39)
%44 = bitcast double* %34 to <2 x double>*
store <2 x double> %42, <2 x double>* %44
%45 = bitcast double* %37 to <2 x double>*
store <2 x double> %43, <2 x double>* %45
%46 = add nuw i64 %27, 4
%47 = add <2 x i32> %28, <i32 4, i32 4>
%48 = icmp eq i64 %46, %17
br i1 %48, label %49, label %26
49: ; preds = %26
%50 = icmp eq i64 %17, %14
br i1 %50, label %64, label %51
51: ; preds = %12, %49
%52 = phi i64 [ 0, %12 ], [ %17, %49 ]
br label %53
53: ; preds = %51, %53
%54 = phi i64 [ %62, %53 ], [ %52, %51 ]
%55 = trunc i64 %54 to i32
%56 = sub i32 %55, %13
%57 = sitofp i32 %56 to double
%58 = getelementptr inbounds double, double* %3, i64 %54
%59 = load double, double* %58
%60 = fneg double %57
%61 = tail call double @llvm.fmuladd.f64(double %60, double %10, double %59)
store double %61, double* %58
%62 = add nuw nsw i64 %54, 1
%63 = icmp eq i64 %62, %14
br i1 %63, label %64, label %53
64: ; preds = %53, %49, %5
ret double %8
}