; LLVM IR from jzimmerman/langcc :: gen/cc/gen.ll (ZN4lang2cc6parser17_parse_proc_5_1_0EPN6langcc15ParserProcStateE)

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

%"struct.langcc::SymItem" = type { i64, i64, %"struct.langcc::ParserAttrMask", i64, i64, i64, %"struct.langcc::Result_T", %"struct.langcc::ParserLookahead" }
%"struct.langcc::ParserAttrMask" = type { [16 x i8] }
%"struct.langcc::Result_T" = type { ptr, %"struct.langcc::TokenBounds" }
%"struct.langcc::TokenBounds" = type { i32, i32 }
%"struct.langcc::ParserLookahead" = type { [8 x i16] }
%"struct.langcc::ParserProcState" = type { %"struct.langcc::rc_ptr.16", ptr, ptr, i64, ptr, i64, ptr, i64, ptr, i64, %"struct.langcc::SymItem", ptr, ptr }
%"struct.langcc::rc_ptr.16" = type { ptr, ptr }
%"struct.langcc::ParserVertexStackItem" = type { i64, i64 }

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6langcc8Result_TC2EPvNS_11TokenBoundsE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64) unnamed_addr #2 align 2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN6langcc15make_rc_inc_extIbJbEEEPT_PNS_5ArenaEDpT0_(ptr noundef, i1 noundef zeroext) #4

; Function Attrs: mustprogress noinline uwtable
define dso_local void @_ZN4lang2cc6parser17_parse_proc_5_1_0EPN6langcc15ParserProcStateE(ptr dead_on_unwind noalias writable sret(%"struct.langcc::SymItem") align 8 %0, ptr noundef %1) #5 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %"struct.langcc::Result_T", align 8
  %11 = alloca %"struct.langcc::TokenBounds", align 4
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %12, i32 0, i32 5
  %14 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %14, ptr %4, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %15, i32 0, i32 7
  %17 = load i64, ptr %16, align 8, !tbaa !20
  store i64 %17, ptr %5, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %18, i32 0, i32 9
  %20 = load i64, ptr %19, align 8, !tbaa !21
  store i64 %20, ptr %6, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %21, i32 0, i32 3
  %23 = load i64, ptr %22, align 8, !tbaa !22
  store i64 %23, ptr %7, align 8, !tbaa !19
  %24 = load i64, ptr %7, align 8, !tbaa !19
  %25 = sub nsw i64 %24, 0
  store i64 %25, ptr %7, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %26, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !23
  %29 = load i64, ptr %7, align 8, !tbaa !19
  %30 = sub nsw i64 %29, 1
  %31 = getelementptr inbounds %"struct.langcc::ParserVertexStackItem", ptr %28, i64 %30
  %32 = getelementptr inbounds %"struct.langcc::ParserVertexStackItem", ptr %31, i32 0, i32 1
  %33 = load i64, ptr %32, align 8, !tbaa !24
  store i64 %33, ptr %8, align 8, !tbaa !19
  %34 = load i64, ptr %4, align 8, !tbaa !19
  %35 = sub nsw i64 %34, 0
  store i64 %35, ptr %4, align 8, !tbaa !19
  %36 = load i64, ptr %5, align 8, !tbaa !19
  %37 = sub nsw i64 %36, 0
  store i64 %37, ptr %5, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %38, i32 0, i32 12
  %40 = load ptr, ptr %39, align 8, !tbaa !26
  %41 = call noundef ptr @_ZN6langcc15make_rc_inc_extIbJbEEEPT_PNS_5ArenaEDpT0_(ptr noundef %40, i1 noundef zeroext false)
  store ptr %41, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = load i64, ptr %8, align 8, !tbaa !19
  %44 = trunc i64 %43 to i32
  %45 = load i64, ptr %8, align 8, !tbaa !19
  %46 = trunc i64 %45 to i32
  call void @_ZN6langcc11TokenBoundsC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %11, i32 noundef %44, i32 noundef %46)
  %47 = load i64, ptr %11, align 4
  call void @_ZN6langcc8Result_TC2EPvNS_11TokenBoundsE(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef %42, i64 %47)
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %48, i32 0, i32 6
  %50 = load ptr, ptr %49, align 8, !tbaa !27
  %51 = load i64, ptr %5, align 8, !tbaa !19
  %52 = getelementptr inbounds %"struct.langcc::Result_T", ptr %50, i64 %51
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %52, ptr align 8 %10, i64 16, i1 false), !tbaa.struct !28
  %53 = load i64, ptr %5, align 8, !tbaa !19
  %54 = add nsw i64 %53, 1
  store i64 %54, ptr %5, align 8, !tbaa !19
  %55 = load i64, ptr %8, align 8, !tbaa !19
  call void @_ZN6langcc7SymItemC2Ell(ptr noundef nonnull align 8 dereferenceable(88) %0, i64 noundef 180, i64 noundef %55)
  %56 = load i64, ptr %4, align 8, !tbaa !19
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %57, i32 0, i32 5
  store i64 %56, ptr %58, align 8, !tbaa !9
  %59 = load i64, ptr %5, align 8, !tbaa !19
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %60, i32 0, i32 7
  store i64 %59, ptr %61, align 8, !tbaa !20
  %62 = load i64, ptr %6, align 8, !tbaa !19
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %63, i32 0, i32 9
  store i64 %62, ptr %64, align 8, !tbaa !21
  %65 = load i64, ptr %7, align 8, !tbaa !19
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.langcc::ParserProcState", ptr %66, i32 0, i32 3
  store i64 %65, ptr %67, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { alwaysinline 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 = { mustprogress noinline 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 = { 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, !12, i64 48}
!10 = !{!"_ZTSN6langcc15ParserProcStateE", !11, i64 0, !6, i64 16, !6, i64 24, !12, i64 32, !6, i64 40, !12, i64 48, !6, i64 56, !12, i64 64, !6, i64 72, !12, i64 80, !13, i64 88, !6, i64 176, !6, i64 184}
!11 = !{!"_ZTSN6langcc6rc_ptrINS_9LexOutputEEE", !6, i64 0, !6, i64 8}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTSN6langcc7SymItemE", !12, i64 0, !12, i64 8, !14, i64 16, !12, i64 32, !12, i64 40, !12, i64 48, !15, i64 56, !18, i64 72}
!14 = !{!"_ZTSN6langcc14ParserAttrMaskE", !7, i64 0}
!15 = !{!"_ZTSN6langcc8Result_TE", !6, i64 0, !16, i64 8}
!16 = !{!"_ZTSN6langcc11TokenBoundsE", !17, i64 0, !17, i64 4}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSN6langcc15ParserLookaheadE", !7, i64 0}
!19 = !{!12, !12, i64 0}
!20 = !{!10, !12, i64 64}
!21 = !{!10, !12, i64 80}
!22 = !{!10, !12, i64 32}
!23 = !{!10, !6, i64 24}
!24 = !{!25, !12, i64 8}
!25 = !{!"_ZTSN6langcc21ParserVertexStackItemE", !12, i64 0, !12, i64 8}
!26 = !{!10, !6, i64 184}
!27 = !{!10, !6, i64 56}
!28 = !{i64 0, i64 8, !5, i64 8, i64 4, !29, i64 12, i64 4, !29}
!29 = !{!17, !17, 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"

%"struct.langcc::SymItem" = type { i64, i64, %"struct.langcc::ParserAttrMask", i64, i64, i64, %"struct.langcc::Result_T", %"struct.langcc::ParserLookahead" }
%"struct.langcc::ParserAttrMask" = type { [16 x i8] }
%"struct.langcc::Result_T" = type { ptr, %"struct.langcc::TokenBounds" }
%"struct.langcc::TokenBounds" = type { i32, i32 }
%"struct.langcc::ParserLookahead" = type { [8 x i16] }
%"struct.langcc::ParserVertexStackItem" = type { i64, i64 }

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6langcc8Result_TC2EPvNS_11TokenBoundsE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64) unnamed_addr #2 align 2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN6langcc15make_rc_inc_extIbJbEEEPT_PNS_5ArenaEDpT0_(ptr noundef, i1 noundef zeroext) local_unnamed_addr #4

; Function Attrs: mustprogress noinline uwtable
define dso_local void @_ZN4lang2cc6parser17_parse_proc_5_1_0EPN6langcc15ParserProcStateE(ptr dead_on_unwind noalias writable sret(%"struct.langcc::SymItem") align 8 %0, ptr nocapture noundef %1) local_unnamed_addr #5 {
  %3 = alloca %"struct.langcc::Result_T", align 8
  %4 = alloca %"struct.langcc::TokenBounds", align 8
  %5 = getelementptr inbounds i8, ptr %1, i64 48
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %1, i64 64
  %8 = load i64, ptr %7, align 8, !tbaa !18
  %9 = getelementptr inbounds i8, ptr %1, i64 80
  %10 = load i64, ptr %9, align 8, !tbaa !19
  %11 = getelementptr inbounds i8, ptr %1, i64 32
  %12 = load i64, ptr %11, align 8, !tbaa !20
  %13 = getelementptr inbounds i8, ptr %1, i64 24
  %14 = load ptr, ptr %13, align 8, !tbaa !21
  %15 = getelementptr %"struct.langcc::ParserVertexStackItem", ptr %14, i64 %12
  %16 = getelementptr i8, ptr %15, i64 -8
  %17 = load i64, ptr %16, align 8, !tbaa !22
  %18 = getelementptr inbounds i8, ptr %1, i64 184
  %19 = load ptr, ptr %18, align 8, !tbaa !24
  %20 = tail call noundef ptr @_ZN6langcc15make_rc_inc_extIbJbEEEPT_PNS_5ArenaEDpT0_(ptr noundef %19, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  %21 = trunc i64 %17 to i32
  call void @_ZN6langcc11TokenBoundsC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef %21, i32 noundef %21)
  %22 = load i64, ptr %4, align 8
  call void @_ZN6langcc8Result_TC2EPvNS_11TokenBoundsE(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef %20, i64 %22)
  %23 = getelementptr inbounds i8, ptr %1, i64 56
  %24 = load ptr, ptr %23, align 8, !tbaa !25
  %25 = getelementptr inbounds %"struct.langcc::Result_T", ptr %24, i64 %8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !26
  %26 = add nsw i64 %8, 1
  call void @_ZN6langcc7SymItemC2Ell(ptr noundef nonnull align 8 dereferenceable(88) %0, i64 noundef 180, i64 noundef %17)
  store i64 %6, ptr %5, align 8, !tbaa !5
  store i64 %26, ptr %7, align 8, !tbaa !18
  store i64 %10, ptr %9, align 8, !tbaa !19
  store i64 %12, ptr %11, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { alwaysinline 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 = { mustprogress noinline 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 = { 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, !11, i64 48}
!6 = !{!"_ZTSN6langcc15ParserProcStateE", !7, i64 0, !8, i64 16, !8, i64 24, !11, i64 32, !8, i64 40, !11, i64 48, !8, i64 56, !11, i64 64, !8, i64 72, !11, i64 80, !12, i64 88, !8, i64 176, !8, i64 184}
!7 = !{!"_ZTSN6langcc6rc_ptrINS_9LexOutputEEE", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"_ZTSN6langcc7SymItemE", !11, i64 0, !11, i64 8, !13, i64 16, !11, i64 32, !11, i64 40, !11, i64 48, !14, i64 56, !17, i64 72}
!13 = !{!"_ZTSN6langcc14ParserAttrMaskE", !9, i64 0}
!14 = !{!"_ZTSN6langcc8Result_TE", !8, i64 0, !15, i64 8}
!15 = !{!"_ZTSN6langcc11TokenBoundsE", !16, i64 0, !16, i64 4}
!16 = !{!"int", !9, i64 0}
!17 = !{!"_ZTSN6langcc15ParserLookaheadE", !9, i64 0}
!18 = !{!6, !11, i64 64}
!19 = !{!6, !11, i64 80}
!20 = !{!6, !11, i64 32}
!21 = !{!6, !8, i64 24}
!22 = !{!23, !11, i64 8}
!23 = !{!"_ZTSN6langcc21ParserVertexStackItemE", !11, i64 0, !11, i64 8}
!24 = !{!6, !8, i64 184}
!25 = !{!6, !8, i64 56}
!26 = !{i64 0, i64 8, !27, i64 8, i64 4, !28, i64 12, i64 4, !28}
!27 = !{!8, !8, i64 0}
!28 = !{!16, !16, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass