; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/JetCore/Jet.ll (ZN9SpartyJet17SpartyJetUserInfoD2Ev)

; 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.SpartyJet::SpartyJetUserInfo" = type <{ %"class.fastjet::PseudoJet::UserInfoBase", ptr, i8, [7 x i8] }>
%"class.fastjet::PseudoJet::UserInfoBase" = type { ptr }

@_ZTVN9SpartyJet17SpartyJetUserInfoE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9SpartyJet3Jet7historyEv(ptr noundef nonnull align 8 dereferenceable(128)) #1 align 2

; 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 void @_ZN9SpartyJet17SpartyJetUserInfoD2Ev(ptr noundef nonnull align 8 dereferenceable(17) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN9SpartyJet17SpartyJetUserInfoE, i32 0, i32 0, i32 2), ptr %4, align 8, !tbaa !9
  %5 = getelementptr inbounds %"class.SpartyJet::SpartyJetUserInfo", ptr %4, i32 0, i32 2
  %6 = load i8, ptr %5, align 8, !tbaa !11, !range !15, !noundef !16
  %7 = trunc i8 %6 to i1
  br i1 %7, label %8, label %38

8:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  %9 = getelementptr inbounds %"class.SpartyJet::SpartyJetUserInfo", ptr %4, i32 0, i32 1
  %10 = load ptr, ptr %9, align 8, !tbaa !17
  %11 = invoke noundef ptr @_ZN9SpartyJet3Jet7historyEv(ptr noundef nonnull align 8 dereferenceable(128) %10)
          to label %12 unwind label %39

12:                                               ; preds = %8
  %13 = invoke noundef zeroext i1 @_ZNK9SpartyJet15HistoryProviderINS_14HistoryElementEE7own_jetEv(ptr noundef nonnull align 8 dereferenceable(80) %11)
          to label %14 unwind label %39

14:                                               ; preds = %12
  %15 = zext i1 %13 to i8
  store i8 %15, ptr %3, align 1, !tbaa !18
  %16 = getelementptr inbounds %"class.SpartyJet::SpartyJetUserInfo", ptr %4, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !17
  %18 = invoke noundef ptr @_ZN9SpartyJet3Jet7historyEv(ptr noundef nonnull align 8 dereferenceable(128) %17)
          to label %19 unwind label %39

19:                                               ; preds = %14
  %20 = icmp eq ptr %18, null
  br i1 %20, label %25, label %21

21:                                               ; preds = %19
  %22 = load ptr, ptr %18, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 1
  %24 = load ptr, ptr %23, align 8
  call void %24(ptr noundef nonnull align 8 dereferenceable(80) %18) #4
  br label %25

25:                                               ; preds = %21, %19
  %26 = load i8, ptr %3, align 1, !tbaa !18, !range !15, !noundef !16
  %27 = trunc i8 %26 to i1
  br i1 %27, label %37, label %28

28:                                               ; preds = %25
  %29 = getelementptr inbounds %"class.SpartyJet::SpartyJetUserInfo", ptr %4, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  %31 = icmp eq ptr %30, null
  br i1 %31, label %36, label %32

32:                                               ; preds = %28
  %33 = load ptr, ptr %30, align 8, !tbaa !9
  %34 = getelementptr inbounds ptr, ptr %33, i64 1
  %35 = load ptr, ptr %34, align 8
  call void %35(ptr noundef nonnull align 8 dereferenceable(128) %30) #4
  br label %36

36:                                               ; preds = %32, %28
  br label %37

37:                                               ; preds = %36, %25
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  br label %38

38:                                               ; preds = %37, %1
  call void @_ZN7fastjet9PseudoJet12UserInfoBaseD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  ret void

39:                                               ; preds = %14, %12, %8
  %40 = landingpad { ptr, i32 }
          catch ptr null
  %41 = extractvalue { ptr, i32 } %40, 0
  call void @__clang_call_terminate(ptr %41) #5
  unreachable
}

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK9SpartyJet15HistoryProviderINS_14HistoryElementEE7own_jetEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7fastjet9PseudoJet12UserInfoBaseD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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 = { noinline noreturn nounwind uwtable "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 = { 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 = { nounwind }
attributes #5 = { noreturn 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !14, i64 16}
!12 = !{!"_ZTSN9SpartyJet17SpartyJetUserInfoE", !13, i64 0, !6, i64 8, !14, i64 16}
!13 = !{!"_ZTSN7fastjet9PseudoJet12UserInfoBaseE"}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!12, !6, i64 8}
!18 = !{!14, !14, 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"

@_ZTVN9SpartyJet17SpartyJetUserInfoE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN9SpartyJet3Jet7historyEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN9SpartyJet17SpartyJetUserInfoD2Ev(ptr noundef nonnull align 8 dereferenceable(17) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN9SpartyJet17SpartyJetUserInfoE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load i8, ptr %2, align 8, !tbaa !8, !range !14, !noundef !15
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %5, label %26

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !16
  %8 = tail call noundef ptr @_ZN9SpartyJet3Jet7historyEv(ptr noundef nonnull align 8 dereferenceable(128) %7)
  %9 = invoke noundef zeroext i1 @_ZNK9SpartyJet15HistoryProviderINS_14HistoryElementEE7own_jetEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
          to label %10 unwind label %27

10:                                               ; preds = %5
  %11 = load ptr, ptr %6, align 8, !tbaa !16
  %12 = tail call noundef ptr @_ZN9SpartyJet3Jet7historyEv(ptr noundef nonnull align 8 dereferenceable(128) %11)
  %13 = icmp eq ptr %12, null
  br i1 %13, label %18, label %14

14:                                               ; preds = %10
  %15 = load ptr, ptr %12, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8
  tail call void %17(ptr noundef nonnull align 8 dereferenceable(80) %12) #3
  br label %18

18:                                               ; preds = %14, %10
  br i1 %9, label %26, label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr %6, align 8, !tbaa !16
  %21 = icmp eq ptr %20, null
  br i1 %21, label %26, label %22

22:                                               ; preds = %19
  %23 = load ptr, ptr %20, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %25 = load ptr, ptr %24, align 8
  tail call void %25(ptr noundef nonnull align 8 dereferenceable(128) %20) #3
  br label %26

26:                                               ; preds = %18, %22, %19, %1
  tail call void @_ZN7fastjet9PseudoJet12UserInfoBaseD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  ret void

27:                                               ; preds = %5
  %28 = landingpad { ptr, i32 }
          catch ptr null
  %29 = extractvalue { ptr, i32 } %28, 0
  tail call void @__clang_call_terminate(ptr %29) #4
  unreachable
}

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK9SpartyJet15HistoryProviderINS_14HistoryElementEE7own_jetEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7fastjet9PseudoJet12UserInfoBaseD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { noinline noreturn nounwind uwtable "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 = { 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 = { nounwind }
attributes #4 = { noreturn 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !13, i64 16}
!9 = !{!"_ZTSN9SpartyJet17SpartyJetUserInfoE", !10, i64 0, !11, i64 8, !13, i64 16}
!10 = !{!"_ZTSN7fastjet9PseudoJet12UserInfoBaseE"}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"bool", !12, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!9, !11, i64 8}


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