; LLVM IR from yourtion/LearningMasteringAlgorithms-C :: source (rxsort)

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rxsort(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %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
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %18 = load i32, ptr %9, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = mul i64 %19, 4
  %21 = call noalias ptr @malloc(i64 noundef %20) #6
  store ptr %21, ptr %10, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %4
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %163

24:                                               ; preds = %4
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = mul i64 %26, 4
  %28 = call noalias ptr @malloc(i64 noundef %27) #6
  store ptr %28, ptr %11, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %24
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %163

31:                                               ; preds = %24
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %157, %31
  %33 = load i32, ptr %16, align 4, !tbaa !9
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %36, label %160

36:                                               ; preds = %32
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %46, %36
  %38 = load i32, ptr %14, align 4, !tbaa !9
  %39 = load i32, ptr %9, align 4, !tbaa !9
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %41, label %49

41:                                               ; preds = %37
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = load i32, ptr %14, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr %42, i64 %44
  store i32 0, ptr %45, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %41
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %14, align 4, !tbaa !9
  br label %37, !llvm.loop !11

49:                                               ; preds = %37
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = sitofp i32 %50 to double
  %52 = load i32, ptr %16, align 4, !tbaa !9
  %53 = sitofp i32 %52 to double
  %54 = call double @pow(double noundef %51, double noundef %53) #5
  %55 = fptosi double %54 to i32
  store i32 %55, ptr %13, align 4, !tbaa !9
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %80, %49
  %57 = load i32, ptr %15, align 4, !tbaa !9
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %60, label %83

60:                                               ; preds = %56
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = load i32, ptr %15, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i32, ptr %61, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = load i32, ptr %13, align 4, !tbaa !9
  %67 = sdiv i32 %65, %66
  %68 = load i32, ptr %9, align 4, !tbaa !9
  %69 = srem i32 %67, %68
  store i32 %69, ptr %12, align 4, !tbaa !9
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = load i32, ptr %12, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i32, ptr %70, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = load i32, ptr %12, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %76, i64 %78
  store i32 %75, ptr %79, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %60
  %81 = load i32, ptr %15, align 4, !tbaa !9
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %15, align 4, !tbaa !9
  br label %56, !llvm.loop !13

83:                                               ; preds = %56
  store i32 1, ptr %14, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %105, %83
  %85 = load i32, ptr %14, align 4, !tbaa !9
  %86 = load i32, ptr %9, align 4, !tbaa !9
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %88, label %108

88:                                               ; preds = %84
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = load i32, ptr %14, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr %89, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !9
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = load i32, ptr %14, align 4, !tbaa !9
  %96 = sub nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds i32, ptr %94, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !9
  %100 = add nsw i32 %93, %99
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = load i32, ptr %14, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i32, ptr %101, i64 %103
  store i32 %100, ptr %104, align 4, !tbaa !9
  br label %105

105:                                              ; preds = %88
  %106 = load i32, ptr %14, align 4, !tbaa !9
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %14, align 4, !tbaa !9
  br label %84, !llvm.loop !14

108:                                              ; preds = %84
  %109 = load i32, ptr %7, align 4, !tbaa !9
  %110 = sub nsw i32 %109, 1
  store i32 %110, ptr %15, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %148, %108
  %112 = load i32, ptr %15, align 4, !tbaa !9
  %113 = icmp sge i32 %112, 0
  br i1 %113, label %114, label %151

114:                                              ; preds = %111
  %115 = load ptr, ptr %6, align 8, !tbaa !5
  %116 = load i32, ptr %15, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds i32, ptr %115, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !9
  %120 = load i32, ptr %13, align 4, !tbaa !9
  %121 = sdiv i32 %119, %120
  %122 = load i32, ptr %9, align 4, !tbaa !9
  %123 = srem i32 %121, %122
  store i32 %123, ptr %12, align 4, !tbaa !9
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = load i32, ptr %15, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds i32, ptr %124, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !9
  %129 = load ptr, ptr %11, align 8, !tbaa !5
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = load i32, ptr %12, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds i32, ptr %130, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !9
  %135 = sub nsw i32 %134, 1
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds i32, ptr %129, i64 %136
  store i32 %128, ptr %137, align 4, !tbaa !9
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = load i32, ptr %12, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds i32, ptr %138, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !9
  %143 = sub nsw i32 %142, 1
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = load i32, ptr %12, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds i32, ptr %144, i64 %146
  store i32 %143, ptr %147, align 4, !tbaa !9
  br label %148

148:                                              ; preds = %114
  %149 = load i32, ptr %15, align 4, !tbaa !9
  %150 = add nsw i32 %149, -1
  store i32 %150, ptr %15, align 4, !tbaa !9
  br label %111, !llvm.loop !15

151:                                              ; preds = %111
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = load ptr, ptr %11, align 8, !tbaa !5
  %154 = load i32, ptr %7, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = mul i64 %155, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %152, ptr align 4 %153, i64 %156, i1 false)
  br label %157

157:                                              ; preds = %151
  %158 = load i32, ptr %16, align 4, !tbaa !9
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %16, align 4, !tbaa !9
  br label %32, !llvm.loop !16

160:                                              ; preds = %32
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %161) #5
  %162 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %162) #5
  store i32 0, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %163

163:                                              ; preds = %160, %30, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %164 = load i32, ptr %5, align 4
  ret i32 %164
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

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

attributes #0 = { 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 = { nounwind allocsize(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 "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


; 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: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @rxsort(ptr nocapture noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = sext i32 %3 to i64
  %6 = shl nsw i64 %5, 2
  %7 = tail call noalias ptr @malloc(i64 noundef %6) #6
  %8 = icmp eq ptr %7, null
  br i1 %8, label %59, label %9

9:                                                ; preds = %4
  %10 = sext i32 %1 to i64
  %11 = shl nsw i64 %10, 2
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #6
  %13 = icmp eq ptr %12, null
  br i1 %13, label %59, label %.preheader63

.preheader63:                                     ; preds = %9
  %14 = icmp sgt i32 %2, 0
  br i1 %14, label %.preheader62.lr.ph, label %._crit_edge74

.preheader62.lr.ph:                               ; preds = %.preheader63
  %15 = icmp sgt i32 %3, 0
  %16 = sitofp i32 %3 to double
  %17 = icmp sgt i32 %1, 0
  %18 = icmp sgt i32 %3, 1
  %invariant.gep = getelementptr i8, ptr %12, i64 -4
  %19 = zext i32 %3 to i64
  %20 = shl nuw nsw i64 %19, 2
  %21 = zext i32 %1 to i64
  %22 = add nsw i64 %19, -1
  %23 = add nsw i64 %19, -2
  %xtraiter = and i64 %22, 3
  %24 = icmp ult i64 %23, 3
  %unroll_iter = and i64 %22, -4
  %invariant.gep86 = getelementptr inbounds i8, ptr %7, i64 4
  %invariant.gep88 = getelementptr inbounds i8, ptr %7, i64 8
  %invariant.gep90 = getelementptr inbounds i8, ptr %7, i64 12
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader62

.preheader62:                                     ; preds = %.preheader62.lr.ph, %._crit_edge72
  %.073 = phi i32 [ 0, %.preheader62.lr.ph ], [ %58, %._crit_edge72 ]
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader62
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %7, i8 0, i64 %20, i1 false), !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %.preheader62
  %25 = uitofp nneg i32 %.073 to double
  %26 = tail call double @pow(double noundef %16, double noundef %25) #7
  %27 = fptosi double %26 to i32
  br i1 %17, label %.lr.ph67, label %.preheader61

.preheader61:                                     ; preds = %.lr.ph67, %._crit_edge
  br i1 %18, label %.lr.ph69.preheader, label %.preheader

.lr.ph69.preheader:                               ; preds = %.preheader61
  %load_initial = load i32, ptr %7, align 4
  br i1 %24, label %.preheader.loopexit.unr-lcssa, label %.lr.ph69

.lr.ph67:                                         ; preds = %._crit_edge, %.lr.ph67
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph67 ], [ 0, %._crit_edge ]
  %28 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sdiv i32 %29, %27
  %31 = srem i32 %30, %3
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr %7, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %33, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %21
  br i1 %exitcond.not, label %.preheader61, label %.lr.ph67, !llvm.loop !9

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph69, %.lr.ph69.preheader
  %store_forwarded.unr = phi i32 [ %load_initial, %.lr.ph69.preheader ], [ %47, %.lr.ph69 ]
  %indvars.iv77.unr = phi i64 [ 1, %.lr.ph69.preheader ], [ %indvars.iv.next78.3, %.lr.ph69 ]
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph69.epil

.lr.ph69.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph69.epil
  %store_forwarded.epil = phi i32 [ %38, %.lr.ph69.epil ], [ %store_forwarded.unr, %.preheader.loopexit.unr-lcssa ]
  %indvars.iv77.epil = phi i64 [ %indvars.iv.next78.epil, %.lr.ph69.epil ], [ %indvars.iv77.unr, %.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph69.epil ], [ 0, %.preheader.loopexit.unr-lcssa ]
  %36 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv77.epil
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = add nsw i32 %store_forwarded.epil, %37
  store i32 %38, ptr %36, align 4, !tbaa !5
  %indvars.iv.next78.epil = add nuw nsw i64 %indvars.iv77.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.lr.ph69.epil, !llvm.loop !11

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph69.epil, %.preheader61
  br i1 %17, label %.lr.ph71, label %._crit_edge72

.lr.ph69:                                         ; preds = %.lr.ph69.preheader, %.lr.ph69
  %store_forwarded = phi i32 [ %47, %.lr.ph69 ], [ %load_initial, %.lr.ph69.preheader ]
  %indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %.lr.ph69 ], [ 1, %.lr.ph69.preheader ]
  %niter = phi i64 [ %niter.next.3, %.lr.ph69 ], [ 0, %.lr.ph69.preheader ]
  %39 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv77
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %store_forwarded, %40
  store i32 %41, ptr %39, align 4, !tbaa !5
  %gep87 = getelementptr inbounds i32, ptr %invariant.gep86, i64 %indvars.iv77
  %42 = load i32, ptr %gep87, align 4, !tbaa !5
  %43 = add nsw i32 %41, %42
  store i32 %43, ptr %gep87, align 4, !tbaa !5
  %gep89 = getelementptr inbounds i32, ptr %invariant.gep88, i64 %indvars.iv77
  %44 = load i32, ptr %gep89, align 4, !tbaa !5
  %45 = add nsw i32 %43, %44
  store i32 %45, ptr %gep89, align 4, !tbaa !5
  %gep91 = getelementptr inbounds i32, ptr %invariant.gep90, i64 %indvars.iv77
  %46 = load i32, ptr %gep91, align 4, !tbaa !5
  %47 = add nsw i32 %45, %46
  store i32 %47, ptr %gep91, align 4, !tbaa !5
  %indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.loopexit.unr-lcssa, label %.lr.ph69, !llvm.loop !13

.lr.ph71:                                         ; preds = %.preheader, %.lr.ph71
  %indvars.iv82 = phi i64 [ %indvars.iv.next83, %.lr.ph71 ], [ %21, %.preheader ]
  %indvars.iv.next83 = add nsw i64 %indvars.iv82, -1
  %48 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv.next83
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sdiv i32 %49, %27
  %51 = srem i32 %50, %3
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr %7, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %gep = getelementptr i32, ptr %invariant.gep, i64 %55
  store i32 %49, ptr %gep, align 4, !tbaa !5
  %56 = add nsw i32 %54, -1
  store i32 %56, ptr %53, align 4, !tbaa !5
  %57 = icmp sgt i64 %indvars.iv82, 1
  br i1 %57, label %.lr.ph71, label %._crit_edge72, !llvm.loop !14

._crit_edge72:                                    ; preds = %.lr.ph71, %.preheader
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr nonnull align 4 %12, i64 %11, i1 false)
  %58 = add nuw nsw i32 %.073, 1
  %exitcond85.not = icmp eq i32 %58, %2
  br i1 %exitcond85.not, label %._crit_edge74, label %.preheader62, !llvm.loop !15

._crit_edge74:                                    ; preds = %._crit_edge72, %.preheader63
  tail call void @free(ptr noundef %7) #7
  tail call void @free(ptr noundef %12) #7
  br label %59

59:                                               ; preds = %9, %4, %._crit_edge74
  %.056 = phi i32 [ 0, %._crit_edge74 ], [ -1, %4 ], [ -1, %9 ]
  ret i32 %.056
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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

attributes #0 = { 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nofree nounwind willreturn memory(write) "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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0) }
attributes #7 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass