; LLVM IR from Optiroc/SuperFamiconv :: src/Map.ll (ZN3sfc3Map3addERKNS_5ImageERKNS_7TilesetERKNS_7PaletteEjjj)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.sfc::Tile" = type { i32, i32, i32, i32, %"class.std::vector.0", %"class.std::vector.5", %"class.std::vector.10" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = 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::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<const sfc::Subpalette *, std::allocator<const sfc::Subpalette *>>::_Vector_impl" }
%"struct.std::_Vector_base<const sfc::Subpalette *, std::allocator<const sfc::Subpalette *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const sfc::Subpalette *, std::allocator<const sfc::Subpalette *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const sfc::Subpalette *, std::allocator<const sfc::Subpalette *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.sfc::Image" = type { i32, i32, i32, i32, %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.10", %"class.std::set" }
%"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" = type { %"class.fmt::v10::basic_string_view" }
%"class.fmt::v10::basic_string_view" = type { ptr, i64 }
%"struct.sfc::Mapentry" = type <{ i32, i32, i8, i8, [2 x i8] }>
%"struct.sfc::TileFlipped" = type { i8, i8 }
%"struct.sfc::Map" = type { i32, i32, i32, i32, i32, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<sfc::Mapentry, std::allocator<sfc::Mapentry>>::_Vector_impl" }
%"struct.std::_Vector_base<sfc::Mapentry, std::allocator<sfc::Mapentry>>::_Vector_impl" = type { %"struct.std::_Vector_base<sfc::Mapentry, std::allocator<sfc::Mapentry>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sfc::Mapentry, std::allocator<sfc::Mapentry>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@_ZTISt13runtime_error = external constant ptr
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [59 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sfc3Map3addERKNS_5ImageERKNS_7TilesetERKNS_7PaletteEjjj(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(136) %1, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) #0 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"struct.sfc::Tile", align 8
  %20 = alloca %"class.std::vector.15", align 8
  %21 = alloca ptr, align 8
  %22 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %23 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca %"struct.sfc::Image", align 8
  %27 = alloca %"struct.sfc::Tile", align 8
  %28 = alloca %"class.fmt::v10::basic_format_string", align 8
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca %"struct.sfc::Mapentry", align 4
  %32 = alloca %"class.fmt::v10::basic_format_string", align 8
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca %"struct.sfc::Mapentry", align 4
  %36 = alloca %"struct.sfc::TileFlipped", align 1
  %37 = alloca %"struct.sfc::Mapentry", align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !9
  store i32 %6, ptr %14, align 4, !tbaa !9
  %38 = load ptr, ptr %8, align 8
  %39 = load i32, ptr %14, align 4, !tbaa !9
  %40 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 1
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = mul i32 %39, %41
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = add i32 %42, %43
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 5
  %47 = call noundef i64 @_ZNKSt6vectorIN3sfc8MapentryESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %46) #9
  %48 = icmp ugt i64 %45, %47
  br i1 %48, label %49, label %56

49:                                               ; preds = %7
  %50 = call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %50, ptr noundef @.str)
          to label %51 unwind label %52

51:                                               ; preds = %49
  call void @__cxa_throw(ptr %50, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #10
  unreachable

52:                                               ; preds = %49
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %15, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %16, align 4
  call void @__cxa_free_exception(ptr %50) #9
  br label %248

56:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 -1, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  store i32 -1, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 88, ptr %19) #9
  call void @_ZN3sfc4TileC2Ev(ptr noundef nonnull align 8 dereferenceable(88) %19)
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #9
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZNK3sfc7Palette20subpalettes_matchingERKNS_5ImageE(ptr dead_on_unwind writable sret(%"class.std::vector.15") align 8 %20, ptr noundef nonnull align 8 dereferenceable(48) %57, ptr noundef nonnull align 8 dereferenceable(136) %58)
          to label %59 unwind label %69

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #9
  store ptr %20, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #9
  %60 = load ptr, ptr %21, align 8, !tbaa !5
  %61 = call ptr @_ZNKSt6vectorIPKN3sfc10SubpaletteESaIS3_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #9
  %62 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  store ptr %61, ptr %62, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #9
  %63 = load ptr, ptr %21, align 8, !tbaa !5
  %64 = call ptr @_ZNKSt6vectorIPKN3sfc10SubpaletteESaIS3_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %63) #9
  %65 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %23, i32 0, i32 0
  store ptr %64, ptr %65, align 8
  br label %66

66:                                               ; preds = %115, %59
  %67 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %23) #9
  br i1 %67, label %73, label %68

68:                                               ; preds = %66
  store i32 2, ptr %24, align 4
  br label %119

69:                                               ; preds = %56
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %15, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %16, align 4
  br label %147

73:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #9
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %22) #9
  store ptr %74, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 136, ptr %26) #9
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = load ptr, ptr %25, align 8, !tbaa !5
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  invoke void @_ZN3sfc5ImageC1ERKS0_RKNS_10SubpaletteE(ptr noundef nonnull align 8 dereferenceable(136) %26, ptr noundef nonnull align 8 dereferenceable(136) %75, ptr noundef nonnull align 8 dereferenceable(80) %77)
          to label %78 unwind label %96

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 88, ptr %27) #9
  %79 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 0
  %80 = load i32, ptr %79, align 8, !tbaa !18
  %81 = load i32, ptr %12, align 4, !tbaa !9
  invoke void @_ZN3sfc4TileC1ERKNS_5ImageENS_4ModeEjb(ptr noundef nonnull align 8 dereferenceable(88) %27, ptr noundef nonnull align 8 dereferenceable(136) %26, i32 noundef %80, i32 noundef %81, i1 noundef zeroext true)
          to label %82 unwind label %100

82:                                               ; preds = %78
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = invoke noundef i32 @_ZNK3sfc7Tileset8index_ofERKNS_4TileE(ptr noundef nonnull align 8 dereferenceable(56) %83, ptr noundef nonnull align 8 dereferenceable(88) %27)
          to label %85 unwind label %104

85:                                               ; preds = %82
  store i32 %84, ptr %17, align 4, !tbaa !9
  %86 = load i32, ptr %17, align 4, !tbaa !9
  %87 = icmp ne i32 %86, -1
  br i1 %87, label %88, label %108

88:                                               ; preds = %85
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = load ptr, ptr %25, align 8, !tbaa !5
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = invoke noundef i32 @_ZNK3sfc7Palette8index_ofERKNS_10SubpaletteE(ptr noundef nonnull align 8 dereferenceable(48) %89, ptr noundef nonnull align 8 dereferenceable(80) %91)
          to label %93 unwind label %104

93:                                               ; preds = %88
  store i32 %92, ptr %18, align 4, !tbaa !9
  %94 = invoke noundef nonnull align 8 dereferenceable(88) ptr @_ZN3sfc4TileaSERKS0_(ptr noundef nonnull align 8 dereferenceable(88) %19, ptr noundef nonnull align 8 dereferenceable(88) %27)
          to label %95 unwind label %104

95:                                               ; preds = %93
  store i32 2, ptr %24, align 4
  br label %109

96:                                               ; preds = %73
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %15, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %16, align 4
  br label %118

100:                                              ; preds = %78
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %15, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %16, align 4
  br label %117

104:                                              ; preds = %93, %88, %82
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %15, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %16, align 4
  call void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %27) #9
  br label %117

108:                                              ; preds = %85
  store i32 0, ptr %24, align 4
  br label %109

109:                                              ; preds = %108, %95
  call void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %27) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr %27) #9
  call void @_ZN3sfc5ImageD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %26) #9
  call void @llvm.lifetime.end.p0(i64 136, ptr %26) #9
  %110 = load i32, ptr %24, align 4
  switch i32 %110, label %112 [
    i32 0, label %111
  ]

111:                                              ; preds = %109
  store i32 0, ptr %24, align 4
  br label %112

112:                                              ; preds = %111, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  %113 = load i32, ptr %24, align 4
  switch i32 %113, label %119 [
    i32 0, label %114
  ]

114:                                              ; preds = %112
  br label %115

115:                                              ; preds = %114
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %22) #9
  br label %66

117:                                              ; preds = %104, %100
  call void @llvm.lifetime.end.p0(i64 88, ptr %27) #9
  call void @_ZN3sfc5ImageD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %26) #9
  br label %118

118:                                              ; preds = %117, %96
  call void @llvm.lifetime.end.p0(i64 136, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  call void @_ZNSt6vectorIPKN3sfc10SubpaletteESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #9
  br label %147

119:                                              ; preds = %112, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  br label %120

120:                                              ; preds = %119
  call void @_ZNSt6vectorIPKN3sfc10SubpaletteESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #9
  %121 = load i32, ptr %17, align 4, !tbaa !9
  %122 = icmp eq i32 %121, -1
  br i1 %122, label %123, label %165

123:                                              ; preds = %120
  %124 = load ptr, ptr @stderr, align 8, !tbaa !5
  invoke void @_ZN3fmt3v1019basic_format_stringIcJjjEEC2IA39_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES8_(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 1 dereferenceable(39) @.str.1)
          to label %125 unwind label %148

125:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #9
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = invoke noundef i32 @_ZNK3sfc5Image11src_coord_xEv(ptr noundef nonnull align 8 dereferenceable(136) %126)
          to label %128 unwind label %152

128:                                              ; preds = %125
  store i32 %127, ptr %29, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #9
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  %130 = invoke noundef i32 @_ZNK3sfc5Image11src_coord_yEv(ptr noundef nonnull align 8 dereferenceable(136) %129)
          to label %131 unwind label %156

131:                                              ; preds = %128
  store i32 %130, ptr %30, align 4, !tbaa !9
  %132 = getelementptr inbounds { ptr, i64 }, ptr %28, i32 0, i32 0
  %133 = load ptr, ptr %132, align 8
  %134 = getelementptr inbounds { ptr, i64 }, ptr %28, i32 0, i32 1
  %135 = load i64, ptr %134, align 8
  invoke void @_ZN3fmt3v105printIJjjEEEvP8_IO_FILENS0_19basic_format_stringIcJDpNS0_13type_identityIT_E4typeEEEEDpOS6_(ptr noundef %124, ptr %133, i64 %135, ptr noundef nonnull align 4 dereferenceable(4) %29, ptr noundef nonnull align 4 dereferenceable(4) %30)
          to label %136 unwind label %156

136:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  call void @llvm.lifetime.start.p0(i64 12, ptr %31) #9
  invoke void @_ZN3sfc8MapentryC2Ejjbb(ptr noundef nonnull align 4 dereferenceable(12) %31, i32 noundef 0, i32 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false)
          to label %137 unwind label %161

137:                                              ; preds = %136
  %138 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 5
  %139 = load i32, ptr %14, align 4, !tbaa !9
  %140 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 1
  %141 = load i32, ptr %140, align 4, !tbaa !11
  %142 = mul i32 %139, %141
  %143 = load i32, ptr %13, align 4, !tbaa !9
  %144 = add i32 %142, %143
  %145 = zext i32 %144 to i64
  %146 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3sfc8MapentryESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %138, i64 noundef %145) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %146, ptr align 4 %31, i64 10, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 12, ptr %31) #9
  br label %246

147:                                              ; preds = %118, %69
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #9
  br label %247

148:                                              ; preds = %172, %165, %123
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %15, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %16, align 4
  br label %247

152:                                              ; preds = %125
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %15, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %16, align 4
  br label %160

156:                                              ; preds = %131, %128
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %15, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #9
  br label %160

160:                                              ; preds = %156, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  br label %247

161:                                              ; preds = %136
  %162 = landingpad { ptr, i32 }
          cleanup
  %163 = extractvalue { ptr, i32 } %162, 0
  store ptr %163, ptr %15, align 8
  %164 = extractvalue { ptr, i32 } %162, 1
  store i32 %164, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %31) #9
  br label %247

165:                                              ; preds = %120
  %166 = load i32, ptr %17, align 4, !tbaa !9
  %167 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 0
  %168 = load i32, ptr %167, align 8, !tbaa !18
  %169 = invoke noundef i32 @_ZN3sfc23max_tile_count_for_modeENS_4ModeE(i32 noundef %168)
          to label %170 unwind label %148

170:                                              ; preds = %165
  %171 = icmp sge i32 %166, %169
  br i1 %171, label %172, label %209

172:                                              ; preds = %170
  %173 = load ptr, ptr @stderr, align 8, !tbaa !5
  invoke void @_ZN3fmt3v1019basic_format_stringIcJjjEEC2IA59_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES8_(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 1 dereferenceable(59) @.str.2)
          to label %174 unwind label %148

174:                                              ; preds = %172
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #9
  %175 = load ptr, ptr %9, align 8, !tbaa !5
  %176 = invoke noundef i32 @_ZNK3sfc5Image11src_coord_xEv(ptr noundef nonnull align 8 dereferenceable(136) %175)
          to label %177 unwind label %196

177:                                              ; preds = %174
  store i32 %176, ptr %33, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #9
  %178 = load ptr, ptr %9, align 8, !tbaa !5
  %179 = invoke noundef i32 @_ZNK3sfc5Image11src_coord_yEv(ptr noundef nonnull align 8 dereferenceable(136) %178)
          to label %180 unwind label %200

180:                                              ; preds = %177
  store i32 %179, ptr %34, align 4, !tbaa !9
  %181 = getelementptr inbounds { ptr, i64 }, ptr %32, i32 0, i32 0
  %182 = load ptr, ptr %181, align 8
  %183 = getelementptr inbounds { ptr, i64 }, ptr %32, i32 0, i32 1
  %184 = load i64, ptr %183, align 8
  invoke void @_ZN3fmt3v105printIJjjEEEvP8_IO_FILENS0_19basic_format_stringIcJDpNS0_13type_identityIT_E4typeEEEEDpOS6_(ptr noundef %173, ptr %182, i64 %184, ptr noundef nonnull align 4 dereferenceable(4) %33, ptr noundef nonnull align 4 dereferenceable(4) %34)
          to label %185 unwind label %200

185:                                              ; preds = %180
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #9
  call void @llvm.lifetime.start.p0(i64 12, ptr %35) #9
  invoke void @_ZN3sfc8MapentryC2Ejjbb(ptr noundef nonnull align 4 dereferenceable(12) %35, i32 noundef 0, i32 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false)
          to label %186 unwind label %205

186:                                              ; preds = %185
  %187 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 5
  %188 = load i32, ptr %14, align 4, !tbaa !9
  %189 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 1
  %190 = load i32, ptr %189, align 4, !tbaa !11
  %191 = mul i32 %188, %190
  %192 = load i32, ptr %13, align 4, !tbaa !9
  %193 = add i32 %191, %192
  %194 = zext i32 %193 to i64
  %195 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3sfc8MapentryESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %187, i64 noundef %194) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %195, ptr align 4 %35, i64 10, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 12, ptr %35) #9
  br label %245

196:                                              ; preds = %174
  %197 = landingpad { ptr, i32 }
          cleanup
  %198 = extractvalue { ptr, i32 } %197, 0
  store ptr %198, ptr %15, align 8
  %199 = extractvalue { ptr, i32 } %197, 1
  store i32 %199, ptr %16, align 4
  br label %204

200:                                              ; preds = %180, %177
  %201 = landingpad { ptr, i32 }
          cleanup
  %202 = extractvalue { ptr, i32 } %201, 0
  store ptr %202, ptr %15, align 8
  %203 = extractvalue { ptr, i32 } %201, 1
  store i32 %203, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #9
  br label %204

204:                                              ; preds = %200, %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #9
  br label %247

205:                                              ; preds = %185
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %15, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %35) #9
  br label %247

209:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 2, ptr %36) #9
  %210 = load ptr, ptr %10, align 8, !tbaa !5
  %211 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3sfc7Tileset5tilesEv(ptr noundef nonnull align 8 dereferenceable(56) %210)
          to label %212 unwind label %236

212:                                              ; preds = %209
  %213 = load i32, ptr %17, align 4, !tbaa !9
  %214 = sext i32 %213 to i64
  %215 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNKSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %211, i64 noundef %214) #9
  %216 = invoke i16 @_ZNK3sfc4Tile10is_flippedERKS0_(ptr noundef nonnull align 8 dereferenceable(88) %215, ptr noundef nonnull align 8 dereferenceable(88) %19)
          to label %217 unwind label %236

217:                                              ; preds = %212
  store i16 %216, ptr %36, align 1
  call void @llvm.lifetime.start.p0(i64 12, ptr %37) #9
  %218 = load i32, ptr %17, align 4, !tbaa !9
  %219 = load i32, ptr %18, align 4, !tbaa !9
  %220 = getelementptr inbounds %"struct.sfc::TileFlipped", ptr %36, i32 0, i32 0
  %221 = load i8, ptr %220, align 1, !tbaa !22, !range !24, !noundef !25
  %222 = trunc i8 %221 to i1
  %223 = getelementptr inbounds %"struct.sfc::TileFlipped", ptr %36, i32 0, i32 1
  %224 = load i8, ptr %223, align 1, !tbaa !26, !range !24, !noundef !25
  %225 = trunc i8 %224 to i1
  invoke void @_ZN3sfc8MapentryC2Ejjbb(ptr noundef nonnull align 4 dereferenceable(12) %37, i32 noundef %218, i32 noundef %219, i1 noundef zeroext %222, i1 noundef zeroext %225)
          to label %226 unwind label %240

226:                                              ; preds = %217
  %227 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 5
  %228 = load i32, ptr %14, align 4, !tbaa !9
  %229 = getelementptr inbounds %"struct.sfc::Map", ptr %38, i32 0, i32 1
  %230 = load i32, ptr %229, align 4, !tbaa !11
  %231 = mul i32 %228, %230
  %232 = load i32, ptr %13, align 4, !tbaa !9
  %233 = add i32 %231, %232
  %234 = zext i32 %233 to i64
  %235 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3sfc8MapentryESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %227, i64 noundef %234) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %235, ptr align 4 %37, i64 10, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 12, ptr %37) #9
  call void @llvm.lifetime.end.p0(i64 2, ptr %36) #9
  br label %245

236:                                              ; preds = %212, %209
  %237 = landingpad { ptr, i32 }
          cleanup
  %238 = extractvalue { ptr, i32 } %237, 0
  store ptr %238, ptr %15, align 8
  %239 = extractvalue { ptr, i32 } %237, 1
  store i32 %239, ptr %16, align 4
  br label %244

240:                                              ; preds = %217
  %241 = landingpad { ptr, i32 }
          cleanup
  %242 = extractvalue { ptr, i32 } %241, 0
  store ptr %242, ptr %15, align 8
  %243 = extractvalue { ptr, i32 } %241, 1
  store i32 %243, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %37) #9
  br label %244

244:                                              ; preds = %240, %236
  call void @llvm.lifetime.end.p0(i64 2, ptr %36) #9
  br label %247

245:                                              ; preds = %226, %186
  br label %246

246:                                              ; preds = %245, %137
  call void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %19) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  ret void

247:                                              ; preds = %244, %205, %204, %161, %160, %148, %147
  call void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %19) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %248

248:                                              ; preds = %247, %52
  %249 = load ptr, ptr %15, align 8
  %250 = load i32, ptr %16, align 4
  %251 = insertvalue { ptr, i32 } poison, ptr %249, 0
  %252 = insertvalue { ptr, i32 } %251, i32 %250, 1
  resume { ptr, i32 } %252
}

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

declare ptr @__cxa_allocate_exception(i64)

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

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 #3

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) #4

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

declare void @_ZNK3sfc7Palette20subpalettes_matchingERKNS_5ImageE(ptr dead_on_unwind writable sret(%"class.std::vector.15") align 8, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(136)) #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_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(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

declare void @_ZN3sfc5ImageC1ERKS0_RKNS_10SubpaletteE(ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #2

declare void @_ZN3sfc4TileC1ERKNS_5ImageENS_4ModeEjb(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(136), i32 noundef, i32 noundef, i1 noundef zeroext) unnamed_addr #2

declare noundef i32 @_ZNK3sfc7Tileset8index_ofERKNS_4TileE(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(88)) #2

declare noundef i32 @_ZNK3sfc7Palette8index_ofERKNS_10SubpaletteE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(80)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZN3sfc4TileaSERKS0_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3sfc5ImageD2Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #5 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3sfc8MapentryC2Ejjbb(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) unnamed_addr #1 align 2

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

; 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) #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3sfc23max_tile_count_for_modeENS_4ModeE(i32 noundef) #1

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

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

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

declare i16 @_ZNK3sfc4Tile10is_flippedERKS0_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 4}
!12 = !{!"_ZTSN3sfc3MapE", !13, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !14, i64 24}
!13 = !{!"_ZTSN3sfc4ModeE", !7, i64 0}
!14 = !{!"_ZTSSt6vectorIN3sfc8MapentryESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIN3sfc8MapentryESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN3sfc8MapentryESaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN3sfc8MapentryESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!12, !13, i64 0}
!19 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 1, !20, i64 9, i64 1, !20}
!20 = !{!21, !21, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!23, !21, i64 0}
!23 = !{!"_ZTSN3sfc11TileFlippedE", !21, i64 0, !21, i64 1}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!23, !21, i64 1}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.sfc::Tile" = type { i32, i32, i32, i32, %"class.std::vector.0", %"class.std::vector.5", %"class.std::vector.10" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = 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::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<const sfc::Subpalette *, std::allocator<const sfc::Subpalette *>>::_Vector_impl" }
%"struct.std::_Vector_base<const sfc::Subpalette *, std::allocator<const sfc::Subpalette *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const sfc::Subpalette *, std::allocator<const sfc::Subpalette *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const sfc::Subpalette *, std::allocator<const sfc::Subpalette *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.sfc::Image" = type { i32, i32, i32, i32, %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.10", %"class.std::set" }
%"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" = type { %"class.fmt::v10::basic_string_view" }
%"class.fmt::v10::basic_string_view" = type { ptr, i64 }
%"struct.sfc::Mapentry" = type <{ i32, i32, i8, i8, [2 x i8] }>

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@_ZTISt13runtime_error = external constant ptr
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [59 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sfc3Map3addERKNS_5ImageERKNS_7TilesetERKNS_7PaletteEjjj(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(136) %1, ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca %"struct.sfc::Tile", align 8
  %9 = alloca %"class.std::vector.15", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %"struct.sfc::Image", align 8
  %13 = alloca %"struct.sfc::Tile", align 8
  %14 = alloca %"class.fmt::v10::basic_format_string", align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"struct.sfc::Mapentry", align 4
  %18 = alloca %"class.fmt::v10::basic_format_string", align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"struct.sfc::Mapentry", align 4
  %22 = alloca %"struct.sfc::Mapentry", align 4
  %23 = getelementptr inbounds i8, ptr %0, i64 4
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = mul i32 %24, %6
  %26 = add i32 %25, %5
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds i8, ptr %0, i64 24
  %29 = tail call noundef i64 @_ZNKSt6vectorIN3sfc8MapentryESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #9
  %30 = icmp ult i64 %29, %27
  br i1 %30, label %31, label %36

31:                                               ; preds = %7
  %32 = tail call ptr @__cxa_allocate_exception(i64 16) #9
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull @.str)
          to label %33 unwind label %34

33:                                               ; preds = %31
  tail call void @__cxa_throw(ptr nonnull %32, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #10
  unreachable

34:                                               ; preds = %31
  %35 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %32) #9
  br label %122

36:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %8) #9
  call void @_ZN3sfc4TileC2Ev(ptr noundef nonnull align 8 dereferenceable(88) %8)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #9
  invoke void @_ZNK3sfc7Palette20subpalettes_matchingERKNS_5ImageE(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.15") align 8 %9, ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(136) %1)
          to label %37 unwind label %41

37:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #9
  %38 = call ptr @_ZNKSt6vectorIPKN3sfc10SubpaletteESaIS3_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #9
  store ptr %38, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #9
  %39 = call ptr @_ZNKSt6vectorIPKN3sfc10SubpaletteESaIS3_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #9
  store ptr %39, ptr %11, align 8
  %40 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  br i1 %40, label %.lr.ph, label %._crit_edge

41:                                               ; preds = %36
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %80

.lr.ph:                                           ; preds = %37, %62
  %.04255 = phi i32 [ %.143, %62 ], [ -1, %37 ]
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  call void @llvm.lifetime.start.p0(i64 136, ptr nonnull %12) #9
  %44 = load ptr, ptr %43, align 8, !tbaa !16
  invoke void @_ZN3sfc5ImageC1ERKS0_RKNS_10SubpaletteE(ptr noundef nonnull align 8 dereferenceable(136) %12, ptr noundef nonnull align 8 dereferenceable(136) %1, ptr noundef nonnull align 8 dereferenceable(80) %44)
          to label %45 unwind label %55

45:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %13) #9
  %46 = load i32, ptr %0, align 8, !tbaa !17
  invoke void @_ZN3sfc4TileC1ERKNS_5ImageENS_4ModeEjb(ptr noundef nonnull align 8 dereferenceable(88) %13, ptr noundef nonnull align 8 dereferenceable(136) %12, i32 noundef %46, i32 noundef %4, i1 noundef zeroext true)
          to label %47 unwind label %57

47:                                               ; preds = %45
  %48 = invoke noundef i32 @_ZNK3sfc7Tileset8index_ofERKNS_4TileE(ptr noundef nonnull align 8 dereferenceable(56) %2, ptr noundef nonnull align 8 dereferenceable(88) %13)
          to label %49 unwind label %59

49:                                               ; preds = %47
  %.not = icmp eq i32 %48, -1
  br i1 %.not, label %61, label %50

50:                                               ; preds = %49
  %51 = load ptr, ptr %43, align 8, !tbaa !16
  %52 = invoke noundef i32 @_ZNK3sfc7Palette8index_ofERKNS_10SubpaletteE(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(80) %51)
          to label %53 unwind label %59

53:                                               ; preds = %50
  %54 = invoke noundef nonnull align 8 dereferenceable(88) ptr @_ZN3sfc4TileaSERKS0_(ptr noundef nonnull align 8 dereferenceable(88) %8, ptr noundef nonnull align 8 dereferenceable(88) %13)
          to label %61 unwind label %59

55:                                               ; preds = %.lr.ph
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %66

57:                                               ; preds = %45
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %65

59:                                               ; preds = %53, %50, %47
  %60 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %13) #9
  br label %65

61:                                               ; preds = %49, %53
  %.143 = phi i32 [ %52, %53 ], [ %.04255, %49 ]
  call void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %13) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %13) #9
  call void @_ZN3sfc5ImageD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %12) #9
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %12) #9
  br i1 %.not, label %62, label %85

62:                                               ; preds = %61
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  %64 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  br i1 %64, label %.lr.ph, label %._crit_edge

65:                                               ; preds = %59, %57
  %.pn = phi { ptr, i32 } [ %60, %59 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %13) #9
  call void @_ZN3sfc5ImageD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %12) #9
  br label %66

66:                                               ; preds = %65, %55
  %.pn.pn = phi { ptr, i32 } [ %.pn, %65 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #9
  call void @_ZNSt6vectorIPKN3sfc10SubpaletteESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #9
  br label %80

._crit_edge:                                      ; preds = %62, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #9
  call void @_ZNSt6vectorIPKN3sfc10SubpaletteESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #9
  %67 = load ptr, ptr @stderr, align 8, !tbaa !16
  invoke void @_ZN3fmt3v1019basic_format_stringIcJjjEEC2IA39_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES8_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 1 dereferenceable(39) @.str.1)
          to label %68 unwind label %81

68:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #9
  %69 = call noundef i32 @_ZNK3sfc5Image11src_coord_xEv(ptr noundef nonnull align 8 dereferenceable(136) %1)
  store i32 %69, ptr %15, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #9
  %70 = call noundef i32 @_ZNK3sfc5Image11src_coord_yEv(ptr noundef nonnull align 8 dereferenceable(136) %1)
  store i32 %70, ptr %16, align 4, !tbaa !18
  %71 = load ptr, ptr %14, align 8
  %72 = getelementptr inbounds i8, ptr %14, i64 8
  %73 = load i64, ptr %72, align 8
  invoke void @_ZN3fmt3v105printIJjjEEEvP8_IO_FILENS0_19basic_format_stringIcJDpNS0_13type_identityIT_E4typeEEEEDpOS6_(ptr noundef %67, ptr %71, i64 %73, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %74 unwind label %83

74:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #9
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %17) #9
  call void @_ZN3sfc8MapentryC2Ejjbb(ptr noundef nonnull align 4 dereferenceable(12) %17, i32 noundef 0, i32 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false)
  %75 = load i32, ptr %23, align 4, !tbaa !5
  %76 = mul i32 %75, %6
  %77 = add i32 %76, %5
  %78 = zext i32 %77 to i64
  %79 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3sfc8MapentryESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %78) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(10) %79, ptr noundef nonnull align 4 dereferenceable(10) %17, i64 10, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %17) #9
  br label %120

80:                                               ; preds = %66, %41
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %66 ], [ %42, %41 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #9
  br label %121

81:                                               ; preds = %88, %._crit_edge
  %82 = landingpad { ptr, i32 }
          cleanup
  br label %121

83:                                               ; preds = %68
  %84 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #9
  br label %121

85:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #9
  call void @_ZNSt6vectorIPKN3sfc10SubpaletteESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #9
  %86 = load i32, ptr %0, align 8, !tbaa !17
  %87 = call noundef i32 @_ZN3sfc23max_tile_count_for_modeENS_4ModeE(i32 noundef %86)
  %.not48 = icmp slt i32 %48, %87
  br i1 %.not48, label %104, label %88

88:                                               ; preds = %85
  %89 = load ptr, ptr @stderr, align 8, !tbaa !16
  invoke void @_ZN3fmt3v1019basic_format_stringIcJjjEEC2IA59_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES8_(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 1 dereferenceable(59) @.str.2)
          to label %90 unwind label %81

90:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #9
  %91 = call noundef i32 @_ZNK3sfc5Image11src_coord_xEv(ptr noundef nonnull align 8 dereferenceable(136) %1)
  store i32 %91, ptr %19, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %20) #9
  %92 = call noundef i32 @_ZNK3sfc5Image11src_coord_yEv(ptr noundef nonnull align 8 dereferenceable(136) %1)
  store i32 %92, ptr %20, align 4, !tbaa !18
  %93 = load ptr, ptr %18, align 8
  %94 = getelementptr inbounds i8, ptr %18, i64 8
  %95 = load i64, ptr %94, align 8
  invoke void @_ZN3fmt3v105printIJjjEEEvP8_IO_FILENS0_19basic_format_stringIcJDpNS0_13type_identityIT_E4typeEEEEDpOS6_(ptr noundef %89, ptr %93, i64 %95, ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %96 unwind label %102

96:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #9
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %21) #9
  call void @_ZN3sfc8MapentryC2Ejjbb(ptr noundef nonnull align 4 dereferenceable(12) %21, i32 noundef 0, i32 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false)
  %97 = load i32, ptr %23, align 4, !tbaa !5
  %98 = mul i32 %97, %6
  %99 = add i32 %98, %5
  %100 = zext i32 %99 to i64
  %101 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3sfc8MapentryESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %100) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(10) %101, ptr noundef nonnull align 4 dereferenceable(10) %21, i64 10, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %21) #9
  br label %120

102:                                              ; preds = %90
  %103 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #9
  br label %121

104:                                              ; preds = %85
  %105 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3sfc7Tileset5tilesEv(ptr noundef nonnull align 8 dereferenceable(56) %2)
  %106 = sext i32 %48 to i64
  %107 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNKSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %105, i64 noundef %106) #9
  %108 = invoke i16 @_ZNK3sfc4Tile10is_flippedERKS0_(ptr noundef nonnull align 8 dereferenceable(88) %107, ptr noundef nonnull align 8 dereferenceable(88) %8)
          to label %109 unwind label %118

109:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %22) #9
  %110 = trunc i16 %108 to i1
  %111 = and i16 %108, 256
  %112 = icmp ne i16 %111, 0
  call void @_ZN3sfc8MapentryC2Ejjbb(ptr noundef nonnull align 4 dereferenceable(12) %22, i32 noundef %48, i32 noundef %.143, i1 noundef zeroext %110, i1 noundef zeroext %112)
  %113 = load i32, ptr %23, align 4, !tbaa !5
  %114 = mul i32 %113, %6
  %115 = add i32 %114, %5
  %116 = zext i32 %115 to i64
  %117 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN3sfc8MapentryESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %116) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(10) %117, ptr noundef nonnull align 4 dereferenceable(10) %22, i64 10, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %22) #9
  br label %120

118:                                              ; preds = %104
  %119 = landingpad { ptr, i32 }
          cleanup
  br label %121

120:                                              ; preds = %96, %109, %74
  call void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %8) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %8) #9
  ret void

121:                                              ; preds = %118, %102, %83, %81, %80
  %.pn49 = phi { ptr, i32 } [ %84, %83 ], [ %82, %81 ], [ %103, %102 ], [ %119, %118 ], [ %.pn.pn.pn, %80 ]
  call void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %8) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %8) #9
  br label %122

122:                                              ; preds = %121, %34
  %.pn51 = phi { ptr, i32 } [ %35, %34 ], [ %.pn49, %121 ]
  resume { ptr, i32 } %.pn51
}

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

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 #3

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) #4

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

declare void @_ZNK3sfc7Palette20subpalettes_matchingERKNS_5ImageE(ptr dead_on_unwind writable sret(%"class.std::vector.15") align 8, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_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(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKPKN3sfc10SubpaletteESt6vectorIS4_SaIS4_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

declare void @_ZN3sfc5ImageC1ERKS0_RKNS_10SubpaletteE(ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #2

declare void @_ZN3sfc4TileC1ERKNS_5ImageENS_4ModeEjb(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(136), i32 noundef, i32 noundef, i1 noundef zeroext) unnamed_addr #2

declare noundef i32 @_ZNK3sfc7Tileset8index_ofERKNS_4TileE(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #2

declare noundef i32 @_ZNK3sfc7Palette8index_ofERKNS_10SubpaletteE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZN3sfc4TileaSERKS0_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3sfc4TileD2Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3sfc5ImageD2Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #5 align 2

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

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN3fmt3v1019basic_format_stringIcJjjEEC2IA39_cTnNSt9enable_ifIXsr3std14is_convertibleIRKT_NS0_17basic_string_viewIcEEEE5valueEiE4typeELi0EEES8_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(39)) unnamed_addr #7 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 #1 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 #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3sfc8MapentryC2Ejjbb(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress 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) #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3sfc23max_tile_count_for_modeENS_4ModeE(i32 noundef) local_unnamed_addr #1

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

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

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

declare i16 @_ZNK3sfc4Tile10is_flippedERKS0_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 4}
!6 = !{!"_ZTSN3sfc3MapE", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 24}
!7 = !{!"_ZTSN3sfc4ModeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSSt6vectorIN3sfc8MapentryESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIN3sfc8MapentryESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN3sfc8MapentryESaIS1_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN3sfc8MapentryESaIS1_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!15, !15, i64 0}
!17 = !{!6, !7, i64 0}
!18 = !{!10, !10, i64 0}
!19 = !{i64 0, i64 4, !18, i64 4, i64 4, !18, i64 8, i64 1, !20, i64 9, i64 1, !20}
!20 = !{!21, !21, i64 0}
!21 = !{!"bool", !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass