#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 fabs(double);
double tan(double);
int pie_intercept(double width, double height, double xcen, double ycen,
                  double angle, double *xcept, double *ycept) {
  double angl, slope;
  angl = angle;
  while (angl < 0.0)
    angl = angl + 360.0;
  while (angl >= 360.0)
    angl = angl - 360.0;
  if (fabs(angl - 180.0) < 1.0E-24) {
    *xcept = 0.0;
    *ycept = ycen;
    return (2);
  }
  if (fabs(angl - 0.0) < 1.0E-24) {
    *xcept = width + 1;
    *ycept = ycen;
    return (4);
  }
  if (angl >= 360.0)
    angl = angl - 360.0;
  if (angl < 180.0) {
    *ycept = height + 1;
    if (fabs(angl - 90.0) < 1.0E-24) {
      *xcept = xcen;
      return (1);
    }
  } else {
    *ycept = 0.0;
    if (fabs(angl - 270.0) < 1.0E-24) {
      *xcept = xcen;
      return (3);
    }
  }
  angl = (angl / 180.0) * 3.14159265358979323846;
  slope = tan(angl);
  *xcept = xcen + ((*ycept - ycen) / slope);
  if (*xcept < 0) {
    *ycept = (ycen - (xcen * slope));
    *xcept = 0.0;
    return (2);
  } else if (*xcept > (width + 1)) {
    *ycept = (ycen + ((width + 1 - xcen) * slope));
    *xcept = width + 1;
    return (4);
  } else {
    if (*ycept < height)
      return (3);
    else
      return (1);
  }
}


x86 assembly (clang, -O0):
<pie_intercept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    1168 <pie_intercept+0x58>
movsd  0xea7(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1143 <pie_intercept+0x33>
jmp    116d <pie_intercept+0x5d>
movsd  -0x48(%rbp),%xmm0
movsd  0xe86(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     119f <pie_intercept+0x8f>
movsd  -0x48(%rbp),%xmm0
movsd  0xe6f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    116d <pie_intercept+0x5d>
movsd  -0x48(%rbp),%xmm1
movsd  0xe64(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xe89(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe45(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f1 <pie_intercept+0xe1>
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x2,-0x4(%rbp)
jmp    1488 <pie_intercept+0x378>
movsd  -0x48(%rbp),%xmm1
xorps  %xmm0,%xmm0
subsd  %xmm0,%xmm1
movaps 0xe3c(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdf8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1248 <pie_intercept+0x138>
movsd  0xe06(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x4,-0x4(%rbp)
jmp    1488 <pie_intercept+0x378>
movsd  -0x48(%rbp),%xmm0
movsd  0xdab(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1275 <pie_intercept+0x165>
movsd  -0x48(%rbp),%xmm0
movsd  0xd94(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd93(%rip),%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    12e9 <pie_intercept+0x1d9>
movsd  0xd98(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm1
movsd  0xd76(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xd8b(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd47(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12e4 <pie_intercept+0x1d4>
movsd  -0x20(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1488 <pie_intercept+0x378>
jmp    1340 <pie_intercept+0x230>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm1
movsd  0xd17(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xd34(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xcf0(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    133b <pie_intercept+0x22b>
movsd  -0x20(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x3,-0x4(%rbp)
jmp    1488 <pie_intercept+0x378>
jmp    1340 <pie_intercept+0x230>
movsd  -0x48(%rbp),%xmm0
movsd  0xcc3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xcd7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1030 <tan@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
subsd  -0x28(%rbp),%xmm1
divsd  -0x50(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    13f2 <pie_intercept+0x2e2>
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x2,-0x4(%rbp)
jmp    1488 <pie_intercept+0x378>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xc26(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    145e <pie_intercept+0x34e>
movsd  -0x28(%rbp),%xmm1
movsd  0xc0a(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xbe3(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x4,-0x4(%rbp)
jmp    1488 <pie_intercept+0x378>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1481 <pie_intercept+0x371>
movl   $0x3,-0x4(%rbp)
jmp    1488 <pie_intercept+0x378>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pie_intercept>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
xorpd  %xmm5,%xmm5
ucomisd %xmm4,%xmm5
jbe    113a <pie_intercept+0x2a>
movsd  0xed1(%rip),%xmm6
nop
addsd  %xmm6,%xmm4
ucomisd %xmm4,%xmm5
ja     1130 <pie_intercept+0x20>
ucomisd 0xebe(%rip),%xmm4
jb     116a <pie_intercept+0x5a>
movsd  0xebc(%rip),%xmm5
movsd  0xeac(%rip),%xmm6
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addsd  %xmm5,%xmm4
ucomisd %xmm6,%xmm4
jae    1160 <pie_intercept+0x50>
movsd  0xe9e(%rip),%xmm6
addsd  %xmm4,%xmm6
andpd  0xed2(%rip),%xmm6
movsd  0xe92(%rip),%xmm5
ucomisd %xmm6,%xmm5
jbe    119e <pie_intercept+0x8e>
movq   $0x0,(%r14)
movsd  %xmm3,(%rbx)
mov    $0x2,%eax
jmp    11c6 <pie_intercept+0xb6>
movapd 0xeaa(%rip),%xmm6
andpd  %xmm4,%xmm6
ucomisd %xmm6,%xmm5
jbe    11ce <pie_intercept+0xbe>
addsd  0xe78(%rip),%xmm0
movsd  %xmm0,(%r14)
movsd  %xmm3,(%rbx)
mov    $0x4,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
movsd  0xe4a(%rip),%xmm6
ucomisd %xmm4,%xmm6
jbe    1212 <pie_intercept+0x102>
movsd  0xe4c(%rip),%xmm6
addsd  %xmm1,%xmm6
movsd  %xmm6,(%rbx)
movsd  0xe44(%rip),%xmm6
addsd  %xmm4,%xmm6
andpd  0xe50(%rip),%xmm6
ucomisd %xmm6,%xmm5
jbe    123f <pie_intercept+0x12f>
movsd  %xmm2,(%r14)
mov    $0x1,%eax
jmp    11c6 <pie_intercept+0xb6>
movq   $0x0,(%rbx)
movsd  0xe07(%rip),%xmm6
addsd  %xmm4,%xmm6
andpd  0xe23(%rip),%xmm6
ucomisd %xmm6,%xmm5
jbe    123f <pie_intercept+0x12f>
movsd  %xmm2,(%r14)
mov    $0x3,%eax
jmp    11c6 <pie_intercept+0xb6>
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
divsd  0xdcd(%rip),%xmm4
mulsd  0xde5(%rip),%xmm4
movapd %xmm4,%xmm0
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
call   1030 <tan@plt>
movsd  0x18(%rsp),%xmm4
movsd  0x20(%rsp),%xmm3
movsd  (%rbx),%xmm1
subsd  %xmm3,%xmm1
divsd  %xmm0,%xmm1
addsd  %xmm4,%xmm1
movsd  %xmm1,(%r14)
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    12b8 <pie_intercept+0x1a8>
mulsd  %xmm0,%xmm4
subsd  %xmm4,%xmm3
movsd  %xmm3,(%rbx)
movq   $0x0,(%r14)
mov    $0x2,%eax
jmp    11c6 <pie_intercept+0xb6>
movsd  0x10(%rsp),%xmm2
addsd  0xd6a(%rip),%xmm2
ucomisd %xmm2,%xmm1
jbe    12ea <pie_intercept+0x1da>
movapd %xmm2,%xmm1
subsd  %xmm4,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm3,%xmm1
movsd  %xmm1,(%rbx)
movsd  %xmm2,(%r14)
jmp    11c1 <pie_intercept+0xb1>
xor    %eax,%eax
movsd  0x8(%rsp),%xmm0
ucomisd (%rbx),%xmm0
seta   %al
add    %eax,%eax
add    $0x1,%eax
jmp    11c6 <pie_intercept+0xb6>

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

LLVM IR (-O2):
define i32 @pie_intercept(double %0, double %1, double %2, double %3, double %4, double* nocapture writeonly %5, double* nocapture %6) {
%8 = fcmp olt double %4, 0.000000e+00
br i1 %8, label %12, label %9
9: ; preds = %12, %7
%10 = phi double [ %4, %7 ], [ %14, %12 ]
%11 = fcmp ult double %10, 3.600000e+02
br i1 %11, label %20, label %16
12: ; preds = %7, %12
%13 = phi double [ %14, %12 ], [ %4, %7 ]
%14 = fadd double %13, 3.600000e+02
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %12, label %9
16: ; preds = %9, %16
%17 = phi double [ %18, %16 ], [ %10, %9 ]
%18 = fadd double %17, -3.600000e+02
%19 = fcmp ult double %18, 3.600000e+02
br i1 %19, label %20, label %16
20: ; preds = %16, %9
%21 = phi double [ %10, %9 ], [ %18, %16 ]
%22 = fadd double %21, -1.800000e+02
%23 = tail call double @llvm.fabs.f64(double %22)
%24 = fcmp olt double %23, 0x3AF357C299A88EA7
br i1 %24, label %25, label %26
25: ; preds = %20
store double 0.000000e+00, double* %5
store double %3, double* %6
br label %66
26: ; preds = %20
%27 = tail call double @llvm.fabs.f64(double %21)
%28 = fcmp olt double %27, 0x3AF357C299A88EA7
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = fadd double %0, 1.000000e+00
store double %30, double* %5
store double %3, double* %6
br label %66
31: ; preds = %26
%32 = fcmp olt double %21, 1.800000e+02
br i1 %32, label %33, label %39
33: ; preds = %31
%34 = fadd double %1, 1.000000e+00
store double %34, double* %6
%35 = fadd double %21, -9.000000e+01
%36 = tail call double @llvm.fabs.f64(double %35)
%37 = fcmp olt double %36, 0x3AF357C299A88EA7
br i1 %37, label %38, label %44
38: ; preds = %33
store double %2, double* %5
br label %66
39: ; preds = %31
store double 0.000000e+00, double* %6
%40 = fadd double %21, -2.700000e+02
%41 = tail call double @llvm.fabs.f64(double %40)
%42 = fcmp olt double %41, 0x3AF357C299A88EA7
br i1 %42, label %43, label %44
43: ; preds = %39
store double %2, double* %5
br label %66
44: ; preds = %39, %33
%45 = fdiv double %21, 1.800000e+02
%46 = fmul double %45, 0x400921FB54442D18
%47 = tail call double @tan(double %46)
%48 = load double, double* %6
%49 = fsub double %48, %3
%50 = fdiv double %49, %47
%51 = fadd double %50, %2
store double %51, double* %5
%52 = fcmp olt double %51, 0.000000e+00
br i1 %52, label %53, label %56
53: ; preds = %44
%54 = fneg double %2
%55 = tail call double @llvm.fmuladd.f64(double %54, double %47, double %3)
store double %55, double* %6
store double 0.000000e+00, double* %5
br label %66
56: ; preds = %44
%57 = fadd double %0, 1.000000e+00
%58 = fcmp ogt double %51, %57
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = fsub double %57, %2
%61 = tail call double @llvm.fmuladd.f64(double %60, double %47, double %3)
store double %61, double* %6
store double %57, double* %5
br label %66
62: ; preds = %56
%63 = load double, double* %6
%64 = fcmp olt double %63, %1
%65 = select i1 %64, i32 3, i32 1
br label %66
66: ; preds = %62, %59, %53, %43, %38, %29, %25
%67 = phi i32 [ 2, %25 ], [ 4, %29 ], [ 1, %38 ], [ 2, %53 ], [ 4, %59 ], [ 3, %43 ], [ %65, %62 ]
ret i32 %67
}