; LLVM IR from cvra/robot-software :: lib/fatfs (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 { ptr, i16, i16, i64, i64, i64, ptr, ptr }
%struct.FATFS = type { i8, i8, i8, i8, i8, i8, i16, i16, i64, i64, i64, i64, i64, i64, i64, i64, i64, [512 x i8] }

; Function Attrs: nounwind uwtable
declare dso_local i64 @clust2sect(ptr noundef, i64 noundef) #0

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

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

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

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

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

declare i64 @get_fattime() #2

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

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

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

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

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

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

17:                                               ; preds = %1
  %18 = getelementptr inbounds [12 x i8], ptr %11, i64 0, i64 0
  %19 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 7
  store ptr %18, ptr %19, align 8, !tbaa !13
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = call i32 @follow_path(ptr noundef %4, ptr noundef %20)
  store i32 %21, ptr %3, align 4, !tbaa !11
  %22 = load i32, ptr %3, align 4, !tbaa !11
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %17
  store i32 8, ptr %3, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %24, %17
  %26 = load i32, ptr %3, align 4, !tbaa !11
  %27 = icmp eq i32 %26, 4
  br i1 %27, label %28, label %199

28:                                               ; preds = %25
  %29 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = call i64 @create_chain(ptr noundef %30, i64 noundef 0)
  store i64 %31, ptr %8, align 8, !tbaa !9
  store i32 0, ptr %3, align 4, !tbaa !11
  %32 = load i64, ptr %8, align 8, !tbaa !9
  %33 = icmp eq i64 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %28
  store i32 7, ptr %3, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %34, %28
  %36 = load i64, ptr %8, align 8, !tbaa !9
  %37 = icmp eq i64 %36, 1
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  store i32 2, ptr %3, align 4, !tbaa !11
  br label %39

39:                                               ; preds = %38, %35
  %40 = load i64, ptr %8, align 8, !tbaa !9
  %41 = icmp eq i64 %40, 4294967295
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 1, ptr %3, align 4, !tbaa !11
  br label %43

43:                                               ; preds = %42, %39
  %44 = load i32, ptr %3, align 4, !tbaa !11
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %50

46:                                               ; preds = %43
  %47 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !16
  %49 = call i32 @sync_window(ptr noundef %48)
  store i32 %49, ptr %3, align 4, !tbaa !11
  br label %50

50:                                               ; preds = %46, %43
  %51 = load i32, ptr %3, align 4, !tbaa !11
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %148

53:                                               ; preds = %50
  %54 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !16
  %56 = load i64, ptr %8, align 8, !tbaa !9
  %57 = call i64 @clust2sect(ptr noundef %55, i64 noundef %56)
  store i64 %57, ptr %7, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !16
  %60 = getelementptr inbounds %struct.FATFS, ptr %59, i32 0, i32 17
  %61 = getelementptr inbounds [512 x i8], ptr %60, i64 0, i64 0
  store ptr %61, ptr %5, align 8, !tbaa !5
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mem_set(ptr noundef %62, i32 noundef 0, i32 noundef 512)
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %63, i64 0
  call void @mem_set(ptr noundef %64, i32 noundef 32, i32 noundef 11)
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 0
  store i8 46, ptr %66, align 1, !tbaa !17
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 11
  store i8 16, ptr %68, align 1, !tbaa !17
  %69 = load i64, ptr %10, align 8, !tbaa !9
  %70 = trunc i64 %69 to i8
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 22
  store i8 %70, ptr %72, align 1, !tbaa !17
  %73 = load i64, ptr %10, align 8, !tbaa !9
  %74 = trunc i64 %73 to i16
  %75 = zext i16 %74 to i32
  %76 = ashr i32 %75, 8
  %77 = trunc i32 %76 to i8
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 22
  %80 = getelementptr inbounds i8, ptr %79, i64 1
  store i8 %77, ptr %80, align 1, !tbaa !17
  %81 = load i64, ptr %10, align 8, !tbaa !9
  %82 = lshr i64 %81, 16
  %83 = trunc i64 %82 to i8
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %84, i64 22
  %86 = getelementptr inbounds i8, ptr %85, i64 2
  store i8 %83, ptr %86, align 1, !tbaa !17
  %87 = load i64, ptr %10, align 8, !tbaa !9
  %88 = lshr i64 %87, 24
  %89 = trunc i64 %88 to i8
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %90, i64 22
  %92 = getelementptr inbounds i8, ptr %91, i64 3
  store i8 %89, ptr %92, align 1, !tbaa !17
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = load i64, ptr %8, align 8, !tbaa !9
  call void @st_clust(ptr noundef %93, i64 noundef %94)
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds i8, ptr %95, i64 32
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mem_cpy(ptr noundef %96, ptr noundef %97, i32 noundef 32)
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i64 33
  store i8 46, ptr %99, align 1, !tbaa !17
  %100 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 3
  %101 = load i64, ptr %100, align 8, !tbaa !18
  store i64 %101, ptr %9, align 8, !tbaa !9
  %102 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !16
  %104 = getelementptr inbounds %struct.FATFS, ptr %103, i32 0, i32 0
  %105 = load i8, ptr %104, align 8, !tbaa !19
  %106 = zext i8 %105 to i32
  %107 = icmp eq i32 %106, 3
  br i1 %107, label %108, label %116

108:                                              ; preds = %53
  %109 = load i64, ptr %9, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !16
  %112 = getelementptr inbounds %struct.FATFS, ptr %111, i32 0, i32 14
  %113 = load i64, ptr %112, align 8, !tbaa !21
  %114 = icmp eq i64 %109, %113
  br i1 %114, label %115, label %116

115:                                              ; preds = %108
  store i64 0, ptr %9, align 8, !tbaa !9
  br label %116

116:                                              ; preds = %115, %108, %53
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds i8, ptr %117, i64 32
  %119 = load i64, ptr %9, align 8, !tbaa !9
  call void @st_clust(ptr noundef %118, i64 noundef %119)
  %120 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !16
  %122 = getelementptr inbounds %struct.FATFS, ptr %121, i32 0, i32 2
  %123 = load i8, ptr %122, align 2, !tbaa !22
  store i8 %123, ptr %6, align 1, !tbaa !17
  br label %124

124:                                              ; preds = %144, %116
  %125 = load i8, ptr %6, align 1, !tbaa !17
  %126 = icmp ne i8 %125, 0
  br i1 %126, label %127, label %147

127:                                              ; preds = %124
  %128 = load i64, ptr %7, align 8, !tbaa !9
  %129 = add i64 %128, 1
  store i64 %129, ptr %7, align 8, !tbaa !9
  %130 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !16
  %132 = getelementptr inbounds %struct.FATFS, ptr %131, i32 0, i32 16
  store i64 %128, ptr %132, align 8, !tbaa !23
  %133 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !16
  %135 = getelementptr inbounds %struct.FATFS, ptr %134, i32 0, i32 4
  store i8 1, ptr %135, align 4, !tbaa !24
  %136 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !16
  %138 = call i32 @sync_window(ptr noundef %137)
  store i32 %138, ptr %3, align 4, !tbaa !11
  %139 = load i32, ptr %3, align 4, !tbaa !11
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %127
  br label %147

142:                                              ; preds = %127
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mem_set(ptr noundef %143, i32 noundef 0, i32 noundef 512)
  br label %144

144:                                              ; preds = %142
  %145 = load i8, ptr %6, align 1, !tbaa !17
  %146 = add i8 %145, -1
  store i8 %146, ptr %6, align 1, !tbaa !17
  br label %124, !llvm.loop !25

147:                                              ; preds = %141, %124
  br label %148

148:                                              ; preds = %147, %50
  %149 = load i32, ptr %3, align 4, !tbaa !11
  %150 = icmp eq i32 %149, 0
  br i1 %150, label %151, label %153

151:                                              ; preds = %148
  %152 = call i32 @dir_register(ptr noundef %4)
  store i32 %152, ptr %3, align 4, !tbaa !11
  br label %153

153:                                              ; preds = %151, %148
  %154 = load i32, ptr %3, align 4, !tbaa !11
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %156, label %161

156:                                              ; preds = %153
  %157 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %158 = load ptr, ptr %157, align 8, !tbaa !16
  %159 = load i64, ptr %8, align 8, !tbaa !9
  %160 = call i32 @remove_chain(ptr noundef %158, i64 noundef %159)
  br label %198

161:                                              ; preds = %153
  %162 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 6
  %163 = load ptr, ptr %162, align 8, !tbaa !27
  store ptr %163, ptr %5, align 8, !tbaa !5
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds i8, ptr %164, i64 11
  store i8 16, ptr %165, align 1, !tbaa !17
  %166 = load i64, ptr %10, align 8, !tbaa !9
  %167 = trunc i64 %166 to i8
  %168 = load ptr, ptr %5, align 8, !tbaa !5
  %169 = getelementptr inbounds i8, ptr %168, i64 22
  store i8 %167, ptr %169, align 1, !tbaa !17
  %170 = load i64, ptr %10, align 8, !tbaa !9
  %171 = trunc i64 %170 to i16
  %172 = zext i16 %171 to i32
  %173 = ashr i32 %172, 8
  %174 = trunc i32 %173 to i8
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = getelementptr inbounds i8, ptr %175, i64 22
  %177 = getelementptr inbounds i8, ptr %176, i64 1
  store i8 %174, ptr %177, align 1, !tbaa !17
  %178 = load i64, ptr %10, align 8, !tbaa !9
  %179 = lshr i64 %178, 16
  %180 = trunc i64 %179 to i8
  %181 = load ptr, ptr %5, align 8, !tbaa !5
  %182 = getelementptr inbounds i8, ptr %181, i64 22
  %183 = getelementptr inbounds i8, ptr %182, i64 2
  store i8 %180, ptr %183, align 1, !tbaa !17
  %184 = load i64, ptr %10, align 8, !tbaa !9
  %185 = lshr i64 %184, 24
  %186 = trunc i64 %185 to i8
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = getelementptr inbounds i8, ptr %187, i64 22
  %189 = getelementptr inbounds i8, ptr %188, i64 3
  store i8 %186, ptr %189, align 1, !tbaa !17
  %190 = load ptr, ptr %5, align 8, !tbaa !5
  %191 = load i64, ptr %8, align 8, !tbaa !9
  call void @st_clust(ptr noundef %190, i64 noundef %191)
  %192 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %193 = load ptr, ptr %192, align 8, !tbaa !16
  %194 = getelementptr inbounds %struct.FATFS, ptr %193, i32 0, i32 4
  store i8 1, ptr %194, align 4, !tbaa !24
  %195 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8, !tbaa !16
  %197 = call i32 @sync_fs(ptr noundef %196)
  store i32 %197, ptr %3, align 4, !tbaa !11
  br label %198

198:                                              ; preds = %161, %156
  br label %199

199:                                              ; preds = %198, %25
  br label %200

200:                                              ; preds = %199, %1
  %201 = load i32, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 56, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 %201
}

; Function Attrs: nounwind uwtable
declare hidden i32 @sync_window(ptr noundef) #0

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 48}
!14 = !{!"", !6, i64 0, !15, i64 8, !15, i64 10, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !6, i64 48}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !6, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!14, !10, i64 16}
!19 = !{!20, !7, i64 0}
!20 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !15, i64 6, !15, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !7, i64 88}
!21 = !{!20, !10, i64 64}
!22 = !{!20, !7, i64 2}
!23 = !{!20, !10, i64 80}
!24 = !{!20, !7, i64 4}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!14, !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 { ptr, i16, i16, i64, i64, i64, ptr, ptr }

; Function Attrs: nounwind uwtable
declare dso_local i64 @clust2sect(ptr noundef, i64 noundef) local_unnamed_addr #0

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

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

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

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

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

declare i64 @get_fattime() local_unnamed_addr #2

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @f_mkdir(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.DIR, align 8
  %4 = alloca [12 x i8], align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #3
  %5 = tail call i64 @get_fattime() #3
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #3
  %6 = call i32 @find_volume(ptr noundef nonnull %3, ptr noundef nonnull %2, i8 noundef zeroext 1)
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %78

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %3, i64 48
  store ptr %4, ptr %9, align 8, !tbaa !9
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call i32 @follow_path(ptr noundef nonnull %3, ptr noundef %10)
  %12 = icmp eq i32 %11, 0
  %spec.store.select = select i1 %12, i32 8, i32 %11
  %13 = icmp eq i32 %spec.store.select, 4
  br i1 %13, label %14, label %78

14:                                               ; preds = %8
  %15 = load ptr, ptr %3, align 8, !tbaa !13
  %16 = call i64 @create_chain(ptr noundef %15, i64 noundef 0)
  %17 = icmp eq i64 %16, 0
  %spec.store.select1 = select i1 %17, i32 7, i32 0
  %18 = icmp eq i64 %16, 1
  %spec.store.select3 = select i1 %18, i32 2, i32 %spec.store.select1
  %19 = icmp eq i64 %16, 4294967295
  %spec.store.select4 = select i1 %19, i32 1, i32 %spec.store.select3
  %20 = icmp eq i32 %spec.store.select4, 0
  br i1 %20, label %21, label %.thread63

21:                                               ; preds = %14
  %22 = load ptr, ptr %3, align 8, !tbaa !13
  %23 = call i32 @sync_window(ptr noundef %22)
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %.thread63

25:                                               ; preds = %21
  %26 = load ptr, ptr %3, align 8, !tbaa !13
  %27 = call i64 @clust2sect(ptr noundef %26, i64 noundef %16)
  %28 = load ptr, ptr %3, align 8, !tbaa !13
  %29 = getelementptr inbounds i8, ptr %28, i64 88
  call void @mem_set(ptr noundef nonnull %29, i32 noundef 0, i32 noundef 512)
  call void @mem_set(ptr noundef nonnull %29, i32 noundef 32, i32 noundef 11)
  store i8 46, ptr %29, align 1, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %28, i64 99
  store i8 16, ptr %30, align 1, !tbaa !14
  %31 = trunc i64 %5 to i8
  %32 = getelementptr inbounds i8, ptr %28, i64 110
  store i8 %31, ptr %32, align 1, !tbaa !14
  %33 = lshr i64 %5, 8
  %34 = trunc i64 %33 to i8
  %35 = getelementptr inbounds i8, ptr %28, i64 111
  store i8 %34, ptr %35, align 1, !tbaa !14
  %36 = lshr i64 %5, 16
  %37 = trunc i64 %36 to i8
  %38 = getelementptr inbounds i8, ptr %28, i64 112
  store i8 %37, ptr %38, align 1, !tbaa !14
  %39 = lshr i64 %5, 24
  %40 = trunc i64 %39 to i8
  %41 = getelementptr inbounds i8, ptr %28, i64 113
  store i8 %40, ptr %41, align 1, !tbaa !14
  call void @st_clust(ptr noundef nonnull %29, i64 noundef %16)
  %42 = getelementptr inbounds i8, ptr %28, i64 120
  call void @mem_cpy(ptr noundef nonnull %42, ptr noundef nonnull %29, i32 noundef 32)
  %43 = getelementptr inbounds i8, ptr %28, i64 121
  store i8 46, ptr %43, align 1, !tbaa !14
  %44 = getelementptr inbounds i8, ptr %3, i64 16
  %45 = load i64, ptr %44, align 8, !tbaa !15
  %46 = load ptr, ptr %3, align 8, !tbaa !13
  %47 = load i8, ptr %46, align 8, !tbaa !16
  %48 = icmp eq i8 %47, 3
  br i1 %48, label %49, label %53

49:                                               ; preds = %25
  %50 = getelementptr inbounds i8, ptr %46, i64 64
  %51 = load i64, ptr %50, align 8, !tbaa !18
  %52 = icmp eq i64 %45, %51
  %spec.store.select2 = select i1 %52, i64 0, i64 %45
  br label %53

53:                                               ; preds = %49, %25
  %.052 = phi i64 [ %spec.store.select2, %49 ], [ %45, %25 ]
  call void @st_clust(ptr noundef nonnull %42, i64 noundef %.052)
  %54 = load ptr, ptr %3, align 8, !tbaa !13
  %55 = getelementptr inbounds i8, ptr %54, i64 2
  %56 = load i8, ptr %55, align 2, !tbaa !19
  %.not67 = icmp eq i8 %56, 0
  br i1 %.not67, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %53, %61
  %.05369 = phi i64 [ %62, %61 ], [ %27, %53 ]
  %.05468 = phi i8 [ %63, %61 ], [ %56, %53 ]
  %57 = load ptr, ptr %3, align 8, !tbaa !13
  %58 = getelementptr inbounds i8, ptr %57, i64 80
  store i64 %.05369, ptr %58, align 8, !tbaa !20
  %59 = getelementptr inbounds i8, ptr %57, i64 4
  store i8 1, ptr %59, align 4, !tbaa !21
  %60 = call i32 @sync_window(ptr noundef %57)
  %.not58 = icmp eq i32 %60, 0
  br i1 %.not58, label %61, label %.thread63

61:                                               ; preds = %.lr.ph
  %62 = add i64 %.05369, 1
  call void @mem_set(ptr noundef nonnull %29, i32 noundef 0, i32 noundef 512)
  %63 = add i8 %.05468, -1
  %.not = icmp eq i8 %63, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !22

._crit_edge:                                      ; preds = %61, %53
  %64 = call i32 @dir_register(ptr noundef nonnull %3)
  %.not59 = icmp eq i32 %64, 0
  br i1 %.not59, label %67, label %.thread63

.thread63:                                        ; preds = %.lr.ph, %21, %14, %._crit_edge
  %.366 = phi i32 [ %64, %._crit_edge ], [ %23, %21 ], [ %spec.store.select4, %14 ], [ %60, %.lr.ph ]
  %65 = load ptr, ptr %3, align 8, !tbaa !13
  %66 = call i32 @remove_chain(ptr noundef %65, i64 noundef %16)
  br label %78

67:                                               ; preds = %._crit_edge
  %68 = getelementptr inbounds i8, ptr %3, i64 40
  %69 = load ptr, ptr %68, align 8, !tbaa !24
  %70 = getelementptr inbounds i8, ptr %69, i64 11
  store i8 16, ptr %70, align 1, !tbaa !14
  %71 = getelementptr inbounds i8, ptr %69, i64 22
  store i8 %31, ptr %71, align 1, !tbaa !14
  %72 = getelementptr inbounds i8, ptr %69, i64 23
  store i8 %34, ptr %72, align 1, !tbaa !14
  %73 = getelementptr inbounds i8, ptr %69, i64 24
  store i8 %37, ptr %73, align 1, !tbaa !14
  %74 = getelementptr inbounds i8, ptr %69, i64 25
  store i8 %40, ptr %74, align 1, !tbaa !14
  call void @st_clust(ptr noundef %69, i64 noundef %16)
  %75 = load ptr, ptr %3, align 8, !tbaa !13
  %76 = getelementptr inbounds i8, ptr %75, i64 4
  store i8 1, ptr %76, align 4, !tbaa !21
  %77 = call i32 @sync_fs(ptr noundef %75)
  br label %78

78:                                               ; preds = %8, %67, %.thread63, %1
  %.4 = phi i32 [ %.366, %.thread63 ], [ %77, %67 ], [ %spec.store.select, %8 ], [ %6, %1 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #3
  ret i32 %.4
}

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 48}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 10, !12, i64 16, !12, i64 24, !12, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"short", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !6, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !12, i64 16}
!16 = !{!17, !7, i64 0}
!17 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !11, i64 6, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !7, i64 88}
!18 = !{!17, !12, i64 64}
!19 = !{!17, !7, i64 2}
!20 = !{!17, !12, i64 80}
!21 = !{!17, !7, i64 4}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!10, !6, i64 40}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass