#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 istanpt(double, double, double, double, double, double, double, double,
            double, double);
double twointpts(double *, double *, double, double, double, double, double,
                 double, double, double, double, double, double, double, double,
                 double, int *);
double threeintpts(double xint[], double yint[], double A1, double B1,
                   double PHI_1, double A2, double B2, double H2_TR,
                   double K2_TR, double PHI_2, double AA, double BB, double CC,
                   double DD, double EE, double FF, int *rtnCode) {
  int i, tanpts, tanindex, fnRtn;
  double OverlapArea;
  tanpts = 0;
  for (i = 1; i <= 3; i++) {
    fnRtn = istanpt(xint[i], yint[i], A1, B1, AA, BB, CC, DD, EE, FF);
    if (fnRtn == 114) {
      tanpts++;
      tanindex = i;
    }
  }
  if (tanpts != 1) {
    (*rtnCode) = -109;
    return -1.0;
  }
  switch (tanindex) {
  case 1:
    xint[1] = xint[3];
    yint[1] = yint[3];
    break;
  case 2:
    xint[2] = xint[3];
    yint[2] = yint[3];
    break;
  case 3:
    break;
  }
  OverlapArea = twointpts(xint, yint, A1, B1, PHI_1, A2, B2, H2_TR, K2_TR,
                          PHI_2, AA, BB, CC, DD, EE, FF, rtnCode);
  (*rtnCode) = 108;
  return OverlapArea;
}


x86 assembly (clang, -O0):
<threeintpts>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  0x38(%rbp),%xmm8
movsd  0x30(%rbp),%xmm8
movsd  0x28(%rbp),%xmm8
movsd  0x20(%rbp),%xmm8
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  %xmm4,-0x40(%rbp)
movsd  %xmm5,-0x48(%rbp)
movsd  %xmm6,-0x50(%rbp)
movsd  %xmm7,-0x58(%rbp)
mov    %rdx,-0x60(%rbp)
movl   $0x0,-0x68(%rbp)
movl   $0x1,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jg     1220 <threeintpts+0x100>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  0x10(%rbp),%xmm4
movsd  0x18(%rbp),%xmm5
movsd  0x20(%rbp),%xmm6
movsd  0x28(%rbp),%xmm7
movsd  0x30(%rbp),%xmm9
movsd  0x38(%rbp),%xmm8
movsd  %xmm9,(%rsp)
movsd  %xmm8,0x8(%rsp)
call   1040 <istanpt@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x72,-0x70(%rbp)
jne    120d <threeintpts+0xed>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x6c(%rbp)
jmp    1212 <threeintpts+0xf2>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1191 <threeintpts+0x71>
cmpl   $0x1,-0x68(%rbp)
je     1246 <threeintpts+0x126>
mov    -0x60(%rbp),%rax
movl   $0xffffff93,(%rax)
movsd  0xdc4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1372 <threeintpts+0x252>
mov    -0x6c(%rbp),%eax
mov    %eax,-0x7c(%rbp)
sub    $0x1,%eax
je     127c <threeintpts+0x15c>
jmp    125a <threeintpts+0x13a>
mov    -0x7c(%rbp),%eax
sub    $0x2,%eax
je     12a5 <threeintpts+0x185>
jmp    126b <threeintpts+0x14b>
mov    -0x7c(%rbp),%eax
sub    $0x3,%eax
je     12ce <threeintpts+0x1ae>
jmp    12d3 <threeintpts+0x1b3>
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    12d3 <threeintpts+0x1b3>
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    12d3 <threeintpts+0x1b3>
jmp    12d3 <threeintpts+0x1b3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm4
movsd  -0x48(%rbp),%xmm5
movsd  -0x50(%rbp),%xmm6
movsd  -0x58(%rbp),%xmm7
movsd  0x10(%rbp),%xmm13
movsd  0x18(%rbp),%xmm12
movsd  0x20(%rbp),%xmm11
movsd  0x28(%rbp),%xmm10
movsd  0x30(%rbp),%xmm9
movsd  0x38(%rbp),%xmm8
mov    -0x60(%rbp),%rdx
movsd  %xmm13,(%rsp)
movsd  %xmm12,0x8(%rsp)
movsd  %xmm11,0x10(%rsp)
movsd  %xmm10,0x18(%rsp)
movsd  %xmm9,0x20(%rsp)
movsd  %xmm8,0x28(%rsp)
call   1030 <twointpts@plt>
movsd  %xmm0,-0x78(%rbp)
mov    -0x60(%rbp),%rax
movl   $0x6c,(%rax)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threeintpts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdx,%r14
movsd  %xmm7,0x70(%rsp)
movsd  %xmm6,0x68(%rsp)
movsd  %xmm5,0x60(%rsp)
movsd  %xmm4,0x58(%rsp)
movsd  %xmm3,0x50(%rsp)
movsd  %xmm2,0x48(%rsp)
movaps %xmm1,%xmm3
movsd  %xmm1,0x40(%rsp)
movaps %xmm0,%xmm2
movsd  %xmm0,0x38(%rsp)
mov    %rsi,%r15
mov    %rdi,%r12
movsd  0xd8(%rsp),%xmm8
movsd  0xd0(%rsp),%xmm9
movsd  0xc8(%rsp),%xmm7
movsd  0xc0(%rsp),%xmm6
movsd  0xb8(%rsp),%xmm5
movsd  0xb0(%rsp),%xmm4
movsd  0x8(%rdi),%xmm0
movsd  0x8(%rsi),%xmm1
movsd  %xmm8,0x8(%rsp)
movsd  %xmm9,(%rsp)
call   1040 <istanpt@plt>
xor    %ebx,%ebx
cmp    $0x72,%eax
sete   %bl
movsd  0x10(%r12),%xmm0
movsd  0x10(%r15),%xmm1
movsd  0xd8(%rsp),%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0xd0(%rsp),%xmm2
movsd  %xmm2,(%rsp)
movsd  0x38(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0xb0(%rsp),%xmm4
movsd  0xb8(%rsp),%xmm5
movsd  0xc0(%rsp),%xmm6
movsd  0xc8(%rsp),%xmm7
call   1040 <istanpt@plt>
mov    %eax,%r13d
xor    %ebp,%ebp
cmp    $0x72,%eax
sete   %bpl
add    %ebx,%ebp
movsd  0x18(%r12),%xmm0
movsd  0x18(%r15),%xmm1
movsd  0xd8(%rsp),%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0xd0(%rsp),%xmm2
movsd  %xmm2,(%rsp)
movsd  0x38(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0xb0(%rsp),%xmm4
movsd  0xb8(%rsp),%xmm5
movsd  0xc0(%rsp),%xmm6
movsd  0xc8(%rsp),%xmm7
call   1040 <istanpt@plt>
xor    %ecx,%ecx
cmp    $0x72,%eax
sete   %cl
add    %ebp,%ecx
cmp    $0x1,%ecx
jne    1344 <threeintpts+0x224>
movsd  0xd8(%rsp),%xmm14
movsd  0xd0(%rsp),%xmm13
movsd  0xc8(%rsp),%xmm12
movsd  0xc0(%rsp),%xmm11
movsd  0xb8(%rsp),%xmm10
movsd  0xb0(%rsp),%xmm8
movsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x48(%rsp),%xmm2
movsd  0x50(%rsp),%xmm3
movsd  0x58(%rsp),%xmm4
movsd  0x60(%rsp),%xmm5
movsd  0x68(%rsp),%xmm6
movsd  0x70(%rsp),%xmm7
xor    %ecx,%ecx
cmp    $0x72,%r13d
sete   %cl
add    $0x1,%ecx
cmp    $0x72,%eax
mov    $0x3,%eax
cmovne %ecx,%eax
cmp    $0x1,%eax
je     1353 <threeintpts+0x233>
cmp    $0x2,%eax
movaps %xmm8,%xmm9
jne    1377 <threeintpts+0x257>
lea    0x10(%r12),%rax
lea    0x10(%r15),%rcx
jmp    1360 <threeintpts+0x240>
movsd  0xcb4(%rip),%xmm0
mov    $0xffffff93,%eax
jmp    13b3 <threeintpts+0x293>
lea    0x8(%r12),%rax
lea    0x8(%r15),%rcx
movaps %xmm8,%xmm9
movsd  0x18(%r12),%xmm8
movsd  %xmm8,(%rax)
movsd  0x18(%r15),%xmm8
movsd  %xmm8,(%rcx)
movsd  %xmm14,0x28(%rsp)
movsd  %xmm13,0x20(%rsp)
movsd  %xmm12,0x18(%rsp)
movsd  %xmm11,0x10(%rsp)
movsd  %xmm10,0x8(%rsp)
movsd  %xmm9,(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <twointpts@plt>
mov    $0x6c,%eax
mov    %eax,(%r14)
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @threeintpts(double* %0, double* %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double %14, double %15, i32* %16) {
%18 = alloca double
%19 = alloca double*
%20 = alloca double*
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca i32*
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca double
store double* %0, double** %19
store double* %1, double** %20
store double %2, double* %21
store double %3, double* %22
store double %4, double* %23
store double %5, double* %24
store double %6, double* %25
store double %7, double* %26
store double %8, double* %27
store double %9, double* %28
store double %10, double* %29
store double %11, double* %30
store double %12, double* %31
store double %13, double* %32
store double %14, double* %33
store double %15, double* %34
store i32* %16, i32** %35
store i32 0, i32* %37
store i32 1, i32* %36
br label %41
41: ; preds = %71, %17
%42 = load i32, i32* %36
%43 = icmp sle i32 %42, 3
br i1 %43, label %44, label %74
44: ; preds = %41
%45 = load double*, double** %19
%46 = load i32, i32* %36
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
%49 = load double, double* %48
%50 = load double*, double** %20
%51 = load i32, i32* %36
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
%54 = load double, double* %53
%55 = load double, double* %21
%56 = load double, double* %22
%57 = load double, double* %29
%58 = load double, double* %30
%59 = load double, double* %31
%60 = load double, double* %32
%61 = load double, double* %33
%62 = load double, double* %34
%63 = call i32 @istanpt(double %49, double %54, double %55, double %56, double %57, double %58, double %59, double %60, double %61, double %62)
store i32 %63, i32* %39
%64 = load i32, i32* %39
%65 = icmp eq i32 %64, 114
br i1 %65, label %66, label %70
66: ; preds = %44
%67 = load i32, i32* %37
%68 = add nsw i32 %67, 1
store i32 %68, i32* %37
%69 = load i32, i32* %36
store i32 %69, i32* %38
br label %70
70: ; preds = %66, %44
br label %71
71: ; preds = %70
%72 = load i32, i32* %36
%73 = add nsw i32 %72, 1
store i32 %73, i32* %36
br label %41
74: ; preds = %41
%75 = load i32, i32* %37
%76 = icmp ne i32 %75, 1
br i1 %76, label %77, label %79
77: ; preds = %74
%78 = load i32*, i32** %35
store i32 -109, i32* %78
store double -1.000000e+00, double* %18
br label %125
79: ; preds = %74
%80 = load i32, i32* %38
switch i32 %80, label %104 [
i32 1, label %81
i32 2, label %92
i32 3, label %103
]
81: ; preds = %79
%82 = load double*, double** %19
%83 = getelementptr inbounds double, double* %82, i64 3
%84 = load double, double* %83
%85 = load double*, double** %19
%86 = getelementptr inbounds double, double* %85, i64 1
store double %84, double* %86
%87 = load double*, double** %20
%88 = getelementptr inbounds double, double* %87, i64 3
%89 = load double, double* %88
%90 = load double*, double** %20
%91 = getelementptr inbounds double, double* %90, i64 1
store double %89, double* %91
br label %104
92: ; preds = %79
%93 = load double*, double** %19
%94 = getelementptr inbounds double, double* %93, i64 3
%95 = load double, double* %94
%96 = load double*, double** %19
%97 = getelementptr inbounds double, double* %96, i64 2
store double %95, double* %97
%98 = load double*, double** %20
%99 = getelementptr inbounds double, double* %98, i64 3
%100 = load double, double* %99
%101 = load double*, double** %20
%102 = getelementptr inbounds double, double* %101, i64 2
store double %100, double* %102
br label %104
103: ; preds = %79
br label %104
104: ; preds = %79, %103, %92, %81
%105 = load double*, double** %19
%106 = load double*, double** %20
%107 = load double, double* %21
%108 = load double, double* %22
%109 = load double, double* %23
%110 = load double, double* %24
%111 = load double, double* %25
%112 = load double, double* %26
%113 = load double, double* %27
%114 = load double, double* %28
%115 = load double, double* %29
%116 = load double, double* %30
%117 = load double, double* %31
%118 = load double, double* %32
%119 = load double, double* %33
%120 = load double, double* %34
%121 = load i32*, i32** %35
%122 = call double @twointpts(double* %105, double* %106, double %107, double %108, double %109, double %110, double %111, double %112, double %113, double %114, double %115, double %116, double %117, double %118, double %119, double %120, i32* %121)
store double %122, double* %40
%123 = load i32*, i32** %35
store i32 108, i32* %123
%124 = load double, double* %40
store double %124, double* %18
br label %125
125: ; preds = %104, %77
%126 = load double, double* %18
ret double %126
}

LLVM IR (-O2):
define double @threeintpts(double* %0, double* %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double %14, double %15, i32* %16) {
%18 = getelementptr inbounds double, double* %0, i64 1
%19 = load double, double* %18
%20 = getelementptr inbounds double, double* %1, i64 1
%21 = load double, double* %20
%22 = tail call i32 @istanpt(double %19, double %21, double %2, double %3, double %10, double %11, double %12, double %13, double %14, double %15)
%23 = icmp eq i32 %22, 114
%24 = zext i1 %23 to i32
%25 = getelementptr inbounds double, double* %0, i64 2
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %1, i64 2
%28 = load double, double* %27
%29 = tail call i32 @istanpt(double %26, double %28, double %2, double %3, double %10, double %11, double %12, double %13, double %14, double %15)
%30 = icmp eq i32 %29, 114
%31 = zext i1 %30 to i32
%32 = add nuw nsw i32 %24, %31
%33 = getelementptr inbounds double, double* %0, i64 3
%34 = load double, double* %33
%35 = getelementptr inbounds double, double* %1, i64 3
%36 = load double, double* %35
%37 = tail call i32 @istanpt(double %34, double %36, double %2, double %3, double %10, double %11, double %12, double %13, double %14, double %15)
%38 = icmp eq i32 %37, 114
%39 = zext i1 %38 to i32
%40 = add nuw nsw i32 %32, %39
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %53
42: ; preds = %17
%43 = select i1 %30, i32 2, i32 1
%44 = select i1 %38, i32 3, i32 %43
switch i32 %44, label %51 [
i32 1, label %46
i32 2, label %45
]
45: ; preds = %42
br label %46
46: ; preds = %42, %45
%47 = phi double* [ %25, %45 ], [ %18, %42 ]
%48 = phi double* [ %27, %45 ], [ %20, %42 ]
%49 = load double, double* %33
store double %49, double* %47
%50 = load double, double* %35
store double %50, double* %48
br label %51
51: ; preds = %46, %42
%52 = tail call double @twointpts(double* %0, double* %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double %14, double %15, i32* %16)
br label %53
53: ; preds = %17, %51
%54 = phi i32 [ 108, %51 ], [ -109, %17 ]
%55 = phi double [ %52, %51 ], [ -1.000000e+00, %17 ]
store i32 %54, i32* %16
ret double %55
}