; LLVM IR from jspd-group/pegit :: src (tree)

; 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.strbuf = type { i64, i64, ptr }
%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.dirent = type { i64, i64, i16, i8, [256 x i8] }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@__const.for_each_file_in_directory_recurse.complete = external hidden unnamed_addr constant %struct.strbuf, align 8
@.str.15 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [29 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

declare ptr @opendir(ptr noundef) #1

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

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #3

declare ptr @readdir(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @strbuf_addch(ptr noundef, i32 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @strbuf_addstr(ptr noundef, ptr noundef) #4

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #5

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_dir(ptr noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_file(ptr noundef) #4

declare i32 @closedir(ptr noundef) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @strbuf_setlen(ptr noundef, i64 noundef) #4

; 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) #6

declare void @strbuf_release(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @for_each_file_in_directory_recurse(ptr noundef %0, ptr noundef %1) #7 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.stat, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.strbuf, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 144, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 @__const.for_each_file_in_directory_recurse.complete, i64 24, i1 false)
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  call void @strbuf_addstr(ptr noundef %11, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %15 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 2
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = call ptr @opendir(ptr noundef %16)
  store ptr %17, ptr %12, align 8, !tbaa !5
  %18 = load ptr, ptr %12, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %39, label %20

20:                                               ; preds = %2
  br label %21

21:                                               ; preds = %20
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str) #8
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str.1) #8
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.2) #8
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str.3) #8
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 2
  %32 = load ptr, ptr %31, align 8, !tbaa !11
  %33 = call ptr @__errno_location() #9
  %34 = load i32, ptr %33, align 4, !tbaa !9
  %35 = call ptr @strerror(i32 noundef %34) #8
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.15, ptr noundef %32, ptr noundef %35) #8
  br label %37

37:                                               ; preds = %21
  br label %38

38:                                               ; preds = %37
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %174

39:                                               ; preds = %2
  br label %40

40:                                               ; preds = %161, %91, %39
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = call ptr @readdir(ptr noundef %41)
  store ptr %42, ptr %6, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %170

44:                                               ; preds = %40
  call void @strbuf_addch(ptr noundef %11, i32 noundef 47)
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.dirent, ptr %45, i32 0, i32 4
  %47 = getelementptr inbounds [256 x i8], ptr %46, i64 0, i64 0
  call void @strbuf_addstr(ptr noundef %11, ptr noundef %47)
  %48 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 2
  %49 = load ptr, ptr %48, align 8, !tbaa !11
  %50 = call i32 @stat(ptr noundef %49, ptr noundef %7) #8
  store i32 %50, ptr %8, align 4, !tbaa !9
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %53, label %73

53:                                               ; preds = %44
  br label %54

54:                                               ; preds = %53
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str) #8
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.1) #8
  %59 = load ptr, ptr @stderr, align 8, !tbaa !5
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef @.str.2) #8
  %61 = load ptr, ptr @stderr, align 8, !tbaa !5
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.3) #8
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 2
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = call ptr @__errno_location() #9
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = call ptr @strerror(i32 noundef %67) #8
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef @.str.13, ptr noundef %65, ptr noundef %68) #8
  br label %70

70:                                               ; preds = %54
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %72, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %174

73:                                               ; preds = %44
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.dirent, ptr %74, i32 0, i32 4
  %76 = getelementptr inbounds [256 x i8], ptr %75, i64 0, i64 0
  %77 = call i32 @strcmp(ptr noundef %76, ptr noundef @.str.5) #10
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %91

79:                                               ; preds = %73
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.dirent, ptr %80, i32 0, i32 4
  %82 = getelementptr inbounds [256 x i8], ptr %81, i64 0, i64 0
  %83 = call i32 @strcmp(ptr noundef %82, ptr noundef @.str.6) #10
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %91

85:                                               ; preds = %79
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.dirent, ptr %86, i32 0, i32 4
  %88 = getelementptr inbounds [256 x i8], ptr %87, i64 0, i64 0
  %89 = call i32 @strcmp(ptr noundef %88, ptr noundef @.str.16) #10
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %100, label %91

91:                                               ; preds = %85, %79, %73
  %92 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !14
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.dirent, ptr %94, i32 0, i32 4
  %96 = getelementptr inbounds [256 x i8], ptr %95, i64 0, i64 0
  %97 = call i64 @strlen(ptr noundef %96) #10
  %98 = sub i64 %93, %97
  %99 = sub i64 %98, 1
  call void @strbuf_setlen(ptr noundef %11, i64 noundef %99)
  br label %40, !llvm.loop !15

100:                                              ; preds = %85
  %101 = call i32 @is_dir(ptr noundef %7)
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %111

103:                                              ; preds = %100
  %104 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 2
  %105 = load ptr, ptr %104, align 8, !tbaa !11
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = call i32 @for_each_file_in_directory_recurse(ptr noundef %105, ptr noundef %106)
  store i32 %107, ptr %8, align 4, !tbaa !9
  %108 = load i32, ptr %8, align 4, !tbaa !9
  %109 = load i32, ptr %9, align 4, !tbaa !9
  %110 = add nsw i32 %109, %108
  store i32 %110, ptr %9, align 4, !tbaa !9
  br label %161

111:                                              ; preds = %100
  %112 = call i32 @is_file(ptr noundef %7)
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %125

114:                                              ; preds = %111
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 2
  %117 = load ptr, ptr %116, align 8, !tbaa !11
  %118 = call i32 %115(ptr noundef %117)
  store i32 %118, ptr %8, align 4, !tbaa !9
  %119 = load i32, ptr %8, align 4, !tbaa !9
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %124, label %121

121:                                              ; preds = %114
  %122 = load i32, ptr %9, align 4, !tbaa !9
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %9, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %121, %114
  br label %160

125:                                              ; preds = %111
  %126 = load i32, ptr %10, align 4, !tbaa !9
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %10, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %125
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str) #8
  %131 = load ptr, ptr @stderr, align 8, !tbaa !5
  %132 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %131, ptr noundef @.str.1) #8
  %133 = load ptr, ptr @stderr, align 8, !tbaa !5
  %134 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %133, ptr noundef @.str.2) #8
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef @.str.3) #8
  %137 = load ptr, ptr @stderr, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 2
  %139 = load ptr, ptr %138, align 8, !tbaa !11
  %140 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %137, ptr noundef @.str.17, ptr noundef %139) #8
  br label %141

141:                                              ; preds = %128
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %10, align 4, !tbaa !9
  %144 = icmp sgt i32 %143, 10
  br i1 %144, label %145, label %159

145:                                              ; preds = %142
  br label %146

146:                                              ; preds = %145
  %147 = load ptr, ptr @stderr, align 8, !tbaa !5
  %148 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %147, ptr noundef @.str) #8
  %149 = load ptr, ptr @stderr, align 8, !tbaa !5
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %149, ptr noundef @.str.1) #8
  %151 = load ptr, ptr @stderr, align 8, !tbaa !5
  %152 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %151, ptr noundef @.str.2) #8
  %153 = load ptr, ptr @stderr, align 8, !tbaa !5
  %154 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %153, ptr noundef @.str.3) #8
  %155 = load ptr, ptr @stderr, align 8, !tbaa !5
  %156 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %155, ptr noundef @.str.18) #8
  br label %157

157:                                              ; preds = %146
  br label %158

158:                                              ; preds = %157
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %174

159:                                              ; preds = %142
  br label %160

160:                                              ; preds = %159, %124
  br label %161

161:                                              ; preds = %160, %103
  %162 = getelementptr inbounds %struct.strbuf, ptr %11, i32 0, i32 1
  %163 = load i64, ptr %162, align 8, !tbaa !14
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.dirent, ptr %164, i32 0, i32 4
  %166 = getelementptr inbounds [256 x i8], ptr %165, i64 0, i64 0
  %167 = call i64 @strlen(ptr noundef %166) #10
  %168 = sub i64 %163, %167
  %169 = sub i64 %168, 1
  call void @strbuf_setlen(ptr noundef %11, i64 noundef %169)
  br label %40, !llvm.loop !15

170:                                              ; preds = %40
  call void @strbuf_release(ptr noundef %11)
  %171 = load ptr, ptr %12, align 8, !tbaa !5
  %172 = call i32 @closedir(ptr noundef %171)
  %173 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %173, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %174

174:                                              ; preds = %170, %158, %71, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 144, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %175 = load i32, ptr %3, align 4
  ret i32 %175
}

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

!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 16}
!12 = !{!"strbuf", !13, i64 0, !13, i64 8, !6, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"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.strbuf = type { i64, i64, ptr }
%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 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@__const.for_each_file_in_directory_recurse.complete = external hidden unnamed_addr constant %struct.strbuf, align 8
@.str.15 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [29 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: nofree nounwind
declare noalias noundef ptr @opendir(ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #3

declare ptr @readdir(ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @strbuf_addch(ptr noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @strbuf_addstr(ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_dir(ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @is_file(ptr noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @closedir(ptr nocapture noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @strbuf_setlen(ptr noundef, i64 noundef) local_unnamed_addr #5

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

declare void @strbuf_release(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local i32 @for_each_file_in_directory_recurse(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #8 {
  %3 = alloca %struct.stat, align 8
  %4 = alloca %struct.strbuf, align 8
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) @__const.for_each_file_in_directory_recurse.complete, i64 24, i1 false)
  call void @strbuf_addstr(ptr noundef nonnull %4, ptr noundef %0)
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = call ptr @opendir(ptr noundef %6)
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %10, label %.preheader

.preheader:                                       ; preds = %2
  %8 = call ptr @readdir(ptr noundef nonnull %7) #9
  %.not273941 = icmp eq ptr %8, null
  br i1 %.not273941, label %.outer._crit_edge, label %.lr.ph.lr.ph

.lr.ph.lr.ph:                                     ; preds = %.preheader
  %9 = getelementptr inbounds i8, ptr %4, i64 8
  br label %.lr.ph

10:                                               ; preds = %2
  %11 = load ptr, ptr @stderr, align 8, !tbaa !11
  %12 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str) #10
  %13 = load ptr, ptr @stderr, align 8, !tbaa !11
  %14 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.1) #10
  %15 = load ptr, ptr @stderr, align 8, !tbaa !11
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.2) #10
  %17 = load ptr, ptr @stderr, align 8, !tbaa !11
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.3) #10
  %19 = load ptr, ptr @stderr, align 8, !tbaa !11
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = tail call ptr @__errno_location() #11
  %22 = load i32, ptr %21, align 4, !tbaa !12
  %23 = call ptr @strerror(i32 noundef %22) #9
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.15, ptr noundef %20, ptr noundef %23) #10
  br label %102

25:                                               ; preds = %.lr.ph, %52
  %26 = phi ptr [ %100, %.lr.ph ], [ %57, %52 ]
  call void @strbuf_addch(ptr noundef nonnull %4, i32 noundef 47)
  %27 = getelementptr inbounds i8, ptr %26, i64 19
  call void @strbuf_addstr(ptr noundef nonnull %4, ptr noundef nonnull %27)
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = call i32 @stat(ptr noundef %28, ptr noundef nonnull %3) #9
  %30 = icmp slt i32 %29, 0
  br i1 %30, label %31, label %46

31:                                               ; preds = %25
  %32 = load ptr, ptr @stderr, align 8, !tbaa !11
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str) #10
  %34 = load ptr, ptr @stderr, align 8, !tbaa !11
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.1) #10
  %36 = load ptr, ptr @stderr, align 8, !tbaa !11
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.2) #10
  %38 = load ptr, ptr @stderr, align 8, !tbaa !11
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.3) #10
  %40 = load ptr, ptr @stderr, align 8, !tbaa !11
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = tail call ptr @__errno_location() #11
  %43 = load i32, ptr %42, align 4, !tbaa !12
  %44 = call ptr @strerror(i32 noundef %43) #9
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.13, ptr noundef %41, ptr noundef %44) #10
  br label %102

46:                                               ; preds = %25
  %47 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %27, ptr noundef nonnull dereferenceable(1) @.str.5) #12
  %.not28 = icmp eq i32 %47, 0
  br i1 %.not28, label %52, label %48

48:                                               ; preds = %46
  %49 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %27, ptr noundef nonnull dereferenceable(1) @.str.6) #12
  %.not29 = icmp eq i32 %49, 0
  br i1 %.not29, label %52, label %50

50:                                               ; preds = %48
  %51 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %27, ptr noundef nonnull dereferenceable(1) @.str.16) #12
  %.not30 = icmp eq i32 %51, 0
  br i1 %.not30, label %52, label %58

52:                                               ; preds = %50, %48, %46
  %53 = load i64, ptr %9, align 8, !tbaa !14
  %54 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %27) #12
  %55 = xor i64 %54, -1
  %56 = add i64 %53, %55
  call void @strbuf_setlen(ptr noundef nonnull %4, i64 noundef %56)
  %57 = call ptr @readdir(ptr noundef nonnull %7) #9
  %.not27 = icmp eq ptr %57, null
  br i1 %.not27, label %.outer._crit_edge, label %25, !llvm.loop !15

58:                                               ; preds = %50
  %59 = call i32 @is_dir(ptr noundef nonnull %3)
  %.not31 = icmp eq i32 %59, 0
  br i1 %.not31, label %64, label %60

60:                                               ; preds = %58
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = call i32 @for_each_file_in_directory_recurse(ptr noundef %61, ptr noundef %1)
  %63 = add nsw i32 %62, %.022.ph42
  br label %.outer

64:                                               ; preds = %58
  %65 = call i32 @is_file(ptr noundef nonnull %3)
  %.not32 = icmp eq i32 %65, 0
  br i1 %.not32, label %70, label %66

66:                                               ; preds = %64
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = call i32 %1(ptr noundef %67) #9
  %.not33 = icmp eq i32 %68, 0
  %69 = zext i1 %.not33 to i32
  %spec.select = add nsw i32 %.022.ph42, %69
  br label %.outer

70:                                               ; preds = %64
  %71 = add nsw i32 %.021.ph43, 1
  %72 = load ptr, ptr @stderr, align 8, !tbaa !11
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef nonnull @.str) #10
  %74 = load ptr, ptr @stderr, align 8, !tbaa !11
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef nonnull @.str.1) #10
  %76 = load ptr, ptr @stderr, align 8, !tbaa !11
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef nonnull @.str.2) #10
  %78 = load ptr, ptr @stderr, align 8, !tbaa !11
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef nonnull @.str.3) #10
  %80 = load ptr, ptr @stderr, align 8, !tbaa !11
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef nonnull @.str.17, ptr noundef %81) #10
  %83 = icmp sgt i32 %.021.ph43, 9
  br i1 %83, label %84, label %.outer

84:                                               ; preds = %70
  %85 = load ptr, ptr @stderr, align 8, !tbaa !11
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef nonnull @.str) #10
  %87 = load ptr, ptr @stderr, align 8, !tbaa !11
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef nonnull @.str.1) #10
  %89 = load ptr, ptr @stderr, align 8, !tbaa !11
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef nonnull @.str.2) #10
  %91 = load ptr, ptr @stderr, align 8, !tbaa !11
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef nonnull @.str.3) #10
  %93 = load ptr, ptr @stderr, align 8, !tbaa !11
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.18) #10
  br label %102

.outer:                                           ; preds = %66, %70, %60
  %.123 = phi i32 [ %63, %60 ], [ %.022.ph42, %70 ], [ %spec.select, %66 ]
  %.1 = phi i32 [ %.021.ph43, %60 ], [ %71, %70 ], [ %.021.ph43, %66 ]
  %95 = load i64, ptr %9, align 8, !tbaa !14
  %96 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %27) #12
  %97 = xor i64 %96, -1
  %98 = add i64 %95, %97
  call void @strbuf_setlen(ptr noundef nonnull %4, i64 noundef %98)
  %99 = call ptr @readdir(ptr noundef nonnull %7) #9
  %.not2739 = icmp eq ptr %99, null
  br i1 %.not2739, label %.outer._crit_edge, label %.lr.ph, !llvm.loop !15

.lr.ph:                                           ; preds = %.lr.ph.lr.ph, %.outer
  %100 = phi ptr [ %8, %.lr.ph.lr.ph ], [ %99, %.outer ]
  %.021.ph43 = phi i32 [ 0, %.lr.ph.lr.ph ], [ %.1, %.outer ]
  %.022.ph42 = phi i32 [ 0, %.lr.ph.lr.ph ], [ %.123, %.outer ]
  br label %25

.outer._crit_edge:                                ; preds = %.outer, %52, %.preheader
  %.022.ph.lcssa38 = phi i32 [ 0, %.preheader ], [ %.022.ph42, %52 ], [ %.123, %.outer ]
  call void @strbuf_release(ptr noundef nonnull %4) #9
  %101 = call i32 @closedir(ptr noundef nonnull %7)
  br label %102

102:                                              ; preds = %.outer._crit_edge, %84, %31, %10
  %.0 = phi i32 [ %29, %31 ], [ -1, %84 ], [ %.022.ph.lcssa38, %.outer._crit_edge ], [ -1, %10 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %3) #9
  ret i32 %.0
}

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

!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, !10, i64 16}
!6 = !{!"strbuf", !7, i64 0, !7, i64 8, !10, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!6, !7, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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