; LLVM IR from hbatagelo/abcg :: abcg/external/glslang/glslang/MachineIndependent/preprocessor (PpTokens)

; 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.glslang::TPpContext::TokenStream" = type { %"class.glslang::TVector", i64 }
%"class.glslang::TVector" = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<glslang::TPpContext::TokenStream::Token, glslang::pool_allocator<glslang::TPpContext::TokenStream::Token>>::_Vector_impl" }
%"struct.std::_Vector_base<glslang::TPpContext::TokenStream::Token, glslang::pool_allocator<glslang::TPpContext::TokenStream::Token>>::_Vector_impl" = type { %"class.glslang::pool_allocator.1", %"struct.std::_Vector_base<glslang::TPpContext::TokenStream::Token, glslang::pool_allocator<glslang::TPpContext::TokenStream::Token>>::_Vector_impl_data" }
%"class.glslang::pool_allocator.1" = type { ptr }
%"struct.std::_Vector_base<glslang::TPpContext::TokenStream::Token, glslang::pool_allocator<glslang::TPpContext::TokenStream::Token>>::_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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream22peekUntokenizedPastingEv(ptr noundef nonnull align 8 dereferenceable(40) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  %6 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %5, i32 0, i32 1
  %7 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %7, ptr %3, align 8, !tbaa !18
  br label %8

8:                                                ; preds = %10, %1
  %9 = call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %5, i32 noundef 32)
  br i1 %9, label %10, label %14

10:                                               ; preds = %8
  %11 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %5, i32 0, i32 1
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = add i64 %12, 1
  store i64 %13, ptr %11, align 8, !tbaa !9
  br label %8, !llvm.loop !19

14:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #2
  store i8 0, ptr %4, align 1, !tbaa !21
  %15 = call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %5, i32 noundef 35)
  br i1 %15, label %16, label %23

16:                                               ; preds = %14
  %17 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %5, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = add i64 %18, 1
  store i64 %19, ptr %17, align 8, !tbaa !9
  %20 = call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %5, i32 noundef 35)
  br i1 %20, label %21, label %22

21:                                               ; preds = %16
  store i8 1, ptr %4, align 1, !tbaa !21
  br label %22

22:                                               ; preds = %21, %16
  br label %23

23:                                               ; preds = %22, %14
  %24 = load i64, ptr %3, align 8, !tbaa !18
  %25 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %5, i32 0, i32 1
  store i64 %24, ptr %25, align 8, !tbaa !9
  %26 = load i8, ptr %4, align 1, !tbaa !21, !range !23, !noundef !24
  %27 = trunc i8 %26 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret i1 %27
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !17, i64 32}
!10 = !{!"_ZTSN7glslang10TPpContext11TokenStreamE", !11, i64 0, !17, i64 32}
!11 = !{!"_ZTSN7glslang7TVectorINS_10TPpContext11TokenStream5TokenEEE", !12, i64 0}
!12 = !{!"_ZTSSt6vectorIN7glslang10TPpContext11TokenStream5TokenENS0_14pool_allocatorIS3_EEE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIN7glslang10TPpContext11TokenStream5TokenENS0_14pool_allocatorIS3_EEE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN7glslang10TPpContext11TokenStream5TokenENS0_14pool_allocatorIS3_EEE12_Vector_implE", !15, i64 0, !16, i64 8}
!15 = !{!"_ZTSN7glslang14pool_allocatorINS_10TPpContext11TokenStream5TokenEEE", !6, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN7glslang10TPpContext11TokenStream5TokenENS0_14pool_allocatorIS3_EEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"long", !7, i64 0}
!18 = !{!17, !17, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!22, !22, i64 0}
!22 = !{!"bool", !7, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}


; 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
declare dso_local noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream22peekUntokenizedPastingEv(ptr noundef nonnull align 8 dereferenceable(40) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 32
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %4 = tail call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef 32)
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1, %.lr.ph
  %5 = load i64, ptr %2, align 8, !tbaa !5
  %6 = add i64 %5, 1
  store i64 %6, ptr %2, align 8, !tbaa !5
  %7 = tail call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef 32)
  br i1 %7, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %1
  %8 = tail call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef 35)
  br i1 %8, label %9, label %13

9:                                                ; preds = %._crit_edge
  %10 = load i64, ptr %2, align 8, !tbaa !5
  %11 = add i64 %10, 1
  store i64 %11, ptr %2, align 8, !tbaa !5
  %12 = tail call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef 35)
  br label %13

13:                                               ; preds = %9, %._crit_edge
  %.0 = phi i1 [ false, %._crit_edge ], [ %12, %9 ]
  store i64 %3, ptr %2, align 8, !tbaa !5
  ret i1 %.0
}

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

!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, !16, i64 32}
!6 = !{!"_ZTSN7glslang10TPpContext11TokenStreamE", !7, i64 0, !16, i64 32}
!7 = !{!"_ZTSN7glslang7TVectorINS_10TPpContext11TokenStream5TokenEEE", !8, i64 0}
!8 = !{!"_ZTSSt6vectorIN7glslang10TPpContext11TokenStream5TokenENS0_14pool_allocatorIS3_EEE", !9, i64 0}
!9 = !{!"_ZTSSt12_Vector_baseIN7glslang10TPpContext11TokenStream5TokenENS0_14pool_allocatorIS3_EEE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIN7glslang10TPpContext11TokenStream5TokenENS0_14pool_allocatorIS3_EEE12_Vector_implE", !11, i64 0, !15, i64 8}
!11 = !{!"_ZTSN7glslang14pool_allocatorINS_10TPpContext11TokenStream5TokenEEE", !12, i64 0}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"_ZTSNSt12_Vector_baseIN7glslang10TPpContext11TokenStream5TokenENS0_14pool_allocatorIS3_EEE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!16 = !{!"long", !13, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass