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

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

@.str.19 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [22 x i8], align 1
@stdout = external global ptr, align 8
@.str.23 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [32 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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @_dc_compression_init(ptr noundef, ptr noundef, i8 noundef zeroext, i32 noundef, i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
declare dso_local void @_dc_compression_destroy(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @_dc_unpack(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @_dc_sectorize(ptr noundef, i64, i64, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @_dc_serialize(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @dc_compress(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, i32 noundef %3, i8 noundef zeroext %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i8, align 1
  %11 = alloca ptr, align 8
  %12 = alloca %struct._dc_corners, align 4
  %13 = alloca %struct._dc_corners, align 4
  %14 = alloca %struct._dc_corners, align 4
  %15 = alloca %struct._dc_corners, align 4
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i8 %2, ptr %8, align 1, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !10
  store i8 %4, ptr %10, align 1, !tbaa !9
  %19 = load i32, ptr %9, align 4, !tbaa !10
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %24

21:                                               ; preds = %5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, ptr noundef %22)
  br label %24

24:                                               ; preds = %21, %5
  %25 = load i32, ptr %9, align 4, !tbaa !10
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %30

27:                                               ; preds = %24
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.20, ptr noundef %28)
  br label %30

30:                                               ; preds = %27, %24
  %31 = load i32, ptr %9, align 4, !tbaa !10
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %39

33:                                               ; preds = %30
  %34 = load i8, ptr %8, align 1, !tbaa !9
  %35 = zext i8 %34 to i32
  %36 = load i8, ptr %10, align 1, !tbaa !9
  %37 = zext i8 %36 to i32
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %35, i32 noundef %37)
  br label %39

39:                                               ; preds = %33, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load i8, ptr %8, align 1, !tbaa !9
  %43 = load i32, ptr %9, align 4, !tbaa !10
  %44 = load i8, ptr %10, align 1, !tbaa !9
  %45 = call ptr @_dc_compression_init(ptr noundef %40, ptr noundef %41, i8 noundef zeroext %42, i32 noundef %43, i8 noundef zeroext %44)
  store ptr %45, ptr %11, align 8, !tbaa !5
  %46 = load i32, ptr %9, align 4, !tbaa !10
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %50

48:                                               ; preds = %39
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  br label %50

50:                                               ; preds = %48, %39
  %51 = load i32, ptr %9, align 4, !tbaa !10
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %56

53:                                               ; preds = %50
  %54 = load ptr, ptr @stdout, align 8, !tbaa !5
  %55 = call i32 @fflush(ptr noundef %54)
  br label %56

56:                                               ; preds = %53, %50
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_dc_unpack(ptr noundef %57)
  %58 = load i32, ptr %9, align 4, !tbaa !10
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %76

60:                                               ; preds = %56
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._dc_compression, ptr %61, i32 0, i32 7
  %63 = load ptr, ptr %62, align 8, !tbaa !12
  %64 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %63, i32 0, i32 1
  %65 = load i32, ptr %64, align 8, !tbaa !15
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._dc_compression, ptr %66, i32 0, i32 7
  %68 = load ptr, ptr %67, align 8, !tbaa !12
  %69 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %68, i32 0, i32 2
  %70 = load i32, ptr %69, align 4, !tbaa !17
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._dc_compression, ptr %71, i32 0, i32 3
  %73 = load i64, ptr %72, align 8, !tbaa !18
  %74 = udiv i64 %73, 1000
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.23, i32 noundef %65, i32 noundef %70, i64 noundef %74)
  br label %76

76:                                               ; preds = %60, %56
  %77 = load i32, ptr %9, align 4, !tbaa !10
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %81

79:                                               ; preds = %76
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.24)
  br label %81

81:                                               ; preds = %79, %76
  %82 = load i32, ptr %9, align 4, !tbaa !10
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %87

84:                                               ; preds = %81
  %85 = load ptr, ptr @stdout, align 8, !tbaa !5
  %86 = call i32 @fflush(ptr noundef %85)
  br label %87

87:                                               ; preds = %84, %81
  %88 = load ptr, ptr %11, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._dc_compression, ptr %88, i32 0, i32 1
  %90 = load i8, ptr %89, align 4, !tbaa !19
  %91 = zext i8 %90 to i32
  switch i32 %91, label %170 [
    i32 1, label %92
    i32 2, label %112
  ]

92:                                               ; preds = %87
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._dc_corners, ptr %12, i32 0, i32 0
  store i32 0, ptr %94, align 4, !tbaa !20
  %95 = getelementptr inbounds %struct._dc_corners, ptr %12, i32 0, i32 1
  store i32 0, ptr %95, align 4, !tbaa !22
  %96 = getelementptr inbounds %struct._dc_corners, ptr %12, i32 0, i32 2
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._dc_compression, ptr %97, i32 0, i32 7
  %99 = load ptr, ptr %98, align 8, !tbaa !12
  %100 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %99, i32 0, i32 1
  %101 = load i32, ptr %100, align 8, !tbaa !15
  store i32 %101, ptr %96, align 4, !tbaa !23
  %102 = getelementptr inbounds %struct._dc_corners, ptr %12, i32 0, i32 3
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct._dc_compression, ptr %103, i32 0, i32 7
  %105 = load ptr, ptr %104, align 8, !tbaa !12
  %106 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %105, i32 0, i32 2
  %107 = load i32, ptr %106, align 4, !tbaa !17
  store i32 %107, ptr %102, align 4, !tbaa !24
  %108 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 0
  %109 = load i64, ptr %108, align 4
  %110 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 1
  %111 = load i64, ptr %110, align 4
  call void @_dc_sectorize(ptr noundef %93, i64 %109, i64 %111, i32 noundef 0, i32 noundef 0)
  br label %171

112:                                              ; preds = %87
  %113 = load ptr, ptr %11, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._dc_corners, ptr %13, i32 0, i32 0
  store i32 0, ptr %114, align 4, !tbaa !20
  %115 = getelementptr inbounds %struct._dc_corners, ptr %13, i32 0, i32 1
  store i32 0, ptr %115, align 4, !tbaa !22
  %116 = getelementptr inbounds %struct._dc_corners, ptr %13, i32 0, i32 2
  %117 = load ptr, ptr %11, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._dc_compression, ptr %117, i32 0, i32 7
  %119 = load ptr, ptr %118, align 8, !tbaa !12
  %120 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %119, i32 0, i32 1
  %121 = load i32, ptr %120, align 8, !tbaa !15
  store i32 %121, ptr %116, align 4, !tbaa !23
  %122 = getelementptr inbounds %struct._dc_corners, ptr %13, i32 0, i32 3
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._dc_compression, ptr %123, i32 0, i32 7
  %125 = load ptr, ptr %124, align 8, !tbaa !12
  %126 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %125, i32 0, i32 2
  %127 = load i32, ptr %126, align 4, !tbaa !17
  store i32 %127, ptr %122, align 4, !tbaa !24
  %128 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %129 = load i64, ptr %128, align 4
  %130 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %131 = load i64, ptr %130, align 4
  call void @_dc_sectorize(ptr noundef %113, i64 %129, i64 %131, i32 noundef 0, i32 noundef 0)
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._dc_corners, ptr %14, i32 0, i32 0
  store i32 0, ptr %133, align 4, !tbaa !20
  %134 = getelementptr inbounds %struct._dc_corners, ptr %14, i32 0, i32 1
  store i32 0, ptr %134, align 4, !tbaa !22
  %135 = getelementptr inbounds %struct._dc_corners, ptr %14, i32 0, i32 2
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct._dc_compression, ptr %136, i32 0, i32 7
  %138 = load ptr, ptr %137, align 8, !tbaa !12
  %139 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %138, i32 0, i32 1
  %140 = load i32, ptr %139, align 8, !tbaa !15
  store i32 %140, ptr %135, align 4, !tbaa !23
  %141 = getelementptr inbounds %struct._dc_corners, ptr %14, i32 0, i32 3
  %142 = load ptr, ptr %11, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct._dc_compression, ptr %142, i32 0, i32 7
  %144 = load ptr, ptr %143, align 8, !tbaa !12
  %145 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %144, i32 0, i32 2
  %146 = load i32, ptr %145, align 4, !tbaa !17
  store i32 %146, ptr %141, align 4, !tbaa !24
  %147 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %148 = load i64, ptr %147, align 4
  %149 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %150 = load i64, ptr %149, align 4
  call void @_dc_sectorize(ptr noundef %132, i64 %148, i64 %150, i32 noundef 0, i32 noundef 1)
  %151 = load ptr, ptr %11, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct._dc_corners, ptr %15, i32 0, i32 0
  store i32 0, ptr %152, align 4, !tbaa !20
  %153 = getelementptr inbounds %struct._dc_corners, ptr %15, i32 0, i32 1
  store i32 0, ptr %153, align 4, !tbaa !22
  %154 = getelementptr inbounds %struct._dc_corners, ptr %15, i32 0, i32 2
  %155 = load ptr, ptr %11, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._dc_compression, ptr %155, i32 0, i32 7
  %157 = load ptr, ptr %156, align 8, !tbaa !12
  %158 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 8, !tbaa !15
  store i32 %159, ptr %154, align 4, !tbaa !23
  %160 = getelementptr inbounds %struct._dc_corners, ptr %15, i32 0, i32 3
  %161 = load ptr, ptr %11, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct._dc_compression, ptr %161, i32 0, i32 7
  %163 = load ptr, ptr %162, align 8, !tbaa !12
  %164 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %163, i32 0, i32 2
  %165 = load i32, ptr %164, align 4, !tbaa !17
  store i32 %165, ptr %160, align 4, !tbaa !24
  %166 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %167 = load i64, ptr %166, align 4
  %168 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %169 = load i64, ptr %168, align 4
  call void @_dc_sectorize(ptr noundef %151, i64 %167, i64 %169, i32 noundef 0, i32 noundef 2)
  br label %171

170:                                              ; preds = %87
  br label %171

171:                                              ; preds = %170, %112, %92
  %172 = load i32, ptr %9, align 4, !tbaa !10
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %179

174:                                              ; preds = %171
  %175 = load ptr, ptr %11, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct._dc_compression, ptr %175, i32 0, i32 2
  %177 = load i64, ptr %176, align 8, !tbaa !25
  %178 = call i32 (ptr, ...) @printf(ptr noundef @.str.25, i64 noundef %177)
  br label %179

179:                                              ; preds = %174, %171
  %180 = load i32, ptr %9, align 4, !tbaa !10
  %181 = icmp ne i32 %180, 0
  br i1 %181, label %182, label %184

182:                                              ; preds = %179
  %183 = call i32 (ptr, ...) @printf(ptr noundef @.str.26)
  br label %184

184:                                              ; preds = %182, %179
  %185 = load i32, ptr %9, align 4, !tbaa !10
  %186 = icmp ne i32 %185, 0
  br i1 %186, label %187, label %190

187:                                              ; preds = %184
  %188 = load ptr, ptr @stdout, align 8, !tbaa !5
  %189 = call i32 @fflush(ptr noundef %188)
  br label %190

190:                                              ; preds = %187, %184
  %191 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_dc_serialize(ptr noundef %191)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %192 = load i32, ptr %9, align 4, !tbaa !10
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %194, label %211

194:                                              ; preds = %190
  %195 = load ptr, ptr %11, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct._dc_compression, ptr %195, i32 0, i32 1
  %197 = load i8, ptr %196, align 4, !tbaa !19
  %198 = zext i8 %197 to i32
  %199 = icmp eq i32 %198, 1
  br i1 %199, label %200, label %201

200:                                              ; preds = %194
  br label %209

201:                                              ; preds = %194
  %202 = load ptr, ptr %11, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct._dc_compression, ptr %202, i32 0, i32 1
  %204 = load i8, ptr %203, align 4, !tbaa !19
  %205 = zext i8 %204 to i32
  %206 = icmp eq i32 %205, 2
  %207 = zext i1 %206 to i64
  %208 = select i1 %206, i32 2, i32 0
  br label %209

209:                                              ; preds = %201, %200
  %210 = phi i32 [ 4, %200 ], [ %208, %201 ]
  store i32 %210, ptr %17, align 4, !tbaa !10
  br label %211

211:                                              ; preds = %209, %190
  %212 = load i32, ptr %9, align 4, !tbaa !10
  %213 = icmp ne i32 %212, 0
  br i1 %213, label %214, label %222

214:                                              ; preds = %211
  %215 = load ptr, ptr %11, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct._dc_compression, ptr %215, i32 0, i32 2
  %217 = load i64, ptr %216, align 8, !tbaa !25
  %218 = load i32, ptr %17, align 4, !tbaa !10
  %219 = sext i32 %218 to i64
  %220 = mul i64 %217, %219
  %221 = add i64 %220, 10
  store i64 %221, ptr %16, align 8, !tbaa !26
  br label %222

222:                                              ; preds = %214, %211
  %223 = load i32, ptr %9, align 4, !tbaa !10
  %224 = icmp ne i32 %223, 0
  br i1 %224, label %225, label %229

225:                                              ; preds = %222
  %226 = load i64, ptr %16, align 8, !tbaa !26
  %227 = udiv i64 %226, 1000
  %228 = call i32 (ptr, ...) @printf(ptr noundef @.str.27, i64 noundef %227)
  br label %229

229:                                              ; preds = %225, %222
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %230 = load i32, ptr %9, align 4, !tbaa !10
  %231 = icmp ne i32 %230, 0
  br i1 %231, label %232, label %239

232:                                              ; preds = %229
  %233 = load i64, ptr %16, align 8, !tbaa !26
  %234 = mul i64 %233, 100
  %235 = load ptr, ptr %11, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct._dc_compression, ptr %235, i32 0, i32 3
  %237 = load i64, ptr %236, align 8, !tbaa !18
  %238 = udiv i64 %234, %237
  store i64 %238, ptr %18, align 8, !tbaa !26
  br label %239

239:                                              ; preds = %232, %229
  %240 = load i32, ptr %9, align 4, !tbaa !10
  %241 = icmp ne i32 %240, 0
  br i1 %241, label %242, label %245

242:                                              ; preds = %239
  %243 = load i64, ptr %18, align 8, !tbaa !26
  %244 = call i32 (ptr, ...) @printf(ptr noundef @.str.28, i64 noundef %243)
  br label %245

245:                                              ; preds = %242, %239
  %246 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_dc_compression_destroy(ptr noundef %246)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret void
}

declare i32 @fflush(ptr noundef) #1

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 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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 48}
!13 = !{!"_dc_compression", !11, i64 0, !7, i64 4, !14, i64 8, !14, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !6, i64 48, !6, i64 56}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !11, i64 8}
!16 = !{!"_dc_pixel_matrix", !6, i64 0, !11, i64 8, !11, i64 12}
!17 = !{!16, !11, i64 12}
!18 = !{!13, !14, i64 16}
!19 = !{!13, !7, i64 4}
!20 = !{!21, !11, i64 0}
!21 = !{!"_dc_corners", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!22 = !{!21, !11, i64 4}
!23 = !{!21, !11, i64 8}
!24 = !{!21, !11, i64 12}
!25 = !{!13, !14, i64 8}
!26 = !{!14, !14, 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"

@.str.19 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [22 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.23 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [32 x i8], align 1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @dc_compress(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, i32 noundef %3, i8 noundef zeroext %4) local_unnamed_addr #1 {
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %.thread, label %.critedge72

.thread:                                          ; preds = %5
  %6 = tail call ptr @_dc_compression_init(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, i32 noundef 0, i8 noundef zeroext %4)
  tail call void @_dc_unpack(ptr noundef %6)
  br label %.critedge73

.critedge72:                                      ; preds = %5
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, ptr noundef %0)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20, ptr noundef %1)
  %9 = zext i8 %2 to i32
  %10 = zext i8 %4 to i32
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %9, i32 noundef %10)
  %12 = tail call ptr @_dc_compression_init(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, i32 noundef %3, i8 noundef zeroext %4)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = tail call i32 @fflush(ptr noundef %14)
  tail call void @_dc_unpack(ptr noundef %12)
  %16 = getelementptr inbounds i8, ptr %12, i64 48
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !13
  %20 = getelementptr inbounds i8, ptr %17, i64 12
  %21 = load i32, ptr %20, align 4, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %12, i64 16
  %23 = load i64, ptr %22, align 8, !tbaa !16
  %24 = udiv i64 %23, 1000
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23, i32 noundef %19, i32 noundef %21, i64 noundef %24)
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24)
  %27 = load ptr, ptr @stdout, align 8, !tbaa !5
  %28 = tail call i32 @fflush(ptr noundef %27)
  br label %.critedge73

.critedge73:                                      ; preds = %.thread, %.critedge72
  %29 = phi ptr [ %6, %.thread ], [ %12, %.critedge72 ]
  %30 = getelementptr inbounds i8, ptr %29, i64 4
  %31 = load i8, ptr %30, align 4, !tbaa !17
  switch i8 %31, label %45 [
    i8 1, label %32
    i8 2, label %34
  ]

32:                                               ; preds = %.critedge73
  %33 = getelementptr inbounds i8, ptr %29, i64 48
  br label %.sink.split

34:                                               ; preds = %.critedge73
  %35 = getelementptr inbounds i8, ptr %29, i64 48
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds i8, ptr %36, i64 8
  %38 = load i64, ptr %37, align 8
  tail call void @_dc_sectorize(ptr noundef nonnull %29, i64 0, i64 %38, i32 noundef 0, i32 noundef 0)
  %39 = load ptr, ptr %35, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %39, i64 8
  %41 = load i64, ptr %40, align 8
  tail call void @_dc_sectorize(ptr noundef nonnull %29, i64 0, i64 %41, i32 noundef 0, i32 noundef 1)
  br label %.sink.split

.sink.split:                                      ; preds = %32, %34
  %.sink87 = phi ptr [ %35, %34 ], [ %33, %32 ]
  %.sink85 = phi i32 [ 2, %34 ], [ 0, %32 ]
  %42 = load ptr, ptr %.sink87, align 8, !tbaa !9
  %43 = getelementptr inbounds i8, ptr %42, i64 8
  %44 = load i64, ptr %43, align 8
  tail call void @_dc_sectorize(ptr noundef nonnull %29, i64 0, i64 %44, i32 noundef 0, i32 noundef %.sink85)
  br label %45

45:                                               ; preds = %.sink.split, %.critedge73
  br i1 %.not, label %.critedge79.thread, label %46

.critedge79.thread:                               ; preds = %45
  tail call void @_dc_serialize(ptr noundef nonnull %29)
  br label %68

46:                                               ; preds = %45
  %47 = getelementptr inbounds i8, ptr %29, i64 8
  %48 = load i64, ptr %47, align 8, !tbaa !18
  %49 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25, i64 noundef %48)
  %50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26)
  %51 = load ptr, ptr @stdout, align 8, !tbaa !5
  %52 = tail call i32 @fflush(ptr noundef %51)
  tail call void @_dc_serialize(ptr noundef nonnull %29)
  %53 = load i8, ptr %30, align 4, !tbaa !17
  %54 = icmp eq i8 %53, 1
  %55 = icmp eq i8 %53, 2
  %56 = select i1 %55, i64 2, i64 0
  %57 = select i1 %54, i64 4, i64 %56
  %58 = load i64, ptr %47, align 8, !tbaa !18
  %59 = mul i64 %57, %58
  %60 = add i64 %59, 10
  %61 = udiv i64 %60, 1000
  %62 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.27, i64 noundef %61)
  %63 = mul i64 %60, 100
  %64 = getelementptr inbounds i8, ptr %29, i64 16
  %65 = load i64, ptr %64, align 8, !tbaa !16
  %66 = udiv i64 %63, %65
  %67 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.28, i64 noundef %66)
  br label %68

68:                                               ; preds = %.critedge79.thread, %46
  tail call void @_dc_compression_destroy(ptr noundef nonnull %29)
  ret void
}

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

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 = { 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" }

!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 48}
!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 = !{!14, !11, i64 8}
!14 = !{!"_dc_pixel_matrix", !6, i64 0, !11, i64 8, !11, i64 12}
!15 = !{!14, !11, i64 12}
!16 = !{!10, !12, i64 16}
!17 = !{!10, !7, i64 4}
!18 = !{!10, !12, i64 8}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass