; LLVM IR from carlk3/no-OS-FatFS-SD-SDIO-SPI-RPi-Pico :: src/ff15/source (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, i64, ptr, [12 x i8], i32, ptr }
%struct.FFOBJID = type { ptr, i16, i8, i8, i32, i64, i32, i32, i32, i32, i32, i32 }
%struct.FATFS = type { i8, i8, i8, i8, i8, i8, i16, i16, i16, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, [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: 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

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

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

declare i32 @get_fattime() #2

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

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

; Function Attrs: nounwind uwtable
declare hidden void @st_clust(ptr noundef, 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) #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 96, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 48, 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 %202

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 1120)
  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 %24, label %23

23:                                               ; preds = %16
  store i32 17, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %204

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

37:                                               ; preds = %24
  store i32 8, ptr %4, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %37, %24
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = icmp eq i32 %39, 4
  br i1 %40, label %41, label %49

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

48:                                               ; preds = %41
  store i32 6, ptr %4, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %48, %41, %38
  %50 = load i32, ptr %4, align 4, !tbaa !9
  %51 = icmp eq i32 %50, 4
  br i1 %51, label %52, label %200

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

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

59:                                               ; preds = %58, %52
  %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 2, ptr %4, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %62, %59
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = icmp eq i32 %64, -1
  br i1 %65, label %66, label %67

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

67:                                               ; preds = %66, %63
  %68 = call i32 @get_fattime()
  store i32 %68, ptr %10, align 4, !tbaa !9
  %69 = load i32, ptr %4, align 4, !tbaa !9
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %71, label %128

71:                                               ; preds = %67
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = call i32 @dir_clear(ptr noundef %72, i32 noundef %73)
  store i32 %74, ptr %4, align 4, !tbaa !9
  %75 = load i32, ptr %4, align 4, !tbaa !9
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %77, label %127

77:                                               ; preds = %71
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.FATFS, ptr %78, i32 0, i32 0
  %80 = load i8, ptr %79, align 8, !tbaa !21
  %81 = zext i8 %80 to i32
  %82 = icmp ne i32 %81, 4
  br i1 %82, label %83, label %125

83:                                               ; preds = %77
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.FATFS, ptr %84, i32 0, i32 25
  %86 = getelementptr inbounds [512 x i8], ptr %85, i64 0, i64 0
  %87 = getelementptr inbounds i8, ptr %86, i64 0
  call void @llvm.memset.p0.i64(ptr align 1 %87, i8 32, i64 11, i1 false)
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.FATFS, ptr %88, i32 0, i32 25
  %90 = getelementptr inbounds [512 x i8], ptr %89, i64 0, i64 0
  store i8 46, ptr %90, align 8, !tbaa !19
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.FATFS, ptr %91, i32 0, i32 25
  %93 = getelementptr inbounds [512 x i8], ptr %92, i64 0, i64 11
  store i8 16, ptr %93, align 1, !tbaa !19
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.FATFS, ptr %94, i32 0, i32 25
  %96 = getelementptr inbounds [512 x i8], ptr %95, i64 0, i64 0
  %97 = getelementptr inbounds i8, ptr %96, i64 22
  %98 = load i32, ptr %10, align 4, !tbaa !9
  call void @st_dword(ptr noundef %97, i32 noundef %98)
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.FATFS, ptr %100, i32 0, i32 25
  %102 = getelementptr inbounds [512 x i8], ptr %101, i64 0, i64 0
  %103 = load i32, ptr %8, align 4, !tbaa !9
  call void @st_clust(ptr noundef %99, ptr noundef %102, i32 noundef %103)
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.FATFS, ptr %104, i32 0, i32 25
  %106 = getelementptr inbounds [512 x i8], ptr %105, i64 0, i64 0
  %107 = getelementptr inbounds i8, ptr %106, i64 32
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.FATFS, ptr %108, i32 0, i32 25
  %110 = getelementptr inbounds [512 x i8], ptr %109, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %107, ptr align 8 %110, i64 32, i1 false)
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.FATFS, ptr %111, i32 0, i32 25
  %113 = getelementptr inbounds [512 x i8], ptr %112, i64 0, i64 33
  store i8 46, ptr %113, align 1, !tbaa !19
  %114 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 0
  %115 = getelementptr inbounds %struct.FFOBJID, ptr %114, i32 0, i32 4
  %116 = load i32, ptr %115, align 4, !tbaa !22
  store i32 %116, ptr %9, align 4, !tbaa !9
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.FATFS, ptr %118, i32 0, i32 25
  %120 = getelementptr inbounds [512 x i8], ptr %119, i64 0, i64 0
  %121 = getelementptr inbounds i8, ptr %120, i64 32
  %122 = load i32, ptr %9, align 4, !tbaa !9
  call void @st_clust(ptr noundef %117, ptr noundef %121, i32 noundef %122)
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.FATFS, ptr %123, i32 0, i32 4
  store i8 1, ptr %124, align 4, !tbaa !23
  br label %125

125:                                              ; preds = %83, %77
  %126 = call i32 @dir_register(ptr noundef %6)
  store i32 %126, ptr %4, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %125, %71
  br label %128

128:                                              ; preds = %127, %67
  %129 = load i32, ptr %4, align 4, !tbaa !9
  %130 = icmp eq i32 %129, 0
  br i1 %130, label %131, label %196

131:                                              ; preds = %128
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.FATFS, ptr %132, i32 0, i32 0
  %134 = load i8, ptr %133, align 8, !tbaa !21
  %135 = zext i8 %134 to i32
  %136 = icmp eq i32 %135, 4
  br i1 %136, label %137, label %175

137:                                              ; preds = %131
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.FATFS, ptr %138, i32 0, i32 10
  %140 = load ptr, ptr %139, align 8, !tbaa !18
  %141 = getelementptr inbounds i8, ptr %140, i64 12
  %142 = load i32, ptr %10, align 4, !tbaa !9
  call void @st_dword(ptr noundef %141, i32 noundef %142)
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.FATFS, ptr %143, i32 0, i32 10
  %145 = load ptr, ptr %144, align 8, !tbaa !18
  %146 = getelementptr inbounds i8, ptr %145, i64 52
  %147 = load i32, ptr %8, align 4, !tbaa !9
  call void @st_dword(ptr noundef %146, i32 noundef %147)
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.FATFS, ptr %148, i32 0, i32 10
  %150 = load ptr, ptr %149, align 8, !tbaa !18
  %151 = getelementptr inbounds i8, ptr %150, i64 56
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.FATFS, ptr %152, i32 0, i32 8
  %154 = load i16, ptr %153, align 2, !tbaa !24
  %155 = zext i16 %154 to i32
  %156 = mul i32 %155, 512
  call void @st_dword(ptr noundef %151, i32 noundef %156)
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.FATFS, ptr %157, i32 0, i32 10
  %159 = load ptr, ptr %158, align 8, !tbaa !18
  %160 = getelementptr inbounds i8, ptr %159, i64 40
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.FATFS, ptr %161, i32 0, i32 8
  %163 = load i16, ptr %162, align 2, !tbaa !24
  %164 = zext i16 %163 to i32
  %165 = mul i32 %164, 512
  call void @st_dword(ptr noundef %160, i32 noundef %165)
  %166 = load ptr, ptr %5, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.FATFS, ptr %166, i32 0, i32 10
  %168 = load ptr, ptr %167, align 8, !tbaa !18
  %169 = getelementptr inbounds i8, ptr %168, i64 33
  store i8 3, ptr %169, align 1, !tbaa !19
  %170 = load ptr, ptr %5, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.FATFS, ptr %170, i32 0, i32 10
  %172 = load ptr, ptr %171, align 8, !tbaa !18
  %173 = getelementptr inbounds i8, ptr %172, i64 4
  store i8 16, ptr %173, align 1, !tbaa !19
  %174 = call i32 @store_xdir(ptr noundef %6)
  store i32 %174, ptr %4, align 4, !tbaa !9
  br label %189

175:                                              ; preds = %131
  %176 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 4
  %177 = load ptr, ptr %176, align 8, !tbaa !25
  %178 = getelementptr inbounds i8, ptr %177, i64 22
  %179 = load i32, ptr %10, align 4, !tbaa !9
  call void @st_dword(ptr noundef %178, i32 noundef %179)
  %180 = load ptr, ptr %5, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 4
  %182 = load ptr, ptr %181, align 8, !tbaa !25
  %183 = load i32, ptr %8, align 4, !tbaa !9
  call void @st_clust(ptr noundef %180, ptr noundef %182, i32 noundef %183)
  %184 = getelementptr inbounds %struct.DIR, ptr %6, i32 0, i32 4
  %185 = load ptr, ptr %184, align 8, !tbaa !25
  %186 = getelementptr inbounds i8, ptr %185, i64 11
  store i8 16, ptr %186, align 1, !tbaa !19
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.FATFS, ptr %187, i32 0, i32 4
  store i8 1, ptr %188, align 4, !tbaa !23
  br label %189

189:                                              ; preds = %175, %137
  %190 = load i32, ptr %4, align 4, !tbaa !9
  %191 = icmp eq i32 %190, 0
  br i1 %191, label %192, label %195

192:                                              ; preds = %189
  %193 = load ptr, ptr %5, align 8, !tbaa !5
  %194 = call i32 @sync_fs(ptr noundef %193)
  store i32 %194, ptr %4, align 4, !tbaa !9
  br label %195

195:                                              ; preds = %192, %189
  br label %199

196:                                              ; preds = %128
  %197 = load i32, ptr %8, align 4, !tbaa !9
  %198 = call i32 @remove_chain(ptr noundef %7, i32 noundef %197, i32 noundef 0)
  br label %199

199:                                              ; preds = %196, %195
  br label %200

200:                                              ; preds = %199, %49
  %201 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ff_memfree(ptr noundef %201)
  br label %202

202:                                              ; preds = %200, %1
  %203 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %203, ptr %2, align 4
  store i32 1, ptr %12, align 4
  br label %204

204:                                              ; preds = %202, %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 48, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 96, 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
  %205 = load i32, ptr %2, align 4
  ret i32 %205
}

; 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 48, !10, i64 52, !15, i64 56, !6, i64 64, !7, i64 72, !10, i64 84, !6, i64 88}
!13 = !{!"", !6, i64 0, !14, i64 8, !7, i64 10, !7, i64 11, !10, i64 12, !15, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44}
!14 = !{!"short", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !6, i64 16}
!17 = !{!"", !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, !6, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104, !7, i64 112}
!18 = !{!17, !6, i64 24}
!19 = !{!7, !7, i64 0}
!20 = !{!13, !6, i64 0}
!21 = !{!17, !7, i64 0}
!22 = !{!12, !10, i64 12}
!23 = !{!17, !7, i64 4}
!24 = !{!17, !14, i64 10}
!25 = !{!12, !6, i64 64}


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

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

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

declare i32 @get_fattime() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @store_xdir(ptr 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: nounwind uwtable
declare hidden void @st_clust(ptr noundef, 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) #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 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 96, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 48, 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 %107

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 1120) #5
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %107, label %11

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

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

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

36:                                               ; preds = %32
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = load i8, ptr %37, align 8, !tbaa !19
  %.not33 = icmp eq i8 %38, 4
  br i1 %.not33, label %54, label %39

39:                                               ; preds = %36
  %40 = getelementptr inbounds i8, ptr %37, i64 112
  %41 = getelementptr inbounds i8, ptr %37, i64 113
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(11) %41, i8 32, i64 10, i1 false)
  store i8 46, ptr %40, align 8, !tbaa !20
  %42 = getelementptr inbounds i8, ptr %37, i64 123
  store i8 16, ptr %42, align 1, !tbaa !20
  %43 = getelementptr inbounds i8, ptr %37, i64 134
  call void @st_dword(ptr noundef nonnull %43, i32 noundef %30)
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 112
  call void @st_clust(ptr noundef %44, ptr noundef nonnull %45, i32 noundef %26)
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 112
  %48 = getelementptr inbounds i8, ptr %46, i64 144
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) %48, ptr noundef nonnull align 8 dereferenceable(32) %47, i64 32, i1 false)
  %49 = getelementptr inbounds i8, ptr %46, i64 145
  store i8 46, ptr %49, align 1, !tbaa !20
  %50 = getelementptr inbounds i8, ptr %4, i64 12
  %51 = load i32, ptr %50, align 4, !tbaa !21
  call void @st_clust(ptr noundef %46, ptr noundef nonnull %48, i32 noundef %51)
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %52, i64 4
  store i8 1, ptr %53, align 4, !tbaa !22
  br label %54

54:                                               ; preds = %36, %39
  %55 = call i32 @dir_register(ptr noundef nonnull %4)
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %.thread

57:                                               ; preds = %54
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = load i8, ptr %58, align 8, !tbaa !19
  %60 = icmp eq i8 %59, 4
  br i1 %60, label %70, label %.thread36

.thread36:                                        ; preds = %57
  %61 = getelementptr inbounds i8, ptr %4, i64 64
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  %63 = getelementptr inbounds i8, ptr %62, i64 22
  call void @st_dword(ptr noundef nonnull %63, i32 noundef %30)
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = load ptr, ptr %61, align 8, !tbaa !23
  call void @st_clust(ptr noundef %64, ptr noundef %65, i32 noundef %26)
  %66 = load ptr, ptr %61, align 8, !tbaa !23
  %67 = getelementptr inbounds i8, ptr %66, i64 11
  store i8 16, ptr %67, align 1, !tbaa !20
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i64 4
  store i8 1, ptr %69, align 4, !tbaa !22
  br label %102

70:                                               ; preds = %57
  %71 = getelementptr inbounds i8, ptr %58, i64 24
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  %73 = getelementptr inbounds i8, ptr %72, i64 12
  call void @st_dword(ptr noundef nonnull %73, i32 noundef %30)
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %74, i64 24
  %76 = load ptr, ptr %75, align 8, !tbaa !17
  %77 = getelementptr inbounds i8, ptr %76, i64 52
  call void @st_dword(ptr noundef nonnull %77, i32 noundef %26)
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 24
  %80 = load ptr, ptr %79, align 8, !tbaa !17
  %81 = getelementptr inbounds i8, ptr %80, i64 56
  %82 = getelementptr inbounds i8, ptr %78, i64 10
  %83 = load i16, ptr %82, align 2, !tbaa !24
  %84 = zext i16 %83 to i32
  %85 = shl nuw nsw i32 %84, 9
  call void @st_dword(ptr noundef nonnull %81, i32 noundef %85)
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds i8, ptr %86, i64 24
  %88 = load ptr, ptr %87, align 8, !tbaa !17
  %89 = getelementptr inbounds i8, ptr %88, i64 40
  %90 = getelementptr inbounds i8, ptr %86, i64 10
  %91 = load i16, ptr %90, align 2, !tbaa !24
  %92 = zext i16 %91 to i32
  %93 = shl nuw nsw i32 %92, 9
  call void @st_dword(ptr noundef nonnull %89, i32 noundef %93)
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds i8, ptr %94, i64 24
  %96 = load ptr, ptr %95, align 8, !tbaa !17
  %97 = getelementptr inbounds i8, ptr %96, i64 33
  store i8 3, ptr %97, align 1, !tbaa !20
  %98 = load ptr, ptr %95, align 8, !tbaa !17
  %99 = getelementptr inbounds i8, ptr %98, i64 4
  store i8 16, ptr %99, align 1, !tbaa !20
  %100 = call i32 @store_xdir(ptr noundef nonnull %4)
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %._crit_edge, label %106

._crit_edge:                                      ; preds = %70
  %.pre = load ptr, ptr %3, align 8, !tbaa !5
  br label %102

102:                                              ; preds = %._crit_edge, %.thread36
  %103 = phi ptr [ %.pre, %._crit_edge ], [ %68, %.thread36 ]
  %104 = call i32 @sync_fs(ptr noundef %103)
  br label %106

.thread:                                          ; preds = %24, %32, %54
  %.135 = phi i32 [ %55, %54 ], [ %spec.store.select3, %24 ], [ %34, %32 ]
  %105 = call i32 @remove_chain(ptr noundef nonnull %5, i32 noundef %26, i32 noundef 0)
  br label %106

106:                                              ; preds = %.thread, %102, %70, %11
  %.3 = phi i32 [ %104, %102 ], [ %100, %70 ], [ %.135, %.thread ], [ %.028, %11 ]
  call void @ff_memfree(ptr noundef nonnull %10) #5
  br label %107

107:                                              ; preds = %1, %106, %8
  %.0 = phi i32 [ 17, %8 ], [ %.3, %106 ], [ %6, %1 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 96, 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 48, !13, i64 52, !14, i64 56, !6, i64 64, !7, i64 72, !13, i64 84, !6, i64 88}
!11 = !{!"", !6, i64 0, !12, i64 8, !7, i64 10, !7, i64 11, !13, i64 12, !14, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44}
!12 = !{!"short", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"long", !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, !12, i64 6, !12, i64 8, !12, i64 10, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !7, i64 112}
!17 = !{!16, !6, i64 24}
!18 = !{!11, !6, i64 0}
!19 = !{!16, !7, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{!10, !13, i64 12}
!22 = !{!16, !7, i64 4}
!23 = !{!10, !6, i64 64}
!24 = !{!16, !12, i64 10}


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