; LLVM IR from xiaoxianrouzhiyou/BBearEditor-2.0 :: Code/BBearEditor/Engine/Allocator/tlsf (tlsf)

; 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.control_t = type { %struct.block_header_t, i32, [25 x i32], [25 x [32 x ptr]] }
%struct.block_header_t = type { ptr, i64, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [113 x i8], align 1
@__PRETTY_FUNCTION__.tlsf_check = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [59 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @tlsf_check(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %14, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %237, %1
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = icmp slt i32 %16, 25
  br i1 %17, label %18, label %240

18:                                               ; preds = %15
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %233, %18
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = icmp slt i32 %20, 32
  br i1 %21, label %22, label %236

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.control_t, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 8, !tbaa !11
  %26 = load i32, ptr %3, align 4, !tbaa !9
  %27 = shl i32 1, %26
  %28 = and i32 %25, %27
  store i32 %28, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.control_t, ptr %29, i32 0, i32 2
  %31 = load i32, ptr %3, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [25 x i32], ptr %30, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !9
  store i32 %34, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = load i32, ptr %4, align 4, !tbaa !9
  %37 = shl i32 1, %36
  %38 = and i32 %35, %37
  store i32 %38, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.control_t, ptr %39, i32 0, i32 3
  %41 = load i32, ptr %3, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [25 x [32 x ptr]], ptr %40, i64 0, i64 %42
  %44 = load i32, ptr %4, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [32 x ptr], ptr %43, i64 0, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  store ptr %47, ptr %10, align 8, !tbaa !5
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %64, label %50

50:                                               ; preds = %22
  %51 = load i32, ptr %9, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %55, label %53

53:                                               ; preds = %50
  br i1 true, label %54, label %55

54:                                               ; preds = %53
  br label %56

55:                                               ; preds = %53, %50
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 652, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

56:                                               ; preds = %54
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  br i1 true, label %63, label %60

60:                                               ; preds = %59, %56
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = add nsw i32 %61, -1
  store i32 %62, ptr %6, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %60, %59
  br label %64

64:                                               ; preds = %63, %22
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %85, label %67

67:                                               ; preds = %64
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.control_t, ptr %69, i32 0, i32 0
  %71 = icmp eq ptr %68, %70
  br i1 %71, label %72, label %74

72:                                               ; preds = %67
  br i1 true, label %73, label %74

73:                                               ; preds = %72
  br label %75

74:                                               ; preds = %72, %67
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 657, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

75:                                               ; preds = %73
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.control_t, ptr %77, i32 0, i32 0
  %79 = icmp eq ptr %76, %78
  br i1 %79, label %80, label %81

80:                                               ; preds = %75
  br i1 true, label %84, label %81

81:                                               ; preds = %80, %75
  %82 = load i32, ptr %6, align 4, !tbaa !9
  %83 = add nsw i32 %82, -1
  store i32 %83, ptr %6, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %81, %80
  store i32 7, ptr %11, align 4
  br label %230

85:                                               ; preds = %64
  %86 = load i32, ptr %8, align 4, !tbaa !9
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %90

88:                                               ; preds = %85
  br i1 true, label %89, label %90

89:                                               ; preds = %88
  br label %91

90:                                               ; preds = %88, %85
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.2, i32 noundef 662, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

91:                                               ; preds = %89
  %92 = load i32, ptr %8, align 4, !tbaa !9
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %91
  br i1 true, label %98, label %95

95:                                               ; preds = %94, %91
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = add nsw i32 %96, -1
  store i32 %97, ptr %6, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %95, %94
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.control_t, ptr %100, i32 0, i32 0
  %102 = icmp ne ptr %99, %101
  br i1 %102, label %103, label %105

103:                                              ; preds = %98
  br i1 true, label %104, label %105

104:                                              ; preds = %103
  br label %106

105:                                              ; preds = %103, %98
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.2, i32 noundef 663, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

106:                                              ; preds = %104
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.control_t, ptr %108, i32 0, i32 0
  %110 = icmp ne ptr %107, %109
  br i1 %110, label %111, label %112

111:                                              ; preds = %106
  br i1 true, label %115, label %112

112:                                              ; preds = %111, %106
  %113 = load i32, ptr %6, align 4, !tbaa !9
  %114 = add nsw i32 %113, -1
  store i32 %114, ptr %6, align 4, !tbaa !9
  br label %115

115:                                              ; preds = %112, %111
  br label %116

116:                                              ; preds = %225, %115
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.control_t, ptr %118, i32 0, i32 0
  %120 = icmp ne ptr %117, %119
  br i1 %120, label %121, label %229

121:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %122 = load ptr, ptr %10, align 8, !tbaa !5
  %123 = call i32 @block_is_free(ptr noundef %122)
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %127

125:                                              ; preds = %121
  br i1 true, label %126, label %127

126:                                              ; preds = %125
  br label %128

127:                                              ; preds = %125, %121
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.2, i32 noundef 668, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

128:                                              ; preds = %126
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = call i32 @block_is_free(ptr noundef %129)
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %133

132:                                              ; preds = %128
  br i1 true, label %136, label %133

133:                                              ; preds = %132, %128
  %134 = load i32, ptr %6, align 4, !tbaa !9
  %135 = add nsw i32 %134, -1
  store i32 %135, ptr %6, align 4, !tbaa !9
  br label %136

136:                                              ; preds = %133, %132
  %137 = load ptr, ptr %10, align 8, !tbaa !5
  %138 = call i32 @block_is_prev_free(ptr noundef %137)
  %139 = icmp ne i32 %138, 0
  br i1 %139, label %142, label %140

140:                                              ; preds = %136
  br i1 true, label %141, label %142

141:                                              ; preds = %140
  br label %143

142:                                              ; preds = %140, %136
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.2, i32 noundef 669, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

143:                                              ; preds = %141
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = call i32 @block_is_prev_free(ptr noundef %144)
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %148, label %147

147:                                              ; preds = %143
  br i1 true, label %151, label %148

148:                                              ; preds = %147, %143
  %149 = load i32, ptr %6, align 4, !tbaa !9
  %150 = add nsw i32 %149, -1
  store i32 %150, ptr %6, align 4, !tbaa !9
  br label %151

151:                                              ; preds = %148, %147
  %152 = load ptr, ptr %10, align 8, !tbaa !5
  %153 = call ptr @block_next(ptr noundef %152)
  %154 = call i32 @block_is_free(ptr noundef %153)
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %158, label %156

156:                                              ; preds = %151
  br i1 true, label %157, label %158

157:                                              ; preds = %156
  br label %159

158:                                              ; preds = %156, %151
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.2, i32 noundef 670, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

159:                                              ; preds = %157
  %160 = load ptr, ptr %10, align 8, !tbaa !5
  %161 = call ptr @block_next(ptr noundef %160)
  %162 = call i32 @block_is_free(ptr noundef %161)
  %163 = icmp ne i32 %162, 0
  br i1 %163, label %165, label %164

164:                                              ; preds = %159
  br i1 true, label %168, label %165

165:                                              ; preds = %164, %159
  %166 = load i32, ptr %6, align 4, !tbaa !9
  %167 = add nsw i32 %166, -1
  store i32 %167, ptr %6, align 4, !tbaa !9
  br label %168

168:                                              ; preds = %165, %164
  %169 = load ptr, ptr %10, align 8, !tbaa !5
  %170 = call ptr @block_next(ptr noundef %169)
  %171 = call i32 @block_is_prev_free(ptr noundef %170)
  %172 = icmp ne i32 %171, 0
  br i1 %172, label %173, label %175

173:                                              ; preds = %168
  br i1 true, label %174, label %175

174:                                              ; preds = %173
  br label %176

175:                                              ; preds = %173, %168
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.2, i32 noundef 671, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

176:                                              ; preds = %174
  %177 = load ptr, ptr %10, align 8, !tbaa !5
  %178 = call ptr @block_next(ptr noundef %177)
  %179 = call i32 @block_is_prev_free(ptr noundef %178)
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %181, label %182

181:                                              ; preds = %176
  br i1 true, label %185, label %182

182:                                              ; preds = %181, %176
  %183 = load i32, ptr %6, align 4, !tbaa !9
  %184 = add nsw i32 %183, -1
  store i32 %184, ptr %6, align 4, !tbaa !9
  br label %185

185:                                              ; preds = %182, %181
  %186 = load ptr, ptr %10, align 8, !tbaa !5
  %187 = call i64 @block_size(ptr noundef %186)
  %188 = icmp uge i64 %187, 24
  br i1 %188, label %189, label %191

189:                                              ; preds = %185
  br i1 true, label %190, label %191

190:                                              ; preds = %189
  br label %192

191:                                              ; preds = %189, %185
  call void @__assert_fail(ptr noundef @.str.16, ptr noundef @.str.2, i32 noundef 672, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

192:                                              ; preds = %190
  %193 = load ptr, ptr %10, align 8, !tbaa !5
  %194 = call i64 @block_size(ptr noundef %193)
  %195 = icmp uge i64 %194, 24
  br i1 %195, label %196, label %197

196:                                              ; preds = %192
  br i1 true, label %200, label %197

197:                                              ; preds = %196, %192
  %198 = load i32, ptr %6, align 4, !tbaa !9
  %199 = add nsw i32 %198, -1
  store i32 %199, ptr %6, align 4, !tbaa !9
  br label %200

200:                                              ; preds = %197, %196
  %201 = load ptr, ptr %10, align 8, !tbaa !5
  %202 = call i64 @block_size(ptr noundef %201)
  call void @mapping_insert(i64 noundef %202, ptr noundef %12, ptr noundef %13)
  %203 = load i32, ptr %12, align 4, !tbaa !9
  %204 = load i32, ptr %3, align 4, !tbaa !9
  %205 = icmp eq i32 %203, %204
  br i1 %205, label %206, label %212

206:                                              ; preds = %200
  %207 = load i32, ptr %13, align 4, !tbaa !9
  %208 = load i32, ptr %4, align 4, !tbaa !9
  %209 = icmp eq i32 %207, %208
  br i1 %209, label %210, label %212

210:                                              ; preds = %206
  br i1 true, label %211, label %212

211:                                              ; preds = %210
  br label %213

212:                                              ; preds = %210, %206, %200
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.2, i32 noundef 675, ptr noundef @__PRETTY_FUNCTION__.tlsf_check) #4
  unreachable

213:                                              ; preds = %211
  %214 = load i32, ptr %12, align 4, !tbaa !9
  %215 = load i32, ptr %3, align 4, !tbaa !9
  %216 = icmp eq i32 %214, %215
  br i1 %216, label %217, label %222

217:                                              ; preds = %213
  %218 = load i32, ptr %13, align 4, !tbaa !9
  %219 = load i32, ptr %4, align 4, !tbaa !9
  %220 = icmp eq i32 %218, %219
  br i1 %220, label %221, label %222

221:                                              ; preds = %217
  br i1 true, label %225, label %222

222:                                              ; preds = %221, %217, %213
  %223 = load i32, ptr %6, align 4, !tbaa !9
  %224 = add nsw i32 %223, -1
  store i32 %224, ptr %6, align 4, !tbaa !9
  br label %225

225:                                              ; preds = %222, %221
  %226 = load ptr, ptr %10, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.block_header_t, ptr %226, i32 0, i32 2
  %228 = load ptr, ptr %227, align 8, !tbaa !15
  store ptr %228, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %116, !llvm.loop !16

229:                                              ; preds = %116
  store i32 0, ptr %11, align 4
  br label %230

230:                                              ; preds = %229, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  %231 = load i32, ptr %11, align 4
  switch i32 %231, label %242 [
    i32 0, label %232
    i32 7, label %233
  ]

232:                                              ; preds = %230
  br label %233

233:                                              ; preds = %232, %230
  %234 = load i32, ptr %4, align 4, !tbaa !9
  %235 = add nsw i32 %234, 1
  store i32 %235, ptr %4, align 4, !tbaa !9
  br label %19, !llvm.loop !18

236:                                              ; preds = %19
  br label %237

237:                                              ; preds = %236
  %238 = load i32, ptr %3, align 4, !tbaa !9
  %239 = add nsw i32 %238, 1
  store i32 %239, ptr %3, align 4, !tbaa !9
  br label %15, !llvm.loop !19

240:                                              ; preds = %15
  %241 = load i32, ptr %6, align 4, !tbaa !9
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 %241

242:                                              ; preds = %230
  unreachable
}

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @block_is_free(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @block_is_prev_free(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @block_next(ptr noundef) #0

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

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

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

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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 32}
!12 = !{!"control_t", !13, i64 0, !10, i64 32, !7, i64 36, !7, i64 136}
!13 = !{!"block_header_t", !6, i64 0, !14, i64 8, !6, i64 16, !6, i64 24}
!14 = !{!"long", !7, i64 0}
!15 = !{!13, !6, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


; 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.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [113 x i8], align 1
@__PRETTY_FUNCTION__.tlsf_check = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [59 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @tlsf_check(ptr noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = getelementptr inbounds i8, ptr %0, i64 36
  %6 = getelementptr inbounds i8, ptr %0, i64 136
  br label %.preheader79

.preheader79:                                     ; preds = %1, %71
  %indvars.iv114 = phi i64 [ 0, %1 ], [ %indvars.iv.next115, %71 ]
  %.058111 = phi i32 [ 0, %1 ], [ %.13, %71 ]
  %7 = trunc nuw nsw i64 %indvars.iv114 to i32
  %8 = shl nuw nsw i32 1, %7
  %9 = getelementptr inbounds [25 x i32], ptr %5, i64 0, i64 %indvars.iv114
  br label %10

10:                                               ; preds = %.preheader79, %.loopexit
  %indvars.iv = phi i64 [ 0, %.preheader79 ], [ %indvars.iv.next, %.loopexit ]
  %.1108 = phi i32 [ %.058111, %.preheader79 ], [ %.13, %.loopexit ]
  %11 = load i32, ptr %4, align 8, !tbaa !5
  %12 = and i32 %11, %8
  %13 = load i32, ptr %9, align 4, !tbaa !13
  %14 = trunc nuw nsw i64 %indvars.iv to i32
  %15 = shl nuw i32 1, %14
  %16 = and i32 %13, %15
  %17 = getelementptr inbounds [25 x [32 x ptr]], ptr %6, i64 0, i64 %indvars.iv114, i64 %indvars.iv
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %.not = icmp eq i32 %12, 0
  %cond = icmp eq i32 %16, 0
  br i1 %.not, label %19, label %21

19:                                               ; preds = %10
  br i1 %cond, label %22, label %20

20:                                               ; preds = %19
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 652, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

21:                                               ; preds = %10
  br i1 %cond, label %22, label %25

22:                                               ; preds = %19, %21
  %23 = icmp eq ptr %18, %0
  br i1 %23, label %.loopexit, label %24

24:                                               ; preds = %22
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 657, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

25:                                               ; preds = %21
  %.not63 = icmp eq i32 %13, 0
  br i1 %.not63, label %26, label %27

26:                                               ; preds = %25
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i32 noundef 662, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

27:                                               ; preds = %25
  %.not64 = icmp eq ptr %18, %0
  br i1 %.not64, label %28, label %.preheader

28:                                               ; preds = %27
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2, i32 noundef 663, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

.preheader:                                       ; preds = %27, %62
  %.0107 = phi ptr [ %70, %62 ], [ %18, %27 ]
  %.6106 = phi i32 [ %spec.select77, %62 ], [ %.1108, %27 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %29 = call i32 @block_is_free(ptr noundef %.0107)
  %.not66 = icmp eq i32 %29, 0
  br i1 %.not66, label %30, label %31

30:                                               ; preds = %.preheader
  call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.2, i32 noundef 668, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

31:                                               ; preds = %.preheader
  %32 = call i32 @block_is_free(ptr noundef %.0107)
  %33 = call i32 @block_is_prev_free(ptr noundef %.0107)
  %.not68 = icmp eq i32 %33, 0
  br i1 %.not68, label %35, label %34

34:                                               ; preds = %31
  call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.2, i32 noundef 669, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

35:                                               ; preds = %31
  %36 = call i32 @block_is_prev_free(ptr noundef %.0107)
  %37 = call ptr @block_next(ptr noundef %.0107)
  %38 = call i32 @block_is_free(ptr noundef %37)
  %.not70 = icmp eq i32 %38, 0
  br i1 %.not70, label %40, label %39

39:                                               ; preds = %35
  call void @__assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.2, i32 noundef 670, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

40:                                               ; preds = %35
  %41 = call ptr @block_next(ptr noundef %.0107)
  %42 = call i32 @block_is_free(ptr noundef %41)
  %43 = call ptr @block_next(ptr noundef %.0107)
  %44 = call i32 @block_is_prev_free(ptr noundef %43)
  %.not72 = icmp eq i32 %44, 0
  br i1 %.not72, label %45, label %46

45:                                               ; preds = %40
  call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.2, i32 noundef 671, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

46:                                               ; preds = %40
  %47 = call ptr @block_next(ptr noundef %.0107)
  %48 = call i32 @block_is_prev_free(ptr noundef %47)
  %49 = call i64 @block_size(ptr noundef %.0107)
  %50 = icmp ugt i64 %49, 23
  br i1 %50, label %52, label %51

51:                                               ; preds = %46
  call void @__assert_fail(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.2, i32 noundef 672, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

52:                                               ; preds = %46
  %53 = call i64 @block_size(ptr noundef %.0107)
  %54 = call i64 @block_size(ptr noundef %.0107)
  call void @mapping_insert(i64 noundef %54, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %55 = load i32, ptr %2, align 4, !tbaa !13
  %56 = zext i32 %55 to i64
  %57 = icmp eq i64 %indvars.iv114, %56
  %58 = load i32, ptr %3, align 4
  %59 = zext i32 %58 to i64
  %60 = icmp eq i64 %indvars.iv, %59
  %or.cond = select i1 %57, i1 %60, i1 false
  br i1 %or.cond, label %62, label %61

61:                                               ; preds = %52
  call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.2, i32 noundef 675, ptr noundef nonnull @__PRETTY_FUNCTION__.tlsf_check) #3
  unreachable

62:                                               ; preds = %52
  %63 = icmp ult i64 %53, 24
  %.not67 = icmp eq i32 %32, 0
  %64 = sext i1 %.not67 to i32
  %spec.select = add nsw i32 %.6106, %64
  %.not69 = icmp ne i32 %36, 0
  %65 = sext i1 %.not69 to i32
  %spec.select74 = add nsw i32 %spec.select, %65
  %.not71 = icmp ne i32 %42, 0
  %66 = sext i1 %.not71 to i32
  %spec.select75 = add nsw i32 %spec.select74, %66
  %.not73 = icmp eq i32 %48, 0
  %67 = sext i1 %.not73 to i32
  %spec.select76 = add nsw i32 %spec.select75, %67
  %68 = sext i1 %63 to i32
  %spec.select77 = add nsw i32 %spec.select76, %68
  %69 = getelementptr inbounds i8, ptr %.0107, i64 16
  %70 = load ptr, ptr %69, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %.not65 = icmp eq ptr %70, %0
  br i1 %.not65, label %.loopexit, label %.preheader, !llvm.loop !16

.loopexit:                                        ; preds = %62, %22
  %.13 = phi i32 [ %.1108, %22 ], [ %spec.select77, %62 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 32
  br i1 %exitcond.not, label %71, label %10, !llvm.loop !18

71:                                               ; preds = %.loopexit
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next115, 25
  br i1 %exitcond117.not, label %72, label %.preheader79, !llvm.loop !19

72:                                               ; preds = %71
  ret i32 %.13
}

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @block_is_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @block_is_prev_free(ptr noundef) local_unnamed_addr #0

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

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

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

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

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 = { 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 = { noreturn nounwind }
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, !12, i64 32}
!6 = !{!"control_t", !7, i64 0, !12, i64 32, !9, i64 36, !9, i64 136}
!7 = !{!"block_header_t", !8, i64 0, !11, i64 8, !8, i64 16, !8, i64 24}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!8, !8, i64 0}
!15 = !{!7, !8, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


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