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

; 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::TConstTraverser" = type { %"class.glslang::TIntermTraverser", i32, %"class.glslang::TConstUnionArray", i32, ptr, i32, i8, i8, i32, i8, i32, i32 }
%"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::TConstUnionArray" = type { 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7glslang13TIntermediate14parseConstTreeEP11TIntermNodeNS_16TConstUnionArrayENS_9TOperatorERKNS_5TTypeEb(ptr noundef nonnull align 8 dereferenceable(1784) %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef nonnull align 8 dereferenceable(144) %4, i1 noundef zeroext %5) #1 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca %"class.glslang::TConstTraverser", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store i32 %3, ptr %11, align 4, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  %18 = zext i1 %5 to i8
  store i8 %18, ptr %13, align 1, !tbaa !11
  %19 = load ptr, ptr %8, align 8
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %6
  store i1 false, ptr %7, align 1
  br label %43

23:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 120, ptr %14) #3
  %24 = load i8, ptr %13, align 1, !tbaa !11, !range !13, !noundef !14
  %25 = trunc i8 %24 to i1
  %26 = load i32, ptr %11, align 4, !tbaa !9
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN7glslang15TConstTraverserC2ERKNS_16TConstUnionArrayEbNS_9TOperatorERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(120) %14, ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext %25, i32 noundef %26, ptr noundef nonnull align 8 dereferenceable(144) %27)
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !15
  %30 = getelementptr inbounds ptr, ptr %29, i64 2
  %31 = load ptr, ptr %30, align 8
  invoke void %31(ptr noundef nonnull align 8 dereferenceable(32) %28, ptr noundef %14)
          to label %32 unwind label %37

32:                                               ; preds = %23
  %33 = getelementptr inbounds %"class.glslang::TConstTraverser", ptr %14, i32 0, i32 7
  %34 = load i8, ptr %33, align 1, !tbaa !17, !range !13, !noundef !14
  %35 = trunc i8 %34 to i1
  br i1 %35, label %36, label %41

36:                                               ; preds = %32
  store i1 true, ptr %7, align 1
  store i32 1, ptr %17, align 4
  br label %42

37:                                               ; preds = %23
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %15, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %16, align 4
  call void @_ZN7glslang15TConstTraverserD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %14) #3
  call void @llvm.lifetime.end.p0(i64 120, ptr %14) #3
  br label %45

41:                                               ; preds = %32
  store i1 false, ptr %7, align 1
  store i32 1, ptr %17, align 4
  br label %42

42:                                               ; preds = %41, %36
  call void @_ZN7glslang15TConstTraverserD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %14) #3
  call void @llvm.lifetime.end.p0(i64 120, ptr %14) #3
  br label %43

43:                                               ; preds = %42, %22
  %44 = load i1, ptr %7, align 1
  ret i1 %44

45:                                               ; preds = %37
  %46 = load ptr, ptr %15, align 8
  %47 = load i32, ptr %16, align 4
  %48 = insertvalue { ptr, i32 } poison, ptr %46, 0
  %49 = insertvalue { ptr, i32 } %48, i32 %47, 1
  resume { ptr, i32 } %49
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7glslang15TConstTraverserC2ERKNS_16TConstUnionArrayEbNS_9TOperatorERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext, i32 noundef, ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang15TConstTraverserD2Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #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 = { inlinehint 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 = !{!"_ZTSN7glslang9TOperatorE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{!18, !12, i64 101}
!18 = !{!"_ZTSN7glslang15TConstTraverserE", !19, i64 0, !20, i64 56, !27, i64 64, !10, i64 80, !6, i64 88, !10, i64 96, !12, i64 100, !12, i64 101, !20, i64 104, !12, i64 108, !20, i64 112, !20, i64 116}
!19 = !{!"_ZTSN7glslang16TIntermTraverserE", !12, i64 8, !12, i64 9, !12, i64 10, !12, i64 11, !20, i64 12, !20, i64 16, !21, i64 24}
!20 = !{!"int", !7, i64 0}
!21 = !{!"_ZTSN7glslang7TVectorIP11TIntermNodeEE", !22, i64 0}
!22 = !{!"_ZTSSt6vectorIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE12_Vector_implE", !25, i64 0, !26, i64 8}
!25 = !{!"_ZTSN7glslang14pool_allocatorIP11TIntermNodeEE", !6, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!"_ZTSN7glslang16TConstUnionArrayE", !6, i64 8}


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

%"class.glslang::TConstTraverser" = type { %"class.glslang::TIntermTraverser", i32, %"class.glslang::TConstUnionArray", i32, ptr, i32, i8, i8, i32, i8, i32, i32 }
%"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::TConstUnionArray" = type { ptr, ptr }

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7glslang13TIntermediate14parseConstTreeEP11TIntermNodeNS_16TConstUnionArrayENS_9TOperatorERKNS_5TTypeEb(ptr nocapture noundef nonnull readnone align 8 dereferenceable(1784) %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef nonnull align 8 dereferenceable(144) %4, i1 noundef zeroext %5) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.glslang::TConstTraverser", align 8
  %8 = icmp eq ptr %1, null
  br i1 %8, label %19, label %9

9:                                                ; preds = %6
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %7) #3
  call void @_ZN7glslang15TConstTraverserC2ERKNS_16TConstUnionArrayEbNS_9TOperatorERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(120) %7, ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext %5, i32 noundef %3, ptr noundef nonnull align 8 dereferenceable(144) %4)
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  %12 = load ptr, ptr %11, align 8
  invoke void %12(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull %7)
          to label %13 unwind label %17

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %7, i64 101
  %15 = load i8, ptr %14, align 1, !tbaa !8, !range !23, !noundef !24
  %16 = trunc nuw i8 %15 to i1
  call void @_ZN7glslang15TConstTraverserD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %7) #3
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %7) #3
  br label %19

17:                                               ; preds = %9
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7glslang15TConstTraverserD2Ev(ptr noundef nonnull align 8 dereferenceable(120) %7) #3
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %7) #3
  resume { ptr, i32 } %18

19:                                               ; preds = %6, %13
  %.1 = phi i1 [ %16, %13 ], [ false, %6 ]
  ret i1 %.1
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7glslang15TConstTraverserC2ERKNS_16TConstUnionArrayEbNS_9TOperatorERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext, i32 noundef, ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang15TConstTraverserD2Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #2 align 2

attributes #0 = { mustprogress 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 = { inlinehint 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !11, i64 101}
!9 = !{!"_ZTSN7glslang15TConstTraverserE", !10, i64 0, !13, i64 56, !21, i64 64, !22, i64 80, !19, i64 88, !22, i64 96, !11, i64 100, !11, i64 101, !13, i64 104, !11, i64 108, !13, i64 112, !13, i64 116}
!10 = !{!"_ZTSN7glslang16TIntermTraverserE", !11, i64 8, !11, i64 9, !11, i64 10, !11, i64 11, !13, i64 12, !13, i64 16, !14, i64 24}
!11 = !{!"bool", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"int", !12, 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, !20, i64 8}
!18 = !{!"_ZTSN7glslang14pool_allocatorIP11TIntermNodeEE", !19, i64 0}
!19 = !{!"any pointer", !12, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIP11TIntermNodeN7glslang14pool_allocatorIS1_EEE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!21 = !{!"_ZTSN7glslang16TConstUnionArrayE", !19, i64 8}
!22 = !{!"_ZTSN7glslang9TOperatorE", !12, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}


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