; LLVM IR from yuikns/panther :: ann/test/rand.ll (Z15annClusGaussPtsPPdiii7ANNboold)

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

@_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters = external hidden global ptr, 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: mustprogress nounwind uwtable
declare hidden noundef double @_ZL10annRanUnifdd(double noundef, double noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef double @_ZL11annRanGaussv() #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z15annClusGaussPtsPPdiii7ANNboold(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, double noundef %5) #3 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !11
  store double %5, ptr %12, align 8, !tbaa !13
  %19 = load ptr, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %24, label %21

21:                                               ; preds = %6
  %22 = load i32, ptr %11, align 4, !tbaa !11
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %61

24:                                               ; preds = %21, %6
  %25 = load ptr, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  call void @_Z13annDeallocPtsRPPd(ptr noundef nonnull align 8 dereferenceable(8) @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters)
  br label %28

28:                                               ; preds = %27, %24
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = call noundef ptr @_Z11annAllocPtsii(i32 noundef %29, i32 noundef %30)
  store ptr %31, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %57, %28
  %33 = load i32, ptr %13, align 4, !tbaa !9
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %60

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %53, %37
  %39 = load i32, ptr %15, align 4, !tbaa !9
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %56

43:                                               ; preds = %38
  %44 = call noundef double @_ZL10annRanUnifdd(double noundef -1.000000e+00, double noundef 1.000000e+00)
  %45 = load ptr, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  %46 = load i32, ptr %13, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds ptr, ptr %45, i64 %47
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = load i32, ptr %15, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds double, ptr %49, i64 %51
  store double %44, ptr %52, align 8, !tbaa !13
  br label %53

53:                                               ; preds = %43
  %54 = load i32, ptr %15, align 4, !tbaa !9
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %15, align 4, !tbaa !9
  br label %38, !llvm.loop !15

56:                                               ; preds = %42
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %13, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %13, align 4, !tbaa !9
  br label %32, !llvm.loop !17

60:                                               ; preds = %36
  br label %61

61:                                               ; preds = %60, %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %100, %61
  %63 = load i32, ptr %16, align 4, !tbaa !9
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 8, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %103

67:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = call noundef i32 @_ZL9annRanInti(i32 noundef %68)
  store i32 %69, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %96, %67
  %71 = load i32, ptr %18, align 4, !tbaa !9
  %72 = load i32, ptr %9, align 4, !tbaa !9
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 11, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %99

75:                                               ; preds = %70
  %76 = load double, ptr %12, align 8, !tbaa !13
  %77 = call noundef double @_ZL11annRanGaussv()
  %78 = load ptr, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  %79 = load i32, ptr %17, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds ptr, ptr %78, i64 %80
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = load i32, ptr %18, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds double, ptr %82, i64 %84
  %86 = load double, ptr %85, align 8, !tbaa !13
  %87 = call double @llvm.fmuladd.f64(double %76, double %77, double %86)
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = load i32, ptr %16, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds ptr, ptr %88, i64 %90
  %92 = load ptr, ptr %91, align 8, !tbaa !5
  %93 = load i32, ptr %18, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds double, ptr %92, i64 %94
  store double %87, ptr %95, align 8, !tbaa !13
  br label %96

96:                                               ; preds = %75
  %97 = load i32, ptr %18, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %18, align 4, !tbaa !9
  br label %70, !llvm.loop !18

99:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %16, align 4, !tbaa !9
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %16, align 4, !tbaa !9
  br label %62, !llvm.loop !19

103:                                              ; preds = %66
  ret void
}

declare void @_Z13annDeallocPtsRPPd(ptr noundef nonnull align 8 dereferenceable(8)) #4

declare noundef ptr @_Z11annAllocPtsii(i32 noundef, i32 noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL9annRanInti(i32 noundef) #1

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { "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 #5 = { 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 = !{!"_ZTS7ANNbool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


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

@_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters = external hidden global ptr, align 8

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef double @_ZL10annRanUnifdd(double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef double @_ZL11annRanGaussv() local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z15annClusGaussPtsPPdiii7ANNboold(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, double noundef %5) local_unnamed_addr #2 {
  %7 = load ptr, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  %9 = icmp ne i32 %4, 0
  %or.cond = or i1 %9, %8
  br i1 %or.cond, label %10, label %.loopexit

10:                                               ; preds = %6
  br i1 %8, label %12, label %11

11:                                               ; preds = %10
  tail call void @_Z13annDeallocPtsRPPd(ptr noundef nonnull align 8 dereferenceable(8) @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters)
  br label %12

12:                                               ; preds = %11, %10
  %13 = tail call noundef ptr @_Z11annAllocPtsii(i32 noundef %3, i32 noundef %2)
  store ptr %13, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  %14 = icmp sgt i32 %3, 0
  %15 = icmp sgt i32 %2, 0
  %or.cond55 = and i1 %14, %15
  br i1 %or.cond55, label %.preheader.us.preheader, label %.loopexit

.preheader.us.preheader:                          ; preds = %12
  %wide.trip.count41 = zext nneg i32 %3 to i64
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %indvars.iv38 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next39, %._crit_edge.us ]
  br label %16

16:                                               ; preds = %.preheader.us, %16
  %indvars.iv = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next, %16 ]
  %17 = tail call noundef double @_ZL10annRanUnifdd(double noundef -1.000000e+00, double noundef 1.000000e+00)
  %18 = load ptr, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  %19 = getelementptr inbounds ptr, ptr %18, i64 %indvars.iv38
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = getelementptr inbounds double, ptr %20, i64 %indvars.iv
  store double %17, ptr %21, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us, label %16, !llvm.loop !11

._crit_edge.us:                                   ; preds = %16
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %exitcond42.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count41
  br i1 %exitcond42.not, label %.loopexit, label %.preheader.us, !llvm.loop !13

.loopexit:                                        ; preds = %._crit_edge.us, %12, %6
  %22 = icmp sgt i32 %1, 0
  br i1 %22, label %.lr.ph32, label %._crit_edge33

.lr.ph32:                                         ; preds = %.loopexit
  %23 = icmp sgt i32 %2, 0
  br i1 %23, label %.lr.ph.us.preheader, label %.lr.ph32.split

.lr.ph.us.preheader:                              ; preds = %.lr.ph32
  %wide.trip.count52 = zext nneg i32 %1 to i64
  %wide.trip.count47 = zext nneg i32 %2 to i64
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us34
  %indvars.iv49 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next50, %._crit_edge.us34 ]
  %24 = tail call noundef i32 @_ZL9annRanInti(i32 noundef %3)
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv49
  br label %27

27:                                               ; preds = %.lr.ph.us, %27
  %indvars.iv44 = phi i64 [ 0, %.lr.ph.us ], [ %indvars.iv.next45, %27 ]
  %28 = tail call noundef double @_ZL11annRanGaussv()
  %29 = load ptr, ptr @_ZZ15annClusGaussPtsPPdiii7ANNbooldE8clusters, align 8, !tbaa !5
  %30 = getelementptr inbounds ptr, ptr %29, i64 %25
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = getelementptr inbounds double, ptr %31, i64 %indvars.iv44
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = tail call double @llvm.fmuladd.f64(double %5, double %28, double %33)
  %35 = load ptr, ptr %26, align 8, !tbaa !5
  %36 = getelementptr inbounds double, ptr %35, i64 %indvars.iv44
  store double %34, ptr %36, align 8, !tbaa !9
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
  br i1 %exitcond48.not, label %._crit_edge.us34, label %27, !llvm.loop !14

._crit_edge.us34:                                 ; preds = %27
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond53.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count52
  br i1 %exitcond53.not, label %._crit_edge33, label %.lr.ph.us, !llvm.loop !15

._crit_edge33:                                    ; preds = %.lr.ph32.split, %._crit_edge.us34, %.loopexit
  ret void

.lr.ph32.split:                                   ; preds = %.lr.ph32, %.lr.ph32.split
  %.02530 = phi i32 [ %38, %.lr.ph32.split ], [ 0, %.lr.ph32 ]
  %37 = tail call noundef i32 @_ZL9annRanInti(i32 noundef %3)
  %38 = add nuw nsw i32 %.02530, 1
  %exitcond43.not = icmp eq i32 %38, %1
  br i1 %exitcond43.not, label %._crit_edge33, label %.lr.ph32.split, !llvm.loop !15
}

declare void @_Z13annDeallocPtsRPPd(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

declare noundef ptr @_Z11annAllocPtsii(i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL9annRanInti(i32 noundef) local_unnamed_addr #0

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { "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)"}
!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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass