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

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @_dc_render(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct._dc_corners, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._dc_decompression, ptr %18, i32 0, i32 6
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %20, i32 0, i32 1
  %22 = load i32, ptr %21, align 8, !tbaa !13
  %23 = sext i32 %22 to i64
  store i64 %23, ptr %3, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._dc_decompression, ptr %24, i32 0, i32 6
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !16
  %29 = sext i32 %28 to i64
  store i64 %29, ptr %4, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %30 = load i64, ptr %3, align 8, !tbaa !15
  %31 = mul i64 1, %30
  %32 = load i64, ptr %4, align 8, !tbaa !15
  %33 = mul i64 %31, %32
  %34 = call noalias ptr @malloc(i64 noundef %33) #5
  store ptr %34, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  br label %35

35:                                               ; preds = %197, %1
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._dc_decompression, ptr %36, i32 0, i32 7
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %200

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !15
  br label %41

41:                                               ; preds = %52, %40
  %42 = load i64, ptr %13, align 8, !tbaa !15
  %43 = load i64, ptr %3, align 8, !tbaa !15
  %44 = load i64, ptr %4, align 8, !tbaa !15
  %45 = mul i64 %43, %44
  %46 = icmp ult i64 %42, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %55

48:                                               ; preds = %41
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load i64, ptr %13, align 8, !tbaa !15
  %51 = getelementptr inbounds i8, ptr %49, i64 %50
  store i8 0, ptr %51, align 1, !tbaa !19
  br label %52

52:                                               ; preds = %48
  %53 = load i64, ptr %13, align 8, !tbaa !15
  %54 = add i64 %53, 1
  store i64 %54, ptr %13, align 8, !tbaa !15
  br label %41, !llvm.loop !20

55:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store i64 0, ptr %14, align 8, !tbaa !15
  br label %56

56:                                               ; preds = %194, %55
  %57 = load i64, ptr %14, align 8, !tbaa !15
  %58 = load i64, ptr %4, align 8, !tbaa !15
  %59 = icmp ult i64 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 7, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %197

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  store i64 0, ptr %16, align 8, !tbaa !15
  br label %62

62:                                               ; preds = %190, %61
  %63 = load i64, ptr %16, align 8, !tbaa !15
  %64 = load i64, ptr %3, align 8, !tbaa !15
  %65 = icmp ult i64 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 10, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %193

67:                                               ; preds = %62
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = load i64, ptr %16, align 8, !tbaa !15
  %70 = trunc i64 %69 to i32
  %71 = load i64, ptr %14, align 8, !tbaa !15
  %72 = trunc i64 %71 to i32
  %73 = load i64, ptr %3, align 8, !tbaa !15
  %74 = trunc i64 %73 to i32
  %75 = call i32 @ix(i32 noundef %70, i32 noundef %72, i32 noundef %74)
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %68, i64 %76
  %78 = load i8, ptr %77, align 1, !tbaa !19
  %79 = zext i8 %78 to i32
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %81, label %189

81:                                               ; preds = %67
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._dc_decompression, ptr %82, i32 0, i32 7
  %84 = load ptr, ptr %83, align 8, !tbaa !18
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %189

86:                                               ; preds = %81
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._dc_decompression, ptr %87, i32 0, i32 7
  %89 = load ptr, ptr %88, align 8, !tbaa !18
  store ptr %89, ptr %11, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  store i32 0, ptr %90, align 4, !tbaa !22
  %91 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  store i32 0, ptr %91, align 4, !tbaa !24
  %92 = load i64, ptr %3, align 8, !tbaa !15
  %93 = trunc i64 %92 to i32
  %94 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  store i32 %93, ptr %94, align 4, !tbaa !25
  %95 = load i64, ptr %4, align 8, !tbaa !15
  %96 = trunc i64 %95 to i32
  %97 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  store i32 %96, ptr %97, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !17
  br label %98

98:                                               ; preds = %155, %86
  %99 = load i32, ptr %17, align 4, !tbaa !17
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._dc_light_sector, ptr %100, i32 0, i32 2
  %102 = load i8, ptr %101, align 4, !tbaa !27
  %103 = zext i8 %102 to i32
  %104 = icmp slt i32 %99, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %98
  store i32 13, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %158

106:                                              ; preds = %98
  %107 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  %108 = load i32, ptr %107, align 4, !tbaa !25
  %109 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %110 = load i32, ptr %109, align 4, !tbaa !22
  %111 = sub nsw i32 %108, %110
  store i32 %111, ptr %7, align 4, !tbaa !17
  %112 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  %113 = load i32, ptr %112, align 4, !tbaa !26
  %114 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %115 = load i32, ptr %114, align 4, !tbaa !24
  %116 = sub nsw i32 %113, %115
  store i32 %116, ptr %8, align 4, !tbaa !17
  %117 = load i32, ptr %7, align 4, !tbaa !17
  %118 = load i32, ptr %8, align 4, !tbaa !17
  %119 = icmp sgt i32 %117, %118
  br i1 %119, label %120, label %137

120:                                              ; preds = %106
  %121 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  %122 = load i32, ptr %121, align 4, !tbaa !22
  %123 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  %124 = load i32, ptr %123, align 4, !tbaa !25
  %125 = call i32 @_dc_get_mid(i32 noundef %122, i32 noundef %124)
  store i32 %125, ptr %9, align 4, !tbaa !17
  %126 = load i32, ptr %9, align 4, !tbaa !17
  %127 = sext i32 %126 to i64
  %128 = load i64, ptr %16, align 8, !tbaa !15
  %129 = icmp ugt i64 %127, %128
  br i1 %129, label %130, label %133

130:                                              ; preds = %120
  %131 = load i32, ptr %9, align 4, !tbaa !17
  %132 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 2
  store i32 %131, ptr %132, align 4, !tbaa !25
  br label %136

133:                                              ; preds = %120
  %134 = load i32, ptr %9, align 4, !tbaa !17
  %135 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 0
  store i32 %134, ptr %135, align 4, !tbaa !22
  br label %136

136:                                              ; preds = %133, %130
  br label %154

137:                                              ; preds = %106
  %138 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  %139 = load i32, ptr %138, align 4, !tbaa !24
  %140 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  %141 = load i32, ptr %140, align 4, !tbaa !26
  %142 = call i32 @_dc_get_mid(i32 noundef %139, i32 noundef %141)
  store i32 %142, ptr %9, align 4, !tbaa !17
  %143 = load i32, ptr %9, align 4, !tbaa !17
  %144 = sext i32 %143 to i64
  %145 = load i64, ptr %14, align 8, !tbaa !15
  %146 = icmp ugt i64 %144, %145
  br i1 %146, label %147, label %150

147:                                              ; preds = %137
  %148 = load i32, ptr %9, align 4, !tbaa !17
  %149 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 3
  store i32 %148, ptr %149, align 4, !tbaa !26
  br label %153

150:                                              ; preds = %137
  %151 = load i32, ptr %9, align 4, !tbaa !17
  %152 = getelementptr inbounds %struct._dc_corners, ptr %6, i32 0, i32 1
  store i32 %151, ptr %152, align 4, !tbaa !24
  br label %153

153:                                              ; preds = %150, %147
  br label %154

154:                                              ; preds = %153, %136
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %17, align 4, !tbaa !17
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %17, align 4, !tbaa !17
  br label %98, !llvm.loop !30

158:                                              ; preds = %105
  %159 = load ptr, ptr %2, align 8, !tbaa !5
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = load ptr, ptr %11, align 8, !tbaa !5
  %162 = load i32, ptr %10, align 4, !tbaa !17
  call void @_dc_draw_n_occupy(ptr noundef %159, ptr noundef %6, ptr noundef %160, ptr noundef %161, i32 noundef %162)
  %163 = load ptr, ptr %11, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct._dc_light_sector, ptr %163, i32 0, i32 3
  %165 = load ptr, ptr %164, align 8, !tbaa !31
  %166 = icmp ne ptr %165, null
  br i1 %166, label %167, label %182

167:                                              ; preds = %158
  %168 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %168, ptr %12, align 8, !tbaa !5
  %169 = load ptr, ptr %11, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._dc_light_sector, ptr %169, i32 0, i32 3
  %171 = load ptr, ptr %170, align 8, !tbaa !31
  %172 = load ptr, ptr %11, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct._dc_light_sector, ptr %172, i32 0, i32 3
  %174 = load ptr, ptr %173, align 8, !tbaa !31
  %175 = getelementptr inbounds %struct._dc_light_sector, ptr %174, i32 0, i32 4
  store ptr %171, ptr %175, align 8, !tbaa !32
  %176 = load ptr, ptr %11, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct._dc_light_sector, ptr %176, i32 0, i32 3
  %178 = load ptr, ptr %177, align 8, !tbaa !31
  %179 = load ptr, ptr %2, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct._dc_decompression, ptr %179, i32 0, i32 7
  store ptr %178, ptr %180, align 8, !tbaa !18
  %181 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %181) #4
  br label %188

182:                                              ; preds = %158
  %183 = load ptr, ptr %2, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct._dc_decompression, ptr %183, i32 0, i32 7
  %185 = load ptr, ptr %184, align 8, !tbaa !18
  call void @free(ptr noundef %185) #4
  %186 = load ptr, ptr %2, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct._dc_decompression, ptr %186, i32 0, i32 7
  store ptr null, ptr %187, align 8, !tbaa !18
  br label %188

188:                                              ; preds = %182, %167
  br label %189

189:                                              ; preds = %188, %81, %67
  br label %190

190:                                              ; preds = %189
  %191 = load i64, ptr %16, align 8, !tbaa !15
  %192 = add i64 %191, 1
  store i64 %192, ptr %16, align 8, !tbaa !15
  br label %62, !llvm.loop !33

193:                                              ; preds = %66
  br label %194

194:                                              ; preds = %193
  %195 = load i64, ptr %14, align 8, !tbaa !15
  %196 = add i64 %195, 1
  store i64 %196, ptr %14, align 8, !tbaa !15
  br label %56, !llvm.loop !34

197:                                              ; preds = %60
  %198 = load i32, ptr %10, align 4, !tbaa !17
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %10, align 4, !tbaa !17
  br label %35, !llvm.loop !35

200:                                              ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nounwind }
attributes #5 = { 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 40}
!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 = !{!14, !11, i64 8}
!14 = !{!"_dc_pixel_matrix", !6, i64 0, !11, i64 8, !11, i64 12}
!15 = !{!12, !12, i64 0}
!16 = !{!14, !11, i64 12}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !6, i64 48}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !11, i64 0}
!23 = !{!"_dc_corners", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!24 = !{!23, !11, i64 4}
!25 = !{!23, !11, i64 8}
!26 = !{!23, !11, i64 12}
!27 = !{!28, !7, i64 4}
!28 = !{!"_dc_light_sector", !29, i64 0, !7, i64 3, !7, i64 4, !6, i64 8, !6, i64 16}
!29 = !{!"_dc_pixel", !7, i64 0, !7, i64 1, !7, i64 2}
!30 = distinct !{!30, !21}
!31 = !{!28, !6, i64 8}
!32 = !{!28, !6, i64 16}
!33 = distinct !{!33, !21}
!34 = distinct !{!34, !21}
!35 = distinct !{!35, !21}


; 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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @_dc_render(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca %struct._dc_corners, align 4
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !12
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds i8, ptr %4, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !14
  %10 = sext i32 %9 to i64
  %11 = mul nsw i64 %10, %7
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %.not70 = icmp eq ptr %14, null
  br i1 %.not70, label %._crit_edge, label %.preheader60.lr.ph

.preheader60.lr.ph:                               ; preds = %1
  %.not94 = icmp eq i64 %11, 0
  %.not95 = icmp eq i32 %9, 0
  %15 = getelementptr inbounds i8, ptr %2, i64 4
  %16 = getelementptr inbounds i8, ptr %2, i64 8
  %17 = getelementptr inbounds i8, ptr %2, i64 12
  br i1 %.not95, label %.preheader60.lr.ph.split, label %.preheader60.lr.ph.split.us

.preheader60.lr.ph.split.us:                      ; preds = %.preheader60.lr.ph
  %.not96 = icmp eq i32 %6, 0
  br i1 %.not96, label %.preheader60.lr.ph.split.us.split, label %.preheader60.us.us

.preheader60.us.us:                               ; preds = %.preheader60.lr.ph.split.us, %._crit_edge69.split.us.us.us
  %.05471.us.us = phi i32 [ %64, %._crit_edge69.split.us.us.us ], [ 0, %.preheader60.lr.ph.split.us ]
  br i1 %.not94, label %.preheader.us.us.us.preheader, label %.lr.ph.us.us.preheader

.lr.ph.us.us.preheader:                           ; preds = %.preheader60.us.us
  call void @llvm.memset.p0.i64(ptr align 1 %12, i8 0, i64 %11, i1 false), !tbaa !16
  br label %.preheader.us.us.us.preheader

.preheader.us.us.us.preheader:                    ; preds = %.lr.ph.us.us.preheader, %.preheader60.us.us
  br label %.preheader.us.us.us

.preheader.us.us.us:                              ; preds = %.preheader.us.us.us.preheader, %._crit_edge67.us.us.us
  %.05268.us.us.us = phi i64 [ %63, %._crit_edge67.us.us.us ], [ 0, %.preheader.us.us.us.preheader ]
  %18 = trunc i64 %.05268.us.us.us to i32
  br label %19

19:                                               ; preds = %61, %.preheader.us.us.us
  %.05164.us.us.us = phi i64 [ 0, %.preheader.us.us.us ], [ %62, %61 ]
  %20 = trunc i64 %.05164.us.us.us to i32
  %21 = call i32 @ix(i32 noundef %20, i32 noundef %18, i32 noundef %6)
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i8, ptr %12, i64 %22
  %24 = load i8, ptr %23, align 1, !tbaa !16
  %25 = icmp eq i8 %24, 0
  br i1 %25, label %26, label %61

26:                                               ; preds = %19
  %27 = load ptr, ptr %13, align 8, !tbaa !15
  %.not57.us.us.us = icmp eq ptr %27, null
  br i1 %.not57.us.us.us, label %61, label %28

28:                                               ; preds = %26
  store i32 0, ptr %2, align 4, !tbaa !17
  store i32 0, ptr %15, align 4, !tbaa !19
  store i32 %6, ptr %16, align 4, !tbaa !20
  store i32 %9, ptr %17, align 4, !tbaa !21
  %29 = getelementptr inbounds i8, ptr %27, i64 4
  %30 = load i8, ptr %29, align 4, !tbaa !22
  %.not97 = icmp eq i8 %30, 0
  br i1 %.not97, label %._crit_edge.us.us.us, label %.lr.ph63.us.us.us

._crit_edge.us.us.us:                             ; preds = %56, %28
  call void @_dc_draw_n_occupy(ptr noundef %0, ptr noundef nonnull %2, ptr noundef %12, ptr noundef nonnull %27, i32 noundef %.05471.us.us)
  %31 = getelementptr inbounds i8, ptr %27, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !25
  %.not58.us.us.us = icmp eq ptr %32, null
  br i1 %.not58.us.us.us, label %35, label %33

33:                                               ; preds = %._crit_edge.us.us.us
  %34 = getelementptr inbounds i8, ptr %32, i64 16
  store ptr %32, ptr %34, align 8, !tbaa !26
  store ptr %32, ptr %13, align 8, !tbaa !15
  call void @free(ptr noundef nonnull %27) #6
  br label %61

35:                                               ; preds = %._crit_edge.us.us.us
  %36 = load ptr, ptr %13, align 8, !tbaa !15
  call void @free(ptr noundef %36) #6
  store ptr null, ptr %13, align 8, !tbaa !15
  br label %61

.lr.ph63.us.us.us:                                ; preds = %28, %56
  %.062.us.us.us = phi i32 [ %57, %56 ], [ 0, %28 ]
  %37 = load i32, ptr %16, align 4, !tbaa !20
  %38 = load i32, ptr %2, align 4, !tbaa !17
  %39 = sub nsw i32 %37, %38
  %40 = load i32, ptr %17, align 4, !tbaa !21
  %41 = load i32, ptr %15, align 4, !tbaa !19
  %42 = sub nsw i32 %40, %41
  %43 = icmp sgt i32 %39, %42
  br i1 %43, label %50, label %44

44:                                               ; preds = %.lr.ph63.us.us.us
  %45 = call i32 @_dc_get_mid(i32 noundef %41, i32 noundef %40)
  %46 = sext i32 %45 to i64
  %47 = icmp ult i64 %.05268.us.us.us, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 %45, ptr %15, align 4, !tbaa !19
  br label %56

49:                                               ; preds = %44
  store i32 %45, ptr %17, align 4, !tbaa !21
  br label %56

50:                                               ; preds = %.lr.ph63.us.us.us
  %51 = call i32 @_dc_get_mid(i32 noundef %38, i32 noundef %37)
  %52 = sext i32 %51 to i64
  %53 = icmp ult i64 %.05164.us.us.us, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  store i32 %51, ptr %2, align 4, !tbaa !17
  br label %56

55:                                               ; preds = %50
  store i32 %51, ptr %16, align 4, !tbaa !20
  br label %56

56:                                               ; preds = %55, %54, %49, %48
  %57 = add nuw nsw i32 %.062.us.us.us, 1
  %58 = load i8, ptr %29, align 4, !tbaa !22
  %59 = zext i8 %58 to i32
  %60 = icmp ult i32 %57, %59
  br i1 %60, label %.lr.ph63.us.us.us, label %._crit_edge.us.us.us, !llvm.loop !27

61:                                               ; preds = %35, %33, %26, %19
  %62 = add nuw i64 %.05164.us.us.us, 1
  %exitcond.not = icmp eq i64 %62, %7
  br i1 %exitcond.not, label %._crit_edge67.us.us.us, label %19, !llvm.loop !29

._crit_edge67.us.us.us:                           ; preds = %61
  %63 = add nuw i64 %.05268.us.us.us, 1
  %exitcond98.not = icmp eq i64 %63, %10
  br i1 %exitcond98.not, label %._crit_edge69.split.us.us.us, label %.preheader.us.us.us, !llvm.loop !30

._crit_edge69.split.us.us.us:                     ; preds = %._crit_edge67.us.us.us
  %64 = add nuw nsw i32 %.05471.us.us, 1
  %65 = load ptr, ptr %13, align 8, !tbaa !15
  %.not.us.us = icmp eq ptr %65, null
  br i1 %.not.us.us, label %._crit_edge, label %.preheader60.us.us, !llvm.loop !31

.preheader60.lr.ph.split.us.split:                ; preds = %.preheader60.lr.ph.split.us
  br i1 %.not94, label %.preheader60.us, label %.preheader60.us.us83

.preheader60.us.us83:                             ; preds = %.preheader60.lr.ph.split.us.split, %.preheader60.us.us83
  tail call void @llvm.memset.p0.i64(ptr align 1 %12, i8 0, i64 %11, i1 false), !tbaa !16
  br label %.preheader60.us.us83

.preheader60.us:                                  ; preds = %.preheader60.lr.ph.split.us.split, %.preheader60.us
  br label %.preheader60.us

.preheader60.lr.ph.split:                         ; preds = %.preheader60.lr.ph
  br i1 %.not94, label %.preheader60, label %.preheader60.us77

.preheader60.us77:                                ; preds = %.preheader60.lr.ph.split, %.preheader60.us77
  tail call void @llvm.memset.p0.i64(ptr align 1 %12, i8 0, i64 %11, i1 false), !tbaa !16
  br label %.preheader60.us77

.preheader60:                                     ; preds = %.preheader60.lr.ph.split, %.preheader60
  br label %.preheader60

._crit_edge:                                      ; preds = %._crit_edge69.split.us.us.us, %1
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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


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