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

; 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_MUTEX_STRUCT = type { i64, ptr, i32, ptr, i32, i32, ptr, i32, 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_mutex_get(ptr noundef %0, i64 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %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 ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, 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 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %13 = call i32 @__disable_interrupts()
  store i32 %13, ptr %5, align 4, !tbaa !11
  %14 = load ptr, ptr @_tx_thread_current_ptr, align 8, !tbaa !5
  store ptr %14, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %15, i32 0, i32 2
  %17 = load i32, ptr %16, align 8, !tbaa !13
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %79

19:                                               ; preds = %2
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %20, i32 0, i32 2
  store i32 1, ptr %21, align 8, !tbaa !13
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %23, i32 0, i32 3
  store ptr %22, ptr %24, align 8, !tbaa !15
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %77

27:                                               ; preds = %19
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %28, i32 0, i32 4
  %30 = load i32, ptr %29, align 8, !tbaa !16
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %32, label %40

32:                                               ; preds = %27
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %33, i32 0, i32 11
  %35 = load i32, ptr %34, align 8, !tbaa !17
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %36, i32 0, i32 5
  store i32 %35, ptr %37, align 4, !tbaa !20
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %38, i32 0, i32 10
  store i32 32, ptr %39, align 8, !tbaa !21
  br label %40

40:                                               ; preds = %32, %27
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %41, i32 0, i32 36
  %43 = load ptr, ptr %42, align 8, !tbaa !22
  store ptr %43, ptr %7, align 8, !tbaa !5
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %62

46:                                               ; preds = %40
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %47, i32 0, i32 12
  %49 = load ptr, ptr %48, align 8, !tbaa !23
  store ptr %49, ptr %8, align 8, !tbaa !5
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %51, i32 0, i32 12
  store ptr %50, ptr %52, align 8, !tbaa !23
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %54, i32 0, i32 11
  store ptr %53, ptr %55, align 8, !tbaa !24
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %57, i32 0, i32 12
  store ptr %56, ptr %58, align 8, !tbaa !23
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %60, i32 0, i32 11
  store ptr %59, ptr %61, align 8, !tbaa !24
  br label %72

62:                                               ; preds = %40
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %64, i32 0, i32 36
  store ptr %63, ptr %65, align 8, !tbaa !22
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %67, i32 0, i32 11
  store ptr %66, ptr %68, align 8, !tbaa !24
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %70, i32 0, i32 12
  store ptr %69, ptr %71, align 8, !tbaa !23
  br label %72

72:                                               ; preds = %62, %46
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %73, i32 0, i32 35
  %75 = load i32, ptr %74, align 4, !tbaa !25
  %76 = add i32 %75, 1
  store i32 %76, ptr %74, align 4, !tbaa !25
  br label %77

77:                                               ; preds = %72, %19
  %78 = load i32, ptr %5, align 4, !tbaa !11
  call void @__restore_interrupt(i32 noundef %78)
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %217

79:                                               ; preds = %2
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %80, i32 0, i32 3
  %82 = load ptr, ptr %81, align 8, !tbaa !15
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = icmp eq ptr %82, %83
  br i1 %84, label %85, label %91

85:                                               ; preds = %79
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %86, i32 0, i32 2
  %88 = load i32, ptr %87, align 8, !tbaa !13
  %89 = add i32 %88, 1
  store i32 %89, ptr %87, align 8, !tbaa !13
  %90 = load i32, ptr %5, align 4, !tbaa !11
  call void @__restore_interrupt(i32 noundef %90)
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %216

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

94:                                               ; preds = %91
  %95 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !11
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %99

97:                                               ; preds = %94
  %98 = load i32, ptr %5, align 4, !tbaa !11
  call void @__restore_interrupt(i32 noundef %98)
  store i32 29, ptr %12, align 4, !tbaa !11
  br label %212

99:                                               ; preds = %94
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %100, i32 0, i32 3
  %102 = load ptr, ptr %101, align 8, !tbaa !15
  store ptr %102, ptr %9, align 8, !tbaa !5
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %103, i32 0, i32 20
  store ptr @_tx_mutex_cleanup, ptr %104, align 8, !tbaa !26
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %106, i32 0, i32 21
  store ptr %105, ptr %107, align 8, !tbaa !27
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %108, i32 0, i32 39
  %110 = load i64, ptr %109, align 8, !tbaa !28
  %111 = add i64 %110, 1
  store i64 %111, ptr %109, align 8, !tbaa !28
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %112, i32 0, i32 7
  %114 = load i32, ptr %113, align 8, !tbaa !29
  %115 = icmp eq i32 %114, 0
  br i1 %115, label %116, label %126

116:                                              ; preds = %99
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %118, i32 0, i32 6
  store ptr %117, ptr %119, align 8, !tbaa !30
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = load ptr, ptr %6, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %121, i32 0, i32 22
  store ptr %120, ptr %122, align 8, !tbaa !31
  %123 = load ptr, ptr %6, 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 23
  store ptr %123, ptr %125, align 8, !tbaa !32
  br label %145

126:                                              ; preds = %99
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %127, i32 0, i32 6
  %129 = load ptr, ptr %128, align 8, !tbaa !30
  store ptr %129, ptr %10, align 8, !tbaa !5
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %131, i32 0, i32 22
  store ptr %130, ptr %132, align 8, !tbaa !31
  %133 = load ptr, ptr %10, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %133, i32 0, i32 23
  %135 = load ptr, ptr %134, align 8, !tbaa !32
  store ptr %135, ptr %11, align 8, !tbaa !5
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %137, i32 0, i32 23
  store ptr %136, ptr %138, align 8, !tbaa !32
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %140, i32 0, i32 22
  store ptr %139, ptr %141, align 8, !tbaa !31
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = load ptr, ptr %10, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %143, i32 0, i32 23
  store ptr %142, ptr %144, align 8, !tbaa !32
  br label %145

145:                                              ; preds = %126, %116
  %146 = load ptr, ptr %3, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %146, i32 0, i32 7
  %148 = load i32, ptr %147, align 8, !tbaa !29
  %149 = add i32 %148, 1
  store i32 %149, ptr %147, align 8, !tbaa !29
  %150 = load ptr, ptr %6, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %150, i32 0, i32 12
  store i32 13, ptr %151, align 4, !tbaa !33
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %152, i32 0, i32 14
  store i32 1, ptr %153, align 4, !tbaa !34
  %154 = load i64, ptr %4, align 8, !tbaa !9
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %155, i32 0, i32 19
  %157 = getelementptr inbounds %struct.TX_TIMER_INTERNAL_STRUCT, ptr %156, i32 0, i32 0
  store i64 %154, ptr %157, align 8, !tbaa !35
  %158 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !11
  %159 = add i32 %158, 1
  store volatile i32 %159, ptr @_tx_thread_preempt_disable, align 4, !tbaa !11
  %160 = load i32, ptr %5, align 4, !tbaa !11
  call void @__restore_interrupt(i32 noundef %160)
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %161, i32 0, i32 4
  %163 = load i32, ptr %162, align 8, !tbaa !16
  %164 = icmp eq i32 %163, 1
  br i1 %164, label %165, label %207

165:                                              ; preds = %145
  %166 = load ptr, ptr %3, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %166, i32 0, i32 10
  %168 = load i32, ptr %167, align 8, !tbaa !21
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %169, i32 0, i32 11
  %171 = load i32, ptr %170, align 8, !tbaa !17
  %172 = icmp ugt i32 %168, %171
  br i1 %172, label %173, label %179

173:                                              ; preds = %165
  %174 = load ptr, ptr %6, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %174, i32 0, i32 11
  %176 = load i32, ptr %175, align 8, !tbaa !17
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.TX_MUTEX_STRUCT, ptr %177, i32 0, i32 10
  store i32 %176, ptr %178, align 8, !tbaa !21
  br label %179

179:                                              ; preds = %173, %165
  %180 = load ptr, ptr %6, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %180, i32 0, i32 11
  %182 = load i32, ptr %181, align 8, !tbaa !17
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %183, i32 0, i32 34
  %185 = load i32, ptr %184, align 8, !tbaa !36
  %186 = icmp ult i32 %182, %185
  br i1 %186, label %187, label %193

187:                                              ; preds = %179
  %188 = load ptr, ptr %6, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %188, i32 0, i32 11
  %190 = load i32, ptr %189, align 8, !tbaa !17
  %191 = load ptr, ptr %9, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %191, i32 0, i32 34
  store i32 %190, ptr %192, align 8, !tbaa !36
  br label %193

193:                                              ; preds = %187, %179
  %194 = load ptr, ptr %9, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %194, i32 0, i32 11
  %196 = load i32, ptr %195, align 8, !tbaa !17
  %197 = load ptr, ptr %6, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %197, i32 0, i32 11
  %199 = load i32, ptr %198, align 8, !tbaa !17
  %200 = icmp ugt i32 %196, %199
  br i1 %200, label %201, label %206

201:                                              ; preds = %193
  %202 = load ptr, ptr %9, align 8, !tbaa !5
  %203 = load ptr, ptr %6, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %203, i32 0, i32 11
  %205 = load i32, ptr %204, align 8, !tbaa !17
  call void @_tx_mutex_priority_change(ptr noundef %202, i32 noundef %205)
  br label %206

206:                                              ; preds = %201, %193
  br label %207

207:                                              ; preds = %206, %145
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_tx_thread_system_suspend(ptr noundef %208)
  %209 = load ptr, ptr %6, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %209, i32 0, i32 27
  %211 = load i32, ptr %210, align 4, !tbaa !37
  store i32 %211, ptr %12, align 4, !tbaa !11
  br label %212

212:                                              ; preds = %207, %97
  br label %215

213:                                              ; preds = %91
  %214 = load i32, ptr %5, align 4, !tbaa !11
  call void @__restore_interrupt(i32 noundef %214)
  store i32 29, ptr %12, align 4, !tbaa !11
  br label %215

215:                                              ; preds = %213, %212
  br label %216

216:                                              ; preds = %215, %85
  br label %217

217:                                              ; preds = %216, %77
  %218 = load i32, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, 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 4, ptr %5) #4
  ret i32 %218
}

; 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 void @_tx_mutex_cleanup(ptr noundef, i64 noundef) #3

declare void @_tx_mutex_priority_change(ptr noundef, i32 noundef) #3

declare void @_tx_thread_system_suspend(ptr noundef) #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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 16}
!14 = !{!"TX_MUTEX_STRUCT", !10, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !12, i64 32, !12, i64 36, !6, i64 40, !12, i64 48, !6, i64 56, !6, i64 64, !12, i64 72, !6, i64 80, !6, i64 88}
!15 = !{!14, !6, i64 24}
!16 = !{!14, !12, i64 32}
!17 = !{!18, !12, i64 88}
!18 = !{!"TX_THREAD_STRUCT", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !6, i64 112, !6, i64 120, !10, i64 128, !19, i64 136, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !10, i64 224, !6, i64 232, !12, i64 240, !12, i64 244, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !12, i64 280, !12, i64 284, !12, i64 288, !12, i64 292, !6, i64 296, !6, i64 304, !6, i64 312, !10, i64 320}
!19 = !{!"TX_TIMER_INTERNAL_STRUCT", !10, i64 0, !10, i64 8, !6, i64 16, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!20 = !{!14, !12, i64 36}
!21 = !{!14, !12, i64 72}
!22 = !{!18, !6, i64 296}
!23 = !{!14, !6, i64 88}
!24 = !{!14, !6, i64 80}
!25 = !{!18, !12, i64 292}
!26 = !{!18, !6, i64 192}
!27 = !{!18, !6, i64 200}
!28 = !{!18, !10, i64 320}
!29 = !{!14, !12, i64 48}
!30 = !{!14, !6, i64 40}
!31 = !{!18, !6, i64 208}
!32 = !{!18, !6, i64 216}
!33 = !{!18, !12, i64 92}
!34 = !{!18, !12, i64 100}
!35 = !{!18, !10, i64 136}
!36 = !{!18, !12, i64 288}
!37 = !{!18, !12, i64 244}


; 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 i32 @_tx_mutex_get(ptr noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 @__disable_interrupts()
  %4 = load ptr, ptr @_tx_thread_current_ptr, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %33

8:                                                ; preds = %2
  store i32 1, ptr %5, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %4, ptr %9, align 8, !tbaa !13
  %.not86 = icmp eq ptr %4, null
  br i1 %.not86, label %32, label %10

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = load i32, ptr %11, align 8, !tbaa !14
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %19

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %4, i64 88
  %16 = load i32, ptr %15, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %16, ptr %17, align 4, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %0, i64 72
  store i32 32, ptr %18, align 8, !tbaa !19
  br label %19

19:                                               ; preds = %14, %10
  %20 = getelementptr inbounds i8, ptr %4, i64 296
  %21 = load ptr, ptr %20, align 8, !tbaa !20
  %.not87 = icmp eq ptr %21, null
  br i1 %.not87, label %26, label %22

22:                                               ; preds = %19
  %23 = getelementptr inbounds i8, ptr %21, i64 88
  %24 = load ptr, ptr %23, align 8, !tbaa !21
  store ptr %0, ptr %23, align 8, !tbaa !21
  %25 = getelementptr inbounds i8, ptr %24, i64 80
  br label %26

26:                                               ; preds = %19, %22
  %.sink89 = phi ptr [ %25, %22 ], [ %20, %19 ]
  %.sink88 = phi ptr [ %21, %22 ], [ %0, %19 ]
  %.sink = phi ptr [ %24, %22 ], [ %0, %19 ]
  store ptr %0, ptr %.sink89, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %0, i64 80
  store ptr %.sink88, ptr %27, align 8
  %28 = getelementptr inbounds i8, ptr %0, i64 88
  store ptr %.sink, ptr %28, align 8
  %29 = getelementptr inbounds i8, ptr %4, i64 292
  %30 = load i32, ptr %29, align 4, !tbaa !22
  %31 = add i32 %30, 1
  store i32 %31, ptr %29, align 4, !tbaa !22
  br label %32

32:                                               ; preds = %26, %8
  tail call void @__restore_interrupt(i32 noundef %3)
  br label %93

33:                                               ; preds = %2
  %34 = getelementptr inbounds i8, ptr %0, i64 24
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = icmp eq ptr %35, %4
  br i1 %36, label %37, label %39

37:                                               ; preds = %33
  %38 = add i32 %6, 1
  store i32 %38, ptr %5, align 8, !tbaa !9
  tail call void @__restore_interrupt(i32 noundef %3)
  br label %93

39:                                               ; preds = %33
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %92, label %40

40:                                               ; preds = %39
  %41 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !23
  %.not85 = icmp eq i32 %41, 0
  br i1 %.not85, label %43, label %42

42:                                               ; preds = %40
  tail call void @__restore_interrupt(i32 noundef %3)
  br label %93

43:                                               ; preds = %40
  %44 = getelementptr inbounds i8, ptr %4, i64 192
  store ptr @_tx_mutex_cleanup, ptr %44, align 8, !tbaa !24
  %45 = getelementptr inbounds i8, ptr %4, i64 200
  store ptr %0, ptr %45, align 8, !tbaa !25
  %46 = getelementptr inbounds i8, ptr %4, i64 320
  %47 = load i64, ptr %46, align 8, !tbaa !26
  %48 = add i64 %47, 1
  store i64 %48, ptr %46, align 8, !tbaa !26
  %49 = getelementptr inbounds i8, ptr %0, i64 48
  %50 = load i32, ptr %49, align 8, !tbaa !27
  %51 = icmp eq i32 %50, 0
  %52 = getelementptr inbounds i8, ptr %0, i64 40
  %53 = getelementptr inbounds i8, ptr %4, i64 208
  br i1 %51, label %54, label %56

54:                                               ; preds = %43
  store ptr %4, ptr %52, align 8, !tbaa !28
  store ptr %4, ptr %53, align 8, !tbaa !29
  %55 = getelementptr inbounds i8, ptr %4, i64 216
  br label %62

56:                                               ; preds = %43
  %57 = load ptr, ptr %52, align 8, !tbaa !28
  store ptr %57, ptr %53, align 8, !tbaa !29
  %58 = getelementptr inbounds i8, ptr %57, i64 216
  %59 = load ptr, ptr %58, align 8, !tbaa !30
  %60 = getelementptr inbounds i8, ptr %4, i64 216
  store ptr %59, ptr %60, align 8, !tbaa !30
  %61 = getelementptr inbounds i8, ptr %59, i64 208
  store ptr %4, ptr %61, align 8, !tbaa !29
  br label %62

62:                                               ; preds = %56, %54
  %.sink90 = phi ptr [ %58, %56 ], [ %55, %54 ]
  store ptr %4, ptr %.sink90, align 8, !tbaa !30
  %63 = add i32 %50, 1
  store i32 %63, ptr %49, align 8, !tbaa !27
  %64 = getelementptr inbounds i8, ptr %4, i64 92
  store i32 13, ptr %64, align 4, !tbaa !31
  %65 = getelementptr inbounds i8, ptr %4, i64 100
  store i32 1, ptr %65, align 4, !tbaa !32
  %66 = getelementptr inbounds i8, ptr %4, i64 136
  store i64 %1, ptr %66, align 8, !tbaa !33
  %67 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !23
  %68 = add i32 %67, 1
  store volatile i32 %68, ptr @_tx_thread_preempt_disable, align 4, !tbaa !23
  tail call void @__restore_interrupt(i32 noundef %3)
  %69 = getelementptr inbounds i8, ptr %0, i64 32
  %70 = load i32, ptr %69, align 8, !tbaa !14
  %71 = icmp eq i32 %70, 1
  br i1 %71, label %72, label %89

72:                                               ; preds = %62
  %73 = getelementptr inbounds i8, ptr %0, i64 72
  %74 = load i32, ptr %73, align 8, !tbaa !19
  %75 = getelementptr inbounds i8, ptr %4, i64 88
  %76 = load i32, ptr %75, align 8, !tbaa !15
  %77 = icmp ugt i32 %74, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %72
  store i32 %76, ptr %73, align 8, !tbaa !19
  br label %79

79:                                               ; preds = %78, %72
  %80 = getelementptr inbounds i8, ptr %35, i64 288
  %81 = load i32, ptr %80, align 8, !tbaa !34
  %82 = icmp ult i32 %76, %81
  br i1 %82, label %83, label %84

83:                                               ; preds = %79
  store i32 %76, ptr %80, align 8, !tbaa !34
  br label %84

84:                                               ; preds = %83, %79
  %85 = getelementptr inbounds i8, ptr %35, i64 88
  %86 = load i32, ptr %85, align 8, !tbaa !15
  %87 = icmp ugt i32 %86, %76
  br i1 %87, label %88, label %89

88:                                               ; preds = %84
  tail call void @_tx_mutex_priority_change(ptr noundef nonnull %35, i32 noundef %76) #3
  br label %89

89:                                               ; preds = %84, %88, %62
  tail call void @_tx_thread_system_suspend(ptr noundef nonnull %4) #3
  %90 = getelementptr inbounds i8, ptr %4, i64 244
  %91 = load i32, ptr %90, align 4, !tbaa !35
  br label %93

92:                                               ; preds = %39
  tail call void @__restore_interrupt(i32 noundef %3)
  br label %93

93:                                               ; preds = %37, %42, %89, %92, %32
  %.0 = phi i32 [ 0, %32 ], [ 0, %37 ], [ 29, %42 ], [ %91, %89 ], [ 29, %92 ]
  ret i32 %.0
}

; 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 void @_tx_mutex_cleanup(ptr noundef, i64 noundef) #2

declare void @_tx_mutex_priority_change(ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @_tx_thread_system_suspend(ptr noundef) 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 16}
!10 = !{!"TX_MUTEX_STRUCT", !11, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !12, i64 32, !12, i64 36, !6, i64 40, !12, i64 48, !6, i64 56, !6, i64 64, !12, i64 72, !6, i64 80, !6, i64 88}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !12, i64 32}
!15 = !{!16, !12, i64 88}
!16 = !{!"TX_THREAD_STRUCT", !11, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !6, i64 112, !6, i64 120, !11, i64 128, !17, i64 136, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !11, i64 224, !6, i64 232, !12, i64 240, !12, i64 244, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !12, i64 280, !12, i64 284, !12, i64 288, !12, i64 292, !6, i64 296, !6, i64 304, !6, i64 312, !11, i64 320}
!17 = !{!"TX_TIMER_INTERNAL_STRUCT", !11, i64 0, !11, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!18 = !{!10, !12, i64 36}
!19 = !{!10, !12, i64 72}
!20 = !{!16, !6, i64 296}
!21 = !{!10, !6, i64 88}
!22 = !{!16, !12, i64 292}
!23 = !{!12, !12, i64 0}
!24 = !{!16, !6, i64 192}
!25 = !{!16, !6, i64 200}
!26 = !{!16, !11, i64 320}
!27 = !{!10, !12, i64 48}
!28 = !{!10, !6, i64 40}
!29 = !{!16, !6, i64 208}
!30 = !{!16, !6, i64 216}
!31 = !{!16, !12, i64 92}
!32 = !{!16, !12, i64 100}
!33 = !{!16, !11, i64 136}
!34 = !{!16, !12, i64 288}
!35 = !{!16, !12, i64 244}


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