; 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::FunctionSignatureNode" = type { %"struct.llvh::ms_demangle::TypeNode.base", i32, i8, i16, i32, ptr, i8, ptr }
%"struct.llvh::ms_demangle::TypeNode.base" = type { %"struct.llvh::ms_demangle::Node.base", i8 }
%"struct.llvh::ms_demangle::Node.base" = type <{ ptr, i32 }>

@.str.103 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.106 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.107 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.108 = external hidden unnamed_addr constant [9 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
define dso_local void @_ZNK4llvh11ms_demangle21FunctionSignatureNode9outputPreER12OutputStreamNS0_11OutputFlagsE(ptr noundef nonnull align 8 dereferenceable(56) %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
  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
  %11 = load ptr, ptr %4, align 8
  %12 = getelementptr inbounds %"struct.llvh::ms_demangle::FunctionSignatureNode", ptr %11, i32 0, i32 3
  %13 = load i16, ptr %12, align 2, !tbaa !11
  %14 = zext i16 %13 to i32
  %15 = and i32 %14, 8
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %31, label %17

17:                                               ; preds = %3
  %18 = getelementptr inbounds %"struct.llvh::ms_demangle::FunctionSignatureNode", ptr %11, i32 0, i32 3
  %19 = load i16, ptr %18, align 2, !tbaa !11
  %20 = zext i16 %19 to i32
  %21 = and i32 %20, 16
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %30

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

30:                                               ; preds = %23, %17
  br label %31

31:                                               ; preds = %30, %3
  %32 = getelementptr inbounds %"struct.llvh::ms_demangle::FunctionSignatureNode", ptr %11, i32 0, i32 3
  %33 = load i16, ptr %32, align 2, !tbaa !11
  %34 = zext i16 %33 to i32
  %35 = and i32 %34, 128
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %44

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

44:                                               ; preds = %37, %31
  %45 = getelementptr inbounds %"struct.llvh::ms_demangle::FunctionSignatureNode", ptr %11, i32 0, i32 3
  %46 = load i16, ptr %45, align 2, !tbaa !11
  %47 = zext i16 %46 to i32
  %48 = and i32 %47, 32
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %57

50:                                               ; preds = %44
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef @.str.108)
  %52 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8
  %54 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8
  %56 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %51, ptr %53, ptr %55)
  br label %57

57:                                               ; preds = %50, %44
  %58 = getelementptr inbounds %"struct.llvh::ms_demangle::FunctionSignatureNode", ptr %11, i32 0, i32 5
  %59 = load ptr, ptr %58, align 8, !tbaa !22
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %75

61:                                               ; preds = %57
  %62 = getelementptr inbounds %"struct.llvh::ms_demangle::FunctionSignatureNode", ptr %11, i32 0, i32 5
  %63 = load ptr, ptr %62, align 8, !tbaa !22
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = load ptr, ptr %63, align 8, !tbaa !23
  %67 = getelementptr inbounds ptr, ptr %66, i64 3
  %68 = load ptr, ptr %67, align 8
  call void %68(ptr noundef nonnull align 8 dereferenceable(13) %63, ptr noundef nonnull align 8 dereferenceable(32) %64, i32 noundef %65)
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef @.str.103)
  %70 = getelementptr inbounds { ptr, ptr }, ptr %10, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8
  %72 = getelementptr inbounds { ptr, ptr }, ptr %10, i32 0, i32 1
  %73 = load ptr, ptr %72, align 8
  %74 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %69, ptr %71, ptr %73)
  br label %75

75:                                               ; preds = %61, %57
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = and i32 %76, 1
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %83, label %79

79:                                               ; preds = %75
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.llvh::ms_demangle::FunctionSignatureNode", ptr %11, i32 0, i32 2
  %82 = load i8, ptr %81, align 4, !tbaa !25
  call void @_ZL23outputCallingConventionR12OutputStreamN4llvh11ms_demangle11CallingConvE(ptr noundef nonnull align 8 dereferenceable(32) %80, i8 noundef zeroext %82)
  br label %83

83:                                               ; preds = %79, %75
  ret void
}

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

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, !19, i64 22}
!12 = !{!"_ZTSN4llvh11ms_demangle21FunctionSignatureNodeE", !13, i64 0, !17, i64 16, !18, i64 20, !19, i64 22, !20, i64 24, !6, i64 32, !21, i64 40, !6, i64 48}
!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_demangle15PointerAffinityE", !7, i64 0}
!18 = !{!"_ZTSN4llvh11ms_demangle11CallingConvE", !7, i64 0}
!19 = !{!"_ZTSN4llvh11ms_demangle9FuncClassE", !7, i64 0}
!20 = !{!"_ZTSN4llvh11ms_demangle20FunctionRefQualifierE", !7, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!12, !6, i64 32}
!23 = !{!24, !24, i64 0}
!24 = !{!"vtable pointer", !8, i64 0}
!25 = !{!12, !18, i64 20}


