; LLVM IR from jingweizhanghuai/Morn :: src/util (morn_memory_block)

; 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.HandleList = type { %struct.MList, i32, i32, i32, i32 }
%struct.MList = type { i32, ptr }
%struct.MHandle = type { i32, i32, ptr, ptr }
%struct.HandleMemory = type { i32, i32, i32, i32, ptr, i32, i32, ptr, i32 }

@.str = external hidden unnamed_addr constant [84 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.mMemoryMerge = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 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

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #1

; 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
declare dso_local void @mMemoryBlockRelease(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @mMemoryRedefine(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @mMemoryDevice(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @mMemoryMerge(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %21

18:                                               ; preds = %15
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %25, label %21

21:                                               ; preds = %18, %15
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = icmp eq ptr %22, %23
  br label %25

25:                                               ; preds = %21, %18
  %26 = phi i1 [ true, %18 ], [ %24, %21 ]
  %27 = zext i1 %26 to i32
  store i32 %27, ptr %7, align 4, !tbaa !9
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %32

30:                                               ; preds = %25
  %31 = load i32, ptr %7, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %31, i32 noundef -1, ptr noundef @.str, i32 noundef 699, ptr noundef @__FUNCTION__.mMemoryMerge, ptr noundef @.str.4)
  br label %32

32:                                               ; preds = %30, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = icmp eq ptr %34, %35
  br i1 %36, label %37, label %41

37:                                               ; preds = %33
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mMemoryMerge(ptr noundef %38, ptr noundef %39, ptr noundef %40)
  br label %209

41:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %57

44:                                               ; preds = %41
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.HandleList, ptr %45, i64 -1
  %47 = getelementptr inbounds %struct.HandleList, ptr %46, i32 0, i32 0
  %48 = getelementptr inbounds %struct.MList, ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !11
  %50 = getelementptr inbounds ptr, ptr %49, i64 0
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.MHandle, ptr %51, i32 0, i32 3
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  store ptr %53, ptr %9, align 8, !tbaa !5
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.MList, ptr %54, i32 0, i32 0
  %56 = load i32, ptr %55, align 8, !tbaa !16
  store i32 %56, ptr %10, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %44, %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %73

60:                                               ; preds = %57
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.HandleList, ptr %61, i64 -1
  %63 = getelementptr inbounds %struct.HandleList, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %struct.MList, ptr %63, i32 0, i32 1
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = getelementptr inbounds ptr, ptr %65, i64 0
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MHandle, ptr %67, i32 0, i32 3
  %69 = load ptr, ptr %68, align 8, !tbaa !14
  store ptr %69, ptr %11, align 8, !tbaa !5
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.MList, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !16
  store i32 %72, ptr %12, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %60, %57
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %107

76:                                               ; preds = %73
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %107

79:                                               ; preds = %76
  br label %80

80:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.HandleMemory, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !17
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.HandleMemory, ptr %84, i32 0, i32 1
  %86 = load i32, ptr %85, align 4, !tbaa !17
  %87 = icmp ne i32 %83, %86
  %88 = zext i1 %87 to i32
  store i32 %88, ptr %13, align 4, !tbaa !9
  %89 = load i32, ptr %13, align 4, !tbaa !9
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %93

91:                                               ; preds = %80
  %92 = load i32, ptr %13, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %92, i32 noundef -1, ptr noundef @.str, i32 noundef 708, ptr noundef @__FUNCTION__.mMemoryMerge, ptr noundef @.str.8)
  br label %93

93:                                               ; preds = %91, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.HandleMemory, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 8, !tbaa !19
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.HandleMemory, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !19
  %102 = icmp ne i32 %98, %101
  br i1 %102, label %103, label %106

103:                                              ; preds = %95
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  call void @mMemoryDevice(ptr noundef %104, i32 noundef 0)
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mMemoryDevice(ptr noundef %105, i32 noundef 0)
  br label %106

106:                                              ; preds = %103, %95
  br label %107

107:                                              ; preds = %106, %76, %73
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = load i32, ptr %10, align 4, !tbaa !9
  %110 = load i32, ptr %12, align 4, !tbaa !9
  %111 = add nsw i32 %109, %110
  call void @mMemoryRedefine(ptr noundef %108, i32 noundef %111, i32 noundef -1, i32 noundef -1)
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = icmp eq ptr %112, %113
  br i1 %114, label %115, label %117

115:                                              ; preds = %107
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %116, ptr %8, align 8, !tbaa !5
  br label %184

117:                                              ; preds = %107
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.HandleList, ptr %118, i64 -1
  %120 = getelementptr inbounds %struct.HandleList, ptr %119, i32 0, i32 0
  %121 = getelementptr inbounds %struct.MList, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !11
  %123 = getelementptr inbounds ptr, ptr %122, i64 0
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.MHandle, ptr %124, i32 0, i32 3
  %126 = load ptr, ptr %125, align 8, !tbaa !14
  store ptr %126, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %152, %117
  %128 = load i32, ptr %14, align 4, !tbaa !9
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.MList, ptr %129, i32 0, i32 0
  %131 = load i32, ptr %130, align 8, !tbaa !16
  %132 = icmp slt i32 %128, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %155

134:                                              ; preds = %127
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.MList, ptr %135, i32 0, i32 1
  %137 = load ptr, ptr %136, align 8, !tbaa !20
  %138 = load i32, ptr %14, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds ptr, ptr %137, i64 %139
  %141 = load ptr, ptr %140, align 8, !tbaa !5
  %142 = icmp ne ptr %141, null
  br i1 %142, label %143, label %151

143:                                              ; preds = %134
  %144 = load ptr, ptr %6, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.MList, ptr %144, i32 0, i32 1
  %146 = load ptr, ptr %145, align 8, !tbaa !20
  %147 = load i32, ptr %14, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds ptr, ptr %146, i64 %148
  %150 = load ptr, ptr %149, align 8, !tbaa !5
  call void @mMemoryBlockRelease(ptr noundef %150)
  br label %151

151:                                              ; preds = %143, %134
  br label %152

152:                                              ; preds = %151
  %153 = load i32, ptr %14, align 4, !tbaa !9
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %14, align 4, !tbaa !9
  br label %127, !llvm.loop !21

155:                                              ; preds = %133
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.MList, ptr %156, i32 0, i32 0
  store i32 0, ptr %157, align 8, !tbaa !16
  %158 = load ptr, ptr %9, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.HandleMemory, ptr %158, i32 0, i32 1
  %160 = load i32, ptr %159, align 4, !tbaa !17
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.HandleMemory, ptr %161, i32 0, i32 1
  store i32 %160, ptr %162, align 4, !tbaa !17
  %163 = load i32, ptr %10, align 4, !tbaa !9
  %164 = icmp sgt i32 %163, 0
  br i1 %164, label %165, label %183

165:                                              ; preds = %155
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.MList, ptr %166, i32 0, i32 1
  %168 = load ptr, ptr %167, align 8, !tbaa !20
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.MList, ptr %169, i32 0, i32 1
  %171 = load ptr, ptr %170, align 8, !tbaa !20
  %172 = load i32, ptr %10, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = mul i64 %173, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %168, ptr align 8 %171, i64 %174, i1 false)
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.MList, ptr %175, i32 0, i32 1
  %177 = load ptr, ptr %176, align 8, !tbaa !20
  %178 = load i32, ptr %10, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = mul i64 %179, 8
  call void @llvm.memset.p0.i64(ptr align 8 %177, i8 0, i64 %180, i1 false)
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.MList, ptr %181, i32 0, i32 0
  store i32 0, ptr %182, align 8, !tbaa !16
  br label %183

183:                                              ; preds = %165, %155
  br label %184

184:                                              ; preds = %183, %115
  %185 = load i32, ptr %12, align 4, !tbaa !9
  %186 = icmp sgt i32 %185, 0
  br i1 %186, label %187, label %208

187:                                              ; preds = %184
  %188 = load ptr, ptr %6, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.MList, ptr %188, i32 0, i32 1
  %190 = load ptr, ptr %189, align 8, !tbaa !20
  %191 = load i32, ptr %10, align 4, !tbaa !9
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds ptr, ptr %190, i64 %192
  %194 = load ptr, ptr %5, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.MList, ptr %194, i32 0, i32 1
  %196 = load ptr, ptr %195, align 8, !tbaa !20
  %197 = load i32, ptr %12, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = mul i64 %198, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %193, ptr align 8 %196, i64 %199, i1 false)
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.MList, ptr %200, i32 0, i32 1
  %202 = load ptr, ptr %201, align 8, !tbaa !20
  %203 = load i32, ptr %12, align 4, !tbaa !9
  %204 = sext i32 %203 to i64
  %205 = mul i64 %204, 8
  call void @llvm.memset.p0.i64(ptr align 8 %202, i8 0, i64 %205, i1 false)
  %206 = load ptr, ptr %5, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.MList, ptr %206, i32 0, i32 0
  store i32 0, ptr %207, align 8, !tbaa !16
  br label %208

208:                                              ; preds = %187, %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %209

209:                                              ; preds = %208, %37
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"HandleList", !13, i64 0, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!13 = !{!"MList", !10, i64 0, !6, i64 8}
!14 = !{!15, !6, i64 16}
!15 = !{!"MHandle", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!16 = !{!13, !10, i64 0}
!17 = !{!18, !10, i64 4}
!18 = !{!"HandleMemory", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24, !10, i64 28, !6, i64 32, !10, i64 40}
!19 = !{!18, !10, i64 0}
!20 = !{!13, !6, i64 8}
!21 = distinct !{!21, !22}
!22 = !{!"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 [84 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.mMemoryMerge = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 x i8], align 1

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @mMemoryBlockRelease(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @mMemoryRedefine(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @mMemoryDevice(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @mMemoryMerge(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  br label %tailrecurse

tailrecurse:                                      ; preds = %8, %3
  %.tr = phi ptr [ %0, %3 ], [ %.tr77, %8 ]
  %.tr77 = phi ptr [ %1, %3 ], [ %.tr, %8 ]
  %4 = icmp eq ptr %.tr, null
  %5 = icmp eq ptr %.tr77, null
  %or.cond = and i1 %4, %5
  %6 = icmp eq ptr %.tr, %.tr77
  %spec.select = or i1 %6, %or.cond
  br i1 %spec.select, label %7, label %8

7:                                                ; preds = %tailrecurse
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 699, ptr noundef nonnull @__FUNCTION__.mMemoryMerge, ptr noundef nonnull @.str.4) #4
  br label %8

8:                                                ; preds = %7, %tailrecurse
  %9 = icmp eq ptr %.tr77, %2
  br i1 %9, label %tailrecurse, label %10

10:                                               ; preds = %8
  br i1 %4, label %11, label %.thread83

11:                                               ; preds = %10
  br i1 %5, label %.thread, label %18

.thread83:                                        ; preds = %10
  %12 = getelementptr inbounds i8, ptr %.tr, i64 -24
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = load ptr, ptr %13, align 8, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %17 = load i32, ptr %.tr, align 8, !tbaa !15
  br i1 %5, label %.thread, label %20

18:                                               ; preds = %11
  %19 = load i32, ptr %.tr77, align 8, !tbaa !15
  br label %.thread

20:                                               ; preds = %.thread83
  %21 = getelementptr inbounds i8, ptr %.tr77, i64 -24
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  %26 = load i32, ptr %.tr77, align 8, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %16, i64 4
  %28 = load i32, ptr %27, align 4, !tbaa !16
  %29 = getelementptr inbounds i8, ptr %25, i64 4
  %30 = load i32, ptr %29, align 4, !tbaa !16
  %.not76 = icmp eq i32 %28, %30
  br i1 %.not76, label %32, label %31

31:                                               ; preds = %20
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 708, ptr noundef nonnull @__FUNCTION__.mMemoryMerge, ptr noundef nonnull @.str.8) #4
  br label %32

32:                                               ; preds = %31, %20
  %33 = load i32, ptr %16, align 8, !tbaa !18
  %34 = load i32, ptr %25, align 8, !tbaa !18
  %.not = icmp eq i32 %33, %34
  br i1 %.not, label %.thread, label %35

35:                                               ; preds = %32
  tail call void @mMemoryDevice(ptr noundef nonnull %.tr, i32 noundef 0)
  tail call void @mMemoryDevice(ptr noundef nonnull %.tr77, i32 noundef 0)
  br label %.thread

.thread:                                          ; preds = %18, %.thread83, %11, %32, %35
  %.06389 = phi i32 [ %17, %32 ], [ %17, %35 ], [ 0, %18 ], [ 0, %11 ], [ %17, %.thread83 ]
  %.06487 = phi ptr [ %16, %32 ], [ %16, %35 ], [ null, %18 ], [ null, %11 ], [ %16, %.thread83 ]
  %.06175 = phi i32 [ %26, %32 ], [ %26, %35 ], [ %19, %18 ], [ 0, %11 ], [ 0, %.thread83 ]
  %36 = add nsw i32 %.06175, %.06389
  tail call void @mMemoryRedefine(ptr noundef %2, i32 noundef %36, i32 noundef -1, i32 noundef -1)
  %37 = icmp eq ptr %.tr, %2
  br i1 %37, label %69, label %38

38:                                               ; preds = %.thread
  %39 = getelementptr inbounds i8, ptr %2, i64 -24
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = load ptr, ptr %40, align 8, !tbaa !12
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %43 = load ptr, ptr %42, align 8, !tbaa !13
  %44 = load i32, ptr %2, align 8, !tbaa !15
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %38
  %46 = getelementptr inbounds i8, ptr %2, i64 8
  br label %51

._crit_edge:                                      ; preds = %57, %38
  store i32 0, ptr %2, align 8, !tbaa !15
  %47 = getelementptr inbounds i8, ptr %.06487, i64 4
  %48 = load i32, ptr %47, align 4, !tbaa !16
  %49 = getelementptr inbounds i8, ptr %43, i64 4
  store i32 %48, ptr %49, align 4, !tbaa !16
  %50 = icmp sgt i32 %.06389, 0
  br i1 %50, label %61, label %69

51:                                               ; preds = %.lr.ph, %57
  %52 = phi i32 [ %44, %.lr.ph ], [ %58, %57 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %57 ]
  %53 = load ptr, ptr %46, align 8, !tbaa !19
  %54 = getelementptr inbounds ptr, ptr %53, i64 %indvars.iv
  %55 = load ptr, ptr %54, align 8, !tbaa !12
  %.not71 = icmp eq ptr %55, null
  br i1 %.not71, label %57, label %56

56:                                               ; preds = %51
  tail call void @mMemoryBlockRelease(ptr noundef nonnull %55)
  %.pre = load i32, ptr %2, align 8, !tbaa !15
  br label %57

57:                                               ; preds = %51, %56
  %58 = phi i32 [ %52, %51 ], [ %.pre, %56 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %59 = sext i32 %58 to i64
  %60 = icmp slt i64 %indvars.iv.next, %59
  br i1 %60, label %51, label %._crit_edge, !llvm.loop !20

61:                                               ; preds = %._crit_edge
  %62 = getelementptr inbounds i8, ptr %2, i64 8
  %63 = load ptr, ptr %62, align 8, !tbaa !19
  %64 = getelementptr inbounds i8, ptr %.tr, i64 8
  %65 = load ptr, ptr %64, align 8, !tbaa !19
  %66 = zext nneg i32 %.06389 to i64
  %67 = shl nuw nsw i64 %66, 3
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %63, ptr align 8 %65, i64 %67, i1 false)
  %68 = load ptr, ptr %64, align 8, !tbaa !19
  tail call void @llvm.memset.p0.i64(ptr align 8 %68, i8 0, i64 %67, i1 false)
  store i32 0, ptr %.tr, align 8, !tbaa !15
  br label %69

69:                                               ; preds = %.thread, %._crit_edge, %61
  %70 = icmp sgt i32 %.06175, 0
  br i1 %70, label %71, label %81

71:                                               ; preds = %69
  %72 = getelementptr inbounds i8, ptr %2, i64 8
  %73 = load ptr, ptr %72, align 8, !tbaa !19
  %74 = sext i32 %.06389 to i64
  %75 = getelementptr inbounds ptr, ptr %73, i64 %74
  %76 = getelementptr inbounds i8, ptr %.tr77, i64 8
  %77 = load ptr, ptr %76, align 8, !tbaa !19
  %78 = zext nneg i32 %.06175 to i64
  %79 = shl nuw nsw i64 %78, 3
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %75, ptr align 8 %77, i64 %79, i1 false)
  %80 = load ptr, ptr %76, align 8, !tbaa !19
  tail call void @llvm.memset.p0.i64(ptr align 8 %80, i8 0, i64 %79, i1 false)
  store i32 0, ptr %.tr77, align 8, !tbaa !15
  br label %81

81:                                               ; preds = %69, %71
  ret void
}

attributes #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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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, !11, i64 8}
!6 = !{!"HandleList", !7, i64 0, !8, i64 16, !8, i64 20, !8, i64 24, !8, i64 28}
!7 = !{!"MList", !8, i64 0, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!14, !11, i64 16}
!14 = !{!"MHandle", !8, i64 0, !8, i64 4, !11, i64 8, !11, i64 16}
!15 = !{!7, !8, i64 0}
!16 = !{!17, !8, i64 4}
!17 = !{!"HandleMemory", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !11, i64 16, !8, i64 24, !8, i64 28, !11, i64 32, !8, i64 40}
!18 = !{!17, !8, i64 0}
!19 = !{!7, !11, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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