#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 const asin(double);
double cos(double const);
double sin(double const);
double sqrt(double);
double tan(double);
extern double ionppp(const double *pos, const double *azel, double re,
                     double hion, double *posp) {
  double cosaz, rp, ap, sinap, tanap;
  rp = re / (re + hion) * cos(azel[1]);
  ap = 3.1415926535897932 / 2.0 - azel[1] - asin(rp);
  sinap = sin(ap);
  tanap = tan(ap);
  cosaz = cos(azel[0]);
  posp[0] = asin(sin(pos[0]) * cos(ap) + cos(pos[0]) * sinap * cosaz);
  if ((pos[0] > 70.0 * (3.1415926535897932 / 180.0) &&
       tanap * cosaz > tan(3.1415926535897932 / 2.0 - pos[0])) ||
      (pos[0] < -70.0 * (3.1415926535897932 / 180.0) &&
       -tanap * cosaz > tan(3.1415926535897932 / 2.0 + pos[0]))) {
    posp[1] =
        pos[1] + 3.1415926535897932 - asin(sinap * sin(azel[0]) / cos(posp[0]));
  } else {
    posp[1] = pos[1] + asin(sinap * sin(azel[0]) / cos(posp[0]));
  }
  return 1.0 / sqrt(1.0 - rp * rp);
}


x86 assembly (clang, -O0):
<ionppp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xe54(%rip),%xmm0
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1050 <tan@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1060 <cos@plt>
movsd  -0x60(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <asin@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd8d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12b3 <ionppp+0x163>
movsd  -0x50(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xd70(%rip),%xmm0
subsd  (%rax),%xmm0
call   1050 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     1316 <ionppp+0x1c6>
mov    -0x8(%rbp),%rax
movsd  0xd51(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    139e <ionppp+0x24e>
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xd0d(%rip),%xmm0
addsd  (%rax),%xmm0
call   1050 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    139e <ionppp+0x24e>
mov    -0x8(%rbp),%rax
movsd  0xcf6(%rip),%xmm0
addsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
call   1040 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    1419 <ionppp+0x2c9>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
call   1040 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xbda(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xbc6(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ionppp>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsi),%xmm0
call   1060 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0xe78(%rip),%xmm1
subsd  0x8(%r15),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x30(%rsp)
call   1040 <asin@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <tan@plt>
movaps %xmm0,0x40(%rsp)
movsd  (%r15),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
call   1060 <cos@plt>
mulsd  0x28(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0x38(%rsp),%xmm1
addsd  %xmm1,%xmm0
call   1040 <asin@plt>
movsd  %xmm0,(%r14)
movsd  (%rbx),%xmm0
ucomisd 0xdcf(%rip),%xmm0
jbe    1272 <ionppp+0x122>
movapd 0x40(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0xdab(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <tan@plt>
movapd 0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     12bb <ionppp+0x16b>
movsd  (%rbx),%xmm0
movsd  0xd96(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1311 <ionppp+0x1c1>
movapd 0x40(%rsp),%xmm1
xorpd  0xd9e(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
addsd  0xd56(%rip),%xmm0
call   1050 <tan@plt>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1311 <ionppp+0x1c1>
movsd  0x8(%rbx),%xmm0
addsd  0xd50(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%r15),%xmm0
call   1030 <sin@plt>
mulsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r14),%xmm0
call   1060 <cos@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <asin@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    1355 <ionppp+0x205>
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%r15),%xmm0
call   1030 <sin@plt>
mulsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r14),%xmm0
call   1060 <cos@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <asin@plt>
addsd  0x10(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  %xmm0,0x8(%r14)
mulsd  %xmm1,%xmm1
movsd  0xcb3(%rip),%xmm2
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1385 <ionppp+0x235>
sqrtsd %xmm0,%xmm0
jmp    1392 <ionppp+0x242>
call   1070 <sqrt@plt>
movsd  0xc8e(%rip),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @ionppp(double* %0, double* %1, double %2, double %3, double* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store double %2, double* %8
store double %3, double* %9
store double* %4, double** %10
%16 = load double, double* %8
%17 = load double, double* %8
%18 = load double, double* %9
%19 = fadd double %17, %18
%20 = fdiv double %16, %19
%21 = load double*, double** %7
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = call double @cos(double %23)
%25 = fmul double %20, %24
store double %25, double* %12
%26 = load double*, double** %7
%27 = getelementptr inbounds double, double* %26, i64 1
%28 = load double, double* %27
%29 = fsub double 0x3FF921FB54442D18, %28
%30 = load double, double* %12
%31 = call double @asin(double %30)
%32 = fsub double %29, %31
store double %32, double* %13
%33 = load double, double* %13
%34 = call double @sin(double %33)
store double %34, double* %14
%35 = load double, double* %13
%36 = call double @tan(double %35)
store double %36, double* %15
%37 = load double*, double** %7
%38 = getelementptr inbounds double, double* %37, i64 0
%39 = load double, double* %38
%40 = call double @cos(double %39)
store double %40, double* %11
%41 = load double*, double** %6
%42 = getelementptr inbounds double, double* %41, i64 0
%43 = load double, double* %42
%44 = call double @sin(double %43)
%45 = load double, double* %13
%46 = call double @cos(double %45)
%47 = load double*, double** %6
%48 = getelementptr inbounds double, double* %47, i64 0
%49 = load double, double* %48
%50 = call double @cos(double %49)
%51 = load double, double* %14
%52 = fmul double %50, %51
%53 = load double, double* %11
%54 = fmul double %52, %53
%55 = call double @llvm.fmuladd.f64(double %44, double %46, double %54)
%56 = call double @asin(double %55)
%57 = load double*, double** %10
%58 = getelementptr inbounds double, double* %57, i64 0
store double %56, double* %58
%59 = load double*, double** %6
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = fcmp ogt double %61, 0x3FF38C35418A5BF6
br i1 %62, label %63, label %73
63: ; preds = %5
%64 = load double, double* %15
%65 = load double, double* %11
%66 = fmul double %64, %65
%67 = load double*, double** %6
%68 = getelementptr inbounds double, double* %67, i64 0
%69 = load double, double* %68
%70 = fsub double 0x3FF921FB54442D18, %69
%71 = call double @tan(double %70)
%72 = fcmp ogt double %66, %71
br i1 %72, label %89, label %73
73: ; preds = %63, %5
%74 = load double*, double** %6
%75 = getelementptr inbounds double, double* %74, i64 0
%76 = load double, double* %75
%77 = fcmp olt double %76, 0xBFF38C35418A5BF6
br i1 %77, label %78, label %109
78: ; preds = %73
%79 = load double, double* %15
%80 = fneg double %79
%81 = load double, double* %11
%82 = fmul double %80, %81
%83 = load double*, double** %6
%84 = getelementptr inbounds double, double* %83, i64 0
%85 = load double, double* %84
%86 = fadd double 0x3FF921FB54442D18, %85
%87 = call double @tan(double %86)
%88 = fcmp ogt double %82, %87
br i1 %88, label %89, label %109
89: ; preds = %78, %63
%90 = load double*, double** %6
%91 = getelementptr inbounds double, double* %90, i64 1
%92 = load double, double* %91
%93 = fadd double %92, 0x400921FB54442D18
%94 = load double, double* %14
%95 = load double*, double** %7
%96 = getelementptr inbounds double, double* %95, i64 0
%97 = load double, double* %96
%98 = call double @sin(double %97)
%99 = fmul double %94, %98
%100 = load double*, double** %10
%101 = getelementptr inbounds double, double* %100, i64 0
%102 = load double, double* %101
%103 = call double @cos(double %102)
%104 = fdiv double %99, %103
%105 = call double @asin(double %104)
%106 = fsub double %93, %105
%107 = load double*, double** %10
%108 = getelementptr inbounds double, double* %107, i64 1
store double %106, double* %108
br label %128
109: ; preds = %78, %73
%110 = load double*, double** %6
%111 = getelementptr inbounds double, double* %110, i64 1
%112 = load double, double* %111
%113 = load double, double* %14
%114 = load double*, double** %7
%115 = getelementptr inbounds double, double* %114, i64 0
%116 = load double, double* %115
%117 = call double @sin(double %116)
%118 = fmul double %113, %117
%119 = load double*, double** %10
%120 = getelementptr inbounds double, double* %119, i64 0
%121 = load double, double* %120
%122 = call double @cos(double %121)
%123 = fdiv double %118, %122
%124 = call double @asin(double %123)
%125 = fadd double %112, %124
%126 = load double*, double** %10
%127 = getelementptr inbounds double, double* %126, i64 1
store double %125, double* %127
br label %128
128: ; preds = %109, %89
%129 = load double, double* %12
%130 = load double, double* %12
%131 = fneg double %129
%132 = call double @llvm.fmuladd.f64(double %131, double %130, double 1.000000e+00)
%133 = call double @sqrt(double %132)
%134 = fdiv double 1.000000e+00, %133
ret double %134
}

LLVM IR (-O2):
define double @ionppp(double* nocapture %0, double* nocapture %1, double %2, double %3, double* nocapture %4) {
%6 = fadd double %2, %3
%7 = fdiv double %2, %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = tail call double @cos(double %9)
%11 = fmul double %7, %10
%12 = load double, double* %8
%13 = fsub double 0x3FF921FB54442D18, %12
%14 = tail call double @asin(double %11)
%15 = fsub double %13, %14
%16 = tail call double @sin(double %15)
%17 = tail call double @tan(double %15)
%18 = load double, double* %1
%19 = tail call double @cos(double %18)
%20 = load double, double* %0
%21 = tail call double @sin(double %20)
%22 = tail call double @cos(double %15)
%23 = load double, double* %0
%24 = tail call double @cos(double %23)
%25 = fmul double %16, %24
%26 = fmul double %19, %25
%27 = tail call double @llvm.fmuladd.f64(double %21, double %22, double %26)
%28 = tail call double @asin(double %27)
store double %28, double* %4
%29 = load double, double* %0
%30 = fcmp ogt double %29, 0x3FF38C35418A5BF6
br i1 %30, label %31, label %38
31: ; preds = %5
%32 = fmul double %17, %19
%33 = fsub double 0x3FF921FB54442D18, %29
%34 = tail call double @tan(double %33)
%35 = fcmp ogt double %32, %34
br i1 %35, label %47, label %36
36: ; preds = %31
%37 = load double, double* %0
br label %38
38: ; preds = %36, %5
%39 = phi double [ %37, %36 ], [ %29, %5 ]
%40 = fcmp olt double %39, 0xBFF38C35418A5BF6
br i1 %40, label %41, label %59
41: ; preds = %38
%42 = fneg double %17
%43 = fmul double %19, %42
%44 = fadd double %39, 0x3FF921FB54442D18
%45 = tail call double @tan(double %44)
%46 = fcmp ogt double %43, %45
br i1 %46, label %47, label %59
47: ; preds = %41, %31
%48 = getelementptr inbounds double, double* %0, i64 1
%49 = load double, double* %48
%50 = fadd double %49, 0x400921FB54442D18
%51 = load double, double* %1
%52 = tail call double @sin(double %51)
%53 = fmul double %16, %52
%54 = load double, double* %4
%55 = tail call double @cos(double %54)
%56 = fdiv double %53, %55
%57 = tail call double @asin(double %56)
%58 = fsub double %50, %57
br label %70
59: ; preds = %41, %38
%60 = getelementptr inbounds double, double* %0, i64 1
%61 = load double, double* %60
%62 = load double, double* %1
%63 = tail call double @sin(double %62)
%64 = fmul double %16, %63
%65 = load double, double* %4
%66 = tail call double @cos(double %65)
%67 = fdiv double %64, %66
%68 = tail call double @asin(double %67)
%69 = fadd double %61, %68
br label %70
70: ; preds = %59, %47
%71 = phi double [ %69, %59 ], [ %58, %47 ]
%72 = getelementptr inbounds double, double* %4, i64 1
store double %71, double* %72
%73 = fneg double %11
%74 = tail call double @llvm.fmuladd.f64(double %73, double %11, double 1.000000e+00)
%75 = tail call double @sqrt(double %74)
%76 = fdiv double 1.000000e+00, %75
ret double %76
}