; LLVM IR from catid/Zpng :: zpng (ZPNG_Decompress)

; 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.ZPNG_ImageData = type { %struct.ZPNG_Buffer, i32, i32, i32, i32, i32 }
%struct.ZPNG_Buffer = type { ptr, i32 }
%struct.ZPNG_Header = type { i16, i16, i16, 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: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #1

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

declare i32 @ZSTD_isError(i64 noundef) #3

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

; Function Attrs: mustprogress uwtable
define dso_local void @ZPNG_Decompress(ptr dead_on_unwind noalias writable sret(%struct.ZPNG_ImageData) align 8 %0, ptr %1, i32 %2) #4 {
  %4 = alloca %struct.ZPNG_Buffer, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = getelementptr inbounds { ptr, i32 }, ptr %4, i32 0, i32 0
  store ptr %1, ptr %13, align 8
  %14 = getelementptr inbounds { ptr, i32 }, ptr %4, i32 0, i32 1
  store i32 %2, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store ptr null, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 0
  %16 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %15, i32 0, i32 0
  store ptr null, ptr %16, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 0
  %18 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %17, i32 0, i32 1
  store i32 0, ptr %18, align 8, !tbaa !13
  %19 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 1
  store i32 0, ptr %19, align 8, !tbaa !14
  %20 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 2
  store i32 0, ptr %20, align 4, !tbaa !15
  %21 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 4
  store i32 0, ptr %21, align 4, !tbaa !16
  %22 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 5
  store i32 0, ptr %22, align 8, !tbaa !17
  %23 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 3
  store i32 0, ptr %23, align 8, !tbaa !18
  %24 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %4, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !19
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %31

27:                                               ; preds = %3
  %28 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %4, i32 0, i32 1
  %29 = load i32, ptr %28, align 8, !tbaa !20
  %30 = icmp ult i32 %29, 8
  br i1 %30, label %31, label %42

31:                                               ; preds = %27, %3
  br label %32

32:                                               ; preds = %147, %31
  %33 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 0
  %34 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = icmp ne ptr %35, %36
  br i1 %37, label %38, label %40

38:                                               ; preds = %32
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %39) #6
  br label %40

40:                                               ; preds = %38, %32
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %41) #6
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void

42:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %43 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %4, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !19
  store ptr %44, ptr %8, align 8, !tbaa !5
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ZPNG_Header, ptr %45, i32 0, i32 0
  %47 = load i16, ptr %46, align 2, !tbaa !21
  %48 = zext i16 %47 to i32
  %49 = icmp ne i32 %48, 64504
  br i1 %49, label %50, label %51

50:                                               ; preds = %42
  store i32 2, ptr %7, align 4
  br label %147

51:                                               ; preds = %42
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ZPNG_Header, ptr %52, i32 0, i32 1
  %54 = load i16, ptr %53, align 2, !tbaa !24
  %55 = zext i16 %54 to i32
  %56 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 3
  store i32 %55, ptr %56, align 8, !tbaa !18
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ZPNG_Header, ptr %57, i32 0, i32 2
  %59 = load i16, ptr %58, align 2, !tbaa !25
  %60 = zext i16 %59 to i32
  %61 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 4
  store i32 %60, ptr %61, align 4, !tbaa !16
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ZPNG_Header, ptr %62, i32 0, i32 3
  %64 = load i8, ptr %63, align 2, !tbaa !26
  %65 = zext i8 %64 to i32
  %66 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 2
  store i32 %65, ptr %66, align 4, !tbaa !15
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.ZPNG_Header, ptr %67, i32 0, i32 4
  %69 = load i8, ptr %68, align 1, !tbaa !27
  %70 = zext i8 %69 to i32
  %71 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 1
  store i32 %70, ptr %71, align 8, !tbaa !14
  %72 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 3
  %73 = load i32, ptr %72, align 8, !tbaa !18
  %74 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 2
  %75 = load i32, ptr %74, align 4, !tbaa !15
  %76 = mul i32 %73, %75
  %77 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 5
  store i32 %76, ptr %77, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %78 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 3
  %79 = load i32, ptr %78, align 8, !tbaa !18
  %80 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 4
  %81 = load i32, ptr %80, align 4, !tbaa !16
  %82 = mul i32 %79, %81
  store i32 %82, ptr %9, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %83 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 1
  %84 = load i32, ptr %83, align 8, !tbaa !14
  %85 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 2
  %86 = load i32, ptr %85, align 4, !tbaa !15
  %87 = mul i32 %84, %86
  store i32 %87, ptr %10, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %88 = load i32, ptr %10, align 4, !tbaa !28
  %89 = load i32, ptr %9, align 4, !tbaa !28
  %90 = mul i32 %88, %89
  store i32 %90, ptr %11, align 4, !tbaa !28
  %91 = load i32, ptr %11, align 4, !tbaa !28
  %92 = zext i32 %91 to i64
  %93 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %92) #7
  store ptr %93, ptr %5, align 8, !tbaa !5
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = icmp ne ptr %94, null
  br i1 %95, label %97, label %96

96:                                               ; preds = %51
  store i32 2, ptr %7, align 4
  br label %146

97:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = load i32, ptr %11, align 4, !tbaa !28
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %4, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !19
  %103 = getelementptr inbounds i8, ptr %102, i64 8
  %104 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %4, i32 0, i32 1
  %105 = load i32, ptr %104, align 8, !tbaa !20
  %106 = sub i32 %105, 8
  %107 = zext i32 %106 to i64
  %108 = call i64 @ZSTD_decompress(ptr noundef %98, i64 noundef %100, ptr noundef %103, i64 noundef %107)
  store i64 %108, ptr %12, align 8, !tbaa !29
  %109 = load i64, ptr %12, align 8, !tbaa !29
  %110 = call i32 @ZSTD_isError(i64 noundef %109)
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %113

112:                                              ; preds = %97
  store i32 2, ptr %7, align 4
  br label %145

113:                                              ; preds = %97
  %114 = load i32, ptr %11, align 4, !tbaa !28
  %115 = zext i32 %114 to i64
  %116 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %115) #7
  store ptr %116, ptr %6, align 8, !tbaa !5
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = icmp ne ptr %117, null
  br i1 %118, label %120, label %119

119:                                              ; preds = %113
  store i32 2, ptr %7, align 4
  br label %145

120:                                              ; preds = %113
  %121 = load ptr, ptr %6, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 0
  %123 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %122, i32 0, i32 0
  store ptr %121, ptr %123, align 8, !tbaa !9
  %124 = load i32, ptr %11, align 4, !tbaa !28
  %125 = getelementptr inbounds %struct.ZPNG_ImageData, ptr %0, i32 0, i32 0
  %126 = getelementptr inbounds %struct.ZPNG_Buffer, ptr %125, i32 0, i32 1
  store i32 %124, ptr %126, align 8, !tbaa !13
  %127 = load i32, ptr %10, align 4, !tbaa !28
  switch i32 %127, label %144 [
    i32 1, label %128
    i32 2, label %130
    i32 3, label %132
    i32 4, label %134
    i32 5, label %136
    i32 6, label %138
    i32 7, label %140
    i32 8, label %142
  ]

128:                                              ; preds = %120
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZL17UnpackAndUnfilterILi1EEvPKhP14ZPNG_ImageData(ptr noundef %129, ptr noundef %0)
  br label %144

130:                                              ; preds = %120
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZL17UnpackAndUnfilterILi2EEvPKhP14ZPNG_ImageData(ptr noundef %131, ptr noundef %0)
  br label %144

132:                                              ; preds = %120
  %133 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZL17UnpackAndUnfilterILi3EEvPKhP14ZPNG_ImageData(ptr noundef %133, ptr noundef %0)
  br label %144

134:                                              ; preds = %120
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZL17UnpackAndUnfilterILi4EEvPKhP14ZPNG_ImageData(ptr noundef %135, ptr noundef %0)
  br label %144

136:                                              ; preds = %120
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZL17UnpackAndUnfilterILi5EEvPKhP14ZPNG_ImageData(ptr noundef %137, ptr noundef %0)
  br label %144

138:                                              ; preds = %120
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZL17UnpackAndUnfilterILi6EEvPKhP14ZPNG_ImageData(ptr noundef %139, ptr noundef %0)
  br label %144

140:                                              ; preds = %120
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZL17UnpackAndUnfilterILi7EEvPKhP14ZPNG_ImageData(ptr noundef %141, ptr noundef %0)
  br label %144

142:                                              ; preds = %120
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZL17UnpackAndUnfilterILi8EEvPKhP14ZPNG_ImageData(ptr noundef %143, ptr noundef %0)
  br label %144

144:                                              ; preds = %142, %140, %138, %136, %134, %132, %130, %128, %120
  store i32 2, ptr %7, align 4
  br label %145

145:                                              ; preds = %144, %119, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %146

146:                                              ; preds = %145, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %147

147:                                              ; preds = %146, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %32
}

declare i64 @ZSTD_decompress(ptr noundef, i64 noundef, ptr noundef, i64 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi1EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi2EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi3EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi4EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi5EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi6EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi7EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi8EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) #5

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

!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++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS14ZPNG_ImageData", !11, i64 0, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32}
!11 = !{!"_ZTS11ZPNG_Buffer", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !12, i64 8}
!14 = !{!10, !12, i64 16}
!15 = !{!10, !12, i64 20}
!16 = !{!10, !12, i64 28}
!17 = !{!10, !12, i64 32}
!18 = !{!10, !12, i64 24}
!19 = !{!11, !6, i64 0}
!20 = !{!11, !12, i64 8}
!21 = !{!22, !23, i64 0}
!22 = !{!"_ZTS11ZPNG_Header", !23, i64 0, !23, i64 2, !23, i64 4, !7, i64 6, !7, i64 7}
!23 = !{!"short", !7, i64 0}
!24 = !{!22, !23, i64 2}
!25 = !{!22, !23, i64 4}
!26 = !{!22, !7, i64 6}
!27 = !{!22, !7, i64 7}
!28 = !{!12, !12, i64 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"long", !7, 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"

%struct.ZPNG_ImageData = type { %struct.ZPNG_Buffer, i32, i32, i32, i32, i32 }
%struct.ZPNG_Buffer = type { ptr, i32 }

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

declare i32 @ZSTD_isError(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @ZPNG_Decompress(ptr dead_on_unwind noalias writable sret(%struct.ZPNG_ImageData) align 8 %0, ptr %1, i32 %2) local_unnamed_addr #3 {
  store ptr null, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 0, ptr %4, align 8, !tbaa !12
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = getelementptr inbounds i8, ptr %0, i64 20
  %7 = getelementptr inbounds i8, ptr %0, i64 28
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = icmp eq ptr %1, null
  %11 = icmp ult i32 %2, 8
  %or.cond = select i1 %10, i1 true, i1 %11
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(20) %5, i8 0, i64 20, i1 false)
  br i1 %or.cond, label %12, label %16

12:                                               ; preds = %16, %37, %43, %53, %52, %51, %50, %49, %48, %47, %46, %45, %18, %3
  %.032 = phi ptr [ null, %3 ], [ null, %16 ], [ null, %18 ], [ null, %37 ], [ null, %43 ], [ %44, %53 ], [ %44, %52 ], [ %44, %51 ], [ %44, %50 ], [ %44, %49 ], [ %44, %48 ], [ %44, %47 ], [ %44, %46 ], [ %44, %45 ]
  %.0 = phi ptr [ null, %3 ], [ null, %16 ], [ null, %18 ], [ %36, %37 ], [ %36, %43 ], [ %36, %53 ], [ %36, %52 ], [ %36, %51 ], [ %36, %50 ], [ %36, %49 ], [ %36, %48 ], [ %36, %47 ], [ %36, %46 ], [ %36, %45 ]
  %13 = load ptr, ptr %0, align 8, !tbaa !5
  %.not42 = icmp eq ptr %13, %.032
  br i1 %.not42, label %15, label %14

14:                                               ; preds = %12
  tail call void @free(ptr noundef %.032) #6
  br label %15

15:                                               ; preds = %14, %12
  tail call void @free(ptr noundef %.0) #6
  ret void

16:                                               ; preds = %3
  %17 = load i16, ptr %1, align 2, !tbaa !13
  %.not = icmp eq i16 %17, -1032
  br i1 %.not, label %18, label %12

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %1, i64 2
  %20 = load i16, ptr %19, align 2, !tbaa !16
  %21 = zext i16 %20 to i32
  store i32 %21, ptr %9, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %1, i64 4
  %23 = load i16, ptr %22, align 2, !tbaa !18
  %24 = zext i16 %23 to i32
  store i32 %24, ptr %7, align 4, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %1, i64 6
  %26 = load i8, ptr %25, align 2, !tbaa !20
  %27 = zext i8 %26 to i32
  store i32 %27, ptr %6, align 4, !tbaa !21
  %28 = getelementptr inbounds i8, ptr %1, i64 7
  %29 = load i8, ptr %28, align 1, !tbaa !22
  %30 = zext i8 %29 to i32
  store i32 %30, ptr %5, align 8, !tbaa !23
  %31 = mul nuw nsw i32 %27, %21
  store i32 %31, ptr %8, align 8, !tbaa !24
  %32 = mul nuw i32 %24, %21
  %33 = mul nuw nsw i32 %30, %27
  %34 = mul i32 %32, %33
  %35 = zext i32 %34 to i64
  %36 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %35) #7
  %.not39 = icmp eq ptr %36, null
  br i1 %.not39, label %12, label %37

37:                                               ; preds = %18
  %38 = getelementptr inbounds i8, ptr %1, i64 8
  %39 = add i32 %2, -8
  %40 = zext i32 %39 to i64
  %41 = tail call i64 @ZSTD_decompress(ptr noundef nonnull %36, i64 noundef %35, ptr noundef nonnull %38, i64 noundef %40)
  %42 = tail call i32 @ZSTD_isError(i64 noundef %41)
  %.not40 = icmp eq i32 %42, 0
  br i1 %.not40, label %43, label %12

43:                                               ; preds = %37
  %44 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %35) #7
  %.not41 = icmp eq ptr %44, null
  br i1 %.not41, label %12, label %45

45:                                               ; preds = %43
  store ptr %44, ptr %0, align 8, !tbaa !5
  store i32 %34, ptr %4, align 8, !tbaa !12
  %trunc = trunc nuw i32 %33 to i16
  switch i16 %trunc, label %12 [
    i16 1, label %46
    i16 2, label %47
    i16 3, label %48
    i16 4, label %49
    i16 5, label %50
    i16 6, label %51
    i16 7, label %52
    i16 8, label %53
  ]

46:                                               ; preds = %45
  tail call void @_ZL17UnpackAndUnfilterILi1EEvPKhP14ZPNG_ImageData(ptr noundef nonnull %36, ptr noundef nonnull %0)
  br label %12

47:                                               ; preds = %45
  tail call void @_ZL17UnpackAndUnfilterILi2EEvPKhP14ZPNG_ImageData(ptr noundef nonnull %36, ptr noundef nonnull %0)
  br label %12

48:                                               ; preds = %45
  tail call void @_ZL17UnpackAndUnfilterILi3EEvPKhP14ZPNG_ImageData(ptr noundef nonnull %36, ptr noundef nonnull %0)
  br label %12

49:                                               ; preds = %45
  tail call void @_ZL17UnpackAndUnfilterILi4EEvPKhP14ZPNG_ImageData(ptr noundef nonnull %36, ptr noundef nonnull %0)
  br label %12

50:                                               ; preds = %45
  tail call void @_ZL17UnpackAndUnfilterILi5EEvPKhP14ZPNG_ImageData(ptr noundef nonnull %36, ptr noundef nonnull %0)
  br label %12

51:                                               ; preds = %45
  tail call void @_ZL17UnpackAndUnfilterILi6EEvPKhP14ZPNG_ImageData(ptr noundef nonnull %36, ptr noundef nonnull %0)
  br label %12

52:                                               ; preds = %45
  tail call void @_ZL17UnpackAndUnfilterILi7EEvPKhP14ZPNG_ImageData(ptr noundef nonnull %36, ptr noundef nonnull %0)
  br label %12

53:                                               ; preds = %45
  tail call void @_ZL17UnpackAndUnfilterILi8EEvPKhP14ZPNG_ImageData(ptr noundef nonnull %36, ptr noundef nonnull %0)
  br label %12
}

declare i64 @ZSTD_decompress(ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi1EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi2EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi3EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi4EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi5EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi6EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi7EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL17UnpackAndUnfilterILi8EEvPKhP14ZPNG_ImageData(ptr noundef, ptr noundef) local_unnamed_addr #4

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 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 #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 = { mustprogress 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 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }

!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, !8, i64 0}
!6 = !{!"_ZTS14ZPNG_ImageData", !7, i64 0, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!7 = !{!"_ZTS11ZPNG_Buffer", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!6, !11, i64 8}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTS11ZPNG_Header", !15, i64 0, !15, i64 2, !15, i64 4, !9, i64 6, !9, i64 7}
!15 = !{!"short", !9, i64 0}
!16 = !{!14, !15, i64 2}
!17 = !{!6, !11, i64 24}
!18 = !{!14, !15, i64 4}
!19 = !{!6, !11, i64 28}
!20 = !{!14, !9, i64 6}
!21 = !{!6, !11, i64 20}
!22 = !{!14, !9, i64 7}
!23 = !{!6, !11, i64 16}
!24 = !{!6, !11, i64 32}


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