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

; 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_pixel = type { i8, i8, i8 }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@stderr = external global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @stbi_image_free(ptr noundef) #0

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

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

declare i32 @fclose(ptr noundef) #2

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

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #2

declare i64 @ftell(ptr noundef) #2

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

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

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

21:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._dc_compression, ptr %22, i32 0, i32 4
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = call noalias ptr @fopen(ptr noundef %24, ptr noundef @.str)
  store ptr %25, ptr %7, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = call i32 @fseek(ptr noundef %26, i64 noundef 0, i32 noundef 2)
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = call i64 @ftell(ptr noundef %28)
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._dc_compression, ptr %30, i32 0, i32 3
  store i64 %29, ptr %31, align 8, !tbaa !13
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  call void @rewind(ptr noundef %32)
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = call i32 @fclose(ptr noundef %33)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %35

35:                                               ; preds = %21
  %36 = load i32, ptr %3, align 4, !tbaa !14
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._dc_compression, ptr %37, i32 0, i32 7
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  %40 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %39, i32 0, i32 1
  store i32 %36, ptr %40, align 8, !tbaa !16
  %41 = load i32, ptr %4, align 4, !tbaa !14
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._dc_compression, ptr %42, i32 0, i32 7
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  %45 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %44, i32 0, i32 2
  store i32 %41, ptr %45, align 4, !tbaa !18
  %46 = load i32, ptr %3, align 4, !tbaa !14
  %47 = sext i32 %46 to i64
  %48 = mul i64 3, %47
  %49 = load i32, ptr %4, align 4, !tbaa !14
  %50 = sext i32 %49 to i64
  %51 = mul i64 %48, %50
  %52 = call noalias ptr @malloc(i64 noundef %51) #8
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._dc_compression, ptr %53, i32 0, i32 7
  %55 = load ptr, ptr %54, align 8, !tbaa !15
  %56 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %55, i32 0, i32 0
  store ptr %52, ptr %56, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !20
  br label %57

57:                                               ; preds = %105, %35
  %58 = load i64, ptr %9, align 8, !tbaa !20
  %59 = load i32, ptr %3, align 4, !tbaa !14
  %60 = load i32, ptr %4, align 4, !tbaa !14
  %61 = mul nsw i32 %59, %60
  %62 = sext i32 %61 to i64
  %63 = icmp ult i64 %58, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %108

65:                                               ; preds = %57
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = load i64, ptr %8, align 8, !tbaa !20
  %68 = add i64 %67, 1
  store i64 %68, ptr %8, align 8, !tbaa !20
  %69 = getelementptr inbounds i8, ptr %66, i64 %67
  %70 = load i8, ptr %69, align 1, !tbaa !21
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._dc_compression, ptr %71, i32 0, i32 7
  %73 = load ptr, ptr %72, align 8, !tbaa !15
  %74 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !19
  %76 = load i64, ptr %9, align 8, !tbaa !20
  %77 = getelementptr inbounds %struct._dc_pixel, ptr %75, i64 %76
  %78 = getelementptr inbounds %struct._dc_pixel, ptr %77, i32 0, i32 0
  store i8 %70, ptr %78, align 1, !tbaa !22
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = load i64, ptr %8, align 8, !tbaa !20
  %81 = add i64 %80, 1
  store i64 %81, ptr %8, align 8, !tbaa !20
  %82 = getelementptr inbounds i8, ptr %79, i64 %80
  %83 = load i8, ptr %82, align 1, !tbaa !21
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._dc_compression, ptr %84, i32 0, i32 7
  %86 = load ptr, ptr %85, align 8, !tbaa !15
  %87 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !19
  %89 = load i64, ptr %9, align 8, !tbaa !20
  %90 = getelementptr inbounds %struct._dc_pixel, ptr %88, i64 %89
  %91 = getelementptr inbounds %struct._dc_pixel, ptr %90, i32 0, i32 1
  store i8 %83, ptr %91, align 1, !tbaa !24
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load i64, ptr %8, align 8, !tbaa !20
  %94 = add i64 %93, 1
  store i64 %94, ptr %8, align 8, !tbaa !20
  %95 = getelementptr inbounds i8, ptr %92, i64 %93
  %96 = load i8, ptr %95, align 1, !tbaa !21
  %97 = load ptr, ptr %2, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._dc_compression, ptr %97, i32 0, i32 7
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = getelementptr inbounds %struct._dc_pixel_matrix, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !19
  %102 = load i64, ptr %9, align 8, !tbaa !20
  %103 = getelementptr inbounds %struct._dc_pixel, ptr %101, i64 %102
  %104 = getelementptr inbounds %struct._dc_pixel, ptr %103, i32 0, i32 2
  store i8 %96, ptr %104, align 1, !tbaa !25
  br label %105

105:                                              ; preds = %65
  %106 = load i64, ptr %9, align 8, !tbaa !20
  %107 = add i64 %106, 1
  store i64 %107, ptr %9, align 8, !tbaa !20
  br label %57, !llvm.loop !26

108:                                              ; preds = %64
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  call void @stbi_image_free(ptr noundef %109)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %110 = load ptr, ptr %2, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct._dc_compression, ptr %110, i32 0, i32 1
  %112 = load i8, ptr %111, align 4, !tbaa !28
  %113 = zext i8 %112 to i32
  switch i32 %113, label %125 [
    i32 1, label %114
    i32 2, label %119
  ]

114:                                              ; preds = %108
  %115 = load i32, ptr %3, align 4, !tbaa !14
  %116 = load i32, ptr %4, align 4, !tbaa !14
  %117 = mul nsw i32 %115, %116
  %118 = sext i32 %117 to i64
  store i64 %118, ptr %10, align 8, !tbaa !20
  br label %126

119:                                              ; preds = %108
  %120 = load i32, ptr %3, align 4, !tbaa !14
  %121 = load i32, ptr %4, align 4, !tbaa !14
  %122 = mul nsw i32 %120, %121
  %123 = mul nsw i32 %122, 3
  %124 = sext i32 %123 to i64
  store i64 %124, ptr %10, align 8, !tbaa !20
  br label %126

125:                                              ; preds = %108
  br label %126

126:                                              ; preds = %125, %119, %114
  %127 = load i64, ptr %10, align 8, !tbaa !20
  %128 = mul i64 8, %127
  %129 = call noalias ptr @malloc(i64 noundef %128) #8
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._dc_compression, ptr %130, i32 0, i32 8
  store ptr %129, ptr %131, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !20
  br label %132

132:                                              ; preds = %143, %126
  %133 = load i64, ptr %11, align 8, !tbaa !20
  %134 = load i64, ptr %10, align 8, !tbaa !20
  %135 = icmp ult i64 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %146

137:                                              ; preds = %132
  %138 = load ptr, ptr %2, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._dc_compression, ptr %138, i32 0, i32 8
  %140 = load ptr, ptr %139, align 8, !tbaa !29
  %141 = load i64, ptr %11, align 8, !tbaa !20
  %142 = getelementptr inbounds ptr, ptr %140, i64 %141
  store ptr null, ptr %142, align 8, !tbaa !5
  br label %143

143:                                              ; preds = %137
  %144 = load i64, ptr %11, align 8, !tbaa !20
  %145 = add i64 %144, 1
  store i64 %145, ptr %11, align 8, !tbaa !20
  br label %132, !llvm.loop !30

146:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  ret void
}

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

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

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

declare void @rewind(ptr noundef) #2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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) "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 "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 = { 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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!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, !12, i64 16}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !6, i64 48}
!16 = !{!17, !11, i64 8}
!17 = !{!"_dc_pixel_matrix", !6, i64 0, !11, i64 8, !11, i64 12}
!18 = !{!17, !11, i64 12}
!19 = !{!17, !6, i64 0}
!20 = !{!12, !12, i64 0}
!21 = !{!7, !7, i64 0}
!22 = !{!23, !7, i64 0}
!23 = !{!"_dc_pixel", !7, i64 0, !7, i64 1, !7, i64 2}
!24 = !{!23, !7, i64 1}
!25 = !{!23, !7, i64 2}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!10, !7, i64 4}
!29 = !{!10, !6, i64 56}
!30 = distinct !{!30, !27}


; 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_pixel = type { i8, i8, i8 }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [18 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @stbi_load(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 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: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i64 @ftell(ptr nocapture noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local void @_dc_unpack(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = call ptr @stbi_load(ptr noundef %6, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, i32 noundef 3)
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %8, label %11

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

11:                                               ; preds = %1
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = call noalias ptr @fopen(ptr noundef %12, ptr noundef nonnull @.str)
  %14 = call i32 @fseek(ptr noundef %13, i64 noundef 0, i32 noundef 2)
  %15 = call i64 @ftell(ptr noundef %13)
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 %15, ptr %16, align 8, !tbaa !13
  call void @rewind(ptr noundef %13)
  %17 = call i32 @fclose(ptr noundef %13)
  %18 = load i32, ptr %2, align 4, !tbaa !14
  %19 = getelementptr inbounds i8, ptr %0, i64 48
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  store i32 %18, ptr %21, align 8, !tbaa !16
  %22 = load i32, ptr %3, align 4, !tbaa !14
  %23 = getelementptr inbounds i8, ptr %20, i64 12
  store i32 %22, ptr %23, align 4, !tbaa !18
  %24 = sext i32 %18 to i64
  %25 = mul nsw i64 %24, 3
  %26 = sext i32 %22 to i64
  %27 = mul i64 %25, %26
  %28 = call noalias ptr @malloc(i64 noundef %27) #8
  store ptr %28, ptr %20, align 8, !tbaa !19
  %29 = mul nsw i32 %22, %18
  %30 = sext i32 %29 to i64
  %.not43 = icmp eq i32 %29, 0
  br i1 %.not43, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %11
  call void @stbi_image_free(ptr noundef nonnull %7)
  %31 = getelementptr inbounds i8, ptr %0, i64 4
  %32 = load i8, ptr %31, align 4, !tbaa !20
  switch i8 %32, label %55 [
    i8 1, label %44
    i8 2, label %49
  ]

.lr.ph:                                           ; preds = %11, %.lr.ph
  %.03438 = phi i64 [ %43, %.lr.ph ], [ 0, %11 ]
  %.03537 = phi i64 [ %39, %.lr.ph ], [ 0, %11 ]
  %33 = getelementptr inbounds i8, ptr %7, i64 %.03537
  %34 = load i8, ptr %33, align 1, !tbaa !21
  %35 = getelementptr inbounds %struct._dc_pixel, ptr %28, i64 %.03438
  store i8 %34, ptr %35, align 1, !tbaa !22
  %36 = getelementptr i8, ptr %33, i64 1
  %37 = load i8, ptr %36, align 1, !tbaa !21
  %38 = getelementptr inbounds %struct._dc_pixel, ptr %28, i64 %.03438, i32 1
  store i8 %37, ptr %38, align 1, !tbaa !24
  %39 = add i64 %.03537, 3
  %40 = getelementptr i8, ptr %33, i64 2
  %41 = load i8, ptr %40, align 1, !tbaa !21
  %42 = getelementptr inbounds %struct._dc_pixel, ptr %28, i64 %.03438, i32 2
  store i8 %41, ptr %42, align 1, !tbaa !25
  %43 = add nuw i64 %.03438, 1
  %exitcond.not = icmp eq i64 %43, %30
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !26

44:                                               ; preds = %._crit_edge
  %45 = load i32, ptr %2, align 4, !tbaa !14
  %46 = load i32, ptr %3, align 4, !tbaa !14
  %47 = mul nsw i32 %46, %45
  %48 = sext i32 %47 to i64
  br label %55

49:                                               ; preds = %._crit_edge
  %50 = load i32, ptr %2, align 4, !tbaa !14
  %51 = load i32, ptr %3, align 4, !tbaa !14
  %52 = mul i32 %50, 3
  %53 = mul i32 %52, %51
  %54 = sext i32 %53 to i64
  br label %55

55:                                               ; preds = %._crit_edge, %49, %44
  %.033 = phi i64 [ undef, %._crit_edge ], [ %54, %49 ], [ %48, %44 ]
  %56 = shl i64 %.033, 3
  %57 = call noalias ptr @malloc(i64 noundef %56) #8
  %58 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %57, ptr %58, align 8, !tbaa !28
  %.not44 = icmp eq i64 %.033, 0
  br i1 %.not44, label %._crit_edge42, label %.lr.ph41.preheader

.lr.ph41.preheader:                               ; preds = %55
  %xtraiter = and i64 %.033, 3
  %59 = icmp ult i64 %.033, 4
  br i1 %59, label %._crit_edge42.loopexit.unr-lcssa, label %.lr.ph41.preheader.new

.lr.ph41.preheader.new:                           ; preds = %.lr.ph41.preheader
  %unroll_iter = and i64 %.033, -4
  br label %.lr.ph41

._crit_edge42.loopexit.unr-lcssa:                 ; preds = %.lr.ph41, %.lr.ph41.preheader
  %.039.unr = phi i64 [ 0, %.lr.ph41.preheader ], [ %74, %.lr.ph41 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge42, label %.lr.ph41.epil

.lr.ph41.epil:                                    ; preds = %._crit_edge42.loopexit.unr-lcssa, %.lr.ph41.epil
  %.039.epil = phi i64 [ %62, %.lr.ph41.epil ], [ %.039.unr, %._crit_edge42.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph41.epil ], [ 0, %._crit_edge42.loopexit.unr-lcssa ]
  %60 = load ptr, ptr %58, align 8, !tbaa !28
  %61 = getelementptr inbounds ptr, ptr %60, i64 %.039.epil
  store ptr null, ptr %61, align 8, !tbaa !12
  %62 = add nuw i64 %.039.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge42, label %.lr.ph41.epil, !llvm.loop !29

._crit_edge42:                                    ; preds = %._crit_edge42.loopexit.unr-lcssa, %.lr.ph41.epil, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  ret void

.lr.ph41:                                         ; preds = %.lr.ph41, %.lr.ph41.preheader.new
  %.039 = phi i64 [ 0, %.lr.ph41.preheader.new ], [ %74, %.lr.ph41 ]
  %niter = phi i64 [ 0, %.lr.ph41.preheader.new ], [ %niter.next.3, %.lr.ph41 ]
  %63 = load ptr, ptr %58, align 8, !tbaa !28
  %64 = getelementptr inbounds ptr, ptr %63, i64 %.039
  store ptr null, ptr %64, align 8, !tbaa !12
  %65 = or disjoint i64 %.039, 1
  %66 = load ptr, ptr %58, align 8, !tbaa !28
  %67 = getelementptr inbounds ptr, ptr %66, i64 %65
  store ptr null, ptr %67, align 8, !tbaa !12
  %68 = or disjoint i64 %.039, 2
  %69 = load ptr, ptr %58, align 8, !tbaa !28
  %70 = getelementptr inbounds ptr, ptr %69, i64 %68
  store ptr null, ptr %70, align 8, !tbaa !12
  %71 = or disjoint i64 %.039, 3
  %72 = load ptr, ptr %58, align 8, !tbaa !28
  %73 = getelementptr inbounds ptr, ptr %72, i64 %71
  store ptr null, ptr %73, align 8, !tbaa !12
  %74 = add nuw i64 %.039, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge42.loopexit.unr-lcssa, label %.lr.ph41, !llvm.loop !31
}

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

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

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

; Function Attrs: nofree nounwind
declare void @rewind(ptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { cold nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 24}
!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, !10, i64 16}
!14 = !{!7, !7, i64 0}
!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 = !{!17, !11, i64 0}
!20 = !{!6, !8, i64 4}
!21 = !{!8, !8, i64 0}
!22 = !{!23, !8, i64 0}
!23 = !{!"_dc_pixel", !8, i64 0, !8, i64 1, !8, i64 2}
!24 = !{!23, !8, i64 1}
!25 = !{!23, !8, i64 2}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!6, !11, i64 56}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.unroll.disable"}
!31 = distinct !{!31, !27}


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