; 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.106 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.107 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.108 = external hidden unnamed_addr constant [9 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_demangle21FunctionSignatureNode9outputPreER12OutputStreamNS0_11OutputFlagsE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(56) %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 = getelementptr inbounds i8, ptr %0, i64 22
  %9 = load i16, ptr %8, align 2, !tbaa !5
  %10 = and i16 %9, 24
  %or.cond.not = icmp eq i16 %10, 16
  br i1 %or.cond.not, label %11, label %16

11:                                               ; preds = %3
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull @.str.106)
  %12 = load ptr, ptr %4, align 8
  %13 = getelementptr inbounds i8, ptr %4, i64 8
  %14 = load ptr, ptr %13, align 8
  %15 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %12, ptr %14)
  %.pre = load i16, ptr %8, align 2, !tbaa !5
  br label %16

16:                                               ; preds = %11, %3
  %17 = phi i16 [ %.pre, %11 ], [ %9, %3 ]
  %18 = and i16 %17, 128
  %.not9 = icmp eq i16 %18, 0
  br i1 %.not9, label %24, label %19

19:                                               ; preds = %16
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull @.str.107)
  %20 = load ptr, ptr %5, align 8
  %21 = getelementptr inbounds i8, ptr %5, i64 8
  %22 = load ptr, ptr %21, align 8
  %23 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %20, ptr %22)
  %.pre13 = load i16, ptr %8, align 2, !tbaa !5
  br label %24

24:                                               ; preds = %19, %16
  %25 = phi i16 [ %.pre13, %19 ], [ %17, %16 ]
  %26 = and i16 %25, 32
  %.not10 = icmp eq i16 %26, 0
  br i1 %.not10, label %32, label %27

27:                                               ; preds = %24
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull @.str.108)
  %28 = load ptr, ptr %6, align 8
  %29 = getelementptr inbounds i8, ptr %6, i64 8
  %30 = load ptr, ptr %29, align 8
  %31 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %28, ptr %30)
  br label %32

32:                                               ; preds = %27, %24
  %33 = getelementptr inbounds i8, ptr %0, i64 32
  %34 = load ptr, ptr %33, align 8, !tbaa !19
  %.not11 = icmp eq ptr %34, null
  br i1 %.not11, label %43, label %35

35:                                               ; preds = %32
  %36 = load ptr, ptr %34, align 8, !tbaa !20
  %37 = getelementptr inbounds i8, ptr %36, i64 24
  %38 = load ptr, ptr %37, align 8
  call void %38(ptr noundef nonnull align 8 dereferenceable(13) %34, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %2)
  call void @_ZN10StringViewC2EPKc(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull @.str.103)
  %39 = load ptr, ptr %7, align 8
  %40 = getelementptr inbounds i8, ptr %7, i64 8
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN12OutputStreamlsE10StringView(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr %39, ptr %41)
  br label %43

43:                                               ; preds = %35, %32
  %44 = and i32 %2, 1
  %.not12 = icmp eq i32 %44, 0
  br i1 %.not12, label %45, label %48

45:                                               ; preds = %43
  %46 = getelementptr inbounds i8, ptr %0, i64 20
  %47 = load i8, ptr %46, align 4, !tbaa !22
  call void @_ZL23outputCallingConventionR12OutputStreamN4llvh11ms_demangle11CallingConvE(ptr noundef nonnull align 8 dereferenceable(32) %1, i8 noundef zeroext %47)
  br label %48

48:                                               ; preds = %45, %43
  ret void
}

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

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 22}
!6 = !{!"_ZTSN4llvh11ms_demangle21FunctionSignatureNodeE", !7, i64 0, !13, i64 16, !14, i64 20, !15, i64 22, !16, i64 24, !17, i64 32, !18, i64 40, !17, i64 48}
!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 = !{!"_ZTSN4llvh11ms_demangle15PointerAffinityE", !10, i64 0}
!14 = !{!"_ZTSN4llvh11ms_demangle11CallingConvE", !10, i64 0}
!15 = !{!"_ZTSN4llvh11ms_demangle9FuncClassE", !10, i64 0}
!16 = !{!"_ZTSN4llvh11ms_demangle20FunctionRefQualifierE", !10, i64 0}
!17 = !{!"any pointer", !10, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{!6, !17, i64 32}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !11, i64 0}
!22 = !{!6, !14, i64 20}


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