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

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

72:                                               ; preds = %2
  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

73:                                               ; preds = %2
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %6, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, 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 %77

77:                                               ; preds = %73
  %78 = load ptr, ptr %6, align 8
  %79 = load i32, ptr %7, align 4
  %80 = insertvalue { ptr, i32 } poison, ptr %78, 0
  %81 = insertvalue { ptr, i32 } %80, i32 %79, 1
  resume { ptr, i32 } %81
}

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 = !{!"bool", !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}
!14 = !{i8 0, i8 2}
!15 = !{}


; 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 @_ZN4agge5style6italicEb(ptr dead_on_unwind noalias writable sret(%"struct.agge::style_modifier") align 8 %0, i1 noundef zeroext %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
  %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
  %11 = select i1 %1, i32 16777216, i32 0
  %12 = or disjoint i32 %6, %11
  store i32 %12, ptr %4, align 8
  %13 = or disjoint i16 %10, 128
  store i16 %13, 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 %14 unwind label %15

14:                                               ; preds = %2
  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

15:                                               ; preds = %2
  %16 = 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 } %16
}

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: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass