; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/External/fastjet-3.0.0/plugins/GridJet (GridJetPlugin)

; 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::GridJetPlugin" = type { %"class.fastjet::JetDefinition::Plugin", double, double, double, double, double, i32, i32, i32, %"class.fastjet::JetDefinition" }
%"class.fastjet::JetDefinition::Plugin" = type { ptr }
%"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 }

@.str = external hidden unnamed_addr constant [52 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [146 x i8], align 1
@__PRETTY_FUNCTION__._ZN7fastjet13GridJetPlugin10setup_gridEv = external hidden unnamed_addr constant [42 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7fastjet13GridJetPlugin10setup_gridEv(ptr noundef nonnull align 8 dereferenceable(144) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 2
  %6 = load double, ptr %5, align 8, !tbaa !9
  %7 = fcmp ogt double %6, 0.000000e+00
  br i1 %7, label %8, label %17

8:                                                ; preds = %1
  %9 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 2
  %10 = load double, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 1
  %12 = load double, ptr %11, align 8, !tbaa !22
  %13 = fsub double %10, %12
  %14 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 5
  %15 = load double, ptr %14, align 8, !tbaa !23
  %16 = fcmp oge double %13, %15
  br label %17

17:                                               ; preds = %8, %1
  %18 = phi i1 [ false, %1 ], [ %16, %8 ]
  br i1 %18, label %19, label %20

19:                                               ; preds = %17
  br label %22

20:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 56, ptr noundef @__PRETTY_FUNCTION__._ZN7fastjet13GridJetPlugin10setup_gridEv) #3
  unreachable

21:                                               ; No predecessors!
  br label %22

22:                                               ; preds = %21, %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %23 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 2
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 1
  %26 = load double, ptr %25, align 8, !tbaa !22
  %27 = fsub double %24, %26
  %28 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 5
  %29 = load double, ptr %28, align 8, !tbaa !23
  %30 = fdiv double %27, %29
  store double %30, ptr %3, align 8, !tbaa !24
  %31 = load double, ptr %3, align 8, !tbaa !24
  %32 = fadd double %31, 4.999900e-01
  %33 = fptosi double %32 to i32
  %34 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 6
  store i32 %33, ptr %34, align 8, !tbaa !25
  %35 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 2
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 1
  %38 = load double, ptr %37, align 8, !tbaa !22
  %39 = fsub double %36, %38
  %40 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 6
  %41 = load i32, ptr %40, align 8, !tbaa !25
  %42 = sitofp i32 %41 to double
  %43 = fdiv double %39, %42
  %44 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 3
  store double %43, ptr %44, align 8, !tbaa !26
  %45 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 5
  %46 = load double, ptr %45, align 8, !tbaa !23
  %47 = fdiv double 0x401921FB54442D18, %46
  %48 = fadd double %47, 5.000000e-01
  %49 = fptosi double %48 to i32
  %50 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 7
  store i32 %49, ptr %50, align 4, !tbaa !27
  %51 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 7
  %52 = load i32, ptr %51, align 4, !tbaa !27
  %53 = sitofp i32 %52 to double
  %54 = fdiv double 0x401921FB54442D18, %53
  %55 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 4
  store double %54, ptr %55, align 8, !tbaa !28
  %56 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 6
  %57 = load i32, ptr %56, align 8, !tbaa !25
  %58 = icmp sge i32 %57, 1
  br i1 %58, label %59, label %63

59:                                               ; preds = %22
  %60 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 7
  %61 = load i32, ptr %60, align 4, !tbaa !27
  %62 = icmp sge i32 %61, 1
  br label %63

63:                                               ; preds = %59, %22
  %64 = phi i1 [ false, %22 ], [ %62, %59 ]
  br i1 %64, label %65, label %66

65:                                               ; preds = %63
  br label %68

66:                                               ; preds = %63
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 66, ptr noundef @__PRETTY_FUNCTION__._ZN7fastjet13GridJetPlugin10setup_gridEv) #3
  unreachable

67:                                               ; No predecessors!
  br label %68

68:                                               ; preds = %67, %65
  %69 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 7
  %70 = load i32, ptr %69, align 4, !tbaa !27
  %71 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 6
  %72 = load i32, ptr %71, align 8, !tbaa !25
  %73 = mul nsw i32 %70, %72
  %74 = getelementptr inbounds %"class.fastjet::GridJetPlugin", ptr %4, i32 0, i32 8
  store i32 %73, ptr %74, align 8, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { noreturn nounwind }
attributes #4 = { 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, !12, i64 16}
!10 = !{!"_ZTSN7fastjet13GridJetPluginE", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !13, i64 48, !13, i64 52, !13, i64 56, !14, i64 64}
!11 = !{!"_ZTSN7fastjet13JetDefinition6PluginE"}
!12 = !{!"double", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN7fastjet13JetDefinitionE", !15, i64 0, !12, i64 8, !12, i64 16, !16, i64 24, !6, i64 32, !17, i64 40, !18, i64 48, !6, i64 64, !21, i64 72}
!15 = !{!"_ZTSN7fastjet12JetAlgorithmE", !7, i64 0}
!16 = !{!"_ZTSN7fastjet8StrategyE", !7, i64 0}
!17 = !{!"_ZTSN7fastjet9SharedPtrIKNS_13JetDefinition6PluginEEE", !6, i64 0}
!18 = !{!"_ZTSN7fastjet13JetDefinition17DefaultRecombinerE", !19, i64 0, !20, i64 8}
!19 = !{!"_ZTSN7fastjet13JetDefinition10RecombinerE"}
!20 = !{!"_ZTSN7fastjet19RecombinationSchemeE", !7, i64 0}
!21 = !{!"_ZTSN7fastjet9SharedPtrIKNS_13JetDefinition10RecombinerEEE", !6, i64 0}
!22 = !{!10, !12, i64 8}
!23 = !{!10, !12, i64 40}
!24 = !{!12, !12, i64 0}
!25 = !{!10, !13, i64 48}
!26 = !{!10, !12, i64 24}
!27 = !{!10, !13, i64 52}
!28 = !{!10, !12, i64 32}
!29 = !{!10, !13, i64 56}


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

@.str = external hidden unnamed_addr constant [52 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [146 x i8], align 1
@__PRETTY_FUNCTION__._ZN7fastjet13GridJetPlugin10setup_gridEv = external hidden unnamed_addr constant [42 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7fastjet13GridJetPlugin10setup_gridEv(ptr nocapture noundef nonnull align 8 dereferenceable(144) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load double, ptr %2, align 8, !tbaa !5
  %4 = fcmp ogt double %3, 0.000000e+00
  br i1 %4, label %5, label %.critedge

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !21
  %8 = fsub double %3, %7
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = load double, ptr %9, align 8, !tbaa !22
  %11 = fcmp ult double %8, %10
  br i1 %11, label %.critedge, label %12

.critedge:                                        ; preds = %1, %5
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 56, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7fastjet13GridJetPlugin10setup_gridEv) #2
  unreachable

12:                                               ; preds = %5
  %13 = insertelement <2 x double> <double poison, double 0x401921FB54442D18>, double %8, i64 0
  %14 = insertelement <2 x double> poison, double %10, i64 0
  %15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
  %16 = fdiv <2 x double> %13, %15
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %18 = getelementptr inbounds i8, ptr %0, i64 24
  %19 = fadd <2 x double> %16, <double 4.999900e-01, double 5.000000e-01>
  %20 = fptosi <2 x double> %19 to <2 x i32>
  store <2 x i32> %20, ptr %17, align 8, !tbaa !23
  %21 = sitofp <2 x i32> %20 to <2 x double>
  %22 = fdiv <2 x double> %13, %21
  store <2 x double> %22, ptr %18, align 8, !tbaa !24
  %23 = icmp sgt <2 x i32> %20, zeroinitializer
  %24 = extractelement <2 x i1> %23, i64 0
  %25 = extractelement <2 x i1> %23, i64 1
  %or.cond = select i1 %24, i1 %25, i1 false
  br i1 %or.cond, label %26, label %.critedge2

.critedge2:                                       ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 66, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7fastjet13GridJetPlugin10setup_gridEv) #2
  unreachable

26:                                               ; preds = %12
  %27 = extractelement <2 x i32> %20, i64 0
  %28 = extractelement <2 x i32> %20, i64 1
  %29 = mul nuw nsw i32 %28, %27
  %30 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 %29, ptr %30, align 8, !tbaa !25
  ret void
}

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

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 = { 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, !8, i64 16}
!6 = !{!"_ZTSN7fastjet13GridJetPluginE", !7, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !12, i64 64}
!7 = !{!"_ZTSN7fastjet13JetDefinition6PluginE"}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTSN7fastjet13JetDefinitionE", !13, i64 0, !8, i64 8, !8, i64 16, !14, i64 24, !15, i64 32, !16, i64 40, !17, i64 48, !15, i64 64, !20, i64 72}
!13 = !{!"_ZTSN7fastjet12JetAlgorithmE", !9, i64 0}
!14 = !{!"_ZTSN7fastjet8StrategyE", !9, i64 0}
!15 = !{!"any pointer", !9, i64 0}
!16 = !{!"_ZTSN7fastjet9SharedPtrIKNS_13JetDefinition6PluginEEE", !15, i64 0}
!17 = !{!"_ZTSN7fastjet13JetDefinition17DefaultRecombinerE", !18, i64 0, !19, i64 8}
!18 = !{!"_ZTSN7fastjet13JetDefinition10RecombinerE"}
!19 = !{!"_ZTSN7fastjet19RecombinationSchemeE", !9, i64 0}
!20 = !{!"_ZTSN7fastjet9SharedPtrIKNS_13JetDefinition10RecombinerEEE", !15, i64 0}
!21 = !{!6, !8, i64 8}
!22 = !{!6, !8, i64 40}
!23 = !{!11, !11, i64 0}
!24 = !{!8, !8, i64 0}
!25 = !{!6, !11, i64 56}


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