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

; 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::TDefaultIoResolverBase" = type { %"class.glslang::TIoMapResolver", %"class.std::unordered_map", i8, ptr, i32, i32, i32, [15 x i8], [14 x ptr] }
%"class.glslang::TIoMapResolver" = type { ptr }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }

@_ZTVN7glslang22TDefaultIoResolverBaseE = external dso_local unnamed_addr constant { [24 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7glslang22TDefaultIoResolverBaseC2ERKNS_13TIntermediateE(ptr noundef nonnull align 8 dereferenceable(224) %0, ptr noundef nonnull align 8 dereferenceable(1784) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @_ZN7glslang14TIoMapResolverC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  store ptr getelementptr inbounds inrange(-16, 176) ({ [24 x ptr] }, ptr @_ZTVN7glslang22TDefaultIoResolverBaseE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 1
  call void @_ZNSt13unordered_mapIiSt6vectorIiSaIiEESt4hashIiESt8equal_toIiESaISt4pairIKiS2_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #4
  %9 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 2
  store i8 0, ptr %9, align 8, !tbaa !11
  %10 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 3
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %11, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = invoke noundef i32 @_ZNK7glslang13TIntermediate22getUniformLocationBaseEv(ptr noundef nonnull align 8 dereferenceable(1784) %13)
          to label %15 unwind label %29

15:                                               ; preds = %2
  store i32 %14, ptr %12, align 8, !tbaa !22
  %16 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 5
  store i32 0, ptr %16, align 4, !tbaa !23
  %17 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 6
  store i32 0, ptr %17, align 8, !tbaa !24
  %18 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 7
  %19 = getelementptr inbounds [15 x i8], ptr %18, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %19, i8 0, i64 15, i1 false)
  %20 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 8
  %21 = getelementptr inbounds [14 x ptr], ptr %20, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 8 %21, i8 0, i64 112, i1 false)
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.glslang::TDefaultIoResolverBase", ptr %7, i32 0, i32 8
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = invoke noundef i32 @_ZNK7glslang13TIntermediate8getStageEv(ptr noundef nonnull align 8 dereferenceable(1784) %24)
          to label %26 unwind label %29

26:                                               ; preds = %15
  %27 = zext i32 %25 to i64
  %28 = getelementptr inbounds [14 x ptr], ptr %23, i64 0, i64 %27
  store ptr %22, ptr %28, align 8, !tbaa !5
  ret void

29:                                               ; preds = %15, %2
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %5, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %6, align 4
  call void @_ZNSt13unordered_mapIiSt6vectorIiSaIiEESt4hashIiESt8equal_toIiESaISt4pairIKiS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #4
  call void @_ZN7glslang14TIoMapResolverD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  br label %33

33:                                               ; preds = %29
  %34 = load ptr, ptr %5, align 8
  %35 = load i32, ptr %6, align 4
  %36 = insertvalue { ptr, i32 } poison, ptr %34, 0
  %37 = insertvalue { ptr, i32 } %36, i32 %35, 1
  resume { ptr, i32 } %37
}

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

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

attributes #0 = { 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 #1 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !20, i64 64}
!12 = !{!"_ZTSN7glslang22TDefaultIoResolverBaseE", !13, i64 0, !14, i64 8, !20, i64 64, !6, i64 72, !21, i64 80, !21, i64 84, !21, i64 88, !7, i64 92, !7, i64 112}
!13 = !{!"_ZTSN7glslang14TIoMapResolverE"}
!14 = !{!"_ZTSSt13unordered_mapIiSt6vectorIiSaIiEESt4hashIiESt8equal_toIiESaISt4pairIKiS2_EEE", !15, i64 0}
!15 = !{!"_ZTSSt10_HashtableIiSt4pairIKiSt6vectorIiSaIiEEESaIS5_ENSt8__detail10_Select1stESt8equal_toIiESt4hashIiENS7_18_Mod_range_hashingENS7_20_Default_ranged_hashENS7_20_Prime_rehash_policyENS7_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !16, i64 8, !17, i64 16, !16, i64 24, !18, i64 32, !6, i64 48}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!18 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !19, i64 0, !16, i64 8}
!19 = !{!"float", !7, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{!12, !21, i64 80}
!23 = !{!12, !21, i64 84}
!24 = !{!12, !21, i64 88}


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

@_ZTVN7glslang22TDefaultIoResolverBaseE = external dso_local unnamed_addr constant { [24 x ptr] }, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7glslang22TDefaultIoResolverBaseC2ERKNS_13TIntermediateE(ptr noundef nonnull align 8 dereferenceable(224) %0, ptr noundef nonnull align 8 dereferenceable(1784) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN7glslang14TIoMapResolverC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  store ptr getelementptr inbounds inrange(-16, 176) (i8, ptr @_ZTVN7glslang22TDefaultIoResolverBaseE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZNSt13unordered_mapIiSt6vectorIiSaIiEESt4hashIiESt8equal_toIiESaISt4pairIKiS2_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %3) #3
  %4 = getelementptr inbounds i8, ptr %0, i64 64
  store i8 0, ptr %4, align 8, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %1, ptr %5, align 8, !tbaa !21
  %6 = getelementptr inbounds i8, ptr %0, i64 80
  %7 = tail call noundef i32 @_ZNK7glslang13TIntermediate22getUniformLocationBaseEv(ptr noundef nonnull align 8 dereferenceable(1784) %1)
  store i32 %7, ptr %6, align 8, !tbaa !22
  %8 = getelementptr inbounds i8, ptr %0, i64 84
  %9 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(112) %9, i8 0, i64 112, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(23) %8, i8 0, i64 23, i1 false)
  %10 = tail call noundef i32 @_ZNK7glslang13TIntermediate8getStageEv(ptr noundef nonnull align 8 dereferenceable(1784) %1)
  %11 = zext i32 %10 to i64
  %12 = getelementptr inbounds [14 x ptr], ptr %9, i64 0, i64 %11
  store ptr %1, ptr %12, align 8, !tbaa !21
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIiSt6vectorIiSaIiEESt4hashIiESt8equal_toIiESaISt4pairIKiS2_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7glslang13TIntermediate8getStageEv(ptr noundef nonnull align 8 dereferenceable(1784)) local_unnamed_addr #0 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 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !19, i64 64}
!9 = !{!"_ZTSN7glslang22TDefaultIoResolverBaseE", !10, i64 0, !11, i64 8, !19, i64 64, !13, i64 72, !20, i64 80, !20, i64 84, !20, i64 88, !14, i64 92, !14, i64 112}
!10 = !{!"_ZTSN7glslang14TIoMapResolverE"}
!11 = !{!"_ZTSSt13unordered_mapIiSt6vectorIiSaIiEESt4hashIiESt8equal_toIiESaISt4pairIKiS2_EEE", !12, i64 0}
!12 = !{!"_ZTSSt10_HashtableIiSt4pairIKiSt6vectorIiSaIiEEESaIS5_ENSt8__detail10_Select1stESt8equal_toIiESt4hashIiENS7_18_Mod_range_hashingENS7_20_Default_ranged_hashENS7_20_Prime_rehash_policyENS7_17_Hashtable_traitsILb0ELb0ELb1EEEE", !13, i64 0, !15, i64 8, !16, i64 16, !15, i64 24, !17, i64 32, !13, i64 48}
!13 = !{!"any pointer", !14, i64 0}
!14 = !{!"omnipotent char", !7, i64 0}
!15 = !{!"long", !14, i64 0}
!16 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !13, i64 0}
!17 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !18, i64 0, !15, i64 8}
!18 = !{!"float", !14, i64 0}
!19 = !{!"bool", !14, i64 0}
!20 = !{!"int", !14, i64 0}
!21 = !{!13, !13, i64 0}
!22 = !{!9, !20, i64 80}


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