; LLVM IR from ctlst-tech/catpilot :: os/fatfs/core (ff)

; 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.DIR = type { %struct.FFOBJID, i32, i32, i32, ptr, [12 x i8], i32, ptr }
%struct.FFOBJID = type { ptr, i16, i8, i8, i32, i32, i32 }
%struct.FATFS = type { i8, i8, i8, i8, i8, i8, i16, i16, i16, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [512 x i8] }

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

; Function Attrs: nounwind uwtable
declare hidden i32 @get_ldnumber(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @mount_volume(ptr noundef, ptr noundef, i8 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare hidden void @unlock_volume(ptr noundef, i32 noundef) #1

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

declare ptr @ff_memalloc(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @follow_path(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @chk_share(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @dir_register(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @ld_clust(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @st_clust(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @move_window(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @clst2sect(ptr noundef, i32 noundef) #1

declare void @ff_memfree(ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @sync_fs(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @dir_remove(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @f_rename(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %struct.DIR, align 8
  %9 = alloca %struct.DIR, align 8
  %10 = alloca [32 x i8], align 16
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %15 = call i32 @get_ldnumber(ptr noundef %5)
  %16 = call i32 @mount_volume(ptr noundef %4, ptr noundef %7, i8 noundef zeroext 2)
  store i32 %16, ptr %6, align 4, !tbaa !9
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %177

19:                                               ; preds = %2
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.DIR, ptr %8, i32 0, i32 0
  %22 = getelementptr inbounds %struct.FFOBJID, ptr %21, i32 0, i32 0
  store ptr %20, ptr %22, align 8, !tbaa !11
  %23 = call ptr @ff_memalloc(i32 noundef 512)
  store ptr %23, ptr %13, align 8, !tbaa !5
  %24 = load ptr, ptr %13, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %28, label %26

26:                                               ; preds = %19
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  call void @unlock_volume(ptr noundef %27, i32 noundef 17)
  store i32 17, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %181

28:                                               ; preds = %19
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.FATFS, ptr %30, i32 0, i32 9
  store ptr %29, ptr %31, align 8, !tbaa !15
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call i32 @follow_path(ptr noundef %8, ptr noundef %32)
  store i32 %33, ptr %6, align 4, !tbaa !9
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %44

36:                                               ; preds = %28
  %37 = getelementptr inbounds %struct.DIR, ptr %8, i32 0, i32 5
  %38 = getelementptr inbounds [12 x i8], ptr %37, i64 0, i64 11
  %39 = load i8, ptr %38, align 1, !tbaa !17
  %40 = zext i8 %39 to i32
  %41 = and i32 %40, 160
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %36
  store i32 6, ptr %6, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %43, %36, %28
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %49

47:                                               ; preds = %44
  %48 = call i32 @chk_share(ptr noundef %8, i32 noundef 2)
  store i32 %48, ptr %6, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %47, %44
  %50 = load i32, ptr %6, align 4, !tbaa !9
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %175

52:                                               ; preds = %49
  %53 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %54 = getelementptr inbounds %struct.DIR, ptr %8, i32 0, i32 4
  %55 = load ptr, ptr %54, align 8, !tbaa !18
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %53, ptr align 1 %55, i64 32, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %8, i64 72, i1 false)
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = call i32 @follow_path(ptr noundef %9, ptr noundef %56)
  store i32 %57, ptr %6, align 4, !tbaa !9
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %78

60:                                               ; preds = %52
  %61 = getelementptr inbounds %struct.DIR, ptr %9, i32 0, i32 0
  %62 = getelementptr inbounds %struct.FFOBJID, ptr %61, i32 0, i32 4
  %63 = load i32, ptr %62, align 4, !tbaa !19
  %64 = getelementptr inbounds %struct.DIR, ptr %8, i32 0, i32 0
  %65 = getelementptr inbounds %struct.FFOBJID, ptr %64, i32 0, i32 4
  %66 = load i32, ptr %65, align 4, !tbaa !19
  %67 = icmp eq i32 %63, %66
  br i1 %67, label %68, label %74

68:                                               ; preds = %60
  %69 = getelementptr inbounds %struct.DIR, ptr %9, i32 0, i32 1
  %70 = load i32, ptr %69, align 8, !tbaa !20
  %71 = getelementptr inbounds %struct.DIR, ptr %8, i32 0, i32 1
  %72 = load i32, ptr %71, align 8, !tbaa !20
  %73 = icmp eq i32 %70, %72
  br label %74

74:                                               ; preds = %68, %60
  %75 = phi i1 [ false, %60 ], [ %73, %68 ]
  %76 = zext i1 %75 to i64
  %77 = select i1 %75, i32 4, i32 8
  store i32 %77, ptr %6, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %74, %52
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = icmp eq i32 %79, 4
  br i1 %80, label %81, label %163

81:                                               ; preds = %78
  %82 = call i32 @dir_register(ptr noundef %9)
  store i32 %82, ptr %6, align 4, !tbaa !9
  %83 = load i32, ptr %6, align 4, !tbaa !9
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %162

85:                                               ; preds = %81
  %86 = getelementptr inbounds %struct.DIR, ptr %9, i32 0, i32 4
  %87 = load ptr, ptr %86, align 8, !tbaa !18
  store ptr %87, ptr %11, align 8, !tbaa !5
  %88 = load ptr, ptr %11, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i64 13
  %90 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %91 = getelementptr inbounds i8, ptr %90, i64 13
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %89, ptr align 1 %91, i64 19, i1 false)
  %92 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 11
  %93 = load i8, ptr %92, align 1, !tbaa !17
  %94 = load ptr, ptr %11, align 8, !tbaa !5
  %95 = getelementptr inbounds i8, ptr %94, i64 11
  store i8 %93, ptr %95, align 1, !tbaa !17
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %96, i64 11
  %98 = load i8, ptr %97, align 1, !tbaa !17
  %99 = zext i8 %98 to i32
  %100 = and i32 %99, 16
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %109, label %102

102:                                              ; preds = %85
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = getelementptr inbounds i8, ptr %103, i64 11
  %105 = load i8, ptr %104, align 1, !tbaa !17
  %106 = zext i8 %105 to i32
  %107 = or i32 %106, 32
  %108 = trunc i32 %107 to i8
  store i8 %108, ptr %104, align 1, !tbaa !17
  br label %109

109:                                              ; preds = %102, %85
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.FATFS, ptr %110, i32 0, i32 4
  store i8 1, ptr %111, align 4, !tbaa !21
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = getelementptr inbounds i8, ptr %112, i64 11
  %114 = load i8, ptr %113, align 1, !tbaa !17
  %115 = zext i8 %114 to i32
  %116 = and i32 %115, 16
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %161

118:                                              ; preds = %109
  %119 = getelementptr inbounds %struct.DIR, ptr %8, i32 0, i32 0
  %120 = getelementptr inbounds %struct.FFOBJID, ptr %119, i32 0, i32 4
  %121 = load i32, ptr %120, align 4, !tbaa !19
  %122 = getelementptr inbounds %struct.DIR, ptr %9, i32 0, i32 0
  %123 = getelementptr inbounds %struct.FFOBJID, ptr %122, i32 0, i32 4
  %124 = load i32, ptr %123, align 4, !tbaa !19
  %125 = icmp ne i32 %121, %124
  br i1 %125, label %126, label %161

126:                                              ; preds = %118
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = load ptr, ptr %11, align 8, !tbaa !5
  %130 = call i32 @ld_clust(ptr noundef %128, ptr noundef %129)
  %131 = call i32 @clst2sect(ptr noundef %127, i32 noundef %130)
  store i32 %131, ptr %12, align 4, !tbaa !9
  %132 = load i32, ptr %12, align 4, !tbaa !9
  %133 = icmp eq i32 %132, 0
  br i1 %133, label %134, label %135

134:                                              ; preds = %126
  store i32 2, ptr %6, align 4, !tbaa !9
  br label %160

135:                                              ; preds = %126
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = load i32, ptr %12, align 4, !tbaa !9
  %138 = call i32 @move_window(ptr noundef %136, i32 noundef %137)
  store i32 %138, ptr %6, align 4, !tbaa !9
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.FATFS, ptr %139, i32 0, i32 20
  %141 = getelementptr inbounds [512 x i8], ptr %140, i64 0, i64 0
  %142 = getelementptr inbounds i8, ptr %141, i64 32
  store ptr %142, ptr %11, align 8, !tbaa !5
  %143 = load i32, ptr %6, align 4, !tbaa !9
  %144 = icmp eq i32 %143, 0
  br i1 %144, label %145, label %159

145:                                              ; preds = %135
  %146 = load ptr, ptr %11, align 8, !tbaa !5
  %147 = getelementptr inbounds i8, ptr %146, i64 1
  %148 = load i8, ptr %147, align 1, !tbaa !17
  %149 = zext i8 %148 to i32
  %150 = icmp eq i32 %149, 46
  br i1 %150, label %151, label %159

151:                                              ; preds = %145
  %152 = load ptr, ptr %7, align 8, !tbaa !5
  %153 = load ptr, ptr %11, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.DIR, ptr %9, i32 0, i32 0
  %155 = getelementptr inbounds %struct.FFOBJID, ptr %154, i32 0, i32 4
  %156 = load i32, ptr %155, align 4, !tbaa !19
  call void @st_clust(ptr noundef %152, ptr noundef %153, i32 noundef %156)
  %157 = load ptr, ptr %7, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.FATFS, ptr %157, i32 0, i32 4
  store i8 1, ptr %158, align 4, !tbaa !21
  br label %159

159:                                              ; preds = %151, %145, %135
  br label %160

160:                                              ; preds = %159, %134
  br label %161

161:                                              ; preds = %160, %118, %109
  br label %162

162:                                              ; preds = %161, %81
  br label %163

163:                                              ; preds = %162, %78
  %164 = load i32, ptr %6, align 4, !tbaa !9
  %165 = icmp eq i32 %164, 0
  br i1 %165, label %166, label %174

166:                                              ; preds = %163
  %167 = call i32 @dir_remove(ptr noundef %8)
  store i32 %167, ptr %6, align 4, !tbaa !9
  %168 = load i32, ptr %6, align 4, !tbaa !9
  %169 = icmp eq i32 %168, 0
  br i1 %169, label %170, label %173

170:                                              ; preds = %166
  %171 = load ptr, ptr %7, align 8, !tbaa !5
  %172 = call i32 @sync_fs(ptr noundef %171)
  store i32 %172, ptr %6, align 4, !tbaa !9
  br label %173

173:                                              ; preds = %170, %166
  br label %174

174:                                              ; preds = %173, %163
  br label %175

175:                                              ; preds = %174, %49
  %176 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ff_memfree(ptr noundef %176)
  br label %177

177:                                              ; preds = %175, %2
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = load i32, ptr %6, align 4, !tbaa !9
  call void @unlock_volume(ptr noundef %178, i32 noundef %179)
  %180 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %180, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %181

181:                                              ; preds = %177, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %182 = load i32, ptr %3, align 4
  ret i32 %182
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !13, i64 0, !10, i64 24, !10, i64 28, !10, i64 32, !6, i64 40, !7, i64 48, !10, i64 60, !6, i64 64}
!13 = !{!"", !6, i64 0, !14, i64 8, !7, i64 10, !7, i64 11, !10, i64 12, !10, i64 16, !10, i64 20}
!14 = !{!"short", !7, i64 0}
!15 = !{!16, !6, i64 16}
!16 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !14, i64 6, !14, i64 8, !14, i64 10, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !7, i64 64}
!17 = !{!7, !7, i64 0}
!18 = !{!12, !6, i64 40}
!19 = !{!12, !10, i64 12}
!20 = !{!12, !10, i64 24}
!21 = !{!16, !7, i64 4}


; 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.DIR = type { %struct.FFOBJID, i32, i32, i32, ptr, [12 x i8], i32, ptr }
%struct.FFOBJID = type { ptr, i16, i8, i8, i32, i32, i32 }

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

; Function Attrs: nounwind uwtable
declare hidden i32 @get_ldnumber(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @mount_volume(ptr noundef, ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @unlock_volume(ptr noundef, i32 noundef) local_unnamed_addr #1

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

declare ptr @ff_memalloc(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @follow_path(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @chk_share(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @dir_register(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @ld_clust(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @st_clust(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @move_window(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @clst2sect(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @ff_memfree(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @sync_fs(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @dir_remove(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @f_rename(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.DIR, align 8
  %7 = alloca %struct.DIR, align 8
  %.sroa.4 = alloca [20 x i8], align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %.sroa.4)
  %8 = call i32 @get_ldnumber(ptr noundef nonnull %4)
  %9 = call i32 @mount_volume(ptr noundef nonnull %3, ptr noundef nonnull %5, i8 noundef zeroext 2)
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %88

11:                                               ; preds = %2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %12, ptr %6, align 8, !tbaa !9
  %13 = call ptr @ff_memalloc(i32 noundef 512) #4
  %.not = icmp eq ptr %13, null
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %.not, label %15, label %16

15:                                               ; preds = %11
  call void @unlock_volume(ptr noundef %14, i32 noundef 17)
  br label %90

16:                                               ; preds = %11
  %17 = getelementptr inbounds i8, ptr %14, i64 16
  store ptr %13, ptr %17, align 8, !tbaa !14
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = call i32 @follow_path(ptr noundef nonnull %6, ptr noundef %18)
  %20 = icmp eq i32 %19, 0
  %21 = getelementptr inbounds i8, ptr %6, i64 59
  %22 = load i8, ptr %21, align 1
  %23 = and i8 %22, -96
  %.not37 = icmp eq i8 %23, 0
  %spec.select = select i1 %.not37, i32 0, i32 6
  %.025 = select i1 %20, i32 %spec.select, i32 %19
  %24 = select i1 %20, i1 %.not37, i1 false
  br i1 %24, label %25, label %.thread

25:                                               ; preds = %16
  %26 = call i32 @chk_share(ptr noundef nonnull %6, i32 noundef 2)
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %.thread

28:                                               ; preds = %25
  %29 = getelementptr inbounds i8, ptr %6, i64 40
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %30, i64 11
  %.sroa.3.0.copyload = load i8, ptr %.sroa.3.0..sroa_idx, align 1
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %30, i64 12
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %.sroa.4, ptr noundef nonnull align 1 dereferenceable(20) %.sroa.4.0..sroa_idx, i64 20, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %7, ptr noundef nonnull align 8 dereferenceable(72) %6, i64 72, i1 false)
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = call i32 @follow_path(ptr noundef nonnull %7, ptr noundef %31)
  switch i32 %32, label %.thread [
    i32 0, label %33
    i32 4, label %.thread43
  ]

33:                                               ; preds = %28
  %34 = getelementptr inbounds i8, ptr %7, i64 12
  %35 = load i32, ptr %34, align 4, !tbaa !17
  %36 = getelementptr inbounds i8, ptr %6, i64 12
  %37 = load i32, ptr %36, align 4, !tbaa !17
  %38 = icmp eq i32 %35, %37
  %39 = getelementptr inbounds i8, ptr %7, i64 24
  %40 = load i32, ptr %39, align 8
  %41 = getelementptr inbounds i8, ptr %6, i64 24
  %42 = load i32, ptr %41, align 8
  %43 = icmp eq i32 %40, %42
  %44 = select i1 %38, i1 %43, i1 false
  br i1 %44, label %.thread43, label %.thread

.thread43:                                        ; preds = %28, %33
  %45 = call i32 @dir_register(ptr noundef nonnull %7)
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %.thread

47:                                               ; preds = %.thread43
  %48 = getelementptr inbounds i8, ptr %7, i64 40
  %49 = load ptr, ptr %48, align 8, !tbaa !16
  %50 = getelementptr inbounds i8, ptr %49, i64 13
  %.sroa.4.13.sroa_idx = getelementptr inbounds i8, ptr %.sroa.4, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(19) %50, ptr noundef nonnull align 1 dereferenceable(19) %.sroa.4.13.sroa_idx, i64 19, i1 false)
  %51 = getelementptr inbounds i8, ptr %49, i64 11
  %52 = shl i8 %.sroa.3.0.copyload, 1
  %53 = and i8 %52, 32
  %54 = xor i8 %53, 32
  %spec.select41 = or i8 %54, %.sroa.3.0.copyload
  store i8 %spec.select41, ptr %51, align 1, !tbaa !18
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 4
  store i8 1, ptr %56, align 4, !tbaa !19
  %57 = load i8, ptr %51, align 1, !tbaa !18
  %58 = and i8 %57, 16
  %.not39 = icmp eq i8 %58, 0
  br i1 %.not39, label %82, label %59

59:                                               ; preds = %47
  %60 = getelementptr inbounds i8, ptr %6, i64 12
  %61 = load i32, ptr %60, align 4, !tbaa !17
  %62 = getelementptr inbounds i8, ptr %7, i64 12
  %63 = load i32, ptr %62, align 4, !tbaa !17
  %.not40 = icmp eq i32 %61, %63
  br i1 %.not40, label %82, label %64

64:                                               ; preds = %59
  %65 = call i32 @ld_clust(ptr noundef nonnull %55, ptr noundef nonnull %49)
  %66 = call i32 @clst2sect(ptr noundef nonnull %55, i32 noundef %65)
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %.thread, label %68

68:                                               ; preds = %64
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = call i32 @move_window(ptr noundef %69, i32 noundef %66)
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 96
  %73 = icmp eq i32 %70, 0
  br i1 %73, label %74, label %.thread

74:                                               ; preds = %68
  %75 = getelementptr inbounds i8, ptr %71, i64 97
  %76 = load i8, ptr %75, align 1, !tbaa !18
  %77 = icmp eq i8 %76, 46
  br i1 %77, label %78, label %82

78:                                               ; preds = %74
  %79 = load i32, ptr %62, align 4, !tbaa !17
  call void @st_clust(ptr noundef nonnull %71, ptr noundef nonnull %72, i32 noundef %79)
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %80, i64 4
  store i8 1, ptr %81, align 4, !tbaa !19
  br label %82

82:                                               ; preds = %47, %59, %74, %78
  %83 = call i32 @dir_remove(ptr noundef nonnull %6)
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %.thread

85:                                               ; preds = %82
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = call i32 @sync_fs(ptr noundef %86)
  br label %.thread

.thread:                                          ; preds = %28, %33, %64, %.thread43, %68, %16, %85, %82, %25
  %.4 = phi i32 [ %87, %85 ], [ %83, %82 ], [ %26, %25 ], [ %.025, %16 ], [ 2, %64 ], [ %45, %.thread43 ], [ %70, %68 ], [ 8, %33 ], [ %32, %28 ]
  call void @ff_memfree(ptr noundef nonnull %13) #4
  br label %88

88:                                               ; preds = %.thread, %2
  %.5 = phi i32 [ %.4, %.thread ], [ %9, %2 ]
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  call void @unlock_volume(ptr noundef %89, i32 noundef %.5)
  br label %90

90:                                               ; preds = %88, %15
  %.0 = phi i32 [ %.5, %88 ], [ 17, %15 ]
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %.sroa.4)
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  ret i32 %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!10 = !{!"", !11, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !6, i64 40, !7, i64 48, !13, i64 60, !6, i64 64}
!11 = !{!"", !6, i64 0, !12, i64 8, !7, i64 10, !7, i64 11, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"short", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !12, i64 6, !12, i64 8, !12, i64 10, !6, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !7, i64 64}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !13, i64 12}
!18 = !{!7, !7, i64 0}
!19 = !{!15, !7, i64 4}


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