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

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

59:                                               ; preds = %2
  %60 = getelementptr inbounds %"struct.agge::style_modifier", ptr %5, i32 0, i32 2
  %61 = load i16, ptr %60, align 4
  %62 = and i16 %61, -4
  %63 = or i16 %62, 1
  store i16 %63, ptr %60, align 4
  invoke void @_ZN4agge14style_modifierC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(46) %0, ptr noundef nonnull align 8 dereferenceable(46) %5)
          to label %64 unwind label %65

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

65:                                               ; preds = %59, %2
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %6, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %7, align 4
  call void @_ZN4agge14style_modifierD2Ev(ptr noundef nonnull align 8 dereferenceable(46) %5) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #5
  br label %69

69:                                               ; preds = %65
  %70 = load ptr, ptr %6, align 8
  %71 = load i32, ptr %7, align 4
  %72 = insertvalue { ptr, i32 } poison, ptr %70, 0
  %73 = insertvalue { ptr, i32 } %72, i32 %71, 1
  resume { ptr, i32 } %73
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !7, i64 0}
!10 = !{!"_ZTSN4agge5colorE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!11 = !{!10, !7, i64 1}
!12 = !{!10, !7, i64 2}
!13 = !{!10, !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 @_ZN4agge5style6familyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"struct.agge::style_modifier") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"struct.agge::style_modifier", align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  %4 = getelementptr inbounds i8, ptr %3, i64 32
  %5 = load i32, ptr %4, align 8
  %6 = and i32 %5, -134217728
  store i32 %6, ptr %4, align 8
  %7 = getelementptr inbounds i8, ptr %3, i64 40
  %8 = getelementptr inbounds i8, ptr %3, i64 44
  store i32 0, ptr %7, align 8
  %9 = load i16, ptr %8, align 4
  %10 = and i16 %9, -8192
  store i16 %10, ptr %8, align 4
  %11 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %12 unwind label %17

12:                                               ; preds = %2
  %13 = load i16, ptr %8, align 4
  %14 = and i16 %13, -4
  %15 = or disjoint i16 %14, 1
  store i16 %15, ptr %8, align 4
  invoke void @_ZN4agge14style_modifierC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(46) %0, ptr noundef nonnull align 8 dereferenceable(46) %3)
          to label %16 unwind label %17

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4 align 2

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