; LLVM IR from mlcommons/tiny :: benchmark/interface/Middlewares/ST/threadx/common/src (tx_byte_release)

; 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.TX_BYTE_POOL_STRUCT = type { i64, ptr, i64, i32, ptr, ptr, ptr, i64, ptr, ptr, i32, ptr, ptr }
%struct.TX_THREAD_STRUCT = type { i64, i64, ptr, ptr, ptr, i64, i64, i64, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, i64, %struct.TX_TIMER_INTERNAL_STRUCT, ptr, ptr, ptr, ptr, i64, ptr, i32, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, ptr, ptr, i64 }
%struct.TX_TIMER_INTERNAL_STRUCT = type { i64, i64, ptr, i64, ptr, ptr, ptr }

@_tx_thread_current_ptr = external global ptr, align 8
@_tx_thread_preempt_disable = external global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local i32 @_tx_byte_release(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 ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  store ptr null, ptr %5, align 8, !tbaa !5
  %19 = call i32 @__disable_interrupts()
  store i32 %19, ptr %3, align 4, !tbaa !9
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %20, ptr %7, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %51

23:                                               ; preds = %1
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 -16
  store ptr %25, ptr %7, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 8
  store ptr %27, ptr %8, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %28, ptr %15, align 8, !tbaa !5
  %29 = load ptr, ptr %15, align 8, !tbaa !5
  %30 = load i64, ptr %29, align 8, !tbaa !11
  %31 = icmp ne i64 %30, 4294962926
  br i1 %31, label %32, label %49

32:                                               ; preds = %23
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 8
  store ptr %34, ptr %8, align 8, !tbaa !5
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %35, ptr %16, align 8, !tbaa !5
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  store ptr %37, ptr %5, align 8, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = icmp eq ptr %38, null
  br i1 %39, label %40, label %41

40:                                               ; preds = %32
  store i32 3, ptr %4, align 4, !tbaa !9
  br label %48

41:                                               ; preds = %32
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %42, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !13
  %45 = icmp ne i64 %44, 1113150533
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  store i32 3, ptr %4, align 4, !tbaa !9
  store ptr null, ptr %5, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %46, %41
  br label %48

48:                                               ; preds = %47, %40
  br label %50

49:                                               ; preds = %23
  store i32 3, ptr %4, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %49, %48
  br label %52

51:                                               ; preds = %1
  store i32 3, ptr %4, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %51, %50
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %57

55:                                               ; preds = %52
  %56 = load i32, ptr %3, align 4, !tbaa !9
  call void @__restore_interrupt(i32 noundef %56)
  br label %215

57:                                               ; preds = %52
  %58 = load ptr, ptr @_tx_thread_current_ptr, align 8, !tbaa !5
  store ptr %58, ptr %6, align 8, !tbaa !5
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %60, i32 0, i32 8
  store ptr %59, ptr %61, align 8, !tbaa !15
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 8
  store ptr %63, ptr %8, align 8, !tbaa !5
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %64, ptr %15, align 8, !tbaa !5
  %65 = load ptr, ptr %15, align 8, !tbaa !5
  store i64 4294962926, ptr %65, align 8, !tbaa !11
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %66, ptr %17, align 8, !tbaa !5
  %67 = load ptr, ptr %17, align 8, !tbaa !5
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  store ptr %68, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %69, i32 0, i32 2
  %71 = load i64, ptr %70, align 8, !tbaa !16
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = ptrtoint ptr %72 to i64
  %75 = ptrtoint ptr %73 to i64
  %76 = sub i64 %74, %75
  %77 = add i64 %71, %76
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %78, i32 0, i32 2
  store i64 %77, ptr %79, align 8, !tbaa !16
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %81, i32 0, i32 5
  %83 = load ptr, ptr %82, align 8, !tbaa !17
  %84 = icmp ult ptr %80, %83
  br i1 %84, label %85, label %89

85:                                               ; preds = %57
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %87, i32 0, i32 5
  store ptr %86, ptr %88, align 8, !tbaa !17
  br label %89

89:                                               ; preds = %85, %57
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %90, i32 0, i32 10
  %92 = load i32, ptr %91, align 8, !tbaa !18
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %212

94:                                               ; preds = %89
  br label %95

95:                                               ; preds = %209, %94
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %96, i32 0, i32 10
  %98 = load i32, ptr %97, align 8, !tbaa !18
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %210

100:                                              ; preds = %95
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %101, i32 0, i32 9
  %103 = load ptr, ptr %102, align 8, !tbaa !19
  store ptr %103, ptr %10, align 8, !tbaa !5
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %104, i32 0, i32 24
  %106 = load i64, ptr %105, align 8, !tbaa !20
  store i64 %106, ptr %14, align 8, !tbaa !11
  %107 = load i32, ptr %3, align 4, !tbaa !9
  call void @__restore_interrupt(i32 noundef %107)
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = load i64, ptr %14, align 8, !tbaa !11
  %110 = call ptr @_tx_byte_pool_search(ptr noundef %108, i64 noundef %109)
  store ptr %110, ptr %7, align 8, !tbaa !5
  %111 = call i32 @__disable_interrupts()
  store i32 %111, ptr %3, align 4, !tbaa !9
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %113, i32 0, i32 8
  store ptr %112, ptr %114, align 8, !tbaa !15
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = icmp eq ptr %115, null
  br i1 %116, label %117, label %118

117:                                              ; preds = %100
  br label %210

118:                                              ; preds = %100
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %120, i32 0, i32 9
  %122 = load ptr, ptr %121, align 8, !tbaa !19
  %123 = icmp eq ptr %119, %122
  br i1 %123, label %124, label %175

124:                                              ; preds = %118
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %125, i32 0, i32 24
  %127 = load i64, ptr %126, align 8, !tbaa !20
  %128 = load i64, ptr %14, align 8, !tbaa !11
  %129 = icmp eq i64 %127, %128
  br i1 %129, label %130, label %174

130:                                              ; preds = %124
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %131, i32 0, i32 10
  %133 = load i32, ptr %132, align 8, !tbaa !18
  %134 = add i32 %133, -1
  store i32 %134, ptr %132, align 8, !tbaa !18
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %135, i32 0, i32 10
  %137 = load i32, ptr %136, align 8, !tbaa !18
  store i32 %137, ptr %11, align 4, !tbaa !9
  %138 = load i32, ptr %11, align 4, !tbaa !9
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %140, label %143

140:                                              ; preds = %130
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %141, i32 0, i32 9
  store ptr null, ptr %142, align 8, !tbaa !19
  br label %159

143:                                              ; preds = %130
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %144, i32 0, i32 22
  %146 = load ptr, ptr %145, align 8, !tbaa !23
  store ptr %146, ptr %12, align 8, !tbaa !5
  %147 = load ptr, ptr %12, align 8, !tbaa !5
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %148, i32 0, i32 9
  store ptr %147, ptr %149, align 8, !tbaa !19
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %150, i32 0, i32 23
  %152 = load ptr, ptr %151, align 8, !tbaa !24
  store ptr %152, ptr %13, align 8, !tbaa !5
  %153 = load ptr, ptr %13, align 8, !tbaa !5
  %154 = load ptr, ptr %12, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %154, i32 0, i32 23
  store ptr %153, ptr %155, align 8, !tbaa !24
  %156 = load ptr, ptr %12, align 8, !tbaa !5
  %157 = load ptr, ptr %13, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %157, i32 0, i32 22
  store ptr %156, ptr %158, align 8, !tbaa !23
  br label %159

159:                                              ; preds = %143, %140
  %160 = load ptr, ptr %10, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %160, i32 0, i32 20
  store ptr null, ptr %161, align 8, !tbaa !25
  %162 = load ptr, ptr %10, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %162, i32 0, i32 25
  %164 = load ptr, ptr %163, align 8, !tbaa !26
  store ptr %164, ptr %18, align 8, !tbaa !5
  %165 = load ptr, ptr %7, align 8, !tbaa !5
  %166 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %165, ptr %166, align 8, !tbaa !5
  store ptr null, ptr %7, align 8, !tbaa !5
  %167 = load ptr, ptr %10, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %167, i32 0, i32 27
  store i32 0, ptr %168, align 4, !tbaa !27
  %169 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !9
  %170 = add i32 %169, 1
  store volatile i32 %170, ptr @_tx_thread_preempt_disable, align 4, !tbaa !9
  %171 = load i32, ptr %3, align 4, !tbaa !9
  call void @__restore_interrupt(i32 noundef %171)
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_tx_thread_system_resume(ptr noundef %172)
  %173 = call i32 @__disable_interrupts()
  store i32 %173, ptr %3, align 4, !tbaa !9
  br label %174

174:                                              ; preds = %159, %124
  br label %175

175:                                              ; preds = %174, %118
  %176 = load ptr, ptr %7, align 8, !tbaa !5
  %177 = icmp ne ptr %176, null
  br i1 %177, label %178, label %209

178:                                              ; preds = %175
  %179 = load ptr, ptr %7, align 8, !tbaa !5
  %180 = getelementptr inbounds i8, ptr %179, i64 -16
  store ptr %180, ptr %7, align 8, !tbaa !5
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  %182 = getelementptr inbounds i8, ptr %181, i64 8
  store ptr %182, ptr %8, align 8, !tbaa !5
  %183 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %183, ptr %15, align 8, !tbaa !5
  %184 = load ptr, ptr %15, align 8, !tbaa !5
  store i64 4294962926, ptr %184, align 8, !tbaa !11
  %185 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %185, ptr %17, align 8, !tbaa !5
  %186 = load ptr, ptr %17, align 8, !tbaa !5
  %187 = load ptr, ptr %186, align 8, !tbaa !5
  store ptr %187, ptr %9, align 8, !tbaa !5
  %188 = load ptr, ptr %5, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %188, i32 0, i32 2
  %190 = load i64, ptr %189, align 8, !tbaa !16
  %191 = load ptr, ptr %9, align 8, !tbaa !5
  %192 = load ptr, ptr %7, align 8, !tbaa !5
  %193 = ptrtoint ptr %191 to i64
  %194 = ptrtoint ptr %192 to i64
  %195 = sub i64 %193, %194
  %196 = add i64 %190, %195
  %197 = load ptr, ptr %5, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %197, i32 0, i32 2
  store i64 %196, ptr %198, align 8, !tbaa !16
  %199 = load ptr, ptr %7, align 8, !tbaa !5
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %200, i32 0, i32 5
  %202 = load ptr, ptr %201, align 8, !tbaa !17
  %203 = icmp ult ptr %199, %202
  br i1 %203, label %204, label %208

204:                                              ; preds = %178
  %205 = load ptr, ptr %7, align 8, !tbaa !5
  %206 = load ptr, ptr %5, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.TX_BYTE_POOL_STRUCT, ptr %206, i32 0, i32 5
  store ptr %205, ptr %207, align 8, !tbaa !17
  br label %208

208:                                              ; preds = %204, %178
  br label %209

209:                                              ; preds = %208, %175
  br label %95, !llvm.loop !28

210:                                              ; preds = %117, %95
  %211 = load i32, ptr %3, align 4, !tbaa !9
  call void @__restore_interrupt(i32 noundef %211)
  call void @_tx_thread_system_preempt_check()
  br label %214

212:                                              ; preds = %89
  %213 = load i32, ptr %3, align 4, !tbaa !9
  call void @__restore_interrupt(i32 noundef %213)
  br label %214

214:                                              ; preds = %212, %210
  br label %215

215:                                              ; preds = %214, %55
  %216 = load i32, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret i32 %216
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @__disable_interrupts() #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @__restore_interrupt(i32 noundef) #2

declare ptr @_tx_byte_pool_search(ptr noundef, i64 noundef) #3

declare void @_tx_thread_system_resume(ptr noundef) #3

declare void @_tx_thread_system_preempt_check() #3

; 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 = { alwaysinline 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 = { "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 }

!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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"TX_BYTE_POOL_STRUCT", !12, i64 0, !6, i64 8, !12, i64 16, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !12, i64 56, !6, i64 64, !6, i64 72, !10, i64 80, !6, i64 88, !6, i64 96}
!15 = !{!14, !6, i64 64}
!16 = !{!14, !12, i64 16}
!17 = !{!14, !6, i64 40}
!18 = !{!14, !10, i64 80}
!19 = !{!14, !6, i64 72}
!20 = !{!21, !12, i64 224}
!21 = !{!"TX_THREAD_STRUCT", !12, i64 0, !12, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !6, i64 112, !6, i64 120, !12, i64 128, !22, i64 136, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !12, i64 224, !6, i64 232, !10, i64 240, !10, i64 244, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !10, i64 280, !10, i64 284, !10, i64 288, !10, i64 292, !6, i64 296, !6, i64 304, !6, i64 312, !12, i64 320}
!22 = !{!"TX_TIMER_INTERNAL_STRUCT", !12, i64 0, !12, i64 8, !6, i64 16, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!23 = !{!21, !6, i64 208}
!24 = !{!21, !6, i64 216}
!25 = !{!21, !6, i64 192}
!26 = !{!21, !6, i64 232}
!27 = !{!21, !10, i64 244}
!28 = distinct !{!28, !29}
!29 = !{!"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"

@_tx_thread_current_ptr = external local_unnamed_addr global ptr, align 8
@_tx_thread_preempt_disable = external global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 4) i32 @_tx_byte_release(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call i32 @__disable_interrupts()
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %10, label %3

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 -16
  %5 = getelementptr inbounds i8, ptr %0, i64 -8
  %6 = load i64, ptr %5, align 8
  %7 = inttoptr i64 %6 to ptr
  switch i64 %6, label %8 [
    i64 4294962926, label %10
    i64 0, label %10
  ]

8:                                                ; preds = %3
  %9 = load i64, ptr %7, align 8, !tbaa !5
  %.not90 = icmp eq i64 %9, 1113150533
  %spec.select94 = select i1 %.not90, i32 0, i32 3
  br i1 %.not90, label %11, label %10

10:                                               ; preds = %3, %3, %8, %1
  tail call void @__restore_interrupt(i32 noundef %2)
  br label %76

11:                                               ; preds = %8
  %12 = load ptr, ptr @_tx_thread_current_ptr, align 8, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %7, i64 64
  store ptr %12, ptr %13, align 8, !tbaa !13
  store i64 4294962926, ptr %5, align 8, !tbaa !14
  %14 = load ptr, ptr %4, align 8, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %7, i64 16
  %16 = load i64, ptr %15, align 8, !tbaa !15
  %17 = ptrtoint ptr %14 to i64
  %18 = ptrtoint ptr %4 to i64
  %19 = sub i64 %17, %18
  %20 = add i64 %19, %16
  store i64 %20, ptr %15, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %7, i64 40
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = icmp ult ptr %4, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %11
  store ptr %4, ptr %21, align 8, !tbaa !16
  br label %25

25:                                               ; preds = %24, %11
  %26 = getelementptr inbounds i8, ptr %7, i64 80
  %27 = load i32, ptr %26, align 8, !tbaa !17
  %.not91 = icmp eq i32 %27, 0
  br i1 %.not91, label %75, label %.preheader

.preheader:                                       ; preds = %25
  %28 = getelementptr inbounds i8, ptr %7, i64 72
  br label %29

29:                                               ; preds = %.preheader, %73
  %.0109 = phi i32 [ %2, %.preheader ], [ %.1107, %73 ]
  %30 = load ptr, ptr %28, align 8, !tbaa !18
  %31 = getelementptr inbounds i8, ptr %30, i64 224
  %32 = load i64, ptr %31, align 8, !tbaa !19
  tail call void @__restore_interrupt(i32 noundef %.0109)
  %33 = tail call ptr @_tx_byte_pool_search(ptr noundef nonnull %7, i64 noundef %32) #3
  %34 = tail call i32 @__disable_interrupts()
  store ptr %12, ptr %13, align 8, !tbaa !13
  %35 = icmp eq ptr %33, null
  br i1 %35, label %74, label %36

36:                                               ; preds = %29
  %37 = load ptr, ptr %28, align 8, !tbaa !18
  %38 = icmp eq ptr %30, %37
  br i1 %38, label %39, label %61

39:                                               ; preds = %36
  %40 = load i64, ptr %31, align 8, !tbaa !19
  %41 = icmp eq i64 %40, %32
  br i1 %41, label %42, label %61

42:                                               ; preds = %39
  %43 = load i32, ptr %26, align 8, !tbaa !17
  %44 = add i32 %43, -1
  store i32 %44, ptr %26, align 8, !tbaa !17
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %53, label %46

46:                                               ; preds = %42
  %47 = getelementptr inbounds i8, ptr %30, i64 208
  %48 = load ptr, ptr %47, align 8, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %30, i64 216
  %50 = load ptr, ptr %49, align 8, !tbaa !23
  %51 = getelementptr inbounds i8, ptr %48, i64 216
  store ptr %50, ptr %51, align 8, !tbaa !23
  %52 = getelementptr inbounds i8, ptr %50, i64 208
  store ptr %48, ptr %52, align 8, !tbaa !22
  br label %53

53:                                               ; preds = %42, %46
  %.sink = phi ptr [ %48, %46 ], [ null, %42 ]
  store ptr %.sink, ptr %28, align 8
  %54 = getelementptr inbounds i8, ptr %30, i64 192
  store ptr null, ptr %54, align 8, !tbaa !24
  %55 = getelementptr inbounds i8, ptr %30, i64 232
  %56 = load ptr, ptr %55, align 8, !tbaa !25
  store ptr %33, ptr %56, align 8, !tbaa !12
  %57 = getelementptr inbounds i8, ptr %30, i64 244
  store i32 0, ptr %57, align 4, !tbaa !26
  %58 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !27
  %59 = add i32 %58, 1
  store volatile i32 %59, ptr @_tx_thread_preempt_disable, align 4, !tbaa !27
  tail call void @__restore_interrupt(i32 noundef %34)
  tail call void @_tx_thread_system_resume(ptr noundef nonnull %30) #3
  %60 = tail call i32 @__disable_interrupts()
  br label %73

61:                                               ; preds = %39, %36
  %62 = getelementptr inbounds i8, ptr %33, i64 -16
  %63 = getelementptr inbounds i8, ptr %33, i64 -8
  store i64 4294962926, ptr %63, align 8, !tbaa !14
  %64 = load ptr, ptr %62, align 8, !tbaa !12
  %65 = load i64, ptr %15, align 8, !tbaa !15
  %66 = ptrtoint ptr %64 to i64
  %67 = ptrtoint ptr %62 to i64
  %68 = sub i64 %66, %67
  %69 = add i64 %68, %65
  store i64 %69, ptr %15, align 8, !tbaa !15
  %70 = load ptr, ptr %21, align 8, !tbaa !16
  %71 = icmp ult ptr %62, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %61
  store ptr %62, ptr %21, align 8, !tbaa !16
  br label %73

73:                                               ; preds = %53, %61, %72
  %.1107 = phi i32 [ %34, %61 ], [ %34, %72 ], [ %60, %53 ]
  %.pr = load i32, ptr %26, align 8, !tbaa !17
  %.not92 = icmp eq i32 %.pr, 0
  br i1 %.not92, label %74, label %29, !llvm.loop !28

74:                                               ; preds = %29, %73
  %.2 = phi i32 [ %34, %29 ], [ %.1107, %73 ]
  tail call void @__restore_interrupt(i32 noundef %.2)
  tail call void @_tx_thread_system_preempt_check() #3
  br label %76

75:                                               ; preds = %25
  tail call void @__restore_interrupt(i32 noundef %2)
  br label %76

76:                                               ; preds = %74, %75, %10
  %.07898 = phi i32 [ %spec.select94, %74 ], [ 0, %75 ], [ 3, %10 ]
  ret i32 %.07898
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @__disable_interrupts() local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @__restore_interrupt(i32 noundef) local_unnamed_addr #1

declare ptr @_tx_byte_pool_search(ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @_tx_thread_system_resume(ptr noundef) local_unnamed_addr #2

declare void @_tx_thread_system_preempt_check() local_unnamed_addr #2

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 = { alwaysinline 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 = { "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 }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"TX_BYTE_POOL_STRUCT", !7, i64 0, !10, i64 8, !7, i64 16, !11, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !10, i64 64, !10, i64 72, !11, i64 80, !10, i64 88, !10, i64 96}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!10, !10, i64 0}
!13 = !{!6, !10, i64 64}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !10, i64 40}
!17 = !{!6, !11, i64 80}
!18 = !{!6, !10, i64 72}
!19 = !{!20, !7, i64 224}
!20 = !{!"TX_THREAD_STRUCT", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !10, i64 112, !10, i64 120, !7, i64 128, !21, i64 136, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !7, i64 224, !10, i64 232, !11, i64 240, !11, i64 244, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !10, i64 296, !10, i64 304, !10, i64 312, !7, i64 320}
!21 = !{!"TX_TIMER_INTERNAL_STRUCT", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48}
!22 = !{!20, !10, i64 208}
!23 = !{!20, !10, i64 216}
!24 = !{!20, !10, i64 192}
!25 = !{!20, !10, i64 232}
!26 = !{!20, !11, i64 244}
!27 = !{!11, !11, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,MergedLoadStoreMotionPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass