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

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

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

19:                                               ; preds = %6
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %34, label %22

22:                                               ; preds = %19
  %23 = load i64, ptr %10, align 8, !tbaa !9
  %24 = icmp eq i64 %23, 0
  br i1 %24, label %34, label %25

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

28:                                               ; preds = %25
  %29 = load i64, ptr %12, align 8, !tbaa !9
  %30 = icmp eq i64 %29, 0
  br i1 %30, label %34, label %31

31:                                               ; preds = %28
  %32 = load ptr, ptr %13, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %31, %28, %25, %22, %19, %6
  store i32 24, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %115

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

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

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

47:                                               ; preds = %44, %41, %35
  store i32 32, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %115

48:                                               ; preds = %44
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %49

49:                                               ; preds = %74, %48
  %50 = load i32, ptr %15, align 4, !tbaa !11
  %51 = zext i32 %50 to i64
  %52 = load i64, ptr %10, align 8, !tbaa !9
  %53 = shl i64 %52, 1
  %54 = icmp ult i64 %51, %53
  br i1 %54, label %55, label %77

55:                                               ; preds = %49
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load i32, ptr %15, align 4, !tbaa !11
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %56, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !13
  %61 = zext i8 %60 to i32
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %73

63:                                               ; preds = %55
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = load i32, ptr %15, align 4, !tbaa !11
  %66 = add i32 %65, 1
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds i8, ptr %64, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !13
  %70 = zext i8 %69 to i32
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %63
  store i32 12, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %115

73:                                               ; preds = %63, %55
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %15, align 4, !tbaa !11
  %76 = add i32 %75, 2
  store i32 %76, ptr %15, align 4, !tbaa !11
  br label %49, !llvm.loop !14

77:                                               ; preds = %49
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %103, %77
  %79 = load i32, ptr %15, align 4, !tbaa !11
  %80 = zext i32 %79 to i64
  %81 = load i64, ptr %12, align 8, !tbaa !9
  %82 = shl i64 %81, 1
  %83 = icmp ult i64 %80, %82
  br i1 %83, label %84, label %106

84:                                               ; preds = %78
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load i32, ptr %15, align 4, !tbaa !11
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds i8, ptr %85, i64 %87
  %89 = load i8, ptr %88, align 1, !tbaa !13
  %90 = zext i8 %89 to i32
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %92, label %102

92:                                               ; preds = %84
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = load i32, ptr %15, align 4, !tbaa !11
  %95 = add i32 %94, 1
  %96 = zext i32 %95 to i64
  %97 = getelementptr inbounds i8, ptr %93, i64 %96
  %98 = load i8, ptr %97, align 1, !tbaa !13
  %99 = zext i8 %98 to i32
  %100 = icmp eq i32 %99, 0
  br i1 %100, label %101, label %102

101:                                              ; preds = %92
  store i32 12, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %115

102:                                              ; preds = %92, %84
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %15, align 4, !tbaa !11
  %105 = add i32 %104, 2
  store i32 %105, ptr %15, align 4, !tbaa !11
  br label %78, !llvm.loop !16

106:                                              ; preds = %78
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  %109 = load i64, ptr %10, align 8, !tbaa !9
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  %111 = load i64, ptr %12, align 8, !tbaa !9
  %112 = load ptr, ptr %13, align 8, !tbaa !5
  %113 = call i32 @_fx_unicode_directory_rename(ptr noundef %107, ptr noundef %108, i64 noundef %109, ptr noundef %110, i64 noundef %111, ptr noundef %112)
  store i32 %113, ptr %14, align 4, !tbaa !11
  %114 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %114, ptr %7, align 4
  store i32 1, ptr %16, align 4
  br label %115

115:                                              ; preds = %106, %101, %72, %47, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %116 = load i32, ptr %7, align 4
  ret i32 %116
}

; 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 i32 @_fx_unicode_directory_rename(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, 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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; 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

; Function Attrs: nounwind uwtable
define dso_local i32 @_fxe_unicode_directory_rename(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %8 = insertelement <4 x ptr> %7, ptr %1, i64 1
  %9 = insertelement <4 x ptr> %8, ptr %3, i64 2
  %10 = insertelement <4 x ptr> %9, ptr %5, i64 3
  %11 = icmp eq <4 x ptr> %10, zeroinitializer
  %12 = icmp eq i64 %2, 0
  %13 = icmp eq i64 %4, 0
  %14 = bitcast <4 x i1> %11 to i4
  %15 = icmp ne i4 %14, 0
  %op.rdx = or i1 %15, %12
  %op.rdx55 = or i1 %op.rdx, %13
  br i1 %op.rdx55, label %.loopexit, label %16

16:                                               ; preds = %6
  %17 = load volatile i64, ptr @_tx_thread_system_state, align 8, !tbaa !5
  %18 = tail call i32 @_tx_ipsr_get()
  %19 = zext i32 %18 to i64
  %20 = or i64 %17, %19
  %21 = icmp ne i64 %20, 0
  %22 = load ptr, ptr @_tx_thread_current_ptr, align 8
  %23 = icmp eq ptr %22, null
  %24 = icmp eq ptr %22, @_tx_timer_thread
  %25 = or i1 %23, %24
  %or.cond13 = select i1 %21, i1 true, i1 %25
  br i1 %or.cond13, label %.loopexit, label %.preheader46

.preheader46:                                     ; preds = %16
  %26 = shl i64 %2, 1
  %.not = icmp eq i64 %26, 0
  br i1 %.not, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %38, %.preheader46
  %27 = shl i64 %4, 1
  %.not51 = icmp eq i64 %27, 0
  br i1 %.not51, label %._crit_edge, label %.lr.ph50

.lr.ph:                                           ; preds = %.preheader46, %38
  %28 = phi i64 [ %40, %38 ], [ 0, %.preheader46 ]
  %.048 = phi i32 [ %39, %38 ], [ 0, %.preheader46 ]
  %29 = getelementptr inbounds i8, ptr %1, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !9
  %31 = icmp eq i8 %30, 0
  br i1 %31, label %32, label %38

32:                                               ; preds = %.lr.ph
  %33 = or disjoint i32 %.048, 1
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %1, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !9
  %37 = icmp eq i8 %36, 0
  br i1 %37, label %.loopexit, label %38

38:                                               ; preds = %.lr.ph, %32
  %39 = add i32 %.048, 2
  %40 = zext i32 %39 to i64
  %41 = icmp ugt i64 %26, %40
  br i1 %41, label %.lr.ph, label %.preheader, !llvm.loop !10

.lr.ph50:                                         ; preds = %.preheader, %52
  %42 = phi i64 [ %54, %52 ], [ 0, %.preheader ]
  %.149 = phi i32 [ %53, %52 ], [ 0, %.preheader ]
  %43 = getelementptr inbounds i8, ptr %3, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = icmp eq i8 %44, 0
  br i1 %45, label %46, label %52

46:                                               ; preds = %.lr.ph50
  %47 = or disjoint i32 %.149, 1
  %48 = zext i32 %47 to i64
  %49 = getelementptr inbounds i8, ptr %3, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !9
  %51 = icmp eq i8 %50, 0
  br i1 %51, label %.loopexit, label %52

52:                                               ; preds = %.lr.ph50, %46
  %53 = add i32 %.149, 2
  %54 = zext i32 %53 to i64
  %55 = icmp ugt i64 %27, %54
  br i1 %55, label %.lr.ph50, label %._crit_edge, !llvm.loop !12

._crit_edge:                                      ; preds = %52, %.preheader
  %56 = tail call i32 @_fx_unicode_directory_rename(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4, ptr noundef %5) #3
  br label %.loopexit

.loopexit:                                        ; preds = %32, %46, %16, %6, %._crit_edge
  %.040 = phi i32 [ %56, %._crit_edge ], [ 24, %6 ], [ 32, %16 ], [ 12, %46 ], [ 12, %32 ]
  ret i32 %.040
}

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

declare i32 @_fx_unicode_directory_rename(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


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