; LLVM IR from onnx/onnx-mlir :: src/Runtime (OMSort)

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

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@__PRETTY_FUNCTION__.quick_sort_custom = external hidden unnamed_addr constant [78 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [22 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: nounwind uwtable
define dso_local void @quick_sort_custom(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca %struct.indexStack, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %17, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %18 = load i64, ptr %7, align 8, !tbaa !9
  %19 = add i64 %18, 1
  %20 = call i64 @log2u(i64 noundef %19)
  %21 = add nsw i64 %20, 2
  %22 = mul nsw i64 %21, 2
  store i64 %22, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #3
  br label %23

23:                                               ; preds = %5
  %24 = load i64, ptr %12, align 8, !tbaa !9
  %25 = icmp sgt i64 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  br label %28

27:                                               ; preds = %23
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 245, ptr noundef @__PRETTY_FUNCTION__.quick_sort_custom) #4
  unreachable

28:                                               ; preds = %26
  %29 = load i64, ptr %12, align 8, !tbaa !9
  %30 = mul i64 %29, 8
  %31 = alloca i8, i64 %30, align 16
  %32 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  store ptr %31, ptr %32, align 8, !tbaa !11
  %33 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %37

36:                                               ; preds = %28
  br label %38

37:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 245, ptr noundef @__PRETTY_FUNCTION__.quick_sort_custom) #4
  unreachable

38:                                               ; preds = %36
  %39 = load i64, ptr %12, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 1
  store i64 %39, ptr %40, align 8, !tbaa !13
  %41 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  store i64 0, ptr %41, align 8, !tbaa !14
  br label %42

42:                                               ; preds = %38
  br label %43

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store i64 0, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %44 = load i64, ptr %7, align 8, !tbaa !9
  %45 = sub i64 %44, 1
  store i64 %45, ptr %15, align 8, !tbaa !9
  br label %46

46:                                               ; preds = %43
  %47 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %48 = load i64, ptr %47, align 8, !tbaa !14
  %49 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 1
  %50 = load i64, ptr %49, align 8, !tbaa !13
  %51 = sub nsw i64 %50, 2
  %52 = icmp sle i64 %48, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %46
  br label %55

54:                                               ; preds = %46
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 250, ptr noundef @__PRETTY_FUNCTION__.quick_sort_custom) #4
  unreachable

55:                                               ; preds = %53
  %56 = load i64, ptr %14, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %60 = load i64, ptr %59, align 8, !tbaa !14
  %61 = add nsw i64 %60, 1
  store i64 %61, ptr %59, align 8, !tbaa !14
  %62 = getelementptr inbounds i64, ptr %58, i64 %60
  store i64 %56, ptr %62, align 8, !tbaa !9
  %63 = load i64, ptr %15, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %67 = load i64, ptr %66, align 8, !tbaa !14
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr %66, align 8, !tbaa !14
  %69 = getelementptr inbounds i64, ptr %65, i64 %67
  store i64 %63, ptr %69, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %55
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %253, %71
  %73 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %74 = load i64, ptr %73, align 8, !tbaa !14
  %75 = icmp eq i64 %74, 0
  %76 = xor i1 %75, true
  br i1 %76, label %77, label %254

77:                                               ; preds = %72
  br label %78

78:                                               ; preds = %77
  %79 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %80 = load i64, ptr %79, align 8, !tbaa !14
  %81 = icmp sge i64 %80, 2
  br i1 %81, label %82, label %83

82:                                               ; preds = %78
  br label %84

83:                                               ; preds = %78
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 254, ptr noundef @__PRETTY_FUNCTION__.quick_sort_custom) #4
  unreachable

84:                                               ; preds = %82
  %85 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !11
  %87 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %88 = load i64, ptr %87, align 8, !tbaa !14
  %89 = add nsw i64 %88, -1
  store i64 %89, ptr %87, align 8, !tbaa !14
  %90 = getelementptr inbounds i64, ptr %86, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !9
  store i64 %91, ptr %15, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !11
  %94 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %95 = load i64, ptr %94, align 8, !tbaa !14
  %96 = add nsw i64 %95, -1
  store i64 %96, ptr %94, align 8, !tbaa !14
  %97 = getelementptr inbounds i64, ptr %93, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !9
  store i64 %98, ptr %14, align 8, !tbaa !9
  br label %99

99:                                               ; preds = %84
  br label %100

100:                                              ; preds = %99
  %101 = load i64, ptr %14, align 8, !tbaa !9
  %102 = load i64, ptr %15, align 8, !tbaa !9
  %103 = icmp slt i64 %101, %102
  br i1 %103, label %104, label %253

104:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %105 = load ptr, ptr %10, align 8, !tbaa !5
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = load i64, ptr %14, align 8, !tbaa !9
  %109 = load i64, ptr %15, align 8, !tbaa !9
  %110 = call i64 @quick_sort_partition(ptr noundef %105, ptr noundef %106, ptr noundef %107, i64 noundef %108, i64 noundef %109)
  store i64 %110, ptr %16, align 8, !tbaa !9
  %111 = load i64, ptr %16, align 8, !tbaa !9
  %112 = load i64, ptr %14, align 8, !tbaa !9
  %113 = sub nsw i64 %111, %112
  %114 = load i64, ptr %15, align 8, !tbaa !9
  %115 = load i64, ptr %16, align 8, !tbaa !9
  %116 = sub nsw i64 %114, %115
  %117 = icmp sgt i64 %113, %116
  br i1 %117, label %118, label %185

118:                                              ; preds = %104
  %119 = load i64, ptr %14, align 8, !tbaa !9
  %120 = load i64, ptr %16, align 8, !tbaa !9
  %121 = sub nsw i64 %120, 1
  %122 = icmp slt i64 %119, %121
  br i1 %122, label %123, label %151

123:                                              ; preds = %118
  br label %124

124:                                              ; preds = %123
  %125 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %126 = load i64, ptr %125, align 8, !tbaa !14
  %127 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 1
  %128 = load i64, ptr %127, align 8, !tbaa !13
  %129 = sub nsw i64 %128, 2
  %130 = icmp sle i64 %126, %129
  br i1 %130, label %131, label %132

131:                                              ; preds = %124
  br label %133

132:                                              ; preds = %124
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 261, ptr noundef @__PRETTY_FUNCTION__.quick_sort_custom) #4
  unreachable

133:                                              ; preds = %131
  %134 = load i64, ptr %14, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %136 = load ptr, ptr %135, align 8, !tbaa !11
  %137 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %138 = load i64, ptr %137, align 8, !tbaa !14
  %139 = add nsw i64 %138, 1
  store i64 %139, ptr %137, align 8, !tbaa !14
  %140 = getelementptr inbounds i64, ptr %136, i64 %138
  store i64 %134, ptr %140, align 8, !tbaa !9
  %141 = load i64, ptr %16, align 8, !tbaa !9
  %142 = sub nsw i64 %141, 1
  %143 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %144 = load ptr, ptr %143, align 8, !tbaa !11
  %145 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %146 = load i64, ptr %145, align 8, !tbaa !14
  %147 = add nsw i64 %146, 1
  store i64 %147, ptr %145, align 8, !tbaa !14
  %148 = getelementptr inbounds i64, ptr %144, i64 %146
  store i64 %142, ptr %148, align 8, !tbaa !9
  br label %149

149:                                              ; preds = %133
  br label %150

150:                                              ; preds = %149
  br label %151

151:                                              ; preds = %150, %118
  %152 = load i64, ptr %16, align 8, !tbaa !9
  %153 = add nsw i64 %152, 1
  %154 = load i64, ptr %15, align 8, !tbaa !9
  %155 = icmp slt i64 %153, %154
  br i1 %155, label %156, label %184

156:                                              ; preds = %151
  br label %157

157:                                              ; preds = %156
  %158 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %159 = load i64, ptr %158, align 8, !tbaa !14
  %160 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 1
  %161 = load i64, ptr %160, align 8, !tbaa !13
  %162 = sub nsw i64 %161, 2
  %163 = icmp sle i64 %159, %162
  br i1 %163, label %164, label %165

164:                                              ; preds = %157
  br label %166

165:                                              ; preds = %157
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 263, ptr noundef @__PRETTY_FUNCTION__.quick_sort_custom) #4
  unreachable

166:                                              ; preds = %164
  %167 = load i64, ptr %16, align 8, !tbaa !9
  %168 = add nsw i64 %167, 1
  %169 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %170 = load ptr, ptr %169, align 8, !tbaa !11
  %171 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %172 = load i64, ptr %171, align 8, !tbaa !14
  %173 = add nsw i64 %172, 1
  store i64 %173, ptr %171, align 8, !tbaa !14
  %174 = getelementptr inbounds i64, ptr %170, i64 %172
  store i64 %168, ptr %174, align 8, !tbaa !9
  %175 = load i64, ptr %15, align 8, !tbaa !9
  %176 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %177 = load ptr, ptr %176, align 8, !tbaa !11
  %178 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %179 = load i64, ptr %178, align 8, !tbaa !14
  %180 = add nsw i64 %179, 1
  store i64 %180, ptr %178, align 8, !tbaa !14
  %181 = getelementptr inbounds i64, ptr %177, i64 %179
  store i64 %175, ptr %181, align 8, !tbaa !9
  br label %182

182:                                              ; preds = %166
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183, %151
  br label %252

185:                                              ; preds = %104
  %186 = load i64, ptr %16, align 8, !tbaa !9
  %187 = add nsw i64 %186, 1
  %188 = load i64, ptr %15, align 8, !tbaa !9
  %189 = icmp slt i64 %187, %188
  br i1 %189, label %190, label %218

190:                                              ; preds = %185
  br label %191

191:                                              ; preds = %190
  %192 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %193 = load i64, ptr %192, align 8, !tbaa !14
  %194 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 1
  %195 = load i64, ptr %194, align 8, !tbaa !13
  %196 = sub nsw i64 %195, 2
  %197 = icmp sle i64 %193, %196
  br i1 %197, label %198, label %199

198:                                              ; preds = %191
  br label %200

199:                                              ; preds = %191
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 266, ptr noundef @__PRETTY_FUNCTION__.quick_sort_custom) #4
  unreachable

200:                                              ; preds = %198
  %201 = load i64, ptr %16, align 8, !tbaa !9
  %202 = add nsw i64 %201, 1
  %203 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %204 = load ptr, ptr %203, align 8, !tbaa !11
  %205 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %206 = load i64, ptr %205, align 8, !tbaa !14
  %207 = add nsw i64 %206, 1
  store i64 %207, ptr %205, align 8, !tbaa !14
  %208 = getelementptr inbounds i64, ptr %204, i64 %206
  store i64 %202, ptr %208, align 8, !tbaa !9
  %209 = load i64, ptr %15, align 8, !tbaa !9
  %210 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %211 = load ptr, ptr %210, align 8, !tbaa !11
  %212 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %213 = load i64, ptr %212, align 8, !tbaa !14
  %214 = add nsw i64 %213, 1
  store i64 %214, ptr %212, align 8, !tbaa !14
  %215 = getelementptr inbounds i64, ptr %211, i64 %213
  store i64 %209, ptr %215, align 8, !tbaa !9
  br label %216

216:                                              ; preds = %200
  br label %217

217:                                              ; preds = %216
  br label %218

218:                                              ; preds = %217, %185
  %219 = load i64, ptr %14, align 8, !tbaa !9
  %220 = load i64, ptr %16, align 8, !tbaa !9
  %221 = sub nsw i64 %220, 1
  %222 = icmp slt i64 %219, %221
  br i1 %222, label %223, label %251

223:                                              ; preds = %218
  br label %224

224:                                              ; preds = %223
  %225 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %226 = load i64, ptr %225, align 8, !tbaa !14
  %227 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 1
  %228 = load i64, ptr %227, align 8, !tbaa !13
  %229 = sub nsw i64 %228, 2
  %230 = icmp sle i64 %226, %229
  br i1 %230, label %231, label %232

231:                                              ; preds = %224
  br label %233

232:                                              ; preds = %224
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 268, ptr noundef @__PRETTY_FUNCTION__.quick_sort_custom) #4
  unreachable

233:                                              ; preds = %231
  %234 = load i64, ptr %14, align 8, !tbaa !9
  %235 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %236 = load ptr, ptr %235, align 8, !tbaa !11
  %237 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %238 = load i64, ptr %237, align 8, !tbaa !14
  %239 = add nsw i64 %238, 1
  store i64 %239, ptr %237, align 8, !tbaa !14
  %240 = getelementptr inbounds i64, ptr %236, i64 %238
  store i64 %234, ptr %240, align 8, !tbaa !9
  %241 = load i64, ptr %16, align 8, !tbaa !9
  %242 = sub nsw i64 %241, 1
  %243 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 0
  %244 = load ptr, ptr %243, align 8, !tbaa !11
  %245 = getelementptr inbounds %struct.indexStack, ptr %13, i32 0, i32 2
  %246 = load i64, ptr %245, align 8, !tbaa !14
  %247 = add nsw i64 %246, 1
  store i64 %247, ptr %245, align 8, !tbaa !14
  %248 = getelementptr inbounds i64, ptr %244, i64 %246
  store i64 %242, ptr %248, align 8, !tbaa !9
  br label %249

249:                                              ; preds = %233
  br label %250

250:                                              ; preds = %249
  br label %251

251:                                              ; preds = %250, %218
  br label %252

252:                                              ; preds = %251, %184
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %253

253:                                              ; preds = %252, %100
  br label %72, !llvm.loop !15

254:                                              ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i64 @log2u(i64 noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i64 @quick_sort_partition(ptr noundef, ptr noundef, ptr noundef, i64 noundef, i64 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { noreturn 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 #3 = { nounwind }
attributes #4 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"indexStack", !6, i64 0, !10, i64 8, !10, i64 16}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@__PRETTY_FUNCTION__.quick_sort_custom = external hidden unnamed_addr constant [78 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @quick_sort_custom(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = add i64 %1, 1
  %7 = tail call i64 @log2u(i64 noundef %6)
  %8 = shl i64 %7, 1
  %9 = add i64 %8, 4
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %12, label %11

11:                                               ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 245, ptr noundef nonnull @__PRETTY_FUNCTION__.quick_sort_custom) #2
  unreachable

12:                                               ; preds = %5
  %13 = shl i64 %9, 3
  %14 = alloca i8, i64 %13, align 16
  %15 = add nsw i64 %8, 2
  %16 = icmp sgt i64 %8, -3
  br i1 %16, label %18, label %17

17:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 250, ptr noundef nonnull @__PRETTY_FUNCTION__.quick_sort_custom) #2
  unreachable

18:                                               ; preds = %12
  %19 = add i64 %1, -1
  store i64 0, ptr %14, align 16, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %14, i64 8
  store i64 %19, ptr %20, align 8, !tbaa !5
  %invariant.gep = getelementptr i8, ptr %14, i64 -8
  br label %21

21:                                               ; preds = %18, %60
  %.sroa.22.079 = phi i64 [ 2, %18 ], [ %.sroa.22.4, %60 ]
  %22 = icmp sgt i64 %.sroa.22.079, 1
  br i1 %22, label %24, label %23

23:                                               ; preds = %21
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 254, ptr noundef nonnull @__PRETTY_FUNCTION__.quick_sort_custom) #2
  unreachable

24:                                               ; preds = %21
  %gep = getelementptr i64, ptr %invariant.gep, i64 %.sroa.22.079
  %25 = load i64, ptr %gep, align 8, !tbaa !5
  %26 = add nsw i64 %.sroa.22.079, -2
  %27 = getelementptr inbounds i64, ptr %14, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !5
  %29 = icmp slt i64 %28, %25
  br i1 %29, label %30, label %60

30:                                               ; preds = %24
  %31 = tail call i64 @quick_sort_partition(ptr noundef %4, ptr noundef %0, ptr noundef %3, i64 noundef %28, i64 noundef %25)
  %32 = sub nsw i64 %31, %28
  %33 = sub nsw i64 %25, %31
  %34 = icmp sgt i64 %32, %33
  br i1 %34, label %35, label %46

35:                                               ; preds = %30
  %36 = add nsw i64 %31, -1
  %37 = icmp slt i64 %28, %36
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %.not77 = icmp sgt i64 %26, %15
  br i1 %.not77, label %39, label %40

39:                                               ; preds = %38
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 261, ptr noundef nonnull @__PRETTY_FUNCTION__.quick_sort_custom) #2
  unreachable

40:                                               ; preds = %38
  store i64 %36, ptr %gep, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %40, %35
  %.sroa.22.1 = phi i64 [ %.sroa.22.079, %40 ], [ %26, %35 ]
  %42 = add nsw i64 %31, 1
  %43 = icmp slt i64 %42, %25
  br i1 %43, label %44, label %60

44:                                               ; preds = %41
  %.not78 = icmp sgt i64 %.sroa.22.1, %15
  br i1 %.not78, label %45, label %.sink.split

45:                                               ; preds = %44
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 263, ptr noundef nonnull @__PRETTY_FUNCTION__.quick_sort_custom) #2
  unreachable

46:                                               ; preds = %30
  %47 = add nsw i64 %31, 1
  %48 = icmp slt i64 %47, %25
  br i1 %48, label %49, label %52

49:                                               ; preds = %46
  %.not75 = icmp sgt i64 %26, %15
  br i1 %.not75, label %50, label %51

50:                                               ; preds = %49
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 266, ptr noundef nonnull @__PRETTY_FUNCTION__.quick_sort_custom) #2
  unreachable

51:                                               ; preds = %49
  store i64 %47, ptr %27, align 8, !tbaa !5
  br label %52

52:                                               ; preds = %51, %46
  %.sroa.22.2 = phi i64 [ %.sroa.22.079, %51 ], [ %26, %46 ]
  %53 = add nsw i64 %31, -1
  %54 = icmp slt i64 %28, %53
  br i1 %54, label %55, label %60

55:                                               ; preds = %52
  %.not76 = icmp sgt i64 %.sroa.22.2, %15
  br i1 %.not76, label %56, label %.sink.split

56:                                               ; preds = %55
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 268, ptr noundef nonnull @__PRETTY_FUNCTION__.quick_sort_custom) #2
  unreachable

.sink.split:                                      ; preds = %55, %44
  %.sroa.22.1.sink84 = phi i64 [ %.sroa.22.1, %44 ], [ %.sroa.22.2, %55 ]
  %.sink82 = phi i64 [ %42, %44 ], [ %28, %55 ]
  %.sink = phi i64 [ %25, %44 ], [ %53, %55 ]
  %57 = getelementptr inbounds i64, ptr %14, i64 %.sroa.22.1.sink84
  store i64 %.sink82, ptr %57, align 8, !tbaa !5
  %58 = add nuw nsw i64 %.sroa.22.1.sink84, 2
  %59 = getelementptr i8, ptr %57, i64 8
  store i64 %.sink, ptr %59, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %.sink.split, %41, %52, %24
  %.sroa.22.4 = phi i64 [ %26, %24 ], [ %.sroa.22.1, %41 ], [ %.sroa.22.2, %52 ], [ %58, %.sink.split ]
  %.not = icmp eq i64 %.sroa.22.4, 0
  br i1 %.not, label %61, label %21, !llvm.loop !9

61:                                               ; preds = %60
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i64 @log2u(i64 noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @quick_sort_partition(ptr noundef, ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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 = { noreturn 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 #2 = { noreturn 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass