; LLVM IR from tyoma/agge :: src/agge/stroke.ll (ZN4agge6strokeC2Ev)

; 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.agge::stroke" = type { %"class.agge::vertex_sequence", %"class.agge::pod_vector.0", ptr, ptr, ptr, ptr, float, i32 }
%"class.agge::vertex_sequence" = type { %"class.agge::pod_vector" }
%"class.agge::pod_vector" = type { ptr, ptr, ptr }
%"class.agge::pod_vector.0" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4agge6strokeC2Ev(ptr noundef nonnull align 8 dereferenceable(88) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @_ZN4agge15vertex_sequenceC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @_ZN4agge11noncopyableC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  %6 = getelementptr inbounds %"class.agge::stroke", ptr %5, i32 0, i32 1
  invoke void @_ZN4agge10pod_vectorINS_5pointIfEEEC2Ej(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef 0)
          to label %7 unwind label %15

7:                                                ; preds = %1
  %8 = getelementptr inbounds %"class.agge::stroke", ptr %5, i32 0, i32 3
  %9 = getelementptr inbounds %"class.agge::stroke", ptr %5, i32 0, i32 1
  %10 = invoke noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %11 unwind label %19

11:                                               ; preds = %7
  store ptr %10, ptr %8, align 8, !tbaa !9
  %12 = getelementptr inbounds %"class.agge::stroke", ptr %5, i32 0, i32 4
  store ptr null, ptr %12, align 8, !tbaa !16
  %13 = getelementptr inbounds %"class.agge::stroke", ptr %5, i32 0, i32 5
  store ptr null, ptr %13, align 8, !tbaa !17
  %14 = getelementptr inbounds %"class.agge::stroke", ptr %5, i32 0, i32 7
  store i32 0, ptr %14, align 4, !tbaa !18
  ret void

15:                                               ; preds = %1
  %16 = landingpad { ptr, i32 }
          cleanup
  %17 = extractvalue { ptr, i32 } %16, 0
  store ptr %17, ptr %3, align 8
  %18 = extractvalue { ptr, i32 } %16, 1
  store i32 %18, ptr %4, align 4
  br label %23

19:                                               ; preds = %7
  %20 = landingpad { ptr, i32 }
          cleanup
  %21 = extractvalue { ptr, i32 } %20, 0
  store ptr %21, ptr %3, align 8
  %22 = extractvalue { ptr, i32 } %20, 1
  store i32 %22, ptr %4, align 4
  call void @_ZN4agge10pod_vectorINS_5pointIfEEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  br label %23

23:                                               ; preds = %19, %15
  call void @_ZN4agge10pod_vectorINS_6vertexEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  br label %24

24:                                               ; preds = %23
  %25 = load ptr, ptr %3, align 8
  %26 = load i32, ptr %4, align 4
  %27 = insertvalue { ptr, i32 } poison, ptr %25, 0
  %28 = insertvalue { ptr, i32 } %27, i32 %26, 1
  resume { ptr, i32 } %28
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4agge15vertex_sequenceC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4agge11noncopyableC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4agge10pod_vectorINS_5pointIfEEEC2Ej(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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

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

attributes #0 = { 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 #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 = { 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 = { 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 #4 = { 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 56}
!10 = !{!"_ZTSN4agge6strokeE", !11, i64 0, !13, i64 24, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !14, i64 80, !15, i64 84}
!11 = !{!"_ZTSN4agge15vertex_sequenceE", !12, i64 0}
!12 = !{!"_ZTSN4agge10pod_vectorINS_6vertexEEE", !6, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!"_ZTSN4agge10pod_vectorINS_5pointIfEEEE", !6, i64 0, !6, i64 8, !6, i64 16}
!14 = !{!"float", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!10, !6, i64 64}
!17 = !{!10, !6, i64 72}
!18 = !{!10, !15, i64 84}


; 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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4agge6strokeC2Ev(ptr noundef nonnull align 8 dereferenceable(88) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN4agge15vertex_sequenceC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0)
  tail call void @_ZN4agge11noncopyableC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) #5
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  invoke void @_ZN4agge10pod_vectorINS_5pointIfEEEC2Ej(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 0)
          to label %3 unwind label %8

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 56
  %5 = tail call noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  store ptr %5, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 64
  %7 = getelementptr inbounds i8, ptr %0, i64 84
  store i32 0, ptr %7, align 4, !tbaa !15
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %6, i8 0, i64 16, i1 false)
  ret void

8:                                                ; preds = %1
  %9 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN4agge10pod_vectorINS_6vertexEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  resume { ptr, i32 } %9
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4agge15vertex_sequenceC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4agge11noncopyableC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4agge10pod_vectorINS_5pointIfEEEC2Ej(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { 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 #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 = { 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !9, i64 56}
!6 = !{!"_ZTSN4agge6strokeE", !7, i64 0, !12, i64 24, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !13, i64 80, !14, i64 84}
!7 = !{!"_ZTSN4agge15vertex_sequenceE", !8, i64 0}
!8 = !{!"_ZTSN4agge10pod_vectorINS_6vertexEEE", !9, i64 0, !9, i64 8, !9, i64 16}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSN4agge10pod_vectorINS_5pointIfEEEE", !9, i64 0, !9, i64 8, !9, i64 16}
!13 = !{!"float", !10, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = !{!6, !14, i64 84}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass