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

; 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 uwtable
declare dso_local noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144)) #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) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7glslang13TIntermediate9getOffsetERKNS_5TTypeEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) #1 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %11)
  store ptr %12, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %13, i64 noundef %15) #3
  %17 = getelementptr inbounds %"struct.glslang::TTypeLoc", ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = load ptr, ptr %18, align 8, !tbaa !14
  %20 = getelementptr inbounds ptr, ptr %19, i64 10
  %21 = load ptr, ptr %20, align 8
  %22 = call noundef nonnull align 8 dereferenceable(72) ptr %21(ptr noundef nonnull align 8 dereferenceable(144) %18)
  %23 = call noundef zeroext i1 @_ZNK7glslang10TQualifier9hasOffsetEv(ptr noundef nonnull align 8 dereferenceable(72) %22)
  br i1 %23, label %24, label %37

24:                                               ; preds = %2
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %25, i64 noundef %27) #3
  %29 = getelementptr inbounds %"struct.glslang::TTypeLoc", ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  %32 = getelementptr inbounds ptr, ptr %31, i64 10
  %33 = load ptr, ptr %32, align 8
  %34 = call noundef nonnull align 8 dereferenceable(72) ptr %33(ptr noundef nonnull align 8 dereferenceable(144) %30)
  %35 = getelementptr inbounds %"class.glslang::TQualifier", ptr %34, i32 0, i32 4
  %36 = load i32, ptr %35, align 4, !tbaa !16
  store i32 %36, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %64

37:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %59, %37
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %62

43:                                               ; preds = %38
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = load i32, ptr %10, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %45, i64 noundef %47) #3
  %49 = getelementptr inbounds %"struct.glslang::TTypeLoc", ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  call void @_ZN7glslang13TIntermediate12updateOffsetERKNS_5TTypeES3_RiS4_(ptr noundef nonnull align 8 dereferenceable(144) %44, ptr noundef nonnull align 8 dereferenceable(144) %50, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %54, label %58

54:                                               ; preds = %43
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = add nsw i32 %56, %55
  store i32 %57, ptr %9, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %54, %43
  br label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %10, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %10, align 4, !tbaa !9
  br label %38, !llvm.loop !25

62:                                               ; preds = %42
  %63 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %63, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %64

64:                                               ; preds = %62, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %65 = load i32, ptr %3, align 4
  ret i32 %65
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7glslang10TQualifier9hasOffsetEv(ptr noundef nonnull align 8 dereferenceable(72)) #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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN7glslang8TTypeLocE", !6, i64 0, !13, i64 8}
!13 = !{!"_ZTSN7glslang10TSourceLocE", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!14 = !{!15, !15, i64 0}
!15 = !{!"vtable pointer", !8, i64 0}
!16 = !{!17, !10, i64 20}
!17 = !{!"_ZTSN7glslang10TQualifierE", !6, i64 0, !18, i64 8, !19, i64 8, !19, i64 9, !20, i64 11, !21, i64 11, !21, i64 11, !21, i64 11, !21, i64 11, !21, i64 11, !21, i64 12, !21, i64 12, !21, i64 12, !21, i64 12, !21, i64 12, !21, i64 12, !21, i64 12, !21, i64 12, !21, i64 13, !21, i64 13, !21, i64 13, !21, i64 13, !21, i64 13, !21, i64 13, !21, i64 13, !21, i64 13, !21, i64 14, !21, i64 14, !21, i64 14, !21, i64 14, !21, i64 14, !21, i64 14, !21, i64 14, !21, i64 14, !21, i64 15, !21, i64 15, !21, i64 15, !22, i64 15, !23, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 29, !10, i64 29, !10, i64 32, !10, i64 34, !10, i64 35, !10, i64 36, !10, i64 36, !10, i64 38, !10, i64 40, !10, i64 41, !10, i64 42, !24, i64 44, !21, i64 45, !21, i64 46, !21, i64 47, !21, i64 48, !10, i64 52, !21, i64 56, !10, i64 60, !6, i64 64}
!18 = !{!"_ZTSN7glslang17TStorageQualifierE", !7, i64 0}
!19 = !{!"_ZTSN7glslang16TBuiltInVariableE", !7, i64 0}
!20 = !{!"_ZTSN7glslang19TPrecisionQualifierE", !7, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSN7glslang13TLayoutMatrixE", !7, i64 0}
!23 = !{!"_ZTSN7glslang14TLayoutPackingE", !7, i64 0}
!24 = !{!"_ZTSN7glslang13TLayoutFormatE", !7, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"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 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

; 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 #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7glslang13TIntermediate9getOffsetERKNS_5TTypeEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call noundef ptr @_ZNK7glslang5TType9getStructEv(ptr noundef nonnull align 8 dereferenceable(144) %0)
  %6 = sext i32 %1 to i64
  %7 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %6) #3
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %9, i64 80
  %11 = load ptr, ptr %10, align 8
  %12 = tail call noundef nonnull align 8 dereferenceable(72) ptr %11(ptr noundef nonnull align 8 dereferenceable(144) %8)
  %13 = tail call noundef zeroext i1 @_ZNK7glslang10TQualifier9hasOffsetEv(ptr noundef nonnull align 8 dereferenceable(72) %12)
  br i1 %13, label %14, label %23

14:                                               ; preds = %2
  %15 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %6) #3
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  %18 = getelementptr inbounds i8, ptr %17, i64 80
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef nonnull align 8 dereferenceable(72) ptr %19(ptr noundef nonnull align 8 dereferenceable(144) %16)
  %21 = getelementptr inbounds i8, ptr %20, i64 20
  %22 = load i32, ptr %21, align 4, !tbaa !14
  br label %34

23:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  store i32 0, ptr %3, align 4, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  store i32 0, ptr %4, align 4, !tbaa !23
  %.not15 = icmp slt i32 %1, 0
  br i1 %.not15, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %23
  %24 = add nuw i32 %1, 1
  %wide.trip.count = zext i32 %24 to i64
  br label %.lr.ph

._crit_edge.loopexit:                             ; preds = %33
  %.pre = load i32, ptr %4, align 4, !tbaa !23
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %23
  %25 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ 0, %23 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  br label %34

.lr.ph:                                           ; preds = %.lr.ph.preheader, %33
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %33 ]
  %26 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN7glslang8TTypeLocENS0_14pool_allocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %indvars.iv) #3
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  call void @_ZN7glslang13TIntermediate12updateOffsetERKNS_5TTypeES3_RiS4_(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(144) %27, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %28 = icmp slt i64 %indvars.iv, %6
  br i1 %28, label %29, label %33

29:                                               ; preds = %.lr.ph
  %30 = load i32, ptr %3, align 4, !tbaa !23
  %31 = load i32, ptr %4, align 4, !tbaa !23
  %32 = add nsw i32 %31, %30
  store i32 %32, ptr %4, align 4, !tbaa !23
  br label %33

33:                                               ; preds = %.lr.ph, %29
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !24

34:                                               ; preds = %._crit_edge, %14
  %.013 = phi i32 [ %22, %14 ], [ %25, %._crit_edge ]
  ret i32 %.013
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7glslang10TQualifier9hasOffsetEv(ptr noundef nonnull align 8 dereferenceable(72)) local_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 = { 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, !7, i64 0}
!6 = !{!"_ZTSN7glslang8TTypeLocE", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN7glslang10TSourceLocE", !7, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"vtable pointer", !9, i64 0}
!14 = !{!15, !11, i64 20}
!15 = !{!"_ZTSN7glslang10TQualifierE", !7, i64 0, !16, i64 8, !17, i64 8, !17, i64 9, !18, i64 11, !19, i64 11, !19, i64 11, !19, i64 11, !19, i64 11, !19, i64 11, !19, i64 12, !19, i64 12, !19, i64 12, !19, i64 12, !19, i64 12, !19, i64 12, !19, i64 12, !19, i64 12, !19, i64 13, !19, i64 13, !19, i64 13, !19, i64 13, !19, i64 13, !19, i64 13, !19, i64 13, !19, i64 13, !19, i64 14, !19, i64 14, !19, i64 14, !19, i64 14, !19, i64 14, !19, i64 14, !19, i64 14, !19, i64 14, !19, i64 15, !19, i64 15, !19, i64 15, !20, i64 15, !21, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 29, !11, i64 29, !11, i64 32, !11, i64 34, !11, i64 35, !11, i64 36, !11, i64 36, !11, i64 38, !11, i64 40, !11, i64 41, !11, i64 42, !22, i64 44, !19, i64 45, !19, i64 46, !19, i64 47, !19, i64 48, !11, i64 52, !19, i64 56, !11, i64 60, !7, i64 64}
!16 = !{!"_ZTSN7glslang17TStorageQualifierE", !8, i64 0}
!17 = !{!"_ZTSN7glslang16TBuiltInVariableE", !8, i64 0}
!18 = !{!"_ZTSN7glslang19TPrecisionQualifierE", !8, i64 0}
!19 = !{!"bool", !8, i64 0}
!20 = !{!"_ZTSN7glslang13TLayoutMatrixE", !8, i64 0}
!21 = !{!"_ZTSN7glslang14TLayoutPackingE", !8, i64 0}
!22 = !{!"_ZTSN7glslang13TLayoutFormatE", !8, i64 0}
!23 = !{!11, !11, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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