; LLVM IR from ermig1979/Simd :: src/Simd/SimdBaseImageSavePng.ll (ZN4Simd4Base13ImagePngSaverC2ERKNS_15ImageSaverParamE)

; 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::ImagePngSaver" = type { %"class.Simd::ImageSaver", ptr, [7 x ptr], ptr, i64, i64, %"struct.Simd::Array.0", %"struct.Simd::Array.0", %"struct.Simd::Array.1" }
%"class.Simd::ImageSaver" = type { ptr, %"struct.Simd::ImageSaverParam", %"class.Simd::OutputMemoryStream" }
%"struct.Simd::ImageSaverParam" = type { i64, i64, i32, i32, i32, i32 }
%"class.Simd::OutputMemoryStream" = type { i64, ptr, i64, i64, i64, i64, i64 }
%"struct.Simd::Array.0" = type { ptr, i64 }
%"struct.Simd::Array.1" = type { ptr, i64 }

@_ZTVN4Simd4Base13ImagePngSaverE = external dso_local unnamed_addr constant { [5 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd4Base12ZlibCompressEPhiiRNS_18OutputMemoryStreamE(ptr noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(56)) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine0EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine1EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine2EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine3EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine4EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine5EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine6EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base13ImagePngSaverC2ERKNS_15ImageSaverParamE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4Simd10ImageSaverC2ERKNS_15ImageSaverParamE(ptr noundef nonnull align 8 dereferenceable(96) %7, ptr noundef nonnull align 8 dereferenceable(32) %8)
  store ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr] }, ptr @_ZTVN4Simd4Base13ImagePngSaverE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 1
  store ptr null, ptr %9, align 8, !tbaa !11
  %10 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 4
  store i64 0, ptr %10, align 8, !tbaa !23
  %11 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 5
  store i64 0, ptr %11, align 8, !tbaa !24
  %12 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 6
  invoke void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %12, i64 noundef 0, i1 noundef zeroext false, i64 noundef 8)
          to label %13 unwind label %21

13:                                               ; preds = %2
  %14 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 7
  invoke void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %14, i64 noundef 0, i1 noundef zeroext false, i64 noundef 8)
          to label %15 unwind label %25

15:                                               ; preds = %13
  %16 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 8
  invoke void @_ZN4Simd5ArrayIaEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %16, i64 noundef 0, i1 noundef zeroext false, i64 noundef 8)
          to label %17 unwind label %29

17:                                               ; preds = %15
  %18 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %7, i32 0, i32 1
  %19 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %18, i32 0, i32 2
  %20 = load i32, ptr %19, align 8, !tbaa !25
  switch i32 %20, label %43 [
    i32 1, label %33
    i32 3, label %35
    i32 4, label %37
    i32 16, label %39
    i32 17, label %41
  ]

21:                                               ; preds = %2
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %5, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %6, align 4
  br label %118

25:                                               ; preds = %13
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %5, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %6, align 4
  br label %117

29:                                               ; preds = %15
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %5, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %6, align 4
  br label %116

33:                                               ; preds = %17
  %34 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 4
  store i64 1, ptr %34, align 8, !tbaa !23
  br label %44

35:                                               ; preds = %17
  %36 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 4
  store i64 3, ptr %36, align 8, !tbaa !23
  br label %44

37:                                               ; preds = %17
  %38 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 4
  store i64 4, ptr %38, align 8, !tbaa !23
  br label %44

39:                                               ; preds = %17
  %40 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 4
  store i64 3, ptr %40, align 8, !tbaa !23
  br label %44

41:                                               ; preds = %17
  %42 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 4
  store i64 4, ptr %42, align 8, !tbaa !23
  br label %44

43:                                               ; preds = %17
  br label %44

44:                                               ; preds = %43, %41, %39, %37, %35, %33
  %45 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %7, i32 0, i32 1
  %46 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %45, i32 0, i32 0
  %47 = load i64, ptr %46, align 8, !tbaa !26
  %48 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 4
  %49 = load i64, ptr %48, align 8, !tbaa !23
  %50 = mul i64 %47, %49
  %51 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 5
  store i64 %50, ptr %51, align 8, !tbaa !24
  %52 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %7, i32 0, i32 1
  %53 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %52, i32 0, i32 2
  %54 = load i32, ptr %53, align 8, !tbaa !25
  %55 = icmp eq i32 %54, 3
  br i1 %55, label %56, label %70

56:                                               ; preds = %44
  %57 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 1
  store ptr @_ZN4Simd4Base8BgrToRgbEPKhmmmPhm, ptr %57, align 8, !tbaa !11
  %58 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 7
  %59 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %7, i32 0, i32 1
  %60 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %59, i32 0, i32 1
  %61 = load i64, ptr %60, align 8, !tbaa !27
  %62 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 5
  %63 = load i64, ptr %62, align 8, !tbaa !24
  %64 = mul i64 %61, %63
  invoke void @_ZN4Simd5ArrayIhE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16) %58, i64 noundef %64, i1 noundef zeroext false, i64 noundef 8)
          to label %65 unwind label %66

65:                                               ; preds = %56
  br label %86

66:                                               ; preds = %95, %86, %75, %56
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %5, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %6, align 4
  call void @_ZN4Simd5ArrayIaED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #5
  br label %116

70:                                               ; preds = %44
  %71 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %7, i32 0, i32 1
  %72 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %71, i32 0, i32 2
  %73 = load i32, ptr %72, align 8, !tbaa !25
  %74 = icmp eq i32 %73, 4
  br i1 %74, label %75, label %85

75:                                               ; preds = %70
  %76 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 1
  store ptr @_ZN4Simd4Base10BgraToRgbaEPKhmmmPhm, ptr %76, align 8, !tbaa !11
  %77 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 7
  %78 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %7, i32 0, i32 1
  %79 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %78, i32 0, i32 1
  %80 = load i64, ptr %79, align 8, !tbaa !27
  %81 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 5
  %82 = load i64, ptr %81, align 8, !tbaa !24
  %83 = mul i64 %80, %82
  invoke void @_ZN4Simd5ArrayIhE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16) %77, i64 noundef %83, i1 noundef zeroext false, i64 noundef 8)
          to label %84 unwind label %66

84:                                               ; preds = %75
  br label %85

85:                                               ; preds = %84, %70
  br label %86

86:                                               ; preds = %85, %65
  %87 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 6
  %88 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 5
  %89 = load i64, ptr %88, align 8, !tbaa !24
  %90 = add i64 %89, 1
  %91 = getelementptr inbounds %"class.Simd::ImageSaver", ptr %7, i32 0, i32 1
  %92 = getelementptr inbounds %"struct.Simd::ImageSaverParam", ptr %91, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !27
  %94 = mul i64 %90, %93
  invoke void @_ZN4Simd5ArrayIhE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16) %87, i64 noundef %94, i1 noundef zeroext false, i64 noundef 8)
          to label %95 unwind label %66

95:                                               ; preds = %86
  %96 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 8
  %97 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 5
  %98 = load i64, ptr %97, align 8, !tbaa !24
  %99 = mul i64 %98, 5
  invoke void @_ZN4Simd5ArrayIaE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16) %96, i64 noundef %99, i1 noundef zeroext false, i64 noundef 8)
          to label %100 unwind label %66

100:                                              ; preds = %95
  %101 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 2
  %102 = getelementptr inbounds [7 x ptr], ptr %101, i64 0, i64 0
  store ptr @_ZN4Simd4Base11EncodeLine0EPKhmmmPa, ptr %102, align 8, !tbaa !5
  %103 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 2
  %104 = getelementptr inbounds [7 x ptr], ptr %103, i64 0, i64 1
  store ptr @_ZN4Simd4Base11EncodeLine1EPKhmmmPa, ptr %104, align 8, !tbaa !5
  %105 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 2
  %106 = getelementptr inbounds [7 x ptr], ptr %105, i64 0, i64 2
  store ptr @_ZN4Simd4Base11EncodeLine2EPKhmmmPa, ptr %106, align 8, !tbaa !5
  %107 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 2
  %108 = getelementptr inbounds [7 x ptr], ptr %107, i64 0, i64 3
  store ptr @_ZN4Simd4Base11EncodeLine3EPKhmmmPa, ptr %108, align 8, !tbaa !5
  %109 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 2
  %110 = getelementptr inbounds [7 x ptr], ptr %109, i64 0, i64 4
  store ptr @_ZN4Simd4Base11EncodeLine4EPKhmmmPa, ptr %110, align 8, !tbaa !5
  %111 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 2
  %112 = getelementptr inbounds [7 x ptr], ptr %111, i64 0, i64 5
  store ptr @_ZN4Simd4Base11EncodeLine5EPKhmmmPa, ptr %112, align 8, !tbaa !5
  %113 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 2
  %114 = getelementptr inbounds [7 x ptr], ptr %113, i64 0, i64 6
  store ptr @_ZN4Simd4Base11EncodeLine6EPKhmmmPa, ptr %114, align 8, !tbaa !5
  %115 = getelementptr inbounds %"class.Simd::Base::ImagePngSaver", ptr %7, i32 0, i32 3
  store ptr @_ZN4Simd4Base12ZlibCompressEPhiiRNS_18OutputMemoryStreamE, ptr %115, align 8, !tbaa !28
  ret void

116:                                              ; preds = %66, %29
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #5
  br label %117

117:                                              ; preds = %116, %25
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #5
  br label %118

118:                                              ; preds = %117, %21
  call void @_ZN4Simd10ImageSaverD2Ev(ptr noundef nonnull align 8 dereferenceable(96) %7) #5
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr %5, align 8
  %121 = load i32, ptr %6, align 4
  %122 = insertvalue { ptr, i32 } poison, ptr %120, 0
  %123 = insertvalue { ptr, i32 } %122, i32 %121, 1
  resume { ptr, i32 } %123
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd10ImageSaverC2ERKNS_15ImageSaverParamE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIaEC2Embm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) unnamed_addr #2 align 2

declare void @_ZN4Simd4Base8BgrToRgbEPKhmmmPhm(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #3

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIhE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) #2 align 2

declare void @_ZN4Simd4Base10BgraToRgbaEPKhmmmPhm(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #3

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIaE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd5ArrayIaED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd10ImageSaverD2Ev(ptr noundef nonnull align 8 dereferenceable(96)) unnamed_addr #1 align 2

attributes #0 = { 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 #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 = { alwaysinline 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 = { "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 = { 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 #5 = { 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 96}
!12 = !{!"_ZTSN4Simd4Base13ImagePngSaverE", !13, i64 0, !6, i64 96, !7, i64 104, !6, i64 160, !15, i64 168, !15, i64 176, !21, i64 184, !21, i64 200, !22, i64 216}
!13 = !{!"_ZTSN4Simd10ImageSaverE", !14, i64 8, !20, i64 40}
!14 = !{!"_ZTSN4Simd15ImageSaverParamE", !15, i64 0, !15, i64 8, !16, i64 16, !17, i64 20, !18, i64 24, !19, i64 28}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTS19SimdPixelFormatType", !7, i64 0}
!17 = !{!"_ZTS17SimdImageFileType", !7, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTS11SimdYuvType", !7, i64 0}
!20 = !{!"_ZTSN4Simd18OutputMemoryStreamE", !15, i64 0, !6, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48}
!21 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !15, i64 8}
!22 = !{!"_ZTSN4Simd5ArrayIaEE", !6, i64 0, !15, i64 8}
!23 = !{!12, !15, i64 168}
!24 = !{!12, !15, i64 176}
!25 = !{!13, !16, i64 24}
!26 = !{!13, !15, i64 8}
!27 = !{!13, !15, i64 16}
!28 = !{!12, !6, i64 160}


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

@_ZTVN4Simd4Base13ImagePngSaverE = external dso_local unnamed_addr constant { [5 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd4Base12ZlibCompressEPhiiRNS_18OutputMemoryStreamE(ptr noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(56)) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine0EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine1EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine2EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine3EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine4EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine5EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base11EncodeLine6EPKhmmmPa(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base13ImagePngSaverC2ERKNS_15ImageSaverParamE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN4Simd10ImageSaverC2ERKNS_15ImageSaverParamE(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef nonnull align 8 dereferenceable(32) %1)
  store ptr getelementptr inbounds inrange(-16, 24) (i8, ptr @_ZTVN4Simd4Base13ImagePngSaverE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 96
  store ptr null, ptr %3, align 8, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 168
  %5 = getelementptr inbounds i8, ptr %0, i64 176
  %6 = getelementptr inbounds i8, ptr %0, i64 184
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  invoke void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %6, i64 noundef 0, i1 noundef zeroext false, i64 noundef 8)
          to label %7 unwind label %15

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 200
  invoke void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %8, i64 noundef 0, i1 noundef zeroext false, i64 noundef 8)
          to label %9 unwind label %17

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 216
  invoke void @_ZN4Simd5ArrayIaEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 noundef 0, i1 noundef zeroext false, i64 noundef 8)
          to label %11 unwind label %19

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = load i32, ptr %13, align 8, !tbaa !22
  switch i32 %14, label %32 [
    i32 1, label %.thread
    i32 3, label %.thread10
    i32 4, label %.thread11
    i32 16, label %28
    i32 17, label %29
  ]

15:                                               ; preds = %2
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %58

17:                                               ; preds = %7
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %57

19:                                               ; preds = %9
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %56

.thread10:                                        ; preds = %11
  store i64 3, ptr %4, align 8, !tbaa !23
  %21 = load i64, ptr %12, align 8, !tbaa !24
  %22 = mul i64 %21, 3
  br label %.thread11.invoke

.thread11:                                        ; preds = %11
  store i64 4, ptr %4, align 8, !tbaa !23
  %23 = load i64, ptr %12, align 8, !tbaa !24
  %24 = shl i64 %23, 2
  br label %.thread11.invoke

.thread11.invoke:                                 ; preds = %.thread10, %.thread11
  %.sink16 = phi i64 [ %22, %.thread10 ], [ %24, %.thread11 ]
  %_ZN4Simd4Base8BgrToRgbEPKhmmmPhm.sink = phi ptr [ @_ZN4Simd4Base8BgrToRgbEPKhmmmPhm, %.thread10 ], [ @_ZN4Simd4Base10BgraToRgbaEPKhmmmPhm, %.thread11 ]
  store i64 %.sink16, ptr %5, align 8, !tbaa !25
  store ptr %_ZN4Simd4Base8BgrToRgbEPKhmmmPhm.sink, ptr %3, align 8, !tbaa !8
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  %26 = load i64, ptr %25, align 8, !tbaa !26
  %27 = mul i64 %26, %.sink16
  invoke void @_ZN4Simd5ArrayIhE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16) %8, i64 noundef %27, i1 noundef zeroext false, i64 noundef 8)
          to label %38 unwind label %36

28:                                               ; preds = %11
  br label %.thread

29:                                               ; preds = %11
  br label %.thread

.thread:                                          ; preds = %11, %29, %28
  %.sink = phi i64 [ 4, %29 ], [ 3, %28 ], [ 1, %11 ]
  store i64 %.sink, ptr %4, align 8, !tbaa !23
  %30 = load i64, ptr %12, align 8, !tbaa !24
  %31 = mul i64 %.sink, %30
  br label %.sink.split

32:                                               ; preds = %11
  %33 = load i64, ptr %12, align 8, !tbaa !24
  %34 = load i64, ptr %4, align 8, !tbaa !23
  %35 = mul i64 %34, %33
  br label %.sink.split

36:                                               ; preds = %.thread11.invoke, %44, %38
  %37 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN4Simd5ArrayIaED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  br label %56

.sink.split:                                      ; preds = %.thread, %32
  %.sink12 = phi i64 [ %35, %32 ], [ %31, %.thread ]
  store i64 %.sink12, ptr %5, align 8, !tbaa !25
  br label %38

38:                                               ; preds = %.sink.split, %.thread11.invoke
  %39 = load i64, ptr %5, align 8, !tbaa !25
  %40 = add i64 %39, 1
  %41 = getelementptr inbounds i8, ptr %0, i64 16
  %42 = load i64, ptr %41, align 8, !tbaa !26
  %43 = mul i64 %40, %42
  invoke void @_ZN4Simd5ArrayIhE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16) %6, i64 noundef %43, i1 noundef zeroext false, i64 noundef 8)
          to label %44 unwind label %36

44:                                               ; preds = %38
  %45 = load i64, ptr %5, align 8, !tbaa !25
  %46 = mul i64 %45, 5
  invoke void @_ZN4Simd5ArrayIaE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 noundef %46, i1 noundef zeroext false, i64 noundef 8)
          to label %47 unwind label %36

47:                                               ; preds = %44
  %48 = getelementptr inbounds i8, ptr %0, i64 104
  store ptr @_ZN4Simd4Base11EncodeLine0EPKhmmmPa, ptr %48, align 8, !tbaa !27
  %49 = getelementptr inbounds i8, ptr %0, i64 112
  store ptr @_ZN4Simd4Base11EncodeLine1EPKhmmmPa, ptr %49, align 8, !tbaa !27
  %50 = getelementptr inbounds i8, ptr %0, i64 120
  store ptr @_ZN4Simd4Base11EncodeLine2EPKhmmmPa, ptr %50, align 8, !tbaa !27
  %51 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr @_ZN4Simd4Base11EncodeLine3EPKhmmmPa, ptr %51, align 8, !tbaa !27
  %52 = getelementptr inbounds i8, ptr %0, i64 136
  store ptr @_ZN4Simd4Base11EncodeLine4EPKhmmmPa, ptr %52, align 8, !tbaa !27
  %53 = getelementptr inbounds i8, ptr %0, i64 144
  store ptr @_ZN4Simd4Base11EncodeLine5EPKhmmmPa, ptr %53, align 8, !tbaa !27
  %54 = getelementptr inbounds i8, ptr %0, i64 152
  store ptr @_ZN4Simd4Base11EncodeLine6EPKhmmmPa, ptr %54, align 8, !tbaa !27
  %55 = getelementptr inbounds i8, ptr %0, i64 160
  store ptr @_ZN4Simd4Base12ZlibCompressEPhiiRNS_18OutputMemoryStreamE, ptr %55, align 8, !tbaa !28
  ret void

56:                                               ; preds = %36, %19
  %.pn = phi { ptr, i32 } [ %37, %36 ], [ %20, %19 ]
  tail call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  br label %57

57:                                               ; preds = %56, %17
  %.pn.pn = phi { ptr, i32 } [ %.pn, %56 ], [ %18, %17 ]
  tail call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  br label %58

58:                                               ; preds = %57, %15
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %57 ], [ %16, %15 ]
  tail call void @_ZN4Simd10ImageSaverD2Ev(ptr noundef nonnull align 8 dereferenceable(96) %0) #6
  resume { ptr, i32 } %.pn.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd10ImageSaverC2ERKNS_15ImageSaverParamE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIaEC2Embm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) unnamed_addr #2 align 2

declare void @_ZN4Simd4Base8BgrToRgbEPKhmmmPhm(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #3

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIhE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) local_unnamed_addr #2 align 2

declare void @_ZN4Simd4Base10BgraToRgbaEPKhmmmPhm(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #3

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIaE6ResizeEmbm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd5ArrayIaED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd10ImageSaverD2Ev(ptr noundef nonnull align 8 dereferenceable(96)) unnamed_addr #1 align 2

; 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 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 = { alwaysinline 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 = { "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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !19, i64 96}
!9 = !{!"_ZTSN4Simd4Base13ImagePngSaverE", !10, i64 0, !19, i64 96, !13, i64 104, !19, i64 160, !12, i64 168, !12, i64 176, !20, i64 184, !20, i64 200, !21, i64 216}
!10 = !{!"_ZTSN4Simd10ImageSaverE", !11, i64 8, !18, i64 40}
!11 = !{!"_ZTSN4Simd15ImageSaverParamE", !12, i64 0, !12, i64 8, !14, i64 16, !15, i64 20, !16, i64 24, !17, i64 28}
!12 = !{!"long", !13, i64 0}
!13 = !{!"omnipotent char", !7, i64 0}
!14 = !{!"_ZTS19SimdPixelFormatType", !13, i64 0}
!15 = !{!"_ZTS17SimdImageFileType", !13, i64 0}
!16 = !{!"int", !13, i64 0}
!17 = !{!"_ZTS11SimdYuvType", !13, i64 0}
!18 = !{!"_ZTSN4Simd18OutputMemoryStreamE", !12, i64 0, !19, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48}
!19 = !{!"any pointer", !13, i64 0}
!20 = !{!"_ZTSN4Simd5ArrayIhEE", !19, i64 0, !12, i64 8}
!21 = !{!"_ZTSN4Simd5ArrayIaEE", !19, i64 0, !12, i64 8}
!22 = !{!10, !14, i64 24}
!23 = !{!9, !12, i64 168}
!24 = !{!10, !12, i64 8}
!25 = !{!9, !12, i64 176}
!26 = !{!10, !12, i64 16}
!27 = !{!19, !19, i64 0}
!28 = !{!9, !19, i64 160}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass