; LLVM IR from HarshCasper/NeoAlgo :: C-Plus-Plus/computational_geometry (Check_Orientation_of_three_points)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z16CheckOrientationiiiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 %0, ptr %8, align 4, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !5
  store i32 %3, ptr %11, align 4, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !5
  store i32 %5, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #2
  %16 = load i32, ptr %11, align 4, !tbaa !5
  %17 = load i32, ptr %9, align 4, !tbaa !5
  %18 = sub nsw i32 %16, %17
  %19 = load i32, ptr %12, align 4, !tbaa !5
  %20 = load i32, ptr %10, align 4, !tbaa !5
  %21 = sub nsw i32 %19, %20
  %22 = mul nsw i32 %18, %21
  %23 = load i32, ptr %13, align 4, !tbaa !5
  %24 = load i32, ptr %11, align 4, !tbaa !5
  %25 = sub nsw i32 %23, %24
  %26 = load i32, ptr %10, align 4, !tbaa !5
  %27 = load i32, ptr %8, align 4, !tbaa !5
  %28 = sub nsw i32 %26, %27
  %29 = mul nsw i32 %25, %28
  %30 = sub nsw i32 %22, %29
  store i32 %30, ptr %14, align 4, !tbaa !5
  %31 = load i32, ptr %14, align 4, !tbaa !5
  %32 = sitofp i32 %31 to double
  %33 = fcmp ogt double %32, 1.000000e-10
  br i1 %33, label %34, label %35

34:                                               ; preds = %6
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %45

35:                                               ; preds = %6
  %36 = load i32, ptr %14, align 4, !tbaa !5
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %45

39:                                               ; preds = %35
  %40 = load i32, ptr %14, align 4, !tbaa !5
  %41 = sitofp i32 %40 to double
  %42 = fcmp olt double %41, -1.000000e-10
  br i1 %42, label %43, label %44

43:                                               ; preds = %39
  store i32 1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %45

44:                                               ; preds = %39
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %45

45:                                               ; preds = %44, %43, %38, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #2
  %46 = load i32, ptr %7, align 4
  ret i32 %46
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noundef range(i32 -1, 2) i32 @_Z16CheckOrientationiiiiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = sub nsw i32 %3, %1
  %8 = sub nsw i32 %4, %2
  %9 = mul nsw i32 %8, %7
  %10 = sub nsw i32 %5, %3
  %.neg = sub i32 %0, %2
  %.neg13 = mul i32 %10, %.neg
  %11 = add i32 %.neg13, %9
  %12 = icmp sgt i32 %11, 0
  %13 = icmp ne i32 %11, 0
  %spec.select = zext i1 %13 to i32
  %.0 = select i1 %12, i32 -1, i32 %spec.select
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass