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

; 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::TIntermTraverser" = type { ptr, i8, i8, i8, i8, i32, i32, %"class.glslang::TVector" }
%"class.glslang::TVector" = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<TIntermNode *, glslang::pool_allocator<TIntermNode *>>::_Vector_impl" }
%"struct.std::_Vector_base<TIntermNode *, glslang::pool_allocator<TIntermNode *>>::_Vector_impl" = type { %"class.glslang::pool_allocator", %"struct.std::_Vector_base<TIntermNode *, glslang::pool_allocator<TIntermNode *>>::_Vector_impl_data" }
%"class.glslang::pool_allocator" = type { ptr }
%"struct.std::_Vector_base<TIntermNode *, glslang::pool_allocator<TIntermNode *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.glslang::TIntermBranch" = type { %class.TIntermNode, i32, ptr }
%class.TIntermNode = type { ptr, %"struct.glslang::TSourceLoc" }
%"struct.glslang::TSourceLoc" = type { ptr, i32, i32, i32 }

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7glslang16TIntermTraverser14incrementDepthEP11TIntermNode(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang16TIntermTraverser14decrementDepthEv(ptr noundef nonnull align 8 dereferenceable(56)) #2 align 2

; 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
define dso_local void @_ZN7glslang13TIntermBranch8traverseEPNS_16TIntermTraverserE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  store i8 1, ptr %5, align 1, !tbaa !9
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %"class.glslang::TIntermTraverser", ptr %7, i32 0, i32 1
  %9 = load i8, ptr %8, align 8, !tbaa !11, !range !20, !noundef !21
  %10 = trunc i8 %9 to i1
  br i1 %10, label %11, label %18

11:                                               ; preds = %2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = load ptr, ptr %12, align 8, !tbaa !22
  %14 = getelementptr inbounds ptr, ptr %13, i64 9
  %15 = load ptr, ptr %14, align 8
  %16 = call noundef zeroext i1 %15(ptr noundef nonnull align 8 dereferenceable(56) %12, i32 noundef 0, ptr noundef %6)
  %17 = zext i1 %16 to i8
  store i8 %17, ptr %5, align 1, !tbaa !9
  br label %18

18:                                               ; preds = %11, %2
  %19 = load i8, ptr %5, align 1, !tbaa !9, !range !20, !noundef !21
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %34

21:                                               ; preds = %18
  %22 = getelementptr inbounds %"class.glslang::TIntermBranch", ptr %6, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !24
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %34

25:                                               ; preds = %21
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN7glslang16TIntermTraverser14incrementDepthEP11TIntermNode(ptr noundef nonnull align 8 dereferenceable(56) %26, ptr noundef %6)
  %27 = getelementptr inbounds %"class.glslang::TIntermBranch", ptr %6, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !24
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = load ptr, ptr %28, align 8, !tbaa !22
  %31 = getelementptr inbounds ptr, ptr %30, i64 2
  %32 = load ptr, ptr %31, align 8
  call void %32(ptr noundef nonnull align 8 dereferenceable(32) %28, ptr noundef %29)
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN7glslang16TIntermTraverser14decrementDepthEv(ptr noundef nonnull align 8 dereferenceable(56) %33)
  br label %34

34:                                               ; preds = %25, %21, %18
  %35 = load i8, ptr %5, align 1, !tbaa !9, !range !20, !noundef !21
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %48

37:                                               ; preds = %34
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.glslang::TIntermTraverser", ptr %38, i32 0, i32 3
  %40 = load i8, ptr %39, align 2, !tbaa !29, !range !20, !noundef !21
  %41 = trunc i8 %40 to i1
  br i1 %41, label %42, label %48

42:                                               ; preds = %37
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = load ptr, ptr %43, align 8, !tbaa !22
  %45 = getelementptr inbounds ptr, ptr %44, i64 9
  %46 = load ptr, ptr %45, align 8
  %47 = call noundef zeroext i1 %46(ptr noundef nonnull align 8 dereferenceable(56) %43, i32 noundef 2, ptr noundef %6)
  br label %48

48:                                               ; preds = %42, %37, %34
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  ret void
}

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, !10, i64 8}
!12 = !{!"_ZTSN7glslang16TIntermTraverserE", !10, i64 8, !10, i64 9, !10, i64 10, !10, i64 11, !13, i64 12, !13, i64 16, !14, i64 24}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN7glslang7TVectorIP11TIntermNodeEE", !15, i64 0}
!15 = !{!"_ZTSSt6vectorIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE12_Vector_implE", !18, i64 0, !19, i64 8}
!18 = !{!"_ZTSN7glslang14pool_allocatorIP11TIntermNodeEE", !6, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!23, !23, i64 0}
!23 = !{!"vtable pointer", !8, i64 0}
!24 = !{!25, !6, i64 40}
!25 = !{!"_ZTSN7glslang13TIntermBranchE", !26, i64 0, !28, i64 32, !6, i64 40}
!26 = !{!"_ZTS11TIntermNode", !27, i64 8}
!27 = !{!"_ZTSN7glslang10TSourceLocE", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!28 = !{!"_ZTSN7glslang9TOperatorE", !7, i64 0}
!29 = !{!12, !10, i64 10}


; 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 void @_ZN7glslang16TIntermTraverser14incrementDepthEP11TIntermNode(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang16TIntermTraverser14decrementDepthEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7glslang13TIntermBranch8traverseEPNS_16TIntermTraverserE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  %4 = load i8, ptr %3, align 8, !tbaa !5, !range !18, !noundef !19
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %6, label %.thread

6:                                                ; preds = %2
  %7 = load ptr, ptr %1, align 8, !tbaa !20
  %8 = getelementptr inbounds i8, ptr %7, i64 72
  %9 = load ptr, ptr %8, align 8
  %10 = tail call noundef zeroext i1 %9(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef 0, ptr noundef nonnull %0)
  br i1 %10, label %.thread, label %.critedge

.thread:                                          ; preds = %2, %6
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !22
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %18, label %13

13:                                               ; preds = %.thread
  tail call void @_ZN7glslang16TIntermTraverser14incrementDepthEP11TIntermNode(ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef nonnull %0)
  %14 = load ptr, ptr %11, align 8, !tbaa !22
  %15 = load ptr, ptr %14, align 8, !tbaa !20
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  %17 = load ptr, ptr %16, align 8
  tail call void %17(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull %1)
  tail call void @_ZN7glslang16TIntermTraverser14decrementDepthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  br label %18

18:                                               ; preds = %.thread, %13
  %19 = getelementptr inbounds i8, ptr %1, i64 10
  %20 = load i8, ptr %19, align 2, !tbaa !27, !range !18, !noundef !19
  %21 = trunc nuw i8 %20 to i1
  br i1 %21, label %22, label %.critedge

22:                                               ; preds = %18
  %23 = load ptr, ptr %1, align 8, !tbaa !20
  %24 = getelementptr inbounds i8, ptr %23, i64 72
  %25 = load ptr, ptr %24, align 8
  %26 = tail call noundef zeroext i1 %25(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef 2, ptr noundef nonnull %0)
  br label %.critedge

.critedge:                                        ; preds = %6, %22, %18
  ret void
}

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

!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, !7, i64 8}
!6 = !{!"_ZTSN7glslang16TIntermTraverserE", !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !10, i64 12, !10, i64 16, !11, i64 24}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSN7glslang7TVectorIP11TIntermNodeEE", !12, i64 0}
!12 = !{!"_ZTSSt6vectorIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE12_Vector_implE", !15, i64 0, !17, i64 8}
!15 = !{!"_ZTSN7glslang14pool_allocatorIP11TIntermNodeEE", !16, i64 0}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !9, i64 0}
!22 = !{!23, !16, i64 40}
!23 = !{!"_ZTSN7glslang13TIntermBranchE", !24, i64 0, !26, i64 32, !16, i64 40}
!24 = !{!"_ZTS11TIntermNode", !25, i64 8}
!25 = !{!"_ZTSN7glslang10TSourceLocE", !16, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!26 = !{!"_ZTSN7glslang9TOperatorE", !8, i64 0}
!27 = !{!6, !7, i64 10}


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