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

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

; 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @ix(i32 noundef, i32 noundef, i32 noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @_dc_get_mid(i32 noundef, i32 noundef) #4

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

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

; Function Attrs: nounwind uwtable
define dso_local void @_dc_sectorize(ptr noundef %0, i64 %1, i64 %2, i32 noundef %3, i32 noundef %4) #4 {
  %6 = alloca %struct._dc_corners, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct._dc_corners, align 4
  %16 = alloca %struct._dc_corners, align 4
  %17 = alloca %struct._dc_corners, align 4
  %18 = alloca %struct._dc_corners, align 4
  %19 = alloca %struct._dc_corners, align 4
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca ptr, align 8
  %23 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 0
  store i64 %1, ptr %23, align 4
  %24 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 1
  store i64 %2, ptr %24, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  store i32 %4, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = call i32 @_dc_get_delta(ptr noundef %25, ptr noundef %6, i32 noundef %26)
  store i32 %27, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %28 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  %29 = load i32, ptr %28, align 4, !tbaa !11
  %30 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = sub nsw i32 %29, %31
  store i32 %32, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %33 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  %34 = load i32, ptr %33, align 4, !tbaa !14
  %35 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %36 = load i32, ptr %35, align 4, !tbaa !15
  %37 = sub nsw i32 %34, %36
  store i32 %37, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = mul nsw i32 %38, %39
  store i32 %40, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #5
  call void @llvm.memset.p0.i64(ptr align 4 %15, i8 0, i64 16, i1 false)
  %41 = load i32, ptr %13, align 4, !tbaa !9
  %42 = icmp sgt i32 %41, 1
  br i1 %42, label %43, label %141

43:                                               ; preds = %5
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._dc_compression, ptr %45, i32 0, i32 6
  %47 = load i8, ptr %46, align 8, !tbaa !16
  %48 = zext i8 %47 to i32
  %49 = icmp sgt i32 %44, %48
  br i1 %49, label %50, label %141

50:                                               ; preds = %43
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %8, align 4, !tbaa !9
  %53 = load i32, ptr %11, align 4, !tbaa !9
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = icmp sgt i32 %53, %54
  br i1 %55, label %56, label %98

56:                                               ; preds = %50
  %57 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %58 = load i32, ptr %57, align 4, !tbaa !13
  %59 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  %60 = load i32, ptr %59, align 4, !tbaa !11
  %61 = call i32 @_dc_get_mid(i32 noundef %58, i32 noundef %60)
  store i32 %61, ptr %14, align 4, !tbaa !9
  %62 = getelementptr inbounds %struct._dc_corners, ptr %16, i32 0, i32 0
  %63 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %64 = load i32, ptr %63, align 4, !tbaa !13
  store i32 %64, ptr %62, align 4, !tbaa !13
  %65 = getelementptr inbounds %struct._dc_corners, ptr %16, i32 0, i32 1
  %66 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !15
  store i32 %67, ptr %65, align 4, !tbaa !15
  %68 = getelementptr inbounds %struct._dc_corners, ptr %16, i32 0, i32 2
  %69 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %69, ptr %68, align 4, !tbaa !11
  %70 = getelementptr inbounds %struct._dc_corners, ptr %16, i32 0, i32 3
  %71 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  %72 = load i32, ptr %71, align 4, !tbaa !14
  store i32 %72, ptr %70, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %16, i64 16, i1 false), !tbaa.struct !19
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load i32, ptr %8, align 4, !tbaa !9
  %75 = load i32, ptr %9, align 4, !tbaa !9
  %76 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %77 = load i64, ptr %76, align 4
  %78 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %79 = load i64, ptr %78, align 4
  call void @_dc_sectorize(ptr noundef %73, i64 %77, i64 %79, i32 noundef %74, i32 noundef %75)
  %80 = getelementptr inbounds %struct._dc_corners, ptr %17, i32 0, i32 0
  %81 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %81, ptr %80, align 4, !tbaa !13
  %82 = getelementptr inbounds %struct._dc_corners, ptr %17, i32 0, i32 1
  %83 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %84 = load i32, ptr %83, align 4, !tbaa !15
  store i32 %84, ptr %82, align 4, !tbaa !15
  %85 = getelementptr inbounds %struct._dc_corners, ptr %17, i32 0, i32 2
  %86 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  %87 = load i32, ptr %86, align 4, !tbaa !11
  store i32 %87, ptr %85, align 4, !tbaa !11
  %88 = getelementptr inbounds %struct._dc_corners, ptr %17, i32 0, i32 3
  %89 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  %90 = load i32, ptr %89, align 4, !tbaa !14
  store i32 %90, ptr %88, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %17, i64 16, i1 false), !tbaa.struct !19
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = load i32, ptr %8, align 4, !tbaa !9
  %93 = load i32, ptr %9, align 4, !tbaa !9
  %94 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %95 = load i64, ptr %94, align 4
  %96 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %97 = load i64, ptr %96, align 4
  call void @_dc_sectorize(ptr noundef %91, i64 %95, i64 %97, i32 noundef %92, i32 noundef %93)
  br label %140

98:                                               ; preds = %50
  %99 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %100 = load i32, ptr %99, align 4, !tbaa !15
  %101 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  %102 = load i32, ptr %101, align 4, !tbaa !14
  %103 = call i32 @_dc_get_mid(i32 noundef %100, i32 noundef %102)
  store i32 %103, ptr %14, align 4, !tbaa !9
  %104 = getelementptr inbounds %struct._dc_corners, ptr %18, i32 0, i32 0
  %105 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %106 = load i32, ptr %105, align 4, !tbaa !13
  store i32 %106, ptr %104, align 4, !tbaa !13
  %107 = getelementptr inbounds %struct._dc_corners, ptr %18, i32 0, i32 1
  %108 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %109 = load i32, ptr %108, align 4, !tbaa !15
  store i32 %109, ptr %107, align 4, !tbaa !15
  %110 = getelementptr inbounds %struct._dc_corners, ptr %18, i32 0, i32 2
  %111 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  %112 = load i32, ptr %111, align 4, !tbaa !11
  store i32 %112, ptr %110, align 4, !tbaa !11
  %113 = getelementptr inbounds %struct._dc_corners, ptr %18, i32 0, i32 3
  %114 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %114, ptr %113, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %18, i64 16, i1 false), !tbaa.struct !19
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = load i32, ptr %8, align 4, !tbaa !9
  %117 = load i32, ptr %9, align 4, !tbaa !9
  %118 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %119 = load i64, ptr %118, align 4
  %120 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %121 = load i64, ptr %120, align 4
  call void @_dc_sectorize(ptr noundef %115, i64 %119, i64 %121, i32 noundef %116, i32 noundef %117)
  %122 = getelementptr inbounds %struct._dc_corners, ptr %19, i32 0, i32 0
  %123 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %124 = load i32, ptr %123, align 4, !tbaa !13
  store i32 %124, ptr %122, align 4, !tbaa !13
  %125 = getelementptr inbounds %struct._dc_corners, ptr %19, i32 0, i32 1
  %126 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %126, ptr %125, align 4, !tbaa !15
  %127 = getelementptr inbounds %struct._dc_corners, ptr %19, i32 0, i32 2
  %128 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  %129 = load i32, ptr %128, align 4, !tbaa !11
  store i32 %129, ptr %127, align 4, !tbaa !11
  %130 = getelementptr inbounds %struct._dc_corners, ptr %19, i32 0, i32 3
  %131 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  %132 = load i32, ptr %131, align 4, !tbaa !14
  store i32 %132, ptr %130, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %19, i64 16, i1 false), !tbaa.struct !19
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = load i32, ptr %8, align 4, !tbaa !9
  %135 = load i32, ptr %9, align 4, !tbaa !9
  %136 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %137 = load i64, ptr %136, align 4
  %138 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %139 = load i64, ptr %138, align 4
  call void @_dc_sectorize(ptr noundef %133, i64 %137, i64 %139, i32 noundef %134, i32 noundef %135)
  br label %140

140:                                              ; preds = %98, %56
  br label %214

141:                                              ; preds = %43, %5
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct._dc_compression, ptr %142, i32 0, i32 2
  %144 = load i64, ptr %143, align 8, !tbaa !20
  %145 = add i64 %144, 1
  store i64 %145, ptr %143, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct._dc_compression, ptr %146, i32 0, i32 1
  %148 = load i8, ptr %147, align 4, !tbaa !21
  %149 = zext i8 %148 to i32
  switch i32 %149, label %191 [
    i32 1, label %150
    i32 2, label %162
  ]

150:                                              ; preds = %141
  %151 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %152 = load i32, ptr %151, align 4, !tbaa !13
  %153 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %154 = load i32, ptr %153, align 4, !tbaa !15
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._dc_compression, ptr %155, i32 0, i32 7
  %157 = load ptr, ptr %156, align 8, !tbaa !22
  %158 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 8, !tbaa !23
  %160 = call i32 @ix(i32 noundef %152, i32 noundef %154, i32 noundef %159)
  %161 = sext i32 %160 to i64
  store i64 %161, ptr %20, align 8, !tbaa !25
  br label %192

162:                                              ; preds = %141
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct._dc_compression, ptr %163, i32 0, i32 7
  %165 = load ptr, ptr %164, align 8, !tbaa !22
  %166 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %165, i32 0, i32 1
  %167 = load i32, ptr %166, align 8, !tbaa !23
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct._dc_compression, ptr %168, i32 0, i32 7
  %170 = load ptr, ptr %169, align 8, !tbaa !22
  %171 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %170, i32 0, i32 2
  %172 = load i32, ptr %171, align 4, !tbaa !26
  %173 = mul nsw i32 %167, %172
  %174 = sext i32 %173 to i64
  store i64 %174, ptr %21, align 8, !tbaa !25
  %175 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %176 = load i32, ptr %175, align 4, !tbaa !13
  %177 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %178 = load i32, ptr %177, align 4, !tbaa !15
  %179 = load ptr, ptr %7, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct._dc_compression, ptr %179, i32 0, i32 7
  %181 = load ptr, ptr %180, align 8, !tbaa !22
  %182 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %181, i32 0, i32 1
  %183 = load i32, ptr %182, align 8, !tbaa !23
  %184 = call i32 @ix(i32 noundef %176, i32 noundef %178, i32 noundef %183)
  %185 = sext i32 %184 to i64
  %186 = load i64, ptr %21, align 8, !tbaa !25
  %187 = load i32, ptr %9, align 4, !tbaa !9
  %188 = sext i32 %187 to i64
  %189 = mul i64 %186, %188
  %190 = add i64 %185, %189
  store i64 %190, ptr %20, align 8, !tbaa !25
  br label %192

191:                                              ; preds = %141
  br label %192

192:                                              ; preds = %191, %162, %150
  %193 = call noalias ptr @malloc(i64 noundef 24) #6
  %194 = load ptr, ptr %7, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct._dc_compression, ptr %194, i32 0, i32 8
  %196 = load ptr, ptr %195, align 8, !tbaa !27
  %197 = load i64, ptr %20, align 8, !tbaa !25
  %198 = getelementptr inbounds ptr, ptr %196, i64 %197
  store ptr %193, ptr %198, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %199 = load ptr, ptr %7, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct._dc_compression, ptr %199, i32 0, i32 8
  %201 = load ptr, ptr %200, align 8, !tbaa !27
  %202 = load i64, ptr %20, align 8, !tbaa !25
  %203 = getelementptr inbounds ptr, ptr %201, i64 %202
  %204 = load ptr, ptr %203, align 8, !tbaa !5
  store ptr %204, ptr %22, align 8, !tbaa !5
  %205 = load ptr, ptr %7, align 8, !tbaa !5
  %206 = load ptr, ptr %22, align 8, !tbaa !5
  %207 = load i32, ptr %9, align 4, !tbaa !9
  call void @_dc_get_avg(ptr noundef %205, ptr noundef %6, ptr noundef %206, i32 noundef %207)
  %208 = load ptr, ptr %22, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct._dc_heavy_sector, ptr %208, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %209, ptr align 4 %6, i64 16, i1 false), !tbaa.struct !19
  %210 = load i32, ptr %8, align 4, !tbaa !9
  %211 = trunc i32 %210 to i8
  %212 = load ptr, ptr %22, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct._dc_heavy_sector, ptr %212, i32 0, i32 3
  store i8 %211, ptr %213, align 4, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %214

214:                                              ; preds = %192, %140
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_dc_corners", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!13 = !{!12, !10, i64 0}
!14 = !{!12, !10, i64 12}
!15 = !{!12, !10, i64 4}
!16 = !{!17, !7, i64 40}
!17 = !{!"_dc_compression", !10, i64 0, !7, i64 4, !18, i64 8, !18, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !6, i64 48, !6, i64 56}
!18 = !{!"long", !7, i64 0}
!19 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9, i64 12, i64 4, !9}
!20 = !{!17, !18, i64 8}
!21 = !{!17, !7, i64 4}
!22 = !{!17, !6, i64 48}
!23 = !{!24, !10, i64 8}
!24 = !{!"_dc_pixel_matrix", !6, i64 0, !10, i64 8, !10, i64 12}
!25 = !{!18, !18, i64 0}
!26 = !{!24, !10, i64 12}
!27 = !{!17, !6, i64 56}
!28 = !{!29, !7, i64 20}
!29 = !{!"_dc_heavy_sector", !12, i64 0, !30, i64 16, !7, i64 19, !7, i64 20}
!30 = !{!"_dc_pixel", !7, i64 0, !7, i64 1, !7, i64 2}


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

%struct._dc_corners = type { i32, i32, i32, i32 }

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @ix(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @_dc_get_mid(i32 noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @_dc_get_delta(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @_dc_sectorize(ptr noundef %0, i64 %1, i64 %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #2 {
  %6 = alloca %struct._dc_corners, align 8
  store i64 %1, ptr %6, align 8
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  store i64 %2, ptr %7, align 8
  %8 = call i32 @_dc_get_delta(ptr noundef %0, ptr noundef nonnull %6, i32 noundef %4)
  %9 = load i32, ptr %7, align 8, !tbaa !5
  %10 = load i32, ptr %6, align 8, !tbaa !10
  %11 = sub nsw i32 %9, %10
  %12 = getelementptr inbounds i8, ptr %6, i64 12
  %13 = load i32, ptr %12, align 4, !tbaa !11
  %14 = getelementptr inbounds i8, ptr %6, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !12
  %16 = sub nsw i32 %13, %15
  %17 = mul nsw i32 %16, %11
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %19, label %39

19:                                               ; preds = %5
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  %21 = load i8, ptr %20, align 8, !tbaa !13
  %22 = zext i8 %21 to i32
  %23 = icmp sgt i32 %8, %22
  br i1 %23, label %24, label %39

24:                                               ; preds = %19
  %25 = add nsw i32 %3, 1
  %26 = icmp sgt i32 %11, %16
  br i1 %26, label %27, label %33

27:                                               ; preds = %24
  %28 = call i32 @_dc_get_mid(i32 noundef %10, i32 noundef %9)
  %29 = load i64, ptr %6, align 8
  %30 = load i32, ptr %12, align 4, !tbaa !11
  %.sroa.15.8.insert.ext36 = zext i32 %28 to i64
  %.sroa.15.12.insert.ext50 = zext i32 %30 to i64
  %.sroa.15.12.insert.shift51 = shl nuw i64 %.sroa.15.12.insert.ext50, 32
  %.sroa.15.12.insert.insert53 = or disjoint i64 %.sroa.15.12.insert.shift51, %.sroa.15.8.insert.ext36
  call void @_dc_sectorize(ptr noundef nonnull %0, i64 %29, i64 %.sroa.15.12.insert.insert53, i32 noundef %25, i32 noundef %4)
  %31 = load i32, ptr %14, align 4, !tbaa !12
  %32 = load i64, ptr %7, align 8
  %.sroa.017.sroa.11.0.insert.ext63 = zext i32 %31 to i64
  %.sroa.017.sroa.11.0.insert.shift64 = shl nuw i64 %.sroa.017.sroa.11.0.insert.ext63, 32
  %.sroa.017.sroa.0.0.insert.insert56 = or disjoint i64 %.sroa.017.sroa.11.0.insert.shift64, %.sroa.15.8.insert.ext36
  call void @_dc_sectorize(ptr noundef nonnull %0, i64 %.sroa.017.sroa.0.0.insert.insert56, i64 %32, i32 noundef %25, i32 noundef %4)
  br label %76

33:                                               ; preds = %24
  %34 = call i32 @_dc_get_mid(i32 noundef %15, i32 noundef %13)
  %35 = load i64, ptr %6, align 8
  %36 = load i32, ptr %7, align 8, !tbaa !5
  %.sroa.15.8.insert.ext28 = zext i32 %36 to i64
  %.sroa.15.12.insert.ext40 = zext i32 %34 to i64
  %.sroa.15.12.insert.shift41 = shl nuw i64 %.sroa.15.12.insert.ext40, 32
  %.sroa.15.12.insert.insert43 = or disjoint i64 %.sroa.15.12.insert.shift41, %.sroa.15.8.insert.ext28
  call void @_dc_sectorize(ptr noundef nonnull %0, i64 %35, i64 %.sroa.15.12.insert.insert43, i32 noundef %25, i32 noundef %4)
  %37 = load i32, ptr %6, align 8, !tbaa !10
  %38 = load i64, ptr %7, align 8
  %.sroa.017.sroa.0.0.insert.ext60 = zext i32 %37 to i64
  %.sroa.017.sroa.0.0.insert.insert62 = or disjoint i64 %.sroa.15.12.insert.shift41, %.sroa.017.sroa.0.0.insert.ext60
  call void @_dc_sectorize(ptr noundef nonnull %0, i64 %.sroa.017.sroa.0.0.insert.insert62, i64 %38, i32 noundef %25, i32 noundef %4)
  br label %76

39:                                               ; preds = %19, %5
  %40 = getelementptr inbounds i8, ptr %0, i64 8
  %41 = load i64, ptr %40, align 8, !tbaa !17
  %42 = add i64 %41, 1
  store i64 %42, ptr %40, align 8, !tbaa !17
  %43 = getelementptr inbounds i8, ptr %0, i64 4
  %44 = load i8, ptr %43, align 4, !tbaa !18
  switch i8 %44, label %66 [
    i8 1, label %45
    i8 2, label %52
  ]

45:                                               ; preds = %39
  %46 = getelementptr inbounds i8, ptr %0, i64 48
  %47 = load ptr, ptr %46, align 8, !tbaa !19
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = load i32, ptr %48, align 8, !tbaa !20
  %50 = call i32 @ix(i32 noundef %10, i32 noundef %15, i32 noundef %49)
  %51 = sext i32 %50 to i64
  br label %66

52:                                               ; preds = %39
  %53 = getelementptr inbounds i8, ptr %0, i64 48
  %54 = load ptr, ptr %53, align 8, !tbaa !19
  %55 = getelementptr inbounds i8, ptr %54, i64 8
  %56 = load i32, ptr %55, align 8, !tbaa !20
  %57 = getelementptr inbounds i8, ptr %54, i64 12
  %58 = load i32, ptr %57, align 4, !tbaa !22
  %59 = mul nsw i32 %58, %56
  %60 = sext i32 %59 to i64
  %61 = call i32 @ix(i32 noundef %10, i32 noundef %15, i32 noundef %56)
  %62 = sext i32 %61 to i64
  %63 = sext i32 %4 to i64
  %64 = mul nsw i64 %60, %63
  %65 = add nsw i64 %64, %62
  br label %66

66:                                               ; preds = %39, %52, %45
  %.0 = phi i64 [ undef, %39 ], [ %65, %52 ], [ %51, %45 ]
  %67 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #3
  %68 = getelementptr inbounds i8, ptr %0, i64 56
  %69 = load ptr, ptr %68, align 8, !tbaa !23
  %70 = getelementptr inbounds ptr, ptr %69, i64 %.0
  store ptr %67, ptr %70, align 8, !tbaa !24
  %71 = load ptr, ptr %68, align 8, !tbaa !23
  %72 = getelementptr inbounds ptr, ptr %71, i64 %.0
  %73 = load ptr, ptr %72, align 8, !tbaa !24
  call void @_dc_get_avg(ptr noundef nonnull %0, ptr noundef nonnull %6, ptr noundef %73, i32 noundef %4)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %73, ptr noundef nonnull align 8 dereferenceable(16) %6, i64 16, i1 false), !tbaa.struct !25
  %74 = trunc i32 %3 to i8
  %75 = getelementptr inbounds i8, ptr %73, i64 20
  store i8 %74, ptr %75, align 4, !tbaa !27
  br label %76

76:                                               ; preds = %27, %33, %66
  ret void
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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, !7, i64 8}
!6 = !{!"_dc_corners", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!6, !7, i64 12}
!12 = !{!6, !7, i64 4}
!13 = !{!14, !8, i64 40}
!14 = !{!"_dc_compression", !7, i64 0, !8, i64 4, !15, i64 8, !15, i64 16, !16, i64 24, !16, i64 32, !8, i64 40, !16, i64 48, !16, i64 56}
!15 = !{!"long", !8, i64 0}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!14, !15, i64 8}
!18 = !{!14, !8, i64 4}
!19 = !{!14, !16, i64 48}
!20 = !{!21, !7, i64 8}
!21 = !{!"_dc_pixel_matrix", !16, i64 0, !7, i64 8, !7, i64 12}
!22 = !{!21, !7, i64 12}
!23 = !{!14, !16, i64 56}
!24 = !{!16, !16, i64 0}
!25 = !{i64 0, i64 4, !26, i64 4, i64 4, !26, i64 8, i64 4, !26, i64 12, i64 4, !26}
!26 = !{!7, !7, i64 0}
!27 = !{!28, !8, i64 20}
!28 = !{!"_dc_heavy_sector", !6, i64 0, !29, i64 16, !8, i64 19, !8, i64 20}
!29 = !{!"_dc_pixel", !8, i64 0, !8, i64 1, !8, i64 2}


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