; LLVM IR from ryanlayer/giggle :: src (disk_store)

; 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.disk_store = type { ptr, ptr, ptr, ptr, i32, i32, i64, i64, ptr, ptr, i8, ptr }
%struct.disk_file_header = type { i8, i8, i8, ptr, ptr }

@.str.16 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [30 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: noreturn
declare void @err(i32 noundef, ptr noundef, ...) #1

declare i64 @ftell(ptr noundef) #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @disk_store_append(ptr noundef %0, ptr noundef %1, i64 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.disk_store, ptr %12, i32 0, i32 5
  %14 = load i32, ptr %13, align 4, !tbaa !11
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.disk_store, ptr %15, i32 0, i32 4
  %17 = load i32, ptr %16, align 8, !tbaa !14
  %18 = icmp uge i32 %14, %17
  br i1 %18, label %19, label %87

19:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.disk_store, ptr %20, i32 0, i32 4
  %22 = load i32, ptr %21, align 8, !tbaa !14
  store i32 %22, ptr %7, align 4, !tbaa !15
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.disk_store, ptr %23, i32 0, i32 4
  %25 = load i32, ptr %24, align 8, !tbaa !14
  %26 = mul i32 %25, 2
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.disk_store, ptr %27, i32 0, i32 4
  store i32 %26, ptr %28, align 8, !tbaa !14
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.disk_store, ptr %29, i32 0, i32 8
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.disk_store, ptr %32, i32 0, i32 4
  %34 = load i32, ptr %33, align 8, !tbaa !14
  %35 = zext i32 %34 to i64
  %36 = mul i64 %35, 8
  %37 = call ptr @realloc(ptr noundef %31, i64 noundef %36) #7
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.disk_store, ptr %38, i32 0, i32 8
  store ptr %37, ptr %39, align 8, !tbaa !16
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.disk_store, ptr %40, i32 0, i32 8
  %42 = load ptr, ptr %41, align 8, !tbaa !16
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %45

44:                                               ; preds = %19
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.16) #8
  unreachable

45:                                               ; preds = %19
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.disk_store, ptr %46, i32 0, i32 8
  %48 = load ptr, ptr %47, align 8, !tbaa !16
  %49 = load i32, ptr %7, align 4, !tbaa !15
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds i64, ptr %48, i64 %50
  %52 = load i32, ptr %7, align 4, !tbaa !15
  %53 = zext i32 %52 to i64
  %54 = mul i64 %53, 8
  call void @llvm.memset.p0.i64(ptr align 8 %51, i8 0, i64 %54, i1 false)
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.disk_store, ptr %55, i32 0, i32 10
  %57 = load i8, ptr %56, align 8, !tbaa !17
  %58 = icmp ne i8 %57, 0
  br i1 %58, label %59, label %86

59:                                               ; preds = %45
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.disk_store, ptr %60, i32 0, i32 9
  %62 = load ptr, ptr %61, align 8, !tbaa !18
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.disk_store, ptr %63, i32 0, i32 4
  %65 = load i32, ptr %64, align 8, !tbaa !14
  %66 = zext i32 %65 to i64
  %67 = mul i64 %66, 4
  %68 = call ptr @realloc(ptr noundef %62, i64 noundef %67) #7
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.disk_store, ptr %69, i32 0, i32 9
  store ptr %68, ptr %70, align 8, !tbaa !18
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.disk_store, ptr %71, i32 0, i32 9
  %73 = load ptr, ptr %72, align 8, !tbaa !18
  %74 = icmp eq ptr %73, null
  br i1 %74, label %75, label %76

75:                                               ; preds = %59
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.16) #8
  unreachable

76:                                               ; preds = %59
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.disk_store, ptr %77, i32 0, i32 9
  %79 = load ptr, ptr %78, align 8, !tbaa !18
  %80 = load i32, ptr %7, align 4, !tbaa !15
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %79, i64 %81
  %83 = load i32, ptr %7, align 4, !tbaa !15
  %84 = zext i32 %83 to i64
  %85 = mul i64 %84, 4
  call void @llvm.memset.p0.i64(ptr align 4 %82, i8 0, i64 %85, i1 false)
  br label %86

86:                                               ; preds = %76, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %87

87:                                               ; preds = %86, %3
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.disk_store, ptr %88, i32 0, i32 3
  %90 = load ptr, ptr %89, align 8, !tbaa !19
  %91 = call i32 @fseek(ptr noundef %90, i64 noundef 0, i32 noundef 2)
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %97

93:                                               ; preds = %87
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.disk_store, ptr %94, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !20
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.17, ptr noundef %96) #8
  unreachable

97:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.disk_store, ptr %98, i32 0, i32 5
  %100 = load i32, ptr %99, align 4, !tbaa !11
  store i32 %100, ptr %8, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.disk_store, ptr %101, i32 0, i32 3
  %103 = load ptr, ptr %102, align 8, !tbaa !19
  %104 = call i64 @ftell(ptr noundef %103)
  store i64 %104, ptr %9, align 8, !tbaa !9
  %105 = load i32, ptr %8, align 4, !tbaa !15
  %106 = icmp eq i32 %105, 0
  br i1 %106, label %107, label %113

107:                                              ; preds = %97
  %108 = load i64, ptr %9, align 8, !tbaa !9
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.disk_store, ptr %109, i32 0, i32 7
  %111 = load i64, ptr %110, align 8, !tbaa !21
  %112 = icmp ne i64 %108, %111
  br i1 %112, label %127, label %113

113:                                              ; preds = %107, %97
  %114 = load i32, ptr %8, align 4, !tbaa !15
  %115 = icmp ugt i32 %114, 0
  br i1 %115, label %116, label %131

116:                                              ; preds = %113
  %117 = load i64, ptr %9, align 8, !tbaa !9
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.disk_store, ptr %118, i32 0, i32 8
  %120 = load ptr, ptr %119, align 8, !tbaa !16
  %121 = load i32, ptr %8, align 4, !tbaa !15
  %122 = sub i32 %121, 1
  %123 = zext i32 %122 to i64
  %124 = getelementptr inbounds i64, ptr %120, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !9
  %126 = icmp ne i64 %117, %125
  br i1 %126, label %127, label %131

127:                                              ; preds = %116, %107
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.disk_store, ptr %128, i32 0, i32 1
  %130 = load ptr, ptr %129, align 8, !tbaa !20
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.18, ptr noundef %130) #8
  unreachable

131:                                              ; preds = %116, %113
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.disk_store, ptr %132, i32 0, i32 10
  %134 = load i8, ptr %133, align 8, !tbaa !17
  %135 = icmp ne i8 %134, 0
  br i1 %135, label %136, label %163

136:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.disk_store, ptr %137, i32 0, i32 11
  %139 = load ptr, ptr %138, align 8, !tbaa !22
  %140 = getelementptr inbounds %struct.disk_file_header, ptr %139, i32 0, i32 3
  %141 = load ptr, ptr %140, align 8, !tbaa !23
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = load i64, ptr %6, align 8, !tbaa !9
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.disk_store, ptr %144, i32 0, i32 11
  %146 = load ptr, ptr %145, align 8, !tbaa !22
  %147 = getelementptr inbounds %struct.disk_file_header, ptr %146, i32 0, i32 1
  %148 = load i8, ptr %147, align 1, !tbaa !25
  %149 = zext i8 %148 to i32
  %150 = call ptr %141(ptr noundef %142, i64 noundef %143, i32 noundef %149, ptr noundef %10)
  store ptr %150, ptr %11, align 8, !tbaa !5
  %151 = load ptr, ptr %11, align 8, !tbaa !5
  %152 = load i64, ptr %10, align 8, !tbaa !9
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.disk_store, ptr %153, i32 0, i32 3
  %155 = load ptr, ptr %154, align 8, !tbaa !19
  %156 = call i64 @fwrite(ptr noundef %151, i64 noundef %152, i64 noundef 1, ptr noundef %155)
  %157 = icmp ne i64 %156, 1
  br i1 %157, label %158, label %162

158:                                              ; preds = %136
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.disk_store, ptr %159, i32 0, i32 1
  %161 = load ptr, ptr %160, align 8, !tbaa !20
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.19, ptr noundef %161) #8
  unreachable

162:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %176

163:                                              ; preds = %131
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = load i64, ptr %6, align 8, !tbaa !9
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.disk_store, ptr %166, i32 0, i32 3
  %168 = load ptr, ptr %167, align 8, !tbaa !19
  %169 = call i64 @fwrite(ptr noundef %164, i64 noundef %165, i64 noundef 1, ptr noundef %168)
  %170 = icmp ne i64 %169, 1
  br i1 %170, label %171, label %175

171:                                              ; preds = %163
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.disk_store, ptr %172, i32 0, i32 1
  %174 = load ptr, ptr %173, align 8, !tbaa !20
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.19, ptr noundef %174) #8
  unreachable

175:                                              ; preds = %163
  br label %176

176:                                              ; preds = %175, %162
  %177 = load ptr, ptr %4, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.disk_store, ptr %177, i32 0, i32 3
  %179 = load ptr, ptr %178, align 8, !tbaa !19
  %180 = call i64 @ftell(ptr noundef %179)
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.disk_store, ptr %181, i32 0, i32 8
  %183 = load ptr, ptr %182, align 8, !tbaa !16
  %184 = load i32, ptr %8, align 4, !tbaa !15
  %185 = zext i32 %184 to i64
  %186 = getelementptr inbounds i64, ptr %183, i64 %185
  store i64 %180, ptr %186, align 8, !tbaa !9
  %187 = load ptr, ptr %4, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.disk_store, ptr %187, i32 0, i32 10
  %189 = load i8, ptr %188, align 8, !tbaa !17
  %190 = icmp ne i8 %189, 0
  br i1 %190, label %191, label %200

191:                                              ; preds = %176
  %192 = load i64, ptr %6, align 8, !tbaa !9
  %193 = trunc i64 %192 to i32
  %194 = load ptr, ptr %4, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.disk_store, ptr %194, i32 0, i32 9
  %196 = load ptr, ptr %195, align 8, !tbaa !18
  %197 = load i32, ptr %8, align 4, !tbaa !15
  %198 = zext i32 %197 to i64
  %199 = getelementptr inbounds i32, ptr %196, i64 %198
  store i32 %193, ptr %199, align 4, !tbaa !15
  br label %200

200:                                              ; preds = %191, %176
  %201 = load ptr, ptr %4, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.disk_store, ptr %201, i32 0, i32 5
  %203 = load i32, ptr %202, align 4, !tbaa !11
  %204 = add i32 %203, 1
  store i32 %204, ptr %202, align 4, !tbaa !11
  %205 = load i32, ptr %8, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  ret i32 %205
}

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 36}
!12 = !{!"disk_store", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !10, i64 40, !10, i64 48, !6, i64 56, !6, i64 64, !7, i64 72, !6, i64 80}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 32}
!15 = !{!13, !13, i64 0}
!16 = !{!12, !6, i64 56}
!17 = !{!12, !7, i64 72}
!18 = !{!12, !6, i64 64}
!19 = !{!12, !6, i64 24}
!20 = !{!12, !6, i64 8}
!21 = !{!12, !10, i64 48}
!22 = !{!12, !6, i64 80}
!23 = !{!24, !6, i64 8}
!24 = !{!"disk_file_header", !7, i64 0, !7, i64 1, !7, i64 2, !6, i64 8, !6, i64 16}
!25 = !{!24, !7, i64 1}


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

@.str.16 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [30 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: noreturn
declare void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i64 @ftell(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @disk_store_append(ptr nocapture noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #3 {
  %4 = alloca i64, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 36
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = load i32, ptr %7, align 8, !tbaa !12
  %.not = icmp ult i32 %6, %8
  br i1 %.not, label %36, label %9

9:                                                ; preds = %3
  %10 = shl i32 %8, 1
  store i32 %10, ptr %7, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %0, i64 56
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = zext i32 %10 to i64
  %14 = shl nuw nsw i64 %13, 3
  %15 = tail call ptr @realloc(ptr noundef %12, i64 noundef %14) #6
  store ptr %15, ptr %11, align 8, !tbaa !13
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %9
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.16) #7
  unreachable

18:                                               ; preds = %9
  %19 = zext i32 %8 to i64
  %20 = getelementptr inbounds i64, ptr %15, i64 %19
  %21 = shl nuw nsw i64 %19, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %20, i8 0, i64 %21, i1 false)
  %22 = getelementptr inbounds i8, ptr %0, i64 72
  %23 = load i8, ptr %22, align 8, !tbaa !14
  %.not55 = icmp eq i8 %23, 0
  br i1 %.not55, label %36, label %24

24:                                               ; preds = %18
  %25 = getelementptr inbounds i8, ptr %0, i64 64
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = load i32, ptr %7, align 8, !tbaa !12
  %28 = zext i32 %27 to i64
  %29 = shl nuw nsw i64 %28, 2
  %30 = tail call ptr @realloc(ptr noundef %26, i64 noundef %29) #6
  store ptr %30, ptr %25, align 8, !tbaa !15
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %24
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.16) #7
  unreachable

33:                                               ; preds = %24
  %34 = getelementptr inbounds i32, ptr %30, i64 %19
  %35 = shl nuw nsw i64 %19, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %34, i8 0, i64 %35, i1 false)
  br label %36

36:                                               ; preds = %18, %33, %3
  %37 = getelementptr inbounds i8, ptr %0, i64 24
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  %39 = tail call i32 @fseek(ptr noundef %38, i64 noundef 0, i32 noundef 2)
  %.not56 = icmp eq i32 %39, 0
  br i1 %.not56, label %43, label %40

40:                                               ; preds = %36
  %41 = getelementptr inbounds i8, ptr %0, i64 8
  %42 = load ptr, ptr %41, align 8, !tbaa !17
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.17, ptr noundef %42) #7
  unreachable

43:                                               ; preds = %36
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = load ptr, ptr %37, align 8, !tbaa !16
  %46 = tail call i64 @ftell(ptr noundef %45)
  %cond = icmp eq i32 %44, 0
  br i1 %cond, label %47, label %50

47:                                               ; preds = %43
  %48 = getelementptr inbounds i8, ptr %0, i64 48
  %49 = load i64, ptr %48, align 8, !tbaa !18
  %.not57 = icmp eq i64 %46, %49
  br i1 %.not57, label %60, label %57

50:                                               ; preds = %43
  %51 = getelementptr inbounds i8, ptr %0, i64 56
  %52 = load ptr, ptr %51, align 8, !tbaa !13
  %53 = add i32 %44, -1
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds i64, ptr %52, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !19
  %.not59 = icmp eq i64 %46, %56
  br i1 %.not59, label %60, label %57

57:                                               ; preds = %50, %47
  %58 = getelementptr inbounds i8, ptr %0, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !17
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.18, ptr noundef %59) #7
  unreachable

60:                                               ; preds = %47, %50
  %61 = getelementptr inbounds i8, ptr %0, i64 72
  %62 = load i8, ptr %61, align 8, !tbaa !14
  %.not60 = icmp eq i8 %62, 0
  br i1 %.not60, label %79, label %63

63:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %64 = getelementptr inbounds i8, ptr %0, i64 80
  %65 = load ptr, ptr %64, align 8, !tbaa !20
  %66 = getelementptr inbounds i8, ptr %65, i64 8
  %67 = load ptr, ptr %66, align 8, !tbaa !21
  %68 = getelementptr inbounds i8, ptr %65, i64 1
  %69 = load i8, ptr %68, align 1, !tbaa !23
  %70 = zext i8 %69 to i32
  %71 = call ptr %67(ptr noundef %1, i64 noundef %2, i32 noundef %70, ptr noundef nonnull %4) #8
  %72 = load i64, ptr %4, align 8, !tbaa !19
  %73 = load ptr, ptr %37, align 8, !tbaa !16
  %74 = call i64 @fwrite(ptr noundef %71, i64 noundef %72, i64 noundef 1, ptr noundef %73)
  %.not62 = icmp eq i64 %74, 1
  br i1 %.not62, label %78, label %75

75:                                               ; preds = %63
  %76 = getelementptr inbounds i8, ptr %0, i64 8
  %77 = load ptr, ptr %76, align 8, !tbaa !17
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.19, ptr noundef %77) #7
  unreachable

78:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %85

79:                                               ; preds = %60
  %80 = load ptr, ptr %37, align 8, !tbaa !16
  %81 = tail call i64 @fwrite(ptr noundef %1, i64 noundef %2, i64 noundef 1, ptr noundef %80)
  %.not61 = icmp eq i64 %81, 1
  br i1 %.not61, label %85, label %82

82:                                               ; preds = %79
  %83 = getelementptr inbounds i8, ptr %0, i64 8
  %84 = load ptr, ptr %83, align 8, !tbaa !17
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.19, ptr noundef %84) #7
  unreachable

85:                                               ; preds = %79, %78
  %86 = load ptr, ptr %37, align 8, !tbaa !16
  %87 = call i64 @ftell(ptr noundef %86)
  %88 = getelementptr inbounds i8, ptr %0, i64 56
  %89 = load ptr, ptr %88, align 8, !tbaa !13
  %90 = zext i32 %44 to i64
  %91 = getelementptr inbounds i64, ptr %89, i64 %90
  store i64 %87, ptr %91, align 8, !tbaa !19
  %92 = load i8, ptr %61, align 8, !tbaa !14
  %.not63 = icmp eq i8 %92, 0
  br i1 %.not63, label %98, label %93

93:                                               ; preds = %85
  %94 = trunc i64 %2 to i32
  %95 = getelementptr inbounds i8, ptr %0, i64 64
  %96 = load ptr, ptr %95, align 8, !tbaa !15
  %97 = getelementptr inbounds i32, ptr %96, i64 %90
  store i32 %94, ptr %97, align 4, !tbaa !24
  br label %98

98:                                               ; preds = %93, %85
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = add i32 %99, 1
  store i32 %100, ptr %5, align 4, !tbaa !5
  ret i32 %44
}

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn "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 = { 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 #4 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(1) }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 36}
!6 = !{!"disk_store", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 36, !11, i64 40, !11, i64 48, !7, i64 56, !7, i64 64, !8, i64 72, !7, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !10, i64 32}
!13 = !{!6, !7, i64 56}
!14 = !{!6, !8, i64 72}
!15 = !{!6, !7, i64 64}
!16 = !{!6, !7, i64 24}
!17 = !{!6, !7, i64 8}
!18 = !{!6, !11, i64 48}
!19 = !{!11, !11, i64 0}
!20 = !{!6, !7, i64 80}
!21 = !{!22, !7, i64 8}
!22 = !{!"disk_file_header", !8, i64 0, !8, i64 1, !8, i64 2, !7, i64 8, !7, i64 16}
!23 = !{!22, !8, i64 1}
!24 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass