; LLVM IR from AlgoGenesis/C :: String Algorithms/Burrows-Wheeler Transform (Program)

; 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.BWTResult = type { ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local void @burrows_wheeler_transform(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca [1000 x ptr], align 16
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = call i64 @strlen(ptr noundef %16) #6
  %18 = trunc i64 %17 to i32
  store i32 %18, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8000, ptr %6) #5
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = mul i64 %20, 4
  %22 = call noalias ptr @malloc(i64 noundef %21) #7
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.BWTResult, ptr %23, i32 0, i32 1
  store ptr %22, ptr %24, align 8, !tbaa !11
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  %27 = sext i32 %26 to i64
  %28 = mul i64 %27, 1
  %29 = call noalias ptr @malloc(i64 noundef %28) #7
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.BWTResult, ptr %30, i32 0, i32 0
  store ptr %29, ptr %31, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %86, %2
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = add nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = mul i64 %40, 1
  %42 = call noalias ptr @malloc(i64 noundef %41) #7
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %44
  store ptr %42, ptr %45, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %68, %37
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %71

51:                                               ; preds = %46
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = add nsw i32 %53, %54
  %56 = load i32, ptr %5, align 4, !tbaa !9
  %57 = srem i32 %55, %56
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %52, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !14
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i8, ptr %64, i64 %66
  store i8 %60, ptr %67, align 1, !tbaa !14
  br label %68

68:                                               ; preds = %51
  %69 = load i32, ptr %9, align 4, !tbaa !9
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %9, align 4, !tbaa !9
  br label %46, !llvm.loop !15

71:                                               ; preds = %50
  %72 = load i32, ptr %7, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %73
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  %76 = load i32, ptr %5, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i8, ptr %75, i64 %77
  store i8 0, ptr %78, align 1, !tbaa !14
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.BWTResult, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !11
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i32, ptr %82, i64 %84
  store i32 %79, ptr %85, align 4, !tbaa !9
  br label %86

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

89:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %166, %89
  %91 = load i32, ptr %10, align 4, !tbaa !9
  %92 = load i32, ptr %5, align 4, !tbaa !9
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %169

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %96

96:                                               ; preds = %162, %95
  %97 = load i32, ptr %11, align 4, !tbaa !9
  %98 = load i32, ptr %5, align 4, !tbaa !9
  %99 = sub nsw i32 %98, 1
  %100 = icmp slt i32 %97, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %96
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %165

102:                                              ; preds = %96
  %103 = load i32, ptr %11, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %104
  %106 = load ptr, ptr %105, align 8, !tbaa !5
  %107 = load i32, ptr %11, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %109
  %111 = load ptr, ptr %110, align 8, !tbaa !5
  %112 = call i32 @strcmp(ptr noundef %106, ptr noundef %111) #6
  %113 = icmp sgt i32 %112, 0
  br i1 %113, label %114, label %161

114:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %115 = load i32, ptr %11, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %116
  %118 = load ptr, ptr %117, align 8, !tbaa !5
  store ptr %118, ptr %12, align 8, !tbaa !5
  %119 = load i32, ptr %11, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %121
  %123 = load ptr, ptr %122, align 8, !tbaa !5
  %124 = load i32, ptr %11, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %125
  store ptr %123, ptr %126, align 8, !tbaa !5
  %127 = load ptr, ptr %12, align 8, !tbaa !5
  %128 = load i32, ptr %11, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %130
  store ptr %127, ptr %131, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.BWTResult, ptr %132, i32 0, i32 1
  %134 = load ptr, ptr %133, align 8, !tbaa !11
  %135 = load i32, ptr %11, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds i32, ptr %134, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !9
  store i32 %138, ptr %13, align 4, !tbaa !9
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.BWTResult, ptr %139, i32 0, i32 1
  %141 = load ptr, ptr %140, align 8, !tbaa !11
  %142 = load i32, ptr %11, align 4, !tbaa !9
  %143 = add nsw i32 %142, 1
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds i32, ptr %141, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !9
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.BWTResult, ptr %147, i32 0, i32 1
  %149 = load ptr, ptr %148, align 8, !tbaa !11
  %150 = load i32, ptr %11, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds i32, ptr %149, i64 %151
  store i32 %146, ptr %152, align 4, !tbaa !9
  %153 = load i32, ptr %13, align 4, !tbaa !9
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.BWTResult, ptr %154, i32 0, i32 1
  %156 = load ptr, ptr %155, align 8, !tbaa !11
  %157 = load i32, ptr %11, align 4, !tbaa !9
  %158 = add nsw i32 %157, 1
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i32, ptr %156, i64 %159
  store i32 %153, ptr %160, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %161

161:                                              ; preds = %114, %102
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %11, align 4, !tbaa !9
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %11, align 4, !tbaa !9
  br label %96, !llvm.loop !18

165:                                              ; preds = %101
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %10, align 4, !tbaa !9
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %10, align 4, !tbaa !9
  br label %90, !llvm.loop !19

169:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %170

170:                                              ; preds = %191, %169
  %171 = load i32, ptr %14, align 4, !tbaa !9
  %172 = load i32, ptr %5, align 4, !tbaa !9
  %173 = icmp slt i32 %171, %172
  br i1 %173, label %175, label %174

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

175:                                              ; preds = %170
  %176 = load i32, ptr %14, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %177
  %179 = load ptr, ptr %178, align 8, !tbaa !5
  %180 = load i32, ptr %5, align 4, !tbaa !9
  %181 = sub nsw i32 %180, 1
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds i8, ptr %179, i64 %182
  %184 = load i8, ptr %183, align 1, !tbaa !14
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.BWTResult, ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !13
  %188 = load i32, ptr %14, align 4, !tbaa !9
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds i8, ptr %187, i64 %189
  store i8 %184, ptr %190, align 1, !tbaa !14
  br label %191

191:                                              ; preds = %175
  %192 = load i32, ptr %14, align 4, !tbaa !9
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %14, align 4, !tbaa !9
  br label %170, !llvm.loop !20

194:                                              ; preds = %174
  %195 = load ptr, ptr %4, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.BWTResult, ptr %195, i32 0, i32 0
  %197 = load ptr, ptr %196, align 8, !tbaa !13
  %198 = load i32, ptr %5, align 4, !tbaa !9
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds i8, ptr %197, i64 %199
  store i8 0, ptr %200, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %201

201:                                              ; preds = %211, %194
  %202 = load i32, ptr %15, align 4, !tbaa !9
  %203 = load i32, ptr %5, align 4, !tbaa !9
  %204 = icmp slt i32 %202, %203
  br i1 %204, label %206, label %205

205:                                              ; preds = %201
  store i32 17, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %214

206:                                              ; preds = %201
  %207 = load i32, ptr %15, align 4, !tbaa !9
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [1000 x ptr], ptr %6, i64 0, i64 %208
  %210 = load ptr, ptr %209, align 8, !tbaa !5
  call void @free(ptr noundef %210) #5
  br label %211

211:                                              ; preds = %206
  %212 = load i32, ptr %15, align 4, !tbaa !9
  %213 = add nsw i32 %212, 1
  store i32 %213, ptr %15, align 4, !tbaa !9
  br label %201, !llvm.loop !21

214:                                              ; preds = %205
  call void @llvm.lifetime.end.p0(i64 8000, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret void
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

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

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 willreturn memory(read) "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(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 "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 }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { 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 = !{!12, !6, i64 8}
!12 = !{!"", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 0}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !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"

; Function Attrs: nounwind uwtable
define dso_local void @burrows_wheeler_transform(ptr nocapture noundef readonly %0, ptr nocapture noundef %1) local_unnamed_addr #0 {
  %3 = alloca [1000 x ptr], align 16
  %4 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #5
  %5 = trunc i64 %4 to i32
  call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %3) #6
  %sext = shl i64 %4, 32
  %6 = ashr exact i64 %sext, 32
  %7 = ashr exact i64 %sext, 30
  %8 = tail call noalias ptr @malloc(i64 noundef %7) #7
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %8, ptr %9, align 8, !tbaa !5
  %sext64 = add i64 %sext, 4294967296
  %10 = ashr exact i64 %sext64, 32
  %11 = tail call noalias ptr @malloc(i64 noundef %10) #7
  store ptr %11, ptr %1, align 8, !tbaa !10
  %12 = icmp sgt i32 %5, 0
  br i1 %12, label %.lr.ph.us.preheader, label %._crit_edge.thread

.lr.ph.us.preheader:                              ; preds = %2
  %wide.trip.count86 = and i64 %4, 2147483647
  %13 = add nsw i64 %wide.trip.count86, -1
  %xtraiter = and i64 %4, 1
  %14 = icmp eq i64 %13, 0
  %unroll_iter = sub nsw i64 %wide.trip.count86, %xtraiter
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %indvars.iv83 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next84, %._crit_edge.us ]
  %15 = tail call noalias ptr @malloc(i64 noundef %10) #7
  %16 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv83
  store ptr %15, ptr %16, align 8, !tbaa !11
  br i1 %14, label %._crit_edge.us.unr-lcssa, label %.lr.ph.us.new

.lr.ph.us.new:                                    ; preds = %.lr.ph.us, %.lr.ph.us.new
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph.us.new ], [ 0, %.lr.ph.us ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph.us.new ], [ 0, %.lr.ph.us ]
  %17 = add nuw nsw i64 %indvars.iv, %indvars.iv83
  %18 = trunc nuw nsw i64 %17 to i32
  %19 = urem i32 %18, %5
  %20 = zext nneg i32 %19 to i64
  %21 = getelementptr inbounds i8, ptr %0, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !12
  %23 = getelementptr inbounds i8, ptr %15, i64 %indvars.iv
  store i8 %22, ptr %23, align 1, !tbaa !12
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %24 = add nuw nsw i64 %indvars.iv.next, %indvars.iv83
  %25 = trunc nuw nsw i64 %24 to i32
  %26 = urem i32 %25, %5
  %27 = zext nneg i32 %26 to i64
  %28 = getelementptr inbounds i8, ptr %0, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %15, i64 %indvars.iv.next
  store i8 %29, ptr %30, align 1, !tbaa !12
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.lr.ph.us.new, !llvm.loop !13

._crit_edge.us.unr-lcssa:                         ; preds = %.lr.ph.us.new, %.lr.ph.us
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.us ], [ %indvars.iv.next.1, %.lr.ph.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %._crit_edge.us.epilog-lcssa

._crit_edge.us.epilog-lcssa:                      ; preds = %._crit_edge.us.unr-lcssa
  %31 = add nuw nsw i64 %indvars.iv.unr, %indvars.iv83
  %32 = trunc nuw nsw i64 %31 to i32
  %33 = urem i32 %32, %5
  %34 = zext nneg i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %0, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !12
  %37 = getelementptr inbounds i8, ptr %15, i64 %indvars.iv.unr
  store i8 %36, ptr %37, align 1, !tbaa !12
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %38 = getelementptr inbounds i8, ptr %15, i64 %6
  store i8 0, ptr %38, align 1, !tbaa !12
  %39 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv83
  %40 = trunc nuw nsw i64 %indvars.iv83 to i32
  store i32 %40, ptr %39, align 4, !tbaa !15
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
  br i1 %exitcond87.not, label %.preheader67, label %.lr.ph.us, !llvm.loop !17

.preheader67:                                     ; preds = %._crit_edge.us
  br i1 %12, label %.preheader66.lr.ph, label %._crit_edge.thread

.preheader66.lr.ph:                               ; preds = %.preheader67
  %.not = icmp eq i32 %5, 1
  br i1 %.not, label %.lr.ph, label %.preheader66.us.preheader

.preheader66.us.preheader:                        ; preds = %.preheader66.lr.ph
  %41 = add i64 %4, 4294967295
  %wide.trip.count91 = and i64 %41, 4294967295
  br label %.preheader66.us

.preheader66.us:                                  ; preds = %.preheader66.us.preheader, %._crit_edge.us75
  %.06173.us = phi i32 [ %55, %._crit_edge.us75 ], [ 0, %.preheader66.us.preheader ]
  %.pre = load ptr, ptr %3, align 16, !tbaa !11
  br label %42

42:                                               ; preds = %.preheader66.us, %53
  %43 = phi ptr [ %.pre, %.preheader66.us ], [ %54, %53 ]
  %indvars.iv88 = phi i64 [ 0, %.preheader66.us ], [ %indvars.iv.next89, %53 ]
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %44 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv.next89
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  %46 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %43, ptr noundef nonnull dereferenceable(1) %45) #5
  %47 = icmp sgt i32 %46, 0
  br i1 %47, label %48, label %53

48:                                               ; preds = %42
  %49 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv88
  store ptr %45, ptr %49, align 8, !tbaa !11
  store ptr %43, ptr %44, align 8, !tbaa !11
  %50 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv88
  %51 = load <2 x i32>, ptr %50, align 4, !tbaa !15
  %52 = shufflevector <2 x i32> %51, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i32> %52, ptr %50, align 4, !tbaa !15
  br label %53

53:                                               ; preds = %48, %42
  %54 = phi ptr [ %43, %48 ], [ %45, %42 ]
  %exitcond92.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count91
  br i1 %exitcond92.not, label %._crit_edge.us75, label %42, !llvm.loop !18

._crit_edge.us75:                                 ; preds = %53
  %55 = add nuw nsw i32 %.06173.us, 1
  %exitcond93.not = icmp eq i32 %55, %5
  br i1 %exitcond93.not, label %.preheader, label %.preheader66.us, !llvm.loop !19

.preheader:                                       ; preds = %._crit_edge.us75
  br i1 %12, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.preheader66.lr.ph, %.preheader
  %sext65 = add nsw i64 %sext, -4294967296
  %56 = ashr exact i64 %sext65, 32
  %xtraiter107 = and i64 %4, 3
  %57 = icmp ult i64 %13, 3
  br i1 %57, label %._crit_edge.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter109 = sub nsw i64 %wide.trip.count86, %xtraiter107
  br label %66

._crit_edge.thread:                               ; preds = %.preheader, %.preheader67, %2
  %58 = getelementptr inbounds i8, ptr %11, i64 %6
  store i8 0, ptr %58, align 1, !tbaa !12
  br label %._crit_edge80

._crit_edge.unr-lcssa:                            ; preds = %66, %.lr.ph
  %indvars.iv94.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next95.3, %66 ]
  %lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
  br i1 %lcmp.mod108.not, label %._crit_edge, label %.epil.preheader106

.epil.preheader106:                               ; preds = %._crit_edge.unr-lcssa, %.epil.preheader106
  %indvars.iv94.epil = phi i64 [ %indvars.iv.next95.epil, %.epil.preheader106 ], [ %indvars.iv94.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader106 ], [ 0, %._crit_edge.unr-lcssa ]
  %59 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv94.epil
  %60 = load ptr, ptr %59, align 8, !tbaa !11
  %61 = getelementptr inbounds i8, ptr %60, i64 %56
  %62 = load i8, ptr %61, align 1, !tbaa !12
  %63 = load ptr, ptr %1, align 8, !tbaa !10
  %64 = getelementptr inbounds i8, ptr %63, i64 %indvars.iv94.epil
  store i8 %62, ptr %64, align 1, !tbaa !12
  %indvars.iv.next95.epil = add nuw nsw i64 %indvars.iv94.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter107
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader106, !llvm.loop !20

._crit_edge:                                      ; preds = %.epil.preheader106, %._crit_edge.unr-lcssa
  %.pre104 = load ptr, ptr %1, align 8, !tbaa !10
  %65 = getelementptr inbounds i8, ptr %.pre104, i64 %6
  store i8 0, ptr %65, align 1, !tbaa !12
  br i1 %12, label %.lr.ph79.preheader, label %._crit_edge80

.lr.ph79.preheader:                               ; preds = %._crit_edge
  %wide.trip.count102 = and i64 %4, 2147483647
  br label %.lr.ph79

66:                                               ; preds = %66, %.lr.ph.new
  %indvars.iv94 = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next95.3, %66 ]
  %niter110 = phi i64 [ 0, %.lr.ph.new ], [ %niter110.next.3, %66 ]
  %67 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv94
  %68 = load ptr, ptr %67, align 16, !tbaa !11
  %69 = getelementptr inbounds i8, ptr %68, i64 %56
  %70 = load i8, ptr %69, align 1, !tbaa !12
  %71 = load ptr, ptr %1, align 8, !tbaa !10
  %72 = getelementptr inbounds i8, ptr %71, i64 %indvars.iv94
  store i8 %70, ptr %72, align 1, !tbaa !12
  %indvars.iv.next95 = or disjoint i64 %indvars.iv94, 1
  %73 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv.next95
  %74 = load ptr, ptr %73, align 8, !tbaa !11
  %75 = getelementptr inbounds i8, ptr %74, i64 %56
  %76 = load i8, ptr %75, align 1, !tbaa !12
  %77 = load ptr, ptr %1, align 8, !tbaa !10
  %78 = getelementptr inbounds i8, ptr %77, i64 %indvars.iv.next95
  store i8 %76, ptr %78, align 1, !tbaa !12
  %indvars.iv.next95.1 = or disjoint i64 %indvars.iv94, 2
  %79 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv.next95.1
  %80 = load ptr, ptr %79, align 16, !tbaa !11
  %81 = getelementptr inbounds i8, ptr %80, i64 %56
  %82 = load i8, ptr %81, align 1, !tbaa !12
  %83 = load ptr, ptr %1, align 8, !tbaa !10
  %84 = getelementptr inbounds i8, ptr %83, i64 %indvars.iv.next95.1
  store i8 %82, ptr %84, align 1, !tbaa !12
  %indvars.iv.next95.2 = or disjoint i64 %indvars.iv94, 3
  %85 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv.next95.2
  %86 = load ptr, ptr %85, align 8, !tbaa !11
  %87 = getelementptr inbounds i8, ptr %86, i64 %56
  %88 = load i8, ptr %87, align 1, !tbaa !12
  %89 = load ptr, ptr %1, align 8, !tbaa !10
  %90 = getelementptr inbounds i8, ptr %89, i64 %indvars.iv.next95.2
  store i8 %88, ptr %90, align 1, !tbaa !12
  %indvars.iv.next95.3 = add nuw nsw i64 %indvars.iv94, 4
  %niter110.next.3 = add i64 %niter110, 4
  %niter110.ncmp.3 = icmp eq i64 %niter110.next.3, %unroll_iter109
  br i1 %niter110.ncmp.3, label %._crit_edge.unr-lcssa, label %66, !llvm.loop !22

._crit_edge80:                                    ; preds = %.lr.ph79, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %3) #6
  ret void

.lr.ph79:                                         ; preds = %.lr.ph79.preheader, %.lr.ph79
  %indvars.iv99 = phi i64 [ 0, %.lr.ph79.preheader ], [ %indvars.iv.next100, %.lr.ph79 ]
  %91 = getelementptr inbounds [1000 x ptr], ptr %3, i64 0, i64 %indvars.iv99
  %92 = load ptr, ptr %91, align 8, !tbaa !11
  tail call void @free(ptr noundef %92) #6
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %exitcond103.not = icmp eq i64 %indvars.iv.next100, %wide.trip.count102
  br i1 %exitcond103.not, label %._crit_edge80, label %.lr.ph79, !llvm.loop !23
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 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 #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 = { nounwind willreturn memory(read) }
attributes #6 = { nounwind }
attributes #7 = { 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, !7, i64 8}
!6 = !{!"", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!8, !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !8, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}


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