; LLVM IR from alexzheng42/sDMD :: src (TimePrediction)

; 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.AtomStr = type { ptr, ptr }
%struct.PropertyStr = type { [8 x i8], [2 x [16 x i8]], [8 x i8], i32, i32, i32, double, double, [3 x double], %struct.AtomSeqStr, ptr, ptr }
%struct.AtomSeqStr = type { i32, i32, i32 }
%struct.DynamicStr = type { [4 x i32], [4 x double], [4 x double], %struct.HBStr, %struct.HBNeighborStr, %struct.InteractionEventStr }
%struct.HBStr = type { i32, i32, i8, i32 }
%struct.HBNeighborStr = type { [5 x i32], i32, i32 }
%struct.InteractionEventStr = type { i32, i64, i64, double, double, i32, i32 }

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: nounwind uwtable
define dso_local void @CalculateVCOM(i32 noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store double 0.000000e+00, ptr %9, align 8, !tbaa !11
  %14 = load ptr, ptr %8, align 8, !tbaa !9
  %15 = getelementptr inbounds double, ptr %14, i64 3
  store double 0.000000e+00, ptr %15, align 8, !tbaa !11
  %16 = load ptr, ptr %8, align 8, !tbaa !9
  %17 = getelementptr inbounds double, ptr %16, i64 2
  store double 0.000000e+00, ptr %17, align 8, !tbaa !11
  %18 = load ptr, ptr %8, align 8, !tbaa !9
  %19 = getelementptr inbounds double, ptr %18, i64 1
  store double 0.000000e+00, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %20 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %20, ptr %10, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %71, %4
  %22 = load i32, ptr %10, align 4, !tbaa !5
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %74

26:                                               ; preds = %21
  %27 = load ptr, ptr %7, align 8, !tbaa !9
  %28 = load i32, ptr %10, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds %struct.AtomStr, ptr %27, i64 %29
  %31 = getelementptr inbounds %struct.AtomStr, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = getelementptr inbounds %struct.PropertyStr, ptr %32, i32 0, i32 7
  %34 = load double, ptr %33, align 8, !tbaa !15
  %35 = load double, ptr %9, align 8, !tbaa !11
  %36 = fadd double %35, %34
  store double %36, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %67, %26
  %38 = load i32, ptr %12, align 4, !tbaa !5
  %39 = icmp sle i32 %38, 3
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %70

41:                                               ; preds = %37
  %42 = load ptr, ptr %7, align 8, !tbaa !9
  %43 = load i32, ptr %10, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %struct.AtomStr, ptr %42, i64 %44
  %46 = getelementptr inbounds %struct.AtomStr, ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  %48 = getelementptr inbounds %struct.DynamicStr, ptr %47, i32 0, i32 2
  %49 = load i32, ptr %12, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [4 x double], ptr %48, i64 0, i64 %50
  %52 = load double, ptr %51, align 8, !tbaa !11
  %53 = load ptr, ptr %7, align 8, !tbaa !9
  %54 = load i32, ptr %10, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds %struct.AtomStr, ptr %53, i64 %55
  %57 = getelementptr inbounds %struct.AtomStr, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !13
  %59 = getelementptr inbounds %struct.PropertyStr, ptr %58, i32 0, i32 7
  %60 = load double, ptr %59, align 8, !tbaa !15
  %61 = load ptr, ptr %8, align 8, !tbaa !9
  %62 = load i32, ptr %12, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds double, ptr %61, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !11
  %66 = call double @llvm.fmuladd.f64(double %52, double %60, double %65)
  store double %66, ptr %64, align 8, !tbaa !11
  br label %67

67:                                               ; preds = %41
  %68 = load i32, ptr %12, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %12, align 4, !tbaa !5
  br label %37, !llvm.loop !19

70:                                               ; preds = %40
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %10, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %10, align 4, !tbaa !5
  br label %21, !llvm.loop !21

74:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %87, %74
  %76 = load i32, ptr %13, align 4, !tbaa !5
  %77 = icmp sle i32 %76, 3
  br i1 %77, label %79, label %78

78:                                               ; preds = %75
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %90

79:                                               ; preds = %75
  %80 = load double, ptr %9, align 8, !tbaa !11
  %81 = load ptr, ptr %8, align 8, !tbaa !9
  %82 = load i32, ptr %13, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds double, ptr %81, i64 %83
  %85 = load double, ptr %84, align 8, !tbaa !11
  %86 = fdiv double %85, %80
  store double %86, ptr %84, align 8, !tbaa !11
  br label %87

87:                                               ; preds = %79
  %88 = load i32, ptr %13, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %13, align 4, !tbaa !5
  br label %75, !llvm.loop !22

90:                                               ; preds = %78
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"AtomStr", !10, i64 0, !10, i64 8}
!15 = !{!16, !12, i64 72}
!16 = !{!"PropertyStr", !7, i64 0, !7, i64 8, !7, i64 40, !6, i64 48, !6, i64 52, !6, i64 56, !12, i64 64, !12, i64 72, !7, i64 80, !17, i64 104, !10, i64 120, !10, i64 128}
!17 = !{!"AtomSeqStr", !6, i64 0, !6, i64 4, !6, i64 8}
!18 = !{!14, !10, i64 8}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}


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

%struct.AtomStr = type { ptr, ptr }

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @CalculateVCOM(i32 noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef %3) local_unnamed_addr #1 {
  %5 = getelementptr inbounds i8, ptr %3, i64 24
  %6 = getelementptr inbounds i8, ptr %3, i64 16
  %7 = getelementptr inbounds i8, ptr %3, i64 8
  %.not27 = icmp sgt i32 %0, %1
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, i8 0, i64 24, i1 false)
  br i1 %.not27, label %.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %4
  %8 = sext i32 %0 to i64
  %9 = add i32 %1, 1
  %.pre = load double, ptr %3, align 8, !tbaa !5
  br label %.lr.ph

.preheader.loopexit:                              ; preds = %.lr.ph
  %10 = insertelement <2 x double> poison, double %35, i64 0
  %11 = insertelement <2 x double> %10, double %38, i64 1
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %4
  %12 = phi double [ 0.000000e+00, %4 ], [ %42, %.preheader.loopexit ]
  %.025.lcssa = phi double [ 0.000000e+00, %4 ], [ %43, %.preheader.loopexit ]
  %13 = phi <2 x double> [ zeroinitializer, %4 ], [ %11, %.preheader.loopexit ]
  %14 = insertelement <2 x double> poison, double %.025.lcssa, i64 0
  %15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
  %16 = fdiv <2 x double> %13, %15
  store <2 x double> %16, ptr %7, align 8, !tbaa !5
  %17 = fdiv double %12, %.025.lcssa
  store double %17, ptr %5, align 8, !tbaa !5
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %18 = phi double [ 0.000000e+00, %.lr.ph.preheader ], [ %42, %.lr.ph ]
  %19 = phi double [ 0.000000e+00, %.lr.ph.preheader ], [ %38, %.lr.ph ]
  %20 = phi double [ 0.000000e+00, %.lr.ph.preheader ], [ %35, %.lr.ph ]
  %21 = phi double [ %.pre, %.lr.ph.preheader ], [ %30, %.lr.ph ]
  %indvars.iv = phi i64 [ %8, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.02528 = phi double [ 0.000000e+00, %.lr.ph.preheader ], [ %43, %.lr.ph ]
  %22 = getelementptr inbounds %struct.AtomStr, ptr %2, i64 %indvars.iv
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %23, i64 72
  %25 = load double, ptr %24, align 8, !tbaa !12
  %26 = getelementptr inbounds i8, ptr %22, i64 8
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = getelementptr inbounds i8, ptr %27, i64 48
  %29 = load double, ptr %28, align 8, !tbaa !5
  %30 = tail call double @llvm.fmuladd.f64(double %29, double %25, double %21)
  store double %30, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %27, i64 56
  %32 = load double, ptr %31, align 8, !tbaa !5
  %33 = load double, ptr %24, align 8, !tbaa !12
  %34 = getelementptr inbounds i8, ptr %27, i64 64
  %35 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %20)
  store double %35, ptr %7, align 8, !tbaa !5
  %36 = load double, ptr %34, align 8, !tbaa !5
  %37 = load double, ptr %24, align 8, !tbaa !12
  %38 = tail call double @llvm.fmuladd.f64(double %36, double %37, double %19)
  store double %38, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %27, i64 72
  %40 = load double, ptr %39, align 8, !tbaa !5
  %41 = load double, ptr %24, align 8, !tbaa !12
  %42 = tail call double @llvm.fmuladd.f64(double %40, double %41, double %18)
  store double %42, ptr %5, align 8, !tbaa !5
  %43 = fadd double %.02528, %25
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %9, %lftr.wideiv
  br i1 %exitcond.not, label %.preheader.loopexit, label %.lr.ph, !llvm.loop !17
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: 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" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"AtomStr", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !6, i64 72}
!13 = !{!"PropertyStr", !7, i64 0, !7, i64 8, !7, i64 40, !14, i64 48, !14, i64 52, !14, i64 56, !6, i64 64, !6, i64 72, !7, i64 80, !15, i64 104, !11, i64 120, !11, i64 128}
!14 = !{!"int", !7, i64 0}
!15 = !{!"AtomSeqStr", !14, i64 0, !14, i64 4, !14, i64 8}
!16 = !{!10, !11, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass