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

; 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.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::auto_ptr.1" = type { ptr }

@_ZN7fastjet8fwrapper4jetsE = external dso_local global %"class.std::vector", align 8
@_ZN7fastjet8fwrapper2csE = external dso_local global %"class.std::auto_ptr.1", align 8
@.str.6 = external hidden unnamed_addr constant [147 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1
@__PRETTY_FUNCTION__.fastjetarea_ = external hidden unnamed_addr constant [33 x i8], align 1
@_ZTIN7fastjet15ClusterSequenceE = external constant ptr
@_ZTIN7fastjet23ClusterSequenceAreaBaseE = external constant 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
declare dso_local noundef i64 @_ZNKSt6vectorIN7fastjet9PseudoJetESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZNSt6vectorIN7fastjet9PseudoJetESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local double @fastjetarea_(ptr noundef nonnull align 4 dereferenceable(4) %0) #3 {
  %2 = alloca double, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = load i32, ptr %6, align 4, !tbaa !9
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %9, label %15

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = call noundef i64 @_ZNKSt6vectorIN7fastjet9PseudoJetESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN7fastjet8fwrapper4jetsE) #5
  %14 = icmp ule i64 %12, %13
  br label %15

15:                                               ; preds = %9, %1
  %16 = phi i1 [ false, %1 ], [ %14, %9 ]
  br i1 %16, label %17, label %18

17:                                               ; preds = %15
  br label %20

18:                                               ; preds = %15
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.6, i32 noundef 366, ptr noundef @__PRETTY_FUNCTION__.fastjetarea_) #6
  unreachable

19:                                               ; No predecessors!
  br label %20

20:                                               ; preds = %19, %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %21 = call noundef ptr @_ZNKSt8auto_ptrIN7fastjet15ClusterSequenceEE3getEv(ptr noundef nonnull align 8 dereferenceable(8) @_ZN7fastjet8fwrapper2csE) #5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %25, label %23

23:                                               ; preds = %20
  %24 = call ptr @__dynamic_cast(ptr %21, ptr @_ZTIN7fastjet15ClusterSequenceE, ptr @_ZTIN7fastjet23ClusterSequenceAreaBaseE, i64 0) #5
  br label %26

25:                                               ; preds = %20
  br label %26

26:                                               ; preds = %25, %23
  %27 = phi ptr [ %24, %23 ], [ null, %25 ]
  store ptr %27, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %41

30:                                               ; preds = %26
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = sub nsw i32 %33, 1
  %35 = sext i32 %34 to i64
  %36 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNSt6vectorIN7fastjet9PseudoJetESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZN7fastjet8fwrapper4jetsE, i64 noundef %35) #5
  %37 = load ptr, ptr %31, align 8, !tbaa !11
  %38 = getelementptr inbounds ptr, ptr %37, i64 2
  %39 = load ptr, ptr %38, align 8
  %40 = call noundef double %39(ptr noundef nonnull align 8 dereferenceable(276) %31, ptr noundef nonnull align 8 dereferenceable(88) %36)
  store double %40, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %42

41:                                               ; preds = %26
  store double 0.000000e+00, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %42

42:                                               ; preds = %41, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %43 = load double, ptr %2, align 8
  ret double %43
}

; Function Attrs: nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) #4

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 = { noreturn 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 #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 willreturn memory(read) }
attributes #5 = { nounwind }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, 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"

%"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::auto_ptr.1" = type { ptr }

@_ZN7fastjet8fwrapper4jetsE = external dso_local global %"class.std::vector", align 8
@_ZN7fastjet8fwrapper2csE = external dso_local global %"class.std::auto_ptr.1", align 8
@.str.6 = external hidden unnamed_addr constant [147 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1
@__PRETTY_FUNCTION__.fastjetarea_ = external hidden unnamed_addr constant [33 x i8], align 1
@_ZTIN7fastjet15ClusterSequenceE = external constant ptr
@_ZTIN7fastjet23ClusterSequenceAreaBaseE = external constant ptr

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZNSt6vectorIN7fastjet9PseudoJetESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef double @fastjetarea_(ptr nocapture noundef nonnull readonly align 4 dereferenceable(4) %0) local_unnamed_addr #2 {
  %2 = load i32, ptr %0, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %4, label %.critedge

4:                                                ; preds = %1
  %5 = zext nneg i32 %2 to i64
  %6 = tail call noundef i64 @_ZNKSt6vectorIN7fastjet9PseudoJetESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN7fastjet8fwrapper4jetsE) #4
  %.not = icmp ult i64 %6, %5
  br i1 %.not, label %.critedge, label %7

.critedge:                                        ; preds = %1, %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.6, i32 noundef 366, ptr noundef nonnull @__PRETTY_FUNCTION__.fastjetarea_) #5
  unreachable

7:                                                ; preds = %4
  %8 = tail call noundef ptr @_ZNKSt8auto_ptrIN7fastjet15ClusterSequenceEE3getEv(ptr noundef nonnull align 8 dereferenceable(8) @_ZN7fastjet8fwrapper2csE) #4
  %9 = icmp eq ptr %8, null
  br i1 %9, label %.thread, label %10

10:                                               ; preds = %7
  %11 = tail call ptr @__dynamic_cast(ptr nonnull %8, ptr nonnull @_ZTIN7fastjet15ClusterSequenceE, ptr nonnull @_ZTIN7fastjet23ClusterSequenceAreaBaseE, i64 0) #4
  %.not9 = icmp eq ptr %11, null
  br i1 %.not9, label %.thread, label %12

12:                                               ; preds = %10
  %13 = load i32, ptr %0, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  %15 = sext i32 %14 to i64
  %16 = tail call noundef nonnull align 8 dereferenceable(88) ptr @_ZNSt6vectorIN7fastjet9PseudoJetESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_ZN7fastjet8fwrapper4jetsE, i64 noundef %15) #4
  %17 = load ptr, ptr %11, align 8, !tbaa !9
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef double %19(ptr noundef nonnull align 8 dereferenceable(276) %11, ptr noundef nonnull align 8 dereferenceable(88) %16)
  br label %.thread

.thread:                                          ; preds = %7, %10, %12
  %.0 = phi double [ %20, %12 ], [ 0.000000e+00, %10 ], [ 0.000000e+00, %7 ]
  ret double %.0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) local_unnamed_addr #3

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 = { noreturn 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 = { 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 = { mustprogress nofree nounwind willreturn memory(read) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}


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