; LLVM IR from Discngine/fpocket :: src (voronoi_lst)

; 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.c_lst_vertices = type { ptr, ptr, ptr, i64 }
%struct.node_vertice = type { ptr, ptr, ptr }
%struct.s_vvertice = type { i32, i32, i32, i32, i32, float, float, float, float, i32, i32, [4 x i32], [4 x ptr], [3 x float], float }
%struct.s_atm = type { i32, float, float, float, float, float, float, float, [5 x i8], [7 x i8], [16 x i8], [16 x i8], [3 x i8], [8 x i8], i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, i8, i8, float, float, float, float, i16, ptr, i32 }

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

declare ptr @my_malloc(i64 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @get_vert_contacted_atms(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.c_lst_vertices, ptr %12, i32 0, i32 3
  %14 = load i64, ptr %13, align 8, !tbaa !11
  %15 = mul i64 %14, 4
  %16 = call ptr @llvm.stacksave.p0()
  store ptr %16, ptr %7, align 8
  %17 = alloca i32, i64 %15, align 16
  store i64 %15, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.c_lst_vertices, ptr %18, i32 0, i32 3
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = mul i64 8, %20
  %22 = mul i64 %21, 4
  %23 = call ptr @my_malloc(i64 noundef %22)
  store ptr %23, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.c_lst_vertices, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !14
  store ptr %26, ptr %10, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %76, %2
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %80

30:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.node_vertice, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  store ptr %33, ptr %11, align 8, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %73, %30
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = icmp slt i32 %35, 4
  br i1 %36, label %37, label %76

37:                                               ; preds = %34
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.s_vvertice, ptr %39, i32 0, i32 12
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [4 x ptr], ptr %40, i64 0, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.s_atm, ptr %44, i32 0, i32 14
  %46 = load i32, ptr %45, align 8, !tbaa !17
  %47 = call i32 @in_tab(ptr noundef %17, i32 noundef %38, i32 noundef %46)
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %72, label %49

49:                                               ; preds = %37
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.s_vvertice, ptr %50, i32 0, i32 12
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [4 x ptr], ptr %51, i64 0, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds ptr, ptr %56, i64 %58
  store ptr %55, ptr %59, align 8, !tbaa !5
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.s_atm, ptr %64, i32 0, i32 14
  %66 = load i32, ptr %65, align 8, !tbaa !17
  %67 = load i32, ptr %6, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i32, ptr %17, i64 %68
  store i32 %66, ptr %69, align 4, !tbaa !9
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %6, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %49, %37
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %5, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %5, align 4, !tbaa !9
  br label %34, !llvm.loop !21

76:                                               ; preds = %34
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.node_vertice, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !23
  store ptr %79, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %27, !llvm.loop !24

80:                                               ; preds = %27
  %81 = load i32, ptr %6, align 4, !tbaa !9
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  store i32 %81, ptr %82, align 4, !tbaa !9
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %84 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %84)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret ptr %83
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

declare i32 @in_tab(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = { nocallback nofree nosync nounwind willreturn }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 24}
!12 = !{!"c_lst_vertices", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 0}
!15 = !{!16, !6, i64 16}
!16 = !{!"node_vertice", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!18, !10, i64 88}
!18 = !{!"s_atm", !10, i64 0, !19, i64 4, !19, i64 8, !19, i64 12, !19, i64 16, !19, i64 20, !19, i64 24, !19, i64 28, !7, i64 32, !7, i64 37, !7, i64 44, !7, i64 60, !7, i64 76, !7, i64 79, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !19, i64 116, !19, i64 120, !19, i64 124, !19, i64 128, !19, i64 132, !19, i64 136, !19, i64 140, !7, i64 144, !7, i64 145, !19, i64 148, !19, i64 152, !19, i64 156, !19, i64 160, !20, i64 164, !6, i64 168, !10, i64 176}
!19 = !{!"float", !7, i64 0}
!20 = !{!"short", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!16, !6, i64 0}
!24 = distinct !{!24, !22}


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

declare ptr @my_malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @get_vert_contacted_atms(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = shl i64 %4, 2
  %6 = alloca i32, i64 %5, align 16
  %7 = shl i64 %4, 5
  %8 = tail call ptr @my_malloc(i64 noundef %7) #2
  %.02227 = load ptr, ptr %0, align 8, !tbaa !11
  %.not28 = icmp eq ptr %.02227, null
  br i1 %.not28, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %.loopexit
  %.02230 = phi ptr [ %.022, %.loopexit ], [ %.02227, %2 ]
  %.02329 = phi i32 [ %.2.3, %.loopexit ], [ 0, %2 ]
  %9 = getelementptr inbounds i8, ptr %.02230, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %10, i64 64
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %12, i64 88
  %14 = load i32, ptr %13, align 8, !tbaa !14
  %15 = call i32 @in_tab(ptr noundef nonnull %6, i32 noundef %.02329, i32 noundef %14) #2
  %.not24 = icmp eq i32 %15, 0
  br i1 %.not24, label %16, label %24

16:                                               ; preds = %.lr.ph
  %17 = load ptr, ptr %11, align 8, !tbaa !11
  %18 = sext i32 %.02329 to i64
  %19 = getelementptr inbounds ptr, ptr %8, i64 %18
  store ptr %17, ptr %19, align 8, !tbaa !11
  %20 = getelementptr inbounds i8, ptr %17, i64 88
  %21 = load i32, ptr %20, align 8, !tbaa !14
  %22 = getelementptr inbounds i32, ptr %6, i64 %18
  store i32 %21, ptr %22, align 4, !tbaa !19
  %23 = add nsw i32 %.02329, 1
  br label %24

24:                                               ; preds = %.lr.ph, %16
  %.2 = phi i32 [ %.02329, %.lr.ph ], [ %23, %16 ]
  %25 = getelementptr inbounds i8, ptr %10, i64 72
  %26 = load ptr, ptr %25, align 8, !tbaa !11
  %27 = getelementptr inbounds i8, ptr %26, i64 88
  %28 = load i32, ptr %27, align 8, !tbaa !14
  %29 = call i32 @in_tab(ptr noundef nonnull %6, i32 noundef %.2, i32 noundef %28) #2
  %.not24.1 = icmp eq i32 %29, 0
  br i1 %.not24.1, label %30, label %38

30:                                               ; preds = %24
  %31 = load ptr, ptr %25, align 8, !tbaa !11
  %32 = sext i32 %.2 to i64
  %33 = getelementptr inbounds ptr, ptr %8, i64 %32
  store ptr %31, ptr %33, align 8, !tbaa !11
  %34 = getelementptr inbounds i8, ptr %31, i64 88
  %35 = load i32, ptr %34, align 8, !tbaa !14
  %36 = getelementptr inbounds i32, ptr %6, i64 %32
  store i32 %35, ptr %36, align 4, !tbaa !19
  %37 = add nsw i32 %.2, 1
  br label %38

38:                                               ; preds = %30, %24
  %.2.1 = phi i32 [ %.2, %24 ], [ %37, %30 ]
  %39 = getelementptr inbounds i8, ptr %10, i64 80
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = getelementptr inbounds i8, ptr %40, i64 88
  %42 = load i32, ptr %41, align 8, !tbaa !14
  %43 = call i32 @in_tab(ptr noundef nonnull %6, i32 noundef %.2.1, i32 noundef %42) #2
  %.not24.2 = icmp eq i32 %43, 0
  br i1 %.not24.2, label %44, label %52

44:                                               ; preds = %38
  %45 = load ptr, ptr %39, align 8, !tbaa !11
  %46 = sext i32 %.2.1 to i64
  %47 = getelementptr inbounds ptr, ptr %8, i64 %46
  store ptr %45, ptr %47, align 8, !tbaa !11
  %48 = getelementptr inbounds i8, ptr %45, i64 88
  %49 = load i32, ptr %48, align 8, !tbaa !14
  %50 = getelementptr inbounds i32, ptr %6, i64 %46
  store i32 %49, ptr %50, align 4, !tbaa !19
  %51 = add nsw i32 %.2.1, 1
  br label %52

52:                                               ; preds = %44, %38
  %.2.2 = phi i32 [ %.2.1, %38 ], [ %51, %44 ]
  %53 = getelementptr inbounds i8, ptr %10, i64 88
  %54 = load ptr, ptr %53, align 8, !tbaa !11
  %55 = getelementptr inbounds i8, ptr %54, i64 88
  %56 = load i32, ptr %55, align 8, !tbaa !14
  %57 = call i32 @in_tab(ptr noundef nonnull %6, i32 noundef %.2.2, i32 noundef %56) #2
  %.not24.3 = icmp eq i32 %57, 0
  br i1 %.not24.3, label %58, label %.loopexit

58:                                               ; preds = %52
  %59 = load ptr, ptr %53, align 8, !tbaa !11
  %60 = sext i32 %.2.2 to i64
  %61 = getelementptr inbounds ptr, ptr %8, i64 %60
  store ptr %59, ptr %61, align 8, !tbaa !11
  %62 = getelementptr inbounds i8, ptr %59, i64 88
  %63 = load i32, ptr %62, align 8, !tbaa !14
  %64 = getelementptr inbounds i32, ptr %6, i64 %60
  store i32 %63, ptr %64, align 4, !tbaa !19
  %65 = add nsw i32 %.2.2, 1
  br label %.loopexit

.loopexit:                                        ; preds = %58, %52
  %.2.3 = phi i32 [ %.2.2, %52 ], [ %65, %58 ]
  %.022 = load ptr, ptr %.02230, align 8, !tbaa !11
  %.not = icmp eq ptr %.022, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !20

._crit_edge:                                      ; preds = %.loopexit, %2
  %.023.lcssa = phi i32 [ 0, %2 ], [ %.2.3, %.loopexit ]
  store i32 %.023.lcssa, ptr %1, align 4, !tbaa !19
  ret ptr %8
}

declare i32 @in_tab(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

attributes #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 = { 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 = { 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, !10, i64 24}
!6 = !{!"c_lst_vertices", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !7, i64 16}
!13 = !{!"node_vertice", !7, i64 0, !7, i64 8, !7, i64 16}
!14 = !{!15, !16, i64 88}
!15 = !{!"s_atm", !16, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !8, i64 32, !8, i64 37, !8, i64 44, !8, i64 60, !8, i64 76, !8, i64 79, !16, i64 88, !16, i64 92, !16, i64 96, !16, i64 100, !16, i64 104, !16, i64 108, !16, i64 112, !17, i64 116, !17, i64 120, !17, i64 124, !17, i64 128, !17, i64 132, !17, i64 136, !17, i64 140, !8, i64 144, !8, i64 145, !17, i64 148, !17, i64 152, !17, i64 156, !17, i64 160, !18, i64 164, !7, i64 168, !16, i64 176}
!16 = !{!"int", !8, i64 0}
!17 = !{!"float", !8, i64 0}
!18 = !{!"short", !8, i64 0}
!19 = !{!16, !16, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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