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

; 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 }
%struct.FX_MEDIA_STRUCT = type { i64, ptr, ptr, i64, i32, i64, ptr, ptr, i64, i64, i32, i32, i32, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i64, i64, i32, i64, i64, ptr, i32, i32, ptr, i64, i64, i64, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i64, ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, %struct.TX_MUTEX_STRUCT, i32, %struct.FX_DIR_ENTRY_STRUCT, %struct.FX_DIR_ENTRY_STRUCT, [256 x i8], [256 x i8], %struct.FX_PATH_STRUCT, [16 x %struct.FX_FAT_CACHE_ENTRY_STRUCT], [128 x i8], i64, [1024 x i8], [256 x %struct.FX_CACHED_SECTOR_STRUCT], i64, i64, i64, i64, i8 }
%struct.TX_MUTEX_STRUCT = type { i64, ptr, i32, ptr, i32, i32, ptr, i32, ptr, ptr, i32, ptr, ptr }
%struct.FX_DIR_ENTRY_STRUCT = type { ptr, [13 x i8], i32, i32, i8, i8, i8, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%struct.FX_PATH_STRUCT = type { %struct.FX_DIR_ENTRY_STRUCT, [256 x i8], [256 x i8], i64 }
%struct.FX_FAT_CACHE_ENTRY_STRUCT = type { i64, i64, i64 }
%struct.FX_CACHED_SECTOR_STRUCT = type { ptr, i64, i8, i8, i8, i8, ptr }

@_tx_thread_system_state = external global i64, align 8
@_tx_thread_current_ptr = external global ptr, align 8
@_tx_timer_thread = external global %struct.TX_THREAD_STRUCT, align 8
@_fx_system_media_max_sector_cache = external global i64, align 8
@_fx_system_media_max_fat_cache = external global i64, align 8
@_fx_system_media_opened_ptr = external global ptr, align 8
@_fx_system_media_opened_count = external global i64, align 8

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

25:                                               ; preds = %7
  %26 = load ptr, ptr %11, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %35, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %35, label %31

31:                                               ; preds = %28
  %32 = load i32, ptr %15, align 4, !tbaa !11
  %33 = zext i32 %32 to i64
  %34 = icmp ne i64 %33, 12144
  br i1 %34, label %35, label %36

35:                                               ; preds = %31, %28, %25, %7
  store i32 24, ptr %8, align 4
  store i32 1, ptr %22, align 4
  br label %111

36:                                               ; preds = %31
  %37 = load volatile i64, ptr @_tx_thread_system_state, align 8, !tbaa !9
  %38 = call i32 @_tx_ipsr_get()
  %39 = zext i32 %38 to i64
  %40 = or i64 %37, %39
  %41 = icmp ne i64 %40, 0
  br i1 %41, label %48, label %42

42:                                               ; preds = %36
  %43 = load ptr, ptr @_tx_thread_current_ptr, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %48, label %45

45:                                               ; preds = %42
  %46 = load ptr, ptr @_tx_thread_current_ptr, align 8, !tbaa !5
  %47 = icmp eq ptr %46, @_tx_timer_thread
  br i1 %47, label %48, label %49

48:                                               ; preds = %45, %42, %36
  store i32 32, ptr %8, align 4
  store i32 1, ptr %22, align 4
  br label %111

49:                                               ; preds = %45
  %50 = load i64, ptr @_fx_system_media_max_sector_cache, align 8, !tbaa !9
  store i64 %50, ptr %17, align 8, !tbaa !9
  %51 = load i64, ptr %17, align 8, !tbaa !9
  %52 = load i64, ptr %17, align 8, !tbaa !9
  %53 = xor i64 %52, -1
  %54 = add i64 %53, 1
  %55 = and i64 %51, %54
  store i64 %55, ptr %17, align 8, !tbaa !9
  %56 = load i64, ptr %17, align 8, !tbaa !9
  %57 = icmp eq i64 %56, 1
  br i1 %57, label %62, label %58

58:                                               ; preds = %49
  %59 = load i64, ptr %17, align 8, !tbaa !9
  %60 = load i64, ptr @_fx_system_media_max_sector_cache, align 8, !tbaa !9
  %61 = icmp ne i64 %59, %60
  br i1 %61, label %62, label %63

62:                                               ; preds = %58, %49
  store i32 2, ptr %8, align 4
  store i32 1, ptr %22, align 4
  br label %111

63:                                               ; preds = %58
  %64 = load i64, ptr @_fx_system_media_max_fat_cache, align 8, !tbaa !9
  store i64 %64, ptr %17, align 8, !tbaa !9
  %65 = load i64, ptr %17, align 8, !tbaa !9
  %66 = load i64, ptr %17, align 8, !tbaa !9
  %67 = xor i64 %66, -1
  %68 = add i64 %67, 1
  %69 = and i64 %65, %68
  store i64 %69, ptr %17, align 8, !tbaa !9
  %70 = load i64, ptr %17, align 8, !tbaa !9
  %71 = icmp eq i64 %70, 1
  br i1 %71, label %76, label %72

72:                                               ; preds = %63
  %73 = load i64, ptr %17, align 8, !tbaa !9
  %74 = load i64, ptr @_fx_system_media_max_fat_cache, align 8, !tbaa !9
  %75 = icmp ne i64 %73, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %72, %63
  store i32 2, ptr %8, align 4
  store i32 1, ptr %22, align 4
  br label %111

77:                                               ; preds = %72
  %78 = call ptr @_tx_thread_identify()
  store ptr %78, ptr %20, align 8, !tbaa !5
  %79 = load ptr, ptr %20, align 8, !tbaa !5
  %80 = call i32 @_tx_thread_preemption_change(ptr noundef %79, i32 noundef 0, ptr noundef %21)
  %81 = load ptr, ptr @_fx_system_media_opened_ptr, align 8, !tbaa !5
  store ptr %81, ptr %18, align 8, !tbaa !5
  %82 = load i64, ptr @_fx_system_media_opened_count, align 8, !tbaa !9
  store i64 %82, ptr %19, align 8, !tbaa !9
  br label %83

83:                                               ; preds = %95, %77
  %84 = load i64, ptr %19, align 8, !tbaa !9
  %85 = add i64 %84, -1
  store i64 %85, ptr %19, align 8, !tbaa !9
  %86 = icmp ne i64 %84, 0
  br i1 %86, label %87, label %99

87:                                               ; preds = %83
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  %89 = load ptr, ptr %18, align 8, !tbaa !5
  %90 = icmp eq ptr %88, %89
  br i1 %90, label %91, label %95

91:                                               ; preds = %87
  %92 = load ptr, ptr %20, align 8, !tbaa !5
  %93 = load i32, ptr %21, align 4, !tbaa !11
  %94 = call i32 @_tx_thread_preemption_change(ptr noundef %92, i32 noundef %93, ptr noundef %21)
  store i32 24, ptr %8, align 4
  store i32 1, ptr %22, align 4
  br label %111

95:                                               ; preds = %87
  %96 = load ptr, ptr %18, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %96, i32 0, i32 50
  %98 = load ptr, ptr %97, align 8, !tbaa !13
  store ptr %98, ptr %18, align 8, !tbaa !5
  br label %83, !llvm.loop !19

99:                                               ; preds = %83
  %100 = load ptr, ptr %20, align 8, !tbaa !5
  %101 = load i32, ptr %21, align 4, !tbaa !11
  %102 = call i32 @_tx_thread_preemption_change(ptr noundef %100, i32 noundef %101, ptr noundef %21)
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = load ptr, ptr %12, align 8, !tbaa !5
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  %108 = load i64, ptr %14, align 8, !tbaa !9
  %109 = call i32 @_fx_media_open(ptr noundef %103, ptr noundef %104, ptr noundef %105, ptr noundef %106, ptr noundef %107, i64 noundef %108)
  store i32 %109, ptr %16, align 4, !tbaa !11
  %110 = load i32, ptr %16, align 4, !tbaa !11
  store i32 %110, ptr %8, align 4
  store i32 1, ptr %22, align 4
  br label %111

111:                                              ; preds = %99, %91, %76, %62, %48, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  %112 = load i32, ptr %8, align 4
  ret i32 %112
}

; 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 @_tx_ipsr_get() #2

declare ptr @_tx_thread_identify() #3

declare i32 @_tx_thread_preemption_change(ptr noundef, i32 noundef, ptr noundef) #3

declare i32 @_fx_media_open(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 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, !6, i64 328}
!14 = !{!"FX_MEDIA_STRUCT", !10, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !12, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !10, i64 72, !12, i64 80, !12, i64 84, !12, i64 88, !15, i64 96, !10, i64 104, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !10, i64 152, !12, i64 160, !10, i64 168, !10, i64 176, !12, i64 184, !10, i64 192, !10, i64 200, !6, i64 208, !12, i64 216, !12, i64 220, !6, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !12, i64 256, !12, i64 260, !12, i64 264, !12, i64 268, !12, i64 272, !12, i64 276, !12, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !10, i64 320, !6, i64 328, !6, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !10, i64 520, !10, i64 528, !10, i64 536, !10, i64 544, !10, i64 552, !10, i64 560, !10, i64 568, !10, i64 576, !10, i64 584, !10, i64 592, !10, i64 600, !10, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !10, i64 664, !10, i64 672, !10, i64 680, !10, i64 688, !10, i64 696, !10, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !10, i64 760, !10, i64 768, !10, i64 776, !10, i64 784, !10, i64 792, !10, i64 800, !10, i64 808, !10, i64 816, !16, i64 824, !12, i64 920, !17, i64 928, !17, i64 1064, !7, i64 1200, !7, i64 1456, !18, i64 1712, !7, i64 2368, !7, i64 2752, !10, i64 2880, !7, i64 2888, !7, i64 3912, !10, i64 12104, !10, i64 12112, !10, i64 12120, !10, i64 12128, !7, i64 12136}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"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}
!17 = !{!"FX_DIR_ENTRY_STRUCT", !6, i64 0, !7, i64 8, !12, i64 24, !12, i64 28, !7, i64 32, !7, i64 33, !7, i64 34, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !10, i64 56, !15, i64 64, !15, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !15, i64 112, !10, i64 120, !15, i64 128}
!18 = !{!"FX_PATH_STRUCT", !17, i64 0, !7, i64 136, !7, i64 392, !10, i64 648}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%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_system_state = external global i64, align 8
@_tx_thread_current_ptr = external local_unnamed_addr global ptr, align 8
@_tx_timer_thread = external global %struct.TX_THREAD_STRUCT, align 8
@_fx_system_media_max_sector_cache = external local_unnamed_addr global i64, align 8
@_fx_system_media_max_fat_cache = external local_unnamed_addr global i64, align 8
@_fx_system_media_opened_ptr = external local_unnamed_addr global ptr, align 8
@_fx_system_media_opened_count = external local_unnamed_addr global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @_fxe_media_open(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, i64 noundef %5, i32 noundef %6) local_unnamed_addr #0 {
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %9 = icmp eq ptr %0, null
  %10 = icmp eq ptr %2, null
  %or.cond = or i1 %9, %10
  %11 = icmp eq ptr %4, null
  %or.cond3 = or i1 %or.cond, %11
  %12 = icmp ne i32 %6, 12144
  %or.cond6 = or i1 %or.cond3, %12
  br i1 %or.cond6, label %47, label %13

13:                                               ; preds = %7
  %14 = load volatile i64, ptr @_tx_thread_system_state, align 8, !tbaa !5
  %15 = tail call i32 @_tx_ipsr_get()
  %16 = zext i32 %15 to i64
  %17 = or i64 %14, %16
  %18 = icmp ne i64 %17, 0
  %19 = load ptr, ptr @_tx_thread_current_ptr, align 8
  %20 = icmp eq ptr %19, null
  %21 = icmp eq ptr %19, @_tx_timer_thread
  %22 = or i1 %20, %21
  %or.cond10 = select i1 %18, i1 true, i1 %22
  br i1 %or.cond10, label %47, label %23

23:                                               ; preds = %13
  %24 = load i64, ptr @_fx_system_media_max_sector_cache, align 8, !tbaa !5
  %25 = sub i64 0, %24
  %26 = and i64 %24, %25
  %27 = icmp ne i64 %26, 1
  %.not = icmp eq i64 %26, %24
  %or.cond45 = and i1 %27, %.not
  br i1 %or.cond45, label %28, label %47

28:                                               ; preds = %23
  %29 = load i64, ptr @_fx_system_media_max_fat_cache, align 8, !tbaa !5
  %30 = sub i64 0, %29
  %31 = and i64 %29, %30
  %32 = icmp ne i64 %31, 1
  %.not43 = icmp eq i64 %31, %29
  %or.cond46 = and i1 %32, %.not43
  br i1 %or.cond46, label %33, label %47

33:                                               ; preds = %28
  %34 = tail call ptr @_tx_thread_identify() #4
  %35 = call i32 @_tx_thread_preemption_change(ptr noundef %34, i32 noundef 0, ptr noundef nonnull %8) #4
  %36 = load i64, ptr @_fx_system_media_opened_count, align 8, !tbaa !5
  %.not4448 = icmp eq i64 %36, 0
  br i1 %.not4448, label %._crit_edge, label %.lr.ph

37:                                               ; preds = %.lr.ph
  %38 = add i64 %.in, -1
  %39 = getelementptr inbounds i8, ptr %.03749, i64 328
  %.not44 = icmp eq i64 %38, 0
  br i1 %.not44, label %._crit_edge, label %.lr.ph, !llvm.loop !9

.lr.ph:                                           ; preds = %33, %37
  %.in = phi i64 [ %38, %37 ], [ %36, %33 ]
  %.03749.in = phi ptr [ %39, %37 ], [ @_fx_system_media_opened_ptr, %33 ]
  %.03749 = load ptr, ptr %.03749.in, align 8, !tbaa !11
  %40 = icmp eq ptr %.03749, %0
  br i1 %40, label %41, label %37

41:                                               ; preds = %.lr.ph
  %42 = load i32, ptr %8, align 4, !tbaa !13
  %43 = call i32 @_tx_thread_preemption_change(ptr noundef %34, i32 noundef %42, ptr noundef nonnull %8) #4
  br label %47

._crit_edge:                                      ; preds = %37, %33
  %44 = load i32, ptr %8, align 4, !tbaa !13
  %45 = call i32 @_tx_thread_preemption_change(ptr noundef %34, i32 noundef %44, ptr noundef nonnull %8) #4
  %46 = call i32 @_fx_media_open(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, i64 noundef %5) #4
  br label %47

47:                                               ; preds = %28, %23, %13, %7, %._crit_edge, %41
  %.0 = phi i32 [ 24, %41 ], [ %46, %._crit_edge ], [ 24, %7 ], [ 32, %13 ], [ 2, %23 ], [ 2, %28 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  ret i32 %.0
}

; Function Attrs: mustprogress 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 @_tx_ipsr_get() local_unnamed_addr #2

declare ptr @_tx_thread_identify() local_unnamed_addr #3

declare i32 @_tx_thread_preemption_change(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @_fx_media_open(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress 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 = { mustprogress 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass