; LLVM IR from libtcod/libtcod :: src/libtcod (console_)

; 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.std::array" = type { [2 x i32] }
%"class.std::basic_string_view" = type { i64, ptr }
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload_base" }
%"struct.std::_Optional_payload_base" = type { %"union.std::_Optional_payload_base<TCOD_ColorRGB>::_Storage", i8 }
%"union.std::_Optional_payload_base<TCOD_ColorRGB>::_Storage" = type { %struct.TCOD_ColorRGB }
%struct.TCOD_ColorRGB = type { i8, i8, i8 }
%"struct.tcod::ColorRGB" = type { %struct.TCOD_ColorRGB }
%struct.TCOD_Console = type { i32, i32, ptr, i32, i32, %struct.TCOD_ColorRGB, %struct.TCOD_ColorRGB, i8, %struct.TCOD_ColorRGB, i32, ptr, ptr }

; 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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4tcod5printER12TCOD_ConsoleRKSt5arrayIiLm2EESt17basic_string_viewIcSt11char_traitsIcEESt8optionalI13TCOD_ColorRGBESC_16TCOD_alignment_t17TCOD_bkgnd_flag_t(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(8), i64, ptr, i32, i32, i32 noundef, i32 noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare { i64, ptr } @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEcvSt17basic_string_viewIcS2_EEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11TCODConsole5printEiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE16TCOD_alignment_t17TCOD_bkgnd_flag_t(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef %4, i32 noundef %5) #3 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::array", align 4
  %14 = alloca %"class.std::basic_string_view", align 8
  %15 = alloca %"class.std::optional", align 1
  %16 = alloca %"struct.tcod::ColorRGB", align 1
  %17 = alloca %"class.std::optional", align 1
  %18 = alloca %"struct.tcod::ColorRGB", align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !11
  store i32 %5, ptr %12, align 4, !tbaa !13
  %19 = load ptr, ptr %7, align 8
  %20 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZN11TCODConsolecvR12TCOD_ConsoleEv(ptr noundef nonnull align 8 dereferenceable(8) %19)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %21 = getelementptr inbounds %"struct.std::array", ptr %13, i32 0, i32 0
  %22 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %22, ptr %21, align 4, !tbaa !9
  %23 = getelementptr inbounds i32, ptr %21, i64 1
  %24 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %24, ptr %23, align 4, !tbaa !9
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = call { i64, ptr } @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEcvSt17basic_string_viewIcS2_EEv(ptr noundef nonnull align 8 dereferenceable(32) %25) #4
  %27 = getelementptr inbounds { i64, ptr }, ptr %14, i32 0, i32 0
  %28 = extractvalue { i64, ptr } %26, 0
  store i64 %28, ptr %27, align 8
  %29 = getelementptr inbounds { i64, ptr }, ptr %14, i32 0, i32 1
  %30 = extractvalue { i64, ptr } %26, 1
  store ptr %30, ptr %29, align 8
  call void @llvm.lifetime.start.p0(i64 3, ptr %16) #4
  %31 = call noundef ptr @_ZN11TCODConsole3getEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #4
  %32 = getelementptr inbounds %struct.TCOD_Console, ptr %31, i32 0, i32 5
  call void @_ZN4tcod8ColorRGBC2ERK13TCOD_ColorRGB(ptr noundef nonnull align 1 dereferenceable(3) %16, ptr noundef nonnull align 1 dereferenceable(3) %32) #4
  call void @_ZNSt8optionalI13TCOD_ColorRGBEC2IN4tcod8ColorRGBETnNSt9enable_ifIX7__and_vISt6__not_ISt7is_sameIS1_NSt9remove_cvINSt16remove_referenceIT_E4typeEE4typeEEES6_IS7_ISt10in_place_tSE_EESt16is_constructibleIS0_JSA_EESt14is_convertibleISA_S0_EEEbE4typeELb1EEEOSA_(ptr noundef nonnull align 1 dereferenceable(4) %15, ptr noundef nonnull align 1 dereferenceable(3) %16) #4
  call void @llvm.lifetime.start.p0(i64 3, ptr %18) #4
  %33 = call noundef ptr @_ZN11TCODConsole3getEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #4
  %34 = getelementptr inbounds %struct.TCOD_Console, ptr %33, i32 0, i32 6
  call void @_ZN4tcod8ColorRGBC2ERK13TCOD_ColorRGB(ptr noundef nonnull align 1 dereferenceable(3) %18, ptr noundef nonnull align 1 dereferenceable(3) %34) #4
  call void @_ZNSt8optionalI13TCOD_ColorRGBEC2IN4tcod8ColorRGBETnNSt9enable_ifIX7__and_vISt6__not_ISt7is_sameIS1_NSt9remove_cvINSt16remove_referenceIT_E4typeEE4typeEEES6_IS7_ISt10in_place_tSE_EESt16is_constructibleIS0_JSA_EESt14is_convertibleISA_S0_EEEbE4typeELb1EEEOSA_(ptr noundef nonnull align 1 dereferenceable(4) %17, ptr noundef nonnull align 1 dereferenceable(3) %18) #4
  %35 = load i32, ptr %11, align 4, !tbaa !11
  %36 = load i32, ptr %12, align 4, !tbaa !13
  %37 = getelementptr inbounds { i64, ptr }, ptr %14, i32 0, i32 0
  %38 = load i64, ptr %37, align 8
  %39 = getelementptr inbounds { i64, ptr }, ptr %14, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8
  %41 = getelementptr inbounds %"class.std::optional", ptr %15, i32 0, i32 0
  %42 = getelementptr inbounds %"struct.std::_Optional_base", ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %"struct.std::_Optional_payload", ptr %42, i32 0, i32 0
  %44 = load i32, ptr %43, align 1
  %45 = getelementptr inbounds %"class.std::optional", ptr %17, i32 0, i32 0
  %46 = getelementptr inbounds %"struct.std::_Optional_base", ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %"struct.std::_Optional_payload", ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 1
  call void @_ZN4tcod5printER12TCOD_ConsoleRKSt5arrayIiLm2EESt17basic_string_viewIcSt11char_traitsIcEESt8optionalI13TCOD_ColorRGBESC_16TCOD_alignment_t17TCOD_bkgnd_flag_t(ptr noundef nonnull align 8 dereferenceable(56) %20, ptr noundef nonnull align 4 dereferenceable(8) %13, i64 %38, ptr %40, i32 %44, i32 %48, i32 noundef %35, i32 noundef %36)
  call void @llvm.lifetime.end.p0(i64 3, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 3, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS16TCOD_alignment_t", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTS17TCOD_bkgnd_flag_t", !7, i64 0}


; 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.std::array" = type { [2 x i32] }
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload_base" }
%"struct.std::_Optional_payload_base" = type { %"union.std::_Optional_payload_base<TCOD_ColorRGB>::_Storage", i8 }
%"union.std::_Optional_payload_base<TCOD_ColorRGB>::_Storage" = type { %struct.TCOD_ColorRGB }
%struct.TCOD_ColorRGB = type { i8, i8, i8 }
%"struct.tcod::ColorRGB" = type { %struct.TCOD_ColorRGB }

; 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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare { i64, ptr } @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEcvSt17basic_string_viewIcS2_EEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11TCODConsole5printEiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE16TCOD_alignment_t17TCOD_bkgnd_flag_t(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #3 align 2 {
  %7 = alloca %"struct.std::array", align 4
  %8 = alloca %"class.std::optional", align 4
  %9 = alloca %"struct.tcod::ColorRGB", align 1
  %10 = alloca %"class.std::optional", align 4
  %11 = alloca %"struct.tcod::ColorRGB", align 1
  %12 = tail call noundef nonnull align 8 dereferenceable(56) ptr @_ZN11TCODConsolecvR12TCOD_ConsoleEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  store i32 %1, ptr %7, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 %2, ptr %13, align 4, !tbaa !5
  %14 = tail call { i64, ptr } @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEcvSt17basic_string_viewIcS2_EEv(ptr noundef nonnull align 8 dereferenceable(32) %3) #4
  %15 = extractvalue { i64, ptr } %14, 0
  %16 = extractvalue { i64, ptr } %14, 1
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %9) #4
  %17 = tail call noundef ptr @_ZN11TCODConsole3getEv(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  %18 = getelementptr inbounds i8, ptr %17, i64 24
  call void @_ZN4tcod8ColorRGBC2ERK13TCOD_ColorRGB(ptr noundef nonnull align 1 dereferenceable(3) %9, ptr noundef nonnull align 1 dereferenceable(3) %18) #4
  call void @_ZNSt8optionalI13TCOD_ColorRGBEC2IN4tcod8ColorRGBETnNSt9enable_ifIX7__and_vISt6__not_ISt7is_sameIS1_NSt9remove_cvINSt16remove_referenceIT_E4typeEE4typeEEES6_IS7_ISt10in_place_tSE_EESt16is_constructibleIS0_JSA_EESt14is_convertibleISA_S0_EEEbE4typeELb1EEEOSA_(ptr noundef nonnull align 1 dereferenceable(4) %8, ptr noundef nonnull align 1 dereferenceable(3) %9) #4
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %11) #4
  %19 = call noundef ptr @_ZN11TCODConsole3getEv(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  %20 = getelementptr inbounds i8, ptr %19, i64 27
  call void @_ZN4tcod8ColorRGBC2ERK13TCOD_ColorRGB(ptr noundef nonnull align 1 dereferenceable(3) %11, ptr noundef nonnull align 1 dereferenceable(3) %20) #4
  call void @_ZNSt8optionalI13TCOD_ColorRGBEC2IN4tcod8ColorRGBETnNSt9enable_ifIX7__and_vISt6__not_ISt7is_sameIS1_NSt9remove_cvINSt16remove_referenceIT_E4typeEE4typeEEES6_IS7_ISt10in_place_tSE_EESt16is_constructibleIS0_JSA_EESt14is_convertibleISA_S0_EEEbE4typeELb1EEEOSA_(ptr noundef nonnull align 1 dereferenceable(4) %10, ptr noundef nonnull align 1 dereferenceable(3) %11) #4
  %21 = load i32, ptr %8, align 4
  %22 = load i32, ptr %10, align 4
  call void @_ZN4tcod5printER12TCOD_ConsoleRKSt5arrayIiLm2EESt17basic_string_viewIcSt11char_traitsIcEESt8optionalI13TCOD_ColorRGBESC_16TCOD_alignment_t17TCOD_bkgnd_flag_t(ptr noundef nonnull align 8 dereferenceable(56) %12, ptr noundef nonnull align 4 dereferenceable(8) %7, i64 %15, ptr %16, i32 %21, i32 %22, i32 noundef %4, i32 noundef %5)
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass