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

; 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::TType" = type { ptr, i32, [4 x i8], %"class.glslang::TQualifier", ptr, %union.anon.84, ptr, ptr, %"struct.glslang::TSampler", ptr, ptr }
%"class.glslang::TQualifier" = type <{ ptr, i64, i8, [3 x i8], i32, i32, i64, i64, i8, i8, i8, i8, i8, [3 x i8], i32, i8, [3 x i8], i32, ptr }>
%union.anon.84 = type { ptr }
%"struct.glslang::TSampler" = type { i32 }

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

declare i32 @__gxx_personality_v0(...)

; 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 i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7glslang13TIntermediate30computeTypeUniformLocationSizeERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(144) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %"class.glslang::TType", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.glslang::TType", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds ptr, ptr %12, i64 29
  %14 = load ptr, ptr %13, align 8
  %15 = call noundef zeroext i1 %14(ptr noundef nonnull align 8 dereferenceable(144) %11)
  br i1 %15, label %16, label %42

16:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 144, ptr %4) #3
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN7glslang5TTypeC2ERKS0_ib(ptr noundef nonnull align 8 dereferenceable(144) %4, ptr noundef nonnull align 8 dereferenceable(144) %17, i32 noundef 0, i1 noundef zeroext false)
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds ptr, ptr %19, i64 30
  %21 = load ptr, ptr %20, align 8
  %22 = invoke noundef zeroext i1 %21(ptr noundef nonnull align 8 dereferenceable(144) %18)
          to label %23 unwind label %34

23:                                               ; preds = %16
  br i1 %22, label %24, label %38

24:                                               ; preds = %23
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds ptr, ptr %26, i64 15
  %28 = load ptr, ptr %27, align 8
  %29 = invoke noundef i32 %28(ptr noundef nonnull align 8 dereferenceable(144) %25)
          to label %30 unwind label %34

30:                                               ; preds = %24
  %31 = invoke noundef i32 @_ZN7glslang13TIntermediate30computeTypeUniformLocationSizeERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(144) %4)
          to label %32 unwind label %34

32:                                               ; preds = %30
  %33 = mul nsw i32 %29, %31
  store i32 %33, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %41

34:                                               ; preds = %38, %30, %24, %16
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %5, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %6, align 4
  call void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %4) #3
  call void @llvm.lifetime.end.p0(i64 144, ptr %4) #3
  br label %76

38:                                               ; preds = %23
  %39 = invoke noundef i32 @_ZN7glslang13TIntermediate30computeTypeUniformLocationSizeERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(144) %4)
          to label %40 unwind label %34

40:                                               ; preds = %38
  store i32 %39, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %41

41:                                               ; preds = %40, %32
  call void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %4) #3
  call void @llvm.lifetime.end.p0(i64 144, ptr %4) #3
  br label %74

42:                                               ; preds = %1
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %44, i64 35
  %46 = load ptr, ptr %45, align 8
  %47 = call noundef zeroext i1 %46(ptr noundef nonnull align 8 dereferenceable(144) %43)
  br i1 %47, label %48, label %73

48:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %49

49:                                               ; preds = %64, %48
  %50 = load i32, ptr %9, align 4, !tbaa !11
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %51)
  %53 = call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %52) #3
  %54 = trunc i64 %53 to i32
  %55 = icmp slt i32 %50, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %49
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %71

57:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 144, ptr %10) #3
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = load i32, ptr %9, align 4, !tbaa !11
  call void @_ZN7glslang5TTypeC2ERKS0_ib(ptr noundef nonnull align 8 dereferenceable(144) %10, ptr noundef nonnull align 8 dereferenceable(144) %58, i32 noundef %59, i1 noundef zeroext false)
  %60 = invoke noundef i32 @_ZN7glslang13TIntermediate30computeTypeUniformLocationSizeERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(144) %10)
          to label %61 unwind label %67

61:                                               ; preds = %57
  %62 = load i32, ptr %8, align 4, !tbaa !11
  %63 = add nsw i32 %62, %60
  store i32 %63, ptr %8, align 4, !tbaa !11
  call void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %10) #3
  call void @llvm.lifetime.end.p0(i64 144, ptr %10) #3
  br label %64

64:                                               ; preds = %61
  %65 = load i32, ptr %9, align 4, !tbaa !11
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %9, align 4, !tbaa !11
  br label %49, !llvm.loop !13

67:                                               ; preds = %57
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %5, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %6, align 4
  call void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %10) #3
  call void @llvm.lifetime.end.p0(i64 144, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %76

71:                                               ; preds = %56
  %72 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %72, ptr %2, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %74

73:                                               ; preds = %42
  store i32 1, ptr %2, align 4
  br label %74

74:                                               ; preds = %73, %71, %41
  %75 = load i32, ptr %2, align 4
  ret i32 %75

76:                                               ; preds = %67, %34
  %77 = load ptr, ptr %5, align 8
  %78 = load i32, ptr %6, align 4
  %79 = insertvalue { ptr, i32 } poison, ptr %77, 0
  %80 = insertvalue { ptr, i32 } %79, i32 %78, 1
  resume { ptr, i32 } %80
}

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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

%"class.glslang::TType" = type { ptr, i32, [4 x i8], %"class.glslang::TQualifier", ptr, %union.anon.84, ptr, ptr, %"struct.glslang::TSampler", ptr, ptr }
%"class.glslang::TQualifier" = type <{ ptr, i64, i8, [3 x i8], i32, i32, i64, i64, i8, i8, i8, i8, i8, [3 x i8], i32, i8, [3 x i8], i32, ptr }>
%union.anon.84 = type { ptr }
%"struct.glslang::TSampler" = type { i32 }

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress 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 i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7glslang13TIntermediate30computeTypeUniformLocationSizeERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(144) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.glslang::TType", align 8
  %3 = alloca %"class.glslang::TType", align 8
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 232
  %6 = load ptr, ptr %5, align 8
  %7 = tail call noundef zeroext i1 %6(ptr noundef nonnull align 8 dereferenceable(144) %0)
  br i1 %7, label %8, label %28

8:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %2) #3
  call void @_ZN7glslang5TTypeC2ERKS0_ib(ptr noundef nonnull align 8 dereferenceable(144) %2, ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef 0, i1 noundef zeroext false)
  %9 = load ptr, ptr %0, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 240
  %11 = load ptr, ptr %10, align 8
  %12 = invoke noundef zeroext i1 %11(ptr noundef nonnull align 8 dereferenceable(144) %0)
          to label %13 unwind label %23

13:                                               ; preds = %8
  br i1 %12, label %14, label %25

14:                                               ; preds = %13
  %15 = load ptr, ptr %0, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 120
  %17 = load ptr, ptr %16, align 8
  %18 = invoke noundef i32 %17(ptr noundef nonnull align 8 dereferenceable(144) %0)
          to label %19 unwind label %23

19:                                               ; preds = %14
  %20 = invoke noundef i32 @_ZN7glslang13TIntermediate30computeTypeUniformLocationSizeERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(144) %2)
          to label %21 unwind label %23

21:                                               ; preds = %19
  %22 = mul nsw i32 %20, %18
  br label %27

23:                                               ; preds = %25, %19, %14, %8
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %2) #3
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %2) #3
  br label %47

25:                                               ; preds = %13
  %26 = invoke noundef i32 @_ZN7glslang13TIntermediate30computeTypeUniformLocationSizeERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(144) %2)
          to label %27 unwind label %23

27:                                               ; preds = %25, %21
  %.017 = phi i32 [ %22, %21 ], [ %26, %25 ]
  call void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %2) #3
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %2) #3
  br label %.loopexit

28:                                               ; preds = %1
  %29 = load ptr, ptr %0, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 280
  %31 = load ptr, ptr %30, align 8
  %32 = tail call noundef zeroext i1 %31(ptr noundef nonnull align 8 dereferenceable(144) %0)
  br i1 %32, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %28
  %33 = tail call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %0)
  %34 = tail call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %33) #3
  %35 = trunc i64 %34 to i32
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %38
  %.021 = phi i32 [ %40, %38 ], [ 0, %.preheader ]
  %.01420 = phi i32 [ %39, %38 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %3) #3
  call void @_ZN7glslang5TTypeC2ERKS0_ib(ptr noundef nonnull align 8 dereferenceable(144) %3, ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %.021, i1 noundef zeroext false)
  %37 = invoke noundef i32 @_ZN7glslang13TIntermediate30computeTypeUniformLocationSizeERKNS_5TTypeE(ptr noundef nonnull align 8 dereferenceable(144) %3)
          to label %38 unwind label %45

38:                                               ; preds = %.lr.ph
  %39 = add nsw i32 %37, %.01420
  call void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %3) #3
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %3) #3
  %40 = add nuw nsw i32 %.021, 1
  %41 = call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %0)
  %42 = call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %41) #3
  %43 = trunc i64 %42 to i32
  %44 = icmp slt i32 %40, %43
  br i1 %44, label %.lr.ph, label %.loopexit, !llvm.loop !8

45:                                               ; preds = %.lr.ph
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7glslang5TTypeD2Ev(ptr noundef nonnull align 8 dereferenceable(144) %3) #3
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %3) #3
  br label %47

.loopexit:                                        ; preds = %38, %.preheader, %28, %27
  %.1 = phi i32 [ %.017, %27 ], [ 1, %28 ], [ 0, %.preheader ], [ %39, %38 ]
  ret i32 %.1

47:                                               ; preds = %45, %23
  %.pn = phi { ptr, i32 } [ %24, %23 ], [ %46, %45 ]
  resume { ptr, i32 } %.pn
}

attributes #0 = { mustprogress 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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