; LLVM IR from ChaCheeChoo/GAAS-Engine :: GWDGenSource (main)

; 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.header = type { [4 x i8], [2 x i16], i32, i32, i32, i32, i32 }
%struct.Path = type { [512 x i8] }
%struct.ToCblock = type { i32, i32, i32, i32 }

@fileindex = external dso_local global ptr, align 8
@filepath = external dso_local global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@head = external dso_local global %struct.header, align 4
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [23 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @genindex(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca [256 x i8], align 16
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 256, ptr %8) #5
  %12 = getelementptr inbounds [256 x i8], ptr %8, i64 0, i64 0
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds ptr, ptr %13, i64 1
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %12, ptr noundef @.str.3, ptr noundef %15) #5
  store i8 71, ptr @head, align 4, !tbaa !11
  store i8 87, ptr getelementptr inbounds ([4 x i8], ptr @head, i64 0, i64 1), align 1, !tbaa !11
  store i8 68, ptr getelementptr inbounds ([4 x i8], ptr @head, i64 0, i64 2), align 2, !tbaa !11
  store i8 0, ptr getelementptr inbounds ([4 x i8], ptr @head, i64 0, i64 3), align 1, !tbaa !11
  store i16 1, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 1), align 4, !tbaa !12
  store i16 0, ptr getelementptr inbounds ([2 x i16], ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 1), i64 0, i64 1), align 2, !tbaa !12
  store i32 16, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 5), align 4, !tbaa !14
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 2
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = call i32 @countfiles(ptr noundef %19, i32 noundef 0)
  store i32 %20, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 3), align 4, !tbaa !16
  %21 = load i32, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 3), align 4, !tbaa !16
  %22 = zext i32 %21 to i64
  %23 = mul i64 16, %22
  %24 = trunc i64 %23 to i32
  store i32 %24, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 4), align 4, !tbaa !17
  %25 = load i32, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 4), align 4, !tbaa !17
  %26 = zext i32 %25 to i64
  %27 = call noalias ptr @malloc(i64 noundef %26) #6
  store ptr %27, ptr @fileindex, align 8, !tbaa !9
  %28 = load i32, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 3), align 4, !tbaa !16
  %29 = zext i32 %28 to i64
  %30 = mul i64 512, %29
  %31 = call noalias ptr @malloc(i64 noundef %30) #6
  store ptr %31, ptr @filepath, align 8, !tbaa !9
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i64 2
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  call void @genindex(ptr noundef %34, i32 noundef 0)
  %35 = getelementptr inbounds [256 x i8], ptr %8, i64 0, i64 0
  %36 = call noalias ptr @fopen(ptr noundef %35, ptr noundef @.str.4)
  store ptr %36, ptr %6, align 8, !tbaa !9
  %37 = load ptr, ptr %6, align 8, !tbaa !9
  %38 = load i32, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 4), align 4, !tbaa !17
  %39 = zext i32 %38 to i64
  %40 = add i64 28, %39
  %41 = call i32 @fseek(ptr noundef %37, i64 noundef %40, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %42 = load ptr, ptr %6, align 8, !tbaa !9
  %43 = call i64 @ftell(ptr noundef %42)
  %44 = trunc i64 %43 to i32
  store i32 %44, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 2), align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %124, %2
  %46 = load i32, ptr %10, align 4, !tbaa !5
  %47 = load i32, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 3), align 4, !tbaa !16
  %48 = icmp ult i32 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %127

50:                                               ; preds = %45
  %51 = load ptr, ptr @filepath, align 8, !tbaa !9
  %52 = load i32, ptr %10, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %struct.Path, ptr %51, i64 %53
  %55 = getelementptr inbounds %struct.Path, ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds [512 x i8], ptr %55, i64 0, i64 0
  %57 = call noalias ptr @fopen(ptr noundef %56, ptr noundef @.str.5)
  store ptr %57, ptr %7, align 8, !tbaa !9
  %58 = load i32, ptr %10, align 4, !tbaa !5
  %59 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds %struct.ToCblock, ptr %59, i64 %61
  %63 = getelementptr inbounds %struct.ToCblock, ptr %62, i32 0, i32 0
  store i32 %58, ptr %63, align 4, !tbaa !19
  %64 = load ptr, ptr %6, align 8, !tbaa !9
  %65 = call i64 @ftell(ptr noundef %64)
  %66 = trunc i64 %65 to i32
  %67 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %68 = load i32, ptr %10, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds %struct.ToCblock, ptr %67, i64 %69
  %71 = getelementptr inbounds %struct.ToCblock, ptr %70, i32 0, i32 2
  store i32 %66, ptr %71, align 4, !tbaa !21
  %72 = load ptr, ptr %7, align 8, !tbaa !9
  %73 = call i32 @fseek(ptr noundef %72, i64 noundef 0, i32 noundef 2)
  %74 = load ptr, ptr %7, align 8, !tbaa !9
  %75 = call i64 @ftell(ptr noundef %74)
  %76 = trunc i64 %75 to i32
  %77 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %78 = load i32, ptr %10, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds %struct.ToCblock, ptr %77, i64 %79
  %81 = getelementptr inbounds %struct.ToCblock, ptr %80, i32 0, i32 3
  store i32 %76, ptr %81, align 4, !tbaa !22
  %82 = load ptr, ptr %7, align 8, !tbaa !9
  %83 = call i32 @fseek(ptr noundef %82, i64 noundef 0, i32 noundef 0)
  %84 = load ptr, ptr %6, align 8, !tbaa !9
  %85 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds %struct.ToCblock, ptr %85, i64 %87
  %89 = getelementptr inbounds %struct.ToCblock, ptr %88, i32 0, i32 2
  %90 = load i32, ptr %89, align 4, !tbaa !21
  %91 = zext i32 %90 to i64
  %92 = call i32 @fseek(ptr noundef %84, i64 noundef %91, i32 noundef 0)
  %93 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %94 = load i32, ptr %10, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds %struct.ToCblock, ptr %93, i64 %95
  %97 = getelementptr inbounds %struct.ToCblock, ptr %96, i32 0, i32 3
  %98 = load i32, ptr %97, align 4, !tbaa !22
  %99 = zext i32 %98 to i64
  %100 = call noalias ptr @malloc(i64 noundef %99) #6
  store ptr %100, ptr %9, align 8, !tbaa !9
  %101 = load ptr, ptr %9, align 8, !tbaa !9
  %102 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %struct.ToCblock, ptr %102, i64 %104
  %106 = getelementptr inbounds %struct.ToCblock, ptr %105, i32 0, i32 3
  %107 = load i32, ptr %106, align 4, !tbaa !22
  %108 = zext i32 %107 to i64
  %109 = load ptr, ptr %7, align 8, !tbaa !9
  %110 = call i64 @fread(ptr noundef %101, i64 noundef %108, i64 noundef 1, ptr noundef %109)
  %111 = load ptr, ptr %9, align 8, !tbaa !9
  %112 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds %struct.ToCblock, ptr %112, i64 %114
  %116 = getelementptr inbounds %struct.ToCblock, ptr %115, i32 0, i32 3
  %117 = load i32, ptr %116, align 4, !tbaa !22
  %118 = zext i32 %117 to i64
  %119 = load ptr, ptr %6, align 8, !tbaa !9
  %120 = call i64 @fwrite(ptr noundef %111, i64 noundef %118, i64 noundef 1, ptr noundef %119)
  %121 = load ptr, ptr %9, align 8, !tbaa !9
  call void @free(ptr noundef %121) #5
  %122 = load ptr, ptr %7, align 8, !tbaa !9
  %123 = call i32 @fclose(ptr noundef %122)
  br label %124

124:                                              ; preds = %50
  %125 = load i32, ptr %10, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %10, align 4, !tbaa !5
  br label %45, !llvm.loop !23

127:                                              ; preds = %49
  %128 = load ptr, ptr %6, align 8, !tbaa !9
  %129 = call i32 @fseek(ptr noundef %128, i64 noundef 28, i32 noundef 0)
  %130 = load ptr, ptr %6, align 8, !tbaa !9
  %131 = call i64 @ftell(ptr noundef %130)
  %132 = trunc i64 %131 to i32
  store i32 %132, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 6), align 4, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %133

133:                                              ; preds = %173, %127
  %134 = load i32, ptr %11, align 4, !tbaa !5
  %135 = load i32, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 3), align 4, !tbaa !16
  %136 = icmp ult i32 %134, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %176

138:                                              ; preds = %133
  %139 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %140 = load i32, ptr %11, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds %struct.ToCblock, ptr %139, i64 %141
  %143 = load i32, ptr getelementptr inbounds (%struct.header, ptr @head, i32 0, i32 5), align 4, !tbaa !14
  %144 = zext i32 %143 to i64
  %145 = load ptr, ptr %6, align 8, !tbaa !9
  %146 = call i64 @fwrite(ptr noundef %142, i64 noundef %144, i64 noundef 1, ptr noundef %145)
  %147 = load i32, ptr %11, align 4, !tbaa !5
  %148 = load ptr, ptr @filepath, align 8, !tbaa !9
  %149 = load i32, ptr %11, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds %struct.Path, ptr %148, i64 %150
  %152 = getelementptr inbounds %struct.Path, ptr %151, i32 0, i32 0
  %153 = getelementptr inbounds [512 x i8], ptr %152, i64 0, i64 0
  %154 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %155 = load i32, ptr %11, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds %struct.ToCblock, ptr %154, i64 %156
  %158 = getelementptr inbounds %struct.ToCblock, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 4, !tbaa !26
  %160 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds %struct.ToCblock, ptr %160, i64 %162
  %164 = getelementptr inbounds %struct.ToCblock, ptr %163, i32 0, i32 2
  %165 = load i32, ptr %164, align 4, !tbaa !21
  %166 = load ptr, ptr @fileindex, align 8, !tbaa !9
  %167 = load i32, ptr %11, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds %struct.ToCblock, ptr %166, i64 %168
  %170 = getelementptr inbounds %struct.ToCblock, ptr %169, i32 0, i32 3
  %171 = load i32, ptr %170, align 4, !tbaa !22
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %147, ptr noundef %153, i32 noundef %159, i32 noundef %165, i32 noundef %171)
  br label %173

173:                                              ; preds = %138
  %174 = load i32, ptr %11, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %11, align 4, !tbaa !5
  br label %133, !llvm.loop !27

176:                                              ; preds = %137
  %177 = load ptr, ptr %6, align 8, !tbaa !9
  %178 = call i32 @fseek(ptr noundef %177, i64 noundef 0, i32 noundef 0)
  %179 = load ptr, ptr %6, align 8, !tbaa !9
  %180 = call i64 @fwrite(ptr noundef @head, i64 noundef 28, i64 noundef 1, ptr noundef %179)
  %181 = load ptr, ptr @fileindex, align 8, !tbaa !9
  call void @free(ptr noundef %181) #5
  %182 = load ptr, ptr @filepath, align 8, !tbaa !9
  call void @free(ptr noundef %182) #5
  %183 = load ptr, ptr %6, align 8, !tbaa !9
  %184 = call i32 @fclose(ptr noundef %183)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 256, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  ret i32 0
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

declare noalias ptr @fopen(ptr noundef, ptr noundef) #4

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #4

declare i64 @ftell(ptr noundef) #4

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

declare i32 @fclose(ptr noundef) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind "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 allocsize(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 #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 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!"short", !7, i64 0}
!14 = !{!15, !6, i64 20}
!15 = !{!"header", !7, i64 0, !7, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!16 = !{!15, !6, i64 12}
!17 = !{!15, !6, i64 16}
!18 = !{!15, !6, i64 8}
!19 = !{!20, !6, i64 0}
!20 = !{!"ToCblock", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!21 = !{!20, !6, i64 8}
!22 = !{!20, !6, i64 12}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!15, !6, i64 24}
!26 = !{!20, !6, i64 4}
!27 = distinct !{!27, !24}


; 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.header = type { [4 x i8], [2 x i16], i32, i32, i32, i32, i32 }
%struct.Path = type { [512 x i8] }
%struct.ToCblock = type { i32, i32, i32, i32 }

@fileindex = external dso_local local_unnamed_addr global ptr, align 8
@filepath = external dso_local local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@head = external dso_local global %struct.header, align 4
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [23 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @genindex(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = alloca [256 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #5
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %5) #5
  store <4 x i8> <i8 71, i8 87, i8 68, i8 0>, ptr @head, align 4, !tbaa !9
  store i16 1, ptr getelementptr inbounds (i8, ptr @head, i64 4), align 4, !tbaa !10
  store i16 0, ptr getelementptr inbounds (i8, ptr @head, i64 6), align 2, !tbaa !10
  store i32 16, ptr getelementptr inbounds (i8, ptr @head, i64 20), align 4, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = tail call i32 @countfiles(ptr noundef %8, i32 noundef 0)
  store i32 %9, ptr getelementptr inbounds (i8, ptr @head, i64 12), align 4, !tbaa !15
  %10 = shl i32 %9, 4
  store i32 %10, ptr getelementptr inbounds (i8, ptr @head, i64 16), align 4, !tbaa !16
  %11 = zext i32 %10 to i64
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #6
  store ptr %12, ptr @fileindex, align 8, !tbaa !5
  %13 = zext i32 %9 to i64
  %14 = shl nuw nsw i64 %13, 9
  %15 = tail call noalias ptr @malloc(i64 noundef %14) #6
  store ptr %15, ptr @filepath, align 8, !tbaa !5
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  tail call void @genindex(ptr noundef %16, i32 noundef 0)
  %17 = call noalias ptr @fopen(ptr noundef nonnull %3, ptr noundef nonnull @.str.4)
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @head, i64 16), align 4, !tbaa !16
  %19 = zext i32 %18 to i64
  %20 = add nuw nsw i64 %19, 28
  %21 = tail call i32 @fseek(ptr noundef %17, i64 noundef %20, i32 noundef 0)
  %22 = tail call i64 @ftell(ptr noundef %17)
  %23 = trunc i64 %22 to i32
  store i32 %23, ptr getelementptr inbounds (i8, ptr @head, i64 8), align 4, !tbaa !17
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @head, i64 12), align 4, !tbaa !15
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %2
  %25 = tail call i32 @fseek(ptr noundef %17, i64 noundef 28, i32 noundef 0)
  %26 = tail call i64 @ftell(ptr noundef %17)
  %27 = trunc i64 %26 to i32
  store i32 %27, ptr getelementptr inbounds (i8, ptr @head, i64 24), align 4, !tbaa !18
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @head, i64 12), align 4, !tbaa !15
  %.not46 = icmp eq i32 %28, 0
  br i1 %.not46, label %._crit_edge45, label %.lr.ph44

.lr.ph:                                           ; preds = %2, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %2 ]
  %29 = load ptr, ptr @filepath, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.Path, ptr %29, i64 %indvars.iv
  %31 = tail call noalias ptr @fopen(ptr noundef %30, ptr noundef nonnull @.str.5)
  %32 = load ptr, ptr @fileindex, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ToCblock, ptr %32, i64 %indvars.iv
  %34 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %34, ptr %33, align 4, !tbaa !19
  %35 = tail call i64 @ftell(ptr noundef %17)
  %36 = trunc i64 %35 to i32
  %37 = load ptr, ptr @fileindex, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ToCblock, ptr %37, i64 %indvars.iv, i32 2
  store i32 %36, ptr %38, align 4, !tbaa !21
  %39 = tail call i32 @fseek(ptr noundef %31, i64 noundef 0, i32 noundef 2)
  %40 = tail call i64 @ftell(ptr noundef %31)
  %41 = trunc i64 %40 to i32
  %42 = load ptr, ptr @fileindex, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ToCblock, ptr %42, i64 %indvars.iv, i32 3
  store i32 %41, ptr %43, align 4, !tbaa !22
  %44 = tail call i32 @fseek(ptr noundef %31, i64 noundef 0, i32 noundef 0)
  %45 = load ptr, ptr @fileindex, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ToCblock, ptr %45, i64 %indvars.iv, i32 2
  %47 = load i32, ptr %46, align 4, !tbaa !21
  %48 = zext i32 %47 to i64
  %49 = tail call i32 @fseek(ptr noundef %17, i64 noundef %48, i32 noundef 0)
  %50 = load ptr, ptr @fileindex, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ToCblock, ptr %50, i64 %indvars.iv, i32 3
  %52 = load i32, ptr %51, align 4, !tbaa !22
  %53 = zext i32 %52 to i64
  %54 = tail call noalias ptr @malloc(i64 noundef %53) #6
  %55 = tail call i64 @fread(ptr noundef %54, i64 noundef %53, i64 noundef 1, ptr noundef %31)
  %56 = load ptr, ptr @fileindex, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.ToCblock, ptr %56, i64 %indvars.iv, i32 3
  %58 = load i32, ptr %57, align 4, !tbaa !22
  %59 = zext i32 %58 to i64
  %60 = tail call i64 @fwrite(ptr noundef %54, i64 noundef %59, i64 noundef 1, ptr noundef %17)
  tail call void @free(ptr noundef %54) #5
  %61 = tail call i32 @fclose(ptr noundef %31)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %62 = load i32, ptr getelementptr inbounds (i8, ptr @head, i64 12), align 4, !tbaa !15
  %63 = zext i32 %62 to i64
  %64 = icmp ult i64 %indvars.iv.next, %63
  br i1 %64, label %.lr.ph, label %._crit_edge, !llvm.loop !23

._crit_edge45:                                    ; preds = %.lr.ph44, %._crit_edge
  %65 = tail call i32 @fseek(ptr noundef %17, i64 noundef 0, i32 noundef 0)
  %66 = tail call i64 @fwrite(ptr noundef nonnull @head, i64 noundef 28, i64 noundef 1, ptr noundef %17)
  %67 = load ptr, ptr @fileindex, align 8, !tbaa !5
  tail call void @free(ptr noundef %67) #5
  %68 = load ptr, ptr @filepath, align 8, !tbaa !5
  tail call void @free(ptr noundef %68) #5
  %69 = tail call i32 @fclose(ptr noundef %17)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #5
  ret i32 0

.lr.ph44:                                         ; preds = %._crit_edge, %.lr.ph44
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %.lr.ph44 ], [ 0, %._crit_edge ]
  %70 = load ptr, ptr @fileindex, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ToCblock, ptr %70, i64 %indvars.iv48
  %72 = load i32, ptr getelementptr inbounds (i8, ptr @head, i64 20), align 4, !tbaa !12
  %73 = zext i32 %72 to i64
  %74 = tail call i64 @fwrite(ptr noundef %71, i64 noundef %73, i64 noundef 1, ptr noundef %17)
  %75 = load ptr, ptr @filepath, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.Path, ptr %75, i64 %indvars.iv48
  %77 = load ptr, ptr @fileindex, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ToCblock, ptr %77, i64 %indvars.iv48
  %79 = getelementptr inbounds i8, ptr %78, i64 4
  %80 = load i32, ptr %79, align 4, !tbaa !25
  %81 = getelementptr inbounds i8, ptr %78, i64 8
  %82 = load i32, ptr %81, align 4, !tbaa !21
  %83 = getelementptr inbounds i8, ptr %78, i64 12
  %84 = load i32, ptr %83, align 4, !tbaa !22
  %85 = trunc nuw nsw i64 %indvars.iv48 to i32
  %86 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %85, ptr noundef %76, i32 noundef %80, i32 noundef %82, i32 noundef %84)
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %87 = load i32, ptr getelementptr inbounds (i8, ptr @head, i64 12), align 4, !tbaa !15
  %88 = zext i32 %87 to i64
  %89 = icmp ult i64 %indvars.iv.next49, %88
  br i1 %89, label %.lr.ph44, label %._crit_edge45, !llvm.loop !26
}

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i64 @ftell(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) 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 #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!"short", !7, i64 0}
!12 = !{!13, !14, i64 20}
!13 = !{!"header", !7, i64 0, !7, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24}
!14 = !{!"int", !7, i64 0}
!15 = !{!13, !14, i64 12}
!16 = !{!13, !14, i64 16}
!17 = !{!13, !14, i64 8}
!18 = !{!13, !14, i64 24}
!19 = !{!20, !14, i64 0}
!20 = !{!"ToCblock", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!21 = !{!20, !14, i64 8}
!22 = !{!20, !14, i64 12}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!20, !14, i64 4}
!26 = distinct !{!26, !24}


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