; LLVM IR from ermig1979/Simd :: src/Simd (SimdBaseImageLoadPng)

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

%"class.Simd::Base::ImagePngLoader" = type { %"class.Simd::ImageLoader", [7 x ptr], ptr, ptr, i8, i8, i8, i32, i32, i32, i32, [3 x i16], i8, i8, i8, i8, [3 x i8], %"struct.Simd::Array", %"struct.Simd::Array", %"struct.Simd::Array", %"class.std::vector" }
%"class.Simd::ImageLoader" = type { ptr, %"struct.Simd::ImageLoaderParam", %"class.Simd::InputMemoryStream", %"struct.Simd::View" }
%"struct.Simd::ImageLoaderParam" = type { ptr, i64, i32, i32 }
%"class.Simd::InputMemoryStream" = type { ptr, i64, i64, i64, i64 }
%"struct.Simd::View" = type <{ i64, i64, i64, i32, [4 x i8], ptr, i8, [7 x i8] }>
%"struct.Simd::Array" = type { ptr, i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Simd::Base::ImagePngLoader::Chunk, std::allocator<Simd::Base::ImagePngLoader::Chunk>>::_Vector_impl" }
%"struct.std::_Vector_base<Simd::Base::ImagePngLoader::Chunk, std::allocator<Simd::Base::ImagePngLoader::Chunk>>::_Vector_impl" = type { %"struct.std::_Vector_base<Simd::Base::ImagePngLoader::Chunk, std::allocator<Simd::Base::ImagePngLoader::Chunk>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Simd::Base::ImagePngLoader::Chunk, std::allocator<Simd::Base::ImagePngLoader::Chunk>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.Simd::Base::ImagePngLoader::Chunk" = type { i32, i32, i32 }

@_ZN4Simd4BaseL15DepthScaleTableE = external hidden constant [9 x i8], align 1

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

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4Simd17InputMemoryStream4SkipEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Simd4Base14ImagePngLoader16ReadTransparencyERKNS1_5ChunkE(ptr noundef nonnull align 8 dereferenceable(304) %0, ptr noundef nonnull align 4 dereferenceable(12) %1) #2 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  %11 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 4
  %12 = load i8, ptr %11, align 8, !tbaa !9, !range !26, !noundef !27
  %13 = trunc i8 %12 to i1
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %152

15:                                               ; preds = %2
  %16 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 20
  %17 = call noundef i64 @_ZNKSt6vectorIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #4
  %18 = icmp ne i64 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %15
  store i1 false, ptr %3, align 1
  br label %152

20:                                               ; preds = %15
  %21 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 15
  %22 = load i8, ptr %21, align 1, !tbaa !28
  %23 = icmp ne i8 %22, 0
  br i1 %23, label %24, label %79

24:                                               ; preds = %20
  %25 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 17
  %26 = getelementptr inbounds %"struct.Simd::Array", ptr %25, i32 0, i32 1
  %27 = load i64, ptr %26, align 8, !tbaa !29
  %28 = icmp eq i64 %27, 0
  br i1 %28, label %45, label %29

29:                                               ; preds = %24
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.Simd::Base::ImagePngLoader::Chunk", ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 4, !tbaa !30
  %33 = zext i32 %32 to i64
  %34 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 17
  %35 = getelementptr inbounds %"struct.Simd::Array", ptr %34, i32 0, i32 1
  %36 = load i64, ptr %35, align 8, !tbaa !29
  %37 = icmp ugt i64 %33, %36
  br i1 %37, label %45, label %38

38:                                               ; preds = %29
  %39 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 2
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.Simd::Base::ImagePngLoader::Chunk", ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 4, !tbaa !30
  %43 = zext i32 %42 to i64
  %44 = call noundef zeroext i1 @_ZNK4Simd17InputMemoryStream7CanReadEm(ptr noundef nonnull align 8 dereferenceable(40) %39, i64 noundef %43)
  br i1 %44, label %46, label %45

45:                                               ; preds = %38, %29, %24
  store i1 false, ptr %3, align 1
  br label %152

46:                                               ; preds = %38
  %47 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 15
  store i8 4, ptr %47, align 1, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !32
  br label %48

48:                                               ; preds = %69, %46
  %49 = load i64, ptr %6, align 8, !tbaa !32
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.Simd::Base::ImagePngLoader::Chunk", ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 4, !tbaa !30
  %53 = zext i32 %52 to i64
  %54 = icmp ult i64 %49, %53
  br i1 %54, label %56, label %55

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

56:                                               ; preds = %48
  %57 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 2
  %58 = call noundef ptr @_ZNK4Simd17InputMemoryStream7CurrentEv(ptr noundef nonnull align 8 dereferenceable(40) %57)
  %59 = load i64, ptr %6, align 8, !tbaa !32
  %60 = getelementptr inbounds i8, ptr %58, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !33
  %62 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 17
  %63 = getelementptr inbounds %"struct.Simd::Array", ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !34
  %65 = load i64, ptr %6, align 8, !tbaa !32
  %66 = mul i64 %65, 4
  %67 = add i64 %66, 3
  %68 = getelementptr inbounds i8, ptr %64, i64 %67
  store i8 %61, ptr %68, align 1, !tbaa !33
  br label %69

69:                                               ; preds = %56
  %70 = load i64, ptr %6, align 8, !tbaa !32
  %71 = add i64 %70, 1
  store i64 %71, ptr %6, align 8, !tbaa !32
  br label %48, !llvm.loop !35

72:                                               ; preds = %55
  %73 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 2
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.Simd::Base::ImagePngLoader::Chunk", ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 4, !tbaa !30
  %77 = zext i32 %76 to i64
  %78 = call noundef zeroext i1 @_ZN4Simd17InputMemoryStream4SkipEm(ptr noundef nonnull align 8 dereferenceable(40) %73, i64 noundef %77)
  br label %151

79:                                               ; preds = %20
  %80 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 9
  %81 = load i32, ptr %80, align 4, !tbaa !37
  %82 = and i32 %81, 1
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %92

84:                                               ; preds = %79
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %"struct.Simd::Base::ImagePngLoader::Chunk", ptr %85, i32 0, i32 0
  %87 = load i32, ptr %86, align 4, !tbaa !30
  %88 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 9
  %89 = load i32, ptr %88, align 4, !tbaa !37
  %90 = mul i32 %89, 2
  %91 = icmp ne i32 %87, %90
  br i1 %91, label %92, label %93

92:                                               ; preds = %84, %79
  store i1 false, ptr %3, align 1
  br label %152

93:                                               ; preds = %84
  %94 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 5
  store i8 1, ptr %94, align 1, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !32
  br label %95

95:                                               ; preds = %110, %93
  %96 = load i64, ptr %7, align 8, !tbaa !32
  %97 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 9
  %98 = load i32, ptr %97, align 4, !tbaa !37
  %99 = zext i32 %98 to i64
  %100 = icmp ult i64 %96, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %95
  store i32 5, ptr %8, align 4
  br label %113

102:                                              ; preds = %95
  %103 = getelementptr inbounds %"class.Simd::ImageLoader", ptr %10, i32 0, i32 2
  %104 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 11
  %105 = load i64, ptr %7, align 8, !tbaa !32
  %106 = getelementptr inbounds [3 x i16], ptr %104, i64 0, i64 %105
  %107 = call noundef zeroext i1 @_ZN4Simd17InputMemoryStream9ReadBe16uERt(ptr noundef nonnull align 8 dereferenceable(40) %103, ptr noundef nonnull align 2 dereferenceable(2) %106)
  br i1 %107, label %109, label %108

108:                                              ; preds = %102
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %113

109:                                              ; preds = %102
  br label %110

110:                                              ; preds = %109
  %111 = load i64, ptr %7, align 8, !tbaa !32
  %112 = add i64 %111, 1
  store i64 %112, ptr %7, align 8, !tbaa !32
  br label %95, !llvm.loop !39

113:                                              ; preds = %108, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %114 = load i32, ptr %8, align 4
  switch i32 %114, label %154 [
    i32 5, label %115
    i32 1, label %152
  ]

115:                                              ; preds = %113
  %116 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 12
  %117 = load i8, ptr %116, align 2, !tbaa !40
  %118 = zext i8 %117 to i32
  %119 = icmp ne i32 %118, 16
  br i1 %119, label %120, label %150

120:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !32
  br label %121

121:                                              ; preds = %146, %120
  %122 = load i64, ptr %9, align 8, !tbaa !32
  %123 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 9
  %124 = load i32, ptr %123, align 4, !tbaa !37
  %125 = zext i32 %124 to i64
  %126 = icmp ult i64 %122, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %121
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %149

128:                                              ; preds = %121
  %129 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 11
  %130 = load i64, ptr %9, align 8, !tbaa !32
  %131 = getelementptr inbounds [3 x i16], ptr %129, i64 0, i64 %130
  %132 = load i16, ptr %131, align 2, !tbaa !41
  %133 = trunc i16 %132 to i8
  %134 = zext i8 %133 to i32
  %135 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 12
  %136 = load i8, ptr %135, align 2, !tbaa !40
  %137 = zext i8 %136 to i64
  %138 = getelementptr inbounds [9 x i8], ptr @_ZN4Simd4BaseL15DepthScaleTableE, i64 0, i64 %137
  %139 = load i8, ptr %138, align 1, !tbaa !33
  %140 = zext i8 %139 to i32
  %141 = mul nsw i32 %134, %140
  %142 = trunc i32 %141 to i8
  %143 = getelementptr inbounds %"class.Simd::Base::ImagePngLoader", ptr %10, i32 0, i32 16
  %144 = load i64, ptr %9, align 8, !tbaa !32
  %145 = getelementptr inbounds [3 x i8], ptr %143, i64 0, i64 %144
  store i8 %142, ptr %145, align 1, !tbaa !33
  br label %146

146:                                              ; preds = %128
  %147 = load i64, ptr %9, align 8, !tbaa !32
  %148 = add i64 %147, 1
  store i64 %148, ptr %9, align 8, !tbaa !32
  br label %121, !llvm.loop !43

149:                                              ; preds = %127
  br label %150

150:                                              ; preds = %149, %115
  br label %151

151:                                              ; preds = %150, %72
  store i1 true, ptr %3, align 1
  br label %152

152:                                              ; preds = %151, %113, %92, %45, %19, %14
  %153 = load i1, ptr %3, align 1
  ret i1 %153

154:                                              ; preds = %113
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Simd17InputMemoryStream7CanReadEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4Simd17InputMemoryStream7CurrentEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4Simd17InputMemoryStream9ReadBe16uERt(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 2 dereferenceable(2)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline 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 #2 = { 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 #3 = { 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !19, i64 192}
!10 = !{!"_ZTSN4Simd4Base14ImagePngLoaderE", !11, i64 0, !7, i64 120, !6, i64 176, !6, i64 184, !19, i64 192, !19, i64 193, !19, i64 194, !20, i64 196, !20, i64 200, !20, i64 204, !20, i64 208, !7, i64 212, !7, i64 218, !7, i64 219, !7, i64 220, !7, i64 221, !7, i64 222, !21, i64 232, !21, i64 248, !21, i64 264, !22, i64 280}
!11 = !{!"_ZTSN4Simd11ImageLoaderE", !12, i64 8, !16, i64 32, !17, i64 72}
!12 = !{!"_ZTSN4Simd16ImageLoaderParamE", !6, i64 0, !13, i64 8, !14, i64 16, !15, i64 20}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTS17SimdImageFileType", !7, i64 0}
!15 = !{!"_ZTS19SimdPixelFormatType", !7, i64 0}
!16 = !{!"_ZTSN4Simd17InputMemoryStreamE", !6, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!17 = !{!"_ZTSN4Simd4ViewINS_9AllocatorEEE", !13, i64 0, !13, i64 8, !13, i64 16, !18, i64 24, !6, i64 32, !19, i64 40}
!18 = !{!"_ZTSN4Simd4ViewINS_9AllocatorEE6FormatE", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !13, i64 8}
!22 = !{!"_ZTSSt6vectorIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!10, !7, i64 221}
!29 = !{!10, !13, i64 240}
!30 = !{!31, !20, i64 0}
!31 = !{!"_ZTSN4Simd4Base14ImagePngLoader5ChunkE", !20, i64 0, !20, i64 4, !20, i64 8}
!32 = !{!13, !13, i64 0}
!33 = !{!7, !7, i64 0}
!34 = !{!10, !6, i64 232}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!10, !20, i64 204}
!38 = !{!10, !19, i64 193}
!39 = distinct !{!39, !36}
!40 = !{!10, !7, i64 218}
!41 = !{!42, !42, i64 0}
!42 = !{!"short", !7, i64 0}
!43 = distinct !{!43, !36}


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

@_ZN4Simd4BaseL15DepthScaleTableE = external hidden local_unnamed_addr constant [9 x i8], align 1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4Simd17InputMemoryStream4SkipEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN4Simd4Base14ImagePngLoader16ReadTransparencyERKNS1_5ChunkE(ptr noundef nonnull align 8 dereferenceable(304) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 192
  %4 = load i8, ptr %3, align 8, !tbaa !5, !range !25, !noundef !26
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %.loopexit, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 280
  %8 = tail call noundef i64 @_ZNKSt6vectorIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #2
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %9, label %.loopexit

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 221
  %11 = load i8, ptr %10, align 1, !tbaa !27
  %.not25 = icmp eq i8 %11, 0
  br i1 %.not25, label %38, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 232
  %14 = getelementptr inbounds i8, ptr %0, i64 240
  %15 = load i64, ptr %14, align 8, !tbaa !28
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %.loopexit, label %17

17:                                               ; preds = %12
  %18 = load i32, ptr %1, align 4, !tbaa !29
  %19 = zext i32 %18 to i64
  %20 = icmp ult i64 %15, %19
  br i1 %20, label %.loopexit, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 32
  %23 = tail call noundef zeroext i1 @_ZNK4Simd17InputMemoryStream7CanReadEm(ptr noundef nonnull align 8 dereferenceable(40) %22, i64 noundef %19)
  br i1 %23, label %24, label %.loopexit

24:                                               ; preds = %21
  store i8 4, ptr %10, align 1, !tbaa !27
  %25 = load i32, ptr %1, align 4, !tbaa !29
  %.not40 = icmp eq i32 %25, 0
  br i1 %.not40, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %24
  %.lcssa = phi i64 [ 0, %24 ], [ %36, %.lr.ph ]
  %26 = tail call noundef zeroext i1 @_ZN4Simd17InputMemoryStream4SkipEm(ptr noundef nonnull align 8 dereferenceable(40) %22, i64 noundef %.lcssa)
  br label %.loopexit

.lr.ph:                                           ; preds = %24, %.lr.ph
  %.02033 = phi i64 [ %34, %.lr.ph ], [ 0, %24 ]
  %27 = tail call noundef ptr @_ZNK4Simd17InputMemoryStream7CurrentEv(ptr noundef nonnull align 8 dereferenceable(40) %22)
  %28 = getelementptr inbounds i8, ptr %27, i64 %.02033
  %29 = load i8, ptr %28, align 1, !tbaa !31
  %30 = load ptr, ptr %13, align 8, !tbaa !32
  %31 = shl nuw nsw i64 %.02033, 2
  %32 = or disjoint i64 %31, 3
  %33 = getelementptr inbounds i8, ptr %30, i64 %32
  store i8 %29, ptr %33, align 1, !tbaa !31
  %34 = add nuw nsw i64 %.02033, 1
  %35 = load i32, ptr %1, align 4, !tbaa !29
  %36 = zext i32 %35 to i64
  %37 = icmp ult i64 %34, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !33

38:                                               ; preds = %9
  %39 = getelementptr inbounds i8, ptr %0, i64 204
  %40 = load i32, ptr %39, align 4, !tbaa !35
  %41 = and i32 %40, 1
  %.not26 = icmp eq i32 %41, 0
  br i1 %.not26, label %.loopexit, label %42

42:                                               ; preds = %38
  %43 = load i32, ptr %1, align 4, !tbaa !29
  %44 = shl i32 %40, 1
  %.not27 = icmp eq i32 %43, %44
  br i1 %.not27, label %.lr.ph36, label %.loopexit

.lr.ph36:                                         ; preds = %42
  %45 = getelementptr inbounds i8, ptr %0, i64 193
  store i8 1, ptr %45, align 1, !tbaa !36
  %46 = getelementptr inbounds i8, ptr %0, i64 32
  %47 = getelementptr inbounds i8, ptr %0, i64 212
  br label %53

48:                                               ; preds = %53
  %49 = add nuw nsw i64 %.01934, 1
  %50 = load i32, ptr %39, align 4, !tbaa !35
  %51 = zext i32 %50 to i64
  %52 = icmp ult i64 %49, %51
  br i1 %52, label %53, label %._crit_edge37, !llvm.loop !37

53:                                               ; preds = %.lr.ph36, %48
  %.01934 = phi i64 [ 0, %.lr.ph36 ], [ %49, %48 ]
  %54 = getelementptr inbounds [3 x i16], ptr %47, i64 0, i64 %.01934
  %55 = tail call noundef zeroext i1 @_ZN4Simd17InputMemoryStream9ReadBe16uERt(ptr noundef nonnull align 8 dereferenceable(40) %46, ptr noundef nonnull align 2 dereferenceable(2) %54)
  br i1 %55, label %48, label %.loopexit

._crit_edge37:                                    ; preds = %48
  %56 = getelementptr inbounds i8, ptr %0, i64 218
  %57 = load i8, ptr %56, align 2, !tbaa !38
  %.not28 = icmp eq i8 %57, 16
  br i1 %.not28, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %._crit_edge37
  %58 = zext i32 %50 to i64
  %.not42 = icmp eq i32 %50, 0
  br i1 %.not42, label %.loopexit, label %.lr.ph39

.lr.ph39:                                         ; preds = %.preheader
  %59 = getelementptr inbounds i8, ptr %0, i64 212
  %60 = zext i8 %57 to i64
  %61 = getelementptr inbounds [9 x i8], ptr @_ZN4Simd4BaseL15DepthScaleTableE, i64 0, i64 %60
  %62 = load i8, ptr %61, align 1, !tbaa !31
  %63 = getelementptr inbounds i8, ptr %0, i64 222
  %min.iters.check = icmp ult i32 %50, 16
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph39
  %scevgep = getelementptr inbounds i8, ptr %0, i64 222
  %scevgep51 = getelementptr i8, ptr %scevgep, i64 %58
  %scevgep52 = getelementptr inbounds i8, ptr %0, i64 212
  %64 = shl nuw nsw i64 %58, 1
  %scevgep53 = getelementptr i8, ptr %scevgep52, i64 %64
  %bound0 = icmp ult ptr %63, %scevgep53
  %bound1 = icmp ult ptr %59, %scevgep51
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %58, 4294967280
  %broadcast.splatinsert = insertelement <8 x i8> poison, i8 %62, i64 0
  %broadcast.splat = shufflevector <8 x i8> %broadcast.splatinsert, <8 x i8> poison, <8 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %65 = getelementptr inbounds [3 x i16], ptr %59, i64 0, i64 %index
  %66 = getelementptr inbounds i8, ptr %65, i64 16
  %wide.load = load <8 x i16>, ptr %65, align 4, !tbaa !39, !alias.scope !41
  %wide.load54 = load <8 x i16>, ptr %66, align 4, !tbaa !39, !alias.scope !41
  %67 = trunc <8 x i16> %wide.load to <8 x i8>
  %68 = trunc <8 x i16> %wide.load54 to <8 x i8>
  %69 = mul <8 x i8> %broadcast.splat, %67
  %70 = mul <8 x i8> %broadcast.splat, %68
  %71 = getelementptr inbounds [3 x i8], ptr %63, i64 0, i64 %index
  %72 = getelementptr inbounds i8, ptr %71, i64 8
  store <8 x i8> %69, ptr %71, align 2, !tbaa !31, !alias.scope !44, !noalias !41
  store <8 x i8> %70, ptr %72, align 2, !tbaa !31, !alias.scope !44, !noalias !41
  %index.next = add nuw i64 %index, 16
  %73 = icmp eq i64 %index.next, %n.vec
  br i1 %73, label %middle.block, label %vector.body, !llvm.loop !46

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %58
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph39
  %.038.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph39 ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %58, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %.038.prol = phi i64 [ %79, %scalar.ph.prol ], [ %.038.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %74 = getelementptr inbounds [3 x i16], ptr %59, i64 0, i64 %.038.prol
  %75 = load i16, ptr %74, align 2, !tbaa !39
  %76 = trunc i16 %75 to i8
  %77 = mul i8 %62, %76
  %78 = getelementptr inbounds [3 x i8], ptr %63, i64 0, i64 %.038.prol
  store i8 %77, ptr %78, align 1, !tbaa !31
  %79 = add nuw nsw i64 %.038.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !49

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %.038.unr = phi i64 [ %.038.ph, %scalar.ph.preheader ], [ %79, %scalar.ph.prol ]
  %80 = sub nsw i64 %.038.ph, %58
  %81 = icmp ugt i64 %80, -4
  br i1 %81, label %.loopexit, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %.038 = phi i64 [ %105, %scalar.ph ], [ %.038.unr, %scalar.ph.prol.loopexit ]
  %82 = getelementptr inbounds [3 x i16], ptr %59, i64 0, i64 %.038
  %83 = load i16, ptr %82, align 2, !tbaa !39
  %84 = trunc i16 %83 to i8
  %85 = mul i8 %62, %84
  %86 = getelementptr inbounds [3 x i8], ptr %63, i64 0, i64 %.038
  store i8 %85, ptr %86, align 1, !tbaa !31
  %87 = add nuw nsw i64 %.038, 1
  %88 = getelementptr inbounds [3 x i16], ptr %59, i64 0, i64 %87
  %89 = load i16, ptr %88, align 2, !tbaa !39
  %90 = trunc i16 %89 to i8
  %91 = mul i8 %62, %90
  %92 = getelementptr inbounds [3 x i8], ptr %63, i64 0, i64 %87
  store i8 %91, ptr %92, align 1, !tbaa !31
  %93 = add nuw nsw i64 %.038, 2
  %94 = getelementptr inbounds [3 x i16], ptr %59, i64 0, i64 %93
  %95 = load i16, ptr %94, align 2, !tbaa !39
  %96 = trunc i16 %95 to i8
  %97 = mul i8 %62, %96
  %98 = getelementptr inbounds [3 x i8], ptr %63, i64 0, i64 %93
  store i8 %97, ptr %98, align 1, !tbaa !31
  %99 = add nuw nsw i64 %.038, 3
  %100 = getelementptr inbounds [3 x i16], ptr %59, i64 0, i64 %99
  %101 = load i16, ptr %100, align 2, !tbaa !39
  %102 = trunc i16 %101 to i8
  %103 = mul i8 %62, %102
  %104 = getelementptr inbounds [3 x i8], ptr %63, i64 0, i64 %99
  store i8 %103, ptr %104, align 1, !tbaa !31
  %105 = add nuw nsw i64 %.038, 4
  %exitcond.not.3 = icmp eq i64 %105, %58
  br i1 %exitcond.not.3, label %.loopexit, label %scalar.ph, !llvm.loop !51

.loopexit:                                        ; preds = %53, %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %.preheader, %._crit_edge, %._crit_edge37, %38, %42, %12, %17, %21, %6, %2
  %.1 = phi i1 [ false, %2 ], [ false, %6 ], [ false, %21 ], [ false, %17 ], [ false, %12 ], [ false, %42 ], [ false, %38 ], [ true, %._crit_edge37 ], [ true, %._crit_edge ], [ true, %.preheader ], [ true, %middle.block ], [ true, %scalar.ph ], [ true, %scalar.ph.prol.loopexit ], [ false, %53 ]
  ret i1 %.1
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4Simd17InputMemoryStream7CanReadEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4Simd17InputMemoryStream7CurrentEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4Simd17InputMemoryStream9ReadBe16uERt(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 2 dereferenceable(2)) local_unnamed_addr #0 align 2

attributes #0 = { alwaysinline 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 #1 = { 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 #2 = { 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, !18, i64 192}
!6 = !{!"_ZTSN4Simd4Base14ImagePngLoaderE", !7, i64 0, !10, i64 120, !9, i64 176, !9, i64 184, !18, i64 192, !18, i64 193, !18, i64 194, !19, i64 196, !19, i64 200, !19, i64 204, !19, i64 208, !10, i64 212, !10, i64 218, !10, i64 219, !10, i64 220, !10, i64 221, !10, i64 222, !20, i64 232, !20, i64 248, !20, i64 264, !21, i64 280}
!7 = !{!"_ZTSN4Simd11ImageLoaderE", !8, i64 8, !15, i64 32, !16, i64 72}
!8 = !{!"_ZTSN4Simd16ImageLoaderParamE", !9, i64 0, !12, i64 8, !13, i64 16, !14, i64 20}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!"_ZTS17SimdImageFileType", !10, i64 0}
!14 = !{!"_ZTS19SimdPixelFormatType", !10, i64 0}
!15 = !{!"_ZTSN4Simd17InputMemoryStreamE", !9, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!16 = !{!"_ZTSN4Simd4ViewINS_9AllocatorEEE", !12, i64 0, !12, i64 8, !12, i64 16, !17, i64 24, !9, i64 32, !18, i64 40}
!17 = !{!"_ZTSN4Simd4ViewINS_9AllocatorEE6FormatE", !10, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{!"int", !10, i64 0}
!20 = !{!"_ZTSN4Simd5ArrayIhEE", !9, i64 0, !12, i64 8}
!21 = !{!"_ZTSSt6vectorIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN4Simd4Base14ImagePngLoader5ChunkESaIS3_EE17_Vector_impl_dataE", !9, i64 0, !9, i64 8, !9, i64 16}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!6, !10, i64 221}
!28 = !{!6, !12, i64 240}
!29 = !{!30, !19, i64 0}
!30 = !{!"_ZTSN4Simd4Base14ImagePngLoader5ChunkE", !19, i64 0, !19, i64 4, !19, i64 8}
!31 = !{!10, !10, i64 0}
!32 = !{!6, !9, i64 232}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!6, !19, i64 204}
!36 = !{!6, !18, i64 193}
!37 = distinct !{!37, !34}
!38 = !{!6, !10, i64 218}
!39 = !{!40, !40, i64 0}
!40 = !{!"short", !10, i64 0}
!41 = !{!42}
!42 = distinct !{!42, !43}
!43 = distinct !{!43, !"LVerDomain"}
!44 = !{!45}
!45 = distinct !{!45, !43}
!46 = distinct !{!46, !34, !47, !48}
!47 = !{!"llvm.loop.isvectorized", i32 1}
!48 = !{!"llvm.loop.unroll.runtime.disable"}
!49 = distinct !{!49, !50}
!50 = !{!"llvm.loop.unroll.disable"}
!51 = distinct !{!51, !34, !47}


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