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

; 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.std::_List_const_iterator" = type { ptr }
%"struct.glslang::TAttributeArgs" = type { i32, ptr }

@.str.14 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [37 x i8], align 1

; 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 i32 @_ZNK7glslang14TAttributeArgs4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt20_List_const_iteratorIN7glslang14TAttributeArgsEES4_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7glslang13TParseContext22handleSwitchAttributesERKNS_5TListINS_14TAttributeArgsEEEP11TIntermNode(ptr noundef nonnull align 8 dereferenceable(24912) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::_List_const_iterator", align 8
  %10 = alloca %"struct.std::_List_const_iterator", align 8
  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
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds ptr, ptr %13, i64 10
  %15 = load ptr, ptr %14, align 8
  %16 = call noundef ptr %15(ptr noundef nonnull align 8 dereferenceable(32) %12)
  store ptr %16, ptr %7, align 8, !tbaa !5
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %3
  store i32 1, ptr %8, align 4
  br label %64

20:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = call ptr @_ZNKSt7__cxx114listIN7glslang14TAttributeArgsENS1_14pool_allocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) %21) #3
  %23 = getelementptr inbounds %"struct.std::_List_const_iterator", ptr %9, i32 0, i32 0
  store ptr %22, ptr %23, align 8
  br label %24

24:                                               ; preds = %61, %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call ptr @_ZNKSt7__cxx114listIN7glslang14TAttributeArgsENS1_14pool_allocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(32) %25) #3
  %27 = getelementptr inbounds %"struct.std::_List_const_iterator", ptr %10, i32 0, i32 0
  store ptr %26, ptr %27, align 8
  %28 = call noundef zeroext i1 @_ZStneRKSt20_List_const_iteratorIN7glslang14TAttributeArgsEES4_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br i1 %28, label %30, label %29

29:                                               ; preds = %24
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %63

30:                                               ; preds = %24
  %31 = call noundef ptr @_ZNKSt20_List_const_iteratorIN7glslang14TAttributeArgsEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  %32 = call noundef i32 @_ZNK7glslang14TAttributeArgs4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %31)
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %34, label %43

34:                                               ; preds = %30
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds ptr, ptr %36, i64 0
  %38 = load ptr, ptr %37, align 8
  %39 = call noundef nonnull align 8 dereferenceable(24) ptr %38(ptr noundef nonnull align 8 dereferenceable(32) %35)
  %40 = load ptr, ptr %11, align 8, !tbaa !9
  %41 = getelementptr inbounds ptr, ptr %40, i64 43
  %42 = load ptr, ptr %41, align 8
  call void (ptr, ptr, ptr, ptr, ptr, ...) %42(ptr noundef nonnull align 8 dereferenceable(1176) %11, ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef @.str.14, ptr noundef @.str.15, ptr noundef @.str.15)
  br label %61

43:                                               ; preds = %30
  %44 = call noundef ptr @_ZNKSt20_List_const_iteratorIN7glslang14TAttributeArgsEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  %45 = getelementptr inbounds %"struct.glslang::TAttributeArgs", ptr %44, i32 0, i32 0
  %46 = load i32, ptr %45, align 8, !tbaa !11
  switch i32 %46, label %51 [
    i32 7, label %47
    i32 2, label %49
  ]

47:                                               ; preds = %43
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN7glslang13TIntermSwitch10setFlattenEv(ptr noundef nonnull align 8 dereferenceable(50) %48)
  br label %60

49:                                               ; preds = %43
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN7glslang13TIntermSwitch14setDontFlattenEv(ptr noundef nonnull align 8 dereferenceable(50) %50)
  br label %60

51:                                               ; preds = %43
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  %54 = getelementptr inbounds ptr, ptr %53, i64 0
  %55 = load ptr, ptr %54, align 8
  %56 = call noundef nonnull align 8 dereferenceable(24) ptr %55(ptr noundef nonnull align 8 dereferenceable(32) %52)
  %57 = load ptr, ptr %11, align 8, !tbaa !9
  %58 = getelementptr inbounds ptr, ptr %57, i64 43
  %59 = load ptr, ptr %58, align 8
  call void (ptr, ptr, ptr, ptr, ptr, ...) %59(ptr noundef nonnull align 8 dereferenceable(1176) %11, ptr noundef nonnull align 8 dereferenceable(24) %56, ptr noundef @.str.17, ptr noundef @.str.15, ptr noundef @.str.15)
  br label %60

60:                                               ; preds = %51, %49, %47
  br label %61

61:                                               ; preds = %60, %34
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt20_List_const_iteratorIN7glslang14TAttributeArgsEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  br label %24, !llvm.loop !14

63:                                               ; preds = %29
  store i32 0, ptr %8, align 4
  br label %64

64:                                               ; preds = %63, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %65 = load i32, ptr %8, align 4
  switch i32 %65, label %67 [
    i32 0, label %66
    i32 1, label %66
  ]

66:                                               ; preds = %64, %64
  ret void

67:                                               ; preds = %64
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang13TIntermSwitch10setFlattenEv(ptr noundef nonnull align 8 dereferenceable(50)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang13TIntermSwitch14setDontFlattenEv(ptr noundef nonnull align 8 dereferenceable(50)) #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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN7glslang14TAttributeArgsE", !13, i64 0, !6, i64 8}
!13 = !{!"_ZTSN7glslang14TAttributeTypeE", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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"

%"struct.std::_List_const_iterator" = type { ptr }

@.str.14 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [37 x i8], align 1

; 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 i32 @_ZNK7glslang14TAttributeArgs4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt20_List_const_iteratorIN7glslang14TAttributeArgsEES4_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7glslang13TParseContext22handleSwitchAttributesERKNS_5TListINS_14TAttributeArgsEEEP11TIntermNode(ptr noundef nonnull align 8 dereferenceable(24912) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"struct.std::_List_const_iterator", align 8
  %5 = alloca %"struct.std::_List_const_iterator", align 8
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 80
  %8 = load ptr, ptr %7, align 8
  %9 = tail call noundef ptr %8(ptr noundef nonnull align 8 dereferenceable(32) %2)
  %10 = icmp eq ptr %9, null
  br i1 %10, label %41, label %11

11:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %12 = tail call ptr @_ZNKSt7__cxx114listIN7glslang14TAttributeArgsENS1_14pool_allocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  store ptr %12, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %13 = tail call ptr @_ZNKSt7__cxx114listIN7glslang14TAttributeArgsENS1_14pool_allocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  store ptr %13, ptr %5, align 8
  %14 = call noundef zeroext i1 @_ZStneRKSt20_List_const_iteratorIN7glslang14TAttributeArgsEES4_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br i1 %14, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %37, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %41

.lr.ph:                                           ; preds = %11, %37
  %15 = call noundef ptr @_ZNKSt20_List_const_iteratorIN7glslang14TAttributeArgsEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  %16 = call noundef i32 @_ZNK7glslang14TAttributeArgs4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %15)
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %18, label %25

18:                                               ; preds = %.lr.ph
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = load ptr, ptr %19, align 8
  %21 = call noundef nonnull align 8 dereferenceable(24) ptr %20(ptr noundef nonnull align 8 dereferenceable(32) %2)
  %22 = load ptr, ptr %0, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 344
  %24 = load ptr, ptr %23, align 8
  call void (ptr, ptr, ptr, ptr, ptr, ...) %24(ptr noundef nonnull align 8 dereferenceable(1176) %0, ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.15)
  br label %37

25:                                               ; preds = %.lr.ph
  %26 = call noundef ptr @_ZNKSt20_List_const_iteratorIN7glslang14TAttributeArgsEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  %27 = load i32, ptr %26, align 8, !tbaa !8
  switch i32 %27, label %30 [
    i32 7, label %28
    i32 2, label %29
  ]

28:                                               ; preds = %25
  call void @_ZN7glslang13TIntermSwitch10setFlattenEv(ptr noundef nonnull align 8 dereferenceable(50) %9)
  br label %37

29:                                               ; preds = %25
  call void @_ZN7glslang13TIntermSwitch14setDontFlattenEv(ptr noundef nonnull align 8 dereferenceable(50) %9)
  br label %37

30:                                               ; preds = %25
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = load ptr, ptr %31, align 8
  %33 = call noundef nonnull align 8 dereferenceable(24) ptr %32(ptr noundef nonnull align 8 dereferenceable(32) %2)
  %34 = load ptr, ptr %0, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 344
  %36 = load ptr, ptr %35, align 8
  call void (ptr, ptr, ptr, ptr, ptr, ...) %36(ptr noundef nonnull align 8 dereferenceable(1176) %0, ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.15)
  br label %37

37:                                               ; preds = %28, %29, %30, %18
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt20_List_const_iteratorIN7glslang14TAttributeArgsEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %39 = call ptr @_ZNKSt7__cxx114listIN7glslang14TAttributeArgsENS1_14pool_allocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  store ptr %39, ptr %5, align 8
  %40 = call noundef zeroext i1 @_ZStneRKSt20_List_const_iteratorIN7glslang14TAttributeArgsEES4_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br i1 %40, label %.lr.ph, label %._crit_edge, !llvm.loop !13

41:                                               ; preds = %3, %._crit_edge
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang13TIntermSwitch10setFlattenEv(ptr noundef nonnull align 8 dereferenceable(50)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7glslang13TIntermSwitch14setDontFlattenEv(ptr noundef nonnull align 8 dereferenceable(50)) 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, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 0}
!9 = !{!"_ZTSN7glslang14TAttributeArgsE", !10, i64 0, !12, i64 8}
!10 = !{!"_ZTSN7glslang14TAttributeTypeE", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"any pointer", !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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