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

; 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 @atom_in_explicit_pocket(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca float, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %90, %2
  %9 = load i32, ptr %6, align 4, !tbaa !9
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.s_fparams, ptr %10, i32 0, i32 8
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = icmp slt i32 %9, %12
  br i1 %13, label %14, label %93

14:                                               ; preds = %8
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.s_fparams, ptr %15, i32 0, i32 11
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds i16, ptr %17, i64 %19
  %21 = load i16, ptr %20, align 2, !tbaa !16
  %22 = zext i16 %21 to i32
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.s_atm, ptr %23, i32 0, i32 16
  %25 = load i32, ptr %24, align 8, !tbaa !17
  %26 = icmp eq i32 %22, %25
  br i1 %26, label %27, label %89

27:                                               ; preds = %14
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.s_fparams, ptr %28, i32 0, i32 9
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i8, ptr %30, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !20
  %35 = sext i8 %34 to i32
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.s_atm, ptr %36, i32 0, i32 10
  %38 = getelementptr inbounds [16 x i8], ptr %37, i64 0, i64 0
  %39 = load i8, ptr %38, align 4, !tbaa !20
  %40 = sext i8 %39 to i32
  %41 = icmp eq i32 %35, %40
  br i1 %41, label %42, label %89

42:                                               ; preds = %27
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.s_fparams, ptr %43, i32 0, i32 10
  %45 = load ptr, ptr %44, align 8, !tbaa !21
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i8, ptr %45, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !20
  %50 = sext i8 %49 to i32
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.s_atm, ptr %51, i32 0, i32 28
  %53 = load i8, ptr %52, align 8, !tbaa !22
  %54 = sext i8 %53 to i32
  %55 = icmp eq i32 %50, %54
  br i1 %55, label %88, label %56

56:                                               ; preds = %42
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.s_fparams, ptr %57, i32 0, i32 10
  %59 = load ptr, ptr %58, align 8, !tbaa !21
  %60 = load i32, ptr %6, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i8, ptr %59, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !20
  %64 = sext i8 %63 to i32
  %65 = icmp eq i32 %64, 45
  br i1 %65, label %66, label %72

66:                                               ; preds = %56
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.s_atm, ptr %67, i32 0, i32 28
  %69 = load i8, ptr %68, align 8, !tbaa !22
  %70 = sext i8 %69 to i32
  %71 = icmp eq i32 %70, 32
  br i1 %71, label %88, label %72

72:                                               ; preds = %66, %56
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.s_fparams, ptr %73, i32 0, i32 10
  %75 = load ptr, ptr %74, align 8, !tbaa !21
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i8, ptr %75, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !20
  %80 = sext i8 %79 to i32
  %81 = icmp eq i32 %80, 45
  br i1 %81, label %82, label %89

82:                                               ; preds = %72
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.s_atm, ptr %83, i32 0, i32 28
  %85 = load i8, ptr %84, align 8, !tbaa !22
  %86 = sext i8 %85 to i32
  %87 = icmp eq i32 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %82, %66, %42
  store float 1.000000e+00, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %94

89:                                               ; preds = %82, %72, %27, %14
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %6, align 4, !tbaa !9
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %6, align 4, !tbaa !9
  br label %8, !llvm.loop !23

93:                                               ; preds = %8
  store float 0.000000e+00, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %94

94:                                               ; preds = %93, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  %95 = load float, ptr %3, align 4
  ret float %95
}

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, !10, i64 14028}
!12 = !{!"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, !13, i64 14068, !10, i64 14072, !10, i64 14076, !10, i64 14080, !13, i64 14084, !10, i64 14088, !10, i64 14092, !10, i64 14096, !13, i64 14100, !14, i64 14104, !14, i64 14108, !14, i64 14112, !14, i64 14116, !14, i64 14120, !7, i64 14128, !13, i64 14288, !13, i64 14290, !7, i64 14296, !10, i64 14456, !7, i64 14460}
!13 = !{!"short", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!12, !6, i64 14048}
!16 = !{!13, !13, i64 0}
!17 = !{!18, !10, i64 96}
!18 = !{!"s_atm", !10, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, 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, !14, i64 116, !14, i64 120, !14, i64 124, !14, i64 128, !14, i64 132, !14, i64 136, !14, i64 140, !7, i64 144, !7, i64 145, !14, i64 148, !14, i64 152, !14, i64 156, !14, i64 160, !13, i64 164, !6, i64 168, !10, i64 176}
!19 = !{!12, !6, i64 14032}
!20 = !{!7, !7, i64 0}
!21 = !{!12, !6, i64 14040}
!22 = !{!18, !7, i64 144}
!23 = distinct !{!23, !24}
!24 = !{!"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"

; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local noundef float @atom_in_explicit_pocket(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 14040
  %4 = getelementptr inbounds i8, ptr %1, i64 14028
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %7 = getelementptr inbounds i8, ptr %1, i64 14048
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %0, i64 96
  %10 = load i32, ptr %9, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %1, i64 14032
  %12 = getelementptr inbounds i8, ptr %0, i64 44
  %13 = getelementptr inbounds i8, ptr %0, i64 144
  %wide.trip.count = zext nneg i32 %5 to i64
  br label %14

14:                                               ; preds = %.lr.ph, %34
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %34 ]
  %15 = getelementptr inbounds i16, ptr %8, i64 %indvars.iv
  %16 = load i16, ptr %15, align 2, !tbaa !16
  %17 = zext i16 %16 to i32
  %18 = icmp eq i32 %10, %17
  br i1 %18, label %19, label %34

19:                                               ; preds = %14
  %20 = load ptr, ptr %11, align 8, !tbaa !17
  %21 = getelementptr inbounds i8, ptr %20, i64 %indvars.iv
  %22 = load i8, ptr %21, align 1, !tbaa !18
  %23 = load i8, ptr %12, align 4, !tbaa !18
  %24 = icmp eq i8 %22, %23
  br i1 %24, label %25, label %34

25:                                               ; preds = %19
  %26 = load ptr, ptr %3, align 8, !tbaa !19
  %27 = getelementptr inbounds i8, ptr %26, i64 %indvars.iv
  %28 = load i8, ptr %27, align 1, !tbaa !18
  %29 = load i8, ptr %13, align 8, !tbaa !20
  %30 = icmp eq i8 %28, %29
  br i1 %30, label %._crit_edge, label %31

31:                                               ; preds = %25
  %32 = icmp eq i8 %28, 45
  %33 = and i8 %29, -33
  %or.cond2123 = icmp eq i8 %33, 0
  %or.cond22 = and i1 %32, %or.cond2123
  br i1 %or.cond22, label %._crit_edge, label %34

34:                                               ; preds = %31, %14, %19
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %14, !llvm.loop !21

._crit_edge:                                      ; preds = %31, %25, %34, %2
  %.018 = phi float [ 0.000000e+00, %2 ], [ 0.000000e+00, %34 ], [ 1.000000e+00, %25 ], [ 1.000000e+00, %31 ]
  ret float %.018
}

attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) 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" }

!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 14028}
!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, !9, i64 14048}
!14 = !{!15, !10, i64 96}
!15 = !{!"s_atm", !10, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, 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, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !7, i64 144, !7, i64 145, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !11, i64 164, !9, i64 168, !10, i64 176}
!16 = !{!11, !11, i64 0}
!17 = !{!6, !9, i64 14032}
!18 = !{!7, !7, i64 0}
!19 = !{!6, !9, i64 14040}
!20 = !{!15, !7, i64 144}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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