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

; 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 @_ZN4agge5style12height_scaleEd(ptr dead_on_unwind noalias writable sret(%"struct.agge::style_modifier") align 8 %0, double noundef %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, 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 double %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 double, ptr %4, align 8, !tbaa !5
  %56 = fmul double 2.560000e+02, %55
  %57 = fptosi double %56 to i32
  %58 = getelementptr inbounds %"struct.agge::style_modifier", ptr %5, i32 0, i32 0
  %59 = getelementptr inbounds %"struct.agge::font_descriptor", ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 8
  %61 = and i32 %57, 1048575
  %62 = and i32 %60, -1048576
  %63 = or i32 %62, %61
  store i32 %63, ptr %59, align 8
  %64 = getelementptr inbounds %"struct.agge::style_modifier", ptr %5, i32 0, i32 2
  %65 = load i16, ptr %64, align 4
  %66 = and i16 %65, -29
  %67 = or i16 %66, 16
  store i16 %67, ptr %64, align 4
  invoke void @_ZN4agge14style_modifierC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(46) %0, ptr noundef nonnull align 8 dereferenceable(46) %5)
          to label %68 unwind label %69

68:                                               ; 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

69:                                               ; preds = %2
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %6, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, 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 %73

73:                                               ; preds = %69
  %74 = load ptr, ptr %6, align 8
  %75 = load i32, ptr %7, align 4
  %76 = insertvalue { ptr, i32 } poison, ptr %74, 0
  %77 = insertvalue { ptr, i32 } %76, i32 %75, 1
  resume { ptr, i32 } %77
}

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 = !{!"double", !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 @_ZN4agge5style12height_scaleEd(ptr dead_on_unwind noalias writable sret(%"struct.agge::style_modifier") align 8 %0, double noundef %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 = fmul double %1, 2.560000e+02
  %12 = fptosi double %11 to i32
  %13 = and i32 %12, 1048575
  %14 = or disjoint i32 %6, %13
  store i32 %14, ptr %4, align 8
  %15 = or disjoint i16 %10, 16
  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 = %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

17:                                               ; preds = %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
}

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,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass