#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 M_PI;
int /*<<< orphan*/ cartesian2spherical(double *, double *, double *, double,
                                       double, double);
float cos(float);
int /*<<< orphan*/ rotateY_d(int, float, double *, double *, double *);
int /*<<< orphan*/ rotateZ_d(int, float, double *, double *, double *);
float sin(float);
int /*<<< orphan*/ spherical2Cartesian(int, float, float, double *, double *,
                                       double *);
double sqrt(int);
void projectionHammerAitoff_xy(float longitude, float latitude,
                               float dlongitude, float dlatitude, float *x,
                               float *y) {
  float f;
  double x2, y2, z2, theta, phi, r;
  dlongitude *= 180.0 / M_PI;
  dlatitude *= 180.0 / M_PI;
  spherical2Cartesian(1, latitude + 0.5 * M_PI, longitude, &x2, &y2, &z2);
  rotateZ_d(1, dlongitude, &x2, &y2, &z2);
  rotateY_d(1, -dlatitude, &x2, &y2, &z2);
  cartesian2spherical(&r, &theta, &phi, x2, y2, z2);
  latitude = theta - 0.5 * M_PI;
  longitude = phi;
  f = 1.0 / sqrt(1.0 + cos(latitude) * cos(0.5 * longitude));
  *x = f * 2.0 * sqrt(2.0) * cos(latitude) * sin(0.5 * longitude);
  *y = sqrt(2.0) * sin(latitude) * f;
  *x *= 0.5 * sqrt(2);
  *y *= 0.5 * sqrt(2);
}


x86 assembly (clang, -O0):
<projectionHammerAitoff_xy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  0xe81(%rip),%xmm1
mov    0x2e42(%rip),%rax
divsd  (%rax),%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movsd  0xe58(%rip),%xmm1
mov    0x2e19(%rip),%rax
divsd  (%rax),%xmm1
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
mov    0x2def(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xdfb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
mov    $0x1,%edi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1090 <spherical2Cartesian@plt>
movss  -0xc(%rbp),%xmm0
mov    $0x1,%edi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1030 <rotateZ_d@plt>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    $0x1,%edi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1050 <rotateY_d@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
lea    -0x58(%rbp),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1070 <cartesian2spherical@plt>
movsd  -0x48(%rbp),%xmm1
mov    0x2d4d(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xd71(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movsd  -0x50(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
movss  %xmm0,-0x7c(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd1a(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x7c(%rbp),%xmm0
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd05(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1080 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xced(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcc7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    $0x2,%edi
call   1080 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movss  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc6b(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    $0x2,%edi
call   1080 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    $0x2,%edi
call   1080 <sqrt@plt>
movsd  0xbee(%rip),%xmm1
mulsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    $0x2,%edi
call   1080 <sqrt@plt>
movsd  0xbc0(%rip),%xmm1
mulsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<projectionHammerAitoff_xy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movaps %xmm0,%xmm4
mov    0x2e5a(%rip),%rbp
movsd  0x0(%rbp),%xmm0
movsd  0xe65(%rip),%xmm5
divsd  %xmm0,%xmm5
cvtss2sd %xmm2,%xmm2
mulsd  %xmm5,%xmm2
cvtsd2ss %xmm2,%xmm2
movss  %xmm2,0x4(%rsp)
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
mulsd  %xmm5,%xmm2
cvtsd2ss %xmm2,%xmm2
movaps %xmm2,0x10(%rsp)
cvtss2sd %xmm1,%xmm1
mulsd  0xe37(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0x48(%rsp),%rbx
lea    0x40(%rsp),%r12
lea    0x38(%rsp),%r13
mov    $0x1,%edi
movaps %xmm4,%xmm1
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1090 <spherical2Cartesian@plt>
mov    $0x1,%edi
movss  0x4(%rsp),%xmm0
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1030 <rotateZ_d@plt>
movaps 0x10(%rsp),%xmm0
xorps  0xdfd(%rip),%xmm0
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1050 <rotateY_d@plt>
movsd  0x48(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x38(%rsp),%xmm2
lea    0x50(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
call   1070 <cartesian2spherical@plt>
movsd  0x0(%rbp),%xmm0
mulsd  0xda7(%rip),%xmm0
addsd  0x30(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
movsd  0x28(%rsp),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x10(%rsp)
call   1060 <cos@plt>
movss  %xmm0,0x20(%rsp)
movss  0x10(%rsp),%xmm0
mulss  0xd8e(%rip),%xmm0
movss  %xmm0,0x10(%rsp)
call   1060 <cos@plt>
mulss  0x20(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xd59(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <sqrt@plt>
movsd  0xd48(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
addsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x2,%edi
call   1080 <sqrt@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
call   1060 <cos@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <sin@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r15)
mov    $0x2,%edi
call   1080 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1040 <sin@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r14)
mov    $0x2,%edi
call   1080 <sqrt@plt>
mulsd  0xc84(%rip),%xmm0
movss  (%r15),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,(%r15)
mov    $0x2,%edi
call   1080 <sqrt@plt>
mulsd  0xc59(%rip),%xmm0
movss  (%r14),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,(%r14)
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @projectionHammerAitoff_xy(float %0, float %1, float %2, float %3, float* %4, float* %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float*
%12 = alloca float*
%13 = alloca float
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float* %4, float** %11
store float* %5, float** %12
%20 = load double, double* @M_PI
%21 = fdiv double 1.800000e+02, %20
%22 = load float, float* %9
%23 = fpext float %22 to double
%24 = fmul double %23, %21
%25 = fptrunc double %24 to float
store float %25, float* %9
%26 = load double, double* @M_PI
%27 = fdiv double 1.800000e+02, %26
%28 = load float, float* %10
%29 = fpext float %28 to double
%30 = fmul double %29, %27
%31 = fptrunc double %30 to float
store float %31, float* %10
%32 = load float, float* %8
%33 = fpext float %32 to double
%34 = load double, double* @M_PI
%35 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %34, double %33)
%36 = fptrunc double %35 to float
%37 = load float, float* %7
%38 = call i32 @spherical2Cartesian(i32 1, float %36, float %37, double* %14, double* %15, double* %16)
%39 = load float, float* %9
%40 = call i32 @rotateZ_d(i32 1, float %39, double* %14, double* %15, double* %16)
%41 = load float, float* %10
%42 = fneg float %41
%43 = call i32 @rotateY_d(i32 1, float %42, double* %14, double* %15, double* %16)
%44 = load double, double* %14
%45 = load double, double* %15
%46 = load double, double* %16
%47 = call i32 @cartesian2spherical(double* %19, double* %17, double* %18, double %44, double %45, double %46)
%48 = load double, double* %17
%49 = load double, double* @M_PI
%50 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %49, double %48)
%51 = fptrunc double %50 to float
store float %51, float* %8
%52 = load double, double* %18
%53 = fptrunc double %52 to float
store float %53, float* %7
%54 = load float, float* %8
%55 = call float @cos(float %54)
%56 = load float, float* %7
%57 = fpext float %56 to double
%58 = fmul double 5.000000e-01, %57
%59 = fptrunc double %58 to float
%60 = call float @cos(float %59)
%61 = fmul float %55, %60
%62 = fpext float %61 to double
%63 = fadd double 1.000000e+00, %62
%64 = fptosi double %63 to i32
%65 = call double @sqrt(i32 %64)
%66 = fdiv double 1.000000e+00, %65
%67 = fptrunc double %66 to float
store float %67, float* %13
%68 = load float, float* %13
%69 = fpext float %68 to double
%70 = fmul double %69, 2.000000e+00
%71 = call double @sqrt(i32 2)
%72 = fmul double %70, %71
%73 = load float, float* %8
%74 = call float @cos(float %73)
%75 = fpext float %74 to double
%76 = fmul double %72, %75
%77 = load float, float* %7
%78 = fpext float %77 to double
%79 = fmul double 5.000000e-01, %78
%80 = fptrunc double %79 to float
%81 = call float @sin(float %80)
%82 = fpext float %81 to double
%83 = fmul double %76, %82
%84 = fptrunc double %83 to float
%85 = load float*, float** %11
store float %84, float* %85
%86 = call double @sqrt(i32 2)
%87 = load float, float* %8
%88 = call float @sin(float %87)
%89 = fpext float %88 to double
%90 = fmul double %86, %89
%91 = load float, float* %13
%92 = fpext float %91 to double
%93 = fmul double %90, %92
%94 = fptrunc double %93 to float
%95 = load float*, float** %12
store float %94, float* %95
%96 = call double @sqrt(i32 2)
%97 = fmul double 5.000000e-01, %96
%98 = load float*, float** %11
%99 = load float, float* %98
%100 = fpext float %99 to double
%101 = fmul double %100, %97
%102 = fptrunc double %101 to float
store float %102, float* %98
%103 = call double @sqrt(i32 2)
%104 = fmul double 5.000000e-01, %103
%105 = load float*, float** %12
%106 = load float, float* %105
%107 = fpext float %106 to double
%108 = fmul double %107, %104
%109 = fptrunc double %108 to float
store float %109, float* %105
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @projectionHammerAitoff_xy(float %0, float %1, float %2, float %3, float* nocapture %4, float* nocapture %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = bitcast double* %7 to i8*
%14 = bitcast double* %8 to i8*
%15 = bitcast double* %9 to i8*
%16 = bitcast double* %10 to i8*
%17 = bitcast double* %11 to i8*
%18 = bitcast double* %12 to i8*
%19 = load double, double* @M_PI
%20 = fdiv double 1.800000e+02, %19
%21 = fpext float %2 to double
%22 = fmul double %20, %21
%23 = fptrunc double %22 to float
%24 = fpext float %3 to double
%25 = fmul double %20, %24
%26 = fptrunc double %25 to float
%27 = fpext float %1 to double
%28 = tail call double @llvm.fmuladd.f64(double %19, double 5.000000e-01, double %27)
%29 = fptrunc double %28 to float
%30 = call i32 @spherical2Cartesian(i32 1, float %29, float %0, double* %7, double* %8, double* %9)
%31 = call i32 @rotateZ_d(i32 1, float %23, double* %7, double* %8, double* %9)
%32 = fneg float %26
%33 = call i32 @rotateY_d(i32 1, float %32, double* %7, double* %8, double* %9)
%34 = load double, double* %7
%35 = load double, double* %8
%36 = load double, double* %9
%37 = call i32 @cartesian2spherical(double* %12, double* %10, double* %11, double %34, double %35, double %36)
%38 = load double, double* %10
%39 = load double, double* @M_PI
%40 = call double @llvm.fmuladd.f64(double %39, double -5.000000e-01, double %38)
%41 = fptrunc double %40 to float
%42 = load double, double* %11
%43 = fptrunc double %42 to float
%44 = call float @cos(float %41)
%45 = fmul float %43, 5.000000e-01
%46 = call float @cos(float %45)
%47 = fmul float %44, %46
%48 = fpext float %47 to double
%49 = fadd double %48, 1.000000e+00
%50 = fptosi double %49 to i32
%51 = call double @sqrt(i32 %50)
%52 = fdiv double 1.000000e+00, %51
%53 = fptrunc double %52 to float
%54 = fpext float %53 to double
%55 = fmul double %54, 2.000000e+00
%56 = call double @sqrt(i32 2)
%57 = fmul double %56, %55
%58 = call float @cos(float %41)
%59 = fpext float %58 to double
%60 = fmul double %57, %59
%61 = call float @sin(float %45)
%62 = fpext float %61 to double
%63 = fmul double %60, %62
%64 = fptrunc double %63 to float
store float %64, float* %4
%65 = call double @sqrt(i32 2)
%66 = call float @sin(float %41)
%67 = fpext float %66 to double
%68 = fmul double %65, %67
%69 = fmul double %68, %54
%70 = fptrunc double %69 to float
store float %70, float* %5
%71 = call double @sqrt(i32 2)
%72 = fmul double %71, 5.000000e-01
%73 = load float, float* %4
%74 = fpext float %73 to double
%75 = fmul double %72, %74
%76 = fptrunc double %75 to float
store float %76, float* %4
%77 = call double @sqrt(i32 2)
%78 = fmul double %77, 5.000000e-01
%79 = load float, float* %5
%80 = fpext float %79 to double
%81 = fmul double %78, %80
%82 = fptrunc double %81 to float
store float %82, float* %5
ret void
}