; 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.102 = type { %"class.std::shared_ptr.103" }
%"class.std::shared_ptr.103" = type { %"class.std::__shared_ptr.104" }
%"class.std::__shared_ptr.104" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%struct.ptr.97 = type { %"class.std::shared_ptr.98" }
%"class.std::shared_ptr.98" = type { %"class.std::__shared_ptr.99" }
%"class.std::__shared_ptr.99" = 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

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

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

declare void @_ZN2ts11NodeFactory23createParenthesizedTypeE3ptrINS_4data8TypeNodeEE(ptr dead_on_unwind writable sret(%struct.ptr.102) align 8, ptr noundef nonnull align 8 dereferenceable(232), ptr noundef) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2ts18ParenthesizerRules35parenthesizeMemberOfConditionalTypeE3ptrINS_4data8TypeNodeEE(ptr dead_on_unwind noalias writable sret(%struct.ptr.97) align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %2) #4 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.102, align 8
  %8 = alloca i1, align 1
  %9 = alloca %struct.ptr.97, align 8
  %10 = alloca i1, align 1
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = 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
  %14 = load ptr, ptr %5, align 8
  %15 = getelementptr inbounds %"struct.ts::ParenthesizerRules", ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = call noundef zeroext i1 @_ZN2ts11NodeFactory20NoParenthesizerRulesEv(ptr noundef nonnull align 8 dereferenceable(232) %16)
  br i1 %17, label %18, label %19

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

19:                                               ; preds = %3
  %20 = call noundef zeroext i1 @_ZN3ptrIN2ts4data8TypeNodeEEeqE10SyntaxKind(ptr noundef nonnull align 8 dereferenceable(16) %2, i32 noundef 194)
  store i1 false, ptr %8, align 1
  store i1 false, ptr %10, align 1
  store i1 false, ptr %13, align 1
  br i1 %20, label %21, label %26

21:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  store i1 true, ptr %8, align 1
  %22 = getelementptr inbounds %"struct.ts::ParenthesizerRules", ptr %14, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  call void @_ZN3ptrIN2ts4data8TypeNodeEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  store i1 true, ptr %10, align 1
  invoke void @_ZN2ts11NodeFactory23createParenthesizedTypeE3ptrINS_4data8TypeNodeEE(ptr dead_on_unwind writable sret(%struct.ptr.102) align 8 %7, ptr noundef nonnull align 8 dereferenceable(232) %23, ptr noundef %9)
          to label %24 unwind label %37

24:                                               ; preds = %21
  store i1 true, ptr %13, align 1
  invoke void @_ZN3ptrIN2ts4data21ParenthesizedTypeNodeEE2asIS_INS1_8TypeNodeEEEET_v(ptr dead_on_unwind writable sret(%struct.ptr.97) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %25 unwind label %41

25:                                               ; preds = %24
  br label %27

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

27:                                               ; preds = %26, %25
  %28 = load i1, ptr %13, align 1
  br i1 %28, label %29, label %30

29:                                               ; preds = %27
  call void @_ZN3ptrIN2ts4data21ParenthesizedTypeNodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  br label %30

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

32:                                               ; preds = %30
  call void @_ZN3ptrIN2ts4data8TypeNodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  br label %33

33:                                               ; preds = %32, %30
  %34 = load i1, ptr %8, align 1
  br i1 %34, label %35, label %36

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

36:                                               ; preds = %35, %33
  br label %55

37:                                               ; preds = %21
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %11, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %12, align 4
  br label %48

41:                                               ; preds = %24
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %11, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %12, align 4
  %45 = load i1, ptr %13, align 1
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  call void @_ZN3ptrIN2ts4data21ParenthesizedTypeNodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  br label %47

47:                                               ; preds = %46, %41
  br label %48

48:                                               ; preds = %47, %37
  %49 = load i1, ptr %10, align 1
  br i1 %49, label %50, label %51

50:                                               ; preds = %48
  call void @_ZN3ptrIN2ts4data8TypeNodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  br label %51

51:                                               ; preds = %50, %48
  %52 = load i1, ptr %8, align 1
  br i1 %52, label %53, label %54

53:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  br label %54

54:                                               ; preds = %53, %51
  br label %56

55:                                               ; preds = %36, %18
  ret void

56:                                               ; preds = %54
  %57 = load ptr, ptr %11, align 8
  %58 = load i32, ptr %12, align 4
  %59 = insertvalue { ptr, i32 } poison, ptr %57, 0
  %60 = insertvalue { ptr, i32 } %59, i32 %58, 1
  resume { ptr, i32 } %60
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3ptrIN2ts4data8TypeNodeEEeqE10SyntaxKind(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #2 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { 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 = { 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 = { 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 #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.102 = type { %"class.std::shared_ptr.103" }
%"class.std::shared_ptr.103" = type { %"class.std::__shared_ptr.104" }
%"class.std::__shared_ptr.104" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%struct.ptr.97 = type { %"class.std::shared_ptr.98" }
%"class.std::shared_ptr.98" = type { %"class.std::__shared_ptr.99" }
%"class.std::__shared_ptr.99" = 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

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

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

declare void @_ZN2ts11NodeFactory23createParenthesizedTypeE3ptrINS_4data8TypeNodeEE(ptr dead_on_unwind writable sret(%struct.ptr.102) align 8, ptr noundef nonnull align 8 dereferenceable(232), ptr noundef) local_unnamed_addr #1

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

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

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

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

9:                                                ; preds = %3
  %10 = tail call noundef zeroext i1 @_ZN3ptrIN2ts4data8TypeNodeEEeqE10SyntaxKind(ptr noundef nonnull align 8 dereferenceable(16) %2, i32 noundef 194)
  br i1 %10, label %11, label %14

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

13:                                               ; preds = %11
  invoke void @_ZN3ptrIN2ts4data21ParenthesizedTypeNodeEE2asIS_INS1_8TypeNodeEEEET_v(ptr dead_on_unwind writable sret(%struct.ptr.97) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %.critedge unwind label %17

14:                                               ; preds = %9
  tail call void @_ZN3ptrIN2ts4data8TypeNodeEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  br label %.critedge13

.critedge:                                        ; preds = %13
  call void @_ZN3ptrIN2ts4data21ParenthesizedTypeNodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  call void @_ZN3ptrIN2ts4data8TypeNodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  br label %.critedge13

15:                                               ; preds = %11
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %19

17:                                               ; preds = %13
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3ptrIN2ts4data21ParenthesizedTypeNodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  br label %19

19:                                               ; preds = %15, %17
  %.pn = phi { ptr, i32 } [ %18, %17 ], [ %16, %15 ]
  call void @_ZN3ptrIN2ts4data8TypeNodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  resume { ptr, i32 } %.pn

.critedge13:                                      ; preds = %14, %.critedge, %8
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3ptrIN2ts4data8TypeNodeEEeqE10SyntaxKind(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { 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 = { 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 = { 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 #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