; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/External/fastjet-3.0.0/plugins/SISCone/siscone/siscone/sph_74b38bf2 (12CSphmomentumE)

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

%"class.siscone_spherical::CSph3vector" = type <{ double, double, double, double, double, double, %"class.siscone::Creference", [4 x i8] }>
%"class.siscone::Creference" = type { [3 x i32] }
%"class.siscone_spherical::sph_hash_cones" = type { ptr, i32, i32, double, double }
%"class.siscone_spherical::sph_hash_element" = type { %"class.siscone_spherical::CSph3vector", i8, ptr }

; 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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN17siscone_spherical16sph_hash_elementC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 8 dereferenceable(60) ptr @_ZN17siscone_spherical11CSph3vectoraSERKS0_(ptr noundef nonnull align 8 dereferenceable(60), ptr noundef nonnull align 8 dereferenceable(60)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7sisconeeqERKNS_10CreferenceES2_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #5

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN17siscone_spherical14sph_hash_cones6insertEPNS_12CSphmomentumE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %1) #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.siscone_spherical::CSph3vector", ptr %12, i32 0, i32 6
  %14 = getelementptr inbounds %"class.siscone::Creference", ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds [3 x i32], ptr %14, i64 0, i64 0
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %"class.siscone_spherical::sph_hash_cones", ptr %11, i32 0, i32 2
  %18 = load i32, ptr %17, align 4, !tbaa !11
  %19 = and i32 %16, %18
  store i32 %19, ptr %7, align 4, !tbaa !9
  %20 = getelementptr inbounds %"class.siscone_spherical::sph_hash_cones", ptr %11, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds ptr, ptr %21, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr %25, ptr %6, align 8, !tbaa !5
  br label %26

26:                                               ; preds = %71, %2
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %59

29:                                               ; preds = %26
  %30 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 80) #8
  invoke void @_ZN17siscone_spherical16sph_hash_elementC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %30)
          to label %31 unwind label %55

31:                                               ; preds = %29
  store ptr %30, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %"class.siscone_spherical::sph_hash_element", ptr %33, i32 0, i32 0
  %35 = call noundef nonnull align 8 dereferenceable(60) ptr @_ZN17siscone_spherical11CSph3vectoraSERKS0_(ptr noundef nonnull align 8 dereferenceable(60) %34, ptr noundef nonnull align 8 dereferenceable(60) %32)
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.siscone_spherical::sph_hash_element", ptr %36, i32 0, i32 1
  store i8 1, ptr %37, align 8, !tbaa !15
  %38 = getelementptr inbounds %"class.siscone_spherical::sph_hash_cones", ptr %11, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !14
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds ptr, ptr %39, i64 %41
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.siscone_spherical::sph_hash_element", ptr %44, i32 0, i32 2
  store ptr %43, ptr %45, align 8, !tbaa !20
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %"class.siscone_spherical::sph_hash_cones", ptr %11, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  %49 = load i32, ptr %7, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds ptr, ptr %48, i64 %50
  store ptr %46, ptr %51, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.siscone_spherical::sph_hash_cones", ptr %11, i32 0, i32 1
  %53 = load i32, ptr %52, align 8, !tbaa !21
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %52, align 8, !tbaa !21
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %73

55:                                               ; preds = %29
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %8, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %9, align 4
  call void @_ZdlPvm(ptr noundef %30, i64 noundef 80) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %75

59:                                               ; preds = %26
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %"class.siscone_spherical::CSph3vector", ptr %60, i32 0, i32 6
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %"class.siscone_spherical::sph_hash_element", ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %"class.siscone_spherical::CSph3vector", ptr %63, i32 0, i32 6
  %65 = call noundef zeroext i1 @_ZN7sisconeeqERKNS_10CreferenceES2_(ptr noundef nonnull align 4 dereferenceable(12) %61, ptr noundef nonnull align 4 dereferenceable(12) %64)
  br i1 %65, label %66, label %67

66:                                               ; preds = %59
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %73

67:                                               ; preds = %59
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %"class.siscone_spherical::sph_hash_element", ptr %68, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !20
  store ptr %70, ptr %6, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %67
  br i1 true, label %26, label %72, !llvm.loop !22

72:                                               ; preds = %71
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %73

73:                                               ; preds = %72, %66, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %74 = load i32, ptr %3, align 4
  ret i32 %74

75:                                               ; preds = %55
  %76 = load ptr, ptr %8, align 8
  %77 = load i32, ptr %9, align 4
  %78 = insertvalue { ptr, i32 } poison, ptr %76, 0
  %79 = insertvalue { ptr, i32 } %78, i32 %77, 1
  resume { ptr, i32 } %79
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin 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 = { nobuiltin allocsize(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 = { inlinehint mustprogress 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 #4 = { "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 #5 = { inlinehint mustprogress 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 #6 = { mustprogress 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 12}
!12 = !{!"_ZTSN17siscone_spherical14sph_hash_conesE", !6, i64 0, !10, i64 8, !10, i64 12, !13, i64 16, !13, i64 24}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !6, i64 0}
!15 = !{!16, !19, i64 64}
!16 = !{!"_ZTSN17siscone_spherical16sph_hash_elementE", !17, i64 0, !19, i64 64, !6, i64 72}
!17 = !{!"_ZTSN17siscone_spherical11CSph3vectorE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !18, i64 48}
!18 = !{!"_ZTSN7siscone10CreferenceE", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!16, !6, i64 72}
!21 = !{!12, !10, i64 8}
!22 = distinct !{!22, !23}
!23 = !{!"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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN17siscone_spherical16sph_hash_elementC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 8 dereferenceable(60) ptr @_ZN17siscone_spherical11CSph3vectoraSERKS0_(ptr noundef nonnull align 8 dereferenceable(60), ptr noundef nonnull align 8 dereferenceable(60)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7sisconeeqERKNS_10CreferenceES2_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN17siscone_spherical14sph_hash_cones6insertEPNS_12CSphmomentumE(ptr nocapture noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %1) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 48
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 12
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = and i32 %6, %4
  %8 = load ptr, ptr %0, align 8, !tbaa !13
  %9 = sext i32 %7 to i64
  %10 = getelementptr inbounds ptr, ptr %8, i64 %9
  %.01617 = load ptr, ptr %10, align 8, !tbaa !14
  %11 = icmp eq ptr %.01617, null
  br i1 %11, label %._crit_edge, label %.lr.ph

12:                                               ; preds = %.lr.ph
  %13 = getelementptr inbounds i8, ptr %.01618, i64 72
  %.016 = load ptr, ptr %13, align 8, !tbaa !14
  %14 = icmp eq ptr %.016, null
  br i1 %14, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %12, %2
  %15 = tail call noalias noundef nonnull dereferenceable(80) ptr @_Znwm(i64 noundef 80) #6
  invoke void @_ZN17siscone_spherical16sph_hash_elementC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %15)
          to label %16 unwind label %26

16:                                               ; preds = %._crit_edge
  %17 = tail call noundef nonnull align 8 dereferenceable(60) ptr @_ZN17siscone_spherical11CSph3vectoraSERKS0_(ptr noundef nonnull align 8 dereferenceable(60) %15, ptr noundef nonnull align 8 dereferenceable(60) %1)
  %18 = getelementptr inbounds i8, ptr %15, i64 64
  store i8 1, ptr %18, align 8, !tbaa !17
  %19 = load ptr, ptr %0, align 8, !tbaa !13
  %20 = getelementptr inbounds ptr, ptr %19, i64 %9
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %15, i64 72
  store ptr %21, ptr %22, align 8, !tbaa !22
  store ptr %15, ptr %20, align 8, !tbaa !14
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load i32, ptr %23, align 8, !tbaa !23
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %23, align 8, !tbaa !23
  br label %.loopexit

26:                                               ; preds = %._crit_edge
  %27 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %15, i64 noundef 80) #7
  resume { ptr, i32 } %27

.lr.ph:                                           ; preds = %2, %12
  %.01618 = phi ptr [ %.016, %12 ], [ %.01617, %2 ]
  %28 = getelementptr inbounds i8, ptr %.01618, i64 48
  %29 = tail call noundef zeroext i1 @_ZN7sisconeeqERKNS_10CreferenceES2_(ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %28)
  br i1 %29, label %.loopexit, label %12

.loopexit:                                        ; preds = %.lr.ph, %16
  ret i32 0
}

attributes #0 = { nobuiltin 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 #1 = { nobuiltin allocsize(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 = { inlinehint mustprogress 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 = { "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 #4 = { inlinehint mustprogress 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 #5 = { mustprogress 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 #6 = { builtin allocsize(0) }
attributes #7 = { builtin 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 12}
!10 = !{!"_ZTSN17siscone_spherical14sph_hash_conesE", !11, i64 0, !6, i64 8, !6, i64 12, !12, i64 16, !12, i64 24}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{!11, !11, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !21, i64 64}
!18 = !{!"_ZTSN17siscone_spherical16sph_hash_elementE", !19, i64 0, !21, i64 64, !11, i64 72}
!19 = !{!"_ZTSN17siscone_spherical11CSph3vectorE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !20, i64 48}
!20 = !{!"_ZTSN7siscone10CreferenceE", !7, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!18, !11, i64 72}
!23 = !{!10, !6, i64 8}


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