; LLVM IR from PaddlePaddle/Serving :: core/predictor/tools/ocrtools (clipper)

; 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"

%"struct.ClipperLib::IntPoint" = type { i64, i64 }

; 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) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN10ClipperLib17GetOverlapSegmentENS_8IntPointES0_S0_S0_RS0_S1_(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, ptr noundef byval(%"struct.ClipperLib::IntPoint") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %8) #2 {
  %10 = alloca i1, align 1
  %11 = alloca %"struct.ClipperLib::IntPoint", align 8
  %12 = alloca %"struct.ClipperLib::IntPoint", align 8
  %13 = alloca %"struct.ClipperLib::IntPoint", align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 0
  store i64 %0, ptr %16, align 8
  %17 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 1
  store i64 %1, ptr %17, align 8
  %18 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 0
  store i64 %2, ptr %18, align 8
  %19 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 1
  store i64 %3, ptr %19, align 8
  %20 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  store i64 %4, ptr %20, align 8
  %21 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  store i64 %5, ptr %21, align 8
  store ptr %7, ptr %14, align 8, !tbaa !5
  store ptr %8, ptr %15, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %11, i32 0, i32 0
  %23 = load i64, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %12, i32 0, i32 0
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = sub nsw i64 %23, %25
  %27 = call noundef i64 @_ZN10ClipperLib3AbsEx(i64 noundef %26)
  %28 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %11, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !12
  %30 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %12, i32 0, i32 1
  %31 = load i64, ptr %30, align 8, !tbaa !12
  %32 = sub nsw i64 %29, %31
  %33 = call noundef i64 @_ZN10ClipperLib3AbsEx(i64 noundef %32)
  %34 = icmp sgt i64 %27, %33
  br i1 %34, label %35, label %77

35:                                               ; preds = %9
  %36 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %11, i32 0, i32 0
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %12, i32 0, i32 0
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = icmp sgt i64 %37, %39
  br i1 %40, label %41, label %42

41:                                               ; preds = %35
  call void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %12)
  br label %42

42:                                               ; preds = %41, %35
  %43 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %13, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %6, i32 0, i32 0
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = icmp sgt i64 %44, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %42
  call void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %6)
  br label %49

49:                                               ; preds = %48, %42
  %50 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %11, i32 0, i32 0
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %13, i32 0, i32 0
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = icmp sgt i64 %51, %53
  br i1 %54, label %55, label %57

55:                                               ; preds = %49
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %56, ptr align 8 %11, i64 16, i1 false), !tbaa.struct !13
  br label %59

57:                                               ; preds = %49
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %58, ptr align 8 %13, i64 16, i1 false), !tbaa.struct !13
  br label %59

59:                                               ; preds = %57, %55
  %60 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %12, i32 0, i32 0
  %61 = load i64, ptr %60, align 8, !tbaa !9
  %62 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %6, i32 0, i32 0
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = icmp slt i64 %61, %63
  br i1 %64, label %65, label %67

65:                                               ; preds = %59
  %66 = load ptr, ptr %15, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %66, ptr align 8 %12, i64 16, i1 false), !tbaa.struct !13
  br label %69

67:                                               ; preds = %59
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %68, ptr align 8 %6, i64 16, i1 false), !tbaa.struct !13
  br label %69

69:                                               ; preds = %67, %65
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %70, i32 0, i32 0
  %72 = load i64, ptr %71, align 8, !tbaa !9
  %73 = load ptr, ptr %15, align 8, !tbaa !5
  %74 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %73, i32 0, i32 0
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = icmp slt i64 %72, %75
  store i1 %76, ptr %10, align 1
  br label %119

77:                                               ; preds = %9
  %78 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %11, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !12
  %80 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %12, i32 0, i32 1
  %81 = load i64, ptr %80, align 8, !tbaa !12
  %82 = icmp slt i64 %79, %81
  br i1 %82, label %83, label %84

83:                                               ; preds = %77
  call void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %12)
  br label %84

84:                                               ; preds = %83, %77
  %85 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %13, i32 0, i32 1
  %86 = load i64, ptr %85, align 8, !tbaa !12
  %87 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %6, i32 0, i32 1
  %88 = load i64, ptr %87, align 8, !tbaa !12
  %89 = icmp slt i64 %86, %88
  br i1 %89, label %90, label %91

90:                                               ; preds = %84
  call void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %6)
  br label %91

91:                                               ; preds = %90, %84
  %92 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %11, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !12
  %94 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %13, i32 0, i32 1
  %95 = load i64, ptr %94, align 8, !tbaa !12
  %96 = icmp slt i64 %93, %95
  br i1 %96, label %97, label %99

97:                                               ; preds = %91
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %98, ptr align 8 %11, i64 16, i1 false), !tbaa.struct !13
  br label %101

99:                                               ; preds = %91
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %100, ptr align 8 %13, i64 16, i1 false), !tbaa.struct !13
  br label %101

101:                                              ; preds = %99, %97
  %102 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %12, i32 0, i32 1
  %103 = load i64, ptr %102, align 8, !tbaa !12
  %104 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %6, i32 0, i32 1
  %105 = load i64, ptr %104, align 8, !tbaa !12
  %106 = icmp sgt i64 %103, %105
  br i1 %106, label %107, label %109

107:                                              ; preds = %101
  %108 = load ptr, ptr %15, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %108, ptr align 8 %12, i64 16, i1 false), !tbaa.struct !13
  br label %111

109:                                              ; preds = %101
  %110 = load ptr, ptr %15, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %110, ptr align 8 %6, i64 16, i1 false), !tbaa.struct !13
  br label %111

111:                                              ; preds = %109, %107
  %112 = load ptr, ptr %14, align 8, !tbaa !5
  %113 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %112, i32 0, i32 1
  %114 = load i64, ptr %113, align 8, !tbaa !12
  %115 = load ptr, ptr %15, align 8, !tbaa !5
  %116 = getelementptr inbounds %"struct.ClipperLib::IntPoint", ptr %115, i32 0, i32 1
  %117 = load i64, ptr %116, align 8, !tbaa !12
  %118 = icmp sgt i64 %114, %117
  store i1 %118, ptr %10, align 1
  br label %119

119:                                              ; preds = %111, %69
  %120 = load i1, ptr %10, align 1
  ret i1 %120
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN10ClipperLib3AbsEx(i64 noundef) #3

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { inlinehint 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" }

!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, !11, i64 0}
!10 = !{!"_ZTSN10ClipperLib8IntPointE", !11, i64 0, !11, i64 8}
!11 = !{!"long long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{i64 0, i64 8, !14, i64 8, i64 8, !14}
!14 = !{!11, !11, i64 0}


; 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"

%"struct.ClipperLib::IntPoint" = type { i64, i64 }

; Function Attrs: mustprogress 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) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN10ClipperLib17GetOverlapSegmentENS_8IntPointES0_S0_S0_RS0_S1_(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, ptr noundef byval(%"struct.ClipperLib::IntPoint") align 8 %6, ptr nocapture noundef nonnull align 8 dereferenceable(16) %7, ptr nocapture noundef nonnull align 8 dereferenceable(16) %8) local_unnamed_addr #1 {
  %10 = alloca %"struct.ClipperLib::IntPoint", align 8
  %11 = alloca %"struct.ClipperLib::IntPoint", align 8
  %12 = alloca %"struct.ClipperLib::IntPoint", align 8
  store i64 %0, ptr %10, align 8
  %13 = getelementptr inbounds i8, ptr %10, i64 8
  store i64 %1, ptr %13, align 8
  store i64 %2, ptr %11, align 8
  %14 = getelementptr inbounds i8, ptr %11, i64 8
  store i64 %3, ptr %14, align 8
  store i64 %4, ptr %12, align 8
  %15 = getelementptr inbounds i8, ptr %12, i64 8
  store i64 %5, ptr %15, align 8
  %16 = sub nsw i64 %0, %2
  %17 = tail call noundef i64 @_ZN10ClipperLib3AbsEx(i64 noundef %16)
  %18 = sub nsw i64 %1, %3
  %19 = tail call noundef i64 @_ZN10ClipperLib3AbsEx(i64 noundef %18)
  %20 = icmp sgt i64 %17, %19
  br i1 %20, label %21, label %39

21:                                               ; preds = %9
  %22 = icmp sgt i64 %0, %2
  br i1 %22, label %23, label %24

23:                                               ; preds = %21
  call void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %11)
  %.pre14 = load i64, ptr %12, align 8, !tbaa !5
  br label %24

24:                                               ; preds = %23, %21
  %25 = phi i64 [ %.pre14, %23 ], [ %4, %21 ]
  %26 = load i64, ptr %6, align 8, !tbaa !5
  %27 = icmp sgt i64 %25, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %24
  call void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %6)
  %.pre15 = load i64, ptr %12, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %28, %24
  %30 = phi i64 [ %.pre15, %28 ], [ %25, %24 ]
  %31 = load i64, ptr %10, align 8, !tbaa !5
  %32 = icmp sgt i64 %31, %30
  %. = select i1 %32, ptr %10, ptr %12
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %., i64 16, i1 false)
  %33 = load i64, ptr %11, align 8, !tbaa !5
  %34 = load i64, ptr %6, align 8, !tbaa !5
  %35 = icmp slt i64 %33, %34
  %.sink16 = select i1 %35, ptr %11, ptr %6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %.sink16, i64 16, i1 false)
  %36 = load i64, ptr %7, align 8, !tbaa !5
  %37 = load i64, ptr %8, align 8, !tbaa !5
  %38 = icmp slt i64 %36, %37
  br label %60

39:                                               ; preds = %9
  %40 = icmp slt i64 %1, %3
  br i1 %40, label %41, label %42

41:                                               ; preds = %39
  call void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %11)
  %.pre = load i64, ptr %15, align 8, !tbaa !10
  br label %42

42:                                               ; preds = %41, %39
  %43 = phi i64 [ %.pre, %41 ], [ %5, %39 ]
  %44 = getelementptr inbounds i8, ptr %6, i64 8
  %45 = load i64, ptr %44, align 8, !tbaa !10
  %46 = icmp slt i64 %43, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %42
  call void @_ZN10ClipperLib10SwapPointsERNS_8IntPointES1_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %6)
  %.pre13 = load i64, ptr %15, align 8, !tbaa !10
  br label %48

48:                                               ; preds = %47, %42
  %49 = phi i64 [ %.pre13, %47 ], [ %43, %42 ]
  %50 = load i64, ptr %13, align 8, !tbaa !10
  %51 = icmp slt i64 %50, %49
  %.19 = select i1 %51, ptr %10, ptr %12
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %.19, i64 16, i1 false)
  %52 = load i64, ptr %14, align 8, !tbaa !10
  %53 = load i64, ptr %44, align 8, !tbaa !10
  %54 = icmp sgt i64 %52, %53
  %.sink18 = select i1 %54, ptr %11, ptr %6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %.sink18, i64 16, i1 false)
  %55 = getelementptr inbounds i8, ptr %7, i64 8
  %56 = load i64, ptr %55, align 8, !tbaa !10
  %57 = getelementptr inbounds i8, ptr %8, i64 8
  %58 = load i64, ptr %57, align 8, !tbaa !10
  %59 = icmp sgt i64 %56, %58
  br label %60

60:                                               ; preds = %48, %29
  %.0 = phi i1 [ %38, %29 ], [ %59, %48 ]
  ret i1 %.0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN10ClipperLib3AbsEx(i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { inlinehint 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" }

!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, !7, i64 0}
!6 = !{!"_ZTSN10ClipperLib8IntPointE", !7, i64 0, !7, i64 8}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass