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

; 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.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<sfc::Tile, std::allocator<sfc::Tile>>::_Vector_impl" }
%"struct.std::_Vector_base<sfc::Tile, std::allocator<sfc::Tile>>::_Vector_impl" = type { %"struct.std::_Vector_base<sfc::Tile, std::allocator<sfc::Tile>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sfc::Tile, std::allocator<sfc::Tile>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.sfc::Tileset" = type { i32, i32, i32, i32, i32, i8, i8, i8, i32, %"class.std::vector.13" }

@_ZTISt13runtime_error = external constant ptr
@.str.4 = external hidden unnamed_addr constant [70 x i8], align 1

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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare ptr @__cxa_allocate_exception(i64)

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

declare void @__cxa_free_exception(ptr)

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

declare void @__cxa_throw(ptr, ptr, ptr)

; 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) #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3sfc7Tileset22remap_tiles_for_outputERKSt6vectorINS_4TileESaIS2_EENS_4ModeE(ptr dead_on_unwind noalias writable sret(%"class.std::vector.13") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef %3) #4 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i1, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %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 i32, align 4
  %20 = alloca %"class.std::vector.13", align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  %23 = load ptr, ptr %6, align 8
  store i1 false, ptr %9, align 1
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %44

26:                                               ; preds = %4
  %27 = getelementptr inbounds %"struct.sfc::Tileset", ptr %23, i32 0, i32 3
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = urem i32 %28, 16
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %36, label %31

31:                                               ; preds = %26
  %32 = getelementptr inbounds %"struct.sfc::Tileset", ptr %23, i32 0, i32 4
  %33 = load i32, ptr %32, align 8, !tbaa !19
  %34 = urem i32 %33, 16
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %44

36:                                               ; preds = %31, %26
  %37 = getelementptr inbounds %"struct.sfc::Tileset", ptr %23, i32 0, i32 3
  %38 = load i32, ptr %37, align 4, !tbaa !11
  %39 = icmp ule i32 %38, 64
  br i1 %39, label %54, label %40

40:                                               ; preds = %36
  %41 = getelementptr inbounds %"struct.sfc::Tileset", ptr %23, i32 0, i32 4
  %42 = load i32, ptr %41, align 8, !tbaa !19
  %43 = icmp ule i32 %42, 64
  br i1 %43, label %54, label %44

44:                                               ; preds = %40, %31, %4
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = icmp eq i32 %45, 3
  br i1 %46, label %50, label %47

47:                                               ; preds = %44
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = icmp eq i32 %48, 4
  br i1 %49, label %50, label %163

50:                                               ; preds = %47, %44
  %51 = getelementptr inbounds %"struct.sfc::Tileset", ptr %23, i32 0, i32 4
  %52 = load i32, ptr %51, align 8, !tbaa !19
  %53 = icmp eq i32 %52, 16
  br i1 %53, label %54, label %163

54:                                               ; preds = %50, %40, %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %55 = getelementptr inbounds %"struct.sfc::Tileset", ptr %23, i32 0, i32 3
  %56 = load i32, ptr %55, align 4, !tbaa !11
  %57 = udiv i32 %56, 8
  store i32 %57, ptr %10, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %58 = getelementptr inbounds %"struct.sfc::Tileset", ptr %23, i32 0, i32 4
  %59 = load i32, ptr %58, align 8, !tbaa !19
  %60 = udiv i32 %59, 8
  store i32 %60, ptr %11, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %61 = load i32, ptr %8, align 4, !tbaa !9
  %62 = icmp eq i32 %61, 1
  %63 = zext i1 %62 to i64
  %64 = select i1 %62, i32 16, i32 1
  store i32 %64, ptr %12, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %65 = load i32, ptr %12, align 4, !tbaa !20
  %66 = load i32, ptr %10, align 4, !tbaa !20
  %67 = udiv i32 %65, %66
  store i32 %67, ptr %13, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = call noundef i64 @_ZNKSt6vectorIN3sfc4TileESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %68) #6
  %70 = trunc i64 %69 to i32
  %71 = load i32, ptr %13, align 4, !tbaa !20
  %72 = invoke noundef i32 @_ZN3sfc8div_ceilEii(i32 noundef %70, i32 noundef %71)
          to label %73 unwind label %88

73:                                               ; preds = %54
  %74 = load i32, ptr %11, align 4, !tbaa !20
  %75 = mul i32 %72, %74
  store i32 %75, ptr %14, align 4, !tbaa !20
  %76 = load i32, ptr %12, align 4, !tbaa !20
  %77 = load i32, ptr %14, align 4, !tbaa !20
  %78 = mul i32 %76, %77
  %79 = zext i32 %78 to i64
  invoke void @_ZNSt6vectorIN3sfc4TileESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %79)
          to label %80 unwind label %88

80:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !20
  br label %81

81:                                               ; preds = %157, %80
  %82 = load i32, ptr %17, align 4, !tbaa !20
  %83 = zext i32 %82 to i64
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = call noundef i64 @_ZNKSt6vectorIN3sfc4TileESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %84) #6
  %86 = icmp ult i64 %83, %85
  br i1 %86, label %92, label %87

87:                                               ; preds = %81
  store i32 2, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %161

88:                                               ; preds = %73, %54
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %15, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %16, align 4
  br label %162

92:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %93 = load i32, ptr %17, align 4, !tbaa !20
  %94 = load i32, ptr %13, align 4, !tbaa !20
  %95 = udiv i32 %93, %94
  %96 = load i32, ptr %11, align 4, !tbaa !20
  %97 = mul i32 %95, %96
  %98 = load i32, ptr %12, align 4, !tbaa !20
  %99 = mul i32 %97, %98
  %100 = load i32, ptr %17, align 4, !tbaa !20
  %101 = load i32, ptr %13, align 4, !tbaa !20
  %102 = urem i32 %100, %101
  %103 = load i32, ptr %10, align 4, !tbaa !20
  %104 = mul i32 %102, %103
  %105 = add i32 %99, %104
  store i32 %105, ptr %19, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #6
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %107 = load i32, ptr %17, align 4, !tbaa !20
  %108 = zext i32 %107 to i64
  %109 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNKSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %106, i64 noundef %108) #6
  invoke void @_ZNK3sfc4Tile5cropsEjj(ptr dead_on_unwind writable sret(%"class.std::vector.13") align 8 %20, ptr noundef nonnull align 8 dereferenceable(88) %109, i32 noundef 8, i32 noundef 8)
          to label %110 unwind label %116

110:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !20
  br label %111

111:                                              ; preds = %153, %110
  %112 = load i32, ptr %21, align 4, !tbaa !20
  %113 = load i32, ptr %11, align 4, !tbaa !20
  %114 = icmp ult i32 %112, %113
  br i1 %114, label %120, label %115

115:                                              ; preds = %111
  store i32 5, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %156

116:                                              ; preds = %92
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %15, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %16, align 4
  br label %160

120:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !20
  br label %121

121:                                              ; preds = %145, %120
  %122 = load i32, ptr %22, align 4, !tbaa !20
  %123 = load i32, ptr %10, align 4, !tbaa !20
  %124 = icmp ult i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 8, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %152

126:                                              ; preds = %121
  %127 = load i32, ptr %21, align 4, !tbaa !20
  %128 = load i32, ptr %10, align 4, !tbaa !20
  %129 = mul i32 %127, %128
  %130 = load i32, ptr %22, align 4, !tbaa !20
  %131 = add i32 %129, %130
  %132 = zext i32 %131 to i64
  %133 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNKSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %132) #6
  %134 = load i32, ptr %19, align 4, !tbaa !20
  %135 = load i32, ptr %21, align 4, !tbaa !20
  %136 = load i32, ptr %12, align 4, !tbaa !20
  %137 = mul i32 %135, %136
  %138 = add i32 %134, %137
  %139 = load i32, ptr %22, align 4, !tbaa !20
  %140 = add i32 %138, %139
  %141 = zext i32 %140 to i64
  %142 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %141) #6
  %143 = invoke noundef nonnull align 8 dereferenceable(88) ptr @_ZN3sfc4TileaSERKS0_(ptr noundef nonnull align 8 dereferenceable(88) %142, ptr noundef nonnull align 8 dereferenceable(88) %133)
          to label %144 unwind label %148

144:                                              ; preds = %126
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %22, align 4, !tbaa !20
  %147 = add i32 %146, 1
  store i32 %147, ptr %22, align 4, !tbaa !20
  br label %121, !llvm.loop !21

148:                                              ; preds = %126
  %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
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #6
  br label %160

152:                                              ; preds = %125
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %21, align 4, !tbaa !20
  %155 = add i32 %154, 1
  store i32 %155, ptr %21, align 4, !tbaa !20
  br label %111, !llvm.loop !23

156:                                              ; preds = %115
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %17, align 4, !tbaa !20
  %159 = add i32 %158, 1
  store i32 %159, ptr %17, align 4, !tbaa !20
  br label %81, !llvm.loop !24

160:                                              ; preds = %148, %116
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %162

161:                                              ; preds = %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %174

162:                                              ; preds = %160, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %178

163:                                              ; preds = %50, %47
  %164 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %164, ptr noundef @.str.4)
          to label %165 unwind label %166

165:                                              ; preds = %163
  invoke void @__cxa_throw(ptr %164, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #7
          to label %184 unwind label %170

166:                                              ; preds = %163
  %167 = landingpad { ptr, i32 }
          cleanup
  %168 = extractvalue { ptr, i32 } %167, 0
  store ptr %168, ptr %15, align 8
  %169 = extractvalue { ptr, i32 } %167, 1
  store i32 %169, ptr %16, align 4
  call void @__cxa_free_exception(ptr %164) #6
  br label %178

170:                                              ; preds = %165
  %171 = landingpad { ptr, i32 }
          cleanup
  %172 = extractvalue { ptr, i32 } %171, 0
  store ptr %172, ptr %15, align 8
  %173 = extractvalue { ptr, i32 } %171, 1
  store i32 %173, ptr %16, align 4
  br label %178

174:                                              ; preds = %161
  store i1 true, ptr %9, align 1
  store i32 1, ptr %18, align 4
  %175 = load i1, ptr %9, align 1
  br i1 %175, label %177, label %176

176:                                              ; preds = %174
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %177

177:                                              ; preds = %176, %174
  ret void

178:                                              ; preds = %170, %166, %162
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %179

179:                                              ; preds = %178
  %180 = load ptr, ptr %15, align 8
  %181 = load i32, ptr %16, align 4
  %182 = insertvalue { ptr, i32 } poison, ptr %180, 0
  %183 = insertvalue { ptr, i32 } %182, i32 %181, 1
  resume { ptr, i32 } %183

184:                                              ; preds = %165
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3sfc8div_ceilEii(i32 noundef, i32 noundef) #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZNSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 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)) #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress 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 = { nounwind }
attributes #7 = { 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 = !{!"_ZTSN3sfc4ModeE", !7, i64 0}
!11 = !{!12, !13, i64 12}
!12 = !{!"_ZTSN3sfc7TilesetE", !13, i64 0, !10, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !14, i64 20, !14, i64 21, !14, i64 22, !13, i64 24, !15, i64 32}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSSt6vectorIN3sfc4TileESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIN3sfc4TileESaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN3sfc4TileESaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN3sfc4TileESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!12, !13, i64 16}
!20 = !{!13, !13, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}


; 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.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<sfc::Tile, std::allocator<sfc::Tile>>::_Vector_impl" }
%"struct.std::_Vector_base<sfc::Tile, std::allocator<sfc::Tile>>::_Vector_impl" = type { %"struct.std::_Vector_base<sfc::Tile, std::allocator<sfc::Tile>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sfc::Tile, std::allocator<sfc::Tile>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZTISt13runtime_error = external constant ptr
@.str.4 = external hidden unnamed_addr constant [70 x i8], align 1

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

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

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

; 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 #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3sfc7Tileset22remap_tiles_for_outputERKSt6vectorINS_4TileESaIS2_EENS_4ModeE(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector.13") align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(56) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef %3) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::vector.13", align 8
  tail call void @_ZNSt6vectorIN3sfc4TileESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  %6 = icmp eq i32 %3, 1
  br i1 %6, label %7, label %16

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %1, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = and i32 %9, 15
  %11 = icmp eq i32 %10, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %1, i64 16
  %.pre = load i32, ptr %.phi.trans.insert, align 8
  %12 = and i32 %.pre, 15
  %13 = icmp eq i32 %12, 0
  %or.cond77 = select i1 %11, i1 true, i1 %13
  br i1 %or.cond77, label %._crit_edge, label %.thread

._crit_edge:                                      ; preds = %7
  %14 = icmp ult i32 %9, 65
  %15 = icmp ult i32 %.pre, 65
  %or.cond53 = select i1 %14, i1 true, i1 %15
  br i1 %or.cond53, label %21, label %.thread

16:                                               ; preds = %4
  %17 = add i32 %3, -3
  %or.cond = icmp ult i32 %17, 2
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  %19 = load i32, ptr %18, align 8
  %20 = icmp eq i32 %19, 16
  %or.cond56 = select i1 %or.cond, i1 %20, i1 false
  br i1 %or.cond56, label %._crit_edge72, label %.thread

._crit_edge72:                                    ; preds = %16
  %.phi.trans.insert73 = getelementptr inbounds i8, ptr %1, i64 12
  %.pre74 = load i32, ptr %.phi.trans.insert73, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %._crit_edge72, %._crit_edge
  %22 = phi i32 [ 16, %._crit_edge72 ], [ %.pre, %._crit_edge ]
  %23 = phi i32 [ %.pre74, %._crit_edge72 ], [ %9, %._crit_edge ]
  %24 = phi i32 [ 0, %._crit_edge72 ], [ 4, %._crit_edge ]
  %25 = phi i32 [ 1, %._crit_edge72 ], [ 16, %._crit_edge ]
  %26 = lshr i32 %23, 3
  %.fr68 = freeze i32 %22
  %27 = lshr i32 %.fr68, 3
  %28 = udiv i32 %25, %26
  %29 = tail call noundef i64 @_ZNKSt6vectorIN3sfc4TileESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %30 = trunc i64 %29 to i32
  %31 = tail call noundef i32 @_ZN3sfc8div_ceilEii(i32 noundef %30, i32 noundef %28)
  %32 = mul i32 %31, %27
  %33 = shl i32 %32, %24
  %34 = zext i32 %33 to i64
  invoke void @_ZNSt6vectorIN3sfc4TileESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %34)
          to label %.preheader60 unwind label %65

.preheader60:                                     ; preds = %21
  %35 = tail call noundef i64 @_ZNKSt6vectorIN3sfc4TileESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %.not = icmp eq i64 %35, 0
  br i1 %.not, label %._crit_edge64, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader60
  %36 = icmp ugt i32 %.fr68, 7
  br i1 %36, label %.lr.ph.split.us.preheader, label %.lr.ph.split

.lr.ph.split.us.preheader:                        ; preds = %.lr.ph
  %umax = tail call i32 @llvm.umax.i32(i32 %26, i32 1)
  %wide.trip.count = zext nneg i32 %umax to i64
  br label %.lr.ph.split.us

.lr.ph.split.us:                                  ; preds = %.lr.ph.split.us.preheader, %._crit_edge.us
  %37 = phi i64 [ %60, %._crit_edge.us ], [ 0, %.lr.ph.split.us.preheader ]
  %.04163.us = phi i32 [ %59, %._crit_edge.us ], [ 0, %.lr.ph.split.us.preheader ]
  %38 = udiv i32 %.04163.us, %28
  %39 = mul i32 %38, %27
  %40 = urem i32 %.04163.us, %28
  %41 = mul i32 %40, %26
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  %42 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNKSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %37) #7
  invoke void @_ZNK3sfc4Tile5cropsEjj(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.13") align 8 %5, ptr noundef nonnull align 8 dereferenceable(88) %42, i32 noundef 8, i32 noundef 8)
          to label %.preheader.us unwind label %.split.us

43:                                               ; preds = %54
  %44 = add nuw nsw i32 %.04062.us, 1
  %exitcond71.not = icmp eq i32 %44, %27
  br i1 %exitcond71.not, label %._crit_edge.us, label %.preheader.us, !llvm.loop !17

45:                                               ; preds = %.preheader.us, %54
  %indvars.iv = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next, %54 ]
  %46 = trunc nuw nsw i64 %indvars.iv to i32
  %47 = add i32 %55, %46
  %48 = zext i32 %47 to i64
  %49 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNKSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %48) #7
  %50 = add i32 %58, %46
  %51 = zext i32 %50 to i64
  %52 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %51) #7
  %53 = invoke noundef nonnull align 8 dereferenceable(88) ptr @_ZN3sfc4TileaSERKS0_(ptr noundef nonnull align 8 dereferenceable(88) %52, ptr noundef nonnull align 8 dereferenceable(88) %49)
          to label %54 unwind label %.split66.us

54:                                               ; preds = %45
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %43, label %45, !llvm.loop !19

.preheader.us:                                    ; preds = %.lr.ph.split.us, %43
  %.04062.us = phi i32 [ %44, %43 ], [ 0, %.lr.ph.split.us ]
  %55 = mul i32 %.04062.us, %26
  %56 = add i32 %.04062.us, %39
  %57 = shl i32 %56, %24
  %58 = add i32 %57, %41
  br label %45

._crit_edge.us:                                   ; preds = %43
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  %59 = add i32 %.04163.us, 1
  %60 = zext i32 %59 to i64
  %61 = call noundef i64 @_ZNKSt6vectorIN3sfc4TileESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %62 = icmp ugt i64 %61, %60
  br i1 %62, label %.lr.ph.split.us, label %._crit_edge64, !llvm.loop !20

.split.us:                                        ; preds = %.lr.ph.split.us
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %74

.split66.us:                                      ; preds = %45
  %64 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  br label %74

65:                                               ; preds = %21
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %81

.lr.ph.split:                                     ; preds = %.lr.ph, %.preheader59
  %67 = phi i64 [ %70, %.preheader59 ], [ 0, %.lr.ph ]
  %.04163 = phi i32 [ %69, %.preheader59 ], [ 0, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  %68 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZNKSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %67) #7
  invoke void @_ZNK3sfc4Tile5cropsEjj(ptr dead_on_unwind nonnull writable sret(%"class.std::vector.13") align 8 %5, ptr noundef nonnull align 8 dereferenceable(88) %68, i32 noundef 8, i32 noundef 8)
          to label %.preheader59 unwind label %.split

.preheader59:                                     ; preds = %.lr.ph.split
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  %69 = add i32 %.04163, 1
  %70 = zext i32 %69 to i64
  %71 = call noundef i64 @_ZNKSt6vectorIN3sfc4TileESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %72 = icmp ugt i64 %71, %70
  br i1 %72, label %.lr.ph.split, label %._crit_edge64, !llvm.loop !20

.split:                                           ; preds = %.lr.ph.split
  %73 = landingpad { ptr, i32 }
          cleanup
  br label %74

74:                                               ; preds = %.split, %.split.us, %.split66.us
  %.pn = phi { ptr, i32 } [ %64, %.split66.us ], [ %73, %.split ], [ %63, %.split.us ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  br label %81

.thread:                                          ; preds = %7, %._crit_edge, %16
  %75 = tail call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %75, ptr noundef nonnull @.str.4)
          to label %76 unwind label %77

76:                                               ; preds = %.thread
  invoke void @__cxa_throw(ptr nonnull %75, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #8
          to label %82 unwind label %79

77:                                               ; preds = %.thread
  %78 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %75) #7
  br label %81

79:                                               ; preds = %76
  %80 = landingpad { ptr, i32 }
          cleanup
  br label %81

._crit_edge64:                                    ; preds = %.preheader59, %._crit_edge.us, %.preheader60
  ret void

81:                                               ; preds = %65, %74, %79, %77
  %.pn.pn.pn = phi { ptr, i32 } [ %80, %79 ], [ %78, %77 ], [ %.pn, %74 ], [ %66, %65 ]
  call void @_ZNSt6vectorIN3sfc4TileESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  resume { ptr, i32 } %.pn.pn.pn

82:                                               ; preds = %76
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3sfc8div_ceilEii(i32 noundef, i32 noundef) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZNSt6vectorIN3sfc4TileESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 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 #5 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #6

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


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass