; LLVM IR from thepowersgang/mrustc :: src/parse/expr.ll (Z14Parse_Expr_TryR11TokenStream)

; 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.AST::ExprNodeP" = type { ptr }
%class.TraceLog = type { ptr, %"class.std::function" }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }

@__func__._Z14Parse_Expr_TryR11TokenStream = external hidden unnamed_addr constant [15 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z19Parse_ExprBlockNodeR11TokenStream(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8, ptr noundef nonnull align 8 dereferenceable(176)) #1

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

declare noundef zeroext i1 @_Z13debug_enabledv() #3

declare void @_ZN8TraceLogC1EPKc(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) unnamed_addr #3

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #4

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #5

; Function Attrs: nounwind
declare void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZL12mk_exprnodepRK11TokenStreamPN3AST8ExprNodeE(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8, ptr noundef nonnull align 8 dereferenceable(176), ptr noundef) #6

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z14Parse_Expr_TryR11TokenStream(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(176) %1) #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %class.TraceLog, align 8
  %6 = alloca %"class.AST::ExprNodeP", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.AST::ExprNodeP", align 8
  %10 = alloca i1, align 1
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %5) #8
  %11 = call noundef zeroext i1 @_Z13debug_enabledv()
  %12 = zext i1 %11 to i64
  %13 = select i1 %11, ptr @__func__._Z14Parse_Expr_TryR11TokenStream, ptr null
  call void @_ZN8TraceLogC1EPKc(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_Z19Parse_ExprBlockNodeR11TokenStream(ptr dead_on_unwind writable sret(%"class.AST::ExprNodeP") align 8 %6, ptr noundef nonnull align 8 dereferenceable(176) %14)
          to label %15 unwind label %22

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 48) #9
          to label %18 unwind label %26

18:                                               ; preds = %15
  store i1 true, ptr %10, align 1
  invoke void @_ZN3AST9ExprNodePC2EOS0_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %19 unwind label %30

19:                                               ; preds = %18
  invoke void @_ZN3AST12ExprNode_TryC2ENS_9ExprNodePE(ptr noundef nonnull align 8 dereferenceable(48) %17, ptr noundef %9)
          to label %20 unwind label %34

20:                                               ; preds = %19
  store i1 false, ptr %10, align 1
  invoke void @_ZL12mk_exprnodepRK11TokenStreamPN3AST8ExprNodeE(ptr dead_on_unwind writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(176) %16, ptr noundef %17)
          to label %21 unwind label %34

21:                                               ; preds = %20
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #8
  ret void

22:                                               ; preds = %2
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %7, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %8, align 4
  br label %43

26:                                               ; preds = %15
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %7, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %8, align 4
  br label %42

30:                                               ; preds = %18
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %7, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %8, align 4
  br label %38

34:                                               ; preds = %20, %19
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %7, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %8, align 4
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  br label %38

38:                                               ; preds = %34, %30
  %39 = load i1, ptr %10, align 1
  br i1 %39, label %40, label %41

40:                                               ; preds = %38
  call void @_ZdlPvm(ptr noundef %17, i64 noundef 48) #10
  br label %41

41:                                               ; preds = %40, %38
  br label %42

42:                                               ; preds = %41, %26
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  br label %43

43:                                               ; preds = %42, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #8
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %7, align 8
  %46 = load i32, ptr %8, align 4
  %47 = insertvalue { ptr, i32 } poison, ptr %45, 0
  %48 = insertvalue { ptr, i32 } %47, i32 %46, 1
  resume { ptr, i32 } %48
}

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

attributes #0 = { nounwind "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 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { nobuiltin allocsize(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 = { nobuiltin nounwind "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 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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"}


; 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.AST::ExprNodeP" = type { ptr }
%class.TraceLog = type { ptr, %"class.std::function" }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }

@__func__._Z14Parse_Expr_TryR11TokenStream = external hidden unnamed_addr constant [15 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z19Parse_ExprBlockNodeR11TokenStream(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8, ptr noundef nonnull align 8 dereferenceable(176)) local_unnamed_addr #1

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

declare noundef zeroext i1 @_Z13debug_enabledv() local_unnamed_addr #3

declare void @_ZN8TraceLogC1EPKc(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) unnamed_addr #3

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #4

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZL12mk_exprnodepRK11TokenStreamPN3AST8ExprNodeE(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8, ptr noundef nonnull align 8 dereferenceable(176), ptr noundef) local_unnamed_addr #6

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z14Parse_Expr_TryR11TokenStream(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(176) %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.TraceLog, align 8
  %4 = alloca %"class.AST::ExprNodeP", align 8
  %5 = alloca %"class.AST::ExprNodeP", align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #8
  %6 = tail call noundef zeroext i1 @_Z13debug_enabledv()
  %7 = select i1 %6, ptr @__func__._Z14Parse_Expr_TryR11TokenStream, ptr null
  call void @_ZN8TraceLogC1EPKc(ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  invoke void @_Z19Parse_ExprBlockNodeR11TokenStream(ptr dead_on_unwind nonnull writable sret(%"class.AST::ExprNodeP") align 8 %4, ptr noundef nonnull align 8 dereferenceable(176) %1)
          to label %8 unwind label %13

8:                                                ; preds = %2
  %9 = invoke noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #9
          to label %10 unwind label %15

10:                                               ; preds = %8
  call void @_ZN3AST9ExprNodePC2EOS0_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %4)
  invoke void @_ZN3AST12ExprNode_TryC2ENS_9ExprNodePE(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull %5)
          to label %11 unwind label %19

11:                                               ; preds = %10
  invoke void @_ZL12mk_exprnodepRK11TokenStreamPN3AST8ExprNodeE(ptr dead_on_unwind writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(176) %1, ptr noundef nonnull %9)
          to label %12 unwind label %17

12:                                               ; preds = %11
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #8
  ret void

13:                                               ; preds = %2
  %14 = landingpad { ptr, i32 }
          cleanup
  br label %22

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

17:                                               ; preds = %11
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  br label %21

19:                                               ; preds = %10
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  call void @_ZdlPvm(ptr noundef nonnull %9, i64 noundef 48) #10
  br label %21

21:                                               ; preds = %17, %19, %15
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %18, %17 ], [ %16, %15 ]
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  br label %22

22:                                               ; preds = %21, %13
  %.pn.pn = phi { ptr, i32 } [ %.pn, %21 ], [ %14, %13 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #8
  resume { ptr, i32 } %.pn.pn
}

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

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


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