; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream5atEndEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

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

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

13:                                               ; preds = %15, %2
  %14 = call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %10, i32 noundef 32)
  br i1 %14, label %15, label %19

15:                                               ; preds = %13
  %16 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %10, i32 0, i32 1
  %17 = load i64, ptr %16, align 8, !tbaa !11
  %18 = add i64 %17, 1
  store i64 %18, ptr %16, align 8, !tbaa !11
  br label %13, !llvm.loop !21

19:                                               ; preds = %13
  %20 = call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %10, i32 noundef 151)
  br i1 %20, label %21, label %24

21:                                               ; preds = %19
  %22 = load i64, ptr %6, align 8, !tbaa !20
  %23 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %10, i32 0, i32 1
  store i64 %22, ptr %23, align 8, !tbaa !11
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %48

24:                                               ; preds = %19
  %25 = load i8, ptr %5, align 1, !tbaa !9, !range !23, !noundef !24
  %26 = trunc i8 %25 to i1
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %48

28:                                               ; preds = %24
  %29 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %10, i32 0, i32 1
  %30 = load i64, ptr %29, align 8, !tbaa !11
  store i64 %30, ptr %6, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  store i8 0, ptr %8, align 1, !tbaa !9
  br label %31

31:                                               ; preds = %41, %28
  %32 = call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream5atEndEv(ptr noundef nonnull align 8 dereferenceable(40) %10)
  br i1 %32, label %33, label %34

33:                                               ; preds = %31
  br label %42

34:                                               ; preds = %31
  %35 = call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %10, i32 noundef 32)
  br i1 %35, label %37, label %36

36:                                               ; preds = %34
  store i8 1, ptr %8, align 1, !tbaa !9
  br label %42

37:                                               ; preds = %34
  %38 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %10, i32 0, i32 1
  %39 = load i64, ptr %38, align 8, !tbaa !11
  %40 = add i64 %39, 1
  store i64 %40, ptr %38, align 8, !tbaa !11
  br label %41

41:                                               ; preds = %37
  br i1 true, label %31, label %42, !llvm.loop !25

42:                                               ; preds = %41, %36, %33
  %43 = load i64, ptr %6, align 8, !tbaa !20
  %44 = getelementptr inbounds %"class.glslang::TPpContext::TokenStream", ptr %10, i32 0, i32 1
  store i64 %43, ptr %44, align 8, !tbaa !11
  %45 = load i8, ptr %8, align 1, !tbaa !9, !range !23, !noundef !24
  %46 = trunc i8 %45 to i1
  %47 = xor i1 %46, true
  store i1 %47, ptr %3, align 1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  br label %48

48:                                               ; preds = %42, %27, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %49 = load i1, ptr %3, align 1
  ret i1 %49
}

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


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

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

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

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

._crit_edge:                                      ; preds = %.lr.ph, %2
  %9 = tail call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef 151)
  br i1 %9, label %.sink.split, label %10

10:                                               ; preds = %._crit_edge
  br i1 %1, label %11, label %19

11:                                               ; preds = %10
  %12 = load i64, ptr %3, align 8, !tbaa !5
  %13 = tail call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream5atEndEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  br i1 %13, label %.sink.split, label %.lr.ph7

.lr.ph7:                                          ; preds = %11, %15
  %14 = tail call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream9peekTokenEi(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef 32)
  br i1 %14, label %15, label %.sink.split

15:                                               ; preds = %.lr.ph7
  %16 = load i64, ptr %3, align 8, !tbaa !5
  %17 = add i64 %16, 1
  store i64 %17, ptr %3, align 8, !tbaa !5
  %18 = tail call noundef zeroext i1 @_ZN7glslang10TPpContext11TokenStream5atEndEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  br i1 %18, label %.sink.split, label %.lr.ph7, !llvm.loop !19

.sink.split:                                      ; preds = %.lr.ph7, %15, %11, %._crit_edge
  %.sink = phi i64 [ %4, %._crit_edge ], [ %12, %11 ], [ %12, %15 ], [ %12, %.lr.ph7 ]
  %.05.ph = phi i1 [ true, %._crit_edge ], [ true, %11 ], [ %14, %15 ], [ %14, %.lr.ph7 ]
  store i64 %.sink, ptr %3, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %.sink.split, %10
  %.05 = phi i1 [ false, %10 ], [ %.05.ph, %.sink.split ]
  ret i1 %.05
}

attributes #0 = { 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 #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" }

!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"}
!19 = distinct !{!19, !18}


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