; LLVM IR from robotics-upo/Heuristic_path_planners :: include/voro++-0.4.6/src (cell)

; 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::voronoicell_base" = type { ptr, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, double, double, double, double }

@.str.19 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4voro16voronoicell_base15output_verticesEdddP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(160) %0, double noundef %1, double noundef %2, double noundef %3, ptr noundef %4) #3 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store double %2, ptr %8, align 8, !tbaa !9
  store double %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  %12 = load ptr, ptr %6, align 8
  %13 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %12, i32 0, i32 5
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %16, label %71

16:                                               ; preds = %5
  %17 = load ptr, ptr %10, align 8, !tbaa !5
  %18 = load double, ptr %7, align 8, !tbaa !9
  %19 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %12, i32 0, i32 9
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = load double, ptr %20, align 8, !tbaa !9
  %22 = call double @llvm.fmuladd.f64(double %21, double 5.000000e-01, double %18)
  %23 = load double, ptr %8, align 8, !tbaa !9
  %24 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %12, i32 0, i32 9
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  %26 = getelementptr inbounds double, ptr %25, i64 1
  %27 = load double, ptr %26, align 8, !tbaa !9
  %28 = call double @llvm.fmuladd.f64(double %27, double 5.000000e-01, double %23)
  %29 = load double, ptr %9, align 8, !tbaa !9
  %30 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %12, i32 0, i32 9
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  %32 = getelementptr inbounds double, ptr %31, i64 2
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = call double @llvm.fmuladd.f64(double %33, double 5.000000e-01, double %29)
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str.19, double noundef %22, double noundef %28, double noundef %34) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %36 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %12, i32 0, i32 9
  %37 = load ptr, ptr %36, align 8, !tbaa !14
  %38 = getelementptr inbounds double, ptr %37, i64 3
  store ptr %38, ptr %11, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %67, %16
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %12, i32 0, i32 9
  %42 = load ptr, ptr %41, align 8, !tbaa !14
  %43 = getelementptr inbounds %"class.voro::voronoicell_base", ptr %12, i32 0, i32 5
  %44 = load i32, ptr %43, align 8, !tbaa !11
  %45 = mul nsw i32 3, %44
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds double, ptr %42, i64 %46
  %48 = icmp ult ptr %40, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %70

50:                                               ; preds = %39
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = load double, ptr %7, align 8, !tbaa !9
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = load double, ptr %53, align 8, !tbaa !9
  %55 = call double @llvm.fmuladd.f64(double %54, double 5.000000e-01, double %52)
  %56 = load double, ptr %8, align 8, !tbaa !9
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = getelementptr inbounds double, ptr %57, i64 1
  %59 = load double, ptr %58, align 8, !tbaa !9
  %60 = call double @llvm.fmuladd.f64(double %59, double 5.000000e-01, double %56)
  %61 = load double, ptr %9, align 8, !tbaa !9
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = getelementptr inbounds double, ptr %62, i64 2
  %64 = load double, ptr %63, align 8, !tbaa !9
  %65 = call double @llvm.fmuladd.f64(double %64, double 5.000000e-01, double %61)
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef @.str.20, double noundef %55, double noundef %60, double noundef %65) #4
  br label %67

67:                                               ; preds = %50
  %68 = load ptr, ptr %11, align 8, !tbaa !5
  %69 = getelementptr inbounds double, ptr %68, i64 3
  store ptr %69, ptr %11, align 8, !tbaa !5
  br label %39, !llvm.loop !15

70:                                               ; preds = %49
  br label %71

71:                                               ; preds = %70, %5
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind "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 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 #4 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 24}
!12 = !{!"_ZTSN4voro16voronoicell_baseE", !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !13, i64 112, !13, i64 116, !6, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !6, i64 48}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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

@.str.19 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [12 x i8], align 1

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local void @_ZN4voro16voronoicell_base15output_verticesEdddP8_IO_FILE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(160) %0, double noundef %1, double noundef %2, double noundef %3, ptr nocapture noundef %4) local_unnamed_addr #2 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %9, label %.loopexit

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = load double, ptr %11, align 8, !tbaa !13
  %13 = tail call double @llvm.fmuladd.f64(double %12, double 5.000000e-01, double %1)
  %14 = getelementptr inbounds i8, ptr %11, i64 8
  %15 = load double, ptr %14, align 8, !tbaa !13
  %16 = tail call double @llvm.fmuladd.f64(double %15, double 5.000000e-01, double %2)
  %17 = getelementptr inbounds i8, ptr %11, i64 16
  %18 = load double, ptr %17, align 8, !tbaa !13
  %19 = tail call double @llvm.fmuladd.f64(double %18, double 5.000000e-01, double %3)
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.19, double noundef %13, double noundef %16, double noundef %19) #3
  %21 = load i32, ptr %6, align 8, !tbaa !5
  %22 = icmp sgt i32 %21, 1
  br i1 %22, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %9
  %23 = load ptr, ptr %10, align 8, !tbaa !12
  %.014 = getelementptr inbounds i8, ptr %23, i64 24
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.016 = phi ptr [ %.0, %.lr.ph ], [ %.014, %.lr.ph.preheader ]
  %.pn15 = phi ptr [ %.016, %.lr.ph ], [ %23, %.lr.ph.preheader ]
  %24 = load double, ptr %.016, align 8, !tbaa !13
  %25 = tail call double @llvm.fmuladd.f64(double %24, double 5.000000e-01, double %1)
  %26 = getelementptr inbounds i8, ptr %.pn15, i64 32
  %27 = load double, ptr %26, align 8, !tbaa !13
  %28 = tail call double @llvm.fmuladd.f64(double %27, double 5.000000e-01, double %2)
  %29 = getelementptr inbounds i8, ptr %.pn15, i64 40
  %30 = load double, ptr %29, align 8, !tbaa !13
  %31 = tail call double @llvm.fmuladd.f64(double %30, double 5.000000e-01, double %3)
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.20, double noundef %25, double noundef %28, double noundef %31) #3
  %.0 = getelementptr inbounds i8, ptr %.016, i64 24
  %33 = load ptr, ptr %10, align 8, !tbaa !12
  %34 = load i32, ptr %6, align 8, !tbaa !5
  %35 = mul nsw i32 %34, 3
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds double, ptr %33, i64 %36
  %38 = icmp ult ptr %.0, %37
  br i1 %38, label %.lr.ph, label %.loopexit, !llvm.loop !14

.loopexit:                                        ; preds = %.lr.ph, %9, %5
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nofree nounwind "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 nofree 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 = { 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, !7, i64 24}
!6 = !{!"_ZTSN4voro16voronoicell_baseE", !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !7, i64 112, !7, i64 116, !10, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !10, i64 48}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass