; LLVM IR from kmxz/overlayfs-tools :: logic (traverse)

; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }
%struct._ftsent = type { ptr, ptr, ptr, i64, ptr, ptr, ptr, i32, i32, i16, i16, i64, i64, i64, i16, i16, i16, i16, ptr, [1 x i8] }

@stderr = external global ptr, align 8
@.str.25 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [20 x i8], align 1

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #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
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare ptr @fts_open(ptr noundef, i32 noundef, ptr noundef) #3

declare ptr @fts_read(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @fts_set(ptr noundef, ptr noundef, i32 noundef) #2

declare i32 @fts_close(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @traverse(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #4 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca [2 x ptr], align 16
  %20 = alloca [4096 x i8], align 16
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  %28 = alloca %struct.stat, align 8
  %29 = alloca i8, align 1
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !5
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #7
  %30 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %30, ptr %19, align 8, !tbaa !5
  %31 = getelementptr inbounds ptr, ptr %19, i64 1
  store ptr null, ptr %31, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4096, ptr %20) #7
  %32 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 0
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = call ptr @strcpy(ptr noundef %32, ptr noundef %33) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = call i64 @strlen(ptr noundef %35) #8
  store i64 %36, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = call i64 @strlen(ptr noundef %37) #8
  store i64 %38, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %39 = getelementptr inbounds [2 x ptr], ptr %19, i64 0, i64 0
  %40 = call ptr @fts_open(ptr noundef %39, i32 noundef 20, ptr noundef null)
  store ptr %40, ptr %23, align 8, !tbaa !5
  %41 = load ptr, ptr %23, align 8, !tbaa !5
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %44

43:                                               ; preds = %8
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %164

44:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  store i32 0, ptr %25, align 4, !tbaa !11
  br label %45

45:                                               ; preds = %148, %44
  %46 = load i32, ptr %25, align 4, !tbaa !11
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %52

48:                                               ; preds = %45
  %49 = load ptr, ptr %23, align 8, !tbaa !5
  %50 = call ptr @fts_read(ptr noundef %49)
  store ptr %50, ptr %18, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br label %52

52:                                               ; preds = %48, %45
  %53 = phi i1 [ false, %45 ], [ %51, %48 ]
  br i1 %53, label %54, label %149

54:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  store ptr null, ptr %26, align 8, !tbaa !5
  %55 = load ptr, ptr %18, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._ftsent, ptr %55, i32 0, i32 15
  %57 = load i16, ptr %56, align 2, !tbaa !13
  %58 = zext i16 %57 to i32
  switch i32 %58, label %81 [
    i32 1, label %59
    i32 6, label %61
    i32 8, label %63
    i32 12, label %65
    i32 3, label %67
  ]

59:                                               ; preds = %54
  %60 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %60, ptr %26, align 8, !tbaa !5
  br label %87

61:                                               ; preds = %54
  %62 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %62, ptr %26, align 8, !tbaa !5
  br label %87

63:                                               ; preds = %54
  %64 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %64, ptr %26, align 8, !tbaa !5
  br label %87

65:                                               ; preds = %54
  %66 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %66, ptr %26, align 8, !tbaa !5
  br label %87

67:                                               ; preds = %54
  %68 = load ptr, ptr %18, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._ftsent, ptr %68, i32 0, i32 18
  %70 = load ptr, ptr %69, align 8, !tbaa !16
  %71 = call zeroext i1 @is_whiteout(ptr noundef %70)
  br i1 %71, label %72, label %74

72:                                               ; preds = %67
  %73 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %73, ptr %26, align 8, !tbaa !5
  br label %80

74:                                               ; preds = %67
  store i32 -1, ptr %25, align 4, !tbaa !11
  %75 = load ptr, ptr @stderr, align 8, !tbaa !5
  %76 = load ptr, ptr %18, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._ftsent, ptr %76, i32 0, i32 6
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef @.str.25, ptr noundef %78) #7
  br label %80

80:                                               ; preds = %74, %72
  br label %87

81:                                               ; preds = %54
  store i32 -1, ptr %25, align 4, !tbaa !11
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = load ptr, ptr %18, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._ftsent, ptr %83, i32 0, i32 6
  %85 = load ptr, ptr %84, align 8, !tbaa !17
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.26, ptr noundef %85) #7
  br label %87

87:                                               ; preds = %81, %80, %65, %63, %61, %59
  %88 = load ptr, ptr %26, align 8, !tbaa !5
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %145

90:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  store i32 0, ptr %27, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 144, ptr %28) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #7
  store i8 1, ptr %29, align 1, !tbaa !18
  %91 = load i64, ptr %22, align 8, !tbaa !9
  %92 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 %91
  %93 = load ptr, ptr %18, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._ftsent, ptr %93, i32 0, i32 6
  %95 = load ptr, ptr %94, align 8, !tbaa !17
  %96 = load i64, ptr %21, align 8, !tbaa !9
  %97 = getelementptr inbounds i8, ptr %95, i64 %96
  %98 = call ptr @strcpy(ptr noundef %92, ptr noundef %97) #7
  %99 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 0
  %100 = call i32 @lstat(ptr noundef %99, ptr noundef %28) #7
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %116

102:                                              ; preds = %90
  %103 = call ptr @__errno_location() #9
  %104 = load i32, ptr %103, align 4, !tbaa !11
  %105 = icmp eq i32 %104, 2
  br i1 %105, label %110, label %106

106:                                              ; preds = %102
  %107 = call ptr @__errno_location() #9
  %108 = load i32, ptr %107, align 4, !tbaa !11
  %109 = icmp eq i32 %108, 20
  br i1 %109, label %110, label %111

110:                                              ; preds = %106, %102
  store i8 0, ptr %29, align 1, !tbaa !18
  br label %115

111:                                              ; preds = %106
  %112 = load ptr, ptr @stderr, align 8, !tbaa !5
  %113 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 0
  %114 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %112, ptr noundef @.str.27, ptr noundef %113) #7
  store i32 -1, ptr %25, align 4, !tbaa !11
  store i32 3, ptr %24, align 4
  br label %142

115:                                              ; preds = %110
  br label %116

116:                                              ; preds = %115, %90
  %117 = load ptr, ptr %26, align 8, !tbaa !5
  %118 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 0
  %119 = load ptr, ptr %18, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._ftsent, ptr %119, i32 0, i32 6
  %121 = load ptr, ptr %120, align 8, !tbaa !17
  %122 = load i64, ptr %22, align 8, !tbaa !9
  %123 = load i8, ptr %29, align 1, !tbaa !18, !range !20, !noundef !21
  %124 = trunc i8 %123 to i1
  br i1 %124, label %125, label %126

125:                                              ; preds = %116
  br label %127

126:                                              ; preds = %116
  br label %127

127:                                              ; preds = %126, %125
  %128 = phi ptr [ %28, %125 ], [ null, %126 ]
  %129 = load ptr, ptr %18, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct._ftsent, ptr %129, i32 0, i32 18
  %131 = load ptr, ptr %130, align 8, !tbaa !16
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = call i32 %117(ptr noundef %118, ptr noundef %121, i64 noundef %122, ptr noundef %128, ptr noundef %131, ptr noundef %132, ptr noundef %27)
  store i32 %133, ptr %25, align 4, !tbaa !11
  %134 = load i32, ptr %27, align 4, !tbaa !11
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %141

136:                                              ; preds = %127
  %137 = load ptr, ptr %23, align 8, !tbaa !5
  %138 = load ptr, ptr %18, align 8, !tbaa !5
  %139 = load i32, ptr %27, align 4, !tbaa !11
  %140 = call i32 @fts_set(ptr noundef %137, ptr noundef %138, i32 noundef %139) #7
  br label %141

141:                                              ; preds = %136, %127
  store i32 0, ptr %24, align 4
  br label %142

142:                                              ; preds = %141, %111
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 144, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  %143 = load i32, ptr %24, align 4
  switch i32 %143, label %146 [
    i32 0, label %144
  ]

144:                                              ; preds = %142
  br label %145

145:                                              ; preds = %144, %87
  store i32 0, ptr %24, align 4
  br label %146

146:                                              ; preds = %145, %142
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  %147 = load i32, ptr %24, align 4
  switch i32 %147, label %166 [
    i32 0, label %148
    i32 3, label %149
  ]

148:                                              ; preds = %146
  br label %45, !llvm.loop !22

149:                                              ; preds = %146, %52
  %150 = call ptr @__errno_location() #9
  %151 = load i32, ptr %150, align 4, !tbaa !11
  %152 = icmp ne i32 %151, 0
  br i1 %152, label %153, label %154

153:                                              ; preds = %149
  store i32 -1, ptr %25, align 4, !tbaa !11
  br label %154

154:                                              ; preds = %153, %149
  %155 = load ptr, ptr %23, align 8, !tbaa !5
  %156 = call i32 @fts_close(ptr noundef %155)
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %161, label %158

158:                                              ; preds = %154
  %159 = load i32, ptr %25, align 4, !tbaa !11
  %160 = icmp ne i32 %159, 0
  br label %161

161:                                              ; preds = %158, %154
  %162 = phi i1 [ true, %154 ], [ %160, %158 ]
  %163 = zext i1 %162 to i32
  store i32 %163, ptr %9, align 4
  store i32 1, ptr %24, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %164

164:                                              ; preds = %161, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %165 = load i32, ptr %9, align 4
  ret i32 %165

166:                                              ; preds = %146
  unreachable
}

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @is_whiteout(ptr noundef) #6

; Function Attrs: nounwind
declare i32 @lstat(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind willreturn memory(none) "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 "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 = { "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 #4 = { 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 #5 = { nounwind willreturn memory(read) "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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind willreturn memory(none) }

!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, !15, i64 98}
!14 = !{!"_ftsent", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !12, i64 56, !12, i64 60, !15, i64 64, !15, i64 66, !10, i64 72, !10, i64 80, !10, i64 88, !15, i64 96, !15, i64 98, !15, i64 100, !15, i64 102, !6, i64 104, !7, i64 112}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !6, i64 104}
!17 = !{!14, !6, i64 48}
!18 = !{!19, !19, i64 0}
!19 = !{!"_Bool", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; 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.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.25 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [20 x i8], align 1

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare ptr @fts_open(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare ptr @fts_read(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @fts_set(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @fts_close(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @traverse(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr noundef readonly %3, ptr noundef readonly %4, ptr noundef readonly %5, ptr noundef readonly %6, ptr noundef readonly %7) local_unnamed_addr #5 {
  %9 = alloca [2 x ptr], align 16
  %10 = alloca [4096 x i8], align 16
  %11 = alloca i32, align 4
  %12 = alloca %struct.stat, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #9
  store ptr %1, ptr %9, align 16, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %10) #9
  %14 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) %0) #9
  %15 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #10
  %16 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #10
  %17 = call ptr @fts_open(ptr noundef nonnull %9, i32 noundef 20, ptr noundef null) #9
  %18 = icmp eq ptr %17, null
  br i1 %18, label %64, label %.preheader

.preheader:                                       ; preds = %8
  %19 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 %16
  br label %20

20:                                               ; preds = %.preheader, %.thread
  %21 = call ptr @fts_read(ptr noundef nonnull %17) #9
  %.not.not = icmp ne ptr %21, null
  br i1 %.not.not, label %22, label %.critedge.loopexit

22:                                               ; preds = %20
  %23 = getelementptr inbounds i8, ptr %21, i64 98
  %24 = load i16, ptr %23, align 2, !tbaa !9
  switch i16 %24, label %.critedge.loopexit.sink.split [
    i16 1, label %32
    i16 6, label %25
    i16 8, label %26
    i16 12, label %27
    i16 3, label %28
  ]

25:                                               ; preds = %22
  br label %32

26:                                               ; preds = %22
  br label %32

27:                                               ; preds = %22
  br label %32

28:                                               ; preds = %22
  %29 = getelementptr inbounds i8, ptr %21, i64 104
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = call zeroext i1 @is_whiteout(ptr noundef %30)
  br i1 %31, label %32, label %.critedge.loopexit.sink.split

32:                                               ; preds = %28, %22, %27, %26, %25
  %.032 = phi ptr [ %6, %27 ], [ %5, %26 ], [ %4, %25 ], [ %3, %22 ], [ %7, %28 ]
  %.not41 = icmp eq ptr %.032, null
  br i1 %.not41, label %.thread, label %33

33:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #9
  store i32 0, ptr %11, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %12) #9
  %34 = getelementptr inbounds i8, ptr %21, i64 48
  %35 = load ptr, ptr %34, align 8, !tbaa !16
  %36 = getelementptr inbounds i8, ptr %35, i64 %15
  %37 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) %36) #9
  %38 = call i32 @lstat(ptr noundef nonnull %10, ptr noundef nonnull %12) #9
  %.not42 = icmp eq i32 %38, 0
  br i1 %.not42, label %42, label %39

39:                                               ; preds = %33
  %40 = tail call ptr @__errno_location() #11
  %41 = load i32, ptr %40, align 4, !tbaa !15
  switch i32 %41, label %.thread56 [
    i32 2, label %42
    i32 20, label %42
  ]

42:                                               ; preds = %39, %39, %33
  %. = phi ptr [ %12, %33 ], [ null, %39 ], [ null, %39 ]
  %43 = load ptr, ptr %34, align 8, !tbaa !16
  %44 = getelementptr inbounds i8, ptr %21, i64 104
  %45 = load ptr, ptr %44, align 8, !tbaa !14
  %46 = call i32 %.032(ptr noundef nonnull %10, ptr noundef %43, i64 noundef %16, ptr noundef %., ptr noundef %45, ptr noundef %2, ptr noundef nonnull %11) #9
  %47 = load i32, ptr %11, align 4, !tbaa !15
  %.not43 = icmp eq i32 %47, 0
  br i1 %.not43, label %52, label %48

48:                                               ; preds = %42
  %49 = call i32 @fts_set(ptr noundef nonnull %17, ptr noundef nonnull %21, i32 noundef %47) #9
  br label %52

.thread56:                                        ; preds = %39
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str.27, ptr noundef nonnull %10) #12
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #9
  br label %.critedge

52:                                               ; preds = %48, %42
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #9
  br label %.thread

.thread:                                          ; preds = %52, %32
  %.4 = phi i32 [ 0, %32 ], [ %46, %52 ]
  %53 = icmp eq i32 %.4, 0
  br i1 %53, label %20, label %.critedge.loopexit

.critedge.loopexit.sink.split:                    ; preds = %22, %28
  %.str.25.sink = phi ptr [ @.str.25, %28 ], [ @.str.26, %22 ]
  %54 = load ptr, ptr @stderr, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %21, i64 48
  %56 = load ptr, ptr %55, align 8, !tbaa !16
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull %.str.25.sink, ptr noundef %56) #12
  br label %.critedge.loopexit

.critedge.loopexit:                               ; preds = %20, %.thread, %.critedge.loopexit.sink.split
  %.pre = tail call ptr @__errno_location() #11
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.thread56
  %.pre-phi = phi ptr [ %.pre, %.critedge.loopexit ], [ %40, %.thread56 ]
  %58 = load i32, ptr %.pre-phi, align 4, !tbaa !15
  %.not44 = icmp ne i32 %58, 0
  %59 = call i32 @fts_close(ptr noundef nonnull %17) #9
  %60 = icmp ne i32 %59, 0
  %61 = or i1 %.not.not, %.not44
  %62 = select i1 %60, i1 true, i1 %61
  %63 = zext i1 %62 to i32
  br label %64

64:                                               ; preds = %8, %.critedge
  %.036 = phi i32 [ %63, %.critedge ], [ -1, %8 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  ret i32 %.036
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #6

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #7

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @is_whiteout(ptr noundef) local_unnamed_addr #8

; Function Attrs: nofree nounwind
declare noundef i32 @lstat(ptr nocapture noundef readonly, ptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { nofree nounwind "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 = { "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 #4 = { nounwind "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 #5 = { 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 #6 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #8 = { inlinehint 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind willreturn memory(none) }
attributes #12 = { cold 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, !13, i64 98}
!10 = !{!"_ftsent", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !12, i64 56, !12, i64 60, !13, i64 64, !13, i64 66, !11, i64 72, !11, i64 80, !11, i64 88, !13, i64 96, !13, i64 98, !13, i64 100, !13, i64 102, !6, i64 104, !7, i64 112}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 104}
!15 = !{!12, !12, i64 0}
!16 = !{!10, !6, i64 48}


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