#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*/ asin(double);
double cos(int /*<<< orphan*/);
double sin(double);
extern double ionmapf(const double *pos, const double *azel) {
  if (pos[2] >= 350000.0) {
    return 1.0;
  }
  return 1.0 / cos(asin((6378137.0 + pos[2]) / (6378137.0 + 350000.0) *
                        sin(3.1415926535897932 / 2.0 - azel[1])));
}


x86 assembly (clang, -O0):
<ionmapf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  0xeaf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     116d <ionmapf+0x3d>
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <ionmapf+0xa1>
mov    -0x10(%rbp),%rax
movsd  0xea7(%rip),%xmm0
addsd  0x10(%rax),%xmm0
movsd  0xe92(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xe75(%rip),%xmm0
subsd  0x8(%rax),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <asin@plt>
mov    %eax,%edi
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe40(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ionmapf>:
push   %rax
movsd  0x10(%rdi),%xmm0
ucomisd 0xeca(%rip),%xmm0
jae    118a <ionmapf+0x5a>
addsd  0xec8(%rip),%xmm0
divsd  0xec8(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xec3(%rip),%xmm0
subsd  0x8(%rsi),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
call   1040 <asin@plt>
mov    %eax,%edi
call   1050 <cos@plt>
movapd %xmm0,%xmm1
movsd  0xe7c(%rip),%xmm0
divsd  %xmm1,%xmm0
pop    %rax
ret
movsd  0xe6e(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ionmapf(double* %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
%6 = load double*, double** %4
%7 = getelementptr inbounds double, double* %6, i64 2
%8 = load double, double* %7
%9 = fcmp oge double %8, 3.500000e+05
br i1 %9, label %10, label %11
10: ; preds = %2
store double 1.000000e+00, double* %3
br label %26
11: ; preds = %2
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 2
%14 = load double, double* %13
%15 = fadd double 0x415854A640000000, %14
%16 = fdiv double %15, 0x4159AA7240000000
%17 = load double*, double** %5
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = fsub double 0x3FF921FB54442D18, %19
%21 = call double @sin(double %20)
%22 = fmul double %16, %21
%23 = call i32 @asin(double %22)
%24 = call double @cos(i32 %23)
%25 = fdiv double 1.000000e+00, %24
store double %25, double* %3
br label %26
26: ; preds = %11, %10
%27 = load double, double* %3
ret double %27
}

LLVM IR (-O2):
define double @ionmapf(double* nocapture %0, double* nocapture %1) {
%3 = getelementptr inbounds double, double* %0, i64 2
%4 = load double, double* %3
%5 = fcmp ult double %4, 3.500000e+05
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = fadd double %4, 0x415854A640000000
%8 = fdiv double %7, 0x4159AA7240000000
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = fsub double 0x3FF921FB54442D18, %10
%12 = tail call double @sin(double %11)
%13 = fmul double %8, %12
%14 = tail call i32 @asin(double %13)
%15 = tail call double @cos(i32 %14)
%16 = fdiv double 1.000000e+00, %15
br label %17
17: ; preds = %2, %6
%18 = phi double [ %16, %6 ], [ 1.000000e+00, %2 ]
ret double %18
}