; LLVM IR from HANDS-FREE/OpenRE :: 3_OS/STM32F1/RTOS/uCOS-II/CORE (os_core)

; 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.os_tcb = type { ptr, ptr, ptr, i32, i16, i16, ptr, ptr, ptr, ptr, ptr, i16, i32, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, ptr, i32, ptr, [1 x i32] }

@OSTCBPrioTbl = external dso_local global [64 x ptr], align 16
@OSTCBList = external dso_local global ptr, align 8
@OSRdyGrp = external dso_local global i8, align 1
@OSRdyTbl = external dso_local global [8 x i8], align 1
@OSTCBFreeList = external dso_local global ptr, align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@OSTaskCtr = external dso_local global i8, align 1

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

declare i32 @OS_CPU_SR_Save() #1

declare void @OS_CPU_SR_Restore(i32 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @OS_TCBInit(i8 noundef zeroext %0, ptr noundef %1, ptr noundef %2, i16 noundef zeroext %3, i32 noundef %4, ptr noundef %5, i16 noundef zeroext %6) #2 {
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i16, align 2
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i16, align 2
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  store i8 %0, ptr %9, align 1, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !8
  store ptr %2, ptr %11, align 8, !tbaa !8
  store i16 %3, ptr %12, align 2, !tbaa !10
  store i32 %4, ptr %13, align 4, !tbaa !12
  store ptr %5, ptr %14, align 8, !tbaa !8
  store i16 %6, ptr %15, align 2, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  store i32 0, ptr %17, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #3
  %20 = call i32 @OS_CPU_SR_Save()
  store i32 %20, ptr %17, align 4, !tbaa !12
  %21 = load ptr, ptr @OSTCBFreeList, align 8, !tbaa !8
  store ptr %21, ptr %16, align 8, !tbaa !8
  %22 = load ptr, ptr %16, align 8, !tbaa !8
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %164

24:                                               ; preds = %7
  %25 = load ptr, ptr %16, align 8, !tbaa !8
  %26 = getelementptr inbounds %struct.os_tcb, ptr %25, i32 0, i32 6
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  store ptr %27, ptr @OSTCBFreeList, align 8, !tbaa !8
  %28 = load i32, ptr %17, align 4, !tbaa !12
  call void @OS_CPU_SR_Restore(i32 noundef %28)
  %29 = load ptr, ptr %10, align 8, !tbaa !8
  %30 = load ptr, ptr %16, align 8, !tbaa !8
  %31 = getelementptr inbounds %struct.os_tcb, ptr %30, i32 0, i32 0
  store ptr %29, ptr %31, align 8, !tbaa !16
  %32 = load i8, ptr %9, align 1, !tbaa !5
  %33 = load ptr, ptr %16, align 8, !tbaa !8
  %34 = getelementptr inbounds %struct.os_tcb, ptr %33, i32 0, i32 15
  store i8 %32, ptr %34, align 2, !tbaa !17
  %35 = load ptr, ptr %16, align 8, !tbaa !8
  %36 = getelementptr inbounds %struct.os_tcb, ptr %35, i32 0, i32 13
  store i8 0, ptr %36, align 8, !tbaa !18
  %37 = load ptr, ptr %16, align 8, !tbaa !8
  %38 = getelementptr inbounds %struct.os_tcb, ptr %37, i32 0, i32 14
  store i8 0, ptr %38, align 1, !tbaa !19
  %39 = load ptr, ptr %16, align 8, !tbaa !8
  %40 = getelementptr inbounds %struct.os_tcb, ptr %39, i32 0, i32 12
  store i32 0, ptr %40, align 4, !tbaa !20
  %41 = load ptr, ptr %14, align 8, !tbaa !8
  %42 = load ptr, ptr %16, align 8, !tbaa !8
  %43 = getelementptr inbounds %struct.os_tcb, ptr %42, i32 0, i32 1
  store ptr %41, ptr %43, align 8, !tbaa !21
  %44 = load i32, ptr %13, align 4, !tbaa !12
  %45 = load ptr, ptr %16, align 8, !tbaa !8
  %46 = getelementptr inbounds %struct.os_tcb, ptr %45, i32 0, i32 3
  store i32 %44, ptr %46, align 8, !tbaa !22
  %47 = load ptr, ptr %11, align 8, !tbaa !8
  %48 = load ptr, ptr %16, align 8, !tbaa !8
  %49 = getelementptr inbounds %struct.os_tcb, ptr %48, i32 0, i32 2
  store ptr %47, ptr %49, align 8, !tbaa !23
  %50 = load i16, ptr %15, align 2, !tbaa !10
  %51 = load ptr, ptr %16, align 8, !tbaa !8
  %52 = getelementptr inbounds %struct.os_tcb, ptr %51, i32 0, i32 4
  store i16 %50, ptr %52, align 4, !tbaa !24
  %53 = load i16, ptr %12, align 2, !tbaa !10
  %54 = load ptr, ptr %16, align 8, !tbaa !8
  %55 = getelementptr inbounds %struct.os_tcb, ptr %54, i32 0, i32 5
  store i16 %53, ptr %55, align 2, !tbaa !25
  %56 = load ptr, ptr %16, align 8, !tbaa !8
  %57 = getelementptr inbounds %struct.os_tcb, ptr %56, i32 0, i32 20
  store i8 0, ptr %57, align 1, !tbaa !26
  %58 = load i8, ptr %9, align 1, !tbaa !5
  %59 = zext i8 %58 to i32
  %60 = ashr i32 %59, 3
  %61 = trunc i32 %60 to i8
  %62 = load ptr, ptr %16, align 8, !tbaa !8
  %63 = getelementptr inbounds %struct.os_tcb, ptr %62, i32 0, i32 17
  store i8 %61, ptr %63, align 4, !tbaa !27
  %64 = load i8, ptr %9, align 1, !tbaa !5
  %65 = zext i8 %64 to i32
  %66 = and i32 %65, 7
  %67 = trunc i32 %66 to i8
  %68 = load ptr, ptr %16, align 8, !tbaa !8
  %69 = getelementptr inbounds %struct.os_tcb, ptr %68, i32 0, i32 16
  store i8 %67, ptr %69, align 1, !tbaa !28
  %70 = load ptr, ptr %16, align 8, !tbaa !8
  %71 = getelementptr inbounds %struct.os_tcb, ptr %70, i32 0, i32 17
  %72 = load i8, ptr %71, align 4, !tbaa !27
  %73 = zext i8 %72 to i32
  %74 = zext i32 %73 to i64
  %75 = shl i64 1, %74
  %76 = trunc i64 %75 to i8
  %77 = load ptr, ptr %16, align 8, !tbaa !8
  %78 = getelementptr inbounds %struct.os_tcb, ptr %77, i32 0, i32 19
  store i8 %76, ptr %78, align 2, !tbaa !29
  %79 = load ptr, ptr %16, align 8, !tbaa !8
  %80 = getelementptr inbounds %struct.os_tcb, ptr %79, i32 0, i32 16
  %81 = load i8, ptr %80, align 1, !tbaa !28
  %82 = zext i8 %81 to i32
  %83 = zext i32 %82 to i64
  %84 = shl i64 1, %83
  %85 = trunc i64 %84 to i8
  %86 = load ptr, ptr %16, align 8, !tbaa !8
  %87 = getelementptr inbounds %struct.os_tcb, ptr %86, i32 0, i32 18
  store i8 %85, ptr %87, align 1, !tbaa !30
  %88 = load ptr, ptr %16, align 8, !tbaa !8
  %89 = getelementptr inbounds %struct.os_tcb, ptr %88, i32 0, i32 8
  store ptr null, ptr %89, align 8, !tbaa !31
  %90 = load ptr, ptr %16, align 8, !tbaa !8
  %91 = getelementptr inbounds %struct.os_tcb, ptr %90, i32 0, i32 10
  store ptr null, ptr %91, align 8, !tbaa !32
  %92 = load ptr, ptr %16, align 8, !tbaa !8
  %93 = getelementptr inbounds %struct.os_tcb, ptr %92, i32 0, i32 9
  store ptr null, ptr %93, align 8, !tbaa !33
  %94 = load ptr, ptr %16, align 8, !tbaa !8
  %95 = getelementptr inbounds %struct.os_tcb, ptr %94, i32 0, i32 21
  store i32 0, ptr %95, align 8, !tbaa !34
  %96 = load ptr, ptr %16, align 8, !tbaa !8
  %97 = getelementptr inbounds %struct.os_tcb, ptr %96, i32 0, i32 23
  store i32 0, ptr %97, align 8, !tbaa !35
  %98 = load ptr, ptr %16, align 8, !tbaa !8
  %99 = getelementptr inbounds %struct.os_tcb, ptr %98, i32 0, i32 22
  store i32 0, ptr %99, align 4, !tbaa !36
  %100 = load ptr, ptr %16, align 8, !tbaa !8
  %101 = getelementptr inbounds %struct.os_tcb, ptr %100, i32 0, i32 24
  store ptr null, ptr %101, align 8, !tbaa !37
  %102 = load ptr, ptr %16, align 8, !tbaa !8
  %103 = getelementptr inbounds %struct.os_tcb, ptr %102, i32 0, i32 25
  store i32 0, ptr %103, align 8, !tbaa !38
  %104 = load ptr, ptr %16, align 8, !tbaa !8
  %105 = getelementptr inbounds %struct.os_tcb, ptr %104, i32 0, i32 26
  store ptr @.str, ptr %105, align 8, !tbaa !39
  store i8 0, ptr %18, align 1, !tbaa !5
  br label %106

106:                                              ; preds = %116, %24
  %107 = load i8, ptr %18, align 1, !tbaa !5
  %108 = zext i8 %107 to i32
  %109 = icmp ult i32 %108, 1
  br i1 %109, label %110, label %119

110:                                              ; preds = %106
  %111 = load ptr, ptr %16, align 8, !tbaa !8
  %112 = getelementptr inbounds %struct.os_tcb, ptr %111, i32 0, i32 27
  %113 = load i8, ptr %18, align 1, !tbaa !5
  %114 = zext i8 %113 to i64
  %115 = getelementptr inbounds [1 x i32], ptr %112, i64 0, i64 %114
  store i32 0, ptr %115, align 4, !tbaa !12
  br label %116

116:                                              ; preds = %110
  %117 = load i8, ptr %18, align 1, !tbaa !5
  %118 = add i8 %117, 1
  store i8 %118, ptr %18, align 1, !tbaa !5
  br label %106, !llvm.loop !40

119:                                              ; preds = %106
  %120 = load ptr, ptr %16, align 8, !tbaa !8
  call void @OSTCBInitHook(ptr noundef %120)
  %121 = load ptr, ptr %16, align 8, !tbaa !8
  call void @OSTaskCreateHook(ptr noundef %121)
  %122 = call i32 @OS_CPU_SR_Save()
  store i32 %122, ptr %17, align 4, !tbaa !12
  %123 = load ptr, ptr %16, align 8, !tbaa !8
  %124 = load i8, ptr %9, align 1, !tbaa !5
  %125 = zext i8 %124 to i64
  %126 = getelementptr inbounds [64 x ptr], ptr @OSTCBPrioTbl, i64 0, i64 %125
  store ptr %123, ptr %126, align 8, !tbaa !8
  %127 = load ptr, ptr @OSTCBList, align 8, !tbaa !8
  %128 = load ptr, ptr %16, align 8, !tbaa !8
  %129 = getelementptr inbounds %struct.os_tcb, ptr %128, i32 0, i32 6
  store ptr %127, ptr %129, align 8, !tbaa !14
  %130 = load ptr, ptr %16, align 8, !tbaa !8
  %131 = getelementptr inbounds %struct.os_tcb, ptr %130, i32 0, i32 7
  store ptr null, ptr %131, align 8, !tbaa !42
  %132 = load ptr, ptr @OSTCBList, align 8, !tbaa !8
  %133 = icmp ne ptr %132, null
  br i1 %133, label %134, label %138

134:                                              ; preds = %119
  %135 = load ptr, ptr %16, align 8, !tbaa !8
  %136 = load ptr, ptr @OSTCBList, align 8, !tbaa !8
  %137 = getelementptr inbounds %struct.os_tcb, ptr %136, i32 0, i32 7
  store ptr %135, ptr %137, align 8, !tbaa !42
  br label %138

138:                                              ; preds = %134, %119
  %139 = load ptr, ptr %16, align 8, !tbaa !8
  store ptr %139, ptr @OSTCBList, align 8, !tbaa !8
  %140 = load ptr, ptr %16, align 8, !tbaa !8
  %141 = getelementptr inbounds %struct.os_tcb, ptr %140, i32 0, i32 19
  %142 = load i8, ptr %141, align 2, !tbaa !29
  %143 = zext i8 %142 to i32
  %144 = load i8, ptr @OSRdyGrp, align 1, !tbaa !5
  %145 = zext i8 %144 to i32
  %146 = or i32 %145, %143
  %147 = trunc i32 %146 to i8
  store i8 %147, ptr @OSRdyGrp, align 1, !tbaa !5
  %148 = load ptr, ptr %16, align 8, !tbaa !8
  %149 = getelementptr inbounds %struct.os_tcb, ptr %148, i32 0, i32 18
  %150 = load i8, ptr %149, align 1, !tbaa !30
  %151 = zext i8 %150 to i32
  %152 = load ptr, ptr %16, align 8, !tbaa !8
  %153 = getelementptr inbounds %struct.os_tcb, ptr %152, i32 0, i32 17
  %154 = load i8, ptr %153, align 4, !tbaa !27
  %155 = zext i8 %154 to i64
  %156 = getelementptr inbounds [8 x i8], ptr @OSRdyTbl, i64 0, i64 %155
  %157 = load i8, ptr %156, align 1, !tbaa !5
  %158 = zext i8 %157 to i32
  %159 = or i32 %158, %151
  %160 = trunc i32 %159 to i8
  store i8 %160, ptr %156, align 1, !tbaa !5
  %161 = load i8, ptr @OSTaskCtr, align 1, !tbaa !5
  %162 = add i8 %161, 1
  store i8 %162, ptr @OSTaskCtr, align 1, !tbaa !5
  %163 = load i32, ptr %17, align 4, !tbaa !12
  call void @OS_CPU_SR_Restore(i32 noundef %163)
  store i8 0, ptr %8, align 1
  store i32 1, ptr %19, align 4
  br label %166

164:                                              ; preds = %7
  %165 = load i32, ptr %17, align 4, !tbaa !12
  call void @OS_CPU_SR_Restore(i32 noundef %165)
  store i8 66, ptr %8, align 1
  store i32 1, ptr %19, align 4
  br label %166

166:                                              ; preds = %164, %138
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  %167 = load i8, ptr %8, align 1
  ret i8 %167
}

declare void @OSTCBInitHook(ptr noundef) #1

declare void @OSTaskCreateHook(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = !{!15, !9, i64 32}
!15 = !{!"os_tcb", !9, i64 0, !9, i64 8, !9, i64 16, !13, i64 24, !11, i64 28, !11, i64 30, !9, i64 32, !9, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !11, i64 72, !13, i64 76, !6, i64 80, !6, i64 81, !6, i64 82, !6, i64 83, !6, i64 84, !6, i64 85, !6, i64 86, !6, i64 87, !13, i64 88, !13, i64 92, !13, i64 96, !9, i64 104, !13, i64 112, !9, i64 120, !6, i64 128}
!16 = !{!15, !9, i64 0}
!17 = !{!15, !6, i64 82}
!18 = !{!15, !6, i64 80}
!19 = !{!15, !6, i64 81}
!20 = !{!15, !13, i64 76}
!21 = !{!15, !9, i64 8}
!22 = !{!15, !13, i64 24}
!23 = !{!15, !9, i64 16}
!24 = !{!15, !11, i64 28}
!25 = !{!15, !11, i64 30}
!26 = !{!15, !6, i64 87}
!27 = !{!15, !6, i64 84}
!28 = !{!15, !6, i64 83}
!29 = !{!15, !6, i64 86}
!30 = !{!15, !6, i64 85}
!31 = !{!15, !9, i64 48}
!32 = !{!15, !9, i64 64}
!33 = !{!15, !9, i64 56}
!34 = !{!15, !13, i64 88}
!35 = !{!15, !13, i64 96}
!36 = !{!15, !13, i64 92}
!37 = !{!15, !9, i64 104}
!38 = !{!15, !13, i64 112}
!39 = !{!15, !9, i64 120}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}
!42 = !{!15, !9, i64 40}


; 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"

@OSTCBPrioTbl = external dso_local local_unnamed_addr global [64 x ptr], align 16
@OSTCBList = external dso_local local_unnamed_addr global ptr, align 8
@OSRdyGrp = external dso_local local_unnamed_addr global i8, align 1
@OSRdyTbl = external dso_local local_unnamed_addr global [8 x i8], align 1
@OSTCBFreeList = external dso_local local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@OSTaskCtr = external dso_local local_unnamed_addr global i8, align 1

declare i32 @OS_CPU_SR_Save() local_unnamed_addr #0

declare void @OS_CPU_SR_Restore(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 67) i8 @OS_TCBInit(i8 noundef zeroext %0, ptr noundef %1, ptr noundef %2, i16 noundef zeroext %3, i32 noundef %4, ptr noundef %5, i16 noundef zeroext %6) local_unnamed_addr #1 {
  %8 = tail call i32 @OS_CPU_SR_Save() #3
  %9 = load ptr, ptr @OSTCBFreeList, align 8, !tbaa !5
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %60, label %10

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %9, i64 32
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  store ptr %12, ptr @OSTCBFreeList, align 8, !tbaa !5
  tail call void @OS_CPU_SR_Restore(i32 noundef %8) #3
  store ptr %1, ptr %9, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %9, i64 82
  store i8 %0, ptr %13, align 2, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %9, i64 80
  store i8 0, ptr %14, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %9, i64 81
  store i8 0, ptr %15, align 1, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %9, i64 76
  store i32 0, ptr %16, align 4, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr %5, ptr %17, align 8, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %9, i64 24
  store i32 %4, ptr %18, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %9, i64 16
  store ptr %2, ptr %19, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %9, i64 28
  store i16 %6, ptr %20, align 4, !tbaa !21
  %21 = getelementptr inbounds i8, ptr %9, i64 30
  store i16 %3, ptr %21, align 2, !tbaa !22
  %22 = getelementptr inbounds i8, ptr %9, i64 87
  store i8 0, ptr %22, align 1, !tbaa !23
  %23 = lshr i8 %0, 3
  %24 = getelementptr inbounds i8, ptr %9, i64 84
  store i8 %23, ptr %24, align 4, !tbaa !24
  %25 = and i8 %0, 7
  %26 = getelementptr inbounds i8, ptr %9, i64 83
  store i8 %25, ptr %26, align 1, !tbaa !25
  %27 = zext nneg i8 %23 to i32
  %28 = shl nuw i32 1, %27
  %29 = trunc i32 %28 to i8
  %30 = getelementptr inbounds i8, ptr %9, i64 86
  store i8 %29, ptr %30, align 2, !tbaa !26
  %31 = shl nuw i8 1, %25
  %32 = getelementptr inbounds i8, ptr %9, i64 85
  store i8 %31, ptr %32, align 1, !tbaa !27
  %33 = getelementptr inbounds i8, ptr %9, i64 48
  %34 = getelementptr inbounds i8, ptr %9, i64 88
  store i32 0, ptr %34, align 8, !tbaa !28
  %35 = getelementptr inbounds i8, ptr %9, i64 96
  store i32 0, ptr %35, align 8, !tbaa !29
  %36 = getelementptr inbounds i8, ptr %9, i64 92
  store i32 0, ptr %36, align 4, !tbaa !30
  %37 = getelementptr inbounds i8, ptr %9, i64 104
  store ptr null, ptr %37, align 8, !tbaa !31
  %38 = getelementptr inbounds i8, ptr %9, i64 112
  store i32 0, ptr %38, align 8, !tbaa !32
  %39 = getelementptr inbounds i8, ptr %9, i64 120
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %33, i8 0, i64 24, i1 false)
  store ptr @.str, ptr %39, align 8, !tbaa !33
  %40 = getelementptr inbounds i8, ptr %9, i64 128
  store i32 0, ptr %40, align 4, !tbaa !34
  tail call void @OSTCBInitHook(ptr noundef nonnull %9) #3
  tail call void @OSTaskCreateHook(ptr noundef nonnull %9) #3
  %41 = tail call i32 @OS_CPU_SR_Save() #3
  %42 = zext i8 %0 to i64
  %43 = getelementptr inbounds [64 x ptr], ptr @OSTCBPrioTbl, i64 0, i64 %42
  store ptr %9, ptr %43, align 8, !tbaa !5
  %44 = load ptr, ptr @OSTCBList, align 8, !tbaa !5
  store ptr %44, ptr %11, align 8, !tbaa !9
  %45 = getelementptr inbounds i8, ptr %9, i64 40
  store ptr null, ptr %45, align 8, !tbaa !35
  %.not58 = icmp eq ptr %44, null
  br i1 %.not58, label %48, label %46

46:                                               ; preds = %10
  %47 = getelementptr inbounds i8, ptr %44, i64 40
  store ptr %9, ptr %47, align 8, !tbaa !35
  br label %48

48:                                               ; preds = %46, %10
  store ptr %9, ptr @OSTCBList, align 8, !tbaa !5
  %49 = load i8, ptr %30, align 2, !tbaa !26
  %50 = load i8, ptr @OSRdyGrp, align 1, !tbaa !36
  %51 = or i8 %50, %49
  store i8 %51, ptr @OSRdyGrp, align 1, !tbaa !36
  %52 = load i8, ptr %32, align 1, !tbaa !27
  %53 = load i8, ptr %24, align 4, !tbaa !24
  %54 = zext i8 %53 to i64
  %55 = getelementptr inbounds [8 x i8], ptr @OSRdyTbl, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !36
  %57 = or i8 %56, %52
  store i8 %57, ptr %55, align 1, !tbaa !36
  %58 = load i8, ptr @OSTaskCtr, align 1, !tbaa !36
  %59 = add i8 %58, 1
  store i8 %59, ptr @OSTaskCtr, align 1, !tbaa !36
  br label %60

60:                                               ; preds = %7, %48
  %.sink = phi i32 [ %41, %48 ], [ %8, %7 ]
  %.055 = phi i8 [ 0, %48 ], [ 66, %7 ]
  tail call void @OS_CPU_SR_Restore(i32 noundef %.sink) #3
  ret i8 %.055
}

declare void @OSTCBInitHook(ptr noundef) local_unnamed_addr #0

declare void @OSTaskCreateHook(ptr noundef) local_unnamed_addr #0

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

attributes #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 nounwind willreturn memory(argmem: write) }
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, !6, i64 32}
!10 = !{!"os_tcb", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !12, i64 28, !12, i64 30, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !12, i64 72, !11, i64 76, !7, i64 80, !7, i64 81, !7, i64 82, !7, i64 83, !7, i64 84, !7, i64 85, !7, i64 86, !7, i64 87, !11, i64 88, !11, i64 92, !11, i64 96, !6, i64 104, !11, i64 112, !6, i64 120, !7, i64 128}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!10, !6, i64 0}
!14 = !{!10, !7, i64 82}
!15 = !{!10, !7, i64 80}
!16 = !{!10, !7, i64 81}
!17 = !{!10, !11, i64 76}
!18 = !{!10, !6, i64 8}
!19 = !{!10, !11, i64 24}
!20 = !{!10, !6, i64 16}
!21 = !{!10, !12, i64 28}
!22 = !{!10, !12, i64 30}
!23 = !{!10, !7, i64 87}
!24 = !{!10, !7, i64 84}
!25 = !{!10, !7, i64 83}
!26 = !{!10, !7, i64 86}
!27 = !{!10, !7, i64 85}
!28 = !{!10, !11, i64 88}
!29 = !{!10, !11, i64 96}
!30 = !{!10, !11, i64 92}
!31 = !{!10, !6, i64 104}
!32 = !{!10, !11, i64 112}
!33 = !{!10, !6, i64 120}
!34 = !{!11, !11, i64 0}
!35 = !{!10, !6, i64 40}
!36 = !{!7, !7, i64 0}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass