; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/External/fastjet-3.0.0/src (ClusterSequence_TiledN2)

; 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.fastjet::ClusterSequence" = type <{ ptr, %"class.fastjet::JetDefinition", %"class.std::vector", %"class.std::vector.1", i8, [3 x i8], i32, double, double, double, double, i32, i32, %"class.fastjet::SharedPtr.6", i32, i8, i8, [2 x i8], %"class.fastjet::SharedPtr.7", %"class.std::vector.8", double, double, double, double, i32, i32, i32, [4 x i8] }>
%"class.fastjet::JetDefinition" = type { i32, double, double, i32, ptr, %"class.fastjet::SharedPtr", %"class.fastjet::JetDefinition::DefaultRecombiner", ptr, %"class.fastjet::SharedPtr.0" }
%"class.fastjet::SharedPtr" = type { ptr }
%"class.fastjet::JetDefinition::DefaultRecombiner" = type <{ %"class.fastjet::JetDefinition::Recombiner", i32, [4 x i8] }>
%"class.fastjet::JetDefinition::Recombiner" = type { ptr }
%"class.fastjet::SharedPtr.0" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<fastjet::PseudoJet, std::allocator<fastjet::PseudoJet>>::_Vector_impl" }
%"struct.std::_Vector_base<fastjet::PseudoJet, std::allocator<fastjet::PseudoJet>>::_Vector_impl" = type { %"struct.std::_Vector_base<fastjet::PseudoJet, std::allocator<fastjet::PseudoJet>>::_Vector_impl_data" }
%"struct.std::_Vector_base<fastjet::PseudoJet, std::allocator<fastjet::PseudoJet>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.1" = type { %"struct.std::_Vector_base.2" }
%"struct.std::_Vector_base.2" = type { %"struct.std::_Vector_base<fastjet::ClusterSequence::history_element, std::allocator<fastjet::ClusterSequence::history_element>>::_Vector_impl" }
%"struct.std::_Vector_base<fastjet::ClusterSequence::history_element, std::allocator<fastjet::ClusterSequence::history_element>>::_Vector_impl" = type { %"struct.std::_Vector_base<fastjet::ClusterSequence::history_element, std::allocator<fastjet::ClusterSequence::history_element>>::_Vector_impl_data" }
%"struct.std::_Vector_base<fastjet::ClusterSequence::history_element, std::allocator<fastjet::ClusterSequence::history_element>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.fastjet::SharedPtr.6" = type { ptr }
%"class.fastjet::SharedPtr.7" = type { ptr }
%"class.std::vector.8" = type { %"struct.std::_Vector_base.9" }
%"struct.std::_Vector_base.9" = type { %"struct.std::_Vector_base<fastjet::ClusterSequence::Tile, std::allocator<fastjet::ClusterSequence::Tile>>::_Vector_impl" }
%"struct.std::_Vector_base<fastjet::ClusterSequence::Tile, std::allocator<fastjet::ClusterSequence::Tile>>::_Vector_impl" = type { %"struct.std::_Vector_base<fastjet::ClusterSequence::Tile, std::allocator<fastjet::ClusterSequence::Tile>>::_Vector_impl_data" }
%"struct.std::_Vector_base<fastjet::ClusterSequence::Tile, std::allocator<fastjet::ClusterSequence::Tile>>::_Vector_impl_data" = type { ptr, ptr, 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: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK7fastjet15ClusterSequence11_tile_indexERKdS2_(ptr noundef nonnull align 8 dereferenceable(276) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = load double, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 20
  %13 = load double, ptr %12, align 8, !tbaa !11
  %14 = fcmp ole double %11, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %3
  store i32 0, ptr %7, align 4, !tbaa !37
  br label %53

16:                                               ; preds = %3
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load double, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 21
  %20 = load double, ptr %19, align 8, !tbaa !38
  %21 = fcmp oge double %18, %20
  br i1 %21, label %22, label %28

22:                                               ; preds = %16
  %23 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 26
  %24 = load i32, ptr %23, align 8, !tbaa !39
  %25 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 25
  %26 = load i32, ptr %25, align 4, !tbaa !40
  %27 = sub nsw i32 %24, %26
  store i32 %27, ptr %7, align 4, !tbaa !37
  br label %52

28:                                               ; preds = %16
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load double, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 20
  %32 = load double, ptr %31, align 8, !tbaa !11
  %33 = fsub double %30, %32
  %34 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 22
  %35 = load double, ptr %34, align 8, !tbaa !41
  %36 = fdiv double %33, %35
  %37 = fptosi double %36 to i32
  store i32 %37, ptr %7, align 4, !tbaa !37
  %38 = load i32, ptr %7, align 4, !tbaa !37
  %39 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 26
  %40 = load i32, ptr %39, align 8, !tbaa !39
  %41 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 25
  %42 = load i32, ptr %41, align 4, !tbaa !40
  %43 = sub nsw i32 %40, %42
  %44 = icmp sgt i32 %38, %43
  br i1 %44, label %45, label %51

45:                                               ; preds = %28
  %46 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 26
  %47 = load i32, ptr %46, align 8, !tbaa !39
  %48 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 25
  %49 = load i32, ptr %48, align 4, !tbaa !40
  %50 = sub nsw i32 %47, %49
  store i32 %50, ptr %7, align 4, !tbaa !37
  br label %51

51:                                               ; preds = %45, %28
  br label %52

52:                                               ; preds = %51, %22
  br label %53

53:                                               ; preds = %52, %15
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load double, ptr %54, align 8, !tbaa !9
  %56 = fadd double %55, 0x401921FB54442D18
  %57 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 23
  %58 = load double, ptr %57, align 8, !tbaa !42
  %59 = fdiv double %56, %58
  %60 = fptosi double %59 to i32
  %61 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 24
  %62 = load i32, ptr %61, align 8, !tbaa !43
  %63 = srem i32 %60, %62
  store i32 %63, ptr %8, align 4, !tbaa !37
  %64 = load i32, ptr %8, align 4, !tbaa !37
  %65 = load i32, ptr %7, align 4, !tbaa !37
  %66 = getelementptr inbounds %"class.fastjet::ClusterSequence", ptr %9, i32 0, i32 24
  %67 = load i32, ptr %66, align 8, !tbaa !43
  %68 = mul nsw i32 %65, %67
  %69 = add nsw i32 %64, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  ret i32 %69
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 232}
!12 = !{!"_ZTSN7fastjet15ClusterSequenceE", !13, i64 8, !21, i64 88, !25, i64 112, !29, i64 136, !30, i64 140, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !15, i64 176, !14, i64 180, !31, i64 184, !30, i64 192, !29, i64 196, !29, i64 197, !32, i64 200, !33, i64 208, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !30, i64 264, !30, i64 268, !30, i64 272}
!13 = !{!"_ZTSN7fastjet13JetDefinitionE", !14, i64 0, !10, i64 8, !10, i64 16, !15, i64 24, !6, i64 32, !16, i64 40, !17, i64 48, !6, i64 64, !20, i64 72}
!14 = !{!"_ZTSN7fastjet12JetAlgorithmE", !7, i64 0}
!15 = !{!"_ZTSN7fastjet8StrategyE", !7, i64 0}
!16 = !{!"_ZTSN7fastjet9SharedPtrIKNS_13JetDefinition6PluginEEE", !6, i64 0}
!17 = !{!"_ZTSN7fastjet13JetDefinition17DefaultRecombinerE", !18, i64 0, !19, i64 8}
!18 = !{!"_ZTSN7fastjet13JetDefinition10RecombinerE"}
!19 = !{!"_ZTSN7fastjet19RecombinationSchemeE", !7, i64 0}
!20 = !{!"_ZTSN7fastjet9SharedPtrIKNS_13JetDefinition10RecombinerEEE", !6, i64 0}
!21 = !{!"_ZTSSt6vectorIN7fastjet9PseudoJetESaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIN7fastjet9PseudoJetESaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIN7fastjet9PseudoJetESaIS1_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN7fastjet9PseudoJetESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTSSt6vectorIN7fastjet15ClusterSequence15history_elementESaIS2_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIN7fastjet15ClusterSequence15history_elementESaIS2_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN7fastjet15ClusterSequence15history_elementESaIS2_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIN7fastjet15ClusterSequence15history_elementESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"bool", !7, i64 0}
!30 = !{!"int", !7, i64 0}
!31 = !{!"_ZTSN7fastjet9SharedPtrINS_22PseudoJetStructureBaseEEE", !6, i64 0}
!32 = !{!"_ZTSN7fastjet9SharedPtrINS_15ClusterSequence6ExtrasEEE", !6, i64 0}
!33 = !{!"_ZTSSt6vectorIN7fastjet15ClusterSequence4TileESaIS2_EE", !34, i64 0}
!34 = !{!"_ZTSSt12_Vector_baseIN7fastjet15ClusterSequence4TileESaIS2_EE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIN7fastjet15ClusterSequence4TileESaIS2_EE12_Vector_implE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseIN7fastjet15ClusterSequence4TileESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!37 = !{!30, !30, i64 0}
!38 = !{!12, !10, i64 240}
!39 = !{!12, !30, i64 272}
!40 = !{!12, !30, i64 268}
!41 = !{!12, !10, i64 248}
!42 = !{!12, !10, i64 256}
!43 = !{!12, !30, i64 264}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef i32 @_ZNK7fastjet15ClusterSequence11_tile_indexERKdS2_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(276) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %2) local_unnamed_addr #0 align 2 {
  %4 = load double, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 232
  %6 = load double, ptr %5, align 8, !tbaa !9
  %7 = fcmp ugt double %4, %6
  br i1 %7, label %8, label %29

8:                                                ; preds = %3
  %9 = getelementptr inbounds i8, ptr %0, i64 240
  %10 = load double, ptr %9, align 8, !tbaa !36
  %11 = fcmp ult double %4, %10
  br i1 %11, label %18, label %12

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %0, i64 272
  %14 = load i32, ptr %13, align 8, !tbaa !37
  %15 = getelementptr inbounds i8, ptr %0, i64 268
  %16 = load i32, ptr %15, align 4, !tbaa !38
  %17 = sub nsw i32 %14, %16
  br label %29

18:                                               ; preds = %8
  %19 = fsub double %4, %6
  %20 = getelementptr inbounds i8, ptr %0, i64 248
  %21 = load double, ptr %20, align 8, !tbaa !39
  %22 = fdiv double %19, %21
  %23 = fptosi double %22 to i32
  %24 = getelementptr inbounds i8, ptr %0, i64 272
  %25 = load i32, ptr %24, align 8, !tbaa !37
  %26 = getelementptr inbounds i8, ptr %0, i64 268
  %27 = load i32, ptr %26, align 4, !tbaa !38
  %28 = sub nsw i32 %25, %27
  %spec.select = tail call i32 @llvm.smin.i32(i32 %28, i32 %23)
  br label %29

29:                                               ; preds = %18, %3, %12
  %.0 = phi i32 [ %17, %12 ], [ 0, %3 ], [ %spec.select, %18 ]
  %30 = load double, ptr %2, align 8, !tbaa !5
  %31 = fadd double %30, 0x401921FB54442D18
  %32 = getelementptr inbounds i8, ptr %0, i64 256
  %33 = load double, ptr %32, align 8, !tbaa !40
  %34 = fdiv double %31, %33
  %35 = fptosi double %34 to i32
  %36 = getelementptr inbounds i8, ptr %0, i64 264
  %37 = load i32, ptr %36, align 8, !tbaa !41
  %38 = srem i32 %35, %37
  %39 = mul nsw i32 %37, %.0
  %40 = add nsw i32 %38, %39
  ret i32 %40
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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) }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 232}
!10 = !{!"_ZTSN7fastjet15ClusterSequenceE", !11, i64 8, !20, i64 88, !24, i64 112, !28, i64 136, !29, i64 140, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !13, i64 176, !12, i64 180, !30, i64 184, !29, i64 192, !28, i64 196, !28, i64 197, !31, i64 200, !32, i64 208, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !29, i64 264, !29, i64 268, !29, i64 272}
!11 = !{!"_ZTSN7fastjet13JetDefinitionE", !12, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !14, i64 32, !15, i64 40, !16, i64 48, !14, i64 64, !19, i64 72}
!12 = !{!"_ZTSN7fastjet12JetAlgorithmE", !7, i64 0}
!13 = !{!"_ZTSN7fastjet8StrategyE", !7, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"_ZTSN7fastjet9SharedPtrIKNS_13JetDefinition6PluginEEE", !14, i64 0}
!16 = !{!"_ZTSN7fastjet13JetDefinition17DefaultRecombinerE", !17, i64 0, !18, i64 8}
!17 = !{!"_ZTSN7fastjet13JetDefinition10RecombinerE"}
!18 = !{!"_ZTSN7fastjet19RecombinationSchemeE", !7, i64 0}
!19 = !{!"_ZTSN7fastjet9SharedPtrIKNS_13JetDefinition10RecombinerEEE", !14, i64 0}
!20 = !{!"_ZTSSt6vectorIN7fastjet9PseudoJetESaIS1_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIN7fastjet9PseudoJetESaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIN7fastjet9PseudoJetESaIS1_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIN7fastjet9PseudoJetESaIS1_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!24 = !{!"_ZTSSt6vectorIN7fastjet15ClusterSequence15history_elementESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIN7fastjet15ClusterSequence15history_elementESaIS2_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN7fastjet15ClusterSequence15history_elementESaIS2_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN7fastjet15ClusterSequence15history_elementESaIS2_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!28 = !{!"bool", !7, i64 0}
!29 = !{!"int", !7, i64 0}
!30 = !{!"_ZTSN7fastjet9SharedPtrINS_22PseudoJetStructureBaseEEE", !14, i64 0}
!31 = !{!"_ZTSN7fastjet9SharedPtrINS_15ClusterSequence6ExtrasEEE", !14, i64 0}
!32 = !{!"_ZTSSt6vectorIN7fastjet15ClusterSequence4TileESaIS2_EE", !33, i64 0}
!33 = !{!"_ZTSSt12_Vector_baseIN7fastjet15ClusterSequence4TileESaIS2_EE", !34, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIN7fastjet15ClusterSequence4TileESaIS2_EE12_Vector_implE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIN7fastjet15ClusterSequence4TileESaIS2_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!36 = !{!10, !6, i64 240}
!37 = !{!10, !29, i64 272}
!38 = !{!10, !29, i64 268}
!39 = !{!10, !6, i64 248}
!40 = !{!10, !6, i64 256}
!41 = !{!10, !29, i64 264}


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