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

; 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_pockets = type { ptr, ptr, ptr, i64, ptr }
%struct.node_pocket = type { ptr, ptr, ptr }
%struct.s_pocket = type { ptr, ptr, float, float, float, float, [3 x float], i32, i32, i32, i32 }
%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 }

@.str = external hidden unnamed_addr constant [18 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: nounwind uwtable
define dso_local void @writeAlphaSpheresToFile(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  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) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store ptr null, ptr %11, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.c_lst_pockets, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %16

16:                                               ; preds = %60, %2
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %22

19:                                               ; preds = %16
  %20 = load i32, ptr %12, align 4, !tbaa !12
  %21 = icmp slt i32 %20, 1
  br label %22

22:                                               ; preds = %19, %16
  %23 = phi i1 [ false, %16 ], [ %21, %19 ]
  br i1 %23, label %24, label %66

24:                                               ; preds = %22
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.node_pocket, ptr %25, i32 0, i32 2
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  store ptr %27, ptr %9, align 8, !tbaa !5
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.s_pocket, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = getelementptr inbounds %struct.c_lst_vertices, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  store ptr %32, ptr %10, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %36, %24
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %60

36:                                               ; preds = %33
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.node_vertice, ptr %37, i32 0, i32 2
  %39 = load ptr, ptr %38, align 8, !tbaa !21
  store ptr %39, ptr %11, align 8, !tbaa !5
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.s_vvertice, ptr %40, i32 0, i32 6
  %42 = load float, ptr %41, align 8, !tbaa !23
  store float %42, ptr %5, align 4, !tbaa !25
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.s_vvertice, ptr %43, i32 0, i32 7
  %45 = load float, ptr %44, align 4, !tbaa !26
  store float %45, ptr %6, align 4, !tbaa !25
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.s_vvertice, ptr %46, i32 0, i32 8
  %48 = load float, ptr %47, align 8, !tbaa !27
  store float %48, ptr %7, align 4, !tbaa !25
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = load float, ptr %5, align 4, !tbaa !25
  %51 = fpext float %50 to double
  %52 = load float, ptr %6, align 4, !tbaa !25
  %53 = fpext float %52 to double
  %54 = load float, ptr %7, align 4, !tbaa !25
  %55 = fpext float %54 to double
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str, double noundef %51, double noundef %53, double noundef %55) #3
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.node_vertice, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !28
  store ptr %59, ptr %10, align 8, !tbaa !5
  br label %33, !llvm.loop !29

60:                                               ; preds = %33
  %61 = load i32, ptr %12, align 4, !tbaa !12
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %12, align 4, !tbaa !12
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.node_pocket, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !31
  store ptr %65, ptr %8, align 8, !tbaa !5
  br label %16, !llvm.loop !32

66:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 = !{!10, !6, i64 0}
!10 = !{!"c_lst_pockets", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"node_pocket", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!17, !6, i64 8}
!17 = !{!"s_pocket", !6, i64 0, !6, i64 8, !18, i64 16, !18, i64 20, !18, i64 24, !18, i64 28, !7, i64 32, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56}
!18 = !{!"float", !7, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"c_lst_vertices", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!21 = !{!22, !6, i64 16}
!22 = !{!"node_vertice", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!24, !18, i64 24}
!24 = !{!"s_vvertice", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !18, i64 20, !18, i64 24, !18, i64 28, !18, i64 32, !13, i64 36, !13, i64 40, !7, i64 44, !7, i64 64, !7, i64 96, !18, i64 108}
!25 = !{!18, !18, i64 0}
!26 = !{!24, !18, i64 28}
!27 = !{!24, !18, i64 32}
!28 = !{!22, !6, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!15, !6, i64 0}
!32 = distinct !{!32, !30}


; 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 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local void @writeAlphaSpheresToFile(ptr nocapture noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %.01721 = load ptr, ptr %1, align 8, !tbaa !5
  %.not24 = icmp eq ptr %.01721, null
  br i1 %.not24, label %._crit_edge, label %.lr.ph23.preheader

.lr.ph23.preheader:                               ; preds = %2
  %3 = getelementptr inbounds i8, ptr %.01721, i64 16
  %4 = load ptr, ptr %3, align 8, !tbaa !9
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %.01618 = load ptr, ptr %6, align 8, !tbaa !5
  %.not19 = icmp eq ptr %.01618, null
  br i1 %.not19, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph23.preheader, %.lr.ph
  %.01620 = phi ptr [ %.016, %.lr.ph ], [ %.01618, %.lr.ph23.preheader ]
  %7 = getelementptr inbounds i8, ptr %.01620, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %8, i64 24
  %10 = load float, ptr %9, align 8, !tbaa !17
  %11 = getelementptr inbounds i8, ptr %8, i64 28
  %12 = load float, ptr %11, align 4, !tbaa !19
  %13 = getelementptr inbounds i8, ptr %8, i64 32
  %14 = load float, ptr %13, align 8, !tbaa !20
  %15 = fpext float %10 to double
  %16 = fpext float %12 to double
  %17 = fpext float %14 to double
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str, double noundef %15, double noundef %16, double noundef %17) #2
  %.016 = load ptr, ptr %.01620, align 8, !tbaa !5
  %.not = icmp eq ptr %.016, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !21

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph23.preheader, %2
  ret void
}

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

attributes #0 = { 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 #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 = { 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, !6, i64 16}
!10 = !{!"node_pocket", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!12, !6, i64 8}
!12 = !{!"s_pocket", !6, i64 0, !6, i64 8, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !7, i64 32, !14, i64 44, !14, i64 48, !14, i64 52, !14, i64 56}
!13 = !{!"float", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 16}
!16 = !{!"node_vertice", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!18, !13, i64 24}
!18 = !{!"s_vvertice", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !14, i64 36, !14, i64 40, !7, i64 44, !7, i64 64, !7, i64 96, !13, i64 108}
!19 = !{!18, !13, i64 28}
!20 = !{!18, !13, i64 32}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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