; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/Middlewares/Third_Party/FatFs/src (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._FDID, i64, i64, i64, ptr, [12 x i8], i64 }
%struct._FDID = type { ptr, i16, i8, i8, i64, i64 }

; 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 @find_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

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

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

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

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

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

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

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

14:                                               ; preds = %1
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = call i32 @follow_path(ptr noundef %4, ptr noundef %15)
  store i32 %16, ptr %3, align 4, !tbaa !11
  %17 = load i32, ptr %3, align 4, !tbaa !11
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %94

19:                                               ; preds = %14
  %20 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 5
  %21 = getelementptr inbounds [12 x i8], ptr %20, i64 0, i64 11
  %22 = load i8, ptr %21, align 1, !tbaa !17
  %23 = zext i8 %22 to i32
  %24 = and i32 %23, 128
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %19
  store i32 6, ptr %3, align 4, !tbaa !11
  br label %36

27:                                               ; preds = %19
  %28 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %29 = getelementptr inbounds %struct._FDID, ptr %28, i32 0, i32 2
  %30 = load i8, ptr %29, align 2, !tbaa !18
  %31 = zext i8 %30 to i32
  %32 = and i32 %31, 1
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %35

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

35:                                               ; preds = %34, %27
  br label %36

36:                                               ; preds = %35, %26
  %37 = load i32, ptr %3, align 4, !tbaa !11
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %72

39:                                               ; preds = %36
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 4
  %42 = load ptr, ptr %41, align 8, !tbaa !19
  %43 = call i64 @ld_clust(ptr noundef %40, ptr noundef %42)
  store i64 %43, ptr %6, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %45 = getelementptr inbounds %struct._FDID, ptr %44, i32 0, i32 2
  %46 = load i8, ptr %45, align 2, !tbaa !18
  %47 = zext i8 %46 to i32
  %48 = and i32 %47, 16
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %71

50:                                               ; preds = %39
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.DIR, ptr %5, i32 0, i32 0
  %53 = getelementptr inbounds %struct._FDID, ptr %52, i32 0, i32 0
  store ptr %51, ptr %53, align 8, !tbaa !13
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.DIR, ptr %5, i32 0, i32 0
  %56 = getelementptr inbounds %struct._FDID, ptr %55, i32 0, i32 4
  store i64 %54, ptr %56, align 8, !tbaa !20
  %57 = call i32 @dir_sdi(ptr noundef %5, i64 noundef 0)
  store i32 %57, ptr %3, align 4, !tbaa !11
  %58 = load i32, ptr %3, align 4, !tbaa !11
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %70

60:                                               ; preds = %50
  %61 = call i32 @dir_read(ptr noundef %5, i32 noundef 0)
  store i32 %61, ptr %3, align 4, !tbaa !11
  %62 = load i32, ptr %3, align 4, !tbaa !11
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %60
  store i32 7, ptr %3, align 4, !tbaa !11
  br label %65

65:                                               ; preds = %64, %60
  %66 = load i32, ptr %3, align 4, !tbaa !11
  %67 = icmp eq i32 %66, 4
  br i1 %67, label %68, label %69

68:                                               ; preds = %65
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %69

69:                                               ; preds = %68, %65
  br label %70

70:                                               ; preds = %69, %50
  br label %71

71:                                               ; preds = %70, %39
  br label %72

72:                                               ; preds = %71, %36
  %73 = load i32, ptr %3, align 4, !tbaa !11
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %93

75:                                               ; preds = %72
  %76 = call i32 @dir_remove(ptr noundef %4)
  store i32 %76, ptr %3, align 4, !tbaa !11
  %77 = load i32, ptr %3, align 4, !tbaa !11
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %86

79:                                               ; preds = %75
  %80 = load i64, ptr %6, align 8, !tbaa !9
  %81 = icmp ne i64 %80, 0
  br i1 %81, label %82, label %86

82:                                               ; preds = %79
  %83 = getelementptr inbounds %struct.DIR, ptr %4, i32 0, i32 0
  %84 = load i64, ptr %6, align 8, !tbaa !9
  %85 = call i32 @remove_chain(ptr noundef %83, i64 noundef %84, i64 noundef 0)
  store i32 %85, ptr %3, align 4, !tbaa !11
  br label %86

86:                                               ; preds = %82, %79, %75
  %87 = load i32, ptr %3, align 4, !tbaa !11
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %92

89:                                               ; preds = %86
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = call i32 @sync_fs(ptr noundef %90)
  store i32 %91, ptr %3, align 4, !tbaa !11
  br label %92

92:                                               ; preds = %89, %86
  br label %93

93:                                               ; preds = %92, %72
  br label %94

94:                                               ; preds = %93, %14
  br label %95

95:                                               ; preds = %94, %1
  %96 = load i32, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 88, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 88, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret i32 %96
}

; Function Attrs: nounwind uwtable
declare hidden i32 @dir_remove(ptr 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 = { 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 0}
!14 = !{!"", !15, i64 0, !10, i64 32, !10, i64 40, !10, i64 48, !6, i64 56, !7, i64 64, !10, i64 80}
!15 = !{!"", !6, i64 0, !16, i64 8, !7, i64 10, !7, i64 11, !10, i64 16, !10, i64 24}
!16 = !{!"short", !7, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!14, !7, i64 10}
!19 = !{!14, !6, i64 56}
!20 = !{!14, !10, i64 16}


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

; 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 @find_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

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

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

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

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

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

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

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

9:                                                ; preds = %1
  %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
  br i1 %12, label %13, label %.thread24

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %3, i64 75
  %15 = load i8, ptr %14, align 1, !tbaa !14
  %.not = icmp sgt i8 %15, -1
  br i1 %.not, label %16, label %.thread24

16:                                               ; preds = %13
  %17 = getelementptr inbounds i8, ptr %3, i64 10
  %18 = load i8, ptr %17, align 2, !tbaa !15
  %19 = and i8 %18, 1
  %.not20 = icmp eq i8 %19, 0
  br i1 %.not20, label %20, label %.thread24

20:                                               ; preds = %16
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %3, i64 56
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  %24 = call i64 @ld_clust(ptr noundef %21, ptr noundef %23)
  %25 = load i8, ptr %17, align 2, !tbaa !15
  %26 = and i8 %25, 16
  %.not21 = icmp eq i8 %26, 0
  br i1 %.not21, label %.thread28, label %27

27:                                               ; preds = %20
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %28, ptr %4, align 8, !tbaa !9
  %29 = getelementptr inbounds i8, ptr %4, i64 16
  store i64 %24, ptr %29, align 8, !tbaa !17
  %30 = call i32 @dir_sdi(ptr noundef nonnull %4, i64 noundef 0)
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %.thread24

32:                                               ; preds = %27
  %33 = call i32 @dir_read(ptr noundef nonnull %4, i32 noundef 0)
  %34 = icmp eq i32 %33, 0
  %spec.store.select = select i1 %34, i32 7, i32 %33
  %35 = icmp eq i32 %spec.store.select, 4
  br i1 %35, label %.thread28, label %.thread24

.thread28:                                        ; preds = %32, %20
  %36 = call i32 @dir_remove(ptr noundef nonnull %3)
  %37 = icmp eq i32 %36, 0
  %38 = icmp ne i64 %24, 0
  %or.cond = select i1 %37, i1 %38, i1 false
  br i1 %or.cond, label %39, label %41

39:                                               ; preds = %.thread28
  %40 = call i32 @remove_chain(ptr noundef nonnull %3, i64 noundef %24, i64 noundef 0)
  br label %41

41:                                               ; preds = %39, %.thread28
  %.2 = phi i32 [ %40, %39 ], [ %36, %.thread28 ]
  %42 = icmp eq i32 %.2, 0
  br i1 %42, label %43, label %.thread24

43:                                               ; preds = %41
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = call i32 @sync_fs(ptr noundef %44)
  br label %.thread24

.thread24:                                        ; preds = %16, %13, %27, %32, %9, %41, %43, %1
  %.3 = phi i32 [ %45, %43 ], [ %.2, %41 ], [ %11, %9 ], [ %6, %1 ], [ %30, %27 ], [ %spec.store.select, %32 ], [ 6, %13 ], [ 7, %16 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #2
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %4) #2
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %3) #2
  ret i32 %.3
}

; Function Attrs: nounwind uwtable
declare hidden i32 @dir_remove(ptr 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 = { 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 32, !13, i64 40, !13, i64 48, !6, i64 56, !7, i64 64, !13, i64 80}
!11 = !{!"", !6, i64 0, !12, i64 8, !7, i64 10, !7, i64 11, !13, i64 16, !13, i64 24}
!12 = !{!"short", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !7, i64 10}
!16 = !{!10, !6, i64 56}
!17 = !{!10, !13, i64 16}


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