; LLVM IR from NervanaSystems/ngraph :: src/ngraph/op/avg_pool.ll (ZNK6ngraph2op2v115AvgPoolBackprop21get_forward_arg_shapeEv)

; 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.ngraph::Output" = type { %"class.std::shared_ptr.79", i64 }
%"class.std::shared_ptr.79" = type { %"class.std::__shared_ptr.80" }
%"class.std::__shared_ptr.80" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.ngraph::Shape" = type { %"class.std::vector.69" }
%"class.std::vector.69" = type { %"struct.std::_Vector_base.70" }
%"struct.std::_Vector_base.70" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" = type { ptr, ptr, 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: nounwind
declare void @_ZN6ngraph5ShapeD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN6ngraph5ShapeaSEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

declare void @_ZN6ngraph5ShapeC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3

declare void @_ZNK6ngraph4Node11input_valueEm(ptr dead_on_unwind writable sret(%"class.ngraph::Output") align 8, ptr noundef nonnull align 8 dereferenceable(680), i64 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6ngraph2op2v115AvgPoolBackprop21get_forward_arg_shapeEv(ptr dead_on_unwind noalias writable sret(%"class.ngraph::Shape") align 8 %0, ptr noundef nonnull align 8 dereferenceable(777) %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca %"class.ngraph::Output", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.ngraph::Shape", align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  store i1 false, ptr %5, align 1
  call void @_ZN6ngraph5ShapeC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  invoke void @_ZNK6ngraph4Node11input_valueEm(ptr dead_on_unwind writable sret(%"class.ngraph::Output") align 8 %7, ptr noundef nonnull align 8 dereferenceable(680) %11, i64 noundef 1)
          to label %12 unwind label %23

12:                                               ; preds = %2
  %13 = invoke noundef ptr @_ZNK6ngraph6OutputINS_4NodeEE8get_nodeEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %14 unwind label %27

14:                                               ; preds = %12
  %15 = invoke noundef ptr @_ZN6ngraph7as_typeINS_2op2v08ConstantEPNS_4NodeEEENSt9enable_ifIXsr3std14is_convertibleIDTscPT_clsr3stdE7declvalIT0_EEES8_EE5valueES8_E4typeES9_(ptr noundef %13)
          to label %16 unwind label %27

16:                                               ; preds = %14
  call void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  store ptr %15, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %36

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #5
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK6ngraph2op2v08Constant13get_shape_valEv(ptr dead_on_unwind writable sret(%"class.ngraph::Shape") align 8 %10, ptr noundef nonnull align 8 dereferenceable(729) %20)
          to label %21 unwind label %32

21:                                               ; preds = %19
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN6ngraph5ShapeaSEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  call void @_ZN6ngraph5ShapeD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #5
  br label %36

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

27:                                               ; preds = %14, %12
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %8, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %9, align 4
  call void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  br label %31

31:                                               ; preds = %27, %23
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  br label %38

32:                                               ; preds = %19
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %8, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #5
  br label %38

36:                                               ; preds = %21, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  store i1 true, ptr %5, align 1
  %37 = load i1, ptr %5, align 1
  br i1 %37, label %40, label %39

38:                                               ; preds = %32, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @_ZN6ngraph5ShapeD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %41

39:                                               ; preds = %36
  call void @_ZN6ngraph5ShapeD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %40

40:                                               ; preds = %39, %36
  ret void

41:                                               ; preds = %38
  %42 = load ptr, ptr %8, align 8
  %43 = load i32, ptr %9, 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 noundef ptr @_ZN6ngraph7as_typeINS_2op2v08ConstantEPNS_4NodeEEENSt9enable_ifIXsr3std14is_convertibleIDTscPT_clsr3stdE7declvalIT0_EEES8_EE5valueES8_E4typeES9_(ptr noundef) #4

declare noundef ptr @_ZNK6ngraph6OutputINS_4NodeEE8get_nodeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3

declare void @_ZNK6ngraph2op2v08Constant13get_shape_valEv(ptr dead_on_unwind writable sret(%"class.ngraph::Shape") align 8, ptr noundef nonnull align 8 dereferenceable(729)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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 = { 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.ngraph::Output" = type { %"class.std::shared_ptr.79", i64 }
%"class.std::shared_ptr.79" = type { %"class.std::__shared_ptr.80" }
%"class.std::__shared_ptr.80" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.ngraph::Shape" = type { %"class.std::vector.69" }
%"class.std::vector.69" = type { %"struct.std::_Vector_base.70" }
%"struct.std::_Vector_base.70" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: nounwind
declare void @_ZN6ngraph5ShapeD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN6ngraph5ShapeaSEOS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

declare void @_ZN6ngraph5ShapeC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3

declare void @_ZNK6ngraph4Node11input_valueEm(ptr dead_on_unwind writable sret(%"class.ngraph::Output") align 8, ptr noundef nonnull align 8 dereferenceable(680), i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6ngraph2op2v115AvgPoolBackprop21get_forward_arg_shapeEv(ptr dead_on_unwind noalias nonnull writable sret(%"class.ngraph::Shape") align 8 %0, ptr noundef nonnull align 8 dereferenceable(777) %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.ngraph::Output", align 8
  %4 = alloca %"class.ngraph::Shape", align 8
  tail call void @_ZN6ngraph5ShapeC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  invoke void @_ZNK6ngraph4Node11input_valueEm(ptr dead_on_unwind nonnull writable sret(%"class.ngraph::Output") align 8 %3, ptr noundef nonnull align 8 dereferenceable(680) %1, i64 noundef 1)
          to label %5 unwind label %13

5:                                                ; preds = %2
  %6 = invoke noundef ptr @_ZNK6ngraph6OutputINS_4NodeEE8get_nodeEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %7 unwind label %15

7:                                                ; preds = %5
  %8 = invoke noundef ptr @_ZN6ngraph7as_typeINS_2op2v08ConstantEPNS_4NodeEEENSt9enable_ifIXsr3std14is_convertibleIDTscPT_clsr3stdE7declvalIT0_EEES8_EE5valueES8_E4typeES9_(ptr noundef %6)
          to label %9 unwind label %15

9:                                                ; preds = %7
  call void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %21, label %10

10:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  invoke void @_ZNK6ngraph2op2v08Constant13get_shape_valEv(ptr dead_on_unwind nonnull writable sret(%"class.ngraph::Shape") align 8 %4, ptr noundef nonnull align 8 dereferenceable(729) %8)
          to label %11 unwind label %18

11:                                               ; preds = %10
  %12 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN6ngraph5ShapeaSEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @_ZN6ngraph5ShapeD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %21

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

15:                                               ; preds = %7, %5
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6ngraph6OutputINS_4NodeEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  br label %17

17:                                               ; preds = %15, %13
  %.pn = phi { ptr, i32 } [ %16, %15 ], [ %14, %13 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  br label %20

18:                                               ; preds = %10
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %20

20:                                               ; preds = %18, %17
  %.pn9 = phi { ptr, i32 } [ %19, %18 ], [ %.pn, %17 ]
  call void @_ZN6ngraph5ShapeD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  resume { ptr, i32 } %.pn9

21:                                               ; preds = %9, %11
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN6ngraph7as_typeINS_2op2v08ConstantEPNS_4NodeEEENSt9enable_ifIXsr3std14is_convertibleIDTscPT_clsr3stdE7declvalIT0_EEES8_EE5valueES8_E4typeES9_(ptr noundef) local_unnamed_addr #4

declare noundef ptr @_ZNK6ngraph6OutputINS_4NodeEE8get_nodeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3

declare void @_ZNK6ngraph2op2v08Constant13get_shape_valEv(ptr dead_on_unwind writable sret(%"class.ngraph::Shape") align 8, ptr noundef nonnull align 8 dereferenceable(729)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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 = { 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: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass