; LLVM IR from scandum/blitsort :: src (bench)

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

@sorts = external dso_local global [4 x ptr], align 16
@.str.48 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [10 x i8], align 1

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

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

; Function Attrs: 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) #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @quadsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local void @quadsort_prim(ptr noundef, i64 noundef, i64 noundef) #4

; Function Attrs: noinline nounwind uwtable
declare dso_local i32 @cmp_int(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind
declare void @srand(i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @test_sort(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef) #4

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

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind
declare i32 @rand() #3

; Function Attrs: nounwind uwtable
define dso_local void @range_test(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #4 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %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 [40 x i8], align 16
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = mul nsw i32 %17, 10
  %19 = icmp sgt i32 %18, 2097152
  br i1 %19, label %20, label %23

20:                                               ; preds = %4
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = mul nsw i32 %21, 10
  br label %24

23:                                               ; preds = %4
  br label %24

24:                                               ; preds = %23, %20
  %25 = phi i32 [ %22, %20 ], [ 2097152, %23 ]
  store i32 %25, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = mul i64 %27, 4
  %29 = call noalias ptr @malloc(i64 noundef %28) #8
  store ptr %29, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %30 = load i32, ptr %11, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = mul i64 %31, 4
  %33 = call noalias ptr @malloc(i64 noundef %32) #8
  store ptr %33, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = mul i64 %35, 4
  %37 = call noalias ptr @malloc(i64 noundef %36) #8
  store ptr %37, ptr %15, align 8, !tbaa !9
  %38 = load i32, ptr %8, align 4, !tbaa !5
  call void @srand(i32 noundef %38) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %49, %24
  %40 = load i32, ptr %9, align 4, !tbaa !5
  %41 = load i32, ptr %11, align 4, !tbaa !5
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %43, label %52

43:                                               ; preds = %39
  %44 = call i32 @rand() #7
  %45 = load ptr, ptr %14, align 8, !tbaa !9
  %46 = load i32, ptr %9, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i32, ptr %45, i64 %47
  store i32 %44, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %43
  %50 = load i32, ptr %9, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %9, align 4, !tbaa !5
  br label %39, !llvm.loop !11

52:                                               ; preds = %39
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = icmp sle i32 %53, 4096
  br i1 %54, label %55, label %109

55:                                               ; preds = %52
  store i32 1, ptr %10, align 4, !tbaa !5
  store i32 131072, ptr %6, align 4, !tbaa !5
  store i32 4, ptr %7, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %100, %55
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = icmp sle i32 %57, %58
  br i1 %59, label %60, label %105

60:                                               ; preds = %56
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = icmp sge i32 %61, %62
  br i1 %63, label %64, label %99

64:                                               ; preds = %60
  %65 = getelementptr inbounds [40 x i8], ptr %12, i64 0, i64 0
  %66 = load i32, ptr %10, align 4, !tbaa !5
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %65, ptr noundef @.str.48, i32 noundef %66, i32 noundef %67) #7
  %69 = load ptr, ptr %15, align 8, !tbaa !9
  %70 = load ptr, ptr %14, align 8, !tbaa !9
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = mul i64 %72, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %69, ptr align 4 %70, i64 %73, i1 false)
  %74 = load ptr, ptr %15, align 8, !tbaa !9
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  call void @quadsort(ptr noundef %74, i64 noundef %76, i64 noundef 4, ptr noundef @cmp_int)
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %93, %64
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = icmp ult i64 %79, 4
  br i1 %80, label %81, label %96

81:                                               ; preds = %77
  %82 = load ptr, ptr %13, align 8, !tbaa !9
  %83 = load ptr, ptr %14, align 8, !tbaa !9
  %84 = load ptr, ptr %15, align 8, !tbaa !9
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [4 x ptr], ptr @sorts, i64 0, i64 %89
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  %92 = getelementptr inbounds [40 x i8], ptr %12, i64 0, i64 0
  call void @test_sort(ptr noundef %82, ptr noundef %83, ptr noundef %84, i32 noundef %85, i32 noundef %86, i32 noundef 50, i32 noundef %87, ptr noundef @qsort, ptr noundef %91, ptr noundef %92, i64 noundef 4, ptr noundef @cmp_int)
  br label %93

93:                                               ; preds = %81
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %9, align 4, !tbaa !5
  br label %77, !llvm.loop !13

96:                                               ; preds = %77
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %10, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %96, %60
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = mul nsw i32 %101, 2
  store i32 %102, ptr %7, align 4, !tbaa !5
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = sdiv i32 %103, 2
  store i32 %104, ptr %6, align 4, !tbaa !5
  br label %56, !llvm.loop !14

105:                                              ; preds = %56
  %106 = load ptr, ptr %13, align 8, !tbaa !9
  call void @free(ptr noundef %106) #7
  %107 = load ptr, ptr %14, align 8, !tbaa !9
  call void @free(ptr noundef %107) #7
  %108 = load ptr, ptr %15, align 8, !tbaa !9
  call void @free(ptr noundef %108) #7
  store i32 1, ptr %16, align 4
  br label %205

109:                                              ; preds = %52
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = icmp eq i32 %110, 10000000
  br i1 %111, label %112, label %154

112:                                              ; preds = %109
  store i32 10000000, ptr %7, align 4, !tbaa !5
  store i32 10, ptr %5, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %150, %112
  %114 = load i32, ptr %5, align 4, !tbaa !5
  %115 = icmp sle i32 %114, 10000000
  br i1 %115, label %116, label %153

116:                                              ; preds = %113
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = sdiv i32 %117, 10
  store i32 %118, ptr %7, align 4, !tbaa !5
  %119 = load ptr, ptr %15, align 8, !tbaa !9
  %120 = load ptr, ptr %14, align 8, !tbaa !9
  %121 = load i32, ptr %5, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = mul i64 %122, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %119, ptr align 4 %120, i64 %123, i1 false)
  %124 = load ptr, ptr %15, align 8, !tbaa !9
  %125 = load i32, ptr %5, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  call void @quadsort_prim(ptr noundef %124, i64 noundef %126, i64 noundef 4)
  %127 = getelementptr inbounds [40 x i8], ptr %12, i64 0, i64 0
  %128 = load i32, ptr %5, align 4, !tbaa !5
  %129 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %127, ptr noundef @.str.49, i32 noundef %128) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %146, %116
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = icmp ult i64 %132, 4
  br i1 %133, label %134, label %149

134:                                              ; preds = %130
  %135 = load ptr, ptr %13, align 8, !tbaa !9
  %136 = load ptr, ptr %14, align 8, !tbaa !9
  %137 = load ptr, ptr %15, align 8, !tbaa !9
  %138 = load i32, ptr %5, align 4, !tbaa !5
  %139 = load i32, ptr %5, align 4, !tbaa !5
  %140 = load i32, ptr %7, align 4, !tbaa !5
  %141 = load i32, ptr %9, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [4 x ptr], ptr @sorts, i64 0, i64 %142
  %144 = load ptr, ptr %143, align 8, !tbaa !9
  %145 = getelementptr inbounds [40 x i8], ptr %12, i64 0, i64 0
  call void @test_sort(ptr noundef %135, ptr noundef %136, ptr noundef %137, i32 noundef %138, i32 noundef %139, i32 noundef 10, i32 noundef %140, ptr noundef @qsort, ptr noundef %144, ptr noundef %145, i64 noundef 4, ptr noundef @cmp_int)
  br label %146

146:                                              ; preds = %134
  %147 = load i32, ptr %9, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %9, align 4, !tbaa !5
  br label %130, !llvm.loop !15

149:                                              ; preds = %130
  br label %150

150:                                              ; preds = %149
  %151 = load i32, ptr %5, align 4, !tbaa !5
  %152 = mul nsw i32 %151, 10
  store i32 %152, ptr %5, align 4, !tbaa !5
  br label %113, !llvm.loop !16

153:                                              ; preds = %113
  br label %201

154:                                              ; preds = %109
  store i32 131072, ptr %6, align 4, !tbaa !5
  store i32 4, ptr %7, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %195, %154
  %156 = load i32, ptr %6, align 4, !tbaa !5
  %157 = icmp sgt i32 %156, 0
  br i1 %157, label %158, label %200

158:                                              ; preds = %155
  %159 = load i32, ptr %5, align 4, !tbaa !5
  %160 = load i32, ptr %7, align 4, !tbaa !5
  %161 = icmp sge i32 %159, %160
  br i1 %161, label %162, label %194

162:                                              ; preds = %158
  %163 = load ptr, ptr %15, align 8, !tbaa !9
  %164 = load ptr, ptr %14, align 8, !tbaa !9
  %165 = load i32, ptr %7, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = mul i64 %166, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %163, ptr align 4 %164, i64 %167, i1 false)
  %168 = load ptr, ptr %15, align 8, !tbaa !9
  %169 = load i32, ptr %7, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  call void @quadsort(ptr noundef %168, i64 noundef %170, i64 noundef 4, ptr noundef @cmp_int)
  %171 = getelementptr inbounds [40 x i8], ptr %12, i64 0, i64 0
  %172 = load i32, ptr %7, align 4, !tbaa !5
  %173 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %171, ptr noundef @.str.49, i32 noundef %172) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %190, %162
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = icmp ult i64 %176, 4
  br i1 %177, label %178, label %193

178:                                              ; preds = %174
  %179 = load ptr, ptr %13, align 8, !tbaa !9
  %180 = load ptr, ptr %14, align 8, !tbaa !9
  %181 = load ptr, ptr %15, align 8, !tbaa !9
  %182 = load i32, ptr %7, align 4, !tbaa !5
  %183 = load i32, ptr %7, align 4, !tbaa !5
  %184 = load i32, ptr %6, align 4, !tbaa !5
  %185 = load i32, ptr %9, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [4 x ptr], ptr @sorts, i64 0, i64 %186
  %188 = load ptr, ptr %187, align 8, !tbaa !9
  %189 = getelementptr inbounds [40 x i8], ptr %12, i64 0, i64 0
  call void @test_sort(ptr noundef %179, ptr noundef %180, ptr noundef %181, i32 noundef %182, i32 noundef %183, i32 noundef 100, i32 noundef %184, ptr noundef @qsort, ptr noundef %188, ptr noundef %189, i64 noundef 4, ptr noundef @cmp_int)
  br label %190

190:                                              ; preds = %178
  %191 = load i32, ptr %9, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %9, align 4, !tbaa !5
  br label %174, !llvm.loop !17

193:                                              ; preds = %174
  br label %194

194:                                              ; preds = %193, %158
  br label %195

195:                                              ; preds = %194
  %196 = load i32, ptr %7, align 4, !tbaa !5
  %197 = mul nsw i32 %196, 2
  store i32 %197, ptr %7, align 4, !tbaa !5
  %198 = load i32, ptr %6, align 4, !tbaa !5
  %199 = sdiv i32 %198, 2
  store i32 %199, ptr %6, align 4, !tbaa !5
  br label %155, !llvm.loop !18

200:                                              ; preds = %155
  br label %201

201:                                              ; preds = %200, %153
  %202 = load ptr, ptr %13, align 8, !tbaa !9
  call void @free(ptr noundef %202) #7
  %203 = load ptr, ptr %14, align 8, !tbaa !9
  call void @free(ptr noundef %203) #7
  %204 = load ptr, ptr %15, align 8, !tbaa !9
  call void @free(ptr noundef %204) #7
  store i32 1, ptr %16, align 4
  br label %205

205:                                              ; preds = %201, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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 = { 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 #5 = { noinline 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 #6 = { "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 #7 = { nounwind }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !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"

@sorts = external dso_local local_unnamed_addr global [4 x ptr], align 16
@.str.48 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [10 x i8], align 1

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

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

; 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) #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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 #3

; Function Attrs: nounwind uwtable
declare dso_local void @quadsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local void @quadsort_prim(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: noinline nounwind uwtable
declare dso_local i32 @cmp_int(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare dso_local void @test_sort(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) #7

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #8

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #6

; Function Attrs: nounwind uwtable
define dso_local void @range_test(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #4 {
  %5 = alloca [40 x i8], align 16
  %6 = mul nsw i32 %0, 10
  %7 = tail call i32 @llvm.smax.i32(i32 %6, i32 2097152)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #10
  %8 = sext i32 %0 to i64
  %9 = shl nsw i64 %8, 2
  %10 = tail call noalias ptr @malloc(i64 noundef %9) #11
  %11 = zext nneg i32 %7 to i64
  %12 = shl nuw nsw i64 %11, 2
  %13 = tail call noalias ptr @malloc(i64 noundef %12) #11
  %14 = tail call noalias ptr @malloc(i64 noundef %9) #11
  tail call void @srand(i32 noundef %3) #10
  br label %15

15:                                               ; preds = %4, %15
  %indvars.iv = phi i64 [ 0, %4 ], [ %indvars.iv.next, %15 ]
  %16 = tail call i32 @rand() #10
  %17 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv
  store i32 %16, ptr %17, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %11
  br i1 %exitcond.not, label %18, label %15, !llvm.loop !9

18:                                               ; preds = %15
  %19 = icmp slt i32 %0, 4097
  br i1 %19, label %.preheader, label %30

.preheader:                                       ; preds = %18
  %.not93106 = icmp slt i32 %0, 4
  br i1 %.not93106, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.079109 = phi i32 [ %29, %.lr.ph ], [ 131072, %.preheader ]
  %.080108 = phi i32 [ %28, %.lr.ph ], [ 4, %.preheader ]
  %.085107 = phi i32 [ %27, %.lr.ph ], [ 1, %.preheader ]
  %20 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str.48, i32 noundef %.085107, i32 noundef %.080108) #10
  %21 = zext nneg i32 %.080108 to i64
  %22 = shl nuw nsw i64 %21, 2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %14, ptr noundef nonnull align 4 dereferenceable(1) %13, i64 %22, i1 false)
  call void @quadsort(ptr noundef %14, i64 noundef %21, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %23 = load ptr, ptr @sorts, align 16, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.085107, i32 noundef %.080108, i32 noundef 50, i32 noundef %.079109, ptr noundef nonnull @qsort, ptr noundef %23, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %24 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 8), align 8, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.085107, i32 noundef %.080108, i32 noundef 50, i32 noundef %.079109, ptr noundef nonnull @qsort, ptr noundef %24, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %25 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 16), align 16, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.085107, i32 noundef %.080108, i32 noundef 50, i32 noundef %.079109, ptr noundef nonnull @qsort, ptr noundef %25, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %26 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 24), align 8, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.085107, i32 noundef %.080108, i32 noundef 50, i32 noundef %.079109, ptr noundef nonnull @qsort, ptr noundef %26, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %27 = or disjoint i32 %.080108, 1
  %28 = shl nsw i32 %.080108, 1
  %29 = sdiv i32 %.079109, 2
  %.not93 = icmp sgt i32 %28, %0
  br i1 %.not93, label %._crit_edge, label %.lr.ph, !llvm.loop !13

30:                                               ; preds = %18
  %31 = icmp eq i32 %0, 10000000
  br i1 %31, label %.preheader94, label %.preheader96

.preheader94:                                     ; preds = %30, %.preheader94
  %.0104 = phi i32 [ %40, %.preheader94 ], [ 10, %30 ]
  %.181103 = phi i32 [ %32, %.preheader94 ], [ 10000000, %30 ]
  %32 = sdiv i32 %.181103, 10
  %33 = zext nneg i32 %.0104 to i64
  %34 = shl nuw nsw i64 %33, 2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %14, ptr noundef nonnull align 4 dereferenceable(1) %13, i64 %34, i1 false)
  call void @quadsort_prim(ptr noundef %14, i64 noundef %33, i64 noundef 4)
  %35 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str.49, i32 noundef %.0104) #10
  %36 = load ptr, ptr @sorts, align 16, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.0104, i32 noundef %.0104, i32 noundef 10, i32 noundef %32, ptr noundef nonnull @qsort, ptr noundef %36, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 8), align 8, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.0104, i32 noundef %.0104, i32 noundef 10, i32 noundef %32, ptr noundef nonnull @qsort, ptr noundef %37, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %38 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 16), align 16, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.0104, i32 noundef %.0104, i32 noundef 10, i32 noundef %32, ptr noundef nonnull @qsort, ptr noundef %38, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %39 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 24), align 8, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.0104, i32 noundef %.0104, i32 noundef 10, i32 noundef %32, ptr noundef nonnull @qsort, ptr noundef %39, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %40 = mul nuw nsw i32 %.0104, 10
  %41 = icmp ult i32 %.0104, 1000001
  br i1 %41, label %.preheader94, label %._crit_edge, !llvm.loop !14

.preheader96:                                     ; preds = %30, %.loopexit95
  %.1101 = phi i32 [ %50, %.loopexit95 ], [ 131072, %30 ]
  %.2100 = phi i32 [ %49, %.loopexit95 ], [ 4, %30 ]
  %.not92 = icmp sgt i32 %.2100, %0
  br i1 %.not92, label %.loopexit95, label %.loopexit95.loopexit

.loopexit95.loopexit:                             ; preds = %.preheader96
  %42 = zext nneg i32 %.2100 to i64
  %43 = shl nuw nsw i64 %42, 2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %14, ptr noundef nonnull align 4 dereferenceable(1) %13, i64 %43, i1 false)
  call void @quadsort(ptr noundef %14, i64 noundef %42, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %44 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str.49, i32 noundef %.2100) #10
  %45 = load ptr, ptr @sorts, align 16, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.2100, i32 noundef %.2100, i32 noundef 100, i32 noundef %.1101, ptr noundef nonnull @qsort, ptr noundef %45, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %46 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 8), align 8, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.2100, i32 noundef %.2100, i32 noundef 100, i32 noundef %.1101, ptr noundef nonnull @qsort, ptr noundef %46, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %47 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 16), align 16, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.2100, i32 noundef %.2100, i32 noundef 100, i32 noundef %.1101, ptr noundef nonnull @qsort, ptr noundef %47, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  %48 = load ptr, ptr getelementptr inbounds (i8, ptr @sorts, i64 24), align 8, !tbaa !11
  call void @test_sort(ptr noundef %10, ptr noundef %13, ptr noundef %14, i32 noundef %.2100, i32 noundef %.2100, i32 noundef 100, i32 noundef %.1101, ptr noundef nonnull @qsort, ptr noundef %48, ptr noundef nonnull %5, i64 noundef 4, ptr noundef nonnull @cmp_int)
  br label %.loopexit95

.loopexit95:                                      ; preds = %.loopexit95.loopexit, %.preheader96
  %49 = shl nsw i32 %.2100, 1
  %50 = lshr i32 %.1101, 1
  %.not = icmp ult i32 %.1101, 2
  br i1 %.not, label %._crit_edge, label %.preheader96, !llvm.loop !15

._crit_edge:                                      ; preds = %.loopexit95, %.preheader94, %.lr.ph, %.preheader
  call void @free(ptr noundef %10) #10
  call void @free(ptr noundef %13) #10
  call void @free(ptr noundef %14) #10
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #10
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #9

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { noinline 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 #6 = { 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 #7 = { 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 #8 = { nofree 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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
attributes #11 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass