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

; 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_fparams = type { [2000 x i8], [2000 x i8], [2000 x i8], [8000 x i8], ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, i8, i8, i32, i32, i16, i32, i32, i32, i16, i32, i32, i32, i16, float, float, float, float, float, [20 x ptr], i16, i16, [20 x ptr], i32, [10 x i8] }
%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 }

; 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 float @set_overlap_volumes(ptr noundef %0, ptr noundef %1, i32 noundef %2, float noundef %3, ptr noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !11
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  store i32 0, ptr %13, align 4, !tbaa !9
  %14 = load ptr, ptr %10, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.s_fparams, ptr %14, i32 0, i32 23
  %16 = load i32, ptr %15, align 8, !tbaa !13
  %17 = icmp sle i32 %16, 0
  br i1 %17, label %18, label %22

18:                                               ; preds = %5
  store ptr @set_mc_overlap_volume, ptr %11, align 8, !tbaa !5
  %19 = load ptr, ptr %10, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.s_fparams, ptr %19, i32 0, i32 22
  %21 = load i32, ptr %20, align 4, !tbaa !16
  store i32 %21, ptr %12, align 4, !tbaa !9
  br label %26

22:                                               ; preds = %5
  store ptr @set_basic_overlap_volume, ptr %11, align 8, !tbaa !5
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.s_fparams, ptr %23, i32 0, i32 23
  %25 = load i32, ptr %24, align 8, !tbaa !13
  store i32 %25, ptr %12, align 4, !tbaa !9
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %22, %18
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.s_pocket, ptr %27, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = getelementptr inbounds %struct.c_lst_vertices, ptr %29, i32 0, i32 3
  %31 = load i64, ptr %30, align 8, !tbaa !19
  %32 = icmp ugt i64 %31, 150
  br i1 %32, label %33, label %41

33:                                               ; preds = %26
  %34 = load i32, ptr %13, align 4, !tbaa !9
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %40

36:                                               ; preds = %33
  %37 = load i32, ptr %12, align 4, !tbaa !9
  %38 = icmp slt i32 %37, 20000
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i32 20000, ptr %12, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %39, %36, %33
  br label %41

41:                                               ; preds = %40, %26
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = load float, ptr %9, align 4, !tbaa !11
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = load i32, ptr %12, align 4, !tbaa !9
  %48 = call float %42(ptr noundef %43, i32 noundef %44, float noundef %45, ptr noundef %46, i32 noundef %47)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  ret float %48
}

; Function Attrs: nounwind uwtable
declare dso_local float @set_mc_overlap_volume(ptr noundef, i32 noundef, float noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local float @set_basic_overlap_volume(ptr noundef, i32 noundef, float noundef, ptr noundef, i32 noundef) #1

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 }

!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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 14096}
!14 = !{!"s_fparams", !7, i64 0, !7, i64 2000, !7, i64 4000, !7, i64 6000, !6, i64 14000, !6, i64 14008, !6, i64 14016, !10, i64 14024, !10, i64 14028, !6, i64 14032, !6, i64 14040, !6, i64 14048, !7, i64 14056, !7, i64 14057, !10, i64 14060, !10, i64 14064, !15, i64 14068, !10, i64 14072, !10, i64 14076, !10, i64 14080, !15, i64 14084, !10, i64 14088, !10, i64 14092, !10, i64 14096, !15, i64 14100, !12, i64 14104, !12, i64 14108, !12, i64 14112, !12, i64 14116, !12, i64 14120, !7, i64 14128, !15, i64 14288, !15, i64 14290, !7, i64 14296, !10, i64 14456, !7, i64 14460}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !10, i64 14092}
!17 = !{!18, !6, i64 8}
!18 = !{!"s_pocket", !6, i64 0, !6, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !7, i64 32, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56}
!19 = !{!20, !21, i64 24}
!20 = !{!"c_lst_vertices", !6, i64 0, !6, i64 8, !6, i64 16, !21, i64 24}
!21 = !{!"long", !7, i64 0}


; 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: nounwind uwtable
define dso_local float @set_overlap_volumes(ptr noundef %0, ptr noundef %1, i32 noundef %2, float noundef %3, ptr nocapture noundef readonly %4) local_unnamed_addr #0 {
  %6 = getelementptr inbounds i8, ptr %4, i64 14096
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp slt i32 %7, 1
  br i1 %8, label %9, label %12

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %4, i64 14092
  %11 = load i32, ptr %10, align 4, !tbaa !13
  br label %12

12:                                               ; preds = %5, %9
  %.013 = phi ptr [ @set_mc_overlap_volume, %9 ], [ @set_basic_overlap_volume, %5 ]
  %.012 = phi i32 [ %11, %9 ], [ %7, %5 ]
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %14, i64 24
  %16 = load i64, ptr %15, align 8, !tbaa !16
  %17 = icmp ugt i64 %16, 150
  %18 = tail call i32 @llvm.smax.i32(i32 %.012, i32 20000)
  %19 = and i1 %8, %17
  %.1 = select i1 %19, i32 %18, i32 %.012
  %20 = tail call float %.013(ptr noundef %1, i32 noundef %2, float noundef %3, ptr noundef %0, i32 noundef %.1) #2, !callees !19
  ret float %20
}

; Function Attrs: nounwind uwtable
declare dso_local float @set_mc_overlap_volume(ptr noundef, i32 noundef, float noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local float @set_basic_overlap_volume(ptr noundef, i32 noundef, float noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

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

attributes #0 = { 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 speculatable willreturn memory(none) }
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 14096}
!6 = !{!"s_fparams", !7, i64 0, !7, i64 2000, !7, i64 4000, !7, i64 6000, !9, i64 14000, !9, i64 14008, !9, i64 14016, !10, i64 14024, !10, i64 14028, !9, i64 14032, !9, i64 14040, !9, i64 14048, !7, i64 14056, !7, i64 14057, !10, i64 14060, !10, i64 14064, !11, i64 14068, !10, i64 14072, !10, i64 14076, !10, i64 14080, !11, i64 14084, !10, i64 14088, !10, i64 14092, !10, i64 14096, !11, i64 14100, !12, i64 14104, !12, i64 14108, !12, i64 14112, !12, i64 14116, !12, i64 14120, !7, i64 14128, !11, i64 14288, !11, i64 14290, !7, i64 14296, !10, i64 14456, !7, i64 14460}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!6, !10, i64 14092}
!14 = !{!15, !9, i64 8}
!15 = !{!"s_pocket", !9, i64 0, !9, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !7, i64 32, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56}
!16 = !{!17, !18, i64 24}
!17 = !{!"c_lst_vertices", !9, i64 0, !9, i64 8, !9, i64 16, !18, i64 24}
!18 = !{!"long", !7, i64 0}
!19 = !{ptr @set_basic_overlap_volume, ptr @set_mc_overlap_volume}


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