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

; 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.RcString = type { ptr }
%"struct.AST::ExprNode_Field" = type { %"class.AST::ExprNode", %"class.AST::ExprNodeP", %class.RcString }
%"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 nounwind uwtable
declare dso_local void @_ZN8RcStringC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3AST14ExprNode_Field5cloneEv(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %1) unnamed_addr #5 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.RcString, 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 56) #6
  store i1 true, ptr %9, align 1
  %13 = getelementptr inbounds %"struct.AST::ExprNode_Field", ptr %10, i32 0, i32 1
  %14 = invoke noundef ptr @_ZNK3AST9ExprNodePptEv(ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %15 unwind label %24

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

19:                                               ; preds = %15
  %20 = getelementptr inbounds %"struct.AST::ExprNode_Field", ptr %10, i32 0, i32 2
  invoke void @_ZN8RcStringC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %20)
          to label %21 unwind label %28

21:                                               ; preds = %19
  invoke void @_ZN3AST14ExprNode_FieldC2ENS_9ExprNodePE8RcString(ptr noundef nonnull align 8 dereferenceable(56) %12, ptr noundef %5, ptr noundef %8)
          to label %22 unwind label %32

22:                                               ; preds = %21
  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 %23 unwind label %32

23:                                               ; preds = %22
  call void @_ZN8RcStringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  ret void

24:                                               ; preds = %15, %2
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %6, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %7, align 4
  br label %37

28:                                               ; preds = %19
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %6, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %7, align 4
  br label %36

32:                                               ; preds = %22, %21
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %6, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %7, align 4
  call void @_ZN8RcStringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br label %36

36:                                               ; preds = %32, %28
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br label %37

37:                                               ; preds = %36, %24
  %38 = load i1, ptr %9, align 1
  br i1 %38, label %39, label %40

39:                                               ; preds = %37
  call void @_ZdlPvm(ptr noundef %12, i64 noundef 56) #8
  br label %40

40:                                               ; preds = %39, %37
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %6, align 8
  %43 = load i32, ptr %7, align 4
  %44 = insertvalue { ptr, i32 } poison, ptr %42, 0
  %45 = insertvalue { ptr, i32 } %44, i32 %43, 1
  resume { ptr, i32 } %45
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3AST14ExprNode_FieldC2ENS_9ExprNodePE8RcString(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef) unnamed_addr #5 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 = { 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 #5 = { 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 = { builtin allocsize(0) }
attributes #7 = { nounwind }
attributes #8 = { 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, !10, i64 0}
!10 = !{!"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 }
%class.RcString = 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 nounwind uwtable
declare dso_local void @_ZN8RcStringC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3AST14ExprNode_Field5cloneEv(ptr dead_on_unwind noalias writable sret(%"class.AST::ExprNodeP") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %1) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.AST::ExprNodeP", align 8
  %4 = alloca %class.RcString, 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(56) ptr @_Znwm(i64 noundef 56) #6
  %7 = getelementptr inbounds i8, ptr %1, i64 40
  %8 = tail call noundef ptr @_ZNK3AST9ExprNodePptEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 32
  %11 = load ptr, ptr %10, align 8
  invoke void %11(ptr dead_on_unwind nonnull writable sret(%"class.AST::ExprNodeP") align 8 %3, ptr noundef nonnull align 8 dereferenceable(40) %8)
          to label %12 unwind label %.thread

12:                                               ; preds = %2
  %13 = getelementptr inbounds i8, ptr %1, i64 48
  call void @_ZN8RcStringC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %13)
  invoke void @_ZN3AST14ExprNode_FieldC2ENS_9ExprNodePE8RcString(ptr noundef nonnull align 8 dereferenceable(56) %6, ptr noundef nonnull %3, ptr noundef nonnull %4)
          to label %14 unwind label %17

14:                                               ; preds = %12
  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 %15 unwind label %17

15:                                               ; preds = %14
  call void @_ZN8RcStringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  ret void

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

17:                                               ; preds = %12, %14
  %.0 = phi i1 [ false, %14 ], [ true, %12 ]
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8RcStringD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @_ZN3AST9ExprNodePD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  br i1 %.0, label %19, label %20

19:                                               ; preds = %.thread, %17
  %.pn9 = phi { ptr, i32 } [ %16, %.thread ], [ %18, %17 ]
  call void @_ZdlPvm(ptr noundef nonnull %6, i64 noundef 56) #8
  br label %20

20:                                               ; preds = %17, %19
  %.pn8 = phi { ptr, i32 } [ %18, %17 ], [ %.pn9, %19 ]
  resume { ptr, i32 } %.pn8
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3AST14ExprNode_FieldC2ENS_9ExprNodePE8RcString(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef) unnamed_addr #5 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 = { 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 #5 = { 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 = { builtin allocsize(0) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


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