#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 /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, double *, double *);
scalar_t__ tritest(double, double, double, double, double, double, double,
                   double);
int main(int argc, char *argv[]) {
  double x0, y0, x1, y1, x2, y2, px;
  double py;
  int scanfReturn = 0;
  printf("Triangle Vertex A (x,y): ");
  scanfReturn += scanf("%lf,%lf", &x0, &y0);
  printf("Triangle Vertex  B (x,y): ");
  scanfReturn += scanf("%lf,%lf", &x1, &y1);
  printf("Triangle Vertex  C (x,y): ");
  scanfReturn += scanf("%lf,%lf", &x2, &y2);
  printf("Test Point (x,y): ");
  scanfReturn += scanf("%lf,%lf", &px, &py);
  if (scanfReturn != 8) {
    printf("Please enter an input other than 8\n");
    return 1;
  }
  printf("Point (%.2lf,%.2lf) is ", px, py);
  if (tritest(x0, y0, x1, y1, x2, y2, px, py)) {
    printf("inside");
    printf("the Triangle\n");
  } else {
    printf("outside");
    printf(" the Triangle\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x54(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <scanf@plt>
mov    %rax,%rcx
movslq -0x54(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x54(%rbp)
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <scanf@plt>
mov    %rax,%rcx
movslq -0x54(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x54(%rbp)
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1040 <scanf@plt>
mov    %rax,%rcx
movslq -0x54(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x54(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2b(%rip),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1040 <scanf@plt>
mov    %rax,%rcx
movslq -0x54(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x54(%rbp)
cmpl   $0x8,-0x54(%rbp)
je     122d <main+0xfd>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12c0 <main+0x190>
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
lea    0xe51(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm5
movsd  -0x48(%rbp),%xmm6
movsd  -0x50(%rbp),%xmm7
call   1050 <tritest@plt>
cmp    $0x0,%rax
je     129d <main+0x16d>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b9 <main+0x189>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0xeaf(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb8(%rip),%r15
lea    0x40(%rsp),%rsi
lea    0x38(%rsp),%rdx
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %rax,%rbp
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %rax,%rbx
add    %ebp,%ebx
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
mov    %r15,%rdi
call   1050 <scanf@plt>
mov    %rax,%rbp
add    %ebx,%ebp
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
call   1050 <scanf@plt>
add    %ebp,%eax
cmp    $0x8,%eax
jne    1267 <main+0x127>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
lea    0xe70(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x18(%rsp),%xmm5
movsd  0x10(%rsp),%xmm6
movsd  0x8(%rsp),%xmm7
call   1060 <tritest@plt>
test   %rax,%rax
lea    0xe49(%rip),%rax
lea    0xe3b(%rip),%rdi
cmove  %rax,%rdi
lea    0xe3f(%rip),%rax
lea    0xe39(%rip),%rbx
cmove  %rax,%rbx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1274 <main+0x134>
mov    $0x1,%r14d
lea    0xe2c(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Triangle Vertex A (x,y): \00"
@.str.1 = [8 x i8] c"%lf,%lf\00"
@.str.2 = [27 x i8] c"Triangle Vertex B (x,y): \00"
@.str.3 = [27 x i8] c"Triangle Vertex C (x,y): \00"
@.str.4 = [19 x i8] c"Test Point (x,y): \00"
@.str.5 = [36 x i8] c"Please enter an input other than 8\0A\00"
@.str.6 = [24 x i8] c"Point (%.2lf,%.2lf) is \00"
@.str.7 = [7 x i8] c"inside\00"
@.str.8 = [14 x i8] c"the Triangle\0A\00"
@.str.9 = [8 x i8] c"outside\00"
@.str.10 = [15 x i8] c" the Triangle\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %14
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%16 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %6, double* %7)
%17 = load i32, i32* %14
%18 = sext i32 %17 to i64
%19 = add nsw i64 %18, %16
%20 = trunc i64 %19 to i32
store i32 %20, i32* %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%22 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %8, double* %9)
%23 = load i32, i32* %14
%24 = sext i32 %23 to i64
%25 = add nsw i64 %24, %22
%26 = trunc i64 %25 to i32
store i32 %26, i32* %14
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%28 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %10, double* %11)
%29 = load i32, i32* %14
%30 = sext i32 %29 to i64
%31 = add nsw i64 %30, %28
%32 = trunc i64 %31 to i32
store i32 %32, i32* %14
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%34 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %12, double* %13)
%35 = load i32, i32* %14
%36 = sext i32 %35 to i64
%37 = add nsw i64 %36, %34
%38 = trunc i64 %37 to i32
store i32 %38, i32* %14
%39 = load i32, i32* %14
%40 = icmp ne i32 %39, 8
br i1 %40, label %41, label %43
41: ; preds = %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %64
43: ; preds = %2
%44 = load double, double* %12
%45 = load double, double* %13
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %44, double %45)
%47 = load double, double* %6
%48 = load double, double* %7
%49 = load double, double* %8
%50 = load double, double* %9
%51 = load double, double* %10
%52 = load double, double* %11
%53 = load double, double* %12
%54 = load double, double* %13
%55 = call i64 @tritest(double %47, double %48, double %49, double %50, double %51, double %52, double %53, double %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %43
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
br label %63
60: ; preds = %43
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
br label %63
63: ; preds = %60, %57
store i32 0, i32* %3
br label %64
64: ; preds = %63, %41
%65 = load i32, i32* %3
ret i32 %65
}

LLVM IR (-O2):
@.str = [26 x i8] c"Triangle Vertex A (x,y): \00"
@.str.1 = [8 x i8] c"%lf,%lf\00"
@.str.2 = [27 x i8] c"Triangle Vertex B (x,y): \00"
@.str.3 = [27 x i8] c"Triangle Vertex C (x,y): \00"
@.str.4 = [19 x i8] c"Test Point (x,y): \00"
@.str.6 = [24 x i8] c"Point (%.2lf,%.2lf) is \00"
@.str.7 = [7 x i8] c"inside\00"
@.str.9 = [8 x i8] c"outside\00"
@str = [14 x i8] c" the Triangle\00"
@str.11 = [13 x i8] c"the Triangle\00"
@str.12 = [35 x i8] c"Please enter an input other than 8\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = bitcast double* %3 to i8*
%12 = bitcast double* %4 to i8*
%13 = bitcast double* %5 to i8*
%14 = bitcast double* %6 to i8*
%15 = bitcast double* %7 to i8*
%16 = bitcast double* %8 to i8*
%17 = bitcast double* %9 to i8*
%18 = bitcast double* %10 to i8*
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%20 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %3, double* %4)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%22 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %6)
%23 = add i64 %22, %20
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%25 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %7, double* %8)
%26 = add i64 %23, %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%28 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %9, double* %10)
%29 = add i64 %26, %28
%30 = trunc i64 %29 to i32
%31 = icmp eq i32 %30, 8
br i1 %31, label %32, label %49
32: ; preds = %2
%33 = load double, double* %9
%34 = load double, double* %10
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %33, double %34)
%36 = load double, double* %3
%37 = load double, double* %4
%38 = load double, double* %5
%39 = load double, double* %6
%40 = load double, double* %7
%41 = load double, double* %8
%42 = load double, double* %9
%43 = load double, double* %10
%44 = call i64 @tritest(double %36, double %37, double %38, double %39, double %40, double %41, double %42, double %43)
%45 = icmp eq i64 %44, 0
%46 = select i1 %45, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0)
%47 = select i1 %45, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str.11, i64 0, i64 0)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %46)
br label %49
49: ; preds = %32, %2
%50 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @str.12, i64 0, i64 0), %2 ], [ %47, %32 ]
%51 = phi i32 [ 1, %2 ], [ 0, %32 ]
%52 = call i32 @puts(i8* dereferenceable(1) %50)
ret i32 %51
}