; LLVM IR from ASDAlexander77/TypeScriptCompiler :: tsc/tsc-new-parser (parenthesizer_rules)

; 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.ptr = type { %"class.std::shared_ptr" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%struct.ptr.17 = type { %"class.std::shared_ptr.18" }
%"class.std::shared_ptr.18" = type { %"class.std::__shared_ptr.19" }
%"class.std::__shared_ptr.19" = type { ptr, %"class.std::__shared_count" }
%"struct.ts::ParenthesizerRules" = type { ptr }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2ts18ParenthesizerRules44parenthesizeExpressionOfComputedPropertyNameE3ptrINS_4data10ExpressionEE(ptr dead_on_unwind noalias writable sret(%struct.ptr) align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.ptr.17, align 8
  %11 = alloca i1, align 1
  %12 = alloca %struct.ptr, align 8
  %13 = alloca i1, align 1
  %14 = alloca i1, align 1
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %5, align 8
  %16 = getelementptr inbounds %"struct.ts::ParenthesizerRules", ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = call noundef zeroext i1 @_ZN2ts11NodeFactory20NoParenthesizerRulesEv(ptr noundef nonnull align 8 dereferenceable(232) %17)
  br i1 %18, label %19, label %20

19:                                               ; preds = %3
  call void @_ZN3ptrIN2ts4data10ExpressionEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  br label %62

20:                                               ; preds = %3
  call void @_ZN3ptrIN2ts4data10ExpressionEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  store i1 false, ptr %11, align 1
  store i1 false, ptr %13, align 1
  store i1 false, ptr %14, align 1
  %21 = invoke noundef zeroext i1 @_ZN2tsL15isCommaSequenceE3ptrINS_4data10ExpressionEE(ptr noundef %7)
          to label %22 unwind label %39

22:                                               ; preds = %20
  br i1 %21, label %23, label %28

23:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  store i1 true, ptr %11, align 1
  %24 = getelementptr inbounds %"struct.ts::ParenthesizerRules", ptr %15, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  call void @_ZN3ptrIN2ts4data10ExpressionEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  store i1 true, ptr %13, align 1
  invoke void @_ZN2ts11NodeFactory29createParenthesizedExpressionE3ptrINS_4data10ExpressionEE(ptr dead_on_unwind writable sret(%struct.ptr.17) align 8 %10, ptr noundef nonnull align 8 dereferenceable(232) %25, ptr noundef %12)
          to label %26 unwind label %43

26:                                               ; preds = %23
  store i1 true, ptr %14, align 1
  invoke void @_ZN3ptrIN2ts4data23ParenthesizedExpressionEE2asIS_INS1_10ExpressionEEEET_v(ptr dead_on_unwind writable sret(%struct.ptr) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %10)
          to label %27 unwind label %47

27:                                               ; preds = %26
  br label %29

28:                                               ; preds = %22
  call void @_ZN3ptrIN2ts4data10ExpressionEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  br label %29

29:                                               ; preds = %28, %27
  %30 = load i1, ptr %14, align 1
  br i1 %30, label %31, label %32

31:                                               ; preds = %29
  call void @_ZN3ptrIN2ts4data23ParenthesizedExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  br label %32

32:                                               ; preds = %31, %29
  %33 = load i1, ptr %13, align 1
  br i1 %33, label %34, label %35

34:                                               ; preds = %32
  call void @_ZN3ptrIN2ts4data10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #6
  br label %35

35:                                               ; preds = %34, %32
  %36 = load i1, ptr %11, align 1
  br i1 %36, label %37, label %38

37:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  br label %38

38:                                               ; preds = %37, %35
  call void @_ZN3ptrIN2ts4data10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  br label %62

39:                                               ; preds = %20
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %8, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %9, align 4
  br label %61

43:                                               ; preds = %23
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %8, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %9, align 4
  br label %54

47:                                               ; preds = %26
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %8, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %9, align 4
  %51 = load i1, ptr %14, align 1
  br i1 %51, label %52, label %53

52:                                               ; preds = %47
  call void @_ZN3ptrIN2ts4data23ParenthesizedExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  br label %53

53:                                               ; preds = %52, %47
  br label %54

54:                                               ; preds = %53, %43
  %55 = load i1, ptr %13, align 1
  br i1 %55, label %56, label %57

56:                                               ; preds = %54
  call void @_ZN3ptrIN2ts4data10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #6
  br label %57

57:                                               ; preds = %56, %54
  %58 = load i1, ptr %11, align 1
  br i1 %58, label %59, label %60

59:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  br label %60

60:                                               ; preds = %59, %57
  br label %61

61:                                               ; preds = %60, %39
  call void @_ZN3ptrIN2ts4data10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  br label %63

62:                                               ; preds = %38, %19
  ret void

63:                                               ; preds = %61
  %64 = load ptr, ptr %8, align 8
  %65 = load i32, ptr %9, align 4
  %66 = insertvalue { ptr, i32 } poison, ptr %64, 0
  %67 = insertvalue { ptr, i32 } %66, i32 %65, 1
  resume { ptr, i32 } %67
}

declare noundef zeroext i1 @_ZN2ts11NodeFactory20NoParenthesizerRulesEv(ptr noundef nonnull align 8 dereferenceable(232)) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef zeroext i1 @_ZN2tsL15isCommaSequenceE3ptrINS_4data10ExpressionEE(ptr noundef) #4

declare void @_ZN2ts11NodeFactory29createParenthesizedExpressionE3ptrINS_4data10ExpressionEE(ptr dead_on_unwind writable sret(%struct.ptr.17) align 8, ptr noundef nonnull align 8 dereferenceable(232), ptr noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3ptrIN2ts4data23ParenthesizedExpressionEE2asIS_INS1_10ExpressionEEEET_v(ptr dead_on_unwind noalias writable sret(%struct.ptr) align 8, ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSN2ts18ParenthesizerRulesE", !6, i64 0}


; 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.ptr = type { %"class.std::shared_ptr" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%struct.ptr.17 = type { %"class.std::shared_ptr.18" }
%"class.std::shared_ptr.18" = type { %"class.std::__shared_ptr.19" }
%"class.std::__shared_ptr.19" = type { ptr, %"class.std::__shared_count" }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2ts18ParenthesizerRules44parenthesizeExpressionOfComputedPropertyNameE3ptrINS_4data10ExpressionEE(ptr dead_on_unwind noalias writable sret(%struct.ptr) align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1, ptr noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %struct.ptr, align 8
  %5 = alloca %struct.ptr.17, align 8
  %6 = alloca %struct.ptr, align 8
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  %8 = tail call noundef zeroext i1 @_ZN2ts11NodeFactory20NoParenthesizerRulesEv(ptr noundef nonnull align 8 dereferenceable(232) %7)
  br i1 %8, label %9, label %10

9:                                                ; preds = %3
  tail call void @_ZN3ptrIN2ts4data10ExpressionEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  br label %25

10:                                               ; preds = %3
  call void @_ZN3ptrIN2ts4data10ExpressionEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  %11 = invoke noundef zeroext i1 @_ZN2tsL15isCommaSequenceE3ptrINS_4data10ExpressionEE(ptr noundef nonnull %4)
          to label %12 unwind label %17

12:                                               ; preds = %10
  br i1 %11, label %13, label %16

13:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  call void @_ZN3ptrIN2ts4data10ExpressionEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  invoke void @_ZN2ts11NodeFactory29createParenthesizedExpressionE3ptrINS_4data10ExpressionEE(ptr dead_on_unwind nonnull writable sret(%struct.ptr.17) align 8 %5, ptr noundef nonnull align 8 dereferenceable(232) %14, ptr noundef nonnull %6)
          to label %15 unwind label %19

15:                                               ; preds = %13
  invoke void @_ZN3ptrIN2ts4data23ParenthesizedExpressionEE2asIS_INS1_10ExpressionEEEET_v(ptr dead_on_unwind writable sret(%struct.ptr) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %5)
          to label %.critedge unwind label %21

16:                                               ; preds = %12
  call void @_ZN3ptrIN2ts4data10ExpressionEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  br label %.critedge15

.critedge:                                        ; preds = %15
  call void @_ZN3ptrIN2ts4data23ParenthesizedExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @_ZN3ptrIN2ts4data10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  br label %.critedge15

.critedge15:                                      ; preds = %16, %.critedge
  call void @_ZN3ptrIN2ts4data10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  br label %25

17:                                               ; preds = %10
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %24

19:                                               ; preds = %13
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %23

21:                                               ; preds = %15
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3ptrIN2ts4data23ParenthesizedExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  br label %23

23:                                               ; preds = %19, %21
  %.pn = phi { ptr, i32 } [ %22, %21 ], [ %20, %19 ]
  call void @_ZN3ptrIN2ts4data10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  br label %24

24:                                               ; preds = %23, %17
  %.pn.pn = phi { ptr, i32 } [ %.pn, %23 ], [ %18, %17 ]
  call void @_ZN3ptrIN2ts4data10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  resume { ptr, i32 } %.pn.pn

25:                                               ; preds = %.critedge15, %9
  ret void
}

declare noundef zeroext i1 @_ZN2ts11NodeFactory20NoParenthesizerRulesEv(ptr noundef nonnull align 8 dereferenceable(232)) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef zeroext i1 @_ZN2tsL15isCommaSequenceE3ptrINS_4data10ExpressionEE(ptr noundef) local_unnamed_addr #4

declare void @_ZN2ts11NodeFactory29createParenthesizedExpressionE3ptrINS_4data10ExpressionEE(ptr dead_on_unwind writable sret(%struct.ptr.17) align 8, ptr noundef nonnull align 8 dereferenceable(232), ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3ptrIN2ts4data23ParenthesizedExpressionEE2asIS_INS1_10ExpressionEEEET_v(ptr dead_on_unwind noalias writable sret(%struct.ptr) align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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, !7, i64 0}
!6 = !{!"_ZTSN2ts18ParenthesizerRulesE", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


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