#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;
double atan2(double, double);
double cos(double);
double derotate_180_double(double);
double sin(double);
double paswing_double(double alpha, double beta, double l, double pa0,
                      double l0, int nrJumps, double *jump_longitude,
                      double *jump_offset, double add_height_longitude,
                      double add_height_shift, int add_height_shift_bcw_only) {
  double x1, y1, sa, dl, pa, dbcw, dha;
  int i;
  alpha *= M_PI / 180.0;
  beta *= M_PI / 180.0;
  if (l >= add_height_longitude) {
    dbcw = 2.0 * add_height_shift * 180.0 / M_PI;
    if (add_height_shift_bcw_only == 0) {
      dha = 10.0 * add_height_shift * cos(alpha) * 180.0 / (3.0 * M_PI);
    } else {
      dha = 0;
    }
  } else {
    dbcw = 0;
    dha = 0;
  }
  sa = sin(alpha);
  dl = (l - (l0 + dbcw)) * M_PI / 180.0;
  y1 = sa * sin(dl);
  x1 = sin(alpha + beta) * cos(alpha);
  x1 -= cos(alpha + beta) * sa * cos(dl);
  pa = pa0 + dha + atan2(y1, x1) * 180.0 / M_PI;
  if (nrJumps > 0) {
    for (i = 0; i < nrJumps; i++)
      if (l > jump_longitude[i])
        pa += jump_offset[i];
  }
  pa = derotate_180_double(pa);
  return pa;
}


x86 assembly (clang, -O0):
<paswing_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %edi,-0x2c(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
movsd  %xmm5,-0x48(%rbp)
movsd  %xmm6,-0x50(%rbp)
mov    %ecx,-0x54(%rbp)
mov    0x2e65(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe71(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    0x2e44(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe50(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     1272 <paswing_double+0x132>
movsd  0xe32(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2dfa(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
cmpl   $0x0,-0x54(%rbp)
jne    1262 <paswing_double+0x122>
movsd  0xe0c(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  0xdc6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdca(%rip),%xmm1
mov    0x2d9b(%rip),%rax
mulsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    126d <paswing_double+0x12d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    1288 <paswing_double+0x148>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  -0x88(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
mov    0x2d34(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xd40(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1050 <sin@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1060 <cos@plt>
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0xb0(%rbp),%xmm0
ff
movsd  -0x60(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
call   1040 <atan2@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
movsd  0xc46(%rip),%xmm2
mulsd  %xmm2,%xmm1
mov    0x2c23(%rip),%rax
divsd  (%rax),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    1448 <paswing_double+0x308>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1443 <paswing_double+0x303>
movsd  -0x18(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x94(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    142a <paswing_double+0x2ea>
mov    -0x40(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    142f <paswing_double+0x2ef>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    13e6 <paswing_double+0x2a6>
jmp    1448 <paswing_double+0x308>
movsd  -0x80(%rbp),%xmm0
call   1030 <derotate_180_double@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paswing_double>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
movapd %xmm0,%xmm8
mov    0x2e8a(%rip),%r15
movsd  (%r15),%xmm0
movapd %xmm0,%xmm7
divsd  0xe91(%rip),%xmm7
mulsd  %xmm7,%xmm8
mulsd  %xmm1,%xmm7
ucomisd %xmm5,%xmm2
movsd  %xmm2,0x20(%rsp)
movsd  %xmm3,0x40(%rsp)
movsd  %xmm7,0x10(%rsp)
movsd  %xmm8,0x28(%rsp)
movsd  %xmm4,0x8(%rsp)
jae    11b2 <paswing_double+0x72>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
jmp    1217 <paswing_double+0xd7>
movapd %xmm6,%xmm1
addsd  %xmm6,%xmm1
mulsd  0xe3e(%rip),%xmm1
divsd  %xmm0,%xmm1
test   %ecx,%ecx
movsd  %xmm1,0x18(%rsp)
je     11d6 <paswing_double+0x96>
xorpd  %xmm0,%xmm0
jmp    1212 <paswing_double+0xd2>
mulsd  0xe2a(%rip),%xmm6
movsd  %xmm6,(%rsp)
movapd %xmm8,%xmm0
call   1060 <cos@plt>
movsd  0x28(%rsp),%xmm8
mulsd  (%rsp),%xmm0
mulsd  0xdff(%rip),%xmm0
movsd  (%r15),%xmm1
mulsd  0xe02(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm8,%xmm0
call   1050 <sin@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x18(%rsp),%xmm1
addsd  0x8(%rsp),%xmm1
movsd  0x20(%rsp),%xmm0
subsd  %xmm1,%xmm0
mulsd  (%r15),%xmm0
divsd  0xdb6(%rip),%xmm0
movsd  %xmm0,0x38(%rsp)
call   1050 <sin@plt>
mulsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x28(%rsp),%xmm0
call   1060 <cos@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x38(%rsp),%xmm0
call   1060 <cos@plt>
movsd  0x10(%rsp),%xmm1
mulsd  0x30(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <atan2@plt>
mulsd  0xd0a(%rip),%xmm0
divsd  (%r15),%xmm0
addsd  (%rsp),%xmm0
test   %ebp,%ebp
jle    1324 <paswing_double+0x1e4>
mov    %ebp,%eax
cmp    $0x1,%ebp
jne    1333 <paswing_double+0x1f3>
xor    %ecx,%ecx
movsd  0x20(%rsp),%xmm1
test   $0x1,%al
je     1324 <paswing_double+0x1e4>
ucomisd (%rbx,%rcx,8),%xmm1
jbe    1324 <paswing_double+0x1e4>
addsd  (%r14,%rcx,8),%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <derotate_180_double@plt>
mov    %eax,%edx
and    $0xfffffffe,%edx
xor    %ecx,%ecx
movsd  0x20(%rsp),%xmm1
jmp    1359 <paswing_double+0x219>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x2,%rcx
cmp    %rcx,%rdx
je     1313 <paswing_double+0x1d3>
ucomisd (%rbx,%rcx,8),%xmm1
jbe    1366 <paswing_double+0x226>
addsd  (%r14,%rcx,8),%xmm0
ucomisd 0x8(%rbx,%rcx,8),%xmm1
jbe    1350 <paswing_double+0x210>
addsd  0x8(%r14,%rcx,8),%xmm0
jmp    1350 <paswing_double+0x210>

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @paswing_double(double %0, double %1, double %2, double %3, double %4, i32 %5, double* nocapture %6, double* nocapture %7, double %8, double %9, i32 %10) {
%12 = load double, double* @M_PI
%13 = fdiv double %12, 1.800000e+02
%14 = fmul double %13, %0
%15 = fmul double %13, %1
%16 = fcmp ult double %2, %8
br i1 %16, label %30, label %17
17: ; preds = %11
%18 = fmul double %9, 2.000000e+00
%19 = fmul double %18, 1.800000e+02
%20 = fdiv double %19, %12
%21 = icmp eq i32 %10, 0
br i1 %21, label %22, label %30
22: ; preds = %17
%23 = fmul double %9, 1.000000e+01
%24 = tail call double @cos(double %14)
%25 = fmul double %23, %24
%26 = fmul double %25, 1.800000e+02
%27 = load double, double* @M_PI
%28 = fmul double %27, 3.000000e+00
%29 = fdiv double %26, %28
br label %30
30: ; preds = %11, %17, %22
%31 = phi double [ %20, %22 ], [ %20, %17 ], [ 0.000000e+00, %11 ]
%32 = phi double [ %29, %22 ], [ 0.000000e+00, %17 ], [ 0.000000e+00, %11 ]
%33 = tail call double @sin(double %14)
%34 = fadd double %31, %4
%35 = fsub double %2, %34
%36 = load double, double* @M_PI
%37 = fmul double %35, %36
%38 = fdiv double %37, 1.800000e+02
%39 = tail call double @sin(double %38)
%40 = fmul double %33, %39
%41 = fadd double %14, %15
%42 = tail call double @sin(double %41)
%43 = tail call double @cos(double %14)
%44 = fmul double %42, %43
%45 = tail call double @cos(double %41)
%46 = tail call double @cos(double %38)
%47 = fneg double %45
%48 = fmul double %33, %47
%49 = tail call double @llvm.fmuladd.f64(double %48, double %46, double %44)
%50 = fadd double %32, %3
%51 = tail call double @atan2(double %40, double %49)
%52 = fmul double %51, 1.800000e+02
%53 = load double, double* @M_PI
%54 = fdiv double %52, %53
%55 = fadd double %50, %54
%56 = icmp sgt i32 %5, 0
br i1 %56, label %57, label %102
57: ; preds = %30
%58 = zext i32 %5 to i64
%59 = and i64 %58, 1
%60 = icmp eq i32 %5, 1
br i1 %60, label %89, label %61
61: ; preds = %57
%62 = and i64 %58, 4294967294
br label %63
63: ; preds = %84, %61
%64 = phi i64 [ 0, %61 ], [ %86, %84 ]
%65 = phi double [ %55, %61 ], [ %85, %84 ]
%66 = phi i64 [ 0, %61 ], [ %87, %84 ]
%67 = getelementptr inbounds double, double* %6, i64 %64
%68 = load double, double* %67
%69 = fcmp olt double %68, %2
br i1 %69, label %70, label %74
70: ; preds = %63
%71 = getelementptr inbounds double, double* %7, i64 %64
%72 = load double, double* %71
%73 = fadd double %65, %72
br label %74
74: ; preds = %63, %70
%75 = phi double [ %73, %70 ], [ %65, %63 ]
%76 = or i64 %64, 1
%77 = getelementptr inbounds double, double* %6, i64 %76
%78 = load double, double* %77
%79 = fcmp olt double %78, %2
br i1 %79, label %80, label %84
80: ; preds = %74
%81 = getelementptr inbounds double, double* %7, i64 %76
%82 = load double, double* %81
%83 = fadd double %75, %82
br label %84
84: ; preds = %80, %74
%85 = phi double [ %83, %80 ], [ %75, %74 ]
%86 = add nuw nsw i64 %64, 2
%87 = add i64 %66, 2
%88 = icmp eq i64 %87, %62
br i1 %88, label %89, label %63
89: ; preds = %84, %57
%90 = phi double [ undef, %57 ], [ %85, %84 ]
%91 = phi i64 [ 0, %57 ], [ %86, %84 ]
%92 = phi double [ %55, %57 ], [ %85, %84 ]
%93 = icmp eq i64 %59, 0
br i1 %93, label %102, label %94
94: ; preds = %89
%95 = getelementptr inbounds double, double* %6, i64 %91
%96 = load double, double* %95
%97 = fcmp olt double %96, %2
br i1 %97, label %98, label %102
98: ; preds = %94
%99 = getelementptr inbounds double, double* %7, i64 %91
%100 = load double, double* %99
%101 = fadd double %92, %100
br label %102
102: ; preds = %89, %98, %94, %30
%103 = phi double [ %55, %30 ], [ %90, %89 ], [ %101, %98 ], [ %92, %94 ]
%104 = tail call double @derotate_180_double(double %103)
ret double %104
}