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

; 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.s_clusterlib_vertices = type { ptr, ptr, [3 x double], i32, i8, i8 }
%struct.s_lst_vvertice = type { ptr, ptr, ptr, i32, ptr, i32, 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
declare dso_local ptr @get_3d_array_from_vvertice_list(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @get_mask(i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @prepare_vertices_for_cluster_lib(ptr noundef %0, i8 noundef signext %1, i8 noundef signext %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i8 %1, ptr %5, align 1, !tbaa !9
  store i8 %2, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %8 = call ptr @my_malloc(i64 noundef 48)
  store ptr %8, ptr %7, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = call ptr @get_3d_array_from_vvertice_list(ptr noundef %9)
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.s_clusterlib_vertices, ptr %11, i32 0, i32 0
  store ptr %10, ptr %12, align 8, !tbaa !10
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.s_lst_vvertice, ptr %13, i32 0, i32 5
  %15 = load i32, ptr %14, align 8, !tbaa !13
  %16 = call ptr @get_mask(i32 noundef %15)
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.s_clusterlib_vertices, ptr %17, i32 0, i32 1
  store ptr %16, ptr %18, align 8, !tbaa !15
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.s_clusterlib_vertices, ptr %19, i32 0, i32 2
  %21 = getelementptr inbounds [3 x double], ptr %20, i64 0, i64 0
  store double 1.000000e+00, ptr %21, align 8, !tbaa !16
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.s_clusterlib_vertices, ptr %22, i32 0, i32 2
  %24 = getelementptr inbounds [3 x double], ptr %23, i64 0, i64 1
  store double 1.000000e+00, ptr %24, align 8, !tbaa !16
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.s_clusterlib_vertices, ptr %25, i32 0, i32 2
  %27 = getelementptr inbounds [3 x double], ptr %26, i64 0, i64 2
  store double 1.000000e+00, ptr %27, align 8, !tbaa !16
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.s_clusterlib_vertices, ptr %28, i32 0, i32 3
  store i32 0, ptr %29, align 8, !tbaa !18
  %30 = load i8, ptr %6, align 1, !tbaa !9
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.s_clusterlib_vertices, ptr %31, i32 0, i32 4
  store i8 %30, ptr %32, align 4, !tbaa !19
  %33 = load i8, ptr %5, align 1, !tbaa !9
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.s_clusterlib_vertices, ptr %34, i32 0, i32 5
  store i8 %33, ptr %35, align 1, !tbaa !20
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret ptr %36
}

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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 0}
!11 = !{!"s_clusterlib_vertices", !6, i64 0, !6, i64 8, !7, i64 16, !12, i64 40, !7, i64 44, !7, i64 45}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 40}
!14 = !{!"s_lst_vvertice", !6, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !6, i64 32, !12, i64 40, !12, i64 44}
!15 = !{!11, !6, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!11, !12, i64 40}
!19 = !{!11, !7, i64 44}
!20 = !{!11, !7, i64 45}


; 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
declare dso_local ptr @get_3d_array_from_vvertice_list(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @get_mask(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @prepare_vertices_for_cluster_lib(ptr noundef %0, i8 noundef signext %1, i8 noundef signext %2) local_unnamed_addr #1 {
  %4 = tail call ptr @my_malloc(i64 noundef 48) #2
  %5 = tail call ptr @get_3d_array_from_vvertice_list(ptr noundef %0)
  store ptr %5, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = load i32, ptr %6, align 8, !tbaa !11
  %8 = tail call ptr @get_mask(i32 noundef %7)
  %9 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %8, ptr %9, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %4, i64 16
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %10, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %4, i64 32
  store double 1.000000e+00, ptr %11, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %4, i64 40
  store i32 0, ptr %12, align 8, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %4, i64 44
  store i8 %2, ptr %13, align 4, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %4, i64 45
  store i8 %1, ptr %14, align 1, !tbaa !18
  ret ptr %4
}

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, !7, i64 0}
!6 = !{!"s_clusterlib_vertices", !7, i64 0, !7, i64 8, !8, i64 16, !10, i64 40, !8, i64 44, !8, i64 45}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !10, i64 40}
!12 = !{!"s_lst_vvertice", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !7, i64 32, !10, i64 40, !10, i64 44}
!13 = !{!6, !7, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = !{!6, !10, i64 40}
!17 = !{!6, !8, i64 44}
!18 = !{!6, !8, i64 45}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass