; 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 @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 @dir_register(ptr noundef) #1

declare i32 @get_fattime() #2

; Function Attrs: nounwind uwtable
declare hidden void @st_dword(ptr noundef, i32 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 @remove_chain(ptr noundef, i32 noundef, i32 noundef) #1

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

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) #4

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

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

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

16:                                               ; preds = %1
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 0
  %19 = getelementptr inbounds %struct.FFOBJID, ptr %18, i32 0, i32 0
  store ptr %17, ptr %19, align 8, !tbaa !11
  %20 = call ptr @ff_memalloc(i32 noundef 512)
  store ptr %20, ptr %11, align 8, !tbaa !5
  %21 = load ptr, ptr %11, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %25, label %23

23:                                               ; preds = %16
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  call void @unlock_volume(ptr noundef %24, i32 noundef 17)
  store i32 17, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %150

25:                                               ; preds = %16
  %26 = load ptr, ptr %11, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.FATFS, ptr %27, i32 0, i32 9
  store ptr %26, ptr %28, align 8, !tbaa !15
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = call i32 @follow_path(ptr noundef %6, ptr noundef %29)
  store i32 %30, ptr %4, align 4, !tbaa !9
  %31 = load i32, ptr %4, align 4, !tbaa !9
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %25
  store i32 8, ptr %4, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %33, %25
  %35 = load i32, ptr %4, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 4
  br i1 %36, label %37, label %45

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

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

45:                                               ; preds = %44, %37, %34
  %46 = load i32, ptr %4, align 4, !tbaa !9
  %47 = icmp eq i32 %46, 4
  br i1 %47, label %48, label %144

48:                                               ; preds = %45
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.FFOBJID, ptr %7, i32 0, i32 0
  store ptr %49, ptr %50, align 8, !tbaa !18
  %51 = call i32 @create_chain(ptr noundef %7, i32 noundef 0)
  store i32 %51, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %4, align 4, !tbaa !9
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %48
  store i32 7, ptr %4, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %54, %48
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = icmp eq i32 %56, 1
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  store i32 2, ptr %4, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %58, %55
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = icmp eq i32 %60, -1
  br i1 %61, label %62, label %63

62:                                               ; preds = %59
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %62, %59
  %64 = call i32 @get_fattime()
  store i32 %64, ptr %10, align 4, !tbaa !9
  %65 = load i32, ptr %4, align 4, !tbaa !9
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %117

67:                                               ; preds = %63
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = call i32 @dir_clear(ptr noundef %68, i32 noundef %69)
  store i32 %70, ptr %4, align 4, !tbaa !9
  %71 = load i32, ptr %4, align 4, !tbaa !9
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %116

73:                                               ; preds = %67
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.FATFS, ptr %74, i32 0, i32 20
  %76 = getelementptr inbounds [512 x i8], ptr %75, i64 0, i64 0
  %77 = getelementptr inbounds i8, ptr %76, i64 0
  call void @llvm.memset.p0.i64(ptr align 1 %77, i8 32, i64 11, i1 false)
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.FATFS, ptr %78, i32 0, i32 20
  %80 = getelementptr inbounds [512 x i8], ptr %79, i64 0, i64 0
  store i8 46, ptr %80, align 8, !tbaa !17
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.FATFS, ptr %81, i32 0, i32 20
  %83 = getelementptr inbounds [512 x i8], ptr %82, i64 0, i64 11
  store i8 16, ptr %83, align 1, !tbaa !17
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.FATFS, ptr %84, i32 0, i32 20
  %86 = getelementptr inbounds [512 x i8], ptr %85, i64 0, i64 0
  %87 = getelementptr inbounds i8, ptr %86, i64 22
  %88 = load i32, ptr %10, align 4, !tbaa !9
  call void @st_dword(ptr noundef %87, i32 noundef %88)
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.FATFS, ptr %90, i32 0, i32 20
  %92 = getelementptr inbounds [512 x i8], ptr %91, i64 0, i64 0
  %93 = load i32, ptr %8, align 4, !tbaa !9
  call void @st_clust(ptr noundef %89, ptr noundef %92, i32 noundef %93)
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.FATFS, ptr %94, i32 0, i32 20
  %96 = getelementptr inbounds [512 x i8], ptr %95, i64 0, i64 0
  %97 = getelementptr inbounds i8, ptr %96, i64 32
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.FATFS, ptr %98, i32 0, i32 20
  %100 = getelementptr inbounds [512 x i8], ptr %99, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %97, ptr align 8 %100, i64 32, i1 false)
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.FATFS, ptr %101, i32 0, i32 20
  %103 = getelementptr inbounds [512 x i8], ptr %102, i64 0, i64 33
  store i8 46, ptr %103, align 1, !tbaa !17
  %104 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 0
  %105 = getelementptr inbounds %struct.FFOBJID, ptr %104, i32 0, i32 4
  %106 = load i32, ptr %105, align 4, !tbaa !19
  store i32 %106, ptr %9, align 4, !tbaa !9
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.FATFS, ptr %108, i32 0, i32 20
  %110 = getelementptr inbounds [512 x i8], ptr %109, i64 0, i64 0
  %111 = getelementptr inbounds i8, ptr %110, i64 32
  %112 = load i32, ptr %9, align 4, !tbaa !9
  call void @st_clust(ptr noundef %107, ptr noundef %111, i32 noundef %112)
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.FATFS, ptr %113, i32 0, i32 4
  store i8 1, ptr %114, align 4, !tbaa !20
  %115 = call i32 @dir_register(ptr noundef %6)
  store i32 %115, ptr %4, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %73, %67
  br label %117

117:                                              ; preds = %116, %63
  %118 = load i32, ptr %4, align 4, !tbaa !9
  %119 = icmp eq i32 %118, 0
  br i1 %119, label %120, label %140

120:                                              ; preds = %117
  %121 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 4
  %122 = load ptr, ptr %121, align 8, !tbaa !21
  %123 = getelementptr inbounds i8, ptr %122, i64 22
  %124 = load i32, ptr %10, align 4, !tbaa !9
  call void @st_dword(ptr noundef %123, i32 noundef %124)
  %125 = load ptr, ptr %5, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 4
  %127 = load ptr, ptr %126, align 8, !tbaa !21
  %128 = load i32, ptr %8, align 4, !tbaa !9
  call void @st_clust(ptr noundef %125, ptr noundef %127, i32 noundef %128)
  %129 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 4
  %130 = load ptr, ptr %129, align 8, !tbaa !21
  %131 = getelementptr inbounds i8, ptr %130, i64 11
  store i8 16, ptr %131, align 1, !tbaa !17
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.FATFS, ptr %132, i32 0, i32 4
  store i8 1, ptr %133, align 4, !tbaa !20
  %134 = load i32, ptr %4, align 4, !tbaa !9
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %136, label %139

136:                                              ; preds = %120
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = call i32 @sync_fs(ptr noundef %137)
  store i32 %138, ptr %4, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %136, %120
  br label %143

140:                                              ; preds = %117
  %141 = load i32, ptr %8, align 4, !tbaa !9
  %142 = call i32 @remove_chain(ptr noundef %7, i32 noundef %141, i32 noundef 0)
  br label %143

143:                                              ; preds = %140, %139
  br label %144

144:                                              ; preds = %143, %45
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ff_memfree(ptr noundef %145)
  br label %146

146:                                              ; preds = %144, %1
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = load i32, ptr %4, align 4, !tbaa !9
  call void @unlock_volume(ptr noundef %147, i32 noundef %148)
  %149 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %149, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %150

150:                                              ; preds = %146, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %151 = load i32, ptr %2, align 4
  ret i32 %151
}

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

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: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!13, !6, i64 0}
!19 = !{!12, !10, i64 12}
!20 = !{!16, !7, i64 4}
!21 = !{!12, !6, 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"

%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 @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 @dir_register(ptr noundef) local_unnamed_addr #1

declare i32 @get_fattime() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @st_dword(ptr noundef, i32 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 @remove_chain(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

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) #4

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @f_mkdir(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %struct.DIR, align 8
  %5 = alloca %struct.FFOBJID, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  %6 = call i32 @mount_volume(ptr noundef nonnull %2, ptr noundef nonnull %3, i8 noundef zeroext 2)
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %66

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

12:                                               ; preds = %8
  call void @unlock_volume(ptr noundef %11, i32 noundef 17)
  br label %68

13:                                               ; preds = %8
  %14 = getelementptr inbounds i8, ptr %11, i64 16
  store ptr %10, ptr %14, align 8, !tbaa !14
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = call i32 @follow_path(ptr noundef nonnull %4, ptr noundef %15)
  %17 = icmp eq i32 %16, 0
  %spec.store.select = select i1 %17, i32 8, i32 %16
  %18 = icmp eq i32 %spec.store.select, 4
  %19 = getelementptr inbounds i8, ptr %4, i64 59
  %20 = load i8, ptr %19, align 1
  %21 = and i8 %20, 32
  %.not30 = icmp eq i8 %21, 0
  %spec.select = select i1 %.not30, i32 4, i32 6
  %.026 = select i1 %18, i32 %spec.select, i32 %spec.store.select
  %22 = select i1 %18, i1 %.not30, i1 false
  br i1 %22, label %23, label %65

23:                                               ; preds = %13
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %24, ptr %5, align 8, !tbaa !16
  %25 = call i32 @create_chain(ptr noundef nonnull %5, i32 noundef 0)
  %26 = icmp eq i32 %25, 0
  %spec.store.select1 = select i1 %26, i32 7, i32 0
  %27 = icmp eq i32 %25, 1
  %spec.store.select2 = select i1 %27, i32 2, i32 %spec.store.select1
  %28 = icmp eq i32 %25, -1
  %spec.store.select3 = select i1 %28, i32 1, i32 %spec.store.select2
  %29 = call i32 @get_fattime() #5
  %30 = icmp eq i32 %spec.store.select3, 0
  br i1 %30, label %31, label %.thread

31:                                               ; preds = %23
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = call i32 @dir_clear(ptr noundef %32, i32 noundef %25)
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %.thread

35:                                               ; preds = %31
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %36, i64 64
  %38 = getelementptr inbounds i8, ptr %36, i64 65
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(11) %38, i8 32, i64 10, i1 false)
  store i8 46, ptr %37, align 8, !tbaa !17
  %39 = getelementptr inbounds i8, ptr %36, i64 75
  store i8 16, ptr %39, align 1, !tbaa !17
  %40 = getelementptr inbounds i8, ptr %36, i64 86
  call void @st_dword(ptr noundef nonnull %40, i32 noundef %29)
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 64
  call void @st_clust(ptr noundef %41, ptr noundef nonnull %42, i32 noundef %25)
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 64
  %45 = getelementptr inbounds i8, ptr %43, i64 96
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) %45, ptr noundef nonnull align 8 dereferenceable(32) %44, i64 32, i1 false)
  %46 = getelementptr inbounds i8, ptr %43, i64 97
  store i8 46, ptr %46, align 1, !tbaa !17
  %47 = getelementptr inbounds i8, ptr %4, i64 12
  %48 = load i32, ptr %47, align 4, !tbaa !18
  call void @st_clust(ptr noundef %43, ptr noundef nonnull %45, i32 noundef %48)
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 4
  store i8 1, ptr %50, align 4, !tbaa !19
  %51 = call i32 @dir_register(ptr noundef nonnull %4)
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %.thread

53:                                               ; preds = %35
  %54 = getelementptr inbounds i8, ptr %4, i64 40
  %55 = load ptr, ptr %54, align 8, !tbaa !20
  %56 = getelementptr inbounds i8, ptr %55, i64 22
  call void @st_dword(ptr noundef nonnull %56, i32 noundef %29)
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = load ptr, ptr %54, align 8, !tbaa !20
  call void @st_clust(ptr noundef %57, ptr noundef %58, i32 noundef %25)
  %59 = load ptr, ptr %54, align 8, !tbaa !20
  %60 = getelementptr inbounds i8, ptr %59, i64 11
  store i8 16, ptr %60, align 1, !tbaa !17
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i64 4
  store i8 1, ptr %62, align 4, !tbaa !19
  %63 = call i32 @sync_fs(ptr noundef %61)
  br label %65

.thread:                                          ; preds = %23, %31, %35
  %.132 = phi i32 [ %51, %35 ], [ %spec.store.select3, %23 ], [ %33, %31 ]
  %64 = call i32 @remove_chain(ptr noundef nonnull %5, i32 noundef %25, i32 noundef 0)
  br label %65

65:                                               ; preds = %.thread, %53, %13
  %.2 = phi i32 [ %63, %53 ], [ %.132, %.thread ], [ %.026, %13 ]
  call void @ff_memfree(ptr noundef nonnull %10) #5
  br label %66

66:                                               ; preds = %65, %1
  %.3 = phi i32 [ %.2, %65 ], [ %6, %1 ]
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  call void @unlock_volume(ptr noundef %67, i32 noundef %.3)
  br label %68

68:                                               ; preds = %66, %12
  %.0 = phi i32 [ %.3, %66 ], [ 17, %12 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret i32 %.0
}

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

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: write) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!11, !6, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!10, !13, i64 12}
!19 = !{!15, !7, i64 4}
!20 = !{!10, !6, i64 40}


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