; LLVM IR from facebook/hermes :: external/llvh/lib/Demangle (MicrosoftDemangleNodes)

; 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"

%class.StringView = type { ptr, ptr }
%"struct.llvh::ms_demangle::TagTypeNode" = type <{ %"struct.llvh::ms_demangle::TypeNode.base", [3 x i8], ptr, i32, [4 x i8] }>
%"struct.llvh::ms_demangle::TypeNode.base" = type { %"struct.llvh::ms_demangle::Node.base", i8 }
%"struct.llvh::ms_demangle::Node.base" = type <{ ptr, i32 }>
%"struct.llvh::ms_demangle::TypeNode" = type { %"struct.llvh::ms_demangle::Node.base", i8, [3 x i8] }

@.str.103 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.129 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.130 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.131 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL16outputQualifiersR12OutputStreamN4llvh11ms_demangle10QualifiersEbb(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef zeroext, i1 noundef zeroext, i1 noundef zeroext) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4llvh11ms_demangle11TagTypeNode9outputPreER12OutputStreamNS0_11OutputFlagsE(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %class.StringView, align 8
  %8 = alloca %class.StringView, align 8
  %9 = alloca %class.StringView, align 8
  %10 = alloca %class.StringView, align 8
  %11 = alloca %class.StringView, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8
  %13 = getelementptr inbounds %"struct.llvh::ms_demangle::TagTypeNode", ptr %12, i32 0, i32 3
  %14 = load i32, ptr %13, align 8, !tbaa !11
  switch i32 %14, label %43 [
    i32 0, label %15
    i32 1, label %22
    i32 2, label %29
    i32 3, label %36
  ]

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef @.str.128)
  %17 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8
  %19 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8
  %21 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr %18, ptr %20)
  br label %43

22:                                               ; preds = %3
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef @.str.129)
  %24 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8
  %26 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8
  %28 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr %25, ptr %27)
  br label %43

29:                                               ; preds = %3
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef @.str.130)
  %31 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8
  %33 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8
  %35 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %30, ptr %32, ptr %34)
  br label %43

36:                                               ; preds = %3
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef @.str.131)
  %38 = getelementptr inbounds { ptr, ptr }, ptr %10, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8
  %40 = getelementptr inbounds { ptr, ptr }, ptr %10, i32 0, i32 1
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %37, ptr %39, ptr %41)
  br label %43

43:                                               ; preds = %36, %29, %22, %15, %3
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef @.str.103)
  %45 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8
  %47 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8
  %49 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %44, ptr %46, ptr %48)
  %50 = getelementptr inbounds %"struct.llvh::ms_demangle::TagTypeNode", ptr %12, i32 0, i32 2
  %51 = load ptr, ptr %50, align 8, !tbaa !18
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = load ptr, ptr %51, align 8, !tbaa !19
  %55 = getelementptr inbounds ptr, ptr %54, i64 2
  %56 = load ptr, ptr %55, align 8
  call void %56(ptr noundef nonnull align 8 dereferenceable(24) %51, ptr noundef nonnull align 8 dereferenceable(32) %52, i32 noundef %53)
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.llvh::ms_demangle::TypeNode", ptr %12, i32 0, i32 1
  %59 = load i8, ptr %58, align 4, !tbaa !21
  call void @_ZL16outputQualifiersR12OutputStreamN4llvh11ms_demangle10QualifiersEbb(ptr noundef nonnull align 8 dereferenceable(32) %57, i8 noundef zeroext %59, i1 noundef zeroext true, i1 noundef zeroext false)
  ret void
}

attributes #0 = { 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 #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" }

!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 = !{!"_ZTSN4llvh11ms_demangle11OutputFlagsE", !7, i64 0}
!11 = !{!12, !17, i64 24}
!12 = !{!"_ZTSN4llvh11ms_demangle11TagTypeNodeE", !13, i64 0, !6, i64 16, !17, i64 24}
!13 = !{!"_ZTSN4llvh11ms_demangle8TypeNodeE", !14, i64 0, !16, i64 12}
!14 = !{!"_ZTSN4llvh11ms_demangle4NodeE", !15, i64 8}
!15 = !{!"_ZTSN4llvh11ms_demangle8NodeKindE", !7, i64 0}
!16 = !{!"_ZTSN4llvh11ms_demangle10QualifiersE", !7, i64 0}
!17 = !{!"_ZTSN4llvh11ms_demangle7TagKindE", !7, i64 0}
!18 = !{!12, !6, i64 16}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !8, i64 0}
!21 = !{!13, !16, i64 12}


; 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"

%class.StringView = type { ptr, ptr }

@.str.103 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.129 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.130 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.131 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL16outputQualifiersR12OutputStreamN4llvh11ms_demangle10QualifiersEbb(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef zeroext, i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4llvh11ms_demangle11TagTypeNode9outputPreER12OutputStreamNS0_11OutputFlagsE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(28) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca %class.StringView, align 8
  %5 = alloca %class.StringView, align 8
  %6 = alloca %class.StringView, align 8
  %7 = alloca %class.StringView, align 8
  %8 = alloca %class.StringView, align 8
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load i32, ptr %9, align 8, !tbaa !5
  switch i32 %10, label %17 [
    i32 0, label %11
    i32 1, label %12
    i32 2, label %13
    i32 3, label %14
  ]

11:                                               ; preds = %3
  %.sink10.sroa.gep13 = getelementptr inbounds i8, ptr %4, i64 8
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull @.str.128)
  br label %.sink.split

12:                                               ; preds = %3
  %.sink10.sroa.gep12 = getelementptr inbounds i8, ptr %5, i64 8
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull @.str.129)
  br label %.sink.split

13:                                               ; preds = %3
  %.sink10.sroa.gep11 = getelementptr inbounds i8, ptr %6, i64 8
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull @.str.130)
  br label %.sink.split

14:                                               ; preds = %3
  %.sink10.sroa.gep = getelementptr inbounds i8, ptr %7, i64 8
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull @.str.131)
  br label %.sink.split

.sink.split:                                      ; preds = %11, %12, %13, %14
  %.sink10.sroa.phi = phi ptr [ %.sink10.sroa.gep, %14 ], [ %.sink10.sroa.gep11, %13 ], [ %.sink10.sroa.gep12, %12 ], [ %.sink10.sroa.gep13, %11 ]
  %.sink10 = phi ptr [ %7, %14 ], [ %6, %13 ], [ %5, %12 ], [ %4, %11 ]
  %.sink = load ptr, ptr %.sink10, align 8
  %15 = load ptr, ptr %.sink10.sroa.phi, align 8
  %16 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %.sink, ptr %15)
  br label %17

17:                                               ; preds = %.sink.split, %3
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull @.str.103)
  %18 = load ptr, ptr %8, align 8
  %19 = getelementptr inbounds i8, ptr %8, i64 8
  %20 = load ptr, ptr %19, align 8
  %21 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %18, ptr %20)
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %25 = getelementptr inbounds i8, ptr %24, i64 16
  %26 = load ptr, ptr %25, align 8
  call void %26(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %2)
  %27 = getelementptr inbounds i8, ptr %0, i64 12
  %28 = load i8, ptr %27, align 4, !tbaa !18
  call void @_ZL16outputQualifiersR12OutputStreamN4llvh11ms_demangle10QualifiersEbb(ptr noundef nonnull align 8 dereferenceable(32) %1, i8 noundef zeroext %28, i1 noundef zeroext true, i1 noundef zeroext false)
  ret void
}

attributes #0 = { 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 #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" }

!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, !14, i64 24}
!6 = !{!"_ZTSN4llvh11ms_demangle11TagTypeNodeE", !7, i64 0, !13, i64 16, !14, i64 24}
!7 = !{!"_ZTSN4llvh11ms_demangle8TypeNodeE", !8, i64 0, !12, i64 12}
!8 = !{!"_ZTSN4llvh11ms_demangle4NodeE", !9, i64 8}
!9 = !{!"_ZTSN4llvh11ms_demangle8NodeKindE", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSN4llvh11ms_demangle10QualifiersE", !10, i64 0}
!13 = !{!"any pointer", !10, i64 0}
!14 = !{!"_ZTSN4llvh11ms_demangle7TagKindE", !10, i64 0}
!15 = !{!6, !13, i64 16}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !11, i64 0}
!18 = !{!7, !12, i64 12}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass