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

; 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_created_count = external global i64, align 8
@_tx_thread_created_ptr = external global ptr, align 8
@_tx_thread_preempt_disable = external global i32, align 4
@_tx_thread_system_state = external global i64, align 8
@_tx_thread_execute_ptr = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @_tx_thread_create(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, i64 noundef %5, i32 noundef %6, i32 noundef %7, i64 noundef %8, i32 noundef %9) #0 {
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %2, ptr %13, align 8, !tbaa !5
  store i64 %3, ptr %14, align 8, !tbaa !9
  store ptr %4, ptr %15, align 8, !tbaa !5
  store i64 %5, ptr %16, align 8, !tbaa !9
  store i32 %6, ptr %17, align 4, !tbaa !11
  store i32 %7, ptr %18, align 4, !tbaa !11
  store i64 %8, ptr %19, align 8, !tbaa !9
  store i32 %9, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  store i32 0, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %27 = load ptr, ptr %15, align 8, !tbaa !5
  %28 = load i64, ptr %16, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 1 %27, i8 -17, i64 %28, i1 false)
  %29 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %29, i8 0, i64 328, i1 false)
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = load ptr, ptr %11, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %31, i32 0, i32 10
  store ptr %30, ptr %32, align 8, !tbaa !13
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %34, i32 0, i32 17
  store ptr %33, ptr %35, align 8, !tbaa !16
  %36 = load i64, ptr %14, align 8, !tbaa !9
  %37 = load ptr, ptr %11, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %37, i32 0, i32 18
  store i64 %36, ptr %38, align 8, !tbaa !17
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %40, i32 0, i32 3
  store ptr %39, ptr %41, align 8, !tbaa !18
  %42 = load i64, ptr %16, align 8, !tbaa !9
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %43, i32 0, i32 5
  store i64 %42, ptr %44, align 8, !tbaa !19
  %45 = load i32, ptr %17, align 4, !tbaa !11
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %46, i32 0, i32 11
  store i32 %45, ptr %47, align 8, !tbaa !20
  %48 = load i32, ptr %17, align 4, !tbaa !11
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %49, i32 0, i32 32
  store i32 %48, ptr %50, align 8, !tbaa !21
  %51 = load i64, ptr %19, align 8, !tbaa !9
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %52, i32 0, i32 6
  store i64 %51, ptr %53, align 8, !tbaa !22
  %54 = load i64, ptr %19, align 8, !tbaa !9
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %55, i32 0, i32 7
  store i64 %54, ptr %56, align 8, !tbaa !23
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %57, i32 0, i32 34
  store i32 32, ptr %58, align 8, !tbaa !24
  %59 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %59, ptr %26, align 8, !tbaa !5
  %60 = load ptr, ptr %26, align 8, !tbaa !5
  %61 = load i64, ptr %16, align 8, !tbaa !9
  %62 = sub i64 %61, 1
  %63 = trunc i64 %62 to i32
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds i8, ptr %60, i64 %64
  store ptr %65, ptr %26, align 8, !tbaa !5
  %66 = load ptr, ptr %26, align 8, !tbaa !5
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %67, i32 0, i32 4
  store ptr %66, ptr %68, align 8, !tbaa !25
  %69 = load i32, ptr %18, align 4, !tbaa !11
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %70, i32 0, i32 15
  store i32 %69, ptr %71, align 8, !tbaa !26
  %72 = load i32, ptr %18, align 4, !tbaa !11
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %73, i32 0, i32 33
  store i32 %72, ptr %74, align 4, !tbaa !27
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %75, i32 0, i32 12
  store i32 3, ptr %76, align 4, !tbaa !28
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %77, i32 0, i32 19
  %79 = getelementptr inbounds %struct.TX_TIMER_INTERNAL_STRUCT, ptr %78, i32 0, i32 2
  store ptr @_tx_thread_timeout, ptr %79, align 8, !tbaa !29
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = ptrtoint ptr %80 to i64
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %82, i32 0, i32 19
  %84 = getelementptr inbounds %struct.TX_TIMER_INTERNAL_STRUCT, ptr %83, i32 0, i32 3
  store i64 %81, ptr %84, align 8, !tbaa !30
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_tx_thread_stack_build(ptr noundef %85, ptr noundef @_tx_thread_shell_entry)
  %86 = call i32 @__disable_interrupts()
  store i32 %86, ptr %21, align 4, !tbaa !11
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %87, i32 0, i32 0
  store i64 1414025796, ptr %88, align 8, !tbaa !31
  %89 = load i64, ptr @_tx_thread_created_count, align 8, !tbaa !9
  %90 = icmp eq i64 %89, 0
  br i1 %90, label %91, label %99

91:                                               ; preds = %10
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %92, ptr @_tx_thread_created_ptr, align 8, !tbaa !5
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = load ptr, ptr %11, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %94, i32 0, i32 28
  store ptr %93, ptr %95, align 8, !tbaa !32
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %97, i32 0, i32 29
  store ptr %96, ptr %98, align 8, !tbaa !33
  br label %116

99:                                               ; preds = %10
  %100 = load ptr, ptr @_tx_thread_created_ptr, align 8, !tbaa !5
  store ptr %100, ptr %22, align 8, !tbaa !5
  %101 = load ptr, ptr %22, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %101, i32 0, i32 29
  %103 = load ptr, ptr %102, align 8, !tbaa !33
  store ptr %103, ptr %23, align 8, !tbaa !5
  %104 = load ptr, ptr %11, align 8, !tbaa !5
  %105 = load ptr, ptr %22, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %105, i32 0, i32 29
  store ptr %104, ptr %106, align 8, !tbaa !33
  %107 = load ptr, ptr %11, align 8, !tbaa !5
  %108 = load ptr, ptr %23, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %108, i32 0, i32 28
  store ptr %107, ptr %109, align 8, !tbaa !32
  %110 = load ptr, ptr %23, align 8, !tbaa !5
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %111, i32 0, i32 29
  store ptr %110, ptr %112, align 8, !tbaa !33
  %113 = load ptr, ptr %22, align 8, !tbaa !5
  %114 = load ptr, ptr %11, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %114, i32 0, i32 28
  store ptr %113, ptr %115, align 8, !tbaa !32
  br label %116

116:                                              ; preds = %99, %91
  %117 = load i64, ptr @_tx_thread_created_count, align 8, !tbaa !9
  %118 = add i64 %117, 1
  store i64 %118, ptr @_tx_thread_created_count, align 8, !tbaa !9
  %119 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !11
  %120 = add i32 %119, 1
  store volatile i32 %120, ptr @_tx_thread_preempt_disable, align 4, !tbaa !11
  %121 = load i32, ptr %20, align 4, !tbaa !11
  %122 = icmp eq i32 %121, 1
  br i1 %122, label %123, label %154

123:                                              ; preds = %116
  %124 = load volatile i64, ptr @_tx_thread_system_state, align 8, !tbaa !9
  %125 = call i32 @_tx_ipsr_get()
  %126 = zext i32 %125 to i64
  %127 = or i64 %124, %126
  %128 = icmp uge i64 %127, 4042322160
  br i1 %128, label %129, label %143

129:                                              ; preds = %123
  %130 = load ptr, ptr @_tx_thread_execute_ptr, align 8, !tbaa !5
  store ptr %130, ptr %24, align 8, !tbaa !5
  %131 = load ptr, ptr %24, align 8, !tbaa !5
  %132 = icmp ne ptr %131, null
  br i1 %132, label %133, label %142

133:                                              ; preds = %129
  %134 = load ptr, ptr %24, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %134, i32 0, i32 15
  %136 = load i32, ptr %135, align 8, !tbaa !26
  store i32 %136, ptr %25, align 4, !tbaa !11
  %137 = load ptr, ptr %24, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %137, i32 0, i32 11
  %139 = load i32, ptr %138, align 8, !tbaa !20
  %140 = load ptr, ptr %24, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %140, i32 0, i32 15
  store i32 %139, ptr %141, align 8, !tbaa !26
  br label %142

142:                                              ; preds = %133, %129
  br label %144

143:                                              ; preds = %123
  store ptr null, ptr %24, align 8, !tbaa !5
  br label %144

144:                                              ; preds = %143, %142
  %145 = load i32, ptr %21, align 4, !tbaa !11
  call void @__restore_interrupt(i32 noundef %145)
  %146 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_tx_thread_system_resume(ptr noundef %146)
  %147 = load ptr, ptr %24, align 8, !tbaa !5
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %153

149:                                              ; preds = %144
  %150 = load i32, ptr %25, align 4, !tbaa !11
  %151 = load ptr, ptr %24, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.TX_THREAD_STRUCT, ptr %151, i32 0, i32 15
  store i32 %150, ptr %152, align 8, !tbaa !26
  br label %153

153:                                              ; preds = %149, %144
  br label %160

154:                                              ; preds = %116
  %155 = load i32, ptr %21, align 4, !tbaa !11
  call void @__restore_interrupt(i32 noundef %155)
  %156 = call i32 @__disable_interrupts()
  store i32 %156, ptr %21, align 4, !tbaa !11
  %157 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !11
  %158 = add i32 %157, -1
  store volatile i32 %158, ptr @_tx_thread_preempt_disable, align 4, !tbaa !11
  %159 = load i32, ptr %21, align 4, !tbaa !11
  call void @__restore_interrupt(i32 noundef %159)
  call void @_tx_thread_system_preempt_check()
  br label %160

160:                                              ; preds = %154, %153
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  ret i32 0
}

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

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

declare void @_tx_thread_timeout(i64 noundef) #3

declare void @_tx_thread_stack_build(ptr noundef, ptr noundef) #3

declare void @_tx_thread_shell_entry() #3

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @_tx_ipsr_get() #4

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 80}
!14 = !{!"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, !15, 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}
!15 = !{!"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}
!16 = !{!14, !6, i64 120}
!17 = !{!14, !10, i64 128}
!18 = !{!14, !6, i64 24}
!19 = !{!14, !10, i64 40}
!20 = !{!14, !12, i64 88}
!21 = !{!14, !12, i64 280}
!22 = !{!14, !10, i64 48}
!23 = !{!14, !10, i64 56}
!24 = !{!14, !12, i64 288}
!25 = !{!14, !6, i64 32}
!26 = !{!14, !12, i64 104}
!27 = !{!14, !12, i64 284}
!28 = !{!14, !12, i64 92}
!29 = !{!14, !6, i64 152}
!30 = !{!14, !10, i64 160}
!31 = !{!14, !10, i64 0}
!32 = !{!14, !6, i64 248}
!33 = !{!14, !6, i64 256}


; 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_created_count = external local_unnamed_addr global i64, align 8
@_tx_thread_created_ptr = external local_unnamed_addr global ptr, align 8
@_tx_thread_preempt_disable = external global i32, align 4
@_tx_thread_system_state = external global i64, align 8
@_tx_thread_execute_ptr = external local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @_tx_thread_create(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, i64 noundef %5, i32 noundef %6, i32 noundef %7, i64 noundef %8, i32 noundef %9) local_unnamed_addr #0 {
  tail call void @llvm.memset.p0.i64(ptr align 1 %4, i8 -17, i64 %5, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(328) %0, i8 0, i64 328, i1 false)
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  store ptr %1, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 120
  store ptr %2, ptr %12, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %0, i64 128
  store i64 %3, ptr %13, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %4, ptr %14, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  store i64 %5, ptr %15, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 %6, ptr %16, align 8, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %0, i64 280
  store i32 %6, ptr %17, align 8, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %0, i64 48
  store i64 %8, ptr %18, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %0, i64 56
  store i64 %8, ptr %19, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %0, i64 288
  store i32 32, ptr %20, align 8, !tbaa !21
  %21 = add i64 %5, 4294967295
  %22 = and i64 %21, 4294967295
  %23 = getelementptr inbounds i8, ptr %4, i64 %22
  %24 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %23, ptr %24, align 8, !tbaa !22
  %25 = getelementptr inbounds i8, ptr %0, i64 104
  store i32 %7, ptr %25, align 8, !tbaa !23
  %26 = getelementptr inbounds i8, ptr %0, i64 284
  store i32 %7, ptr %26, align 4, !tbaa !24
  %27 = getelementptr inbounds i8, ptr %0, i64 92
  store i32 3, ptr %27, align 4, !tbaa !25
  %28 = getelementptr inbounds i8, ptr %0, i64 152
  store ptr @_tx_thread_timeout, ptr %28, align 8, !tbaa !26
  %29 = ptrtoint ptr %0 to i64
  %30 = getelementptr inbounds i8, ptr %0, i64 160
  store i64 %29, ptr %30, align 8, !tbaa !27
  tail call void @_tx_thread_stack_build(ptr noundef %0, ptr noundef nonnull @_tx_thread_shell_entry) #4
  %31 = tail call i32 @__disable_interrupts()
  store i64 1414025796, ptr %0, align 8, !tbaa !28
  %32 = load i64, ptr @_tx_thread_created_count, align 8, !tbaa !29
  %33 = icmp eq i64 %32, 0
  br i1 %33, label %39, label %34

34:                                               ; preds = %10
  %35 = load ptr, ptr @_tx_thread_created_ptr, align 8, !tbaa !30
  %36 = getelementptr inbounds i8, ptr %35, i64 256
  %37 = load ptr, ptr %36, align 8, !tbaa !31
  store ptr %0, ptr %36, align 8, !tbaa !31
  %38 = getelementptr inbounds i8, ptr %37, i64 248
  br label %39

39:                                               ; preds = %10, %34
  %.sink66 = phi ptr [ %38, %34 ], [ @_tx_thread_created_ptr, %10 ]
  %.sink65 = phi ptr [ %35, %34 ], [ %0, %10 ]
  %.sink = phi ptr [ %37, %34 ], [ %0, %10 ]
  store ptr %0, ptr %.sink66, align 8, !tbaa !30
  %40 = getelementptr inbounds i8, ptr %0, i64 248
  store ptr %.sink65, ptr %40, align 8
  %41 = getelementptr inbounds i8, ptr %0, i64 256
  store ptr %.sink, ptr %41, align 8
  %42 = add i64 %32, 1
  store i64 %42, ptr @_tx_thread_created_count, align 8, !tbaa !29
  %43 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !32
  %44 = add i32 %43, 1
  store volatile i32 %44, ptr @_tx_thread_preempt_disable, align 4, !tbaa !32
  %45 = icmp eq i32 %9, 1
  br i1 %45, label %46, label %62

46:                                               ; preds = %39
  %47 = load volatile i64, ptr @_tx_thread_system_state, align 8, !tbaa !29
  %48 = tail call i32 @_tx_ipsr_get()
  %49 = zext i32 %48 to i64
  %50 = or i64 %47, %49
  %51 = icmp ugt i64 %50, 4042322159
  br i1 %51, label %52, label %59

52:                                               ; preds = %46
  %53 = load ptr, ptr @_tx_thread_execute_ptr, align 8, !tbaa !30
  %.not = icmp eq ptr %53, null
  br i1 %.not, label %59, label %54

54:                                               ; preds = %52
  %55 = getelementptr inbounds i8, ptr %53, i64 104
  %56 = load i32, ptr %55, align 8, !tbaa !23
  %57 = getelementptr inbounds i8, ptr %53, i64 88
  %58 = load i32, ptr %57, align 8, !tbaa !17
  store i32 %58, ptr %55, align 8, !tbaa !23
  br label %59

59:                                               ; preds = %46, %52, %54
  %.062 = phi ptr [ %53, %54 ], [ null, %52 ], [ null, %46 ]
  %.0 = phi i32 [ %56, %54 ], [ 0, %52 ], [ 0, %46 ]
  tail call void @__restore_interrupt(i32 noundef %31)
  tail call void @_tx_thread_system_resume(ptr noundef nonnull %0) #4
  %.not64 = icmp eq ptr %.062, null
  br i1 %.not64, label %66, label %60

60:                                               ; preds = %59
  %61 = getelementptr inbounds i8, ptr %.062, i64 104
  store i32 %.0, ptr %61, align 8, !tbaa !23
  br label %66

62:                                               ; preds = %39
  tail call void @__restore_interrupt(i32 noundef %31)
  %63 = tail call i32 @__disable_interrupts()
  %64 = load volatile i32, ptr @_tx_thread_preempt_disable, align 4, !tbaa !32
  %65 = add i32 %64, -1
  store volatile i32 %65, ptr @_tx_thread_preempt_disable, align 4, !tbaa !32
  tail call void @__restore_interrupt(i32 noundef %63)
  tail call void @_tx_thread_system_preempt_check() #4
  br label %66

66:                                               ; preds = %59, %60, %62
  ret i32 0
}

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

declare void @_tx_thread_timeout(i64 noundef) #2

declare void @_tx_thread_stack_build(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @_tx_thread_shell_entry() #2

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @_tx_ipsr_get() local_unnamed_addr #3

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #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, !10, i64 80}
!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, !10, i64 120}
!14 = !{!6, !7, i64 128}
!15 = !{!6, !10, i64 24}
!16 = !{!6, !7, i64 40}
!17 = !{!6, !11, i64 88}
!18 = !{!6, !11, i64 280}
!19 = !{!6, !7, i64 48}
!20 = !{!6, !7, i64 56}
!21 = !{!6, !11, i64 288}
!22 = !{!6, !10, i64 32}
!23 = !{!6, !11, i64 104}
!24 = !{!6, !11, i64 284}
!25 = !{!6, !11, i64 92}
!26 = !{!6, !10, i64 152}
!27 = !{!6, !7, i64 160}
!28 = !{!6, !7, i64 0}
!29 = !{!7, !7, i64 0}
!30 = !{!10, !10, i64 0}
!31 = !{!6, !10, i64 256}
!32 = !{!11, !11, i64 0}


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