; LLVM IR from giacomo-ascari/dichotomic-compression :: legacy/dc/dc.ll (dc_deserialize)

; 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._dc_decompression = type { i32, i8, ptr, ptr, i8, i64, ptr, ptr }
%struct._dc_light_sector = type { %struct._dc_pixel, i8, i8, ptr, ptr }
%struct._dc_pixel = type { i8, i8, i8 }
%struct._dc_pixel_matrix = type { ptr, i32, i32 }

@stderr = external global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [19 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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @_dc_append_light_sector(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @_dc_deserialize(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca [8 x i8], align 1
  %5 = alloca [1024 x i8], align 16
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._dc_decompression, ptr %15, i32 0, i32 2
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = call i32 (ptr, i32, ...) @open(ptr noundef %17, i32 noundef 2, i32 noundef 256)
  store i32 %18, ptr %3, align 4, !tbaa !13
  %19 = load i32, ptr %3, align 4, !tbaa !13
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %24, label %21

21:                                               ; preds = %1
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str.14) #6
  call void @exit(i32 noundef 1) #7
  unreachable

24:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %25 = load i32, ptr %3, align 4, !tbaa !13
  %26 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 0
  %27 = call i64 @read(i32 noundef %25, ptr noundef %26, i64 noundef 2)
  %28 = icmp eq i64 %27, 2
  br i1 %28, label %29, label %38

29:                                               ; preds = %24
  %30 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 0
  %31 = load i8, ptr %30, align 1, !tbaa !14
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct._dc_decompression, ptr %32, i32 0, i32 1
  store i8 %31, ptr %33, align 4, !tbaa !15
  %34 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 1
  %35 = load i8, ptr %34, align 1, !tbaa !14
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._dc_decompression, ptr %36, i32 0, i32 4
  store i8 %35, ptr %37, align 8, !tbaa !16
  br label %41

38:                                               ; preds = %24
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str.29) #6
  call void @exit(i32 noundef 1) #7
  unreachable

41:                                               ; preds = %29
  %42 = load i32, ptr %3, align 4, !tbaa !13
  %43 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 0
  %44 = call i64 @read(i32 noundef %42, ptr noundef %43, i64 noundef 8)
  %45 = icmp eq i64 %44, 8
  br i1 %45, label %46, label %85

46:                                               ; preds = %41
  %47 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 0
  %48 = load i8, ptr %47, align 1, !tbaa !14
  %49 = zext i8 %48 to i32
  %50 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 1
  %51 = load i8, ptr %50, align 1, !tbaa !14
  %52 = zext i8 %51 to i32
  %53 = shl i32 %52, 8
  %54 = add nsw i32 %49, %53
  %55 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 2
  %56 = load i8, ptr %55, align 1, !tbaa !14
  %57 = zext i8 %56 to i32
  %58 = shl i32 %57, 16
  %59 = add nsw i32 %54, %58
  %60 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 3
  %61 = load i8, ptr %60, align 1, !tbaa !14
  %62 = zext i8 %61 to i32
  %63 = shl i32 %62, 24
  %64 = add nsw i32 %59, %63
  store i32 %64, ptr %10, align 4, !tbaa !13
  %65 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 4
  %66 = load i8, ptr %65, align 1, !tbaa !14
  %67 = zext i8 %66 to i32
  %68 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 5
  %69 = load i8, ptr %68, align 1, !tbaa !14
  %70 = zext i8 %69 to i32
  %71 = shl i32 %70, 8
  %72 = add nsw i32 %67, %71
  %73 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 6
  %74 = load i8, ptr %73, align 1, !tbaa !14
  %75 = zext i8 %74 to i32
  %76 = shl i32 %75, 16
  %77 = add nsw i32 %72, %76
  %78 = getelementptr inbounds [8 x i8], ptr %4, i64 0, i64 7
  %79 = load i8, ptr %78, align 1, !tbaa !14
  %80 = zext i8 %79 to i32
  %81 = shl i32 %80, 24
  %82 = add nsw i32 %77, %81
  store i32 %82, ptr %11, align 4, !tbaa !13
  %83 = load i32, ptr %10, align 4, !tbaa !13
  store i32 %83, ptr %6, align 4, !tbaa !13
  %84 = load i32, ptr %11, align 4, !tbaa !13
  store i32 %84, ptr %7, align 4, !tbaa !13
  br label %88

85:                                               ; preds = %41
  %86 = load ptr, ptr @stderr, align 8, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef @.str.30) #6
  call void @exit(i32 noundef 1) #7
  unreachable

88:                                               ; preds = %46
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._dc_decompression, ptr %89, i32 0, i32 1
  %91 = load i8, ptr %90, align 4, !tbaa !15
  %92 = zext i8 %91 to i32
  %93 = icmp slt i32 %92, 1
  br i1 %93, label %100, label %94

94:                                               ; preds = %88
  %95 = load ptr, ptr %2, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._dc_decompression, ptr %95, i32 0, i32 1
  %97 = load i8, ptr %96, align 4, !tbaa !15
  %98 = zext i8 %97 to i32
  %99 = icmp sgt i32 %98, 2
  br i1 %99, label %100, label %103

100:                                              ; preds = %94, %88
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef @.str.31) #6
  call void @exit(i32 noundef 1) #7
  unreachable

103:                                              ; preds = %94
  br label %104

104:                                              ; preds = %207, %103
  %105 = load i32, ptr %3, align 4, !tbaa !13
  %106 = getelementptr inbounds [1024 x i8], ptr %5, i64 0, i64 0
  %107 = call i64 @read(i32 noundef %105, ptr noundef %106, i64 noundef 1024)
  %108 = trunc i64 %107 to i32
  store i32 %108, ptr %8, align 4, !tbaa !13
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %208

110:                                              ; preds = %104
  %111 = load ptr, ptr %2, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._dc_decompression, ptr %111, i32 0, i32 1
  %113 = load i8, ptr %112, align 4, !tbaa !15
  %114 = zext i8 %113 to i32
  switch i32 %114, label %206 [
    i32 1, label %115
    i32 2, label %168
  ]

115:                                              ; preds = %110
  %116 = load i32, ptr %8, align 4, !tbaa !13
  %117 = srem i32 %116, 4
  %118 = icmp eq i32 %117, 0
  br i1 %118, label %119, label %164

119:                                              ; preds = %115
  %120 = load i32, ptr %8, align 4, !tbaa !13
  %121 = load i32, ptr %9, align 4, !tbaa !13
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr %9, align 4, !tbaa !13
  store i64 0, ptr %12, align 8, !tbaa !17
  br label %123

123:                                              ; preds = %128, %119
  %124 = load i64, ptr %12, align 8, !tbaa !17
  %125 = load i32, ptr %8, align 4, !tbaa !13
  %126 = sext i32 %125 to i64
  %127 = icmp ult i64 %124, %126
  br i1 %127, label %128, label %163

128:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %129 = call noalias ptr @malloc(i64 noundef 24) #8
  store ptr %129, ptr %13, align 8, !tbaa !5
  %130 = load i64, ptr %12, align 8, !tbaa !17
  %131 = add i64 %130, 1
  store i64 %131, ptr %12, align 8, !tbaa !17
  %132 = getelementptr inbounds [1024 x i8], ptr %5, i64 0, i64 %130
  %133 = load i8, ptr %132, align 1, !tbaa !14
  %134 = load ptr, ptr %13, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct._dc_light_sector, ptr %134, i32 0, i32 2
  store i8 %133, ptr %135, align 4, !tbaa !18
  %136 = load i64, ptr %12, align 8, !tbaa !17
  %137 = add i64 %136, 1
  store i64 %137, ptr %12, align 8, !tbaa !17
  %138 = getelementptr inbounds [1024 x i8], ptr %5, i64 0, i64 %136
  %139 = load i8, ptr %138, align 1, !tbaa !14
  %140 = load ptr, ptr %13, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._dc_light_sector, ptr %140, i32 0, i32 0
  %142 = getelementptr inbounds %struct._dc_pixel, ptr %141, i32 0, i32 0
  store i8 %139, ptr %142, align 8, !tbaa !21
  %143 = load i64, ptr %12, align 8, !tbaa !17
  %144 = add i64 %143, 1
  store i64 %144, ptr %12, align 8, !tbaa !17
  %145 = getelementptr inbounds [1024 x i8], ptr %5, i64 0, i64 %143
  %146 = load i8, ptr %145, align 1, !tbaa !14
  %147 = load ptr, ptr %13, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct._dc_light_sector, ptr %147, i32 0, i32 0
  %149 = getelementptr inbounds %struct._dc_pixel, ptr %148, i32 0, i32 1
  store i8 %146, ptr %149, align 1, !tbaa !22
  %150 = load i64, ptr %12, align 8, !tbaa !17
  %151 = add i64 %150, 1
  store i64 %151, ptr %12, align 8, !tbaa !17
  %152 = getelementptr inbounds [1024 x i8], ptr %5, i64 0, i64 %150
  %153 = load i8, ptr %152, align 1, !tbaa !14
  %154 = load ptr, ptr %13, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct._dc_light_sector, ptr %154, i32 0, i32 0
  %156 = getelementptr inbounds %struct._dc_pixel, ptr %155, i32 0, i32 2
  store i8 %153, ptr %156, align 2, !tbaa !23
  %157 = load ptr, ptr %2, align 8, !tbaa !5
  %158 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_dc_append_light_sector(ptr noundef %157, ptr noundef %158)
  %159 = load ptr, ptr %2, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct._dc_decompression, ptr %159, i32 0, i32 5
  %161 = load i64, ptr %160, align 8, !tbaa !24
  %162 = add i64 %161, 1
  store i64 %162, ptr %160, align 8, !tbaa !24
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %123, !llvm.loop !25

163:                                              ; preds = %123
  br label %167

164:                                              ; preds = %115
  %165 = load ptr, ptr @stderr, align 8, !tbaa !5
  %166 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %165, ptr noundef @.str.32) #6
  call void @exit(i32 noundef 1) #7
  unreachable

167:                                              ; preds = %163
  br label %207

168:                                              ; preds = %110
  %169 = load i32, ptr %8, align 4, !tbaa !13
  %170 = srem i32 %169, 1
  %171 = icmp eq i32 %170, 0
  br i1 %171, label %172, label %202

172:                                              ; preds = %168
  %173 = load i32, ptr %8, align 4, !tbaa !13
  %174 = load i32, ptr %9, align 4, !tbaa !13
  %175 = add nsw i32 %174, %173
  store i32 %175, ptr %9, align 4, !tbaa !13
  store i64 0, ptr %12, align 8, !tbaa !17
  br label %176

176:                                              ; preds = %181, %172
  %177 = load i64, ptr %12, align 8, !tbaa !17
  %178 = load i32, ptr %8, align 4, !tbaa !13
  %179 = sext i32 %178 to i64
  %180 = icmp ult i64 %177, %179
  br i1 %180, label %181, label %201

181:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %182 = call noalias ptr @malloc(i64 noundef 24) #8
  store ptr %182, ptr %14, align 8, !tbaa !5
  %183 = load i64, ptr %12, align 8, !tbaa !17
  %184 = add i64 %183, 1
  store i64 %184, ptr %12, align 8, !tbaa !17
  %185 = getelementptr inbounds [1024 x i8], ptr %5, i64 0, i64 %183
  %186 = load i8, ptr %185, align 1, !tbaa !14
  %187 = load ptr, ptr %14, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct._dc_light_sector, ptr %187, i32 0, i32 2
  store i8 %186, ptr %188, align 4, !tbaa !18
  %189 = load i64, ptr %12, align 8, !tbaa !17
  %190 = add i64 %189, 1
  store i64 %190, ptr %12, align 8, !tbaa !17
  %191 = getelementptr inbounds [1024 x i8], ptr %5, i64 0, i64 %189
  %192 = load i8, ptr %191, align 1, !tbaa !14
  %193 = load ptr, ptr %14, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct._dc_light_sector, ptr %193, i32 0, i32 1
  store i8 %192, ptr %194, align 1, !tbaa !27
  %195 = load ptr, ptr %2, align 8, !tbaa !5
  %196 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_dc_append_light_sector(ptr noundef %195, ptr noundef %196)
  %197 = load ptr, ptr %2, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct._dc_decompression, ptr %197, i32 0, i32 5
  %199 = load i64, ptr %198, align 8, !tbaa !24
  %200 = add i64 %199, 1
  store i64 %200, ptr %198, align 8, !tbaa !24
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %176, !llvm.loop !28

201:                                              ; preds = %176
  br label %205

202:                                              ; preds = %168
  %203 = load ptr, ptr @stderr, align 8, !tbaa !5
  %204 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %203, ptr noundef @.str.32) #6
  call void @exit(i32 noundef 1) #7
  unreachable

205:                                              ; preds = %201
  br label %207

206:                                              ; preds = %110
  br label %207

207:                                              ; preds = %206, %205, %167
  br label %104, !llvm.loop !29

208:                                              ; preds = %104
  %209 = load i32, ptr %3, align 4, !tbaa !13
  %210 = call i32 @close(i32 noundef %209)
  %211 = load i32, ptr %6, align 4, !tbaa !13
  %212 = load ptr, ptr %2, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct._dc_decompression, ptr %212, i32 0, i32 6
  %214 = load ptr, ptr %213, align 8, !tbaa !30
  %215 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %214, i32 0, i32 1
  store i32 %211, ptr %215, align 8, !tbaa !31
  %216 = load i32, ptr %7, align 4, !tbaa !13
  %217 = load ptr, ptr %2, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct._dc_decompression, ptr %217, i32 0, i32 6
  %219 = load ptr, ptr %218, align 8, !tbaa !30
  %220 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %219, i32 0, i32 2
  store i32 %216, ptr %220, align 4, !tbaa !33
  %221 = load i32, ptr %6, align 4, !tbaa !13
  %222 = sext i32 %221 to i64
  %223 = mul i64 3, %222
  %224 = load i32, ptr %7, align 4, !tbaa !13
  %225 = sext i32 %224 to i64
  %226 = mul i64 %223, %225
  %227 = call noalias ptr @malloc(i64 noundef %226) #8
  %228 = load ptr, ptr %2, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct._dc_decompression, ptr %228, i32 0, i32 6
  %230 = load ptr, ptr %229, align 8, !tbaa !30
  %231 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %230, i32 0, i32 0
  store ptr %227, ptr %231, align 8, !tbaa !34
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  ret void
}

declare i32 @open(ptr noundef, i32 noundef, ...) #5

declare i64 @read(i32 noundef, ptr noundef, i64 noundef) #5

declare i32 @close(i32 noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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 = !{!10, !6, i64 8}
!10 = !{!"_dc_decompression", !11, i64 0, !7, i64 4, !6, i64 8, !6, i64 16, !7, i64 24, !12, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !7, i64 4}
!16 = !{!10, !7, i64 24}
!17 = !{!12, !12, i64 0}
!18 = !{!19, !7, i64 4}
!19 = !{!"_dc_light_sector", !20, i64 0, !7, i64 3, !7, i64 4, !6, i64 8, !6, i64 16}
!20 = !{!"_dc_pixel", !7, i64 0, !7, i64 1, !7, i64 2}
!21 = !{!19, !7, i64 0}
!22 = !{!19, !7, i64 1}
!23 = !{!19, !7, i64 2}
!24 = !{!10, !12, i64 32}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!19, !7, i64 3}
!28 = distinct !{!28, !26}
!29 = distinct !{!29, !26}
!30 = !{!10, !6, i64 40}
!31 = !{!32, !11, i64 8}
!32 = !{!"_dc_pixel_matrix", !6, i64 0, !11, i64 8, !11, i64 12}
!33 = !{!32, !11, i64 12}
!34 = !{!32, !6, i64 0}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [19 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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @_dc_append_light_sector(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local void @_dc_deserialize(ptr noundef %0) local_unnamed_addr #4 {
  %2 = alloca [8 x i8], align 2
  %3 = alloca [1024 x i8], align 16
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = tail call i32 (ptr, i32, ...) @open(ptr noundef %5, i32 noundef 2, i32 noundef 256) #7
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %10

7:                                                ; preds = %1
  %8 = load ptr, ptr @stderr, align 8, !tbaa !12
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str.14) #8
  tail call void @exit(i32 noundef 1) #9
  unreachable

10:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %3) #7
  %11 = call i64 @read(i32 noundef %6, ptr noundef nonnull %2, i64 noundef 2) #7
  %12 = icmp eq i64 %11, 2
  br i1 %12, label %13, label %21

13:                                               ; preds = %10
  %14 = load i8, ptr %2, align 2, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 4
  store i8 %14, ptr %15, align 4, !tbaa !14
  %16 = getelementptr inbounds i8, ptr %2, i64 1
  %17 = load i8, ptr %16, align 1, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %0, i64 24
  store i8 %17, ptr %18, align 8, !tbaa !15
  %19 = call i64 @read(i32 noundef %6, ptr noundef nonnull %2, i64 noundef 8) #7
  %20 = icmp eq i64 %19, 8
  br i1 %20, label %24, label %41

21:                                               ; preds = %10
  %22 = load ptr, ptr @stderr, align 8, !tbaa !12
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.29) #8
  tail call void @exit(i32 noundef 1) #9
  unreachable

24:                                               ; preds = %13
  %25 = load i16, ptr %2, align 2
  %26 = getelementptr inbounds i8, ptr %2, i64 2
  %27 = load i8, ptr %26, align 2, !tbaa !13
  %28 = getelementptr inbounds i8, ptr %2, i64 3
  %29 = load i8, ptr %28, align 1, !tbaa !13
  %30 = getelementptr inbounds i8, ptr %2, i64 4
  %31 = load i16, ptr %30, align 2
  %32 = getelementptr inbounds i8, ptr %2, i64 6
  %33 = load i8, ptr %32, align 2, !tbaa !13
  %34 = getelementptr inbounds i8, ptr %2, i64 7
  %35 = load i8, ptr %34, align 1, !tbaa !13
  %36 = load i8, ptr %15, align 4, !tbaa !14
  %37 = add i8 %36, -3
  %or.cond = icmp ult i8 %37, -2
  br i1 %or.cond, label %44, label %.preheader

.preheader:                                       ; preds = %24
  %38 = call i64 @read(i32 noundef %6, ptr noundef nonnull %3, i64 noundef 1024) #7
  %39 = trunc i64 %38 to i32
  %.not5258 = icmp eq i32 %39, 0
  br i1 %.not5258, label %._crit_edge, label %.lr.ph60

.lr.ph60:                                         ; preds = %.preheader
  %40 = getelementptr inbounds i8, ptr %0, i64 32
  br label %47

41:                                               ; preds = %13
  %42 = load ptr, ptr @stderr, align 8, !tbaa !12
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.30) #8
  tail call void @exit(i32 noundef 1) #9
  unreachable

44:                                               ; preds = %24
  %45 = load ptr, ptr @stderr, align 8, !tbaa !12
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.31) #8
  tail call void @exit(i32 noundef 1) #9
  unreachable

47:                                               ; preds = %.lr.ph60, %.loopexit
  %48 = phi i32 [ %39, %.lr.ph60 ], [ %93, %.loopexit ]
  %49 = phi i64 [ %38, %.lr.ph60 ], [ %92, %.loopexit ]
  %50 = load i8, ptr %15, align 4, !tbaa !14
  switch i8 %50, label %.loopexit [
    i8 1, label %51
    i8 2, label %78
  ]

51:                                               ; preds = %47
  %52 = and i32 %48, 3
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %75

54:                                               ; preds = %51
  %sext53 = shl i64 %49, 32
  %55 = ashr exact i64 %sext53, 32
  %.not62 = icmp eq i64 %sext53, 0
  br i1 %.not62, label %.loopexit, label %.lr.ph57

.lr.ph57:                                         ; preds = %54, %.lr.ph57
  %.04756 = phi i64 [ %68, %.lr.ph57 ], [ 0, %54 ]
  %56 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #10
  %57 = or disjoint i64 %.04756, 1
  %58 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 %.04756
  %59 = load i8, ptr %58, align 4, !tbaa !13
  %60 = getelementptr inbounds i8, ptr %56, i64 4
  store i8 %59, ptr %60, align 4, !tbaa !16
  %61 = or disjoint i64 %.04756, 2
  %62 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 %57
  %63 = load i8, ptr %62, align 1, !tbaa !13
  store i8 %63, ptr %56, align 8, !tbaa !19
  %64 = or disjoint i64 %.04756, 3
  %65 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 %61
  %66 = load i8, ptr %65, align 2, !tbaa !13
  %67 = getelementptr inbounds i8, ptr %56, i64 1
  store i8 %66, ptr %67, align 1, !tbaa !20
  %68 = add i64 %.04756, 4
  %69 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 %64
  %70 = load i8, ptr %69, align 1, !tbaa !13
  %71 = getelementptr inbounds i8, ptr %56, i64 2
  store i8 %70, ptr %71, align 2, !tbaa !21
  tail call void @_dc_append_light_sector(ptr noundef nonnull %0, ptr noundef nonnull %56)
  %72 = load i64, ptr %40, align 8, !tbaa !22
  %73 = add i64 %72, 1
  store i64 %73, ptr %40, align 8, !tbaa !22
  %74 = icmp ult i64 %68, %55
  br i1 %74, label %.lr.ph57, label %.loopexit, !llvm.loop !23

75:                                               ; preds = %51
  %76 = load ptr, ptr @stderr, align 8, !tbaa !12
  %77 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef nonnull @.str.32) #8
  tail call void @exit(i32 noundef 1) #9
  unreachable

78:                                               ; preds = %47
  %sext = shl i64 %49, 32
  %79 = ashr exact i64 %sext, 32
  %.not61 = icmp eq i64 %sext, 0
  br i1 %.not61, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %78, %.lr.ph
  %.14855 = phi i64 [ %85, %.lr.ph ], [ 0, %78 ]
  %80 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #10
  %81 = or disjoint i64 %.14855, 1
  %82 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 %.14855
  %83 = load i8, ptr %82, align 2, !tbaa !13
  %84 = getelementptr inbounds i8, ptr %80, i64 4
  store i8 %83, ptr %84, align 4, !tbaa !16
  %85 = add i64 %.14855, 2
  %86 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 %81
  %87 = load i8, ptr %86, align 1, !tbaa !13
  %88 = getelementptr inbounds i8, ptr %80, i64 3
  store i8 %87, ptr %88, align 1, !tbaa !25
  tail call void @_dc_append_light_sector(ptr noundef nonnull %0, ptr noundef %80)
  %89 = load i64, ptr %40, align 8, !tbaa !22
  %90 = add i64 %89, 1
  store i64 %90, ptr %40, align 8, !tbaa !22
  %91 = icmp ult i64 %85, %79
  br i1 %91, label %.lr.ph, label %.loopexit, !llvm.loop !26

.loopexit:                                        ; preds = %.lr.ph, %.lr.ph57, %78, %54, %47
  %92 = call i64 @read(i32 noundef %6, ptr noundef nonnull %3, i64 noundef 1024) #7
  %93 = trunc i64 %92 to i32
  %.not52 = icmp eq i32 %93, 0
  br i1 %.not52, label %._crit_edge, label %47, !llvm.loop !27

._crit_edge:                                      ; preds = %.loopexit, %.preheader
  %94 = zext i16 %31 to i32
  %95 = zext i16 %25 to i32
  %96 = zext i8 %33 to i32
  %97 = shl nuw nsw i32 %96, 16
  %98 = or disjoint i32 %97, %94
  %99 = zext i8 %35 to i32
  %100 = shl nuw i32 %99, 24
  %101 = or disjoint i32 %98, %100
  %102 = zext i8 %27 to i32
  %103 = shl nuw nsw i32 %102, 16
  %104 = or disjoint i32 %103, %95
  %105 = zext i8 %29 to i32
  %106 = shl nuw i32 %105, 24
  %107 = or disjoint i32 %104, %106
  %108 = tail call i32 @close(i32 noundef %6) #7
  %109 = getelementptr inbounds i8, ptr %0, i64 40
  %110 = load ptr, ptr %109, align 8, !tbaa !28
  %111 = getelementptr inbounds i8, ptr %110, i64 8
  store i32 %107, ptr %111, align 8, !tbaa !29
  %112 = getelementptr inbounds i8, ptr %110, i64 12
  store i32 %101, ptr %112, align 4, !tbaa !31
  %113 = sext i32 %107 to i64
  %114 = mul nsw i64 %113, 3
  %115 = sext i32 %101 to i64
  %116 = mul i64 %114, %115
  %117 = tail call noalias ptr @malloc(i64 noundef %116) #10
  store ptr %117, ptr %110, align 8, !tbaa !32
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  ret void
}

; Function Attrs: nofree
declare noundef i32 @open(ptr nocapture noundef readonly, i32 noundef, ...) local_unnamed_addr #5

; Function Attrs: nofree
declare noundef i64 @read(i32 noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #5

declare i32 @close(i32 noundef) local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { cold nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { 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, !10, i64 8}
!6 = !{!"_dc_decompression", !7, i64 0, !8, i64 4, !10, i64 8, !10, i64 16, !8, i64 24, !11, i64 32, !10, i64 40, !10, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!10, !10, i64 0}
!13 = !{!8, !8, i64 0}
!14 = !{!6, !8, i64 4}
!15 = !{!6, !8, i64 24}
!16 = !{!17, !8, i64 4}
!17 = !{!"_dc_light_sector", !18, i64 0, !8, i64 3, !8, i64 4, !10, i64 8, !10, i64 16}
!18 = !{!"_dc_pixel", !8, i64 0, !8, i64 1, !8, i64 2}
!19 = !{!17, !8, i64 0}
!20 = !{!17, !8, i64 1}
!21 = !{!17, !8, i64 2}
!22 = !{!6, !11, i64 32}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!17, !8, i64 3}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !24}
!28 = !{!6, !10, i64 40}
!29 = !{!30, !7, i64 8}
!30 = !{!"_dc_pixel_matrix", !10, i64 0, !7, i64 8, !7, i64 12}
!31 = !{!30, !7, i64 12}
!32 = !{!30, !10, i64 0}


; Effective O3 passes: AggressiveInstCombinePass,BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass