; 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.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [60 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: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #1

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #3

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

declare i64 @ftell(ptr noundef) #4

; 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 ptr @disk_store_load(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #5 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %13 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 88) #7
  store ptr %13, ptr %9, align 8, !tbaa !5
  %14 = load ptr, ptr %9, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %17

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

17:                                               ; preds = %4
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = call noalias ptr @strdup(ptr noundef %18) #6
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.disk_store, ptr %20, i32 0, i32 0
  store ptr %19, ptr %21, align 8, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %28, label %24

24:                                               ; preds = %17
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %40

28:                                               ; preds = %24, %17
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = call noalias ptr @fopen(ptr noundef %29, ptr noundef @.str.9)
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.disk_store, ptr %31, i32 0, i32 2
  store ptr %30, ptr %32, align 8, !tbaa !13
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.disk_store, ptr %33, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %39

37:                                               ; preds = %28
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.10, ptr noundef %38) #8
  unreachable

39:                                               ; preds = %28
  br label %45

40:                                               ; preds = %24
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.disk_store, ptr %43, i32 0, i32 2
  store ptr %42, ptr %44, align 8, !tbaa !13
  br label %45

45:                                               ; preds = %40, %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.disk_store, ptr %46, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !13
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.disk_store, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = call ptr @read_disk_file_header(ptr noundef %48, ptr noundef %51, ptr noundef @.str.3)
  store ptr %52, ptr %10, align 8, !tbaa !5
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %60

55:                                               ; preds = %45
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.disk_store, ptr %56, i32 0, i32 10
  store i8 0, ptr %57, align 8, !tbaa !14
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.disk_store, ptr %58, i32 0, i32 11
  store ptr null, ptr %59, align 8, !tbaa !15
  br label %66

60:                                               ; preds = %45
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.disk_store, ptr %61, i32 0, i32 10
  store i8 1, ptr %62, align 8, !tbaa !14
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.disk_store, ptr %64, i32 0, i32 11
  store ptr %63, ptr %65, align 8, !tbaa !15
  br label %66

66:                                               ; preds = %60, %55
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.disk_store, ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  %70 = call i64 @ftell(ptr noundef %69)
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.disk_store, ptr %71, i32 0, i32 6
  store i64 %70, ptr %72, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.disk_store, ptr %73, i32 0, i32 4
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.disk_store, ptr %75, i32 0, i32 2
  %77 = load ptr, ptr %76, align 8, !tbaa !13
  %78 = call i64 @fread(ptr noundef %74, i64 noundef 4, i64 noundef 1, ptr noundef %77)
  store i64 %78, ptr %11, align 8, !tbaa !17
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.disk_store, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.disk_store, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !13
  %85 = load i64, ptr %11, align 8, !tbaa !17
  call void @check_file_read(ptr noundef %81, ptr noundef %84, i64 noundef 1, i64 noundef %85)
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.disk_store, ptr %86, i32 0, i32 5
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.disk_store, ptr %88, i32 0, i32 2
  %90 = load ptr, ptr %89, align 8, !tbaa !13
  %91 = call i64 @fread(ptr noundef %87, i64 noundef 4, i64 noundef 1, ptr noundef %90)
  store i64 %91, ptr %11, align 8, !tbaa !17
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.disk_store, ptr %92, i32 0, i32 0
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.disk_store, ptr %95, i32 0, i32 2
  %97 = load ptr, ptr %96, align 8, !tbaa !13
  %98 = load i64, ptr %11, align 8, !tbaa !17
  call void @check_file_read(ptr noundef %94, ptr noundef %97, i64 noundef 1, i64 noundef %98)
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.disk_store, ptr %99, i32 0, i32 4
  %101 = load i32, ptr %100, align 8, !tbaa !18
  %102 = zext i32 %101 to i64
  %103 = call noalias ptr @calloc(i64 noundef %102, i64 noundef 8) #7
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.disk_store, ptr %104, i32 0, i32 8
  store ptr %103, ptr %105, align 8, !tbaa !19
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.disk_store, ptr %106, i32 0, i32 8
  %108 = load ptr, ptr %107, align 8, !tbaa !19
  %109 = icmp eq ptr %108, null
  br i1 %109, label %110, label %111

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

111:                                              ; preds = %66
  %112 = load ptr, ptr %9, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.disk_store, ptr %112, i32 0, i32 8
  %114 = load ptr, ptr %113, align 8, !tbaa !19
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.disk_store, ptr %115, i32 0, i32 4
  %117 = load i32, ptr %116, align 8, !tbaa !18
  %118 = zext i32 %117 to i64
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.disk_store, ptr %119, i32 0, i32 2
  %121 = load ptr, ptr %120, align 8, !tbaa !13
  %122 = call i64 @fread(ptr noundef %114, i64 noundef 8, i64 noundef %118, ptr noundef %121)
  store i64 %122, ptr %11, align 8, !tbaa !17
  %123 = load ptr, ptr %9, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.disk_store, ptr %123, i32 0, i32 0
  %125 = load ptr, ptr %124, align 8, !tbaa !9
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.disk_store, ptr %126, i32 0, i32 2
  %128 = load ptr, ptr %127, align 8, !tbaa !13
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.disk_store, ptr %129, i32 0, i32 4
  %131 = load i32, ptr %130, align 8, !tbaa !18
  %132 = zext i32 %131 to i64
  %133 = load i64, ptr %11, align 8, !tbaa !17
  call void @check_file_read(ptr noundef %125, ptr noundef %128, i64 noundef %132, i64 noundef %133)
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.disk_store, ptr %134, i32 0, i32 10
  %136 = load i8, ptr %135, align 8, !tbaa !14
  %137 = icmp ne i8 %136, 0
  br i1 %137, label %138, label %174

138:                                              ; preds = %111
  %139 = load ptr, ptr %9, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.disk_store, ptr %139, i32 0, i32 4
  %141 = load i32, ptr %140, align 8, !tbaa !18
  %142 = zext i32 %141 to i64
  %143 = call noalias ptr @calloc(i64 noundef %142, i64 noundef 4) #7
  %144 = load ptr, ptr %9, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.disk_store, ptr %144, i32 0, i32 9
  store ptr %143, ptr %145, align 8, !tbaa !20
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.disk_store, ptr %146, i32 0, i32 9
  %148 = load ptr, ptr %147, align 8, !tbaa !20
  %149 = icmp eq ptr %148, null
  br i1 %149, label %150, label %151

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

151:                                              ; preds = %138
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.disk_store, ptr %152, i32 0, i32 9
  %154 = load ptr, ptr %153, align 8, !tbaa !20
  %155 = load ptr, ptr %9, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.disk_store, ptr %155, i32 0, i32 4
  %157 = load i32, ptr %156, align 8, !tbaa !18
  %158 = zext i32 %157 to i64
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.disk_store, ptr %159, i32 0, i32 2
  %161 = load ptr, ptr %160, align 8, !tbaa !13
  %162 = call i64 @fread(ptr noundef %154, i64 noundef 4, i64 noundef %158, ptr noundef %161)
  store i64 %162, ptr %11, align 8, !tbaa !17
  %163 = load ptr, ptr %9, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.disk_store, ptr %163, i32 0, i32 0
  %165 = load ptr, ptr %164, align 8, !tbaa !9
  %166 = load ptr, ptr %9, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.disk_store, ptr %166, i32 0, i32 2
  %168 = load ptr, ptr %167, align 8, !tbaa !13
  %169 = load ptr, ptr %9, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.disk_store, ptr %169, i32 0, i32 4
  %171 = load i32, ptr %170, align 8, !tbaa !18
  %172 = zext i32 %171 to i64
  %173 = load i64, ptr %11, align 8, !tbaa !17
  call void @check_file_read(ptr noundef %165, ptr noundef %168, i64 noundef %172, i64 noundef %173)
  br label %177

174:                                              ; preds = %111
  %175 = load ptr, ptr %9, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.disk_store, ptr %175, i32 0, i32 9
  store ptr null, ptr %176, align 8, !tbaa !20
  br label %177

177:                                              ; preds = %174, %151
  %178 = load ptr, ptr %8, align 8, !tbaa !5
  %179 = call noalias ptr @strdup(ptr noundef %178) #6
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.disk_store, ptr %180, i32 0, i32 1
  store ptr %179, ptr %181, align 8, !tbaa !21
  %182 = load ptr, ptr %7, align 8, !tbaa !5
  %183 = icmp eq ptr %182, null
  br i1 %183, label %188, label %184

184:                                              ; preds = %177
  %185 = load ptr, ptr %7, align 8, !tbaa !5
  %186 = load ptr, ptr %185, align 8, !tbaa !5
  %187 = icmp eq ptr %186, null
  br i1 %187, label %188, label %200

188:                                              ; preds = %184, %177
  %189 = load ptr, ptr %8, align 8, !tbaa !5
  %190 = call noalias ptr @fopen(ptr noundef %189, ptr noundef @.str.9)
  %191 = load ptr, ptr %9, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.disk_store, ptr %191, i32 0, i32 3
  store ptr %190, ptr %192, align 8, !tbaa !22
  %193 = load ptr, ptr %9, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.disk_store, ptr %193, i32 0, i32 3
  %195 = load ptr, ptr %194, align 8, !tbaa !22
  %196 = icmp eq ptr %195, null
  br i1 %196, label %197, label %199

197:                                              ; preds = %188
  %198 = load ptr, ptr %8, align 8, !tbaa !5
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.6, ptr noundef %198) #8
  unreachable

199:                                              ; preds = %188
  br label %205

200:                                              ; preds = %184
  %201 = load ptr, ptr %7, align 8, !tbaa !5
  %202 = load ptr, ptr %201, align 8, !tbaa !5
  %203 = load ptr, ptr %9, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.disk_store, ptr %203, i32 0, i32 3
  store ptr %202, ptr %204, align 8, !tbaa !22
  br label %205

205:                                              ; preds = %200, %199
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %206 = load ptr, ptr %9, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.disk_store, ptr %206, i32 0, i32 3
  %208 = load ptr, ptr %207, align 8, !tbaa !22
  %209 = load ptr, ptr %9, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.disk_store, ptr %209, i32 0, i32 1
  %211 = load ptr, ptr %210, align 8, !tbaa !21
  %212 = call ptr @read_disk_file_header(ptr noundef %208, ptr noundef %211, ptr noundef @.str.7)
  store ptr %212, ptr %12, align 8, !tbaa !5
  %213 = load ptr, ptr %12, align 8, !tbaa !5
  %214 = icmp eq ptr %213, null
  br i1 %214, label %215, label %224

215:                                              ; preds = %205
  %216 = load ptr, ptr %9, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.disk_store, ptr %216, i32 0, i32 11
  %218 = load ptr, ptr %217, align 8, !tbaa !15
  %219 = icmp ne ptr %218, null
  br i1 %219, label %220, label %223

220:                                              ; preds = %215
  %221 = load ptr, ptr %8, align 8, !tbaa !5
  %222 = load ptr, ptr %6, align 8, !tbaa !5
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.11, ptr noundef %221, ptr noundef %222) #8
  unreachable

223:                                              ; preds = %215
  br label %265

224:                                              ; preds = %205
  %225 = load ptr, ptr %9, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.disk_store, ptr %225, i32 0, i32 11
  %227 = load ptr, ptr %226, align 8, !tbaa !15
  %228 = icmp ne ptr %227, null
  br i1 %228, label %229, label %263

229:                                              ; preds = %224
  %230 = load ptr, ptr %12, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.disk_file_header, ptr %230, i32 0, i32 0
  %232 = load i8, ptr %231, align 8, !tbaa !23
  %233 = zext i8 %232 to i32
  %234 = load ptr, ptr %10, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.disk_file_header, ptr %234, i32 0, i32 0
  %236 = load i8, ptr %235, align 8, !tbaa !23
  %237 = zext i8 %236 to i32
  %238 = icmp ne i32 %233, %237
  br i1 %238, label %259, label %239

239:                                              ; preds = %229
  %240 = load ptr, ptr %12, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.disk_file_header, ptr %240, i32 0, i32 1
  %242 = load i8, ptr %241, align 1, !tbaa !25
  %243 = zext i8 %242 to i32
  %244 = load ptr, ptr %10, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.disk_file_header, ptr %244, i32 0, i32 1
  %246 = load i8, ptr %245, align 1, !tbaa !25
  %247 = zext i8 %246 to i32
  %248 = icmp ne i32 %243, %247
  br i1 %248, label %259, label %249

249:                                              ; preds = %239
  %250 = load ptr, ptr %12, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.disk_file_header, ptr %250, i32 0, i32 2
  %252 = load i8, ptr %251, align 2, !tbaa !26
  %253 = zext i8 %252 to i32
  %254 = load ptr, ptr %10, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.disk_file_header, ptr %254, i32 0, i32 2
  %256 = load i8, ptr %255, align 2, !tbaa !26
  %257 = zext i8 %256 to i32
  %258 = icmp ne i32 %253, %257
  br i1 %258, label %259, label %262

259:                                              ; preds = %249, %239, %229
  %260 = load ptr, ptr %8, align 8, !tbaa !5
  %261 = load ptr, ptr %6, align 8, !tbaa !5
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.12, ptr noundef %260, ptr noundef %261) #8
  unreachable

262:                                              ; preds = %249
  br label %263

263:                                              ; preds = %262, %224
  %264 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %264) #6
  br label %265

265:                                              ; preds = %263, %223
  %266 = load ptr, ptr %9, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.disk_store, ptr %266, i32 0, i32 3
  %268 = load ptr, ptr %267, align 8, !tbaa !22
  %269 = call i64 @ftell(ptr noundef %268)
  %270 = load ptr, ptr %9, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.disk_store, ptr %270, i32 0, i32 7
  store i64 %269, ptr %271, align 8, !tbaa !27
  %272 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  ret ptr %272
}

declare ptr @read_disk_file_header(ptr noundef, ptr noundef, ptr noundef) #4

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

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

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

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 = { 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 #3 = { 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 = { "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 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 = { nounwind }
attributes #7 = { nounwind allocsize(0,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, !6, i64 0}
!10 = !{!"disk_store", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !11, i64 36, !12, i64 40, !12, i64 48, !6, i64 56, !6, i64 64, !7, i64 72, !6, i64 80}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !6, i64 16}
!14 = !{!10, !7, i64 72}
!15 = !{!10, !6, i64 80}
!16 = !{!10, !12, i64 40}
!17 = !{!12, !12, i64 0}
!18 = !{!10, !11, i64 32}
!19 = !{!10, !6, i64 56}
!20 = !{!10, !6, i64 64}
!21 = !{!10, !6, i64 8}
!22 = !{!10, !6, i64 24}
!23 = !{!24, !7, i64 0}
!24 = !{!"disk_file_header", !7, i64 0, !7, i64 1, !7, i64 2, !6, i64 8, !6, i64 16}
!25 = !{!24, !7, i64 1}
!26 = !{!24, !7, i64 2}
!27 = !{!10, !12, i64 48}


; 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.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [60 x i8], align 1

; 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: noreturn
declare void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @disk_store_load(ptr noundef readonly %0, ptr noundef %1, ptr noundef readonly %2, ptr noundef %3) local_unnamed_addr #4 {
  %5 = tail call noalias dereferenceable_or_null(88) ptr @calloc(i64 noundef 1, i64 noundef 88) #7
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %8

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

8:                                                ; preds = %4
  %9 = tail call noalias ptr @strdup(ptr noundef %1) #9
  store ptr %9, ptr %5, align 8, !tbaa !5
  %10 = icmp eq ptr %0, null
  br i1 %10, label %14, label %11

11:                                               ; preds = %8
  %12 = load ptr, ptr %0, align 8, !tbaa !12
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %19

14:                                               ; preds = %11, %8
  %15 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.9)
  %16 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %15, ptr %16, align 8, !tbaa !13
  %17 = icmp eq ptr %15, null
  br i1 %17, label %18, label %21

18:                                               ; preds = %14
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.10, ptr noundef %1) #8
  unreachable

19:                                               ; preds = %11
  %20 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %12, ptr %20, align 8, !tbaa !13
  br label %21

21:                                               ; preds = %14, %19
  %22 = phi ptr [ %15, %14 ], [ %12, %19 ]
  %23 = getelementptr inbounds i8, ptr %5, i64 16
  %24 = tail call ptr @read_disk_file_header(ptr noundef nonnull %22, ptr noundef %9, ptr noundef nonnull @.str.3) #9
  %25 = icmp ne ptr %24, null
  %spec.select = zext i1 %25 to i8
  %26 = getelementptr inbounds i8, ptr %5, i64 72
  store i8 %spec.select, ptr %26, align 8
  %27 = getelementptr inbounds i8, ptr %5, i64 80
  store ptr %24, ptr %27, align 8
  %28 = tail call i64 @ftell(ptr noundef nonnull %22)
  %29 = getelementptr inbounds i8, ptr %5, i64 40
  store i64 %28, ptr %29, align 8, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %5, i64 32
  %31 = tail call i64 @fread(ptr noundef nonnull %30, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %22)
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load ptr, ptr %23, align 8, !tbaa !13
  tail call void @check_file_read(ptr noundef %32, ptr noundef %33, i64 noundef 1, i64 noundef %31) #9
  %34 = getelementptr inbounds i8, ptr %5, i64 36
  %35 = tail call i64 @fread(ptr noundef nonnull %34, i64 noundef 4, i64 noundef 1, ptr noundef %33)
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load ptr, ptr %23, align 8, !tbaa !13
  tail call void @check_file_read(ptr noundef %36, ptr noundef %37, i64 noundef 1, i64 noundef %35) #9
  %38 = load i32, ptr %30, align 8, !tbaa !15
  %39 = zext i32 %38 to i64
  %40 = tail call noalias ptr @calloc(i64 noundef %39, i64 noundef 8) #7
  %41 = getelementptr inbounds i8, ptr %5, i64 56
  store ptr %40, ptr %41, align 8, !tbaa !16
  %42 = icmp eq ptr %40, null
  br i1 %42, label %43, label %44

43:                                               ; preds = %21
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.8) #8
  unreachable

44:                                               ; preds = %21
  %45 = tail call i64 @fread(ptr noundef nonnull %40, i64 noundef 8, i64 noundef %39, ptr noundef %37)
  tail call void @check_file_read(ptr noundef %36, ptr noundef %37, i64 noundef %39, i64 noundef %45) #9
  %46 = load i8, ptr %26, align 8, !tbaa !17
  %.not = icmp eq i8 %46, 0
  br i1 %.not, label %54, label %47

47:                                               ; preds = %44
  %48 = tail call noalias ptr @calloc(i64 noundef %39, i64 noundef 4) #7
  %49 = getelementptr inbounds i8, ptr %5, i64 64
  store ptr %48, ptr %49, align 8, !tbaa !18
  %50 = icmp eq ptr %48, null
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.8) #8
  unreachable

52:                                               ; preds = %47
  %53 = tail call i64 @fread(ptr noundef nonnull %48, i64 noundef 4, i64 noundef %39, ptr noundef %37)
  tail call void @check_file_read(ptr noundef %36, ptr noundef %37, i64 noundef %39, i64 noundef %53) #9
  br label %56

54:                                               ; preds = %44
  %55 = getelementptr inbounds i8, ptr %5, i64 64
  store ptr null, ptr %55, align 8, !tbaa !18
  br label %56

56:                                               ; preds = %54, %52
  %57 = tail call noalias ptr @strdup(ptr noundef %3) #9
  %58 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %57, ptr %58, align 8, !tbaa !19
  %59 = icmp eq ptr %2, null
  br i1 %59, label %63, label %60

60:                                               ; preds = %56
  %61 = load ptr, ptr %2, align 8, !tbaa !12
  %62 = icmp eq ptr %61, null
  br i1 %62, label %63, label %68

63:                                               ; preds = %60, %56
  %64 = tail call noalias ptr @fopen(ptr noundef %3, ptr noundef nonnull @.str.9)
  %65 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr %64, ptr %65, align 8, !tbaa !20
  %66 = icmp eq ptr %64, null
  br i1 %66, label %67, label %70

67:                                               ; preds = %63
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.6, ptr noundef %3) #8
  unreachable

68:                                               ; preds = %60
  %69 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr %61, ptr %69, align 8, !tbaa !20
  br label %70

70:                                               ; preds = %63, %68
  %71 = phi ptr [ %64, %63 ], [ %61, %68 ]
  %72 = tail call ptr @read_disk_file_header(ptr noundef nonnull %71, ptr noundef %57, ptr noundef nonnull @.str.7) #9
  %73 = icmp eq ptr %72, null
  %74 = load ptr, ptr %27, align 8, !tbaa !21
  %.not93 = icmp eq ptr %74, null
  br i1 %73, label %75, label %77

75:                                               ; preds = %70
  br i1 %.not93, label %93, label %76

76:                                               ; preds = %75
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.11, ptr noundef %3, ptr noundef %1) #8
  unreachable

77:                                               ; preds = %70
  br i1 %.not93, label %92, label %78

78:                                               ; preds = %77
  %79 = load i8, ptr %72, align 8, !tbaa !22
  %80 = load i8, ptr %24, align 8, !tbaa !22
  %.not90 = icmp eq i8 %79, %80
  br i1 %.not90, label %81, label %91

81:                                               ; preds = %78
  %82 = getelementptr inbounds i8, ptr %72, i64 1
  %83 = load i8, ptr %82, align 1, !tbaa !24
  %84 = getelementptr inbounds i8, ptr %24, i64 1
  %85 = load i8, ptr %84, align 1, !tbaa !24
  %.not91 = icmp eq i8 %83, %85
  br i1 %.not91, label %86, label %91

86:                                               ; preds = %81
  %87 = getelementptr inbounds i8, ptr %72, i64 2
  %88 = load i8, ptr %87, align 2, !tbaa !25
  %89 = getelementptr inbounds i8, ptr %24, i64 2
  %90 = load i8, ptr %89, align 2, !tbaa !25
  %.not92 = icmp eq i8 %88, %90
  br i1 %.not92, label %92, label %91

91:                                               ; preds = %86, %81, %78
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.12, ptr noundef %3, ptr noundef %1) #8
  unreachable

92:                                               ; preds = %86, %77
  tail call void @free(ptr noundef nonnull %72) #9
  br label %93

93:                                               ; preds = %75, %92
  %94 = tail call i64 @ftell(ptr noundef nonnull %71)
  %95 = getelementptr inbounds i8, ptr %5, i64 48
  store i64 %94, ptr %95, align 8, !tbaa !26
  ret ptr %5
}

declare ptr @read_disk_file_header(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

declare void @check_file_read(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #5

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

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 = { 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 = { mustprogress nofree nounwind willreturn 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 #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "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 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 #7 = { nounwind allocsize(0,1) }
attributes #8 = { noreturn nounwind }
attributes #9 = { 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, !7, i64 0}
!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 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 16}
!14 = !{!6, !11, i64 40}
!15 = !{!6, !10, i64 32}
!16 = !{!6, !7, i64 56}
!17 = !{!6, !8, i64 72}
!18 = !{!6, !7, i64 64}
!19 = !{!6, !7, i64 8}
!20 = !{!6, !7, i64 24}
!21 = !{!6, !7, i64 80}
!22 = !{!23, !8, i64 0}
!23 = !{!"disk_file_header", !8, i64 0, !8, i64 1, !8, i64 2, !7, i64 8, !7, i64 16}
!24 = !{!23, !8, i64 1}
!25 = !{!23, !8, i64 2}
!26 = !{!6, !11, i64 48}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass