; LLVM IR from mlcommons/tiny :: benchmark/interface/Middlewares/ST/filex/common/src/fx_unicode_name_get_extend_2b0bd401 (extended)

; 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.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_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_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 }

; Function Attrs: nounwind uwtable
define dso_local i32 @_fx_unicode_name_get_extended(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.FX_DIR_ENTRY_STRUCT, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i64 %4, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 136, ptr %13) #3
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %15, i32 0, i32 122
  %17 = getelementptr inbounds [1024 x i8], ptr %16, i64 0, i64 0
  %18 = getelementptr inbounds i8, ptr %17, i64 256
  %19 = getelementptr inbounds %struct.FX_DIR_ENTRY_STRUCT, ptr %13, i32 0, i32 0
  store ptr %18, ptr %19, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct.FX_DIR_ENTRY_STRUCT, ptr %13, i32 0, i32 1
  %21 = getelementptr inbounds [13 x i8], ptr %20, i64 0, i64 0
  store i8 0, ptr %21, align 8, !tbaa !15
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %22, i32 0, i32 0
  %24 = load i64, ptr %23, align 8, !tbaa !16
  %25 = icmp ne i64 %24, 1296385097
  br i1 %25, label %26, label %27

26:                                               ; preds = %5
  store i32 17, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %59

27:                                               ; preds = %5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 0, ptr %28, align 8, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %29, i32 0, i32 0
  %31 = load i64, ptr %30, align 8, !tbaa !16
  %32 = icmp ne i64 %31, 1296385097
  br i1 %32, label %33, label %34

33:                                               ; preds = %27
  store i32 17, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %59

34:                                               ; preds = %27
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %35, i32 0, i32 112
  %37 = call i32 @_tx_mutex_get(ptr noundef %36, i64 noundef 4294967295)
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  store i32 17, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %59

40:                                               ; preds = %34
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = load i64, ptr %11, align 8, !tbaa !9
  %47 = call i32 @_fx_unicode_directory_search(ptr noundef %42, ptr noundef %13, ptr noundef %43, i64 noundef 0, ptr noundef %44, ptr noundef %45, i64 noundef %46)
  store i32 %47, ptr %12, align 4, !tbaa !20
  %48 = load i32, ptr %12, align 4, !tbaa !20
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %55

50:                                               ; preds = %41
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %51, i32 0, i32 112
  %53 = call i32 @_tx_mutex_put(ptr noundef %52)
  %54 = load i32, ptr %12, align 4, !tbaa !20
  store i32 %54, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %59

55:                                               ; preds = %41
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.FX_MEDIA_STRUCT, ptr %56, i32 0, i32 112
  %58 = call i32 @_tx_mutex_put(ptr noundef %57)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %59

59:                                               ; preds = %55, %50, %39, %33, %26
  call void @llvm.lifetime.end.p0(i64 136, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  %60 = load i32, ptr %6, align 4
  ret i32 %60
}

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

declare i32 @_tx_mutex_get(ptr noundef, i64 noundef) #2

declare i32 @_fx_unicode_directory_search(ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i64 noundef) #2

declare i32 @_tx_mutex_put(ptr noundef) #2

; 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 = { "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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"FX_DIR_ENTRY_STRUCT", !6, i64 0, !7, i64 8, !13, i64 24, !13, i64 28, !7, i64 32, !7, i64 33, !7, i64 34, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !10, i64 56, !14, i64 64, !14, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !14, i64 112, !10, i64 120, !14, i64 128}
!13 = !{!"int", !7, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !10, i64 0}
!17 = !{!"FX_MEDIA_STRUCT", !10, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !13, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !10, i64 72, !13, i64 80, !13, i64 84, !13, i64 88, !14, i64 96, !10, i64 104, !13, i64 112, !13, i64 116, !13, i64 120, !13, i64 124, !13, i64 128, !13, i64 132, !13, i64 136, !13, i64 140, !13, i64 144, !10, i64 152, !13, i64 160, !10, i64 168, !10, i64 176, !13, i64 184, !10, i64 192, !10, i64 200, !6, i64 208, !13, i64 216, !13, i64 220, !6, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !13, i64 256, !13, i64 260, !13, i64 264, !13, i64 268, !13, i64 272, !13, i64 276, !13, 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, !18, i64 824, !13, i64 920, !12, i64 928, !12, i64 1064, !7, i64 1200, !7, i64 1456, !19, 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}
!18 = !{!"TX_MUTEX_STRUCT", !10, i64 0, !6, i64 8, !13, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !6, i64 40, !13, i64 48, !6, i64 56, !6, i64 64, !13, i64 72, !6, i64 80, !6, i64 88}
!19 = !{!"FX_PATH_STRUCT", !12, i64 0, !7, i64 136, !7, i64 392, !10, i64 648}
!20 = !{!13, !13, i64 0}


; 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.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 }

; Function Attrs: nounwind uwtable
define dso_local i32 @_fx_unicode_name_get_extended(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4) local_unnamed_addr #0 {
  %6 = alloca %struct.FX_DIR_ENTRY_STRUCT, align 8
  call void @llvm.lifetime.start.p0(i64 136, ptr nonnull %6) #3
  %7 = getelementptr inbounds i8, ptr %0, i64 3144
  store ptr %7, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %6, i64 8
  store i8 0, ptr %8, align 8, !tbaa !13
  %9 = load i64, ptr %0, align 8, !tbaa !14
  %.not = icmp eq i64 %9, 1296385097
  br i1 %.not, label %10, label %18

10:                                               ; preds = %5
  store i64 0, ptr %3, align 8, !tbaa !18
  %11 = load i64, ptr %0, align 8, !tbaa !14
  %.not15 = icmp eq i64 %11, 1296385097
  br i1 %.not15, label %12, label %18

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 824
  %14 = tail call i32 @_tx_mutex_get(ptr noundef nonnull %13, i64 noundef 4294967295) #3
  %.not16 = icmp eq i32 %14, 0
  br i1 %.not16, label %15, label %18

15:                                               ; preds = %12
  %16 = call i32 @_fx_unicode_directory_search(ptr noundef nonnull %0, ptr noundef nonnull %6, ptr noundef %1, i64 noundef 0, ptr noundef %2, ptr noundef nonnull %3, i64 noundef %4) #3
  %17 = call i32 @_tx_mutex_put(ptr noundef nonnull %13) #3
  br label %18

18:                                               ; preds = %15, %12, %10, %5
  %.0 = phi i32 [ 17, %5 ], [ 17, %10 ], [ 17, %12 ], [ %16, %15 ]
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %6) #3
  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

declare i32 @_tx_mutex_get(ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @_fx_unicode_directory_search(ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @_tx_mutex_put(ptr noundef) local_unnamed_addr #2

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


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