; LLVM IR from hoytech/vmtouch :: vmtouch (vmtouch_crawl)

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

@total_files = external dso_local global i64, align 8
@total_dirs = external dso_local global i64, align 8
@curr_crawl_depth = external dso_local global i32, align 4
@orig_device = external dso_local global i64, align 8
@orig_device_inited = external dso_local global i32, align 4
@o_followsymlinks = external dso_local global i32, align 4
@o_singlefilesystem = external dso_local global i32, align 4
@o_ignorehardlinkeduplictes = external dso_local global i32, align 4
@.str.64 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [42 x i8], align 1
@crawl_inodes = external dso_local global [1024 x i64], align 16
@.str.67 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [30 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare hidden void @fatal(ptr noundef, ...) #2

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @increment_nofile_rlimit() #2

; Function Attrs: nounwind uwtable
declare dso_local void @vmtouch_file(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @warning(ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_ignored(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_filename_filtered(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @vmtouch_crawl(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.stat, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [4096 x i8], align 16
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 144, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = call i64 @strlen(ptr noundef %11) #8
  %13 = trunc i64 %12 to i32
  store i32 %13, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = load i32, ptr %8, align 4, !tbaa !9
  %16 = sub nsw i32 %15, 1
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i8, ptr %14, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !11
  %20 = sext i8 %19 to i32
  %21 = icmp eq i32 %20, 47
  br i1 %21, label %22, label %31

22:                                               ; preds = %1
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = icmp sgt i32 %23, 1
  br i1 %24, label %25, label %31

25:                                               ; preds = %22
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = sub nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %26, i64 %29
  store i8 0, ptr %30, align 1, !tbaa !11
  br label %31

31:                                               ; preds = %25, %22, %1
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = call i32 @is_ignored(ptr noundef %32)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %31
  store i32 1, ptr %10, align 4
  br label %226

36:                                               ; preds = %31
  %37 = load i32, ptr @o_followsymlinks, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %42

39:                                               ; preds = %36
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = call i32 @stat64(ptr noundef %40, ptr noundef %3) #7
  br label %45

42:                                               ; preds = %36
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = call i32 @lstat64(ptr noundef %43, ptr noundef %3) #7
  br label %45

45:                                               ; preds = %42, %39
  %46 = phi i32 [ %41, %39 ], [ %44, %42 ]
  store i32 %46, ptr %7, align 4, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %54

49:                                               ; preds = %45
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = call ptr @__errno_location() #9
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = call ptr @strerror(i32 noundef %52) #7
  call void (ptr, ...) @warning(ptr noundef @.str.64, ptr noundef %50, ptr noundef %53)
  store i32 1, ptr %10, align 4
  br label %226

54:                                               ; preds = %45
  %55 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 3
  %56 = load i32, ptr %55, align 8, !tbaa !12
  %57 = and i32 %56, 61440
  %58 = icmp eq i32 %57, 40960
  br i1 %58, label %59, label %61

59:                                               ; preds = %54
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, ...) @warning(ptr noundef @.str.65, ptr noundef %60)
  store i32 1, ptr %10, align 4
  br label %226

61:                                               ; preds = %54
  %62 = load i32, ptr @o_singlefilesystem, align 4, !tbaa !9
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %79

64:                                               ; preds = %61
  %65 = load i32, ptr @orig_device_inited, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %70, label %67

67:                                               ; preds = %64
  %68 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 0
  %69 = load i64, ptr %68, align 8, !tbaa !16
  store i64 %69, ptr @orig_device, align 8, !tbaa !17
  store i32 1, ptr @orig_device_inited, align 4, !tbaa !9
  br label %78

70:                                               ; preds = %64
  %71 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 0
  %72 = load i64, ptr %71, align 8, !tbaa !16
  %73 = load i64, ptr @orig_device, align 8, !tbaa !17
  %74 = icmp ne i64 %72, %73
  br i1 %74, label %75, label %77

75:                                               ; preds = %70
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, ...) @warning(ptr noundef @.str.66, ptr noundef %76)
  store i32 1, ptr %10, align 4
  br label %226

77:                                               ; preds = %70
  br label %78

78:                                               ; preds = %77, %67
  br label %79

79:                                               ; preds = %78, %61
  %80 = load i32, ptr @o_ignorehardlinkeduplictes, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %92, label %82

82:                                               ; preds = %79
  %83 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 2
  %84 = load i64, ptr %83, align 8, !tbaa !18
  %85 = icmp ugt i64 %84, 1
  br i1 %85, label %86, label %92

86:                                               ; preds = %82
  %87 = call i32 @find_object(ptr noundef %3)
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %90

89:                                               ; preds = %86
  store i32 1, ptr %10, align 4
  br label %226

90:                                               ; preds = %86
  call void @add_object(ptr noundef %3)
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91, %82, %79
  %93 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 3
  %94 = load i32, ptr %93, align 8, !tbaa !12
  %95 = and i32 %94, 61440
  %96 = icmp eq i32 %95, 16384
  br i1 %96, label %97, label %194

97:                                               ; preds = %92
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %113, %97
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !9
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %102, label %116

102:                                              ; preds = %98
  %103 = load i32, ptr %9, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1024 x i64], ptr @crawl_inodes, i64 0, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !17
  %107 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 1
  %108 = load i64, ptr %107, align 8, !tbaa !19
  %109 = icmp eq i64 %106, %108
  br i1 %109, label %110, label %112

110:                                              ; preds = %102
  %111 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, ...) @warning(ptr noundef @.str.67, ptr noundef %111)
  store i32 1, ptr %10, align 4
  br label %226

112:                                              ; preds = %102
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %9, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %9, align 4, !tbaa !9
  br label %98, !llvm.loop !20

116:                                              ; preds = %98
  %117 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !9
  %118 = icmp eq i32 %117, 1024
  br i1 %118, label %119, label %121

119:                                              ; preds = %116
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, ...) @fatal(ptr noundef @.str.68, ptr noundef %120)
  br label %121

121:                                              ; preds = %119, %116
  %122 = load i64, ptr @total_dirs, align 8, !tbaa !17
  %123 = add nsw i64 %122, 1
  store i64 %123, ptr @total_dirs, align 8, !tbaa !17
  %124 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 1
  %125 = load i64, ptr %124, align 8, !tbaa !19
  %126 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1024 x i64], ptr @crawl_inodes, i64 0, i64 %127
  store i64 %125, ptr %128, align 8, !tbaa !17
  br label %129

129:                                              ; preds = %142, %121
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = call ptr @opendir(ptr noundef %130)
  store ptr %131, ptr %4, align 8, !tbaa !5
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = icmp eq ptr %132, null
  br i1 %133, label %134, label %148

134:                                              ; preds = %129
  %135 = call ptr @__errno_location() #9
  %136 = load i32, ptr %135, align 4, !tbaa !9
  %137 = icmp eq i32 %136, 23
  br i1 %137, label %142, label %138

138:                                              ; preds = %134
  %139 = call ptr @__errno_location() #9
  %140 = load i32, ptr %139, align 4, !tbaa !9
  %141 = icmp eq i32 %140, 24
  br i1 %141, label %142, label %143

142:                                              ; preds = %138, %134
  call void @increment_nofile_rlimit()
  br label %129

143:                                              ; preds = %138
  %144 = load ptr, ptr %2, align 8, !tbaa !5
  %145 = call ptr @__errno_location() #9
  %146 = load i32, ptr %145, align 4, !tbaa !9
  %147 = call ptr @strerror(i32 noundef %146) #7
  call void (ptr, ...) @warning(ptr noundef @.str.69, ptr noundef %144, ptr noundef %147)
  store i32 1, ptr %10, align 4
  br label %226

148:                                              ; preds = %129
  br label %149

149:                                              ; preds = %177, %165, %148
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  %151 = call ptr @readdir64(ptr noundef %150)
  store ptr %151, ptr %5, align 8, !tbaa !5
  %152 = icmp ne ptr %151, null
  br i1 %152, label %153, label %183

153:                                              ; preds = %149
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.dirent, ptr %154, i32 0, i32 4
  %156 = getelementptr inbounds [256 x i8], ptr %155, i64 0, i64 0
  %157 = call i32 @strcmp(ptr noundef %156, ptr noundef @.str.70) #8
  %158 = icmp eq i32 %157, 0
  br i1 %158, label %165, label %159

159:                                              ; preds = %153
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.dirent, ptr %160, i32 0, i32 4
  %162 = getelementptr inbounds [256 x i8], ptr %161, i64 0, i64 0
  %163 = call i32 @strcmp(ptr noundef %162, ptr noundef @.str.71) #8
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %166

165:                                              ; preds = %159, %153
  br label %149, !llvm.loop !22

166:                                              ; preds = %159
  %167 = getelementptr inbounds [4096 x i8], ptr %6, i64 0, i64 0
  %168 = load ptr, ptr %2, align 8, !tbaa !5
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.dirent, ptr %169, i32 0, i32 4
  %171 = getelementptr inbounds [256 x i8], ptr %170, i64 0, i64 0
  %172 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %167, i64 noundef 4096, ptr noundef @.str.72, ptr noundef %168, ptr noundef %171) #7
  %173 = sext i32 %172 to i64
  %174 = icmp uge i64 %173, 4096
  br i1 %174, label %175, label %177

175:                                              ; preds = %166
  %176 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, ...) @warning(ptr noundef @.str.73, ptr noundef %176)
  br label %184

177:                                              ; preds = %166
  %178 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !9
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr @curr_crawl_depth, align 4, !tbaa !9
  %180 = getelementptr inbounds [4096 x i8], ptr %6, i64 0, i64 0
  call void @vmtouch_crawl(ptr noundef %180)
  %181 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !9
  %182 = add nsw i32 %181, -1
  store i32 %182, ptr @curr_crawl_depth, align 4, !tbaa !9
  br label %149, !llvm.loop !22

183:                                              ; preds = %149
  br label %184

184:                                              ; preds = %183, %175
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = call i32 @closedir(ptr noundef %185)
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %193

188:                                              ; preds = %184
  %189 = load ptr, ptr %2, align 8, !tbaa !5
  %190 = call ptr @__errno_location() #9
  %191 = load i32, ptr %190, align 4, !tbaa !9
  %192 = call ptr @strerror(i32 noundef %191) #7
  call void (ptr, ...) @warning(ptr noundef @.str.74, ptr noundef %189, ptr noundef %192)
  store i32 1, ptr %10, align 4
  br label %226

193:                                              ; preds = %184
  br label %224

194:                                              ; preds = %92
  %195 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 3
  %196 = load i32, ptr %195, align 8, !tbaa !12
  %197 = and i32 %196, 61440
  %198 = icmp eq i32 %197, 40960
  br i1 %198, label %199, label %201

199:                                              ; preds = %194
  %200 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, ...) @warning(ptr noundef @.str.65, ptr noundef %200)
  store i32 1, ptr %10, align 4
  br label %226

201:                                              ; preds = %194
  %202 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 3
  %203 = load i32, ptr %202, align 8, !tbaa !12
  %204 = and i32 %203, 61440
  %205 = icmp eq i32 %204, 32768
  br i1 %205, label %211, label %206

206:                                              ; preds = %201
  %207 = getelementptr inbounds %struct.stat, ptr %3, i32 0, i32 3
  %208 = load i32, ptr %207, align 8, !tbaa !12
  %209 = and i32 %208, 61440
  %210 = icmp eq i32 %209, 24576
  br i1 %210, label %211, label %220

211:                                              ; preds = %206, %201
  %212 = load ptr, ptr %2, align 8, !tbaa !5
  %213 = call i32 @is_filename_filtered(ptr noundef %212)
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %215, label %219

215:                                              ; preds = %211
  %216 = load i64, ptr @total_files, align 8, !tbaa !17
  %217 = add nsw i64 %216, 1
  store i64 %217, ptr @total_files, align 8, !tbaa !17
  %218 = load ptr, ptr %2, align 8, !tbaa !5
  call void @vmtouch_file(ptr noundef %218)
  br label %219

219:                                              ; preds = %215, %211
  br label %222

220:                                              ; preds = %206
  %221 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, ...) @warning(ptr noundef @.str.75, ptr noundef %221)
  br label %222

222:                                              ; preds = %220, %219
  br label %223

223:                                              ; preds = %222
  br label %224

224:                                              ; preds = %223, %193
  br label %225

225:                                              ; preds = %224
  store i32 0, ptr %10, align 4
  br label %226

226:                                              ; preds = %225, %199, %188, %143, %110, %89, %75, %59, %49, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 144, ptr %3) #7
  %227 = load i32, ptr %10, align 4
  switch i32 %227, label %229 [
    i32 0, label %228
    i32 1, label %228
  ]

228:                                              ; preds = %226, %226
  ret void

229:                                              ; preds = %226
  unreachable
}

; Function Attrs: nounwind
declare i32 @stat64(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind
declare i32 @lstat64(ptr noundef, ptr noundef) #0

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

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

declare ptr @opendir(ptr noundef) #6

declare ptr @readdir64(ptr noundef) #6

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

declare i32 @closedir(ptr noundef) #6

attributes #0 = { 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 #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 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { "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 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 24}
!13 = !{!"stat", !14, i64 0, !14, i64 8, !14, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !15, i64 72, !15, i64 88, !15, i64 104, !7, i64 120}
!14 = !{!"long", !7, i64 0}
!15 = !{!"timespec", !14, i64 0, !14, i64 8}
!16 = !{!13, !14, i64 0}
!17 = !{!14, !14, i64 0}
!18 = !{!13, !14, i64 16}
!19 = !{!13, !14, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


; 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 }

@total_files = external dso_local local_unnamed_addr global i64, align 8
@total_dirs = external dso_local local_unnamed_addr global i64, align 8
@curr_crawl_depth = external dso_local local_unnamed_addr global i32, align 4
@orig_device = external dso_local local_unnamed_addr global i64, align 8
@orig_device_inited = external dso_local local_unnamed_addr global i32, align 4
@o_followsymlinks = external dso_local local_unnamed_addr global i32, align 4
@o_singlefilesystem = external dso_local local_unnamed_addr global i32, align 4
@o_ignorehardlinkeduplictes = external dso_local local_unnamed_addr global i32, align 4
@.str.64 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [42 x i8], align 1
@crawl_inodes = external dso_local local_unnamed_addr global [1024 x i64], align 16
@.str.67 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [30 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare hidden void @fatal(ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @increment_nofile_rlimit() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @vmtouch_file(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @warning(ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_ignored(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_filename_filtered(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @vmtouch_crawl(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca %struct.stat, align 8
  %3 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %2) #9
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %3) #9
  %4 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #10
  %5 = trunc i64 %4 to i32
  %6 = shl i64 %4, 32
  %sext = add i64 %6, -4294967296
  %7 = ashr exact i64 %sext, 32
  %8 = getelementptr inbounds i8, ptr %0, i64 %7
  %9 = load i8, ptr %8, align 1, !tbaa !5
  %10 = icmp eq i8 %9, 47
  %11 = icmp sgt i32 %5, 1
  %or.cond = and i1 %10, %11
  br i1 %or.cond, label %12, label %13

12:                                               ; preds = %1
  store i8 0, ptr %8, align 1, !tbaa !5
  br label %13

13:                                               ; preds = %12, %1
  %14 = tail call i32 @is_ignored(ptr noundef nonnull %0)
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %15, label %113

15:                                               ; preds = %13
  %16 = load i32, ptr @o_followsymlinks, align 4, !tbaa !8
  %.not40 = icmp eq i32 %16, 0
  br i1 %.not40, label %19, label %17

17:                                               ; preds = %15
  %18 = call i32 @stat64(ptr noundef nonnull %0, ptr noundef nonnull %2) #9
  br label %21

19:                                               ; preds = %15
  %20 = call i32 @lstat64(ptr noundef nonnull %0, ptr noundef nonnull %2) #9
  br label %21

21:                                               ; preds = %19, %17
  %22 = phi i32 [ %18, %17 ], [ %20, %19 ]
  %.not41 = icmp eq i32 %22, 0
  br i1 %.not41, label %27, label %23

23:                                               ; preds = %21
  %24 = tail call ptr @__errno_location() #11
  %25 = load i32, ptr %24, align 4, !tbaa !8
  %26 = tail call ptr @strerror(i32 noundef %25) #9
  tail call void (ptr, ...) @warning(ptr noundef nonnull @.str.64, ptr noundef nonnull %0, ptr noundef %26)
  br label %113

27:                                               ; preds = %21
  %28 = getelementptr inbounds i8, ptr %2, i64 24
  %29 = load i32, ptr %28, align 8, !tbaa !10
  %30 = and i32 %29, 61440
  %31 = icmp eq i32 %30, 40960
  br i1 %31, label %32, label %33

32:                                               ; preds = %27
  tail call void (ptr, ...) @warning(ptr noundef nonnull @.str.65, ptr noundef nonnull %0)
  br label %113

33:                                               ; preds = %27
  %34 = load i32, ptr @o_singlefilesystem, align 4, !tbaa !8
  %.not42 = icmp eq i32 %34, 0
  br i1 %.not42, label %42, label %35

35:                                               ; preds = %33
  %36 = load i32, ptr @orig_device_inited, align 4, !tbaa !8
  %.not43 = icmp eq i32 %36, 0
  %37 = load i64, ptr %2, align 8, !tbaa !14
  br i1 %.not43, label %38, label %39

38:                                               ; preds = %35
  store i64 %37, ptr @orig_device, align 8, !tbaa !15
  store i32 1, ptr @orig_device_inited, align 4, !tbaa !8
  br label %42

39:                                               ; preds = %35
  %40 = load i64, ptr @orig_device, align 8, !tbaa !15
  %.not44 = icmp eq i64 %37, %40
  br i1 %.not44, label %42, label %41

41:                                               ; preds = %39
  tail call void (ptr, ...) @warning(ptr noundef nonnull @.str.66, ptr noundef nonnull %0)
  br label %113

42:                                               ; preds = %38, %39, %33
  %43 = load i32, ptr @o_ignorehardlinkeduplictes, align 4, !tbaa !8
  %44 = icmp eq i32 %43, 0
  %45 = getelementptr inbounds i8, ptr %2, i64 16
  %46 = load i64, ptr %45, align 8
  %47 = icmp ugt i64 %46, 1
  %or.cond4 = select i1 %44, i1 %47, i1 false
  br i1 %or.cond4, label %48, label %51

48:                                               ; preds = %42
  %49 = call i32 @find_object(ptr noundef nonnull %2)
  %.not45 = icmp eq i32 %49, 0
  br i1 %.not45, label %50, label %113

50:                                               ; preds = %48
  call void @add_object(ptr noundef nonnull %2)
  %.pre = load i32, ptr %28, align 8, !tbaa !10
  %.pre65 = and i32 %.pre, 61440
  br label %51

51:                                               ; preds = %50, %42
  %.pre-phi = phi i32 [ %.pre65, %50 ], [ %30, %42 ]
  %52 = add nsw i32 %.pre-phi, -16384
  %53 = call i32 @llvm.fshl.i32(i32 %52, i32 %52, i32 19)
  switch i32 %53, label %112 [
    i32 0, label %.preheader49
    i32 3, label %106
    i32 2, label %107
    i32 1, label %107
  ]

.preheader49:                                     ; preds = %51
  %54 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !8
  %55 = icmp sgt i32 %54, 0
  br i1 %55, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.preheader49
  %56 = getelementptr inbounds i8, ptr %2, i64 8
  %57 = load i64, ptr %56, align 8, !tbaa !16
  %wide.trip.count = zext nneg i32 %54 to i64
  br label %59

58:                                               ; preds = %59
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %59, !llvm.loop !17

59:                                               ; preds = %.lr.ph, %58
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %58 ]
  %60 = getelementptr inbounds [1024 x i64], ptr @crawl_inodes, i64 0, i64 %indvars.iv
  %61 = load i64, ptr %60, align 8, !tbaa !15
  %62 = icmp eq i64 %61, %57
  br i1 %62, label %63, label %58

63:                                               ; preds = %59
  call void (ptr, ...) @warning(ptr noundef nonnull @.str.67, ptr noundef %0)
  br label %113

._crit_edge:                                      ; preds = %58
  %64 = icmp eq i32 %54, 1024
  br i1 %64, label %65, label %._crit_edge.thread

65:                                               ; preds = %._crit_edge
  call void (ptr, ...) @fatal(ptr noundef nonnull @.str.68, ptr noundef %0)
  %.pre64 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !8
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader49, %65, %._crit_edge
  %66 = phi i32 [ %.pre64, %65 ], [ %54, %._crit_edge ], [ %54, %.preheader49 ]
  %67 = load i64, ptr @total_dirs, align 8, !tbaa !15
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr @total_dirs, align 8, !tbaa !15
  %69 = getelementptr inbounds i8, ptr %2, i64 8
  %70 = load i64, ptr %69, align 8, !tbaa !16
  %71 = sext i32 %66 to i64
  %72 = getelementptr inbounds [1024 x i64], ptr @crawl_inodes, i64 0, i64 %71
  store i64 %70, ptr %72, align 8, !tbaa !15
  %73 = call ptr @opendir(ptr noundef %0)
  %74 = icmp eq ptr %73, null
  br i1 %74, label %.lr.ph56, label %.preheader

.lr.ph56:                                         ; preds = %._crit_edge.thread
  %75 = tail call ptr @__errno_location() #11
  br label %77

.preheader:                                       ; preds = %79, %._crit_edge.thread
  %.lcssa = phi ptr [ %73, %._crit_edge.thread ], [ %80, %79 ]
  %76 = call ptr @readdir64(ptr noundef nonnull %.lcssa) #9
  %.not4758 = icmp eq ptr %76, null
  br i1 %.not4758, label %.loopexit, label %.lr.ph59

77:                                               ; preds = %.lr.ph56, %79
  %78 = load i32, ptr %75, align 4, !tbaa !8
  %.off = add i32 %78, -23
  %switch = icmp ult i32 %.off, 2
  br i1 %switch, label %79, label %82

79:                                               ; preds = %77
  call void @increment_nofile_rlimit()
  %80 = call ptr @opendir(ptr noundef %0)
  %81 = icmp eq ptr %80, null
  br i1 %81, label %77, label %.preheader

82:                                               ; preds = %77
  %83 = call ptr @strerror(i32 noundef %78) #9
  call void (ptr, ...) @warning(ptr noundef nonnull @.str.69, ptr noundef %0, ptr noundef %83)
  br label %113

.lr.ph59:                                         ; preds = %.preheader, %.backedge
  %84 = phi ptr [ %91, %.backedge ], [ %76, %.preheader ]
  %85 = getelementptr inbounds i8, ptr %84, i64 19
  %86 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %85, ptr noundef nonnull dereferenceable(1) @.str.70) #10
  %87 = icmp eq i32 %86, 0
  br i1 %87, label %.backedge, label %88

88:                                               ; preds = %.lr.ph59
  %89 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %85, ptr noundef nonnull dereferenceable(1) @.str.71) #10
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %.backedge, label %92

.backedge:                                        ; preds = %.lr.ph59, %88, %96
  %91 = call ptr @readdir64(ptr noundef nonnull %.lcssa) #9
  %.not47 = icmp eq ptr %91, null
  br i1 %.not47, label %.loopexit, label %.lr.ph59, !llvm.loop !19

92:                                               ; preds = %88
  %93 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 4096, ptr noundef nonnull @.str.72, ptr noundef %0, ptr noundef nonnull %85) #9
  %94 = icmp ugt i32 %93, 4095
  br i1 %94, label %95, label %96

95:                                               ; preds = %92
  call void (ptr, ...) @warning(ptr noundef nonnull @.str.73, ptr noundef %0)
  br label %.loopexit

96:                                               ; preds = %92
  %97 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !8
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr @curr_crawl_depth, align 4, !tbaa !8
  call void @vmtouch_crawl(ptr noundef nonnull %3)
  %99 = load i32, ptr @curr_crawl_depth, align 4, !tbaa !8
  %100 = add nsw i32 %99, -1
  store i32 %100, ptr @curr_crawl_depth, align 4, !tbaa !8
  br label %.backedge

.loopexit:                                        ; preds = %.backedge, %.preheader, %95
  %101 = call i32 @closedir(ptr noundef nonnull %.lcssa)
  %.not48 = icmp eq i32 %101, 0
  br i1 %.not48, label %113, label %102

102:                                              ; preds = %.loopexit
  %103 = tail call ptr @__errno_location() #11
  %104 = load i32, ptr %103, align 4, !tbaa !8
  %105 = call ptr @strerror(i32 noundef %104) #9
  call void (ptr, ...) @warning(ptr noundef nonnull @.str.74, ptr noundef %0, ptr noundef %105)
  br label %113

106:                                              ; preds = %51
  call void (ptr, ...) @warning(ptr noundef nonnull @.str.65, ptr noundef nonnull %0)
  br label %113

107:                                              ; preds = %51, %51
  %108 = call i32 @is_filename_filtered(ptr noundef nonnull %0)
  %.not46 = icmp eq i32 %108, 0
  br i1 %.not46, label %113, label %109

109:                                              ; preds = %107
  %110 = load i64, ptr @total_files, align 8, !tbaa !15
  %111 = add nsw i64 %110, 1
  store i64 %111, ptr @total_files, align 8, !tbaa !15
  call void @vmtouch_file(ptr noundef nonnull %0)
  br label %113

112:                                              ; preds = %51
  call void (ptr, ...) @warning(ptr noundef nonnull @.str.75, ptr noundef nonnull %0)
  br label %113

113:                                              ; preds = %107, %109, %112, %.loopexit, %48, %13, %106, %102, %82, %63, %41, %32, %23
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %2) #9
  ret void
}

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @add_object(ptr noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noalias noundef ptr @opendir(ptr nocapture noundef readonly) local_unnamed_addr #3

declare ptr @readdir64(ptr noundef) local_unnamed_addr #7

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.fshl.i32(i32, i32, i32) #8

attributes #0 = { 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 #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 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !9, i64 24}
!11 = !{!"stat", !12, i64 0, !12, i64 8, !12, i64 16, !9, i64 24, !9, i64 28, !9, i64 32, !9, i64 36, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !13, i64 72, !13, i64 88, !13, i64 104, !6, i64 120}
!12 = !{!"long", !6, i64 0}
!13 = !{!"timespec", !12, i64 0, !12, i64 8}
!14 = !{!11, !12, i64 0}
!15 = !{!12, !12, i64 0}
!16 = !{!11, !12, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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