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

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

@_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control = external hidden global ptr, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z7annRan0v() #0

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z16annClusOrthFlatsPPdiii7ANNbooldi(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, double noundef %5, i32 noundef %6) #3 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %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
  %19 = alloca double, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !11
  store double %5, ptr %13, align 8, !tbaa !13
  store i32 %6, ptr %14, align 4, !tbaa !9
  %23 = load ptr, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %28, label %25

25:                                               ; preds = %7
  %26 = load i32, ptr %12, align 4, !tbaa !11
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %91

28:                                               ; preds = %25, %7
  %29 = load ptr, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  call void @_Z13annDeallocPtsRPPd(ptr noundef nonnull align 8 dereferenceable(8) @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control)
  br label %32

32:                                               ; preds = %31, %28
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = call noundef ptr @_Z11annAllocPtsii(i32 noundef %33, i32 noundef %34)
  store ptr %35, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %87, %32
  %37 = load i32, ptr %15, align 4, !tbaa !9
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %90

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %42 = load i32, ptr %14, align 4, !tbaa !9
  %43 = call noundef i32 @_ZL9annRanInti(i32 noundef %42)
  %44 = add nsw i32 1, %43
  store i32 %44, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %83, %41
  %46 = load i32, ptr %18, align 4, !tbaa !9
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %86

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %51 = load i32, ptr %17, align 4, !tbaa !9
  %52 = sitofp i32 %51 to double
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = load i32, ptr %18, align 4, !tbaa !9
  %55 = sub nsw i32 %53, %54
  %56 = sitofp i32 %55 to double
  %57 = fdiv double %52, %56
  store double %57, ptr %19, align 8, !tbaa !13
  %58 = call noundef double @_Z7annRan0v()
  %59 = load double, ptr %19, align 8, !tbaa !13
  %60 = fcmp olt double %58, %59
  br i1 %60, label %61, label %72

61:                                               ; preds = %50
  %62 = load ptr, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %63 = load i32, ptr %15, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds ptr, ptr %62, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = load i32, ptr %18, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds double, ptr %66, i64 %68
  store double 9.990000e+02, ptr %69, align 8, !tbaa !13
  %70 = load i32, ptr %17, align 4, !tbaa !9
  %71 = add nsw i32 %70, -1
  store i32 %71, ptr %17, align 4, !tbaa !9
  br label %82

72:                                               ; preds = %50
  %73 = call noundef double @_ZL10annRanUnifdd(double noundef -1.000000e+00, double noundef 1.000000e+00)
  %74 = load ptr, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %75 = load i32, ptr %15, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds ptr, ptr %74, i64 %76
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = load i32, ptr %18, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds double, ptr %78, i64 %80
  store double %73, ptr %81, align 8, !tbaa !13
  br label %82

82:                                               ; preds = %72, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %18, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %18, align 4, !tbaa !9
  br label %45, !llvm.loop !15

86:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %15, align 4, !tbaa !9
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %15, align 4, !tbaa !9
  br label %36, !llvm.loop !17

90:                                               ; preds = %40
  br label %91

91:                                               ; preds = %90, %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  store i32 0, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %118, %91
  %93 = load i32, ptr %21, align 4, !tbaa !9
  %94 = load i32, ptr %11, align 4, !tbaa !9
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %121

97:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %98 = load i32, ptr %9, align 4, !tbaa !9
  %99 = load i32, ptr %21, align 4, !tbaa !9
  %100 = add nsw i32 %98, %99
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = sdiv i32 %100, %101
  store i32 %102, ptr %22, align 4, !tbaa !9
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = load i32, ptr %20, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds ptr, ptr %103, i64 %105
  %107 = load i32, ptr %22, align 4, !tbaa !9
  %108 = load i32, ptr %10, align 4, !tbaa !9
  %109 = load ptr, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %110 = load i32, ptr %21, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds ptr, ptr %109, i64 %111
  %113 = load ptr, ptr %112, align 8, !tbaa !5
  %114 = load double, ptr %13, align 8, !tbaa !13
  call void @_ZL11genOrthFlatPPdiiS_d(ptr noundef %106, i32 noundef %107, i32 noundef %108, ptr noundef %113, double noundef %114)
  %115 = load i32, ptr %22, align 4, !tbaa !9
  %116 = load i32, ptr %20, align 4, !tbaa !9
  %117 = add nsw i32 %116, %115
  store i32 %117, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %118

118:                                              ; preds = %97
  %119 = load i32, ptr %21, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %21, align 4, !tbaa !9
  br label %92, !llvm.loop !18

121:                                              ; preds = %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL11genOrthFlatPPdiiS_d(ptr noundef, i32 noundef, i32 noundef, ptr noundef, double noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 }

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


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

@_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control = external hidden global ptr, align 8

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

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

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

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

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

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

11:                                               ; preds = %7
  br i1 %9, label %13, label %12

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

13:                                               ; preds = %12, %11
  %14 = tail call noundef ptr @_Z11annAllocPtsii(i32 noundef %3, i32 noundef %2)
  store ptr %14, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %15 = icmp sgt i32 %3, 0
  br i1 %15, label %.lr.ph43, label %._crit_edge

.lr.ph43:                                         ; preds = %13
  %16 = icmp sgt i32 %2, 0
  br i1 %16, label %.lr.ph.us.preheader, label %.lr.ph43.split

.lr.ph.us.preheader:                              ; preds = %.lr.ph43
  %wide.trip.count52 = zext nneg i32 %3 to i64
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %indvars.iv49 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next50, %._crit_edge.us ]
  %17 = tail call noundef i32 @_ZL9annRanInti(i32 noundef %6)
  %18 = add nsw i32 %17, 1
  br label %19

19:                                               ; preds = %.lr.ph.us, %39
  %indvars.iv = phi i64 [ 0, %.lr.ph.us ], [ %indvars.iv.next, %39 ]
  %.03639.us = phi i32 [ %18, %.lr.ph.us ], [ %.1.us, %39 ]
  %20 = sitofp i32 %.03639.us to double
  %21 = trunc i64 %indvars.iv to i32
  %22 = sub i32 %2, %21
  %23 = sitofp i32 %22 to double
  %24 = fdiv double %20, %23
  %25 = tail call noundef double @_Z7annRan0v()
  %26 = fcmp olt double %25, %24
  br i1 %26, label %33, label %27

27:                                               ; preds = %19
  %28 = tail call noundef double @_ZL10annRanUnifdd(double noundef -1.000000e+00, double noundef 1.000000e+00)
  %29 = load ptr, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %30 = getelementptr inbounds ptr, ptr %29, i64 %indvars.iv49
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = getelementptr inbounds double, ptr %31, i64 %indvars.iv
  store double %28, ptr %32, align 8, !tbaa !9
  br label %39

33:                                               ; preds = %19
  %34 = load ptr, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %35 = getelementptr inbounds ptr, ptr %34, i64 %indvars.iv49
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = getelementptr inbounds double, ptr %36, i64 %indvars.iv
  store double 9.990000e+02, ptr %37, align 8, !tbaa !9
  %38 = add nsw i32 %.03639.us, -1
  br label %39

39:                                               ; preds = %33, %27
  %.1.us = phi i32 [ %38, %33 ], [ %.03639.us, %27 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond48.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond48.not, label %._crit_edge.us, label %19, !llvm.loop !11

._crit_edge.us:                                   ; preds = %39
  %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 %.loopexit, label %.lr.ph.us, !llvm.loop !13

.lr.ph43.split:                                   ; preds = %.lr.ph43, %.lr.ph43.split
  %.041 = phi i32 [ %41, %.lr.ph43.split ], [ 0, %.lr.ph43 ]
  %40 = tail call noundef i32 @_ZL9annRanInti(i32 noundef %6)
  %41 = add nuw nsw i32 %.041, 1
  %exitcond.not = icmp eq i32 %41, %3
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph43.split, !llvm.loop !13

.loopexit:                                        ; preds = %.lr.ph43.split, %._crit_edge.us, %7
  %42 = icmp sgt i32 %3, 0
  br i1 %42, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.loopexit
  %wide.trip.count57 = zext nneg i32 %3 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %13, %.loopexit
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv54 = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next55, %.lr.ph ]
  %.03444 = phi i32 [ 0, %.lr.ph.preheader ], [ %51, %.lr.ph ]
  %43 = trunc i64 %indvars.iv54 to i32
  %44 = add i32 %43, %1
  %45 = sdiv i32 %44, %3
  %46 = sext i32 %.03444 to i64
  %47 = getelementptr inbounds ptr, ptr %0, i64 %46
  %48 = load ptr, ptr @_ZZ16annClusOrthFlatsPPdiii7ANNbooldiE7control, align 8, !tbaa !5
  %49 = getelementptr inbounds ptr, ptr %48, i64 %indvars.iv54
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  tail call void @_ZL11genOrthFlatPPdiiS_d(ptr noundef %47, i32 noundef %45, i32 noundef %2, ptr noundef %50, double noundef %5)
  %51 = add nsw i32 %45, %.03444
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond58.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count57
  br i1 %exitcond58.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL11genOrthFlatPPdiiS_d(ptr noundef, i32 noundef, i32 noundef, ptr noundef, double 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 = { "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" }

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


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