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

; 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.anon.68 = type { i8 }
%class.anon.69 = type { i8 }
%class.anon.71 = type { ptr }
%"class.__gnu_cxx::__normal_iterator.40" = type { ptr }
%class.anon.72 = type { i8 }
%"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 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%class.anon.74 = type { i8 }

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIjSt4lessIjESaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #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) #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EE(ptr dead_on_unwind noalias writable sret(%"class.std::vector.33") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %class.anon.68, align 1
  %8 = alloca %class.anon.69, align 1
  %9 = alloca %class.anon.71, align 8
  %10 = alloca %"class.std::vector.33", align 8
  %11 = alloca %"class.std::vector.33", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.__gnu_cxx::__normal_iterator.40", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator.40", align 8
  %16 = alloca %class.anon.72, align 1
  %17 = alloca i1, align 1
  %18 = alloca %"class.std::set", align 8
  %19 = alloca i32, align 4
  %20 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %22 = alloca %"class.__gnu_cxx::__normal_iterator.40", align 8
  %23 = alloca %"class.__gnu_cxx::__normal_iterator.40", align 8
  %24 = alloca %class.anon.74, align 1
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %26 = getelementptr inbounds %class.anon.71, ptr %9, i32 0, i32 0
  store ptr %25, ptr %26, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  call void @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_1clESA_"(ptr dead_on_unwind writable sret(%"class.std::vector.33") align 8 %10, ptr noundef nonnull align 1 dereferenceable(1) %8, ptr noundef nonnull align 8 dereferenceable(24) %27)
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #5
  invoke void @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_0clESA_"(ptr dead_on_unwind writable sret(%"class.std::vector.33") align 8 %11, ptr noundef nonnull align 1 dereferenceable(1) %7, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %28 unwind label %50

28:                                               ; preds = %3
  %29 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EEaSEOS6_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  %30 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  %31 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %14, i32 0, i32 0
  store ptr %30, ptr %31, align 8
  %32 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  %33 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %15, i32 0, i32 0
  store ptr %32, ptr %33, align 8
  %34 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %14, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8
  %36 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %15, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8
  invoke void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS6_SaIS6_EEEEZNK3sfc7Palette18optimized_palettesERKSA_E3$_3EvT_SH_T0_"(ptr %35, ptr %37)
          to label %38 unwind label %54

38:                                               ; preds = %28
  store i1 false, ptr %17, align 1
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %39

39:                                               ; preds = %79, %38
  %40 = call noundef i64 @_ZNKSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  %41 = icmp ne i64 %40, 0
  br i1 %41, label %42, label %81

42:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 48, ptr %18) #5
  invoke void @_ZN3sfc7vec_popISt3setIjSt4lessIjESaIjEEEET_RSt6vectorIS6_SaIS6_EE(ptr dead_on_unwind writable sret(%"class.std::set") align 8 %18, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %43 unwind label %58

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %44 = invoke noundef i32 @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_2clERKS6_SA_"(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(48) %18, ptr noundef nonnull align 8 dereferenceable(24) %0)
          to label %45 unwind label %62

45:                                               ; preds = %43
  store i32 %44, ptr %19, align 4, !tbaa !11
  %46 = load i32, ptr %19, align 4, !tbaa !11
  %47 = icmp eq i32 %46, -1
  br i1 %47, label %48, label %66

48:                                               ; preds = %45
  invoke void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE9push_backERKS4_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %18)
          to label %49 unwind label %62

49:                                               ; preds = %48
  br label %79

50:                                               ; preds = %3
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %12, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  br label %99

54:                                               ; preds = %28
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %12, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %13, align 4
  br label %99

58:                                               ; preds = %42
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %12, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %13, align 4
  br label %80

62:                                               ; preds = %66, %48, %43
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %12, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %18) #5
  br label %80

66:                                               ; preds = %45
  %67 = load i32, ptr %19, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %68) #5
  %70 = call ptr @_ZNKSt3setIjSt4lessIjESaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %18) #5
  %71 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %20, i32 0, i32 0
  store ptr %70, ptr %71, align 8
  %72 = call ptr @_ZNKSt3setIjSt4lessIjESaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %18) #5
  %73 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %72, ptr %73, align 8
  %74 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %20, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8
  %76 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8
  invoke void @_ZNSt3setIjSt4lessIjESaIjEE6insertISt23_Rb_tree_const_iteratorIjEEEvT_S7_(ptr noundef nonnull align 8 dereferenceable(48) %69, ptr %75, ptr %77)
          to label %78 unwind label %62

78:                                               ; preds = %66
  br label %79

79:                                               ; preds = %78, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %18) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #5
  br label %39, !llvm.loop !13

80:                                               ; preds = %62, %58
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #5
  br label %98

81:                                               ; preds = %39
  %82 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %83 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %22, i32 0, i32 0
  store ptr %82, ptr %83, align 8
  %84 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %85 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %23, i32 0, i32 0
  store ptr %84, ptr %85, align 8
  %86 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %22, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8
  %88 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.40", ptr %23, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8
  invoke void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS6_SaIS6_EEEEZNK3sfc7Palette18optimized_palettesERKSA_E3$_4EvT_SH_T0_"(ptr %87, ptr %89)
          to label %90 unwind label %92

90:                                               ; preds = %81
  store i1 true, ptr %17, align 1
  %91 = load i1, ptr %17, align 1
  br i1 %91, label %97, label %96

92:                                               ; preds = %81
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %12, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %13, align 4
  br label %98

96:                                               ; preds = %90
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %97

97:                                               ; preds = %96, %90
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  ret void

98:                                               ; preds = %92, %80
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %99

99:                                               ; preds = %98, %54, %50
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  br label %100

100:                                              ; preds = %99
  %101 = load ptr, ptr %12, align 8
  %102 = load i32, ptr %13, align 4
  %103 = insertvalue { ptr, i32 } poison, ptr %101, 0
  %104 = insertvalue { ptr, i32 } %103, i32 %102, 1
  resume { ptr, i32 } %104
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_1clESA_"(ptr dead_on_unwind noalias writable sret(%"class.std::vector.33") align 8, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_0clESA_"(ptr dead_on_unwind noalias writable sret(%"class.std::vector.33") align 8, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS6_SaIS6_EEEEZNK3sfc7Palette18optimized_palettesERKSA_E3$_3EvT_SH_T0_"(ptr, ptr) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_2clERKS6_SA_"(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS6_SaIS6_EEEEZNK3sfc7Palette18optimized_palettesERKSA_E3$_4EvT_SH_T0_"(ptr, ptr) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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, !6, i64 0}
!10 = !{!"_ZTSZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEE3$_2", !6, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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.anon.68 = type { i8 }
%class.anon.69 = type { i8 }
%class.anon.71 = 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 }

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EE(ptr dead_on_unwind noalias writable sret(%"class.std::vector.33") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.anon.68, align 1
  %5 = alloca %class.anon.69, align 1
  %6 = alloca %class.anon.71, align 8
  %7 = alloca %"class.std::vector.33", align 8
  %8 = alloca %"class.std::vector.33", align 8
  %9 = alloca %"class.std::set", align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  store ptr %1, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_1clESA_"(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.33") align 8 %7, ptr noundef nonnull align 1 dereferenceable(1) %5, ptr noundef nonnull align 8 dereferenceable(24) %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #5
  invoke void @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_0clESA_"(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.33") align 8 %8, ptr noundef nonnull align 1 dereferenceable(1) %4, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %10 unwind label %21

10:                                               ; preds = %3
  %11 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EEaSEOS6_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  %12 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %13 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  invoke void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS6_SaIS6_EEEEZNK3sfc7Palette18optimized_palettesERKSA_E3$_3EvT_SH_T0_"(ptr %12, ptr %13)
          to label %14 unwind label %23

14:                                               ; preds = %10
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %0, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %15 = call noundef i64 @_ZNKSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %.not18 = icmp eq i64 %15, 0
  br i1 %.not18, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %14, %34
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %9) #5
  invoke void @_ZN3sfc7vec_popISt3setIjSt4lessIjESaIjEEEET_RSt6vectorIS6_SaIS6_EE(ptr dead_on_unwind nonnull writable sret(%"class.std::set") align 8 %9, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %16 unwind label %25

16:                                               ; preds = %.lr.ph
  %17 = invoke noundef i32 @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_2clERKS6_SA_"(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(24) %0)
          to label %18 unwind label %27

18:                                               ; preds = %16
  %19 = icmp eq i32 %17, -1
  br i1 %19, label %20, label %29

20:                                               ; preds = %18
  invoke void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE9push_backERKS4_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %9)
          to label %34 unwind label %27

21:                                               ; preds = %3
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  br label %43

23:                                               ; preds = %10
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %43

25:                                               ; preds = %.lr.ph
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %36

27:                                               ; preds = %29, %20, %16
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #5
  br label %36

29:                                               ; preds = %18
  %30 = sext i32 %17 to i64
  %31 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %30) #5
  %32 = call ptr @_ZNKSt3setIjSt4lessIjESaIjEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #5
  %33 = call ptr @_ZNKSt3setIjSt4lessIjESaIjEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #5
  invoke void @_ZNSt3setIjSt4lessIjESaIjEE6insertISt23_Rb_tree_const_iteratorIjEEEvT_S7_(ptr noundef nonnull align 8 dereferenceable(48) %31, ptr %32, ptr %33)
          to label %34 unwind label %27

34:                                               ; preds = %29, %20
  call void @_ZNSt3setIjSt4lessIjESaIjEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #5
  %35 = call noundef i64 @_ZNKSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %.not = icmp eq i64 %35, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10

36:                                               ; preds = %27, %25
  %.pn = phi { ptr, i32 } [ %28, %27 ], [ %26, %25 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #5
  br label %42

._crit_edge:                                      ; preds = %34, %14
  %37 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %38 = call ptr @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  invoke void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS6_SaIS6_EEEEZNK3sfc7Palette18optimized_palettesERKSA_E3$_4EvT_SH_T0_"(ptr %37, ptr %38)
          to label %41 unwind label %39

39:                                               ; preds = %._crit_edge
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %42

41:                                               ; preds = %._crit_edge
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  ret void

42:                                               ; preds = %39, %36
  %.pn.pn = phi { ptr, i32 } [ %.pn, %36 ], [ %40, %39 ]
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %43

43:                                               ; preds = %42, %23, %21
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %42 ], [ %24, %23 ], [ %22, %21 ]
  call void @_ZNSt6vectorISt3setIjSt4lessIjESaIjEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn.pn.pn
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_1clESA_"(ptr dead_on_unwind noalias writable sret(%"class.std::vector.33") align 8, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_0clESA_"(ptr dead_on_unwind noalias writable sret(%"class.std::vector.33") align 8, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS6_SaIS6_EEEEZNK3sfc7Palette18optimized_palettesERKSA_E3$_3EvT_SH_T0_"(ptr, ptr) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @"_ZZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEENK3$_2clERKS6_SA_"(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt3setIjSt4lessIjESaIjEESt6vectorIS6_SaIS6_EEEEZNK3sfc7Palette18optimized_palettesERKSA_E3$_4EvT_SH_T0_"(ptr, ptr) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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, !7, i64 0}
!6 = !{!"_ZTSZNK3sfc7Palette18optimized_palettesERKSt6vectorISt3setIjSt4lessIjESaIjEESaIS6_EEE3$_2", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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