; LLVM IR from Optiroc/SuperFamiconv :: src/Palette.ll (ZN3sfc7Palette10add_imagesESt6vectorINS_5ImageESaIS2_EE)

; 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.std::vector.33" = type { %"struct.std::_Vector_base.34" }
%"struct.std::_Vector_base.34" = type { %"struct.std::_Vector_base<std::set<unsigned int>, std::allocator<std::set<unsigned int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::set<unsigned int>, std::allocator<std::set<unsigned int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::set<unsigned int>, std::allocator<std::set<unsigned int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::set<unsigned int>, std::allocator<std::set<unsigned int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator.38" = type { ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.fmt::v10::basic_format_string.39" = type { %"class.fmt::v10::basic_string_view" }
%"class.fmt::v10::basic_string_view" = type { ptr, i64 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.40" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.__gnu_cxx::__normal_iterator.3" = type { ptr }
%"struct.sfc::Palette" = type <{ i32, i32, i32, [4 x i8], %"class.std::vector.4", i32, i8, [3 x i8] }>
%"class.std::vector.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = type { %"struct.std::_Vector_base<sfc::Subpalette, std::allocator<sfc::Subpalette>>::_Vector_impl" }
%"struct.std::_Vector_base<sfc::Subpalette, std::allocator<sfc::Subpalette>>::_Vector_impl" = type { %"struct.std::_Vector_base<sfc::Subpalette, std::allocator<sfc::Subpalette>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sfc::Subpalette, std::allocator<sfc::Subpalette>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZTISt13runtime_error = external constant ptr
@stderr = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [60 x i8], align 1

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIjSt4lessIjESaIjEE6insertERKj(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3sfc10Subpalette3addERKSt6vectorIjSaIjEEbb(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24), i1 noundef zeroext, i1 noundef zeroext) #4 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPjSt6vectorIjSaIjEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPjSt6vectorIjSaIjEEEEjET_S7_S7_RKT0_(ptr, ptr, ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN3sfc12reduce_colorEjNS_4ModeE(i32 noundef, i32 noundef) #6

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sfc7Palette10add_imagesESt6vectorINS_5ImageESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::vector.33", align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.38", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator.38", align 8
  %9 = alloca ptr, align 8
  %10 = alloca %"class.std::set", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.fmt::v10::basic_format_string.39", align 8
  %14 = alloca i64, align 8
  %15 = alloca %"class.std::set", align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"class.std::set", align 8
  %19 = alloca %"struct.std::pair", align 8
  %20 = alloca %"class.std::set", align 8
  %21 = alloca %"class.std::set", align 8
  %22 = alloca %"class.std::set", align 8
  %23 = alloca %"class.std::vector.33", align 8
  %24 = alloca ptr, align 8
  %25 = alloca %"class.__gnu_cxx::__normal_iterator.40", align 8
  %26 = alloca %"class.__gnu_cxx::__normal_iterator.40", align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca %"class.std::vector", align 8
  %30 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %31 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %32 = alloca %"class.std::allocator", align 1
  %33 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %34 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %35 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %36 = alloca i32, align 4
  %37 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %38 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %39 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %40 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #10
  call void @llvm.memset.p0.i64(ptr align 8 %5, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #10
  store ptr %1, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #10
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = call ptr @_ZNSt6vectorIN3sfc5ImageESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #10
  %43 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.38", ptr %7, i32 0, i32 0
  store ptr %42, ptr %43, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #10
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call ptr @_ZNSt6vectorIN3sfc5ImageESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #10
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.38", ptr %8, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  br label %47

47:                                               ; preds = %158, %2
  %48 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #10
  br i1 %48, label %50, label %49

49:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  br label %161

50:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #10
  %51 = call noundef nonnull align 8 dereferenceable(136) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #10
  store ptr %51, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %10) #10
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind writable sret(%"class.std::set") align 8 %10, ptr noundef nonnull align 8 dereferenceable(136) %52)
          to label %53 unwind label %77

53:                                               ; preds = %50
  %54 = call noundef i64 @_ZNKSt3setIjSt4lessIjESaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %10) #10
  %55 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 2
  %56 = load i32, ptr %55, align 8, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = icmp ugt i64 %54, %57
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #10
  br i1 %58, label %59, label %99

59:                                               ; preds = %53
  %60 = load ptr, ptr @stderr, align 8, !tbaa !5
  invoke void @_ZN3fmt3v1019basic_format_stringIcJmRjjjEEC2IA71_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES9_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 1 dereferenceable(71) @.str.5)
          to label %61 unwind label %81

61:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #10
  call void @llvm.lifetime.start.p0(i64 48, ptr %15) #10
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind writable sret(%"class.std::set") align 8 %15, ptr noundef nonnull align 8 dereferenceable(136) %62)
          to label %63 unwind label %85

63:                                               ; preds = %61
  %64 = call noundef i64 @_ZNKSt3setIjSt4lessIjESaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %15) #10
  store i64 %64, ptr %14, align 8, !tbaa !18
  %65 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #10
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = invoke noundef i32 @_ZNK3sfc5Image11src_coord_xEv(ptr noundef nonnull align 8 dereferenceable(136) %66)
          to label %68 unwind label %89

68:                                               ; preds = %63
  store i32 %67, ptr %16, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #10
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = invoke noundef i32 @_ZNK3sfc5Image11src_coord_yEv(ptr noundef nonnull align 8 dereferenceable(136) %69)
          to label %71 unwind label %93

71:                                               ; preds = %68
  store i32 %70, ptr %17, align 4, !tbaa !20
  %72 = getelementptr inbounds { ptr, i64 }, ptr %13, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8
  %74 = getelementptr inbounds { ptr, i64 }, ptr %13, i32 0, i32 1
  %75 = load i64, ptr %74, align 8
  invoke void @_ZN3fmt3v105printIJmRjjjEEEvP8_IO_FILENS0_19basic_format_stringIcJDpNS0_13type_identityIT_E4typeEEEEDpOS7_(ptr noundef %60, ptr %73, i64 %75, ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %76 unwind label %93

76:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #10
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %15) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #10
  br label %99

77:                                               ; preds = %50
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %11, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #10
  br label %160

81:                                               ; preds = %59
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %11, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %12, align 4
  br label %160

85:                                               ; preds = %61
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %11, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %12, align 4
  br label %98

89:                                               ; preds = %63
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %11, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %12, align 4
  br label %97

93:                                               ; preds = %71, %68
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %11, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #10
  br label %97

97:                                               ; preds = %93, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #10
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %15) #10
  br label %98

98:                                               ; preds = %97, %85
  call void @llvm.lifetime.end.p0(i64 48, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #10
  br label %160

99:                                               ; preds = %76, %53
  %100 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 6
  %101 = load i8, ptr %100, align 4, !tbaa !21, !range !22, !noundef !23
  %102 = trunc i8 %101 to i1
  br i1 %102, label %103, label %136

103:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 48, ptr %18) #10
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind writable sret(%"class.std::set") align 8 %18, ptr noundef nonnull align 8 dereferenceable(136) %104)
          to label %105 unwind label %117

105:                                              ; preds = %103
  %106 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 5
  %107 = invoke { ptr, i8 } @_ZNSt3setIjSt4lessIjESaIjEE6insertERKj(ptr noundef nonnull align 8 dereferenceable(48) %18, ptr noundef nonnull align 4 dereferenceable(4) %106)
          to label %108 unwind label %121

108:                                              ; preds = %105
  %109 = getelementptr inbounds { ptr, i8 }, ptr %19, i32 0, i32 0
  %110 = extractvalue { ptr, i8 } %107, 0
  store ptr %110, ptr %109, align 8
  %111 = getelementptr inbounds { ptr, i8 }, ptr %19, i32 0, i32 1
  %112 = extractvalue { ptr, i8 } %107, 1
  store i8 %112, ptr %111, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr %20) #10
  %113 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 0
  %114 = load i32, ptr %113, align 8, !tbaa !24
  invoke void @_ZN3sfc13reduce_colorsERKSt3setIjSt4lessIjESaIjEENS_4ModeE(ptr dead_on_unwind writable sret(%"class.std::set") align 8 %20, ptr noundef nonnull align 8 dereferenceable(48) %18, i32 noundef %114)
          to label %115 unwind label %125

115:                                              ; preds = %108
  invoke void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(48) %20)
          to label %116 unwind label %129

116:                                              ; preds = %115
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %20) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr %20) #10
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %18) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #10
  br label %157

117:                                              ; preds = %103
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %11, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %12, align 4
  br label %135

121:                                              ; preds = %105
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %11, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %12, align 4
  br label %134

125:                                              ; preds = %108
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %11, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %12, align 4
  br label %133

129:                                              ; preds = %115
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %11, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %12, align 4
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %20) #10
  br label %133

133:                                              ; preds = %129, %125
  call void @llvm.lifetime.end.p0(i64 48, ptr %20) #10
  br label %134

134:                                              ; preds = %133, %121
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %18) #10
  br label %135

135:                                              ; preds = %134, %117
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #10
  br label %160

136:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 48, ptr %21) #10
  call void @llvm.lifetime.start.p0(i64 48, ptr %22) #10
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind writable sret(%"class.std::set") align 8 %22, ptr noundef nonnull align 8 dereferenceable(136) %137)
          to label %138 unwind label %143

138:                                              ; preds = %136
  %139 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 0
  %140 = load i32, ptr %139, align 8, !tbaa !24
  invoke void @_ZN3sfc13reduce_colorsERKSt3setIjSt4lessIjESaIjEENS_4ModeE(ptr dead_on_unwind writable sret(%"class.std::set") align 8 %21, ptr noundef nonnull align 8 dereferenceable(48) %22, i32 noundef %140)
          to label %141 unwind label %147

141:                                              ; preds = %138
  invoke void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(48) %21)
          to label %142 unwind label %151

142:                                              ; preds = %141
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %21) #10
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %22) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr %21) #10
  br label %157

143:                                              ; preds = %136
  %144 = landingpad { ptr, i32 }
          cleanup
  %145 = extractvalue { ptr, i32 } %144, 0
  store ptr %145, ptr %11, align 8
  %146 = extractvalue { ptr, i32 } %144, 1
  store i32 %146, ptr %12, align 4
  br label %156

147:                                              ; preds = %138
  %148 = landingpad { ptr, i32 }
          cleanup
  %149 = extractvalue { ptr, i32 } %148, 0
  store ptr %149, ptr %11, align 8
  %150 = extractvalue { ptr, i32 } %148, 1
  store i32 %150, ptr %12, align 4
  br label %155

151:                                              ; preds = %141
  %152 = landingpad { ptr, i32 }
          cleanup
  %153 = extractvalue { ptr, i32 } %152, 0
  store ptr %153, ptr %11, align 8
  %154 = extractvalue { ptr, i32 } %152, 1
  store i32 %154, ptr %12, align 4
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %21) #10
  br label %155

155:                                              ; preds = %151, %147
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %22) #10
  br label %156

156:                                              ; preds = %155, %143
  call void @llvm.lifetime.end.p0(i64 48, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr %21) #10
  br label %160

157:                                              ; preds = %142, %116
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  br label %158

158:                                              ; preds = %157
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #10
  br label %47

160:                                              ; preds = %156, %135, %98, %81, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  br label %273

161:                                              ; preds = %49
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #10
  invoke void @_ZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EE(ptr dead_on_unwind writable sret(%"class.std::vector.33") align 8 %23, ptr noundef nonnull align 8 dereferenceable(48) %40, ptr noundef nonnull align 8 dereferenceable(24) %5)
          to label %162 unwind label %171

162:                                              ; preds = %161
  %163 = call noundef i64 @_ZNKSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #10
  %164 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 1
  %165 = load i32, ptr %164, align 4, !tbaa !25
  %166 = zext i32 %165 to i64
  %167 = icmp ugt i64 %163, %166
  br i1 %167, label %168, label %183

168:                                              ; preds = %162
  %169 = call ptr @__cxa_allocate_exception(i64 16) #10
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %169, ptr noundef @.str.6)
          to label %170 unwind label %175

170:                                              ; preds = %168
  invoke void @__cxa_throw(ptr %169, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #11
          to label %279 unwind label %179

171:                                              ; preds = %161
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %11, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %12, align 4
  br label %272

175:                                              ; preds = %168
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %11, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %12, align 4
  call void @__cxa_free_exception(ptr %169) #10
  br label %271

179:                                              ; preds = %170
  %180 = landingpad { ptr, i32 }
          cleanup
  %181 = extractvalue { ptr, i32 } %180, 0
  store ptr %181, ptr %11, align 8
  %182 = extractvalue { ptr, i32 } %180, 1
  store i32 %182, ptr %12, align 4
  br label %271

183:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #10
  store ptr %23, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #10
  %184 = load ptr, ptr %24, align 8, !tbaa !5
  %185 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %184) #10
  %186 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %25, i32 0, i32 0
  store ptr %185, ptr %186, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #10
  %187 = load ptr, ptr %24, align 8, !tbaa !5
  %188 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %187) #10
  %189 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %26, i32 0, i32 0
  store ptr %188, ptr %189, align 8
  br label %190

190:                                              ; preds = %261, %183
  %191 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 8 dereferenceable(8) %26) #10
  br i1 %191, label %193, label %192

192:                                              ; preds = %190
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #10
  br label %270

193:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #10
  %194 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %25) #10
  store ptr %194, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #10
  %195 = invoke noundef nonnull align 8 dereferenceable(80) ptr @_ZN3sfc7Palette14add_subpaletteEv(ptr noundef nonnull align 8 dereferenceable(48) %40)
          to label %196 unwind label %240

196:                                              ; preds = %193
  store ptr %195, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %29) #10
  %197 = load ptr, ptr %27, align 8, !tbaa !5
  %198 = call ptr @_ZNKSt3setIjSt4lessIjESaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %197) #10
  %199 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %30, i32 0, i32 0
  store ptr %198, ptr %199, align 8
  %200 = load ptr, ptr %27, align 8, !tbaa !5
  %201 = call ptr @_ZNKSt3setIjSt4lessIjESaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %200) #10
  %202 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %31, i32 0, i32 0
  store ptr %201, ptr %202, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %32) #10
  call void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %32) #10
  %203 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %30, i32 0, i32 0
  %204 = load ptr, ptr %203, align 8
  %205 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %31, i32 0, i32 0
  %206 = load ptr, ptr %205, align 8
  invoke void @_ZNSt6vectorIjSaIjEEC2ISt23_Rb_tree_const_iteratorIjEvEET_S5_RKS0_(ptr noundef nonnull align 8 dereferenceable(24) %29, ptr %204, ptr %206, ptr noundef nonnull align 1 dereferenceable(1) %32)
          to label %207 unwind label %244

207:                                              ; preds = %196
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %32) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %32) #10
  %208 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 6
  %209 = load i8, ptr %208, align 4, !tbaa !21, !range !22, !noundef !23
  %210 = trunc i8 %209 to i1
  br i1 %210, label %211, label %258

211:                                              ; preds = %207
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #10
  %212 = call ptr @_ZNSt6vectorIjSaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #10
  %213 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %34, i32 0, i32 0
  store ptr %212, ptr %213, align 8
  %214 = call ptr @_ZNSt6vectorIjSaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #10
  %215 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %35, i32 0, i32 0
  store ptr %214, ptr %215, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #10
  %216 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 5
  %217 = load i32, ptr %216, align 8, !tbaa !26
  %218 = getelementptr inbounds %"struct.sfc::Palette", ptr %40, i32 0, i32 0
  %219 = load i32, ptr %218, align 8, !tbaa !24
  %220 = invoke noundef i32 @_ZN3sfc12reduce_colorEjNS_4ModeE(i32 noundef %217, i32 noundef %219)
          to label %221 unwind label %248

221:                                              ; preds = %211
  store i32 %220, ptr %36, align 4, !tbaa !20
  %222 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %34, i32 0, i32 0
  %223 = load ptr, ptr %222, align 8
  %224 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %35, i32 0, i32 0
  %225 = load ptr, ptr %224, align 8
  %226 = invoke ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPjSt6vectorIjSaIjEEEEjET_S7_S7_RKT0_(ptr %223, ptr %225, ptr noundef nonnull align 4 dereferenceable(4) %36)
          to label %227 unwind label %248

227:                                              ; preds = %221
  %228 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %33, i32 0, i32 0
  store ptr %226, ptr %228, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #10
  %229 = call ptr @_ZNSt6vectorIjSaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #10
  %230 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %37, i32 0, i32 0
  store ptr %229, ptr %230, align 8
  %231 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPjSt6vectorIjSaIjEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %33, ptr noundef nonnull align 8 dereferenceable(8) %37) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #10
  br i1 %231, label %232, label %256

232:                                              ; preds = %227
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %38, ptr align 8 %33, i64 8, i1 false), !tbaa.struct !27
  %233 = call ptr @_ZNSt6vectorIjSaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #10
  %234 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %39, i32 0, i32 0
  store ptr %233, ptr %234, align 8
  %235 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %38, i32 0, i32 0
  %236 = load ptr, ptr %235, align 8
  %237 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.3", ptr %39, i32 0, i32 0
  %238 = load ptr, ptr %237, align 8
  invoke void @_ZSt9iter_swapIN9__gnu_cxx17__normal_iteratorIPjSt6vectorIjSaIjEEEES6_EvT_T0_(ptr %236, ptr %238)
          to label %239 unwind label %252

239:                                              ; preds = %232
  br label %256

240:                                              ; preds = %193
  %241 = landingpad { ptr, i32 }
          cleanup
  %242 = extractvalue { ptr, i32 } %241, 0
  store ptr %242, ptr %11, align 8
  %243 = extractvalue { ptr, i32 } %241, 1
  store i32 %243, ptr %12, align 4
  br label %269

244:                                              ; preds = %196
  %245 = landingpad { ptr, i32 }
          cleanup
  %246 = extractvalue { ptr, i32 } %245, 0
  store ptr %246, ptr %11, align 8
  %247 = extractvalue { ptr, i32 } %245, 1
  store i32 %247, ptr %12, align 4
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %32) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %32) #10
  br label %268

248:                                              ; preds = %221, %211
  %249 = landingpad { ptr, i32 }
          cleanup
  %250 = extractvalue { ptr, i32 } %249, 0
  store ptr %250, ptr %11, align 8
  %251 = extractvalue { ptr, i32 } %249, 1
  store i32 %251, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #10
  br label %257

252:                                              ; preds = %232
  %253 = landingpad { ptr, i32 }
          cleanup
  %254 = extractvalue { ptr, i32 } %253, 0
  store ptr %254, ptr %11, align 8
  %255 = extractvalue { ptr, i32 } %253, 1
  store i32 %255, ptr %12, align 4
  br label %257

256:                                              ; preds = %239, %227
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #10
  br label %258

257:                                              ; preds = %252, %248
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #10
  br label %267

258:                                              ; preds = %256, %207
  %259 = load ptr, ptr %28, align 8, !tbaa !5
  invoke void @_ZN3sfc10Subpalette3addERKSt6vectorIjSaIjEEbb(ptr noundef nonnull align 8 dereferenceable(80) %259, ptr noundef nonnull align 8 dereferenceable(24) %29, i1 noundef zeroext false, i1 noundef zeroext false)
          to label %260 unwind label %263

260:                                              ; preds = %258
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %29) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %29) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #10
  br label %261

261:                                              ; preds = %260
  %262 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %25) #10
  br label %190

263:                                              ; preds = %258
  %264 = landingpad { ptr, i32 }
          cleanup
  %265 = extractvalue { ptr, i32 } %264, 0
  store ptr %265, ptr %11, align 8
  %266 = extractvalue { ptr, i32 } %264, 1
  store i32 %266, ptr %12, align 4
  br label %267

267:                                              ; preds = %263, %257
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %29) #10
  br label %268

268:                                              ; preds = %267, %244
  call void @llvm.lifetime.end.p0(i64 24, ptr %29) #10
  br label %269

269:                                              ; preds = %268, %240
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #10
  br label %271

270:                                              ; preds = %192
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %23) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #10
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #10
  ret void

271:                                              ; preds = %269, %179, %175
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %23) #10
  br label %272

272:                                              ; preds = %271, %171
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #10
  br label %273

273:                                              ; preds = %272, %160
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #10
  br label %274

274:                                              ; preds = %273
  %275 = load ptr, ptr %11, align 8
  %276 = load i32, ptr %12, align 4
  %277 = insertvalue { ptr, i32 } poison, ptr %275, 0
  %278 = insertvalue { ptr, i32 } %277, i32 %276, 1
  resume { ptr, i32 } %278

279:                                              ; preds = %170
  unreachable
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind noalias writable sret(%"class.std::set") align 8, ptr noundef nonnull align 8 dereferenceable(136)) #4 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN3fmt3v105printIJmRjjjEEEvP8_IO_FILENS0_19basic_format_stringIcJDpNS0_13type_identityIT_E4typeEEEEDpOS7_(ptr noundef, ptr, i64, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #8

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN3fmt3v1019basic_format_stringIcJmRjjjEEC2IA71_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES9_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(71)) unnamed_addr #8 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3sfc5Image11src_coord_xEv(ptr noundef nonnull align 8 dereferenceable(136)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3sfc5Image11src_coord_yEv(ptr noundef nonnull align 8 dereferenceable(136)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(48)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3sfc13reduce_colorsERKSt3setIjSt4lessIjESaIjEENS_4ModeE(ptr dead_on_unwind noalias writable sret(%"class.std::set") align 8, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #6

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EE(ptr dead_on_unwind noalias writable sret(%"class.std::vector.33") align 8, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZN3sfc7Palette14add_subpaletteEv(ptr noundef nonnull align 8 dereferenceable(48)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEEC2ISt23_Rb_tree_const_iteratorIjEvEET_S5_RKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr, ptr, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt9iter_swapIN9__gnu_cxx17__normal_iteratorIPjSt6vectorIjSaIjEEEES6_EvT_T0_(ptr, ptr) #5

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #9

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

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

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

attributes #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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { inlinehint 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 = { inlinehint 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 #9 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { nounwind }
attributes #11 = { noreturn }

!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, !12, i64 8}
!10 = !{!"_ZTSN3sfc7PaletteE", !11, i64 0, !12, i64 4, !12, i64 8, !13, i64 16, !12, i64 40, !17, i64 44}
!11 = !{!"_ZTSN3sfc4ModeE", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSSt6vectorIN3sfc10SubpaletteESaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIN3sfc10SubpaletteESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIN3sfc10SubpaletteESaIS1_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN3sfc10SubpaletteESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"bool", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!12, !12, i64 0}
!21 = !{!10, !17, i64 44}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!10, !11, i64 0}
!25 = !{!10, !12, i64 4}
!26 = !{!10, !12, i64 40}
!27 = !{i64 0, i64 8, !5}


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

%"class.std::vector.33" = type { %"struct.std::_Vector_base.34" }
%"struct.std::_Vector_base.34" = type { %"struct.std::_Vector_base<std::set<unsigned int>, std::allocator<std::set<unsigned int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::set<unsigned int>, std::allocator<std::set<unsigned int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::set<unsigned int>, std::allocator<std::set<unsigned int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::set<unsigned int>, std::allocator<std::set<unsigned int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator.38" = type { ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.fmt::v10::basic_format_string.39" = type { %"class.fmt::v10::basic_string_view" }
%"class.fmt::v10::basic_string_view" = type { ptr, i64 }
%"class.__gnu_cxx::__normal_iterator.40" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.__gnu_cxx::__normal_iterator.3" = type { ptr }

@_ZTISt13runtime_error = external constant ptr
@stderr = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [60 x i8], align 1

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIjSt4lessIjESaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIjSt4lessIjESaIjEE6insertERKj(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3sfc10Subpalette3addERKSt6vectorIjSaIjEEbb(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(24), i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIjSt4lessIjESaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPjSt6vectorIjSaIjEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPjSt6vectorIjSaIjEEEEjET_S7_S7_RKT0_(ptr, ptr, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN3sfc12reduce_colorEjNS_4ModeE(i32 noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sfc7Palette10add_imagesESt6vectorINS_5ImageESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector.33", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator.38", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator.38", align 8
  %6 = alloca %"class.std::set", align 8
  %7 = alloca %"class.fmt::v10::basic_format_string.39", align 8
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::set", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::set", align 8
  %13 = alloca %"class.std::set", align 8
  %14 = alloca %"class.std::set", align 8
  %15 = alloca %"class.std::set", align 8
  %16 = alloca %"class.std::vector.33", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator.40", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator.40", align 8
  %19 = alloca %"class.std::vector", align 8
  %20 = alloca %"class.std::allocator", align 1
  %21 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  %22 = alloca i32, align 4
  %23 = alloca %"class.__gnu_cxx::__normal_iterator.3", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %24 = call ptr @_ZNSt6vectorIN3sfc5ImageESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #9
  store ptr %24, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %25 = call ptr @_ZNSt6vectorIN3sfc5ImageESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #9
  store ptr %25, ptr %5, align 8
  %26 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #9
  br i1 %26, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %27 = getelementptr inbounds i8, ptr %0, i64 8
  %28 = getelementptr inbounds i8, ptr %7, i64 8
  %29 = getelementptr inbounds i8, ptr %0, i64 44
  %30 = getelementptr inbounds i8, ptr %0, i64 40
  br label %31

._crit_edge:                                      ; preds = %91, %2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %16) #9
  invoke void @_ZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EE(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.33") align 8 %16, ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %95 unwind label %104

31:                                               ; preds = %.lr.ph, %91
  %32 = call noundef nonnull align 8 dereferenceable(136) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #9
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #9
  invoke void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind nonnull writable sret(%"class.std::set") align 8 %6, ptr noundef nonnull align 8 dereferenceable(136) %32)
          to label %33 unwind label %48

33:                                               ; preds = %31
  %34 = call noundef i64 @_ZNKSt3setIjSt4lessIjESaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #9
  %35 = load i32, ptr %27, align 8, !tbaa !5
  %36 = zext i32 %35 to i64
  %37 = icmp ugt i64 %34, %36
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #9
  br i1 %37, label %38, label %57

38:                                               ; preds = %33
  %39 = load ptr, ptr @stderr, align 8, !tbaa !17
  invoke void @_ZN3fmt3v1019basic_format_stringIcJmRjjjEEC2IA71_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES9_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 1 dereferenceable(71) @.str.5)
          to label %40 unwind label %50

40:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %9) #9
  invoke void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind nonnull writable sret(%"class.std::set") align 8 %9, ptr noundef nonnull align 8 dereferenceable(136) %32)
          to label %41 unwind label %52

41:                                               ; preds = %40
  %42 = call noundef i64 @_ZNKSt3setIjSt4lessIjESaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #9
  store i64 %42, ptr %8, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #9
  %43 = call noundef i32 @_ZNK3sfc5Image11src_coord_xEv(ptr noundef nonnull align 8 dereferenceable(136) %32)
  store i32 %43, ptr %10, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #9
  %44 = call noundef i32 @_ZNK3sfc5Image11src_coord_yEv(ptr noundef nonnull align 8 dereferenceable(136) %32)
  store i32 %44, ptr %11, align 4, !tbaa !20
  %45 = load ptr, ptr %7, align 8
  %46 = load i64, ptr %28, align 8
  invoke void @_ZN3fmt3v105printIJmRjjjEEEvP8_IO_FILENS0_19basic_format_stringIcJDpNS0_13type_identityIT_E4typeEEEEDpOS7_(ptr noundef %39, ptr %45, i64 %46, ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %27, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %47 unwind label %54

47:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #9
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  br label %57

48:                                               ; preds = %31
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #9
  br label %94

50:                                               ; preds = %38
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %94

52:                                               ; preds = %40
  %53 = landingpad { ptr, i32 }
          cleanup
  br label %56

54:                                               ; preds = %41
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #9
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #9
  br label %56

56:                                               ; preds = %54, %52
  %.pn40 = phi { ptr, i32 } [ %55, %54 ], [ %53, %52 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  br label %94

57:                                               ; preds = %47, %33
  %58 = load i8, ptr %29, align 4, !tbaa !21, !range !22, !noundef !23
  %59 = trunc nuw i8 %58 to i1
  br i1 %59, label %60, label %78

60:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %12) #9
  invoke void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind nonnull writable sret(%"class.std::set") align 8 %12, ptr noundef nonnull align 8 dereferenceable(136) %32)
          to label %61 unwind label %67

61:                                               ; preds = %60
  %62 = invoke { ptr, i8 } @_ZNSt3setIjSt4lessIjESaIjEE6insertERKj(ptr noundef nonnull align 8 dereferenceable(48) %12, ptr noundef nonnull align 4 dereferenceable(4) %30)
          to label %63 unwind label %69

63:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %13) #9
  %64 = load i32, ptr %0, align 8, !tbaa !24
  invoke void @_ZN3sfc13reduce_colorsERKSt3setIjSt4lessIjESaIjEENS_4ModeE(ptr dead_on_unwind nonnull writable sret(%"class.std::set") align 8 %13, ptr noundef nonnull align 8 dereferenceable(48) %12, i32 noundef %64)
          to label %65 unwind label %71

65:                                               ; preds = %63
  invoke void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(48) %13)
          to label %66 unwind label %73

66:                                               ; preds = %65
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %13) #9
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %12) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %12) #9
  br label %91

67:                                               ; preds = %60
  %68 = landingpad { ptr, i32 }
          cleanup
  br label %77

69:                                               ; preds = %61
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %76

71:                                               ; preds = %63
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %75

73:                                               ; preds = %65
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #9
  br label %75

75:                                               ; preds = %73, %71
  %.pn45 = phi { ptr, i32 } [ %74, %73 ], [ %72, %71 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %13) #9
  br label %76

76:                                               ; preds = %75, %69
  %.pn45.pn = phi { ptr, i32 } [ %.pn45, %75 ], [ %70, %69 ]
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %12) #9
  br label %77

77:                                               ; preds = %76, %67
  %.pn45.pn.pn = phi { ptr, i32 } [ %.pn45.pn, %76 ], [ %68, %67 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %12) #9
  br label %94

78:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %14) #9
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %15) #9
  invoke void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind nonnull writable sret(%"class.std::set") align 8 %15, ptr noundef nonnull align 8 dereferenceable(136) %32)
          to label %79 unwind label %83

79:                                               ; preds = %78
  %80 = load i32, ptr %0, align 8, !tbaa !24
  invoke void @_ZN3sfc13reduce_colorsERKSt3setIjSt4lessIjESaIjEENS_4ModeE(ptr dead_on_unwind nonnull writable sret(%"class.std::set") align 8 %14, ptr noundef nonnull align 8 dereferenceable(48) %15, i32 noundef %80)
          to label %81 unwind label %85

81:                                               ; preds = %79
  invoke void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(48) %14)
          to label %82 unwind label %87

82:                                               ; preds = %81
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #9
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %15) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %15) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %14) #9
  br label %91

83:                                               ; preds = %78
  %84 = landingpad { ptr, i32 }
          cleanup
  br label %90

85:                                               ; preds = %79
  %86 = landingpad { ptr, i32 }
          cleanup
  br label %89

87:                                               ; preds = %81
  %88 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #9
  br label %89

89:                                               ; preds = %87, %85
  %.pn42 = phi { ptr, i32 } [ %88, %87 ], [ %86, %85 ]
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %15) #9
  br label %90

90:                                               ; preds = %89, %83
  %.pn42.pn = phi { ptr, i32 } [ %.pn42, %89 ], [ %84, %83 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %15) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %14) #9
  br label %94

91:                                               ; preds = %82, %66
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #9
  %93 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #9
  br i1 %93, label %31, label %._crit_edge

94:                                               ; preds = %90, %77, %56, %50, %48
  %.pn45.pn.pn.pn = phi { ptr, i32 } [ %.pn45.pn.pn, %77 ], [ %.pn42.pn, %90 ], [ %.pn40, %56 ], [ %51, %50 ], [ %49, %48 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  br label %156

95:                                               ; preds = %._crit_edge
  %96 = call noundef i64 @_ZNKSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #9
  %97 = getelementptr inbounds i8, ptr %0, i64 4
  %98 = load i32, ptr %97, align 4, !tbaa !25
  %99 = zext i32 %98 to i64
  %100 = icmp ugt i64 %96, %99
  br i1 %100, label %101, label %110

101:                                              ; preds = %95
  %102 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %102, ptr noundef nonnull @.str.6)
          to label %103 unwind label %106

103:                                              ; preds = %101
  invoke void @__cxa_throw(ptr nonnull %102, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #10
          to label %157 unwind label %108

104:                                              ; preds = %._crit_edge
  %105 = landingpad { ptr, i32 }
          cleanup
  br label %155

106:                                              ; preds = %101
  %107 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %102) #9
  br label %154

108:                                              ; preds = %103
  %109 = landingpad { ptr, i32 }
          cleanup
  br label %154

110:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #9
  %111 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #9
  store ptr %111, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #9
  %112 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #9
  store ptr %112, ptr %18, align 8
  %113 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #9
  br i1 %113, label %.lr.ph52, label %._crit_edge53

.lr.ph52:                                         ; preds = %110
  %114 = getelementptr inbounds i8, ptr %0, i64 44
  %115 = getelementptr inbounds i8, ptr %0, i64 40
  br label %116

._crit_edge53:                                    ; preds = %146, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #9
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #9
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #9
  ret void

116:                                              ; preds = %.lr.ph52, %146
  %117 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  %118 = invoke noundef nonnull align 8 dereferenceable(80) ptr @_ZN3sfc7Palette14add_subpaletteEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
          to label %119 unwind label %138

119:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %19) #9
  %120 = call ptr @_ZNKSt3setIjSt4lessIjESaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %117) #9
  %121 = call ptr @_ZNKSt3setIjSt4lessIjESaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %117) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %20) #9
  call void @_ZNSaIjEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %20) #9
  invoke void @_ZNSt6vectorIjSaIjEEC2ISt23_Rb_tree_const_iteratorIjEvEET_S5_RKS0_(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr %120, ptr %121, ptr noundef nonnull align 1 dereferenceable(1) %20)
          to label %122 unwind label %140

122:                                              ; preds = %119
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %20) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %20) #9
  %123 = load i8, ptr %114, align 4, !tbaa !21, !range !22, !noundef !23
  %124 = trunc nuw i8 %123 to i1
  br i1 %124, label %125, label %145

125:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %21) #9
  %126 = call ptr @_ZNSt6vectorIjSaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  %127 = call ptr @_ZNSt6vectorIjSaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %22) #9
  %128 = load i32, ptr %115, align 8, !tbaa !26
  %129 = load i32, ptr %0, align 8, !tbaa !24
  %130 = invoke noundef i32 @_ZN3sfc12reduce_colorEjNS_4ModeE(i32 noundef %128, i32 noundef %129)
          to label %131 unwind label %142

131:                                              ; preds = %125
  store i32 %130, ptr %22, align 4, !tbaa !20
  %132 = invoke ptr @_ZSt4findIN9__gnu_cxx17__normal_iteratorIPjSt6vectorIjSaIjEEEEjET_S7_S7_RKT0_(ptr %126, ptr %127, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %133 unwind label %142

133:                                              ; preds = %131
  store ptr %132, ptr %21, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %22) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %23) #9
  %134 = call ptr @_ZNSt6vectorIjSaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  store ptr %134, ptr %23, align 8
  %135 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPjSt6vectorIjSaIjEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %23) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %23) #9
  br i1 %135, label %136, label %144

136:                                              ; preds = %133
  %.sroa.01.0.copyload = load ptr, ptr %21, align 8, !tbaa !17
  %137 = call ptr @_ZNSt6vectorIjSaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  call void @_ZSt9iter_swapIN9__gnu_cxx17__normal_iteratorIPjSt6vectorIjSaIjEEEES6_EvT_T0_(ptr %.sroa.01.0.copyload, ptr %137)
  br label %144

138:                                              ; preds = %116
  %139 = landingpad { ptr, i32 }
          cleanup
  br label %153

140:                                              ; preds = %119
  %141 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIjED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %20) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %20) #9
  br label %152

142:                                              ; preds = %131, %125
  %143 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %22) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %21) #9
  br label %151

144:                                              ; preds = %136, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %21) #9
  br label %145

145:                                              ; preds = %144, %122
  invoke void @_ZN3sfc10Subpalette3addERKSt6vectorIjSaIjEEbb(ptr noundef nonnull align 8 dereferenceable(80) %118, ptr noundef nonnull align 8 dereferenceable(24) %19, i1 noundef zeroext false, i1 noundef zeroext false)
          to label %146 unwind label %149

146:                                              ; preds = %145
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %19) #9
  %147 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  %148 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #9
  br i1 %148, label %116, label %._crit_edge53

149:                                              ; preds = %145
  %150 = landingpad { ptr, i32 }
          cleanup
  br label %151

151:                                              ; preds = %149, %142
  %.pn = phi { ptr, i32 } [ %150, %149 ], [ %143, %142 ]
  call void @_ZNSt6vectorIjSaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %19) #9
  br label %152

152:                                              ; preds = %151, %140
  %.pn.pn = phi { ptr, i32 } [ %.pn, %151 ], [ %141, %140 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %19) #9
  br label %153

153:                                              ; preds = %152, %138
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %152 ], [ %139, %138 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #9
  br label %154

154:                                              ; preds = %153, %108, %106
  %.pn37 = phi { ptr, i32 } [ %109, %108 ], [ %107, %106 ], [ %.pn.pn.pn, %153 ]
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #9
  br label %155

155:                                              ; preds = %154, %104
  %.pn37.pn = phi { ptr, i32 } [ %.pn37, %154 ], [ %105, %104 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #9
  br label %156

156:                                              ; preds = %155, %94
  %.pn45.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn45.pn.pn.pn, %94 ], [ %.pn37.pn, %155 ]
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #9
  resume { ptr, i32 } %.pn45.pn.pn.pn.pn

157:                                              ; preds = %103
  unreachable
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(136) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN3sfc5ImageESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3sfc5Image6colorsEv(ptr dead_on_unwind noalias writable sret(%"class.std::set") align 8, ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN3fmt3v105printIJmRjjjEEEvP8_IO_FILENS0_19basic_format_stringIcJDpNS0_13type_identityIT_E4typeEEEEDpOS7_(ptr noundef, ptr, i64, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #8

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN3fmt3v1019basic_format_stringIcJmRjjjEEC2IA71_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES9_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(71)) unnamed_addr #8 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3sfc5Image11src_coord_xEv(ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3sfc5Image11src_coord_yEv(ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3sfc13reduce_colorsERKSt3setIjSt4lessIjESaIjEENS_4ModeE(ptr dead_on_unwind noalias writable sret(%"class.std::set") align 8, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #6

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EE(ptr dead_on_unwind noalias writable sret(%"class.std::vector.33") align 8, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS5_SaIS5_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZN3sfc7Palette14add_subpaletteEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEEC2ISt23_Rb_tree_const_iteratorIjEvEET_S5_RKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr, ptr, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt9iter_swapIN9__gnu_cxx17__normal_iteratorIPjSt6vectorIjSaIjEEEES6_EvT_T0_(ptr, ptr) local_unnamed_addr #5

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

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

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

attributes #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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { inlinehint 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 = { inlinehint 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 #9 = { nounwind }
attributes #10 = { noreturn }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 8}
!6 = !{!"_ZTSN3sfc7PaletteE", !7, i64 0, !10, i64 4, !10, i64 8, !11, i64 16, !10, i64 40, !16, i64 44}
!7 = !{!"_ZTSN3sfc4ModeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSSt6vectorIN3sfc10SubpaletteESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIN3sfc10SubpaletteESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN3sfc10SubpaletteESaIS1_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN3sfc10SubpaletteESaIS1_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"bool", !8, i64 0}
!17 = !{!15, !15, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !8, i64 0}
!20 = !{!10, !10, i64 0}
!21 = !{!6, !16, i64 44}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!6, !7, i64 0}
!25 = !{!6, !10, i64 4}
!26 = !{!6, !10, i64 40}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass