; LLVM IR from mlcommons/tiny :: benchmark/interface/Middlewares/ST/threadx/common/src/tx_thread_system_resume._1a095aef (resume)

; 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_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_preempt_disable = external global i32, align 4
@_tx_thread_priority_list = external global [32 x ptr], align 16
@_tx_thread_priority_maps = external global [1 x i64], align 8
@_tx_thread_highest_priority = external global i32, align 4
@_tx_thread_execute_ptr = external global ptr, align 8
@_tx_thread_preempted_maps = external global [1 x i64], align 8
@_tx_thread_current_ptr = external global ptr, align 8

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @_tx_thread_system_return_inline() #0

; Function Attrs: nounwind uwtable
define dso_local void @_tx_thread_system_resume(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  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
  %12 = call i32 @__disable_interrupts()
  store i32 %12, ptr %3, align 4, !tbaa !9
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %13, i32 0, i32 19
  %15 = getelementptr inbounds %struct.TX_TIMER_INTERNAL_STRUCT, ptr %14, i32 0, i32 6
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %21

18:                                               ; preds = %1
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %19, i32 0, i32 19
  call void @_tx_timer_system_deactivate(ptr noundef %20)
  br label %25

21:                                               ; preds = %1
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %22, i32 0, i32 19
  %24 = getelementptr inbounds %struct.TX_TIMER_INTERNAL_STRUCT, ptr %23, i32 0, i32 0
  store i64 0, ptr %24, align 8, !tbaa !15
  br label %25

25:                                               ; preds = %21, %18
  %26 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !9
  %27 = add i32 %26, -1
  store volatile i32 %27, ptr @_tx_thread_preempt_disable, align 4, !tbaa !9
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %28, i32 0, i32 14
  %30 = load i32, ptr %29, align 4, !tbaa !16
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %140

32:                                               ; preds = %25
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %33, i32 0, i32 12
  %35 = load i32, ptr %34, align 4, !tbaa !17
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %139

37:                                               ; preds = %32
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %38, i32 0, i32 13
  %40 = load i32, ptr %39, align 8, !tbaa !18
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %133

42:                                               ; preds = %37
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %43, i32 0, i32 12
  store i32 0, ptr %44, align 4, !tbaa !17
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %45, i32 0, i32 11
  %47 = load i32, ptr %46, align 8, !tbaa !19
  store i32 %47, ptr %4, align 4, !tbaa !9
  %48 = load i32, ptr %4, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds [32 x ptr], ptr @_tx_thread_priority_list, i64 0, i64 %49
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  store ptr %51, ptr %6, align 8, !tbaa !5
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %116

54:                                               ; preds = %42
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = load i32, ptr %4, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds [32 x ptr], ptr @_tx_thread_priority_list, i64 0, i64 %57
  store ptr %55, ptr %58, align 8, !tbaa !5
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %60, i32 0, i32 8
  store ptr %59, ptr %61, align 8, !tbaa !20
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %63, i32 0, i32 9
  store ptr %62, ptr %64, align 8, !tbaa !21
  %65 = load i32, ptr %4, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = shl i64 1, %66
  store i64 %67, ptr %5, align 8, !tbaa !22
  %68 = load i64, ptr @_tx_thread_priority_maps, align 8, !tbaa !22
  %69 = load i64, ptr %5, align 8, !tbaa !22
  %70 = or i64 %68, %69
  store i64 %70, ptr @_tx_thread_priority_maps, align 8, !tbaa !22
  %71 = load i32, ptr %4, align 4, !tbaa !9
  %72 = load i32, ptr @_tx_thread_highest_priority, align 4, !tbaa !9
  %73 = icmp ult i32 %71, %72
  br i1 %73, label %74, label %115

74:                                               ; preds = %54
  %75 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %75, ptr @_tx_thread_highest_priority, align 4, !tbaa !9
  %76 = load ptr, ptr @_tx_thread_execute_ptr, align 8, !tbaa !5
  store ptr %76, ptr %8, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = icmp eq ptr %77, null
  br i1 %78, label %79, label %81

79:                                               ; preds = %74
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %80, ptr @_tx_thread_execute_ptr, align 8, !tbaa !5
  br label %114

81:                                               ; preds = %74
  %82 = load i32, ptr %4, align 4, !tbaa !9
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %83, i32 0, i32 15
  %85 = load i32, ptr %84, align 8, !tbaa !23
  %86 = icmp ult i32 %82, %85
  br i1 %86, label %87, label %113

87:                                               ; preds = %81
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %88, i32 0, i32 15
  %90 = load i32, ptr %89, align 8, !tbaa !23
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %91, i32 0, i32 11
  %93 = load i32, ptr %92, align 8, !tbaa !19
  %94 = icmp ne i32 %90, %93
  br i1 %94, label %95, label %104

95:                                               ; preds = %87
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %96, i32 0, i32 11
  %98 = load i32, ptr %97, align 8, !tbaa !19
  %99 = zext i32 %98 to i64
  %100 = shl i64 1, %99
  store i64 %100, ptr %5, align 8, !tbaa !22
  %101 = load i64, ptr @_tx_thread_preempted_maps, align 8, !tbaa !22
  %102 = load i64, ptr %5, align 8, !tbaa !22
  %103 = or i64 %101, %102
  store i64 %103, ptr @_tx_thread_preempted_maps, align 8, !tbaa !22
  br label %104

104:                                              ; preds = %95, %87
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %105, ptr @_tx_thread_execute_ptr, align 8, !tbaa !5
  %106 = load i32, ptr %3, align 4, !tbaa !9
  call void @__restore_interrupt(i32 noundef %106)
  %107 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !9
  %108 = zext i32 %107 to i64
  store i64 %108, ptr %10, align 8, !tbaa !22
  %109 = load i64, ptr %10, align 8, !tbaa !22
  %110 = icmp eq i64 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %104
  call void @_tx_thread_system_return_inline()
  br label %112

112:                                              ; preds = %111, %104
  store i32 1, ptr %11, align 4
  br label %182

113:                                              ; preds = %81
  br label %114

114:                                              ; preds = %113, %79
  br label %115

115:                                              ; preds = %114, %54
  br label %132

116:                                              ; preds = %42
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %117, i32 0, i32 9
  %119 = load ptr, ptr %118, align 8, !tbaa !21
  store ptr %119, ptr %7, align 8, !tbaa !5
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %121, i32 0, i32 8
  store ptr %120, ptr %122, align 8, !tbaa !20
  %123 = load ptr, ptr %2, align 8, !tbaa !5
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %124, i32 0, i32 9
  store ptr %123, ptr %125, align 8, !tbaa !21
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  %127 = load ptr, ptr %2, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %127, i32 0, i32 9
  store ptr %126, ptr %128, align 8, !tbaa !21
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %130, i32 0, i32 8
  store ptr %129, ptr %131, align 8, !tbaa !20
  br label %132

132:                                              ; preds = %116, %115
  br label %138

133:                                              ; preds = %37
  %134 = load ptr, ptr %2, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %134, i32 0, i32 13
  store i32 0, ptr %135, align 8, !tbaa !18
  %136 = load ptr, ptr %2, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %136, i32 0, i32 12
  store i32 3, ptr %137, align 4, !tbaa !17
  br label %138

138:                                              ; preds = %133, %132
  br label %139

139:                                              ; preds = %138, %32
  br label %168

140:                                              ; preds = %25
  %141 = load ptr, ptr %2, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %141, i32 0, i32 12
  %143 = load i32, ptr %142, align 4, !tbaa !17
  %144 = icmp ne i32 %143, 1
  br i1 %144, label %145, label %167

145:                                              ; preds = %140
  %146 = load ptr, ptr %2, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %146, i32 0, i32 12
  %148 = load i32, ptr %147, align 4, !tbaa !17
  %149 = icmp ne i32 %148, 2
  br i1 %149, label %150, label %166

150:                                              ; preds = %145
  %151 = load ptr, ptr %2, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %151, i32 0, i32 13
  %153 = load i32, ptr %152, align 8, !tbaa !18
  %154 = icmp eq i32 %153, 0
  br i1 %154, label %155, label %160

155:                                              ; preds = %150
  %156 = load ptr, ptr %2, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %156, i32 0, i32 14
  store i32 0, ptr %157, align 4, !tbaa !16
  %158 = load ptr, ptr %2, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %158, i32 0, i32 12
  store i32 0, ptr %159, align 4, !tbaa !17
  br label %165

160:                                              ; preds = %150
  %161 = load ptr, ptr %2, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %161, i32 0, i32 13
  store i32 0, ptr %162, align 8, !tbaa !18
  %163 = load ptr, ptr %2, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %163, i32 0, i32 12
  store i32 3, ptr %164, align 4, !tbaa !17
  br label %165

165:                                              ; preds = %160, %155
  br label %166

166:                                              ; preds = %165, %145
  br label %167

167:                                              ; preds = %166, %140
  br label %168

168:                                              ; preds = %167, %139
  %169 = load ptr, ptr @_tx_thread_current_ptr, align 8, !tbaa !5
  store ptr %169, ptr %9, align 8, !tbaa !5
  %170 = load i32, ptr %3, align 4, !tbaa !9
  call void @__restore_interrupt(i32 noundef %170)
  %171 = load ptr, ptr %9, align 8, !tbaa !5
  %172 = load ptr, ptr @_tx_thread_execute_ptr, align 8, !tbaa !5
  %173 = icmp ne ptr %171, %172
  br i1 %173, label %174, label %181

174:                                              ; preds = %168
  %175 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !9
  %176 = zext i32 %175 to i64
  store i64 %176, ptr %10, align 8, !tbaa !22
  %177 = load i64, ptr %10, align 8, !tbaa !22
  %178 = icmp eq i64 %177, 0
  br i1 %178, label %179, label %180

179:                                              ; preds = %174
  call void @_tx_thread_system_return_inline()
  br label %180

180:                                              ; preds = %179, %174
  br label %181

181:                                              ; preds = %180, %168
  store i32 0, ptr %11, align 4
  br label %182

182:                                              ; preds = %181, %112
  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
  %183 = load i32, ptr %11, align 4
  switch i32 %183, label %185 [
    i32 0, label %184
    i32 1, label %184
  ]

184:                                              ; preds = %182, %182
  ret void

185:                                              ; preds = %182
  unreachable
}

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

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

declare void @_tx_timer_system_deactivate(ptr noundef) #3

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

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

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 184}
!12 = !{!"TX_THREAD_STRUCT", !13, i64 0, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 48, !13, 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, !13, i64 128, !14, i64 136, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !13, 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, !13, i64 320}
!13 = !{!"long", !7, i64 0}
!14 = !{!"TX_TIMER_INTERNAL_STRUCT", !13, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!15 = !{!12, !13, i64 136}
!16 = !{!12, !10, i64 100}
!17 = !{!12, !10, i64 92}
!18 = !{!12, !10, i64 96}
!19 = !{!12, !10, i64 88}
!20 = !{!12, !6, i64 64}
!21 = !{!12, !6, i64 72}
!22 = !{!13, !13, i64 0}
!23 = !{!12, !10, i64 104}


; 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_preempt_disable = external global i32, align 4
@_tx_thread_priority_list = external local_unnamed_addr global [32 x ptr], align 16
@_tx_thread_priority_maps = external local_unnamed_addr global [1 x i64], align 8
@_tx_thread_highest_priority = external local_unnamed_addr global i32, align 4
@_tx_thread_execute_ptr = external local_unnamed_addr global ptr, align 8
@_tx_thread_preempted_maps = external local_unnamed_addr global [1 x i64], align 8
@_tx_thread_current_ptr = external local_unnamed_addr global ptr, align 8

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @_tx_thread_system_return_inline() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @_tx_thread_system_resume(ptr noundef %0) local_unnamed_addr #1 {
  %2 = tail call i32 @__disable_interrupts()
  %3 = getelementptr inbounds i8, ptr %0, i64 136
  %4 = getelementptr inbounds i8, ptr %0, i64 184
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %7, label %6

6:                                                ; preds = %1
  tail call void @_tx_timer_system_deactivate(ptr noundef nonnull %3) #3
  br label %8

7:                                                ; preds = %1
  store i64 0, ptr %3, align 8, !tbaa !13
  br label %8

8:                                                ; preds = %7, %6
  %9 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !14
  %10 = add i32 %9, -1
  store volatile i32 %10, ptr @_tx_thread_preempt_disable, align 4, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 100
  %12 = load i32, ptr %11, align 4, !tbaa !15
  %13 = icmp eq i32 %12, 0
  %14 = getelementptr inbounds i8, ptr %0, i64 92
  %15 = load i32, ptr %14, align 4, !tbaa !16
  br i1 %13, label %16, label %62

16:                                               ; preds = %8
  %.not58 = icmp eq i32 %15, 0
  br i1 %.not58, label %69, label %17

17:                                               ; preds = %16
  %18 = getelementptr inbounds i8, ptr %0, i64 96
  %19 = load i32, ptr %18, align 8, !tbaa !17
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %61

21:                                               ; preds = %17
  store i32 0, ptr %14, align 4, !tbaa !16
  %22 = getelementptr inbounds i8, ptr %0, i64 88
  %23 = load i32, ptr %22, align 8, !tbaa !18
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds [32 x ptr], ptr @_tx_thread_priority_list, i64 0, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %55

28:                                               ; preds = %21
  store ptr %0, ptr %25, align 8, !tbaa !19
  %29 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %0, ptr %29, align 8, !tbaa !20
  %30 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %0, ptr %30, align 8, !tbaa !21
  %31 = shl nuw i64 1, %24
  %32 = load i64, ptr @_tx_thread_priority_maps, align 8, !tbaa !22
  %33 = or i64 %32, %31
  store i64 %33, ptr @_tx_thread_priority_maps, align 8, !tbaa !22
  %34 = load i32, ptr @_tx_thread_highest_priority, align 4, !tbaa !14
  %35 = icmp ult i32 %23, %34
  br i1 %35, label %36, label %69

36:                                               ; preds = %28
  store i32 %23, ptr @_tx_thread_highest_priority, align 4, !tbaa !14
  %37 = load ptr, ptr @_tx_thread_execute_ptr, align 8, !tbaa !19
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store ptr %0, ptr @_tx_thread_execute_ptr, align 8, !tbaa !19
  br label %69

40:                                               ; preds = %36
  %41 = getelementptr inbounds i8, ptr %37, i64 104
  %42 = load i32, ptr %41, align 8, !tbaa !23
  %43 = icmp ult i32 %23, %42
  br i1 %43, label %44, label %69

44:                                               ; preds = %40
  %45 = getelementptr inbounds i8, ptr %37, i64 88
  %46 = load i32, ptr %45, align 8, !tbaa !18
  %.not59 = icmp eq i32 %42, %46
  br i1 %.not59, label %52, label %47

47:                                               ; preds = %44
  %48 = zext nneg i32 %46 to i64
  %49 = shl nuw i64 1, %48
  %50 = load i64, ptr @_tx_thread_preempted_maps, align 8, !tbaa !22
  %51 = or i64 %50, %49
  store i64 %51, ptr @_tx_thread_preempted_maps, align 8, !tbaa !22
  br label %52

52:                                               ; preds = %47, %44
  store ptr %0, ptr @_tx_thread_execute_ptr, align 8, !tbaa !19
  tail call void @__restore_interrupt(i32 noundef %2)
  %53 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !14
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %.sink.split, label %75

55:                                               ; preds = %21
  %56 = getelementptr inbounds i8, ptr %26, i64 72
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  %58 = getelementptr inbounds i8, ptr %57, i64 64
  store ptr %0, ptr %58, align 8, !tbaa !20
  store ptr %0, ptr %56, align 8, !tbaa !21
  %59 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %57, ptr %59, align 8, !tbaa !21
  %60 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %26, ptr %60, align 8, !tbaa !20
  br label %69

61:                                               ; preds = %17
  store i32 0, ptr %18, align 8, !tbaa !17
  store i32 3, ptr %14, align 4, !tbaa !16
  br label %69

62:                                               ; preds = %8
  %.off = add i32 %15, -1
  %switch = icmp ult i32 %.off, 2
  br i1 %switch, label %69, label %63

63:                                               ; preds = %62
  %64 = getelementptr inbounds i8, ptr %0, i64 96
  %65 = load i32, ptr %64, align 8, !tbaa !17
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %63
  store i32 0, ptr %11, align 4, !tbaa !15
  store i32 0, ptr %14, align 4, !tbaa !16
  br label %69

68:                                               ; preds = %63
  store i32 0, ptr %64, align 8, !tbaa !17
  store i32 3, ptr %14, align 4, !tbaa !16
  br label %69

69:                                               ; preds = %62, %67, %68, %16, %55, %39, %40, %28, %61
  %70 = load ptr, ptr @_tx_thread_current_ptr, align 8, !tbaa !19
  tail call void @__restore_interrupt(i32 noundef %2)
  %71 = load ptr, ptr @_tx_thread_execute_ptr, align 8, !tbaa !19
  %.not60 = icmp eq ptr %70, %71
  br i1 %.not60, label %75, label %72

72:                                               ; preds = %69
  %73 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !14
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %.sink.split, label %75

.sink.split:                                      ; preds = %72, %52
  tail call void @_tx_thread_system_return_inline()
  br label %75

75:                                               ; preds = %.sink.split, %69, %72, %52
  ret void
}

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

declare void @_tx_timer_system_deactivate(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #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 = { "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, !10, i64 184}
!6 = !{!"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, !12, 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}
!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 = !{!"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}
!13 = !{!6, !7, i64 136}
!14 = !{!11, !11, i64 0}
!15 = !{!6, !11, i64 100}
!16 = !{!6, !11, i64 92}
!17 = !{!6, !11, i64 96}
!18 = !{!6, !11, i64 88}
!19 = !{!10, !10, i64 0}
!20 = !{!6, !10, i64 64}
!21 = !{!6, !10, i64 72}
!22 = !{!7, !7, i64 0}
!23 = !{!6, !11, i64 104}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass