; LLVM IR from robotics-upo/Heuristic_path_planners :: include/voro++-0.4.6/src/c_loops.ll (ZN4voro13c_loop_subset13out_of_boundsEv)

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

%"class.voro::c_loop_base" = type <{ i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.voro::c_loop_subset" = type { %"class.voro::c_loop_base.base", i32, double, double, double, double, double, double, double, double, double, i8, i8, i8, double, double, double, double, double, double, double, double, double, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%"class.voro::c_loop_base.base" = type <{ i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32 }>

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN4voro13c_loop_subset13out_of_boundsEv(ptr noundef nonnull align 8 dereferenceable(304) %0) #0 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %11 = getelementptr inbounds %"class.voro::c_loop_base", ptr %10, i32 0, i32 6
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds %"class.voro::c_loop_base", ptr %10, i32 0, i32 12
  %14 = load i32, ptr %13, align 4, !tbaa !12
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds ptr, ptr %12, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.voro::c_loop_base", ptr %10, i32 0, i32 5
  %19 = load i32, ptr %18, align 4, !tbaa !13
  %20 = getelementptr inbounds %"class.voro::c_loop_base", ptr %10, i32 0, i32 13
  %21 = load i32, ptr %20, align 8, !tbaa !14
  %22 = mul nsw i32 %19, %21
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds double, ptr %17, i64 %23
  store ptr %24, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !15
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %67

28:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = load double, ptr %29, align 8, !tbaa !20
  %31 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 14
  %32 = load double, ptr %31, align 8, !tbaa !21
  %33 = fadd double %30, %32
  %34 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 20
  %35 = load double, ptr %34, align 8, !tbaa !22
  %36 = fsub double %33, %35
  store double %36, ptr %5, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds double, ptr %37, i64 1
  %39 = load double, ptr %38, align 8, !tbaa !20
  %40 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 15
  %41 = load double, ptr %40, align 8, !tbaa !23
  %42 = fadd double %39, %41
  %43 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 21
  %44 = load double, ptr %43, align 8, !tbaa !24
  %45 = fsub double %42, %44
  store double %45, ptr %6, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds double, ptr %46, i64 2
  %48 = load double, ptr %47, align 8, !tbaa !20
  %49 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 16
  %50 = load double, ptr %49, align 8, !tbaa !25
  %51 = fadd double %48, %50
  %52 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 22
  %53 = load double, ptr %52, align 8, !tbaa !26
  %54 = fsub double %51, %53
  store double %54, ptr %7, align 8, !tbaa !20
  %55 = load double, ptr %5, align 8, !tbaa !20
  %56 = load double, ptr %5, align 8, !tbaa !20
  %57 = load double, ptr %6, align 8, !tbaa !20
  %58 = load double, ptr %6, align 8, !tbaa !20
  %59 = fmul double %57, %58
  %60 = call double @llvm.fmuladd.f64(double %55, double %56, double %59)
  %61 = load double, ptr %7, align 8, !tbaa !20
  %62 = load double, ptr %7, align 8, !tbaa !20
  %63 = call double @llvm.fmuladd.f64(double %61, double %62, double %60)
  %64 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 23
  %65 = load double, ptr %64, align 8, !tbaa !27
  %66 = fcmp ogt double %63, %65
  store i1 %66, ptr %2, align 1
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %119

67:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = load double, ptr %68, align 8, !tbaa !20
  %70 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 14
  %71 = load double, ptr %70, align 8, !tbaa !21
  %72 = fadd double %69, %71
  store double %72, ptr %9, align 8, !tbaa !20
  %73 = load double, ptr %9, align 8, !tbaa !20
  %74 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 20
  %75 = load double, ptr %74, align 8, !tbaa !22
  %76 = fcmp olt double %73, %75
  br i1 %76, label %82, label %77

77:                                               ; preds = %67
  %78 = load double, ptr %9, align 8, !tbaa !20
  %79 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 21
  %80 = load double, ptr %79, align 8, !tbaa !24
  %81 = fcmp ogt double %78, %80
  br i1 %81, label %82, label %83

82:                                               ; preds = %77, %67
  store i1 true, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %118

83:                                               ; preds = %77
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds double, ptr %84, i64 1
  %86 = load double, ptr %85, align 8, !tbaa !20
  %87 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 15
  %88 = load double, ptr %87, align 8, !tbaa !23
  %89 = fadd double %86, %88
  store double %89, ptr %9, align 8, !tbaa !20
  %90 = load double, ptr %9, align 8, !tbaa !20
  %91 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 22
  %92 = load double, ptr %91, align 8, !tbaa !26
  %93 = fcmp olt double %90, %92
  br i1 %93, label %99, label %94

94:                                               ; preds = %83
  %95 = load double, ptr %9, align 8, !tbaa !20
  %96 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 23
  %97 = load double, ptr %96, align 8, !tbaa !27
  %98 = fcmp ogt double %95, %97
  br i1 %98, label %99, label %100

99:                                               ; preds = %94, %83
  store i1 true, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %118

100:                                              ; preds = %94
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds double, ptr %101, i64 2
  %103 = load double, ptr %102, align 8, !tbaa !20
  %104 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 16
  %105 = load double, ptr %104, align 8, !tbaa !25
  %106 = fadd double %103, %105
  store double %106, ptr %9, align 8, !tbaa !20
  %107 = load double, ptr %9, align 8, !tbaa !20
  %108 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 24
  %109 = load double, ptr %108, align 8, !tbaa !28
  %110 = fcmp olt double %107, %109
  br i1 %110, label %116, label %111

111:                                              ; preds = %100
  %112 = load double, ptr %9, align 8, !tbaa !20
  %113 = getelementptr inbounds %"class.voro::c_loop_subset", ptr %10, i32 0, i32 25
  %114 = load double, ptr %113, align 8, !tbaa !29
  %115 = fcmp ogt double %112, %114
  br label %116

116:                                              ; preds = %111, %100
  %117 = phi i1 [ true, %100 ], [ %115, %111 ]
  store i1 %117, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %118

118:                                              ; preds = %116, %99, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %119

119:                                              ; preds = %118, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %120 = load i1, ptr %2, align 1
  ret i1 %120
}

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"_ZTSN4voro11c_loop_baseE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 60}
!13 = !{!10, !11, i64 20}
!14 = !{!10, !11, i64 64}
!15 = !{!16, !17, i64 68}
!16 = !{!"_ZTSN4voro13c_loop_subsetE", !10, i64 0, !17, i64 68, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96, !18, i64 104, !18, i64 112, !18, i64 120, !18, i64 128, !18, i64 136, !19, i64 144, !19, i64 145, !19, i64 146, !18, i64 152, !18, i64 160, !18, i64 168, !18, i64 176, !18, i64 184, !18, i64 192, !18, i64 200, !18, i64 208, !18, i64 216, !18, i64 224, !18, i64 232, !18, i64 240, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296, !11, i64 300}
!17 = !{!"_ZTSN4voro18c_loop_subset_modeE", !7, i64 0}
!18 = !{!"double", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!18, !18, i64 0}
!21 = !{!16, !18, i64 152}
!22 = !{!16, !18, i64 200}
!23 = !{!16, !18, i64 160}
!24 = !{!16, !18, i64 208}
!25 = !{!16, !18, i64 168}
!26 = !{!16, !18, i64 216}
!27 = !{!16, !18, i64 224}
!28 = !{!16, !18, i64 232}
!29 = !{!16, !18, i64 240}


; 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(read, inaccessiblemem: none) uwtable
define dso_local noundef zeroext i1 @_ZN4voro13c_loop_subset13out_of_boundsEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(304) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 60
  %5 = load i32, ptr %4, align 4, !tbaa !11
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds ptr, ptr %3, i64 %6
  %8 = load ptr, ptr %7, align 8, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %0, i64 20
  %10 = load i32, ptr %9, align 4, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %0, i64 64
  %12 = load i32, ptr %11, align 8, !tbaa !14
  %13 = mul nsw i32 %12, %10
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds double, ptr %8, i64 %14
  %16 = getelementptr inbounds i8, ptr %0, i64 68
  %17 = load i32, ptr %16, align 4, !tbaa !15
  %18 = icmp eq i32 %17, 0
  %19 = load double, ptr %15, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %0, i64 152
  %21 = load double, ptr %20, align 8, !tbaa !21
  %22 = fadd double %19, %21
  %23 = getelementptr inbounds i8, ptr %0, i64 200
  %24 = load double, ptr %23, align 8, !tbaa !22
  br i1 %18, label %25, label %49

25:                                               ; preds = %1
  %26 = fsub double %22, %24
  %27 = getelementptr inbounds i8, ptr %15, i64 8
  %28 = load double, ptr %27, align 8, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %0, i64 160
  %30 = load double, ptr %29, align 8, !tbaa !23
  %31 = fadd double %28, %30
  %32 = getelementptr inbounds i8, ptr %0, i64 208
  %33 = load double, ptr %32, align 8, !tbaa !24
  %34 = fsub double %31, %33
  %35 = getelementptr inbounds i8, ptr %15, i64 16
  %36 = load double, ptr %35, align 8, !tbaa !20
  %37 = getelementptr inbounds i8, ptr %0, i64 168
  %38 = load double, ptr %37, align 8, !tbaa !25
  %39 = fadd double %36, %38
  %40 = getelementptr inbounds i8, ptr %0, i64 216
  %41 = load double, ptr %40, align 8, !tbaa !26
  %42 = fsub double %39, %41
  %43 = fmul double %34, %34
  %44 = tail call double @llvm.fmuladd.f64(double %26, double %26, double %43)
  %45 = tail call double @llvm.fmuladd.f64(double %42, double %42, double %44)
  %46 = getelementptr inbounds i8, ptr %0, i64 224
  %47 = load double, ptr %46, align 8, !tbaa !27
  %48 = fcmp ogt double %45, %47
  br label %79

49:                                               ; preds = %1
  %50 = fcmp olt double %22, %24
  %51 = getelementptr inbounds i8, ptr %0, i64 208
  %52 = load double, ptr %51, align 8
  %53 = fcmp ogt double %22, %52
  %or.cond = select i1 %50, i1 true, i1 %53
  br i1 %or.cond, label %79, label %54

54:                                               ; preds = %49
  %55 = getelementptr inbounds i8, ptr %15, i64 8
  %56 = load double, ptr %55, align 8, !tbaa !20
  %57 = getelementptr inbounds i8, ptr %0, i64 160
  %58 = load double, ptr %57, align 8, !tbaa !23
  %59 = fadd double %56, %58
  %60 = getelementptr inbounds i8, ptr %0, i64 216
  %61 = load double, ptr %60, align 8, !tbaa !26
  %62 = fcmp olt double %59, %61
  %63 = getelementptr inbounds i8, ptr %0, i64 224
  %64 = load double, ptr %63, align 8
  %65 = fcmp ogt double %59, %64
  %or.cond27 = select i1 %62, i1 true, i1 %65
  br i1 %or.cond27, label %79, label %66

66:                                               ; preds = %54
  %67 = getelementptr inbounds i8, ptr %15, i64 16
  %68 = load double, ptr %67, align 8, !tbaa !20
  %69 = getelementptr inbounds i8, ptr %0, i64 168
  %70 = load double, ptr %69, align 8, !tbaa !25
  %71 = fadd double %68, %70
  %72 = getelementptr inbounds i8, ptr %0, i64 232
  %73 = load double, ptr %72, align 8, !tbaa !28
  %74 = fcmp olt double %71, %73
  %75 = getelementptr inbounds i8, ptr %0, i64 240
  %76 = load double, ptr %75, align 8
  %77 = fcmp ogt double %71, %76
  %78 = select i1 %74, i1 true, i1 %77
  br label %79

79:                                               ; preds = %66, %49, %54, %25
  %.1 = phi i1 [ %48, %25 ], [ %78, %66 ], [ true, %49 ], [ true, %54 ]
  ret i1 %.1
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: 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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !10, i64 24}
!6 = !{!"_ZTSN4voro11c_loop_baseE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 60}
!12 = !{!10, !10, i64 0}
!13 = !{!6, !7, i64 20}
!14 = !{!6, !7, i64 64}
!15 = !{!16, !17, i64 68}
!16 = !{!"_ZTSN4voro13c_loop_subsetE", !6, i64 0, !17, i64 68, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96, !18, i64 104, !18, i64 112, !18, i64 120, !18, i64 128, !18, i64 136, !19, i64 144, !19, i64 145, !19, i64 146, !18, i64 152, !18, i64 160, !18, i64 168, !18, i64 176, !18, i64 184, !18, i64 192, !18, i64 200, !18, i64 208, !18, i64 216, !18, i64 224, !18, i64 232, !18, i64 240, !7, i64 248, !7, i64 252, !7, i64 256, !7, i64 260, !7, i64 264, !7, i64 268, !7, i64 272, !7, i64 276, !7, i64 280, !7, i64 284, !7, i64 288, !7, i64 292, !7, i64 296, !7, i64 300}
!17 = !{!"_ZTSN4voro18c_loop_subset_modeE", !8, i64 0}
!18 = !{!"double", !8, i64 0}
!19 = !{!"bool", !8, i64 0}
!20 = !{!18, !18, i64 0}
!21 = !{!16, !18, i64 152}
!22 = !{!16, !18, i64 200}
!23 = !{!16, !18, i64 160}
!24 = !{!16, !18, i64 208}
!25 = !{!16, !18, i64 168}
!26 = !{!16, !18, i64 216}
!27 = !{!16, !18, i64 224}
!28 = !{!16, !18, i64 232}


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