#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 cos(double);
double sin(double);
double StartTangent(double ang) {
  double tangent = ang + 1.5707963267948965580E0;
  if (ang == 0.0) {
    while ((cos(tangent) > 0.0) || (sin(tangent) >= 0.0))
      tangent += 1.5707963267948965580E0;
  } else if ((ang > 0.0) && (ang <= 1.5707963267948965580E0)) {
    while ((cos(tangent) < 0.0) || (sin(tangent) > 0.0))
      tangent += 1.5707963267948965580E0;
  } else if ((ang > 1.5707963267948965580E0) &&
             (ang <= 3.1415926535897931160E0)) {
    while ((cos(tangent) < 0.0) || (sin(tangent) < 0.0))
      tangent += 1.5707963267948965580E0;
  } else if ((ang > 3.1415926535897931160E0) &&
             (ang <= 3.0 * 1.5707963267948965580E0)) {
    while ((cos(tangent) >= 0.0) || (sin(tangent) < 0.0))
      tangent += 1.5707963267948965580E0;
  } else if ((ang > 3.0 * 1.5707963267948965580E0) &&
             (ang <= 2.0 * 3.1415926535897931160E0)) {
    while ((cos(tangent) > 0.0) || (sin(tangent) >= 0.0))
      tangent += 1.5707963267948965580E0;
  }
  return tangent;
}


x86 assembly (clang, -O0):
<StartTangent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xecb(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11bb <StartTangent+0x9b>
jp     11bb <StartTangent+0x9b>
jmp    115c <StartTangent+0x3c>
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
mov    $0x1,%al
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
ja     118f <StartTangent+0x6f>
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    119f <StartTangent+0x7f>
jmp    11b6 <StartTangent+0x96>
movsd  0xe59(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    115c <StartTangent+0x3c>
jmp    140e <StartTangent+0x2ee>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1247 <StartTangent+0x127>
movsd  0xe2b(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     1247 <StartTangent+0x127>
jmp    11e5 <StartTangent+0xc5>
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x12(%rbp)
ja     121b <StartTangent+0xfb>
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    122b <StartTangent+0x10b>
jmp    1242 <StartTangent+0x122>
movsd  0xdcd(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e5 <StartTangent+0xc5>
jmp    1409 <StartTangent+0x2e9>
movsd  -0x8(%rbp),%xmm0
movsd  0xdac(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12db <StartTangent+0x1bb>
movsd  0xda2(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     12db <StartTangent+0x1bb>
jmp    1276 <StartTangent+0x156>
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x13(%rbp)
ja     12af <StartTangent+0x18f>
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x13(%rbp)
mov    -0x13(%rbp),%al
test   $0x1,%al
jne    12bf <StartTangent+0x19f>
jmp    12d6 <StartTangent+0x1b6>
movsd  0xd39(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1276 <StartTangent+0x156>
jmp    1404 <StartTangent+0x2e4>
movsd  -0x8(%rbp),%xmm0
movsd  0xd20(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    136c <StartTangent+0x24c>
movsd  0xd16(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     136c <StartTangent+0x24c>
jmp    130a <StartTangent+0x1ea>
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
mov    $0x1,%al
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x14(%rbp)
jae    1340 <StartTangent+0x220>
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x14(%rbp)
mov    -0x14(%rbp),%al
test   $0x1,%al
jne    1350 <StartTangent+0x230>
jmp    1367 <StartTangent+0x247>
movsd  0xca8(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    130a <StartTangent+0x1ea>
jmp    13ff <StartTangent+0x2df>
movsd  -0x8(%rbp),%xmm0
movsd  0xc97(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13fa <StartTangent+0x2da>
movsd  0xc8d(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     13fa <StartTangent+0x2da>
jmp    139b <StartTangent+0x27b>
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
mov    $0x1,%al
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x15(%rbp)
ja     13ce <StartTangent+0x2ae>
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    13de <StartTangent+0x2be>
jmp    13f5 <StartTangent+0x2d5>
movsd  0xc1a(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    139b <StartTangent+0x27b>
jmp    13fa <StartTangent+0x2da>
jmp    13ff <StartTangent+0x2df>
jmp    1404 <StartTangent+0x2e4>
jmp    1409 <StartTangent+0x2e9>
jmp    140e <StartTangent+0x2ee>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StartTangent>:
push   %rax
movsd  0xed7(%rip),%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    113d <StartTangent+0x1d>
jnp    11bd <StartTangent+0x9d>
jbe    1151 <StartTangent+0x31>
movsd  0xeb9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11fd <StartTangent+0xdd>
ucomisd 0xea7(%rip),%xmm0
jbe    116d <StartTangent+0x4d>
movsd  0xea5(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123d <StartTangent+0x11d>
ucomisd 0xe93(%rip),%xmm0
jbe    1189 <StartTangent+0x69>
movsd  0xe91(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    127d <StartTangent+0x15d>
ucomisd 0xe7f(%rip),%xmm0
jbe    12ee <StartTangent+0x1ce>
movsd  0xe79(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    12bd <StartTangent+0x19d>
jmp    12ee <StartTangent+0x1ce>
xchg   %ax,%ax
movsd  (%rsp),%xmm2
addsd  0xe43(%rip),%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm0
call   1040 <cos@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     11b0 <StartTangent+0x90>
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    11b0 <StartTangent+0x90>
jmp    12e9 <StartTangent+0x1c9>
xchg   %ax,%ax
movsd  (%rsp),%xmm2
addsd  0xe03(%rip),%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm0
call   1040 <cos@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     11f0 <StartTangent+0xd0>
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
ucomisd 0xdf9(%rip),%xmm0
ja     11f0 <StartTangent+0xd0>
jmp    12e9 <StartTangent+0x1c9>
xchg   %ax,%ax
movsd  (%rsp),%xmm2
addsd  0xdc3(%rip),%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm0
call   1040 <cos@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1230 <StartTangent+0x110>
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1230 <StartTangent+0x110>
jmp    12e9 <StartTangent+0x1c9>
nopl   0x0(%rax,%rax,1)
movsd  (%rsp),%xmm2
addsd  0xd83(%rip),%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm0
call   1040 <cos@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    1270 <StartTangent+0x150>
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1270 <StartTangent+0x150>
jmp    12e9 <StartTangent+0x1c9>
nopl   0x0(%rax,%rax,1)
movsd  (%rsp),%xmm2
addsd  0xd43(%rip),%xmm2
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm0
call   1040 <cos@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     12b0 <StartTangent+0x190>
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
ucomisd 0xd39(%rip),%xmm0
jae    12b0 <StartTangent+0x190>
movsd  (%rsp),%xmm2
movapd %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @StartTangent(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fadd double %4, 0x3FF921FB54442D18
store double %5, double* %3
%6 = load double, double* %2
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %23
8: ; preds = %1
br label %9
9: ; preds = %19, %8
%10 = load double, double* %3
%11 = call double @cos(double %10)
%12 = fcmp ogt double %11, 0.000000e+00
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load double, double* %3
%15 = call double @sin(double %14)
%16 = fcmp oge double %15, 0.000000e+00
br label %17
17: ; preds = %13, %9
%18 = phi i1 [ true, %9 ], [ %16, %13 ]
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = load double, double* %3
%21 = fadd double %20, 0x3FF921FB54442D18
store double %21, double* %3
br label %9
22: ; preds = %17
br label %111
23: ; preds = %1
%24 = load double, double* %2
%25 = fcmp ogt double %24, 0.000000e+00
br i1 %25, label %26, label %44
26: ; preds = %23
%27 = load double, double* %2
%28 = fcmp ole double %27, 0x3FF921FB54442D18
br i1 %28, label %29, label %44
29: ; preds = %26
br label %30
30: ; preds = %40, %29
%31 = load double, double* %3
%32 = call double @cos(double %31)
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load double, double* %3
%36 = call double @sin(double %35)
%37 = fcmp ogt double %36, 0.000000e+00
br label %38
38: ; preds = %34, %30
%39 = phi i1 [ true, %30 ], [ %37, %34 ]
br i1 %39, label %40, label %43
40: ; preds = %38
%41 = load double, double* %3
%42 = fadd double %41, 0x3FF921FB54442D18
store double %42, double* %3
br label %30
43: ; preds = %38
br label %110
44: ; preds = %26, %23
%45 = load double, double* %2
%46 = fcmp ogt double %45, 0x3FF921FB54442D18
br i1 %46, label %47, label %65
47: ; preds = %44
%48 = load double, double* %2
%49 = fcmp ole double %48, 0x400921FB54442D18
br i1 %49, label %50, label %65
50: ; preds = %47
br label %51
51: ; preds = %61, %50
%52 = load double, double* %3
%53 = call double @cos(double %52)
%54 = fcmp olt double %53, 0.000000e+00
br i1 %54, label %59, label %55
55: ; preds = %51
%56 = load double, double* %3
%57 = call double @sin(double %56)
%58 = fcmp olt double %57, 0.000000e+00
br label %59
59: ; preds = %55, %51
%60 = phi i1 [ true, %51 ], [ %58, %55 ]
br i1 %60, label %61, label %64
61: ; preds = %59
%62 = load double, double* %3
%63 = fadd double %62, 0x3FF921FB54442D18
store double %63, double* %3
br label %51
64: ; preds = %59
br label %109
65: ; preds = %47, %44
%66 = load double, double* %2
%67 = fcmp ogt double %66, 0x400921FB54442D18
br i1 %67, label %68, label %86
68: ; preds = %65
%69 = load double, double* %2
%70 = fcmp ole double %69, 0x4012D97C7F3321D2
br i1 %70, label %71, label %86
71: ; preds = %68
br label %72
72: ; preds = %82, %71
%73 = load double, double* %3
%74 = call double @cos(double %73)
%75 = fcmp oge double %74, 0.000000e+00
br i1 %75, label %80, label %76
76: ; preds = %72
%77 = load double, double* %3
%78 = call double @sin(double %77)
%79 = fcmp olt double %78, 0.000000e+00
br label %80
80: ; preds = %76, %72
%81 = phi i1 [ true, %72 ], [ %79, %76 ]
br i1 %81, label %82, label %85
82: ; preds = %80
%83 = load double, double* %3
%84 = fadd double %83, 0x3FF921FB54442D18
store double %84, double* %3
br label %72
85: ; preds = %80
br label %108
86: ; preds = %68, %65
%87 = load double, double* %2
%88 = fcmp ogt double %87, 0x4012D97C7F3321D2
br i1 %88, label %89, label %107
89: ; preds = %86
%90 = load double, double* %2
%91 = fcmp ole double %90, 0x401921FB54442D18
br i1 %91, label %92, label %107
92: ; preds = %89
br label %93
93: ; preds = %103, %92
%94 = load double, double* %3
%95 = call double @cos(double %94)
%96 = fcmp ogt double %95, 0.000000e+00
br i1 %96, label %101, label %97
97: ; preds = %93
%98 = load double, double* %3
%99 = call double @sin(double %98)
%100 = fcmp oge double %99, 0.000000e+00
br label %101
101: ; preds = %97, %93
%102 = phi i1 [ true, %93 ], [ %100, %97 ]
br i1 %102, label %103, label %106
103: ; preds = %101
%104 = load double, double* %3
%105 = fadd double %104, 0x3FF921FB54442D18
store double %105, double* %3
br label %93
106: ; preds = %101
br label %107
107: ; preds = %106, %89, %86
br label %108
108: ; preds = %107, %85
br label %109
109: ; preds = %108, %64
br label %110
110: ; preds = %109, %43
br label %111
111: ; preds = %110, %22
%112 = load double, double* %3
ret double %112
}

LLVM IR (-O2):
define double @StartTangent(double %0) {
%2 = fadd double %0, 0x3FF921FB54442D18
%3 = fcmp oeq double %0, 0.000000e+00
br i1 %3, label %4, label %13
4: ; preds = %1, %11
%5 = phi double [ %12, %11 ], [ %2, %1 ]
%6 = tail call double @cos(double %5)
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = tail call double @sin(double %5)
%10 = fcmp ult double %9, 0.000000e+00
br i1 %10, label %65, label %11
11: ; preds = %4, %8
%12 = fadd double %5, 0x3FF921FB54442D18
br label %4
13: ; preds = %1
%14 = fcmp ogt double %0, 0.000000e+00
%15 = fcmp ole double %0, 0x3FF921FB54442D18
%16 = and i1 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %13, %24
%18 = phi double [ %25, %24 ], [ %2, %13 ]
%19 = tail call double @cos(double %18)
%20 = fcmp olt double %19, 0.000000e+00
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = tail call double @sin(double %18)
%23 = fcmp ogt double %22, 0.000000e+00
br i1 %23, label %24, label %65
24: ; preds = %17, %21
%25 = fadd double %18, 0x3FF921FB54442D18
br label %17
26: ; preds = %13
%27 = fcmp ogt double %0, 0x3FF921FB54442D18
%28 = fcmp ole double %0, 0x400921FB54442D18
%29 = and i1 %27, %28
br i1 %29, label %30, label %39
30: ; preds = %26, %37
%31 = phi double [ %38, %37 ], [ %2, %26 ]
%32 = tail call double @cos(double %31)
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %37, label %34
34: ; preds = %30
%35 = tail call double @sin(double %31)
%36 = fcmp olt double %35, 0.000000e+00
br i1 %36, label %37, label %65
37: ; preds = %30, %34
%38 = fadd double %31, 0x3FF921FB54442D18
br label %30
39: ; preds = %26
%40 = fcmp ogt double %0, 0x400921FB54442D18
%41 = fcmp ole double %0, 0x4012D97C7F3321D2
%42 = and i1 %40, %41
br i1 %42, label %43, label %52
43: ; preds = %39, %50
%44 = phi double [ %51, %50 ], [ %2, %39 ]
%45 = tail call double @cos(double %44)
%46 = fcmp ult double %45, 0.000000e+00
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = tail call double @sin(double %44)
%49 = fcmp olt double %48, 0.000000e+00
br i1 %49, label %50, label %65
50: ; preds = %43, %47
%51 = fadd double %44, 0x3FF921FB54442D18
br label %43
52: ; preds = %39
%53 = fcmp ogt double %0, 0x4012D97C7F3321D2
%54 = fcmp ole double %0, 0x401921FB54442D18
%55 = and i1 %53, %54
br i1 %55, label %56, label %65
56: ; preds = %52, %63
%57 = phi double [ %64, %63 ], [ %2, %52 ]
%58 = tail call double @cos(double %57)
%59 = fcmp ogt double %58, 0.000000e+00
br i1 %59, label %63, label %60
60: ; preds = %56
%61 = tail call double @sin(double %57)
%62 = fcmp ult double %61, 0.000000e+00
br i1 %62, label %65, label %63
63: ; preds = %56, %60
%64 = fadd double %57, 0x3FF921FB54442D18
br label %56
65: ; preds = %60, %47, %34, %21, %8, %52
%66 = phi double [ %2, %52 ], [ %5, %8 ], [ %18, %21 ], [ %31, %34 ], [ %44, %47 ], [ %57, %60 ]
ret double %66
}