; 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::TIntermSwitch" = type <{ %class.TIntermNode, ptr, ptr, i8, i8, [6 x i8] }>
%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 @_ZN7glslang13TIntermSwitch8traverseEPNS_16TIntermTraverserE(ptr noundef nonnull align 8 dereferenceable(50) %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 10
  %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 %55

21:                                               ; preds = %18
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN7glslang16TIntermTraverser14incrementDepthEP11TIntermNode(ptr noundef nonnull align 8 dereferenceable(56) %22, ptr noundef %6)
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.glslang::TIntermTraverser", ptr %23, i32 0, i32 4
  %25 = load i8, ptr %24, align 1, !tbaa !24, !range !20, !noundef !21
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %40

27:                                               ; preds = %21
  %28 = getelementptr inbounds %"class.glslang::TIntermSwitch", ptr %6, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !25
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = load ptr, ptr %29, align 8, !tbaa !22
  %32 = getelementptr inbounds ptr, ptr %31, i64 2
  %33 = load ptr, ptr %32, align 8
  call void %33(ptr noundef nonnull align 8 dereferenceable(352) %29, ptr noundef %30)
  %34 = getelementptr inbounds %"class.glslang::TIntermSwitch", ptr %6, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !29
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load ptr, ptr %35, align 8, !tbaa !22
  %38 = getelementptr inbounds ptr, ptr %37, i64 2
  %39 = load ptr, ptr %38, align 8
  call void %39(ptr noundef nonnull align 8 dereferenceable(32) %35, ptr noundef %36)
  br label %53

40:                                               ; preds = %21
  %41 = getelementptr inbounds %"class.glslang::TIntermSwitch", ptr %6, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8, !tbaa !29
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = load ptr, ptr %42, align 8, !tbaa !22
  %45 = getelementptr inbounds ptr, ptr %44, i64 2
  %46 = load ptr, ptr %45, align 8
  call void %46(ptr noundef nonnull align 8 dereferenceable(32) %42, ptr noundef %43)
  %47 = getelementptr inbounds %"class.glslang::TIntermSwitch", ptr %6, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !25
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load ptr, ptr %48, align 8, !tbaa !22
  %51 = getelementptr inbounds ptr, ptr %50, i64 2
  %52 = load ptr, ptr %51, align 8
  call void %52(ptr noundef nonnull align 8 dereferenceable(352) %48, ptr noundef %49)
  br label %53

53:                                               ; preds = %40, %27
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN7glslang16TIntermTraverser14decrementDepthEv(ptr noundef nonnull align 8 dereferenceable(56) %54)
  br label %55

55:                                               ; preds = %53, %18
  %56 = load i8, ptr %5, align 1, !tbaa !9, !range !20, !noundef !21
  %57 = trunc i8 %56 to i1
  br i1 %57, label %58, label %69

58:                                               ; preds = %55
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %"class.glslang::TIntermTraverser", ptr %59, i32 0, i32 3
  %61 = load i8, ptr %60, align 2, !tbaa !30, !range !20, !noundef !21
  %62 = trunc i8 %61 to i1
  br i1 %62, label %63, label %69

63:                                               ; preds = %58
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load ptr, ptr %64, align 8, !tbaa !22
  %66 = getelementptr inbounds ptr, ptr %65, i64 10
  %67 = load ptr, ptr %66, align 8
  %68 = call noundef zeroext i1 %67(ptr noundef nonnull align 8 dereferenceable(56) %64, i32 noundef 2, ptr noundef %6)
  br label %69

69:                                               ; preds = %63, %58, %55
  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 = !{!12, !10, i64 11}
!25 = !{!26, !6, i64 40}
!26 = !{!"_ZTSN7glslang13TIntermSwitchE", !27, i64 0, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 49}
!27 = !{!"_ZTS11TIntermNode", !28, i64 8}
!28 = !{!"_ZTSN7glslang10TSourceLocE", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!29 = !{!26, !6, i64 32}
!30 = !{!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 @_ZN7glslang13TIntermSwitch8traverseEPNS_16TIntermTraverserE(ptr noundef nonnull align 8 dereferenceable(50) %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 80
  %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
  tail call void @_ZN7glslang16TIntermTraverser14incrementDepthEP11TIntermNode(ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef nonnull %0)
  %11 = getelementptr inbounds i8, ptr %1, i64 11
  %12 = load i8, ptr %11, align 1, !tbaa !22, !range !18, !noundef !19
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %14, label %25

14:                                               ; preds = %.thread
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  %16 = load ptr, ptr %15, align 8, !tbaa !23
  %17 = load ptr, ptr %16, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  %19 = load ptr, ptr %18, align 8
  tail call void %19(ptr noundef nonnull align 8 dereferenceable(352) %16, ptr noundef nonnull %1)
  %20 = getelementptr inbounds i8, ptr %0, i64 32
  %21 = load ptr, ptr %20, align 8, !tbaa !27
  %22 = load ptr, ptr %21, align 8, !tbaa !20
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %24 = load ptr, ptr %23, align 8
  tail call void %24(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef nonnull %1)
  br label %36

25:                                               ; preds = %.thread
  %26 = getelementptr inbounds i8, ptr %0, i64 32
  %27 = load ptr, ptr %26, align 8, !tbaa !27
  %28 = load ptr, ptr %27, align 8, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  %30 = load ptr, ptr %29, align 8
  tail call void %30(ptr noundef nonnull align 8 dereferenceable(32) %27, ptr noundef nonnull %1)
  %31 = getelementptr inbounds i8, ptr %0, i64 40
  %32 = load ptr, ptr %31, align 8, !tbaa !23
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %35 = load ptr, ptr %34, align 8
  tail call void %35(ptr noundef nonnull align 8 dereferenceable(352) %32, ptr noundef nonnull %1)
  br label %36

36:                                               ; preds = %14, %25
  tail call void @_ZN7glslang16TIntermTraverser14decrementDepthEv(ptr noundef nonnull align 8 dereferenceable(56) %1)
  %37 = getelementptr inbounds i8, ptr %1, i64 10
  %38 = load i8, ptr %37, align 2, !tbaa !28, !range !18, !noundef !19
  %39 = trunc nuw i8 %38 to i1
  br i1 %39, label %40, label %.critedge

40:                                               ; preds = %36
  %41 = load ptr, ptr %1, align 8, !tbaa !20
  %42 = getelementptr inbounds i8, ptr %41, i64 80
  %43 = load ptr, ptr %42, align 8
  %44 = tail call noundef zeroext i1 %43(ptr noundef nonnull align 8 dereferenceable(56) %1, i32 noundef 2, ptr noundef nonnull %0)
  br label %.critedge

.critedge:                                        ; preds = %6, %40, %36
  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 = !{!6, !7, i64 11}
!23 = !{!24, !16, i64 40}
!24 = !{!"_ZTSN7glslang13TIntermSwitchE", !25, i64 0, !16, i64 32, !16, i64 40, !7, i64 48, !7, i64 49}
!25 = !{!"_ZTS11TIntermNode", !26, i64 8}
!26 = !{!"_ZTSN7glslang10TSourceLocE", !16, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!27 = !{!24, !16, i64 32}
!28 = !{!6, !7, i64 10}


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