; LLVM IR from thepowersgang/mrustc :: src/ast/expr.ll (ZNK3AST15ExprNode_Assign5cloneEv)

; 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 }
%"struct.AST::ExprNode_Assign" = type { %"class.AST::ExprNode", i32, %"class.AST::ExprNodeP", %"class.AST::ExprNodeP" }
%"class.AST::ExprNode" = type { ptr, %"class.AST::AttributeList", %struct.Span }
%"class.AST::AttributeList" = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<AST::Attribute, std::allocator<AST::Attribute>>::_Vector_impl" }
%"struct.std::_Vector_base<AST::Attribute, std::allocator<AST::Attribute>>::_Vector_impl" = type { %"struct.std::_Vector_base<AST::Attribute, std::allocator<AST::Attribute>>::_Vector_impl_data" }
%"struct.std::_Vector_base<AST::Attribute, std::allocator<AST::Attribute>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Span = type { ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3AST9ExprNodePptEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3AST8ExprNode4spanEv(ptr noundef nonnull align 8 dereferenceable(40)) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3AST15ExprNode_Assign5cloneEv(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(64) %1) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.AST::ExprNodeP", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.AST::ExprNodeP", align 8
  %9 = alloca i1, align 1
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3AST8ExprNode4spanEv(ptr noundef nonnull align 8 dereferenceable(40) %10)
  %12 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 64) #5
  store i1 true, ptr %9, align 1
  %13 = getelementptr inbounds %"struct.AST::ExprNode_Assign", ptr %10, i32 0, i32 1
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds %"struct.AST::ExprNode_Assign", ptr %10, i32 0, i32 2
  %16 = invoke noundef ptr @_ZNK3AST9ExprNodePptEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %17 unwind label %31

17:                                               ; preds = %2
  %18 = load ptr, ptr %16, align 8, !tbaa !20
  %19 = getelementptr inbounds ptr, ptr %18, i64 4
  %20 = load ptr, ptr %19, align 8
  invoke void %20(ptr dead_on_unwind writable sret(%"class.AST::ExprNodeP") align 8 %5, ptr noundef nonnull align 8 dereferenceable(40) %16)
          to label %21 unwind label %31

21:                                               ; preds = %17
  %22 = getelementptr inbounds %"struct.AST::ExprNode_Assign", ptr %10, i32 0, i32 3
  %23 = invoke noundef ptr @_ZNK3AST9ExprNodePptEv(ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %24 unwind label %35

24:                                               ; preds = %21
  %25 = load ptr, ptr %23, align 8, !tbaa !20
  %26 = getelementptr inbounds ptr, ptr %25, i64 4
  %27 = load ptr, ptr %26, align 8
  invoke void %27(ptr dead_on_unwind writable sret(%"class.AST::ExprNodeP") align 8 %8, ptr noundef nonnull align 8 dereferenceable(40) %23)
          to label %28 unwind label %35

28:                                               ; preds = %24
  invoke void @_ZN3AST15ExprNode_AssignC2ENS0_9OperationENS_9ExprNodePES2_(ptr noundef nonnull align 8 dereferenceable(64) %12, i32 noundef %14, ptr noundef %5, ptr noundef %8)
          to label %29 unwind label %39

29:                                               ; preds = %28
  store i1 false, ptr %9, align 1
  invoke void @_ZN3AST12_GLOBAL__N_112mk_exprnodepERK4SpanPNS_8ExprNodeE(ptr dead_on_unwind writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef %12)
          to label %30 unwind label %39

30:                                               ; preds = %29
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  ret void

31:                                               ; preds = %17, %2
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %6, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %7, align 4
  br label %44

35:                                               ; preds = %24, %21
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %6, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %7, align 4
  br label %43

39:                                               ; preds = %29, %28
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %6, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %7, align 4
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  br label %43

43:                                               ; preds = %39, %35
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br label %44

44:                                               ; preds = %43, %31
  %45 = load i1, ptr %9, align 1
  br i1 %45, label %46, label %47

46:                                               ; preds = %44
  call void @_ZdlPvm(ptr noundef %12, i64 noundef 64) #7
  br label %47

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

48:                                               ; preds = %47
  %49 = load ptr, ptr %6, align 8
  %50 = load i32, ptr %7, align 4
  %51 = insertvalue { ptr, i32 } poison, ptr %49, 0
  %52 = insertvalue { ptr, i32 } %51, i32 %50, 1
  resume { ptr, i32 } %52
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3AST15ExprNode_AssignC2ENS0_9OperationENS_9ExprNodePES2_(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef, ptr noundef, ptr noundef) unnamed_addr #4 align 2

declare void @_ZN3AST9ExprNodePD1Ev(ptr)

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { 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 #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 = { builtin allocsize(0) }
attributes #6 = { nounwind }
attributes #7 = { 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"}
!9 = !{!10, !18, i64 40}
!10 = !{!"_ZTSN3AST15ExprNode_AssignE", !11, i64 0, !18, i64 40, !19, i64 48, !19, i64 56}
!11 = !{!"_ZTSN3AST8ExprNodeE", !12, i64 8, !17, i64 32}
!12 = !{!"_ZTSN3AST13AttributeListE", !13, i64 0}
!13 = !{!"_ZTSSt6vectorIN3AST9AttributeESaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIN3AST9AttributeESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIN3AST9AttributeESaIS1_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN3AST9AttributeESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"_ZTS4Span", !6, i64 0}
!18 = !{!"_ZTSN3AST15ExprNode_Assign9OperationE", !7, i64 0}
!19 = !{!"_ZTSN3AST9ExprNodePE", !6, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !8, 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"

%"class.AST::ExprNodeP" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3AST9ExprNodePptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3AST8ExprNode4spanEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3AST15ExprNode_Assign5cloneEv(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(64) %1) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.AST::ExprNodeP", align 8
  %4 = alloca %"class.AST::ExprNodeP", align 8
  %5 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK3AST8ExprNode4spanEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %6 = tail call noalias noundef nonnull dereferenceable(64) ptr @_Znwm(i64 noundef 64) #5
  %7 = getelementptr inbounds i8, ptr %1, i64 40
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 48
  %10 = tail call noundef ptr @_ZNK3AST9ExprNodePptEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
  %11 = load ptr, ptr %10, align 8, !tbaa !19
  %12 = getelementptr inbounds i8, ptr %11, i64 32
  %13 = load ptr, ptr %12, align 8
  invoke void %13(ptr dead_on_unwind nonnull writable sret(%"class.AST::ExprNodeP") align 8 %3, ptr noundef nonnull align 8 dereferenceable(40) %10)
          to label %14 unwind label %.thread

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %1, i64 56
  %16 = call noundef ptr @_ZNK3AST9ExprNodePptEv(ptr noundef nonnull align 8 dereferenceable(8) %15)
  %17 = load ptr, ptr %16, align 8, !tbaa !19
  %18 = getelementptr inbounds i8, ptr %17, i64 32
  %19 = load ptr, ptr %18, align 8
  invoke void %19(ptr dead_on_unwind nonnull writable sret(%"class.AST::ExprNodeP") align 8 %4, ptr noundef nonnull align 8 dereferenceable(40) %16)
          to label %20 unwind label %.thread13

20:                                               ; preds = %14
  invoke void @_ZN3AST15ExprNode_AssignC2ENS0_9OperationENS_9ExprNodePES2_(ptr noundef nonnull align 8 dereferenceable(64) %6, i32 noundef %8, ptr noundef nonnull %3, ptr noundef nonnull %4)
          to label %21 unwind label %25

21:                                               ; preds = %20
  invoke void @_ZN3AST12_GLOBAL__N_112mk_exprnodepERK4SpanPNS_8ExprNodeE(ptr dead_on_unwind writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull %6)
          to label %22 unwind label %25

22:                                               ; preds = %21
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  ret void

.thread:                                          ; preds = %2
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %27

.thread13:                                        ; preds = %14
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br label %27

25:                                               ; preds = %20, %21
  %.0 = phi i1 [ false, %21 ], [ true, %20 ]
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br i1 %.0, label %27, label %28

27:                                               ; preds = %.thread13, %.thread, %25
  %.pn.pn12 = phi { ptr, i32 } [ %23, %.thread ], [ %26, %25 ], [ %24, %.thread13 ]
  call void @_ZdlPvm(ptr noundef nonnull %6, i64 noundef 64) #7
  br label %28

28:                                               ; preds = %25, %27
  %.pn.pn11 = phi { ptr, i32 } [ %26, %25 ], [ %.pn.pn12, %27 ]
  resume { ptr, i32 } %.pn.pn11
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3AST15ExprNode_AssignC2ENS0_9OperationENS_9ExprNodePES2_(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef, ptr noundef, ptr noundef) unnamed_addr #4 align 2

declare void @_ZN3AST9ExprNodePD1Ev(ptr) local_unnamed_addr

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { 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 #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 = { builtin allocsize(0) }
attributes #6 = { nounwind }
attributes #7 = { 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, !17, i64 40}
!6 = !{!"_ZTSN3AST15ExprNode_AssignE", !7, i64 0, !17, i64 40, !18, i64 48, !18, i64 56}
!7 = !{!"_ZTSN3AST8ExprNodeE", !8, i64 8, !16, i64 32}
!8 = !{!"_ZTSN3AST13AttributeListE", !9, i64 0}
!9 = !{!"_ZTSSt6vectorIN3AST9AttributeESaIS1_EE", !10, i64 0}
!10 = !{!"_ZTSSt12_Vector_baseIN3AST9AttributeESaIS1_EE", !11, i64 0}
!11 = !{!"_ZTSNSt12_Vector_baseIN3AST9AttributeESaIS1_EE12_Vector_implE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseIN3AST9AttributeESaIS1_EE17_Vector_impl_dataE", !13, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"any pointer", !14, i64 0}
!14 = !{!"omnipotent char", !15, i64 0}
!15 = !{!"Simple C++ TBAA"}
!16 = !{!"_ZTS4Span", !13, i64 0}
!17 = !{!"_ZTSN3AST15ExprNode_Assign9OperationE", !14, i64 0}
!18 = !{!"_ZTSN3AST9ExprNodePE", !13, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !15, i64 0}


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