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

%"struct.glslang::TTypeLoc" = 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: 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 uwtable
define dso_local void @_ZN7glslang13TIntermediate23mergeImplicitArraySizesERNS_5TTypeERKS1_(ptr noundef nonnull align 8 dereferenceable(1784) %0, ptr noundef nonnull align 8 dereferenceable(144) %1, ptr noundef nonnull align 8 dereferenceable(144) %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds ptr, ptr %10, i64 31
  %12 = load ptr, ptr %11, align 8
  %13 = call noundef zeroext i1 %12(ptr noundef nonnull align 8 dereferenceable(144) %9)
  br i1 %13, label %14, label %56

14:                                               ; preds = %3
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 31
  %18 = load ptr, ptr %17, align 8
  %19 = call noundef zeroext i1 %18(ptr noundef nonnull align 8 dereferenceable(144) %15)
  br i1 %19, label %20, label %41

20:                                               ; preds = %14
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds ptr, ptr %23, i64 18
  %25 = load ptr, ptr %24, align 8
  %26 = call noundef i32 %25(ptr noundef nonnull align 8 dereferenceable(144) %22)
  %27 = load ptr, ptr %21, align 8, !tbaa !9
  %28 = getelementptr inbounds ptr, ptr %27, i64 34
  %29 = load ptr, ptr %28, align 8
  call void %29(ptr noundef nonnull align 8 dereferenceable(144) %21, i32 noundef %26)
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds ptr, ptr %31, i64 32
  %33 = load ptr, ptr %32, align 8
  %34 = call noundef zeroext i1 %33(ptr noundef nonnull align 8 dereferenceable(144) %30)
  br i1 %34, label %35, label %40

35:                                               ; preds = %20
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds ptr, ptr %37, i64 33
  %39 = load ptr, ptr %38, align 8
  call void %39(ptr noundef nonnull align 8 dereferenceable(144) %36)
  br label %40

40:                                               ; preds = %35, %20
  br label %55

41:                                               ; preds = %14
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = getelementptr inbounds ptr, ptr %43, i64 30
  %45 = load ptr, ptr %44, align 8
  %46 = call noundef zeroext i1 %45(ptr noundef nonnull align 8 dereferenceable(144) %42)
  br i1 %46, label %47, label %54

47:                                               ; preds = %41
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds ptr, ptr %50, i64 15
  %52 = load ptr, ptr %51, align 8
  %53 = call noundef i32 %52(ptr noundef nonnull align 8 dereferenceable(144) %49)
  call void @_ZN7glslang5TType20changeOuterArraySizeEi(ptr noundef nonnull align 8 dereferenceable(144) %48, i32 noundef %53)
  br label %54

54:                                               ; preds = %47, %41
  br label %55

55:                                               ; preds = %54, %40
  br label %56

56:                                               ; preds = %55, %3
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = getelementptr inbounds ptr, ptr %58, i64 35
  %60 = load ptr, ptr %59, align 8
  %61 = call noundef zeroext i1 %60(ptr noundef nonnull align 8 dereferenceable(144) %57)
  br i1 %61, label %62, label %76

62:                                               ; preds = %56
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = getelementptr inbounds ptr, ptr %64, i64 35
  %66 = load ptr, ptr %65, align 8
  %67 = call noundef zeroext i1 %66(ptr noundef nonnull align 8 dereferenceable(144) %63)
  br i1 %67, label %68, label %76

68:                                               ; preds = %62
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %69)
  %71 = call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %70) #3
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %72)
  %74 = call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %73) #3
  %75 = icmp ne i64 %71, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %68, %62, %56
  br label %104

77:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %101, %77
  %79 = load i32, ptr %7, align 4, !tbaa !11
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %80)
  %82 = call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %81) #3
  %83 = trunc i64 %82 to i32
  %84 = icmp slt i32 %79, %83
  br i1 %84, label %86, label %85

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

86:                                               ; preds = %78
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %87)
  %89 = load i32, ptr %7, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %88, i64 noundef %90) #3
  %92 = getelementptr inbounds %"struct.glslang::TTypeLoc", ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !13
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %94)
  %96 = load i32, ptr %7, align 4, !tbaa !11
  %97 = sext i32 %96 to i64
  %98 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %95, i64 noundef %97) #3
  %99 = getelementptr inbounds %"struct.glslang::TTypeLoc", ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !13
  call void @_ZN7glslang13TIntermediate23mergeImplicitArraySizesERNS_5TTypeERKS1_(ptr noundef nonnull align 8 dereferenceable(1784) %8, ptr noundef nonnull align 8 dereferenceable(144) %93, ptr noundef nonnull align 8 dereferenceable(144) %100)
  br label %101

101:                                              ; preds = %86
  %102 = load i32, ptr %7, align 4, !tbaa !11
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %7, align 4, !tbaa !11
  br label %78, !llvm.loop !16

104:                                              ; preds = %85, %76
  ret void
}

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

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

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

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 = !{!14, !6, i64 0}
!14 = !{!"_ZTSN7glslang8TTypeLocE", !6, i64 0, !15, i64 8}
!15 = !{!"_ZTSN7glslang10TSourceLocE", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7glslang13TIntermediate23mergeImplicitArraySizesERNS_5TTypeERKS1_(ptr nocapture noundef nonnull readnone align 8 dereferenceable(1784) %0, ptr noundef nonnull align 8 dereferenceable(144) %1, ptr noundef nonnull align 8 dereferenceable(144) %2) local_unnamed_addr #1 align 2 {
  %4 = load ptr, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 248
  %6 = load ptr, ptr %5, align 8
  %7 = tail call noundef zeroext i1 %6(ptr noundef nonnull align 8 dereferenceable(144) %1)
  br i1 %7, label %8, label %38

8:                                                ; preds = %3
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 248
  %11 = load ptr, ptr %10, align 8
  %12 = tail call noundef zeroext i1 %11(ptr noundef nonnull align 8 dereferenceable(144) %2)
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  br i1 %12, label %14, label %29

14:                                               ; preds = %8
  %15 = getelementptr inbounds i8, ptr %13, i64 144
  %16 = load ptr, ptr %15, align 8
  %17 = tail call noundef i32 %16(ptr noundef nonnull align 8 dereferenceable(144) %2)
  %18 = load ptr, ptr %1, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 272
  %20 = load ptr, ptr %19, align 8
  tail call void %20(ptr noundef nonnull align 8 dereferenceable(144) %1, i32 noundef %17)
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 256
  %23 = load ptr, ptr %22, align 8
  %24 = tail call noundef zeroext i1 %23(ptr noundef nonnull align 8 dereferenceable(144) %2)
  br i1 %24, label %25, label %38

25:                                               ; preds = %14
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 264
  %28 = load ptr, ptr %27, align 8
  tail call void %28(ptr noundef nonnull align 8 dereferenceable(144) %1)
  br label %38

29:                                               ; preds = %8
  %30 = getelementptr inbounds i8, ptr %13, i64 240
  %31 = load ptr, ptr %30, align 8
  %32 = tail call noundef zeroext i1 %31(ptr noundef nonnull align 8 dereferenceable(144) %2)
  br i1 %32, label %33, label %38

33:                                               ; preds = %29
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 120
  %36 = load ptr, ptr %35, align 8
  %37 = tail call noundef i32 %36(ptr noundef nonnull align 8 dereferenceable(144) %2)
  tail call void @_ZN7glslang5TType20changeOuterArraySizeEi(ptr noundef nonnull align 8 dereferenceable(144) %1, i32 noundef %37)
  br label %38

38:                                               ; preds = %25, %14, %33, %29, %3
  %39 = load ptr, ptr %1, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 280
  %41 = load ptr, ptr %40, align 8
  %42 = tail call noundef zeroext i1 %41(ptr noundef nonnull align 8 dereferenceable(144) %1)
  br i1 %42, label %43, label %.loopexit

43:                                               ; preds = %38
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 280
  %46 = load ptr, ptr %45, align 8
  %47 = tail call noundef zeroext i1 %46(ptr noundef nonnull align 8 dereferenceable(144) %2)
  br i1 %47, label %48, label %.loopexit

48:                                               ; preds = %43
  %49 = tail call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %1)
  %50 = tail call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %49) #2
  %51 = tail call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %2)
  %52 = tail call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %51) #2
  %.not = icmp eq i64 %50, %52
  br i1 %.not, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %48
  %53 = tail call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %1)
  %54 = tail call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %53) #2
  %55 = trunc i64 %54 to i32
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %57 = tail call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %1)
  %58 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %57, i64 noundef %indvars.iv) #2
  %59 = load ptr, ptr %58, align 8, !tbaa !8
  %60 = tail call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %2)
  %61 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %60, i64 noundef %indvars.iv) #2
  %62 = load ptr, ptr %61, align 8, !tbaa !8
  tail call void @_ZN7glslang13TIntermediate23mergeImplicitArraySizesERNS_5TTypeERKS1_(ptr noundef nonnull align 8 dereferenceable(1784) %0, ptr noundef nonnull align 8 dereferenceable(144) %59, ptr noundef nonnull align 8 dereferenceable(144) %62)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %63 = tail call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %1)
  %64 = tail call noundef i64 @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %63) #2
  %sext = shl i64 %64, 32
  %65 = ashr exact i64 %sext, 32
  %66 = icmp slt i64 %indvars.iv.next, %65
  br i1 %66, label %.lr.ph, label %.loopexit, !llvm.loop !14

.loopexit:                                        ; preds = %.lr.ph, %.preheader, %38, %43, %48
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7glslang5TType20changeOuterArraySizeEi(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef) local_unnamed_addr #1 align 2

attributes #0 = { 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 #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 = { 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, !10, i64 0}
!9 = !{!"_ZTSN7glslang8TTypeLocE", !10, i64 0, !12, i64 8}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"_ZTSN7glslang10TSourceLocE", !10, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!13 = !{!"int", !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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