int TkPolygonToArea(polyPtr, numPoints, rectPtr)
double *polyPtr;
int numPoints;
register double *rectPtr;
{
  int state;
  int count;
  register double *pPtr;
  state = TkLineToArea(polyPtr, polyPtr + 2, rectPtr);
  if (state == 0) {
    return 0;
  }
  for (pPtr = polyPtr + 2, count = numPoints - 1; count >= 2;
       pPtr += 2, count--) {
    if (TkLineToArea(pPtr, pPtr + 2, rectPtr) != state) {
      return 0;
    }
  }
  if (state == 1) {
    return 1;
  }
  if (TkPolygonToPoint(polyPtr, numPoints, rectPtr) == 0.0) {
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<TkPolygonToArea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
mov    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <TkLineToArea@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1163 <TkPolygonToArea+0x43>
movl   $0x0,-0x4(%rbp)
jmp    121f <TkPolygonToArea+0xff>
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x2,-0x28(%rbp)
jl     11cd <TkPolygonToArea+0xad>
mov    -0x30(%rbp),%rdi
mov    -0x30(%rbp),%rsi
add    $0x10,%rsi
mov    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <TkLineToArea@plt>
cmp    -0x24(%rbp),%eax
je     11ae <TkPolygonToArea+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    121f <TkPolygonToArea+0xff>
jmp    11b3 <TkPolygonToArea+0x93>
mov    -0x30(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1178 <TkPolygonToArea+0x58>
cmpl   $0x1,-0x24(%rbp)
jne    11e3 <TkPolygonToArea+0xc3>
movl   $0x1,-0x4(%rbp)
jmp    121f <TkPolygonToArea+0xff>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1030 <TkPolygonToPoint@plt>
cvtsi2sd %eax,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1218 <TkPolygonToArea+0xf8>
jp     1218 <TkPolygonToArea+0xf8>
movl   $0x0,-0x4(%rbp)
jmp    121f <TkPolygonToArea+0xff>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TkPolygonToArea>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,(%rsp)
mov    %rdi,%r15
lea    0x10(%rdi),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <TkLineToArea@plt>
test   %eax,%eax
je     11a4 <TkPolygonToArea+0x84>
mov    %eax,%r13d
mov    (%rsp),%rax
lea    0x1(%rax),%ebp
lea    0x20(%r15),%rsi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
cmp    $0x3,%ebp
jl     1184 <TkPolygonToArea+0x64>
lea    0x10(%rsi),%r14
lea    -0x10(%rsi),%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <TkLineToArea@plt>
mov    %r14,%rsi
cmp    %r13d,%eax
je     1160 <TkPolygonToArea+0x40>
jmp    11a4 <TkPolygonToArea+0x84>
mov    $0x1,%ebx
cmp    $0x1,%r13d
je     11a4 <TkPolygonToArea+0x84>
mov    %r15,%rdi
mov    (%rsp),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1030 <TkPolygonToPoint@plt>
neg    %eax
sbb    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @TkPolygonToArea(double* %0, i32 %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
store double* %0, double** %5
store i32 %1, i32* %6
store double* %2, double** %7
%11 = load double*, double** %5
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 2
%14 = load double*, double** %7
%15 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @TkLineToArea to i32 (double*, double*, double*, ...)*)(double* %11, double* %13, double* %14)
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %3
store i32 0, i32* %4
br label %55
19: ; preds = %3
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 2
store double* %21, double** %10
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %9
br label %24
24: ; preds = %37, %19
%25 = load i32, i32* %9
%26 = icmp sge i32 %25, 2
br i1 %26, label %27, label %42
27: ; preds = %24
%28 = load double*, double** %10
%29 = load double*, double** %10
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double*, double** %7
%32 = call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @TkLineToArea to i32 (double*, double*, double*, ...)*)(double* %28, double* %30, double* %31)
%33 = load i32, i32* %8
%34 = icmp ne i32 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %27
store i32 0, i32* %4
br label %55
36: ; preds = %27
br label %37
37: ; preds = %36
%38 = load double*, double** %10
%39 = getelementptr inbounds double, double* %38, i64 2
store double* %39, double** %10
%40 = load i32, i32* %9
%41 = add nsw i32 %40, -1
store i32 %41, i32* %9
br label %24
42: ; preds = %24
%43 = load i32, i32* %8
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %46
45: ; preds = %42
store i32 1, i32* %4
br label %55
46: ; preds = %42
%47 = load double*, double** %5
%48 = load i32, i32* %6
%49 = load double*, double** %7
%50 = call i32 (double*, i32, double*, ...) bitcast (i32 (...)* @TkPolygonToPoint to i32 (double*, i32, double*, ...)*)(double* %47, i32 %48, double* %49)
%51 = sitofp i32 %50 to double
%52 = fcmp oeq double %51, 0.000000e+00
br i1 %52, label %53, label %54
53: ; preds = %46
store i32 0, i32* %4
br label %55
54: ; preds = %46
store i32 -1, i32* %4
br label %55
55: ; preds = %54, %53, %45, %35, %18
%56 = load i32, i32* %4
ret i32 %56
}

LLVM IR (-O2):
define i32 @TkPolygonToArea(double* %0, i32 %1, double* %2) {
%4 = getelementptr inbounds double, double* %0, i64 2
%5 = tail call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @TkLineToArea to i32 (double*, double*, double*, ...)*)(double* %0, double* %4, double* %2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %22, label %7
7: ; preds = %3, %11
%8 = phi i32 [ %12, %11 ], [ %1, %3 ]
%9 = phi double* [ %13, %11 ], [ %4, %3 ]
%10 = icmp sgt i32 %8, 2
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = add nsw i32 %8, -1
%13 = getelementptr inbounds double, double* %9, i64 2
%14 = tail call i32 (double*, double*, double*, ...) bitcast (i32 (...)* @TkLineToArea to i32 (double*, double*, double*, ...)*)(double* %9, double* %13, double* %2)
%15 = icmp eq i32 %14, %5
br i1 %15, label %7, label %22
16: ; preds = %7
%17 = icmp eq i32 %5, 1
br i1 %17, label %22, label %18
18: ; preds = %16
%19 = tail call i32 (double*, i32, double*, ...) bitcast (i32 (...)* @TkPolygonToPoint to i32 (double*, i32, double*, ...)*)(double* %0, i32 %1, double* %2)
%20 = icmp ne i32 %19, 0
%21 = sext i1 %20 to i32
br label %22
22: ; preds = %11, %18, %16, %3
%23 = phi i32 [ 0, %3 ], [ 1, %16 ], [ %21, %18 ], [ 0, %11 ]
ret i32 %23
}