; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/External/STDHEP/src/stdhep (stdhep_internal_utils)

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

%struct.hepeup = type { i32, i32, double, double, double, double, [500 x i32], [500 x i32], [500 x [2 x i32]], [500 x [2 x i32]], [500 x [5 x double]], [500 x double], [500 x double] }

@hepeup_ = external global %struct.hepeup, align 8

; 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: nounwind uwtable
define dso_local void @StdHepZeroHEPEUP() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #2
  %3 = load i32, ptr @hepeup_, align 8, !tbaa !5
  %4 = load i32, ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 1), align 4, !tbaa !11
  %5 = load double, ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 2), align 8, !tbaa !12
  %6 = load double, ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 3), align 8, !tbaa !13
  %7 = load double, ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 4), align 8, !tbaa !14
  %8 = load double, ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 5), align 8, !tbaa !15
  store i32 0, ptr %1, align 4, !tbaa !16
  br label %9

9:                                                ; preds = %66, %0
  %10 = load i32, ptr %1, align 4, !tbaa !16
  %11 = icmp slt i32 %10, 500
  br i1 %11, label %12, label %69

12:                                               ; preds = %9
  %13 = load i32, ptr %1, align 4, !tbaa !16
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [500 x i32], ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 6), i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !16
  %17 = load i32, ptr %1, align 4, !tbaa !16
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [500 x i32], ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 7), i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !16
  store i32 0, ptr %2, align 4, !tbaa !16
  br label %21

21:                                               ; preds = %39, %12
  %22 = load i32, ptr %2, align 4, !tbaa !16
  %23 = icmp slt i32 %22, 2
  br i1 %23, label %24, label %42

24:                                               ; preds = %21
  %25 = load i32, ptr %1, align 4, !tbaa !16
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [500 x [2 x i32]], ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 8), i64 0, i64 %26
  %28 = load i32, ptr %2, align 4, !tbaa !16
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [2 x i32], ptr %27, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !16
  %32 = load i32, ptr %1, align 4, !tbaa !16
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [500 x [2 x i32]], ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 9), i64 0, i64 %33
  %35 = load i32, ptr %2, align 4, !tbaa !16
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [2 x i32], ptr %34, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !16
  br label %39

39:                                               ; preds = %24
  %40 = load i32, ptr %2, align 4, !tbaa !16
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !16
  br label %21, !llvm.loop !17

42:                                               ; preds = %21
  store i32 0, ptr %2, align 4, !tbaa !16
  br label %43

43:                                               ; preds = %54, %42
  %44 = load i32, ptr %2, align 4, !tbaa !16
  %45 = icmp slt i32 %44, 5
  br i1 %45, label %46, label %57

46:                                               ; preds = %43
  %47 = load i32, ptr %1, align 4, !tbaa !16
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [500 x [5 x double]], ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 10), i64 0, i64 %48
  %50 = load i32, ptr %2, align 4, !tbaa !16
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [5 x double], ptr %49, i64 0, i64 %51
  %53 = load double, ptr %52, align 8, !tbaa !19
  br label %54

54:                                               ; preds = %46
  %55 = load i32, ptr %2, align 4, !tbaa !16
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %2, align 4, !tbaa !16
  br label %43, !llvm.loop !20

57:                                               ; preds = %43
  %58 = load i32, ptr %1, align 4, !tbaa !16
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [500 x double], ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 11), i64 0, i64 %59
  %61 = load double, ptr %60, align 8, !tbaa !19
  %62 = load i32, ptr %1, align 4, !tbaa !16
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [500 x double], ptr getelementptr inbounds (%struct.hepeup, ptr @hepeup_, i32 0, i32 12), i64 0, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !19
  br label %66

66:                                               ; preds = %57
  %67 = load i32, ptr %1, align 4, !tbaa !16
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %1, align 4, !tbaa !16
  br label %9, !llvm.loop !21

69:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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, !7, i64 0}
!6 = !{!"hepeup", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !8, i64 40, !8, i64 2040, !8, i64 4040, !8, i64 8040, !8, i64 12040, !8, i64 32040, !8, i64 36040}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !10, i64 32}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!10, !10, i64 0}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}


; 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(none) uwtable
define dso_local void @StdHepZeroHEPEUP() local_unnamed_addr #0 {
  ret void
}

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

!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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass