; LLVM IR from alexzheng42/sDMD :: analysis (FileManage)

; 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.FileStr = type { i32, [256 x i8] }
%struct.FileListStr = type { i32, [128 x [64 x i8]] }
%struct.dirent = type { i64, i64, i16, i8, [256 x i8] }

@fileList = external global ptr, align 8
@files = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [72 x i8], align 1
@freshStart = external global i32, align 4
@path = external global [1024 x i8], align 16
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1
@sectInfo = external global ptr, align 8

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

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 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: nounwind uwtable
define dso_local void @AssignFileList(i32 noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  %6 = load ptr, ptr @files, align 8, !tbaa !9
  %7 = getelementptr inbounds ptr, ptr %6, i64 6
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds %struct.FileStr, ptr %8, i64 %10
  %12 = getelementptr inbounds %struct.FileStr, ptr %11, i32 0, i32 1
  %13 = getelementptr inbounds [256 x i8], ptr %12, i64 0, i64 0
  %14 = call i64 @strlen(ptr noundef %13) #7
  %15 = icmp ult i64 %14, 5
  br i1 %15, label %38, label %16

16:                                               ; preds = %1
  %17 = load ptr, ptr @files, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 6
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds %struct.FileStr, ptr %19, i64 %21
  %23 = getelementptr inbounds %struct.FileStr, ptr %22, i32 0, i32 1
  %24 = load ptr, ptr @files, align 8, !tbaa !9
  %25 = getelementptr inbounds ptr, ptr %24, i64 6
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds %struct.FileStr, ptr %26, i64 %28
  %30 = getelementptr inbounds %struct.FileStr, ptr %29, i32 0, i32 1
  %31 = getelementptr inbounds [256 x i8], ptr %30, i64 0, i64 0
  %32 = call i64 @strlen(ptr noundef %31) #7
  %33 = sub i64 %32, 4
  %34 = getelementptr inbounds [256 x i8], ptr %23, i64 0, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !11
  %36 = sext i8 %35 to i32
  %37 = icmp ne i32 %36, 46
  br i1 %37, label %38, label %48

38:                                               ; preds = %16, %1
  %39 = load ptr, ptr @files, align 8, !tbaa !9
  %40 = getelementptr inbounds ptr, ptr %39, i64 6
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds %struct.FileStr, ptr %41, i64 %43
  %45 = getelementptr inbounds %struct.FileStr, ptr %44, i32 0, i32 1
  %46 = getelementptr inbounds [256 x i8], ptr %45, i64 0, i64 0
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %46, ptr noundef @.str.2, i32 noundef 61)
  call void @exit(i32 noundef 1) #8
  unreachable

48:                                               ; preds = %16
  %49 = load i32, ptr @freshStart, align 4, !tbaa !5
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %194

51:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #9
  %52 = load ptr, ptr @files, align 8, !tbaa !9
  %53 = getelementptr inbounds ptr, ptr %52, i64 6
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds %struct.FileStr, ptr %54, i64 %56
  %58 = getelementptr inbounds %struct.FileStr, ptr %57, i32 0, i32 1
  %59 = getelementptr inbounds [256 x i8], ptr %58, i64 0, i64 0
  %60 = call i64 @strlen(ptr noundef %59) #7
  store i64 %60, ptr %3, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %61 = call ptr @opendir(ptr noundef @path)
  store ptr %61, ptr %4, align 8, !tbaa !9
  %62 = icmp eq ptr %61, null
  br i1 %62, label %63, label %64

63:                                               ; preds = %51
  call void @perror(ptr noundef @.str.3)
  call void @exit(i32 noundef 1) #8
  unreachable

64:                                               ; preds = %51
  %65 = load ptr, ptr @fileList, align 8, !tbaa !9
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds %struct.FileListStr, ptr %65, i64 %67
  %69 = getelementptr inbounds %struct.FileListStr, ptr %68, i32 0, i32 0
  store i32 0, ptr %69, align 4, !tbaa !14
  br label %70

70:                                               ; preds = %144, %64
  %71 = load ptr, ptr %4, align 8, !tbaa !9
  %72 = call ptr @readdir(ptr noundef %71)
  store ptr %72, ptr %5, align 8, !tbaa !9
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %145

74:                                               ; preds = %70
  %75 = load ptr, ptr %5, align 8, !tbaa !9
  %76 = getelementptr inbounds %struct.dirent, ptr %75, i32 0, i32 4
  %77 = getelementptr inbounds [256 x i8], ptr %76, i64 0, i64 0
  %78 = load ptr, ptr @files, align 8, !tbaa !9
  %79 = getelementptr inbounds ptr, ptr %78, i64 6
  %80 = load ptr, ptr %79, align 8, !tbaa !9
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds %struct.FileStr, ptr %80, i64 %82
  %84 = getelementptr inbounds %struct.FileStr, ptr %83, i32 0, i32 1
  %85 = getelementptr inbounds [256 x i8], ptr %84, i64 0, i64 0
  %86 = load i64, ptr %3, align 8, !tbaa !12
  %87 = sub nsw i64 %86, 4
  %88 = call i32 @strncmp(ptr noundef %77, ptr noundef %85, i64 noundef %87) #7
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %90, label %144

90:                                               ; preds = %74
  %91 = load ptr, ptr %5, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.dirent, ptr %91, i32 0, i32 4
  %93 = getelementptr inbounds [256 x i8], ptr %92, i64 0, i64 0
  %94 = call i64 @strlen(ptr noundef %93) #7
  %95 = load i64, ptr %3, align 8, !tbaa !12
  %96 = icmp eq i64 %94, %95
  br i1 %96, label %105, label %97

97:                                               ; preds = %90
  %98 = load ptr, ptr %5, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct.dirent, ptr %98, i32 0, i32 4
  %100 = getelementptr inbounds [256 x i8], ptr %99, i64 0, i64 0
  %101 = call i64 @strlen(ptr noundef %100) #7
  %102 = load i64, ptr %3, align 8, !tbaa !12
  %103 = add nsw i64 %102, 20
  %104 = icmp eq i64 %101, %103
  br i1 %104, label %105, label %144

105:                                              ; preds = %97, %90
  %106 = load ptr, ptr %5, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct.dirent, ptr %106, i32 0, i32 4
  %108 = getelementptr inbounds [256 x i8], ptr %107, i64 0, i64 0
  %109 = call ptr @strchr(ptr noundef %108, i32 noundef 64) #7
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %123

111:                                              ; preds = %105
  %112 = load ptr, ptr @fileList, align 8, !tbaa !9
  %113 = load i32, ptr %2, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds %struct.FileListStr, ptr %112, i64 %114
  %116 = getelementptr inbounds %struct.FileListStr, ptr %115, i32 0, i32 1
  %117 = getelementptr inbounds [128 x [64 x i8]], ptr %116, i64 0, i64 0
  %118 = getelementptr inbounds [64 x i8], ptr %117, i64 0, i64 0
  %119 = load ptr, ptr %5, align 8, !tbaa !9
  %120 = getelementptr inbounds %struct.dirent, ptr %119, i32 0, i32 4
  %121 = getelementptr inbounds [256 x i8], ptr %120, i64 0, i64 0
  %122 = call ptr @strcpy(ptr noundef %118, ptr noundef %121) #9
  br label %143

123:                                              ; preds = %105
  %124 = load ptr, ptr @fileList, align 8, !tbaa !9
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds %struct.FileListStr, ptr %124, i64 %126
  %128 = getelementptr inbounds %struct.FileListStr, ptr %127, i32 0, i32 1
  %129 = load ptr, ptr @fileList, align 8, !tbaa !9
  %130 = load i32, ptr %2, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds %struct.FileListStr, ptr %129, i64 %131
  %133 = getelementptr inbounds %struct.FileListStr, ptr %132, i32 0, i32 0
  %134 = load i32, ptr %133, align 4, !tbaa !14
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %133, align 4, !tbaa !14
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [128 x [64 x i8]], ptr %128, i64 0, i64 %136
  %138 = getelementptr inbounds [64 x i8], ptr %137, i64 0, i64 0
  %139 = load ptr, ptr %5, align 8, !tbaa !9
  %140 = getelementptr inbounds %struct.dirent, ptr %139, i32 0, i32 4
  %141 = getelementptr inbounds [256 x i8], ptr %140, i64 0, i64 0
  %142 = call ptr @strcpy(ptr noundef %138, ptr noundef %141) #9
  br label %143

143:                                              ; preds = %123, %111
  br label %144

144:                                              ; preds = %143, %97, %74
  br label %70, !llvm.loop !16

145:                                              ; preds = %70
  %146 = load ptr, ptr @fileList, align 8, !tbaa !9
  %147 = load i32, ptr %2, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds %struct.FileListStr, ptr %146, i64 %148
  %150 = getelementptr inbounds %struct.FileListStr, ptr %149, i32 0, i32 1
  %151 = getelementptr inbounds [128 x [64 x i8]], ptr %150, i64 0, i64 1
  %152 = getelementptr inbounds [64 x i8], ptr %151, i64 0, i64 0
  %153 = load ptr, ptr @fileList, align 8, !tbaa !9
  %154 = load i32, ptr %2, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds %struct.FileListStr, ptr %153, i64 %155
  %157 = getelementptr inbounds %struct.FileListStr, ptr %156, i32 0, i32 0
  %158 = load i32, ptr %157, align 4, !tbaa !14
  %159 = sext i32 %158 to i64
  call void @qsort(ptr noundef %152, i64 noundef %159, i64 noundef 64, ptr noundef @Comparator)
  %160 = load ptr, ptr @fileList, align 8, !tbaa !9
  %161 = load i32, ptr %2, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds %struct.FileListStr, ptr %160, i64 %162
  %164 = getelementptr inbounds %struct.FileListStr, ptr %163, i32 0, i32 1
  %165 = getelementptr inbounds [128 x [64 x i8]], ptr %164, i64 0, i64 0
  %166 = getelementptr inbounds [64 x i8], ptr %165, i64 0, i64 0
  %167 = call i64 @strlen(ptr noundef %166) #7
  %168 = icmp ne i64 %167, 0
  br i1 %168, label %169, label %193

169:                                              ; preds = %145
  %170 = load ptr, ptr @fileList, align 8, !tbaa !9
  %171 = load i32, ptr %2, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds %struct.FileListStr, ptr %170, i64 %172
  %174 = getelementptr inbounds %struct.FileListStr, ptr %173, i32 0, i32 1
  %175 = load ptr, ptr @fileList, align 8, !tbaa !9
  %176 = load i32, ptr %2, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds %struct.FileListStr, ptr %175, i64 %177
  %179 = getelementptr inbounds %struct.FileListStr, ptr %178, i32 0, i32 0
  %180 = load i32, ptr %179, align 4, !tbaa !14
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %179, align 4, !tbaa !14
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [128 x [64 x i8]], ptr %174, i64 0, i64 %182
  %184 = getelementptr inbounds [64 x i8], ptr %183, i64 0, i64 0
  %185 = load ptr, ptr @fileList, align 8, !tbaa !9
  %186 = load i32, ptr %2, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds %struct.FileListStr, ptr %185, i64 %187
  %189 = getelementptr inbounds %struct.FileListStr, ptr %188, i32 0, i32 1
  %190 = getelementptr inbounds [128 x [64 x i8]], ptr %189, i64 0, i64 0
  %191 = getelementptr inbounds [64 x i8], ptr %190, i64 0, i64 0
  %192 = call ptr @strcpy(ptr noundef %184, ptr noundef %191) #9
  br label %193

193:                                              ; preds = %169, %145
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  br label %223

194:                                              ; preds = %48
  %195 = load ptr, ptr @fileList, align 8, !tbaa !9
  %196 = load i32, ptr %2, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds %struct.FileListStr, ptr %195, i64 %197
  %199 = getelementptr inbounds %struct.FileListStr, ptr %198, i32 0, i32 0
  store i32 1, ptr %199, align 4, !tbaa !14
  %200 = load ptr, ptr @fileList, align 8, !tbaa !9
  %201 = load i32, ptr %2, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds %struct.FileListStr, ptr %200, i64 %202
  %204 = getelementptr inbounds %struct.FileListStr, ptr %203, i32 0, i32 1
  %205 = load ptr, ptr @fileList, align 8, !tbaa !9
  %206 = load i32, ptr %2, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds %struct.FileListStr, ptr %205, i64 %207
  %209 = getelementptr inbounds %struct.FileListStr, ptr %208, i32 0, i32 0
  %210 = load i32, ptr %209, align 4, !tbaa !14
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [128 x [64 x i8]], ptr %204, i64 0, i64 %211
  %213 = getelementptr inbounds [64 x i8], ptr %212, i64 0, i64 0
  %214 = load ptr, ptr @files, align 8, !tbaa !9
  %215 = getelementptr inbounds ptr, ptr %214, i64 6
  %216 = load ptr, ptr %215, align 8, !tbaa !9
  %217 = load i32, ptr %2, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds %struct.FileStr, ptr %216, i64 %218
  %220 = getelementptr inbounds %struct.FileStr, ptr %219, i32 0, i32 1
  %221 = getelementptr inbounds [256 x i8], ptr %220, i64 0, i64 0
  %222 = call ptr @strcpy(ptr noundef %213, ptr noundef %221) #9
  br label %223

223:                                              ; preds = %194, %193
  %224 = load ptr, ptr @fileList, align 8, !tbaa !9
  %225 = load i32, ptr %2, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds %struct.FileListStr, ptr %224, i64 %226
  %228 = getelementptr inbounds %struct.FileListStr, ptr %227, i32 0, i32 0
  %229 = load i32, ptr %228, align 4, !tbaa !14
  %230 = icmp eq i32 %229, 0
  br i1 %230, label %231, label %241

231:                                              ; preds = %223
  %232 = load ptr, ptr @files, align 8, !tbaa !9
  %233 = getelementptr inbounds ptr, ptr %232, i64 6
  %234 = load ptr, ptr %233, align 8, !tbaa !9
  %235 = load i32, ptr %2, align 4, !tbaa !5
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds %struct.FileStr, ptr %234, i64 %236
  %238 = getelementptr inbounds %struct.FileStr, ptr %237, i32 0, i32 1
  %239 = getelementptr inbounds [256 x i8], ptr %238, i64 0, i64 0
  %240 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %239, ptr noundef @.str.2, i32 noundef 97)
  call void @exit(i32 noundef 1) #8
  unreachable

241:                                              ; preds = %223
  %242 = load ptr, ptr @fileList, align 8, !tbaa !9
  %243 = load i32, ptr %2, align 4, !tbaa !5
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds %struct.FileListStr, ptr %242, i64 %244
  %246 = getelementptr inbounds %struct.FileListStr, ptr %245, i32 0, i32 0
  %247 = load i32, ptr %246, align 4, !tbaa !14
  %248 = add nsw i32 %247, 1
  %249 = sext i32 %248 to i64
  %250 = call noalias ptr @calloc(i64 noundef %249, i64 noundef 416) #10
  store ptr %250, ptr @sectInfo, align 8, !tbaa !9
  ret void
}

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

declare i32 @printf(ptr noundef, ...) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

declare ptr @opendir(ptr noundef) #4

declare void @perror(ptr noundef) #4

declare ptr @readdir(ptr noundef) #4

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #3

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

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

declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

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

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"FileListStr", !6, i64 0, !7, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"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.FileStr = type { i32, [256 x i8] }
%struct.FileListStr = type { i32, [128 x [64 x i8]] }

@fileList = external local_unnamed_addr global ptr, align 8
@files = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [72 x i8], align 1
@freshStart = external local_unnamed_addr global i32, align 4
@path = external global [1024 x i8], align 16
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1
@sectInfo = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @AssignFileList(i32 noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr @files, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 48
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = sext i32 %0 to i64
  %6 = getelementptr inbounds %struct.FileStr, ptr %4, i64 %5, i32 1
  %7 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %6) #8
  %8 = icmp ult i64 %7, 5
  br i1 %8, label %13, label %9

9:                                                ; preds = %1
  %10 = add i64 %7, -4
  %11 = getelementptr inbounds %struct.FileStr, ptr %4, i64 %5, i32 1, i64 %10
  %12 = load i8, ptr %11, align 1, !tbaa !9
  %.not = icmp eq i8 %12, 46
  br i1 %.not, label %15, label %13

13:                                               ; preds = %9, %1
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %6, ptr noundef nonnull @.str.2, i32 noundef 61)
  tail call void @exit(i32 noundef 1) #9
  unreachable

15:                                               ; preds = %9
  %16 = load i32, ptr @freshStart, align 4, !tbaa !10
  %.not36 = icmp eq i32 %16, 0
  br i1 %.not36, label %70, label %17

17:                                               ; preds = %15
  %18 = tail call ptr @opendir(ptr noundef nonnull @path)
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  tail call void @perror(ptr noundef nonnull @.str.3) #10
  tail call void @exit(i32 noundef 1) #9
  unreachable

21:                                               ; preds = %17
  %22 = load ptr, ptr @fileList, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.FileListStr, ptr %22, i64 %5
  store i32 0, ptr %23, align 4, !tbaa !12
  %24 = tail call ptr @readdir(ptr noundef nonnull %18) #11
  %.not3740 = icmp eq ptr %24, null
  br i1 %.not3740, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %21
  %25 = add nsw i64 %7, 20
  br label %26

26:                                               ; preds = %.lr.ph, %53
  %27 = phi ptr [ %24, %.lr.ph ], [ %54, %53 ]
  %28 = getelementptr inbounds i8, ptr %27, i64 19
  %29 = load ptr, ptr @files, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 48
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.FileStr, ptr %31, i64 %5, i32 1
  %33 = tail call i32 @strncmp(ptr noundef nonnull %28, ptr noundef nonnull %32, i64 noundef %10) #8
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %53

35:                                               ; preds = %26
  %36 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %28) #8
  %37 = icmp eq i64 %36, %7
  %38 = icmp eq i64 %36, %25
  %or.cond = select i1 %37, i1 true, i1 %38
  br i1 %or.cond, label %39, label %53

39:                                               ; preds = %35
  %40 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) %28, i32 noundef 64) #8
  %41 = icmp eq ptr %40, null
  %42 = load ptr, ptr @fileList, align 8, !tbaa !5
  br i1 %41, label %43, label %45

43:                                               ; preds = %39
  %44 = getelementptr inbounds %struct.FileListStr, ptr %42, i64 %5, i32 1
  br label %.sink.split

45:                                               ; preds = %39
  %46 = getelementptr inbounds %struct.FileListStr, ptr %42, i64 %5
  %47 = getelementptr inbounds i8, ptr %46, i64 4
  %48 = load i32, ptr %46, align 4, !tbaa !12
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %46, align 4, !tbaa !12
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [128 x [64 x i8]], ptr %47, i64 0, i64 %50
  br label %.sink.split

.sink.split:                                      ; preds = %45, %43
  %.sink = phi ptr [ %44, %43 ], [ %51, %45 ]
  %52 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %.sink, ptr noundef nonnull dereferenceable(1) %28) #11
  br label %53

53:                                               ; preds = %.sink.split, %35, %26
  %54 = tail call ptr @readdir(ptr noundef nonnull %18) #11
  %.not37 = icmp eq ptr %54, null
  br i1 %.not37, label %._crit_edge, label %26, !llvm.loop !14

._crit_edge:                                      ; preds = %53, %21
  %55 = load ptr, ptr @fileList, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.FileListStr, ptr %55, i64 %5
  %57 = getelementptr inbounds i8, ptr %56, i64 68
  %58 = load i32, ptr %56, align 4, !tbaa !12
  %59 = sext i32 %58 to i64
  tail call void @qsort(ptr noundef nonnull %57, i64 noundef %59, i64 noundef 64, ptr noundef nonnull @Comparator) #11
  %60 = load ptr, ptr @fileList, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.FileListStr, ptr %60, i64 %5
  %62 = getelementptr inbounds i8, ptr %61, i64 4
  %char0 = load i8, ptr %62, align 1
  %.not38 = icmp eq i8 %char0, 0
  br i1 %.not38, label %75, label %63

63:                                               ; preds = %._crit_edge
  %64 = load i32, ptr %61, align 4, !tbaa !12
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %61, align 4, !tbaa !12
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [128 x [64 x i8]], ptr %62, i64 0, i64 %66
  %68 = getelementptr inbounds %struct.FileListStr, ptr %60, i64 %5, i32 1
  %69 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %67, ptr noundef nonnull dereferenceable(1) %68) #11
  br label %75

70:                                               ; preds = %15
  %71 = load ptr, ptr @fileList, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.FileListStr, ptr %71, i64 %5
  store i32 1, ptr %72, align 4, !tbaa !12
  %73 = getelementptr inbounds %struct.FileListStr, ptr %71, i64 %5, i32 1, i64 1
  %74 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %73, ptr noundef nonnull dereferenceable(1) %6) #11
  br label %75

75:                                               ; preds = %._crit_edge, %63, %70
  %76 = load ptr, ptr @fileList, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.FileListStr, ptr %76, i64 %5
  %78 = load i32, ptr %77, align 4, !tbaa !12
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %86

80:                                               ; preds = %75
  %81 = load ptr, ptr @files, align 8, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %81, i64 48
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.FileStr, ptr %83, i64 %5, i32 1
  %85 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %84, ptr noundef nonnull @.str.2, i32 noundef 97)
  tail call void @exit(i32 noundef 1) #9
  unreachable

86:                                               ; preds = %75
  %87 = add nsw i32 %78, 1
  %88 = sext i32 %87 to i64
  %89 = tail call noalias ptr @calloc(i64 noundef %88, i64 noundef 416) #12
  store ptr %89, ptr @sectInfo, align 8, !tbaa !5
  ret void
}

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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4

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

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

declare ptr @readdir(ptr noundef) local_unnamed_addr #5

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

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

; 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: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #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 = { noreturn 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 = { "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 = { nofree "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 willreturn memory(read) }
attributes #9 = { noreturn nounwind }
attributes #10 = { cold }
attributes #11 = { nounwind }
attributes #12 = { nounwind allocsize(0,1) }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"FileListStr", !11, i64 0, !7, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass