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

; 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.TInfoSink = type { %"class.glslang::TInfoSinkBase", %"class.glslang::TInfoSinkBase" }
%"class.glslang::TInfoSinkBase" = type <{ %"class.std::__cxx11::basic_string.2", i32, [4 x i8] }>
%"class.std::__cxx11::basic_string.2" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.3 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.3 = type { i64, [8 x i8] }
%"class.glslang::TSymbolTable" = type { %"class.std::vector.13", i64, i8, i8, i32 }
%"class.std::vector.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<glslang::TSymbolTableLevel *, std::allocator<glslang::TSymbolTableLevel *>>::_Vector_impl" }
%"struct.std::_Vector_base<glslang::TSymbolTableLevel *, std::allocator<glslang::TSymbolTableLevel *>>::_Vector_impl" = type { %"struct.std::_Vector_base<glslang::TSymbolTableLevel *, std::allocator<glslang::TSymbolTableLevel *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<glslang::TSymbolTableLevel *, std::allocator<glslang::TSymbolTableLevel *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.41 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [7 x i8], align 1

; 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 nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEPKc(ptr noundef nonnull align 8 dereferenceable(36), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7glslang17TSymbolTableLevel4dumpER9TInfoSinkb(ptr noundef nonnull align 8 dereferenceable(101), ptr noundef nonnull align 8 dereferenceable(80), i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7glslang12TSymbolTable4dumpER9TInfoSinkb(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(80) %1, i1 noundef zeroext %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = zext i1 %2 to i8
  store i8 %8, ptr %6, align 1, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %10 = call noundef i32 @_ZNK7glslang12TSymbolTable12currentLevelEv(ptr noundef nonnull align 8 dereferenceable(40) %9)
  store i32 %10, ptr %7, align 4, !tbaa !11
  br label %11

11:                                               ; preds = %30, %3
  %12 = load i32, ptr %7, align 4, !tbaa !11
  %13 = icmp sge i32 %12, 0
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %33

15:                                               ; preds = %11
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %class.TInfoSink, ptr %16, i32 0, i32 1
  %18 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEPKc(ptr noundef nonnull align 8 dereferenceable(36) %17, ptr noundef @.str.48)
  %19 = load i32, ptr %7, align 4, !tbaa !11
  %20 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEi(ptr noundef nonnull align 8 dereferenceable(36) %18, i32 noundef %19)
  %21 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEPKc(ptr noundef nonnull align 8 dereferenceable(36) %20, ptr noundef @.str.41)
  %22 = getelementptr inbounds %"class.glslang::TSymbolTable", ptr %9, i32 0, i32 0
  %23 = load i32, ptr %7, align 4, !tbaa !11
  %24 = sext i32 %23 to i64
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIPN7glslang17TSymbolTableLevelESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %24) #3
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %29 = trunc i8 %28 to i1
  call void @_ZNK7glslang17TSymbolTableLevel4dumpER9TInfoSinkb(ptr noundef nonnull align 8 dereferenceable(101) %26, ptr noundef nonnull align 8 dereferenceable(80) %27, i1 noundef zeroext %29)
  br label %30

30:                                               ; preds = %15
  %31 = load i32, ptr %7, align 4, !tbaa !11
  %32 = add nsw i32 %31, -1
  store i32 %32, ptr %7, align 4, !tbaa !11
  br label %11, !llvm.loop !15

33:                                               ; preds = %14
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEi(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIPN7glslang17TSymbolTableLevelESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

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 = { 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 = { 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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"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"

@.str.41 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEPKc(ptr noundef nonnull align 8 dereferenceable(36), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7glslang17TSymbolTableLevel4dumpER9TInfoSinkb(ptr noundef nonnull align 8 dereferenceable(101), ptr noundef nonnull align 8 dereferenceable(80), i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK7glslang12TSymbolTable4dumpER9TInfoSinkb(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(80) %1, i1 noundef zeroext %2) local_unnamed_addr #0 align 2 {
  %4 = tail call noundef i32 @_ZNK7glslang12TSymbolTable12currentLevelEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  %5 = icmp sgt i32 %4, -1
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %6 = getelementptr inbounds i8, ptr %1, i64 40
  %7 = zext nneg i32 %4 to i64
  br label %8

._crit_edge:                                      ; preds = %8, %3
  ret void

8:                                                ; preds = %.lr.ph, %8
  %indvars.iv = phi i64 [ %7, %.lr.ph ], [ %indvars.iv.next, %8 ]
  %9 = tail call noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEPKc(ptr noundef nonnull align 8 dereferenceable(36) %6, ptr noundef nonnull @.str.48)
  %10 = trunc nuw nsw i64 %indvars.iv to i32
  %11 = tail call noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEi(ptr noundef nonnull align 8 dereferenceable(36) %9, i32 noundef %10)
  %12 = tail call noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEPKc(ptr noundef nonnull align 8 dereferenceable(36) %11, ptr noundef nonnull @.str.41)
  %13 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIPN7glslang17TSymbolTableLevelESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #2
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  tail call void @_ZNK7glslang17TSymbolTableLevel4dumpER9TInfoSinkb(ptr noundef nonnull align 8 dereferenceable(101) %14, ptr noundef nonnull align 8 dereferenceable(80) %1, i1 noundef zeroext %2)
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %.not = icmp eq i64 %indvars.iv, 0
  br i1 %.not, label %._crit_edge, label %8, !llvm.loop !9
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(36) ptr @_ZN7glslang13TInfoSinkBaselsEi(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIPN7glslang17TSymbolTableLevelESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_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 = { 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"}


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