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

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

@stderr = external global ptr, align 8
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 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

declare i32 @fclose(ptr noundef) #1

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

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

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

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

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

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

22:                                               ; preds = %1
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._dc_compression, ptr %24, i32 0, i32 1
  %26 = load i8, ptr %25, align 4, !tbaa !13
  %27 = zext i8 %26 to i32
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._dc_compression, ptr %28, i32 0, i32 6
  %30 = load i8, ptr %29, align 8, !tbaa !14
  %31 = zext i8 %30 to i32
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef @.str.17, i32 noundef %27, i32 noundef %31) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._dc_compression, ptr %33, i32 0, i32 7
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !16
  store i32 %37, ptr %4, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._dc_compression, ptr %38, i32 0, i32 7
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  %41 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 4, !tbaa !19
  store i32 %42, ptr %5, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %43 = load i32, ptr %4, align 4, !tbaa !18
  %44 = ashr i32 %43, 24
  %45 = and i32 %44, 255
  %46 = trunc i32 %45 to i8
  %47 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 0
  store i8 %46, ptr %47, align 1, !tbaa !20
  %48 = load i32, ptr %4, align 4, !tbaa !18
  %49 = ashr i32 %48, 16
  %50 = and i32 %49, 255
  %51 = trunc i32 %50 to i8
  %52 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 1
  store i8 %51, ptr %52, align 1, !tbaa !20
  %53 = load i32, ptr %4, align 4, !tbaa !18
  %54 = ashr i32 %53, 8
  %55 = and i32 %54, 255
  %56 = trunc i32 %55 to i8
  %57 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 2
  store i8 %56, ptr %57, align 1, !tbaa !20
  %58 = load i32, ptr %4, align 4, !tbaa !18
  %59 = and i32 %58, 255
  %60 = trunc i32 %59 to i8
  %61 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 3
  store i8 %60, ptr %61, align 1, !tbaa !20
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 3
  %64 = load i8, ptr %63, align 1, !tbaa !20
  %65 = zext i8 %64 to i32
  %66 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 2
  %67 = load i8, ptr %66, align 1, !tbaa !20
  %68 = zext i8 %67 to i32
  %69 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 1
  %70 = load i8, ptr %69, align 1, !tbaa !20
  %71 = zext i8 %70 to i32
  %72 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 0
  %73 = load i8, ptr %72, align 1, !tbaa !20
  %74 = zext i8 %73 to i32
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef @.str.18, i32 noundef %65, i32 noundef %68, i32 noundef %71, i32 noundef %74) #5
  %76 = load i32, ptr %5, align 4, !tbaa !18
  %77 = ashr i32 %76, 24
  %78 = and i32 %77, 255
  %79 = trunc i32 %78 to i8
  %80 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 0
  store i8 %79, ptr %80, align 1, !tbaa !20
  %81 = load i32, ptr %5, align 4, !tbaa !18
  %82 = ashr i32 %81, 16
  %83 = and i32 %82, 255
  %84 = trunc i32 %83 to i8
  %85 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 1
  store i8 %84, ptr %85, align 1, !tbaa !20
  %86 = load i32, ptr %5, align 4, !tbaa !18
  %87 = ashr i32 %86, 8
  %88 = and i32 %87, 255
  %89 = trunc i32 %88 to i8
  %90 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 2
  store i8 %89, ptr %90, align 1, !tbaa !20
  %91 = load i32, ptr %5, align 4, !tbaa !18
  %92 = and i32 %91, 255
  %93 = trunc i32 %92 to i8
  %94 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 3
  store i8 %93, ptr %94, align 1, !tbaa !20
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 3
  %97 = load i8, ptr %96, align 1, !tbaa !20
  %98 = zext i8 %97 to i32
  %99 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 2
  %100 = load i8, ptr %99, align 1, !tbaa !20
  %101 = zext i8 %100 to i32
  %102 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 1
  %103 = load i8, ptr %102, align 1, !tbaa !20
  %104 = zext i8 %103 to i32
  %105 = getelementptr inbounds [4 x i8], ptr %6, i64 0, i64 0
  %106 = load i8, ptr %105, align 1, !tbaa !20
  %107 = zext i8 %106 to i32
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef @.str.18, i32 noundef %98, i32 noundef %101, i32 noundef %104, i32 noundef %107) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %109 = load i32, ptr %4, align 4, !tbaa !18
  %110 = load i32, ptr %5, align 4, !tbaa !18
  %111 = mul nsw i32 %109, %110
  %112 = sext i32 %111 to i64
  store i64 %112, ptr %7, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._dc_compression, ptr %113, i32 0, i32 1
  %115 = load i8, ptr %114, align 4, !tbaa !13
  %116 = zext i8 %115 to i32
  switch i32 %116, label %228 [
    i32 1, label %117
    i32 2, label %167
  ]

117:                                              ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 0, ptr %9, align 8, !tbaa !21
  br label %118

118:                                              ; preds = %163, %117
  %119 = load i64, ptr %9, align 8, !tbaa !21
  %120 = load i64, ptr %7, align 8, !tbaa !21
  %121 = icmp ult i64 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %166

123:                                              ; preds = %118
  %124 = load ptr, ptr %2, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._dc_compression, ptr %124, i32 0, i32 8
  %126 = load ptr, ptr %125, align 8, !tbaa !22
  %127 = load i64, ptr %9, align 8, !tbaa !21
  %128 = getelementptr inbounds ptr, ptr %126, i64 %127
  %129 = load ptr, ptr %128, align 8, !tbaa !5
  %130 = icmp ne ptr %129, null
  br i1 %130, label %131, label %162

131:                                              ; preds = %123
  %132 = load ptr, ptr %2, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._dc_compression, ptr %132, i32 0, i32 8
  %134 = load ptr, ptr %133, align 8, !tbaa !22
  %135 = load i64, ptr %9, align 8, !tbaa !21
  %136 = getelementptr inbounds ptr, ptr %134, i64 %135
  %137 = load ptr, ptr %136, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct._dc_heavy_sector, ptr %137, i32 0, i32 1
  store ptr %138, ptr %8, align 8, !tbaa !5
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = load ptr, ptr %2, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._dc_compression, ptr %140, i32 0, i32 8
  %142 = load ptr, ptr %141, align 8, !tbaa !22
  %143 = load i64, ptr %9, align 8, !tbaa !21
  %144 = getelementptr inbounds ptr, ptr %142, i64 %143
  %145 = load ptr, ptr %144, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct._dc_heavy_sector, ptr %145, i32 0, i32 3
  %147 = load i8, ptr %146, align 4, !tbaa !23
  %148 = zext i8 %147 to i32
  %149 = load ptr, ptr %8, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct._dc_pixel, ptr %149, i32 0, i32 0
  %151 = load i8, ptr %150, align 1, !tbaa !27
  %152 = zext i8 %151 to i32
  %153 = load ptr, ptr %8, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct._dc_pixel, ptr %153, i32 0, i32 1
  %155 = load i8, ptr %154, align 1, !tbaa !28
  %156 = zext i8 %155 to i32
  %157 = load ptr, ptr %8, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct._dc_pixel, ptr %157, i32 0, i32 2
  %159 = load i8, ptr %158, align 1, !tbaa !29
  %160 = zext i8 %159 to i32
  %161 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %139, ptr noundef @.str.18, i32 noundef %148, i32 noundef %152, i32 noundef %156, i32 noundef %160) #5
  br label %162

162:                                              ; preds = %131, %123
  br label %163

163:                                              ; preds = %162
  %164 = load i64, ptr %9, align 8, !tbaa !21
  %165 = add i64 %164, 1
  store i64 %165, ptr %9, align 8, !tbaa !21
  br label %118, !llvm.loop !30

166:                                              ; preds = %122
  br label %229

167:                                              ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 0, ptr %10, align 8, !tbaa !21
  br label %168

168:                                              ; preds = %224, %167
  %169 = load i64, ptr %10, align 8, !tbaa !21
  %170 = icmp ult i64 %169, 3
  br i1 %170, label %172, label %171

171:                                              ; preds = %168
  store i32 6, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %227

172:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 0, ptr %12, align 8, !tbaa !21
  br label %173

173:                                              ; preds = %220, %172
  %174 = load i64, ptr %12, align 8, !tbaa !21
  %175 = load i64, ptr %7, align 8, !tbaa !21
  %176 = icmp ult i64 %174, %175
  br i1 %176, label %178, label %177

177:                                              ; preds = %173
  store i32 9, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %223

178:                                              ; preds = %173
  %179 = load ptr, ptr %2, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct._dc_compression, ptr %179, i32 0, i32 8
  %181 = load ptr, ptr %180, align 8, !tbaa !22
  %182 = load i64, ptr %12, align 8, !tbaa !21
  %183 = load i64, ptr %7, align 8, !tbaa !21
  %184 = load i64, ptr %10, align 8, !tbaa !21
  %185 = mul i64 %183, %184
  %186 = add i64 %182, %185
  %187 = getelementptr inbounds ptr, ptr %181, i64 %186
  %188 = load ptr, ptr %187, align 8, !tbaa !5
  %189 = icmp ne ptr %188, null
  br i1 %189, label %190, label %219

190:                                              ; preds = %178
  %191 = load ptr, ptr %3, align 8, !tbaa !5
  %192 = load ptr, ptr %2, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct._dc_compression, ptr %192, i32 0, i32 8
  %194 = load ptr, ptr %193, align 8, !tbaa !22
  %195 = load i64, ptr %12, align 8, !tbaa !21
  %196 = load i64, ptr %7, align 8, !tbaa !21
  %197 = load i64, ptr %10, align 8, !tbaa !21
  %198 = mul i64 %196, %197
  %199 = add i64 %195, %198
  %200 = getelementptr inbounds ptr, ptr %194, i64 %199
  %201 = load ptr, ptr %200, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct._dc_heavy_sector, ptr %201, i32 0, i32 3
  %203 = load i8, ptr %202, align 4, !tbaa !23
  %204 = zext i8 %203 to i32
  %205 = load ptr, ptr %2, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct._dc_compression, ptr %205, i32 0, i32 8
  %207 = load ptr, ptr %206, align 8, !tbaa !22
  %208 = load i64, ptr %12, align 8, !tbaa !21
  %209 = load i64, ptr %7, align 8, !tbaa !21
  %210 = load i64, ptr %10, align 8, !tbaa !21
  %211 = mul i64 %209, %210
  %212 = add i64 %208, %211
  %213 = getelementptr inbounds ptr, ptr %207, i64 %212
  %214 = load ptr, ptr %213, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct._dc_heavy_sector, ptr %214, i32 0, i32 2
  %216 = load i8, ptr %215, align 1, !tbaa !32
  %217 = zext i8 %216 to i32
  %218 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %191, ptr noundef @.str.17, i32 noundef %204, i32 noundef %217) #5
  br label %219

219:                                              ; preds = %190, %178
  br label %220

220:                                              ; preds = %219
  %221 = load i64, ptr %12, align 8, !tbaa !21
  %222 = add i64 %221, 1
  store i64 %222, ptr %12, align 8, !tbaa !21
  br label %173, !llvm.loop !33

223:                                              ; preds = %177
  br label %224

224:                                              ; preds = %223
  %225 = load i64, ptr %10, align 8, !tbaa !21
  %226 = add i64 %225, 1
  store i64 %226, ptr %10, align 8, !tbaa !21
  br label %168, !llvm.loop !34

227:                                              ; preds = %171
  br label %229

228:                                              ; preds = %22
  br label %229

229:                                              ; preds = %228, %227, %166
  %230 = load ptr, ptr %3, align 8, !tbaa !5
  %231 = call i32 @fclose(ptr noundef %230)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

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


; 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.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @_dc_serialize(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 32
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = tail call noalias ptr @fopen(ptr noundef %3, ptr noundef nonnull @.str.15)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %8

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

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load i8, ptr %9, align 4, !tbaa !13
  %11 = zext i8 %10 to i32
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  %13 = load i8, ptr %12, align 8, !tbaa !14
  %14 = zext i8 %13 to i32
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.17, i32 noundef %11, i32 noundef %14) #5
  %16 = getelementptr inbounds i8, ptr %0, i64 48
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %17, i64 12
  %21 = load i32, ptr %20, align 4, !tbaa !18
  %22 = lshr i32 %19, 24
  %23 = lshr i32 %19, 16
  %24 = lshr i32 %19, 8
  %25 = and i32 %19, 255
  %26 = and i32 %24, 255
  %27 = and i32 %23, 255
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.18, i32 noundef %25, i32 noundef %26, i32 noundef %27, i32 noundef %22) #5
  %29 = lshr i32 %21, 24
  %30 = lshr i32 %21, 16
  %31 = lshr i32 %21, 8
  %32 = and i32 %21, 255
  %33 = and i32 %31, 255
  %34 = and i32 %30, 255
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.18, i32 noundef %32, i32 noundef %33, i32 noundef %34, i32 noundef %29) #5
  %36 = mul i32 %21, %19
  %37 = sext i32 %36 to i64
  %38 = load i8, ptr %9, align 4, !tbaa !13
  switch i8 %38, label %.loopexit [
    i8 1, label %.preheader
    i8 2, label %.preheader64
  ]

.preheader64:                                     ; preds = %8
  %.not69 = icmp eq i32 %36, 0
  %39 = getelementptr inbounds i8, ptr %0, i64 56
  br i1 %.not69, label %.loopexit, label %.preheader63.us.preheader

.preheader63.us.preheader:                        ; preds = %.preheader64, %51
  %.066.us = phi i64 [ %52, %51 ], [ 0, %.preheader64 ]
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = getelementptr ptr, ptr %40, i64 %.066.us
  %42 = load ptr, ptr %41, align 8, !tbaa !12
  %.not61.us = icmp eq ptr %42, null
  br i1 %.not61.us, label %51, label %43

43:                                               ; preds = %.preheader63.us.preheader
  %44 = getelementptr inbounds i8, ptr %42, i64 20
  %45 = load i8, ptr %44, align 4, !tbaa !20
  %46 = zext i8 %45 to i32
  %47 = getelementptr inbounds i8, ptr %42, i64 19
  %48 = load i8, ptr %47, align 1, !tbaa !24
  %49 = zext i8 %48 to i32
  %50 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.17, i32 noundef %46, i32 noundef %49) #5
  br label %51

51:                                               ; preds = %43, %.preheader63.us.preheader
  %52 = add nuw i64 %.066.us, 1
  %exitcond.not = icmp eq i64 %52, %37
  br i1 %exitcond.not, label %._crit_edge.us, label %.preheader63.us.preheader, !llvm.loop !25

._crit_edge.us:                                   ; preds = %51, %65
  %.066.us.1 = phi i64 [ %66, %65 ], [ 0, %51 ]
  %53 = load ptr, ptr %39, align 8, !tbaa !19
  %54 = getelementptr ptr, ptr %53, i64 %.066.us.1
  %55 = getelementptr ptr, ptr %54, i64 %37
  %56 = load ptr, ptr %55, align 8, !tbaa !12
  %.not61.us.1 = icmp eq ptr %56, null
  br i1 %.not61.us.1, label %65, label %57

57:                                               ; preds = %._crit_edge.us
  %58 = getelementptr inbounds i8, ptr %56, i64 20
  %59 = load i8, ptr %58, align 4, !tbaa !20
  %60 = zext i8 %59 to i32
  %61 = getelementptr inbounds i8, ptr %56, i64 19
  %62 = load i8, ptr %61, align 1, !tbaa !24
  %63 = zext i8 %62 to i32
  %64 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.17, i32 noundef %60, i32 noundef %63) #5
  br label %65

65:                                               ; preds = %57, %._crit_edge.us
  %66 = add nuw i64 %.066.us.1, 1
  %exitcond.1.not = icmp eq i64 %66, %37
  br i1 %exitcond.1.not, label %._crit_edge.us.1, label %._crit_edge.us, !llvm.loop !25

._crit_edge.us.1:                                 ; preds = %65
  %.idx = shl nsw i64 %37, 4
  br label %67

67:                                               ; preds = %80, %._crit_edge.us.1
  %.066.us.2 = phi i64 [ 0, %._crit_edge.us.1 ], [ %81, %80 ]
  %68 = load ptr, ptr %39, align 8, !tbaa !19
  %69 = getelementptr ptr, ptr %68, i64 %.066.us.2
  %70 = getelementptr i8, ptr %69, i64 %.idx
  %71 = load ptr, ptr %70, align 8, !tbaa !12
  %.not61.us.2 = icmp eq ptr %71, null
  br i1 %.not61.us.2, label %80, label %72

72:                                               ; preds = %67
  %73 = getelementptr inbounds i8, ptr %71, i64 20
  %74 = load i8, ptr %73, align 4, !tbaa !20
  %75 = zext i8 %74 to i32
  %76 = getelementptr inbounds i8, ptr %71, i64 19
  %77 = load i8, ptr %76, align 1, !tbaa !24
  %78 = zext i8 %77 to i32
  %79 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.17, i32 noundef %75, i32 noundef %78) #5
  br label %80

80:                                               ; preds = %72, %67
  %81 = add nuw i64 %.066.us.2, 1
  %exitcond.2.not = icmp eq i64 %81, %37
  br i1 %exitcond.2.not, label %.loopexit, label %67, !llvm.loop !25

.preheader:                                       ; preds = %8
  %.not70 = icmp eq i32 %36, 0
  br i1 %.not70, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %82 = getelementptr inbounds i8, ptr %0, i64 56
  br label %83

83:                                               ; preds = %.lr.ph, %101
  %.05668 = phi i64 [ 0, %.lr.ph ], [ %102, %101 ]
  %84 = load ptr, ptr %82, align 8, !tbaa !19
  %85 = getelementptr inbounds ptr, ptr %84, i64 %.05668
  %86 = load ptr, ptr %85, align 8, !tbaa !12
  %.not62 = icmp eq ptr %86, null
  br i1 %.not62, label %101, label %87

87:                                               ; preds = %83
  %88 = getelementptr inbounds i8, ptr %86, i64 16
  %89 = getelementptr inbounds i8, ptr %86, i64 20
  %90 = load i8, ptr %89, align 4, !tbaa !20
  %91 = zext i8 %90 to i32
  %92 = load i8, ptr %88, align 1, !tbaa !27
  %93 = zext i8 %92 to i32
  %94 = getelementptr inbounds i8, ptr %86, i64 17
  %95 = load i8, ptr %94, align 1, !tbaa !28
  %96 = zext i8 %95 to i32
  %97 = getelementptr inbounds i8, ptr %86, i64 18
  %98 = load i8, ptr %97, align 1, !tbaa !29
  %99 = zext i8 %98 to i32
  %100 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.18, i32 noundef %91, i32 noundef %93, i32 noundef %96, i32 noundef %99) #5
  br label %101

101:                                              ; preds = %83, %87
  %102 = add nuw i64 %.05668, 1
  %exitcond75.not = icmp eq i64 %102, %37
  br i1 %exitcond75.not, label %.loopexit, label %83, !llvm.loop !30

.loopexit:                                        ; preds = %80, %101, %.preheader64, %.preheader, %8
  %103 = tail call i32 @fclose(ptr noundef nonnull %4)
  ret void
}

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


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