; 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::EncodedStringLiteralNode" = type { %"struct.llvh::ms_demangle::SymbolNode", %class.StringView, i8, i32 }
%"struct.llvh::ms_demangle::SymbolNode" = type { %"struct.llvh::ms_demangle::Node.base", ptr }
%"struct.llvh::ms_demangle::Node.base" = type <{ ptr, i32 }>

@.str.21 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [2 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4llvh11ms_demangle24EncodedStringLiteralNode6outputER12OutputStreamNS0_11OutputFlagsE(ptr noundef nonnull align 8 dereferenceable(48) %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
  %12 = alloca %class.StringView, align 8
  %13 = alloca %class.StringView, align 8
  %14 = 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
  %15 = load ptr, ptr %4, align 8
  %16 = getelementptr inbounds %"struct.llvh::ms_demangle::EncodedStringLiteralNode", ptr %15, i32 0, i32 3
  %17 = load i32, ptr %16, align 4, !tbaa !11
  switch i32 %17, label %46 [
    i32 3, label %18
    i32 0, label %25
    i32 1, label %32
    i32 2, label %39
  ]

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

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

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

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

46:                                               ; preds = %39, %32, %25, %18, %3
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.llvh::ms_demangle::EncodedStringLiteralNode", ptr %15, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %48, i64 16, i1 false), !tbaa.struct !19
  %49 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8
  %51 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8
  %53 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %47, ptr %50, ptr %52)
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef @.str.25)
  %54 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8
  %56 = getelementptr inbounds { ptr, ptr }, ptr %12, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8
  %58 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %53, ptr %55, ptr %57)
  %59 = getelementptr inbounds %"struct.llvh::ms_demangle::EncodedStringLiteralNode", ptr %15, i32 0, i32 2
  %60 = load i8, ptr %59, align 8, !tbaa !20, !range !21, !noundef !22
  %61 = trunc i8 %60 to i1
  br i1 %61, label %62, label %69

62:                                               ; preds = %46
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef @.str.26)
  %64 = getelementptr inbounds { ptr, ptr }, ptr %13, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8
  %66 = getelementptr inbounds { ptr, ptr }, ptr %13, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8
  %68 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %63, ptr %65, ptr %67)
  br label %69

69:                                               ; preds = %62, %46
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef @.str.27)
  %71 = getelementptr inbounds { ptr, ptr }, ptr %14, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8
  %73 = getelementptr inbounds { ptr, ptr }, ptr %14, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8
  %75 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %70, ptr %72, ptr %74)
  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" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!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, !18, i64 44}
!12 = !{!"_ZTSN4llvh11ms_demangle24EncodedStringLiteralNodeE", !13, i64 0, !16, i64 24, !17, i64 40, !18, i64 44}
!13 = !{!"_ZTSN4llvh11ms_demangle10SymbolNodeE", !14, i64 0, !6, i64 16}
!14 = !{!"_ZTSN4llvh11ms_demangle4NodeE", !15, i64 8}
!15 = !{!"_ZTSN4llvh11ms_demangle8NodeKindE", !7, i64 0}
!16 = !{!"_ZTS10StringView", !6, i64 0, !6, i64 8}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTSN4llvh11ms_demangle8CharKindE", !7, i64 0}
!19 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}
!20 = !{!12, !17, i64 40}
!21 = !{i8 0, i8 2}
!22 = !{}


; 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.21 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [2 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
define dso_local void @_ZNK4llvh11ms_demangle24EncodedStringLiteralNode6outputER12OutputStreamNS0_11OutputFlagsE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(48) %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 = alloca %class.StringView, align 8
  %10 = alloca %class.StringView, align 8
  %11 = getelementptr inbounds i8, ptr %0, i64 44
  %12 = load i32, ptr %11, align 4, !tbaa !5
  switch i32 %12, label %19 [
    i32 3, label %13
    i32 0, label %14
    i32 1, label %15
    i32 2, label %16
  ]

13:                                               ; 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.21)
  br label %.sink.split

14:                                               ; 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.22)
  br label %.sink.split

15:                                               ; 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.23)
  br label %.sink.split

16:                                               ; 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.24)
  br label %.sink.split

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

19:                                               ; preds = %.sink.split, %3
  %20 = getelementptr inbounds i8, ptr %0, i64 24
  %.sroa.0.0.copyload = load ptr, ptr %20, align 8, !tbaa !16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 32
  %.sroa.2.0.copyload = load ptr, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !16
  %21 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %.sroa.0.0.copyload, ptr %.sroa.2.0.copyload)
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull @.str.25)
  %22 = load ptr, ptr %8, align 8
  %23 = getelementptr inbounds i8, ptr %8, i64 8
  %24 = load ptr, ptr %23, align 8
  %25 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr %22, ptr %24)
  %26 = getelementptr inbounds i8, ptr %0, i64 40
  %27 = load i8, ptr %26, align 8, !tbaa !17, !range !18, !noundef !19
  %28 = trunc nuw i8 %27 to i1
  br i1 %28, label %29, label %34

29:                                               ; preds = %19
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull @.str.26)
  %30 = load ptr, ptr %9, align 8
  %31 = getelementptr inbounds i8, ptr %9, i64 8
  %32 = load ptr, ptr %31, align 8
  %33 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %30, ptr %32)
  br label %34

34:                                               ; preds = %29, %19
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull @.str.27)
  %35 = load ptr, ptr %10, align 8
  %36 = getelementptr inbounds i8, ptr %10, i64 8
  %37 = load ptr, ptr %36, align 8
  %38 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %35, ptr %37)
  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, !15, i64 44}
!6 = !{!"_ZTSN4llvh11ms_demangle24EncodedStringLiteralNodeE", !7, i64 0, !13, i64 24, !14, i64 40, !15, i64 44}
!7 = !{!"_ZTSN4llvh11ms_demangle10SymbolNodeE", !8, i64 0, !12, i64 16}
!8 = !{!"_ZTSN4llvh11ms_demangle4NodeE", !9, i64 8}
!9 = !{!"_ZTSN4llvh11ms_demangle8NodeKindE", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!"_ZTS10StringView", !12, i64 0, !12, i64 8}
!14 = !{!"bool", !10, i64 0}
!15 = !{!"_ZTSN4llvh11ms_demangle8CharKindE", !10, i64 0}
!16 = !{!12, !12, i64 0}
!17 = !{!6, !14, i64 40}
!18 = !{i8 0, i8 2}
!19 = !{}


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