; LLVM IR from Aeternum-Veritas/Merry :: legacy/MerryAssembler/src/lexer.ll (ZN5merry9front_end5Lexer7lex_allEv)

; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<merry::front_end::Token, std::allocator<merry::front_end::Token>>::_Vector_impl" }
%"struct.std::_Vector_base<merry::front_end::Token, std::allocator<merry::front_end::Token>>::_Vector_impl" = type { %"struct.std::_Vector_base<merry::front_end::Token, std::allocator<merry::front_end::Token>>::_Vector_impl_data" }
%"struct.std::_Vector_base<merry::front_end::Token, std::allocator<merry::front_end::Token>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.merry::front_end::Token" = type { %"class.merry::core::Loc", i32, %"class.std::__cxx11::basic_string" }
%"class.merry::core::Loc" = type { i64, i64, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5merry9front_end5Lexer7lex_allEv(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(89) %1) #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i1, align 1
  %6 = alloca %"class.merry::front_end::Token", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.merry::front_end::Token", align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  store i1 false, ptr %5, align 1
  call void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  call void @llvm.lifetime.start.p0(i64 88, ptr %6) #4
  invoke void @_ZN5merry9front_end5Lexer10next_tokenEv(ptr dead_on_unwind writable sret(%"class.merry::front_end::Token") align 8 %6, ptr noundef nonnull align 8 dereferenceable(89) %10)
          to label %11 unwind label %21

11:                                               ; preds = %2
  invoke void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(88) %6)
          to label %12 unwind label %25

12:                                               ; preds = %11
  br label %13

13:                                               ; preds = %20, %12
  %14 = invoke noundef i32 @_ZN5merry9front_end5Token8get_typeEv(ptr noundef nonnull align 8 dereferenceable(88) %6)
          to label %15 unwind label %25

15:                                               ; preds = %13
  %16 = icmp ne i32 %14, 0
  br i1 %16, label %17, label %33

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 88, ptr %9) #4
  invoke void @_ZN5merry9front_end5Lexer10next_tokenEv(ptr dead_on_unwind writable sret(%"class.merry::front_end::Token") align 8 %9, ptr noundef nonnull align 8 dereferenceable(89) %10)
          to label %18 unwind label %29

18:                                               ; preds = %17
  %19 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZN5merry9front_end5TokenaSEOS1_(ptr noundef nonnull align 8 dereferenceable(88) %6, ptr noundef nonnull align 8 dereferenceable(88) %9) #4
  call void @_ZN5merry9front_end5TokenD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %9) #4
  call void @llvm.lifetime.end.p0(i64 88, ptr %9) #4
  invoke void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(88) %6)
          to label %20 unwind label %25

20:                                               ; preds = %18
  br label %13, !llvm.loop !9

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

25:                                               ; preds = %18, %13, %11
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %7, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %8, align 4
  br label %35

29:                                               ; preds = %17
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %7, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 88, ptr %9) #4
  br label %35

33:                                               ; preds = %15
  store i1 true, ptr %5, align 1
  call void @_ZN5merry9front_end5TokenD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %6) #4
  call void @llvm.lifetime.end.p0(i64 88, ptr %6) #4
  %34 = load i1, ptr %5, align 1
  br i1 %34, label %38, label %37

35:                                               ; preds = %29, %25
  call void @_ZN5merry9front_end5TokenD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %6) #4
  br label %36

36:                                               ; preds = %35, %21
  call void @llvm.lifetime.end.p0(i64 88, ptr %6) #4
  call void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %39

37:                                               ; preds = %33
  call void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %38

38:                                               ; preds = %37, %33
  ret void

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5merry9front_end5Lexer10next_tokenEv(ptr dead_on_unwind noalias writable sret(%"class.merry::front_end::Token") align 8, ptr noundef nonnull align 8 dereferenceable(89)) #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(88)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN5merry9front_end5Token8get_typeEv(ptr noundef nonnull align 8 dereferenceable(88)) #1 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<merry::front_end::Token, std::allocator<merry::front_end::Token>>::_Vector_impl" }
%"struct.std::_Vector_base<merry::front_end::Token, std::allocator<merry::front_end::Token>>::_Vector_impl" = type { %"struct.std::_Vector_base<merry::front_end::Token, std::allocator<merry::front_end::Token>>::_Vector_impl_data" }
%"struct.std::_Vector_base<merry::front_end::Token, std::allocator<merry::front_end::Token>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.merry::front_end::Token" = type { %"class.merry::core::Loc", i32, %"class.std::__cxx11::basic_string" }
%"class.merry::core::Loc" = type { i64, i64, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5merry9front_end5Lexer7lex_allEv(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(89) %1) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.merry::front_end::Token", align 8
  %4 = alloca %"class.merry::front_end::Token", align 8
  tail call void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %3) #4
  invoke void @_ZN5merry9front_end5Lexer10next_tokenEv(ptr dead_on_unwind nonnull writable sret(%"class.merry::front_end::Token") align 8 %3, ptr noundef nonnull align 8 dereferenceable(89) %1)
          to label %5 unwind label %10

5:                                                ; preds = %2
  invoke void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(88) %3)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %5, %8
  %6 = call noundef i32 @_ZN5merry9front_end5Token8get_typeEv(ptr noundef nonnull align 8 dereferenceable(88) %3)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %14, label %7

7:                                                ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %4) #4
  invoke void @_ZN5merry9front_end5Lexer10next_tokenEv(ptr dead_on_unwind nonnull writable sret(%"class.merry::front_end::Token") align 8 %4, ptr noundef nonnull align 8 dereferenceable(89) %1)
          to label %8 unwind label %12

8:                                                ; preds = %7
  %9 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZN5merry9front_end5TokenaSEOS1_(ptr noundef nonnull align 8 dereferenceable(88) %3, ptr noundef nonnull align 8 dereferenceable(88) %4) #4
  call void @_ZN5merry9front_end5TokenD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %4) #4
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %4) #4
  invoke void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(88) %3)
          to label %.preheader unwind label %.loopexit, !llvm.loop !5

10:                                               ; preds = %2
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %16

.loopexit:                                        ; preds = %8
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %15

.loopexit.split-lp:                               ; preds = %5
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %15

12:                                               ; preds = %7
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %4) #4
  br label %15

14:                                               ; preds = %.preheader
  call void @_ZN5merry9front_end5TokenD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %3) #4
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %3) #4
  ret void

15:                                               ; preds = %.loopexit, %.loopexit.split-lp, %12
  %.pn = phi { ptr, i32 } [ %13, %12 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN5merry9front_end5TokenD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %3) #4
  br label %16

16:                                               ; preds = %15, %10
  %.pn.pn = phi { ptr, i32 } [ %.pn, %15 ], [ %11, %10 ]
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %3) #4
  call void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  resume { ptr, i32 } %.pn.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5merry9front_end5Lexer10next_tokenEv(ptr dead_on_unwind noalias writable sret(%"class.merry::front_end::Token") align 8, ptr noundef nonnull align 8 dereferenceable(89)) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN5merry9front_end5Token8get_typeEv(ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #1 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIN5merry9front_end5TokenESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass