; LLVM IR from DimitrisJim/leetcode_solutions :: C/Algorithms (937)

; 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
declare dso_local i32 @cmps(ptr noundef, ptr noundef) #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: nounwind uwtable
define dso_local ptr @reorderLogFiles(ptr noundef %0, i32 noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %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 i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = sdiv i32 %18, 2
  store i32 %19, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = sdiv i32 %20, 2
  store i32 %21, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = mul i64 %23, 8
  %25 = call noalias ptr @malloc(i64 noundef %24) #7
  store ptr %25, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = mul i64 %27, 8
  %29 = call noalias ptr @malloc(i64 noundef %28) #7
  store ptr %29, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %119, %3
  %31 = load i32, ptr %13, align 4, !tbaa !9
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %122

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load i32, ptr %13, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %36, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  store ptr %40, ptr %14, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %54, %35
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %44 = sext i8 %43 to i32
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %52

46:                                               ; preds = %41
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i32 1
  store ptr %48, ptr %14, align 8, !tbaa !5
  %49 = load i8, ptr %47, align 1, !tbaa !11
  %50 = sext i8 %49 to i32
  %51 = icmp ne i32 %50, 32
  br label %52

52:                                               ; preds = %46, %41
  %53 = phi i1 [ false, %41 ], [ %51, %46 ]
  br i1 %53, label %54, label %55

54:                                               ; preds = %52
  br label %41, !llvm.loop !12

55:                                               ; preds = %52
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %58 = sext i8 %57 to i32
  %59 = icmp sgt i32 %58, 57
  br i1 %59, label %60, label %89

60:                                               ; preds = %55
  %61 = load i32, ptr %10, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = icmp eq i32 %62, %63
  br i1 %64, label %65, label %78

65:                                               ; preds = %60
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = sitofp i32 %66 to double
  %68 = fmul double %67, 1.500000e+00
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = sitofp i32 %69 to double
  %71 = fmul double %70, %68
  %72 = fptosi double %71 to i32
  store i32 %72, ptr %8, align 4, !tbaa !9
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = load i32, ptr %8, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = mul i64 %75, 8
  %77 = call ptr @realloc(ptr noundef %73, i64 noundef %76) #8
  store ptr %77, ptr %12, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %65, %60
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = load i32, ptr %13, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds ptr, ptr %79, i64 %81
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %10, align 4, !tbaa !9
  %87 = sext i32 %85 to i64
  %88 = getelementptr inbounds ptr, ptr %84, i64 %87
  store ptr %83, ptr %88, align 8, !tbaa !5
  br label %118

89:                                               ; preds = %55
  %90 = load i32, ptr %9, align 4, !tbaa !9
  %91 = add nsw i32 %90, 1
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = icmp eq i32 %91, %92
  br i1 %93, label %94, label %107

94:                                               ; preds = %89
  %95 = load i32, ptr %7, align 4, !tbaa !9
  %96 = sitofp i32 %95 to double
  %97 = fmul double %96, 1.500000e+00
  %98 = load i32, ptr %7, align 4, !tbaa !9
  %99 = sitofp i32 %98 to double
  %100 = fmul double %99, %97
  %101 = fptosi double %100 to i32
  store i32 %101, ptr %7, align 4, !tbaa !9
  %102 = load ptr, ptr %11, align 8, !tbaa !5
  %103 = load i32, ptr %7, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = mul i64 %104, 8
  %106 = call ptr @realloc(ptr noundef %102, i64 noundef %105) #8
  store ptr %106, ptr %11, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %94, %89
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = load i32, ptr %13, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds ptr, ptr %108, i64 %110
  %112 = load ptr, ptr %111, align 8, !tbaa !5
  %113 = load ptr, ptr %11, align 8, !tbaa !5
  %114 = load i32, ptr %9, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %9, align 4, !tbaa !9
  %116 = sext i32 %114 to i64
  %117 = getelementptr inbounds ptr, ptr %113, i64 %116
  store ptr %112, ptr %117, align 8, !tbaa !5
  br label %118

118:                                              ; preds = %107, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %13, align 4, !tbaa !9
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %13, align 4, !tbaa !9
  br label %30, !llvm.loop !14

122:                                              ; preds = %34
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = load i32, ptr %10, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  call void @qsort(ptr noundef %123, i64 noundef %125, i64 noundef 8, ptr noundef @cmps)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %126 = load i32, ptr %10, align 4, !tbaa !9
  %127 = load i32, ptr %9, align 4, !tbaa !9
  %128 = add nsw i32 %126, %127
  store i32 %128, ptr %15, align 4, !tbaa !9
  %129 = load ptr, ptr %12, align 8, !tbaa !5
  %130 = load i32, ptr %15, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = mul i64 %131, 8
  %133 = call ptr @realloc(ptr noundef %129, i64 noundef %132) #8
  store ptr %133, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %134 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %134, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %135

135:                                              ; preds = %150, %122
  %136 = load i32, ptr %16, align 4, !tbaa !9
  %137 = load i32, ptr %15, align 4, !tbaa !9
  %138 = icmp slt i32 %136, %137
  br i1 %138, label %140, label %139

139:                                              ; preds = %135
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %155

140:                                              ; preds = %135
  %141 = load ptr, ptr %11, align 8, !tbaa !5
  %142 = load i32, ptr %17, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds ptr, ptr %141, i64 %143
  %145 = load ptr, ptr %144, align 8, !tbaa !5
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  %147 = load i32, ptr %16, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds ptr, ptr %146, i64 %148
  store ptr %145, ptr %149, align 8, !tbaa !5
  br label %150

150:                                              ; preds = %140
  %151 = load i32, ptr %16, align 4, !tbaa !9
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %16, align 4, !tbaa !9
  %153 = load i32, ptr %17, align 4, !tbaa !9
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %17, align 4, !tbaa !9
  br label %135, !llvm.loop !15

155:                                              ; preds = %139
  %156 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %156) #6
  %157 = load i32, ptr %15, align 4, !tbaa !9
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 %157, ptr %158, align 4, !tbaa !9
  %159 = load ptr, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret ptr %159
}

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #3

declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #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 = { 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 allocsize(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 #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 "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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind allocsize(1) }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


; 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
declare dso_local i32 @cmps(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @reorderLogFiles(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = sdiv i32 %1, 2
  %5 = sext i32 %4 to i64
  %6 = shl nsw i64 %5, 3
  %7 = tail call noalias ptr @malloc(i64 noundef %6) #6
  %8 = tail call noalias ptr @malloc(i64 noundef %6) #6
  %9 = icmp sgt i32 %1, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

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

._crit_edge:                                      ; preds = %54, %3
  %.063.lcssa = phi i32 [ 0, %3 ], [ %.164, %54 ]
  %.061.lcssa = phi i32 [ 0, %3 ], [ %.162, %54 ]
  %.058.lcssa = phi ptr [ %7, %3 ], [ %.260, %54 ]
  %.055.lcssa = phi ptr [ %8, %3 ], [ %.257, %54 ]
  %.058.lcssa98 = ptrtoint ptr %.058.lcssa to i64
  %10 = sext i32 %.061.lcssa to i64
  tail call void @qsort(ptr noundef %.055.lcssa, i64 noundef %10, i64 noundef 8, ptr noundef nonnull @cmps) #7
  %11 = add nsw i32 %.061.lcssa, %.063.lcssa
  %12 = sext i32 %11 to i64
  %13 = shl nsw i64 %12, 3
  %14 = tail call ptr @realloc(ptr noundef %.055.lcssa, i64 noundef %13) #8
  %15 = ptrtoint ptr %14 to i64
  %16 = icmp sgt i32 %.063.lcssa, 0
  br i1 %16, label %.lr.ph85.preheader, label %._crit_edge86

.lr.ph85.preheader:                               ; preds = %._crit_edge
  %17 = add nsw i64 %10, 1
  %smax = tail call i64 @llvm.smax.i64(i64 %17, i64 %12)
  %18 = sub i64 %smax, %10
  %min.iters.check = icmp ult i64 %18, 8
  br i1 %min.iters.check, label %.lr.ph85.preheader101, label %vector.memcheck

.lr.ph85.preheader101:                            ; preds = %middle.block, %vector.memcheck, %.lr.ph85.preheader
  %indvars.iv90.ph = phi i64 [ %10, %vector.memcheck ], [ %10, %.lr.ph85.preheader ], [ %ind.end, %middle.block ]
  %indvars.iv88.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph85.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph85

vector.memcheck:                                  ; preds = %.lr.ph85.preheader
  %19 = shl nsw i64 %10, 3
  %20 = add i64 %19, %15
  %21 = sub i64 %20, %.058.lcssa98
  %diff.check = icmp ult i64 %21, 32
  br i1 %diff.check, label %.lr.ph85.preheader101, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %18, -4
  %ind.end = add i64 %n.vec, %10
  %invariant.gep = getelementptr ptr, ptr %14, i64 %10
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %22 = getelementptr inbounds ptr, ptr %.058.lcssa, i64 %index
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %wide.load = load <2 x ptr>, ptr %22, align 8, !tbaa !5
  %wide.load100 = load <2 x ptr>, ptr %23, align 8, !tbaa !5
  %gep = getelementptr ptr, ptr %invariant.gep, i64 %index
  %24 = getelementptr inbounds i8, ptr %gep, i64 16
  store <2 x ptr> %wide.load, ptr %gep, align 8, !tbaa !5
  store <2 x ptr> %wide.load100, ptr %24, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %25 = icmp eq i64 %index.next, %n.vec
  br i1 %25, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %18, %n.vec
  br i1 %cmp.n, label %._crit_edge86, label %.lr.ph85.preheader101

.lr.ph:                                           ; preds = %.lr.ph.preheader, %54
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %54 ]
  %.05178 = phi i32 [ %4, %.lr.ph.preheader ], [ %.2, %54 ]
  %.05576 = phi ptr [ %8, %.lr.ph.preheader ], [ %.257, %54 ]
  %.05875 = phi ptr [ %7, %.lr.ph.preheader ], [ %.260, %54 ]
  %.06174 = phi i32 [ 0, %.lr.ph.preheader ], [ %.162, %54 ]
  %.06373 = phi i32 [ 0, %.lr.ph.preheader ], [ %.164, %54 ]
  %.06572 = phi i32 [ %4, %.lr.ph.preheader ], [ %.267, %54 ]
  %26 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %30, %.lr.ph
  %.052 = phi ptr [ %27, %.lr.ph ], [ %31, %30 ]
  %29 = load i8, ptr %.052, align 1, !tbaa !13
  %.not = icmp eq i8 %29, 0
  br i1 %.not, label %.critedge.thread, label %30

30:                                               ; preds = %28
  %31 = getelementptr inbounds i8, ptr %.052, i64 1
  %.not70 = icmp eq i8 %29, 32
  br i1 %.not70, label %.critedge, label %28, !llvm.loop !14

.critedge:                                        ; preds = %30
  %.pr = load i8, ptr %31, align 1, !tbaa !13
  %32 = icmp sgt i8 %.pr, 57
  br i1 %32, label %33, label %.critedge.thread

33:                                               ; preds = %.critedge
  %34 = add nsw i32 %.06174, 1
  %35 = icmp eq i32 %34, %.06572
  br i1 %35, label %36, label %54

36:                                               ; preds = %33
  %37 = sitofp i32 %.06572 to double
  %38 = fmul double %37, 1.500000e+00
  %39 = fmul double %38, %37
  %40 = fptosi double %39 to i32
  %41 = sext i32 %40 to i64
  %42 = shl nsw i64 %41, 3
  %43 = tail call ptr @realloc(ptr noundef %.05576, i64 noundef %42) #8
  br label %.sink.split

.critedge.thread:                                 ; preds = %28, %.critedge
  %44 = add nsw i32 %.06373, 1
  %45 = icmp eq i32 %44, %.05178
  br i1 %45, label %46, label %54

46:                                               ; preds = %.critedge.thread
  %47 = sitofp i32 %.05178 to double
  %48 = fmul double %47, 1.500000e+00
  %49 = fmul double %48, %47
  %50 = fptosi double %49 to i32
  %51 = sext i32 %50 to i64
  %52 = shl nsw i64 %51, 3
  %53 = tail call ptr @realloc(ptr noundef %.05875, i64 noundef %52) #8
  br label %.sink.split

.sink.split:                                      ; preds = %36, %46
  %.06373.sink.ph = phi i32 [ %.06373, %46 ], [ %.06174, %36 ]
  %.159.sink.ph = phi ptr [ %53, %46 ], [ %43, %36 ]
  %.267.ph = phi i32 [ %.06572, %46 ], [ %40, %36 ]
  %.164.ph = phi i32 [ %44, %46 ], [ %.06373, %36 ]
  %.162.ph = phi i32 [ %.06174, %46 ], [ %34, %36 ]
  %.260.ph = phi ptr [ %53, %46 ], [ %.05875, %36 ]
  %.257.ph = phi ptr [ %.05576, %46 ], [ %43, %36 ]
  %.2.ph = phi i32 [ %50, %46 ], [ %.05178, %36 ]
  %.pre95 = load ptr, ptr %26, align 8, !tbaa !5
  br label %54

54:                                               ; preds = %.sink.split, %.critedge.thread, %33
  %.06373.sink = phi i32 [ %.06174, %33 ], [ %.06373, %.critedge.thread ], [ %.06373.sink.ph, %.sink.split ]
  %.159.sink = phi ptr [ %.05576, %33 ], [ %.05875, %.critedge.thread ], [ %.159.sink.ph, %.sink.split ]
  %.sink = phi ptr [ %27, %33 ], [ %27, %.critedge.thread ], [ %.pre95, %.sink.split ]
  %.267 = phi i32 [ %.06572, %33 ], [ %.06572, %.critedge.thread ], [ %.267.ph, %.sink.split ]
  %.164 = phi i32 [ %.06373, %33 ], [ %44, %.critedge.thread ], [ %.164.ph, %.sink.split ]
  %.162 = phi i32 [ %34, %33 ], [ %.06174, %.critedge.thread ], [ %.162.ph, %.sink.split ]
  %.260 = phi ptr [ %.05875, %33 ], [ %.05875, %.critedge.thread ], [ %.260.ph, %.sink.split ]
  %.257 = phi ptr [ %.05576, %33 ], [ %.05576, %.critedge.thread ], [ %.257.ph, %.sink.split ]
  %.2 = phi i32 [ %.05178, %33 ], [ %.05178, %.critedge.thread ], [ %.2.ph, %.sink.split ]
  %55 = sext i32 %.06373.sink to i64
  %56 = getelementptr inbounds ptr, ptr %.159.sink, i64 %55
  store ptr %.sink, ptr %56, align 8, !tbaa !5
  %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, label %.lr.ph, !llvm.loop !15

._crit_edge86:                                    ; preds = %.lr.ph85, %middle.block, %._crit_edge
  tail call void @free(ptr noundef %.058.lcssa) #7
  store i32 %11, ptr %2, align 4, !tbaa !16
  ret ptr %14

.lr.ph85:                                         ; preds = %.lr.ph85.preheader101, %.lr.ph85
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %.lr.ph85 ], [ %indvars.iv90.ph, %.lr.ph85.preheader101 ]
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %.lr.ph85 ], [ %indvars.iv88.ph, %.lr.ph85.preheader101 ]
  %57 = getelementptr inbounds ptr, ptr %.058.lcssa, i64 %indvars.iv88
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds ptr, ptr %14, i64 %indvars.iv90
  store ptr %58, ptr %59, align 8, !tbaa !5
  %indvars.iv.next91 = add nsw i64 %indvars.iv90, 1
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %60 = icmp slt i64 %indvars.iv.next91, %12
  br i1 %60, label %.lr.ph85, label %._crit_edge86, !llvm.loop !18
}

; 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 nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #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 nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #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 nounwind willreturn allockind("realloc") allocsize(1) 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 #3 = { nofree "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 = { 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 nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind allocsize(0) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(1) }

!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 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = distinct !{!18, !10, !11}


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