; LLVM IR from tyoma/agge :: src/agge.text/richtext.ll (ZN4agge5style11family_baseEv)

; 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.agge::style_modifier" = type { %"struct.agge::font_descriptor", %"struct.agge::color", i16, [2 x i8] }
%"struct.agge::font_descriptor" = type <{ %"class.std::__cxx11::basic_string", i32, [4 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.agge::color" = type { i8, i8, i8, i8 }

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4agge14style_modifierC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(46), ptr noundef nonnull align 8 dereferenceable(46)) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4agge5style11family_baseEv(ptr dead_on_unwind noalias writable sret(%"struct.agge::style_modifier") align 8 %0) #4 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"struct.agge::style_modifier", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr %3) #5
  %6 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 0
  %7 = getelementptr inbounds %"struct.agge::font_descriptor", ptr %6, i32 0, i32 0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  %8 = getelementptr inbounds %"struct.agge::font_descriptor", ptr %6, i32 0, i32 1
  %9 = load i32, ptr %8, align 8
  %10 = and i32 %9, -1048576
  %11 = or i32 %10, 0
  store i32 %11, ptr %8, align 8
  %12 = getelementptr inbounds %"struct.agge::font_descriptor", ptr %6, i32 0, i32 1
  %13 = load i32, ptr %12, align 8
  %14 = and i32 %13, -15728641
  %15 = or i32 %14, 0
  store i32 %15, ptr %12, align 8
  %16 = getelementptr inbounds %"struct.agge::font_descriptor", ptr %6, i32 0, i32 1
  %17 = load i32, ptr %16, align 8
  %18 = and i32 %17, -16777217
  %19 = or i32 %18, 0
  store i32 %19, ptr %16, align 8
  %20 = getelementptr inbounds %"struct.agge::font_descriptor", ptr %6, i32 0, i32 1
  %21 = load i32, ptr %20, align 8
  %22 = and i32 %21, -100663297
  %23 = or i32 %22, 0
  store i32 %23, ptr %20, align 8
  %24 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 1
  %25 = getelementptr inbounds %"struct.agge::color", ptr %24, i32 0, i32 0
  store i8 0, ptr %25, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.agge::color", ptr %24, i32 0, i32 1
  store i8 0, ptr %26, align 1, !tbaa !9
  %27 = getelementptr inbounds %"struct.agge::color", ptr %24, i32 0, i32 2
  store i8 0, ptr %27, align 2, !tbaa !10
  %28 = getelementptr inbounds %"struct.agge::color", ptr %24, i32 0, i32 3
  store i8 0, ptr %28, align 1, !tbaa !11
  %29 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 2
  %30 = load i16, ptr %29, align 4
  %31 = and i16 %30, -4
  %32 = or i16 %31, 0
  store i16 %32, ptr %29, align 4
  %33 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 2
  %34 = load i16, ptr %33, align 4
  %35 = and i16 %34, -29
  %36 = or i16 %35, 0
  store i16 %36, ptr %33, align 4
  %37 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 2
  %38 = load i16, ptr %37, align 4
  %39 = and i16 %38, -97
  %40 = or i16 %39, 0
  store i16 %40, ptr %37, align 4
  %41 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 2
  %42 = load i16, ptr %41, align 4
  %43 = and i16 %42, -385
  %44 = or i16 %43, 0
  store i16 %44, ptr %41, align 4
  %45 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 2
  %46 = load i16, ptr %45, align 4
  %47 = and i16 %46, -1537
  %48 = or i16 %47, 0
  store i16 %48, ptr %45, align 4
  %49 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 2
  %50 = load i16, ptr %49, align 4
  %51 = and i16 %50, -6145
  %52 = or i16 %51, 0
  store i16 %52, ptr %49, align 4
  %53 = getelementptr inbounds %"struct.agge::style_modifier", ptr %3, i32 0, i32 2
  %54 = load i16, ptr %53, align 4
  %55 = and i16 %54, -4
  %56 = or i16 %55, 2
  store i16 %56, ptr %53, align 4
  invoke void @_ZN4agge14style_modifierC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(46) %0, ptr noundef nonnull align 8 dereferenceable(46) %3)
          to label %57 unwind label %58

57:                                               ; preds = %1
  call void @_ZN4agge14style_modifierD2Ev(ptr noundef nonnull align 8 dereferenceable(46) %3) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #5
  ret void

58:                                               ; preds = %1
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %4, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %5, align 4
  call void @_ZN4agge14style_modifierD2Ev(ptr noundef nonnull align 8 dereferenceable(46) %3) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #5
  br label %62

62:                                               ; preds = %58
  %63 = load ptr, ptr %4, align 8
  %64 = load i32, ptr %5, align 4
  %65 = insertvalue { ptr, i32 } poison, ptr %63, 0
  %66 = insertvalue { ptr, i32 } %65, i32 %64, 1
  resume { ptr, i32 } %66
}

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { nounwind }

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

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


; 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.agge::style_modifier" = type { %"struct.agge::font_descriptor", %"struct.agge::color", i16, [2 x i8] }
%"struct.agge::font_descriptor" = type <{ %"class.std::__cxx11::basic_string", i32, [4 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.agge::color" = type { i8, i8, i8, i8 }

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4agge14style_modifierC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(46), ptr noundef nonnull align 8 dereferenceable(46)) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4agge5style11family_baseEv(ptr dead_on_unwind noalias writable sret(%"struct.agge::style_modifier") align 8 %0) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"struct.agge::style_modifier", align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  %3 = getelementptr inbounds i8, ptr %2, i64 32
  %4 = load i32, ptr %3, align 8
  %5 = and i32 %4, -134217728
  store i32 %5, ptr %3, align 8
  %6 = getelementptr inbounds i8, ptr %2, i64 40
  %7 = getelementptr inbounds i8, ptr %2, i64 44
  store i32 0, ptr %6, align 8
  %8 = load i16, ptr %7, align 4
  %9 = and i16 %8, -8192
  %10 = or disjoint i16 %9, 2
  store i16 %10, ptr %7, align 4
  invoke void @_ZN4agge14style_modifierC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(46) %0, ptr noundef nonnull align 8 dereferenceable(46) %2)
          to label %11 unwind label %12

11:                                               ; preds = %1
  call void @_ZN4agge14style_modifierD2Ev(ptr noundef nonnull align 8 dereferenceable(46) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  ret void

12:                                               ; preds = %1
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4agge14style_modifierD2Ev(ptr noundef nonnull align 8 dereferenceable(46) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  resume { ptr, i32 } %13
}

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { 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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass