#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 */
int /*<<< orphan*/ calc_2d_angles(int *, double *, double *, double *, double,
                                  double, double, double, double);
double sin(double);
void calc_interpolation_params(double *t, int *ncones, double *theta_cones,
                               double *kmax_cones, double *dcf_cones,
                               double fov1, double fov2, double fov3,
                               double res12, double res3) {
  int nphiest, count;
  double theta_temp[4096], kmax_temp[4096], dcf_temp[4096];
  double fov12;
  fov12 = (fov1 > fov2) ? fov1 : fov2;
  calc_2d_angles(ncones, theta_cones, kmax_cones, dcf_cones, fov3, fov12, res3,
                 res12, 3.1415926535897932384626433832795028841971);
  theta_cones[*ncones] = 3.1415926535897932384626433832795028841971;
  kmax_cones[*ncones] = 1.0 / (2.0 * res3);
  (*ncones)++;
  calc_2d_angles(&nphiest, theta_temp, kmax_temp, dcf_temp, fov1, fov2, res12,
                 res12, 2.0 * 3.1415926535897932384626433832795028841971);
  t[0] = 0.0;
  for (count = 1; count < *ncones; count++)
    t[count] = t[count - 1] +
               (double)nphiest *
                   sin((theta_cones[count] + theta_cones[count - 1]) / 2.0) *
                   (kmax_cones[count] + kmax_cones[count - 1]) * res12;
  return;
}


x86 assembly (clang, -O0):
<calc_interpolation_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x18080,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
movsd  %xmm2,-0x40(%rbp)
movsd  %xmm3,-0x48(%rbp)
movsd  %xmm4,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    117a <calc_interpolation_params+0x5a>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18070(%rbp)
ff
jmp    1187 <calc_interpolation_params+0x67>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x18070(%rbp)
ff
movsd  -0x18070(%rbp),%xmm0
ff
movsd  %xmm0,-0x18068(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
movsd  -0x40(%rbp),%xmm0
movsd  -0x18068(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
movsd  0xe52(%rip),%xmm4
call   1030 <calc_2d_angles@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsd  0xe3a(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xe25(%rip),%xmm1
mulsd  -0x50(%rbp),%xmm1
movsd  0xe10(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
lea    -0x8060(%rbp),%rsi
lea    -0x10060(%rbp),%rdx
lea    -0x18060(%rbp),%rcx
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
lea    -0x54(%rbp),%rdi
movsd  0xdb4(%rip),%xmm4
call   1030 <calc_2d_angles@plt>
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    132b <calc_interpolation_params+0x20b>
mov    -0x8(%rbp),%rax
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x18080(%rbp)
ff
cvtsi2sdl -0x54(%rbp),%xmm0
movsd  %xmm0,-0x18078(%rbp)
ff
mov    -0x18(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  0xd50(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  -0x18080(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x18078(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x58(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1263 <calc_interpolation_params+0x143>
add    $0x18080,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_interpolation_params>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18030,%rsp
movaps %xmm4,%xmm5
movsd  %xmm4,0x28(%rsp)
movsd  %xmm3,0x20(%rsp)
movapd %xmm1,%xmm4
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%r12
movapd %xmm0,%xmm1
maxsd  %xmm4,%xmm1
movsd  0xe95(%rip),%xmm4
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r8,%rcx
movaps %xmm2,%xmm0
movaps %xmm5,%xmm2
call   1030 <calc_2d_angles@plt>
movslq (%r15),%rax
movabs $0x400921fb54442d18,%rcx
21 09 40
mov    %rcx,0x0(%r13,%rax,8)
movsd  0x28(%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe62(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%rax,8)
add    $0x1,%eax
mov    %eax,(%r15)
lea    0x1c(%rsp),%rdi
lea    0x10030(%rsp),%rsi
lea    0x8030(%rsp),%rdx
lea    0x30(%rsp),%rcx
movsd  0xe38(%rip),%xmm4
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movaps %xmm2,%xmm3
call   1030 <calc_2d_angles@plt>
movq   $0x0,(%r12)
cmpl   $0x2,(%r15)
jl     1279 <calc_interpolation_params+0x159>
mov    $0x1,%ebx
xorpd  %xmm0,%xmm0
nopl   0x0(%rax)
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl 0x1c(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x0(%r13,%rbx,8),%xmm0
addsd  -0x8(%r13,%rbx,8),%xmm0
mulsd  0xddd(%rip),%xmm0
call   1040 <sin@plt>
movsd  (%r14,%rbx,8),%xmm1
addsd  -0x8(%r14,%rbx,8),%xmm1
mulsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
movslq (%r15),%rax
cmp    %rax,%rbx
jl     1210 <calc_interpolation_params+0xf0>
add    $0x18030,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @calc_interpolation_params(double* %0, i32* %1, double* %2, double* %3, double* %4, double %5, double %6, double %7, double %8, double %9) {
%11 = alloca double*
%12 = alloca i32*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca i32
%22 = alloca i32
%23 = alloca [4096 x double]
%24 = alloca [4096 x double]
%25 = alloca [4096 x double]
%26 = alloca double
store double* %0, double** %11
store i32* %1, i32** %12
store double* %2, double** %13
store double* %3, double** %14
store double* %4, double** %15
store double %5, double* %16
store double %6, double* %17
store double %7, double* %18
store double %8, double* %19
store double %9, double* %20
%27 = load double, double* %16
%28 = load double, double* %17
%29 = fcmp ogt double %27, %28
br i1 %29, label %30, label %32
30: ; preds = %10
%31 = load double, double* %16
br label %34
32: ; preds = %10
%33 = load double, double* %17
br label %34
34: ; preds = %32, %30
%35 = phi double [ %31, %30 ], [ %33, %32 ]
store double %35, double* %26
%36 = load i32*, i32** %12
%37 = load double*, double** %13
%38 = load double*, double** %14
%39 = load double*, double** %15
%40 = load double, double* %18
%41 = load double, double* %26
%42 = load double, double* %20
%43 = load double, double* %19
%44 = call i32 @calc_2d_angles(i32* %36, double* %37, double* %38, double* %39, double %40, double %41, double %42, double %43, double 0x400921FB54442D18)
%45 = load double*, double** %13
%46 = load i32*, i32** %12
%47 = load i32, i32* %46
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %45, i64 %48
store double 0x400921FB54442D18, double* %49
%50 = load double, double* %20
%51 = fmul double 2.000000e+00, %50
%52 = fdiv double 1.000000e+00, %51
%53 = load double*, double** %14
%54 = load i32*, i32** %12
%55 = load i32, i32* %54
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %53, i64 %56
store double %52, double* %57
%58 = load i32*, i32** %12
%59 = load i32, i32* %58
%60 = add nsw i32 %59, 1
store i32 %60, i32* %58
%61 = getelementptr inbounds [4096 x double], [4096 x double]* %23, i64 0, i64 0
%62 = getelementptr inbounds [4096 x double], [4096 x double]* %24, i64 0, i64 0
%63 = getelementptr inbounds [4096 x double], [4096 x double]* %25, i64 0, i64 0
%64 = load double, double* %16
%65 = load double, double* %17
%66 = load double, double* %19
%67 = load double, double* %19
%68 = call i32 @calc_2d_angles(i32* %21, double* %61, double* %62, double* %63, double %64, double %65, double %66, double %67, double 0x401921FB54442D18)
%69 = load double*, double** %11
%70 = getelementptr inbounds double, double* %69, i64 0
store double 0.000000e+00, double* %70
store i32 1, i32* %22
br label %71
71: ; preds = %119, %34
%72 = load i32, i32* %22
%73 = load i32*, i32** %12
%74 = load i32, i32* %73
%75 = icmp slt i32 %72, %74
br i1 %75, label %76, label %122
76: ; preds = %71
%77 = load double*, double** %11
%78 = load i32, i32* %22
%79 = sub nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %77, i64 %80
%82 = load double, double* %81
%83 = load i32, i32* %21
%84 = sitofp i32 %83 to double
%85 = load double*, double** %13
%86 = load i32, i32* %22
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %85, i64 %87
%89 = load double, double* %88
%90 = load double*, double** %13
%91 = load i32, i32* %22
%92 = sub nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double, double* %90, i64 %93
%95 = load double, double* %94
%96 = fadd double %89, %95
%97 = fdiv double %96, 2.000000e+00
%98 = call double @sin(double %97)
%99 = fmul double %84, %98
%100 = load double*, double** %14
%101 = load i32, i32* %22
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %100, i64 %102
%104 = load double, double* %103
%105 = load double*, double** %14
%106 = load i32, i32* %22
%107 = sub nsw i32 %106, 1
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %105, i64 %108
%110 = load double, double* %109
%111 = fadd double %104, %110
%112 = fmul double %99, %111
%113 = load double, double* %19
%114 = call double @llvm.fmuladd.f64(double %112, double %113, double %82)
%115 = load double*, double** %11
%116 = load i32, i32* %22
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %115, i64 %117
store double %114, double* %118
br label %119
119: ; preds = %76
%120 = load i32, i32* %22
%121 = add nsw i32 %120, 1
store i32 %121, i32* %22
br label %71
122: ; preds = %71
ret void
}

LLVM IR (-O2):
define void @calc_interpolation_params(double* nocapture %0, i32* %1, double* %2, double* %3, double* %4, double %5, double %6, double %7, double %8, double %9) {
%11 = alloca i32
%12 = alloca [4096 x double]
%13 = alloca [4096 x double]
%14 = alloca [4096 x double]
%15 = bitcast i32* %11 to i8*
%16 = bitcast [4096 x double]* %12 to i8*
%17 = bitcast [4096 x double]* %13 to i8*
%18 = bitcast [4096 x double]* %14 to i8*
%19 = fcmp ogt double %5, %6
%20 = select i1 %19, double %5, double %6
%21 = tail call i32 @calc_2d_angles(i32* %1, double* %2, double* %3, double* %4, double %7, double %20, double %9, double %8, double 0x400921FB54442D18)
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %2, i64 %23
store double 0x400921FB54442D18, double* %24
%25 = fmul double %9, 2.000000e+00
%26 = fdiv double 1.000000e+00, %25
%27 = getelementptr inbounds double, double* %3, i64 %23
store double %26, double* %27
%28 = add nsw i32 %22, 1
store i32 %28, i32* %1
%29 = getelementptr inbounds [4096 x double], [4096 x double]* %12, i64 0, i64 0
%30 = getelementptr inbounds [4096 x double], [4096 x double]* %13, i64 0, i64 0
%31 = getelementptr inbounds [4096 x double], [4096 x double]* %14, i64 0, i64 0
%32 = call i32 @calc_2d_angles(i32* %11, double* %29, double* %30, double* %31, double %5, double %6, double %8, double %8, double 0x401921FB54442D18)
store double 0.000000e+00, double* %0
%33 = load i32, i32* %1
%34 = icmp sgt i32 %33, 1
br i1 %34, label %35, label %61
35: ; preds = %10, %35
%36 = phi double [ %55, %35 ], [ 0.000000e+00, %10 ]
%37 = phi i64 [ %57, %35 ], [ 1, %10 ]
%38 = add nsw i64 %37, -1
%39 = load i32, i32* %11
%40 = sitofp i32 %39 to double
%41 = getelementptr inbounds double, double* %2, i64 %37
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %2, i64 %38
%44 = load double, double* %43
%45 = fadd double %42, %44
%46 = fmul double %45, 5.000000e-01
%47 = call double @sin(double %46)
%48 = fmul double %47, %40
%49 = getelementptr inbounds double, double* %3, i64 %37
%50 = load double, double* %49
%51 = getelementptr inbounds double, double* %3, i64 %38
%52 = load double, double* %51
%53 = fadd double %50, %52
%54 = fmul double %48, %53
%55 = call double @llvm.fmuladd.f64(double %54, double %8, double %36)
%56 = getelementptr inbounds double, double* %0, i64 %37
store double %55, double* %56
%57 = add nuw nsw i64 %37, 1
%58 = load i32, i32* %1
%59 = sext i32 %58 to i64
%60 = icmp slt i64 %57, %59
br i1 %60, label %35, label %61
61: ; preds = %35, %10
ret void
}