; LLVM IR from iksha-rudra/Computational-Geometry :: CGAlgorithms/CGAlgorithms (cgalgorithms)

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI5PointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN12CGAlgorithms9_findMaxXESt6vectorI5PointSaIS1_EERS1_S4_(ptr noundef %0, ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  store i8 0, ptr %7, align 1, !tbaa !9
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN5Point4setXEi(ptr noundef nonnull align 4 dereferenceable(8) %9, i32 noundef -2147483648)
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %10, i32 noundef -2147483648)
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN5Point4setXEi(ptr noundef nonnull align 4 dereferenceable(8) %11, i32 noundef -2147483648)
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %12, i32 noundef -2147483648)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %13

13:                                               ; preds = %80, %3
  %14 = load i32, ptr %8, align 4, !tbaa !11
  %15 = zext i32 %14 to i64
  %16 = call noundef i64 @_ZNKSt6vectorI5PointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %17 = icmp ult i64 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %83

19:                                               ; preds = %13
  %20 = load i32, ptr %8, align 4, !tbaa !11
  %21 = zext i32 %20 to i64
  %22 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %21)
  %23 = call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %22)
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %24)
  %26 = icmp sgt i32 %23, %25
  br i1 %26, label %27, label %40

27:                                               ; preds = %19
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load i32, ptr %8, align 4, !tbaa !11
  %30 = zext i32 %29 to i64
  %31 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %30)
  %32 = call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %31)
  call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %28, i32 noundef %32)
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i32, ptr %8, align 4, !tbaa !11
  %35 = zext i32 %34 to i64
  %36 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %35)
  %37 = call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %36)
  call void @_ZN5Point4setXEi(ptr noundef nonnull align 4 dereferenceable(8) %33, i32 noundef %37)
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %38, i64 8, i1 false), !tbaa.struct !13
  store i8 0, ptr %7, align 1, !tbaa !9
  br label %79

40:                                               ; preds = %19
  %41 = load i32, ptr %8, align 4, !tbaa !11
  %42 = zext i32 %41 to i64
  %43 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %42)
  %44 = call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %43)
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %45)
  %47 = icmp eq i32 %44, %46
  br i1 %47, label %48, label %78

48:                                               ; preds = %40
  store i8 1, ptr %7, align 1, !tbaa !9
  %49 = load i32, ptr %8, align 4, !tbaa !11
  %50 = zext i32 %49 to i64
  %51 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %50)
  %52 = call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %51)
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %53)
  %55 = icmp slt i32 %52, %54
  br i1 %55, label %56, label %62

56:                                               ; preds = %48
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load i32, ptr %8, align 4, !tbaa !11
  %59 = zext i32 %58 to i64
  %60 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %59)
  %61 = call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %60)
  call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %57, i32 noundef %61)
  br label %77

62:                                               ; preds = %48
  %63 = load i32, ptr %8, align 4, !tbaa !11
  %64 = zext i32 %63 to i64
  %65 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %64)
  %66 = call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %65)
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %67)
  %69 = icmp sgt i32 %66, %68
  br i1 %69, label %70, label %76

70:                                               ; preds = %62
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = load i32, ptr %8, align 4, !tbaa !11
  %73 = zext i32 %72 to i64
  %74 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %73)
  %75 = call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %74)
  call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %71, i32 noundef %75)
  br label %76

76:                                               ; preds = %70, %62
  br label %77

77:                                               ; preds = %76, %56
  br label %78

78:                                               ; preds = %77, %40
  br label %79

79:                                               ; preds = %78, %27
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %8, align 4, !tbaa !11
  %82 = add i32 %81, 1
  store i32 %82, ptr %8, align 4, !tbaa !11
  br label %13, !llvm.loop !14

83:                                               ; preds = %18
  %84 = load i8, ptr %7, align 1, !tbaa !9, !range !16, !noundef !17
  %85 = trunc i8 %84 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  ret i1 %85
}

declare noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8)) #4

declare noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8)) #4

declare void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #4

declare void @_ZN5Point4setXEi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress 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 #4 = { "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 #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i64 0, i64 4, !11, i64 4, i64 4, !11}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{i8 0, i8 2}
!17 = !{}


; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI5PointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN12CGAlgorithms9_findMaxXESt6vectorI5PointSaIS1_EERS1_S4_(ptr noundef %0, ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %2) local_unnamed_addr #1 align 2 {
  tail call void @_ZN5Point4setXEi(ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef -2147483648)
  tail call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef -2147483648)
  tail call void @_ZN5Point4setXEi(ptr noundef nonnull align 4 dereferenceable(8) %2, i32 noundef -2147483648)
  tail call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %2, i32 noundef -2147483648)
  %4 = tail call noundef i64 @_ZNKSt6vectorI5PointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %.not = icmp eq i64 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %34, %3
  %.024.lcssa = phi i1 [ false, %3 ], [ %.1, %34 ]
  ret i1 %.024.lcssa

.lr.ph:                                           ; preds = %3, %34
  %5 = phi i64 [ %36, %34 ], [ 0, %3 ]
  %.027 = phi i32 [ %35, %34 ], [ 0, %3 ]
  %.02426 = phi i1 [ %.1, %34 ], [ false, %3 ]
  %6 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %5)
  %7 = tail call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %6)
  %8 = tail call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %9 = icmp sgt i32 %7, %8
  %10 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %5)
  br i1 %9, label %11, label %16

11:                                               ; preds = %.lr.ph
  %12 = tail call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %10)
  tail call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef %12)
  %13 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %5)
  %14 = tail call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  tail call void @_ZN5Point4setXEi(ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef %14)
  %15 = load i64, ptr %1, align 4
  store i64 %15, ptr %2, align 4
  br label %34

16:                                               ; preds = %.lr.ph
  %17 = tail call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %10)
  %18 = tail call noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %19 = icmp eq i32 %17, %18
  br i1 %19, label %20, label %34

20:                                               ; preds = %16
  %21 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %5)
  %22 = tail call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %21)
  %23 = tail call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %24 = icmp slt i32 %22, %23
  %25 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %5)
  %26 = tail call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %25)
  br i1 %24, label %27, label %28

27:                                               ; preds = %20
  tail call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef %26)
  br label %34

28:                                               ; preds = %20
  %29 = tail call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %2)
  %30 = icmp sgt i32 %26, %29
  br i1 %30, label %31, label %34

31:                                               ; preds = %28
  %32 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorI5PointSaIS0_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %5)
  %33 = tail call noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8) %32)
  tail call void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8) %2, i32 noundef %33)
  br label %34

34:                                               ; preds = %11, %27, %31, %28, %16
  %.1 = phi i1 [ false, %11 ], [ true, %27 ], [ true, %31 ], [ true, %28 ], [ %.02426, %16 ]
  %35 = add i32 %.027, 1
  %36 = zext i32 %35 to i64
  %37 = tail call noundef i64 @_ZNKSt6vectorI5PointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %38 = icmp ugt i64 %37, %36
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !5
}

declare noundef i32 @_ZN5Point1xEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

declare noundef i32 @_ZN5Point1yEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

declare void @_ZN5Point4setYEi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #2

declare void @_ZN5Point4setXEi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #2

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 = { mustprogress 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 #2 = { "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 #3 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass