; LLVM IR from niessner/Matterport :: code/gaps/pkgs/RNBasics/json.ll (ZN4Json9OurReaderC2ERKNS_11OurFeaturesE)

; 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.Json::OurReader" = type <{ %"class.std::stack", %"class.std::deque.13", %"class.std::__cxx11::basic_string", ptr, ptr, ptr, ptr, ptr, %"class.std::__cxx11::basic_string", i32, %"class.Json::OurFeatures", i8, [7 x i8] }>
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<Json::Value *, std::allocator<Json::Value *>>::_Deque_impl" }
%"struct.std::_Deque_base<Json::Value *, std::allocator<Json::Value *>>::_Deque_impl" = type { %"struct.std::_Deque_base<Json::Value *, std::allocator<Json::Value *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<Json::Value *, std::allocator<Json::Value *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::deque.13" = type { %"class.std::_Deque_base.14" }
%"class.std::_Deque_base.14" = type { %"struct.std::_Deque_base<Json::OurReader::ErrorInfo, std::allocator<Json::OurReader::ErrorInfo>>::_Deque_impl" }
%"struct.std::_Deque_base<Json::OurReader::ErrorInfo, std::allocator<Json::OurReader::ErrorInfo>>::_Deque_impl" = type { %"struct.std::_Deque_base<Json::OurReader::ErrorInfo, std::allocator<Json::OurReader::ErrorInfo>>::_Deque_impl_data" }
%"struct.std::_Deque_base<Json::OurReader::ErrorInfo, std::allocator<Json::OurReader::ErrorInfo>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator.18", %"struct.std::_Deque_iterator.18" }
%"struct.std::_Deque_iterator.18" = type { ptr, ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.Json::OurFeatures" = type { i8, i8, i8, i8, i8, i8, i8, i8, i32 }

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Json9OurReaderC2ERKNS_11OurFeaturesE(ptr noundef nonnull align 8 dereferenceable(281) %0, ptr noundef nonnull align 4 dereferenceable(12) %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
  %8 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 0
  call void @_ZNSt5stackIPN4Json5ValueESt5dequeIS2_SaIS2_EEEC2IS5_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %9 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 1
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 80, i1 false)
  invoke void @_ZNSt5dequeIN4Json9OurReader9ErrorInfoESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %9)
          to label %10 unwind label %22

10:                                               ; preds = %2
  %11 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 2
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  %12 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 3
  store ptr null, ptr %12, align 8, !tbaa !9
  %13 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 4
  store ptr null, ptr %13, align 8, !tbaa !28
  %14 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 5
  store ptr null, ptr %14, align 8, !tbaa !29
  %15 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 6
  store ptr null, ptr %15, align 8, !tbaa !30
  %16 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 7
  store ptr null, ptr %16, align 8, !tbaa !31
  %17 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #5
  %18 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 9
  store i32 0, ptr %18, align 8, !tbaa !32
  %19 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 10
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %20, i64 12, i1 false), !tbaa.struct !33
  %21 = getelementptr inbounds %"class.Json::OurReader", ptr %7, i32 0, i32 11
  store i8 0, ptr %21, align 8, !tbaa !36
  ret void

22:                                               ; preds = %2
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %5, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %6, align 4
  call void @_ZNSt5stackIPN4Json5ValueESt5dequeIS2_SaIS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %8) #5
  br label %26

26:                                               ; preds = %22
  %27 = load ptr, ptr %5, align 8
  %28 = load i32, ptr %6, align 4
  %29 = insertvalue { ptr, i32 } poison, ptr %27, 0
  %30 = insertvalue { ptr, i32 } %29, i32 %28, 1
  resume { ptr, i32 } %30
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIN4Json9OurReader9ErrorInfoESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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, !6, i64 192}
!10 = !{!"_ZTSN4Json9OurReaderE", !11, i64 0, !18, i64 80, !23, i64 160, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !23, i64 232, !25, i64 264, !26, i64 268, !27, i64 280}
!11 = !{!"_ZTSSt5stackIPN4Json5ValueESt5dequeIS2_SaIS2_EEE", !12, i64 0}
!12 = !{!"_ZTSSt5dequeIPN4Json5ValueESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSSt11_Deque_baseIPN4Json5ValueESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSNSt11_Deque_baseIPN4Json5ValueESaIS2_EE11_Deque_implE", !15, i64 0}
!15 = !{!"_ZTSNSt11_Deque_baseIPN4Json5ValueESaIS2_EE16_Deque_impl_dataE", !6, i64 0, !16, i64 8, !17, i64 16, !17, i64 48}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSSt15_Deque_iteratorIPN4Json5ValueERS2_PS2_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!"_ZTSSt5dequeIN4Json9OurReader9ErrorInfoESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSNSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE11_Deque_implE", !21, i64 0}
!21 = !{!"_ZTSNSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE16_Deque_impl_dataE", !6, i64 0, !16, i64 8, !22, i64 16, !22, i64 48}
!22 = !{!"_ZTSSt15_Deque_iteratorIN4Json9OurReader9ErrorInfoERS2_PS2_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !16, i64 8, !7, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!25 = !{!"int", !7, i64 0}
!26 = !{!"_ZTSN4Json11OurFeaturesE", !27, i64 0, !27, i64 1, !27, i64 2, !27, i64 3, !27, i64 4, !27, i64 5, !27, i64 6, !27, i64 7, !25, i64 8}
!27 = !{!"bool", !7, i64 0}
!28 = !{!10, !6, i64 200}
!29 = !{!10, !6, i64 208}
!30 = !{!10, !6, i64 216}
!31 = !{!10, !6, i64 224}
!32 = !{!10, !25, i64 264}
!33 = !{i64 0, i64 1, !34, i64 1, i64 1, !34, i64 2, i64 1, !34, i64 3, i64 1, !34, i64 4, i64 1, !34, i64 5, i64 1, !34, i64 6, i64 1, !34, i64 7, i64 1, !34, i64 8, i64 4, !35}
!34 = !{!27, !27, i64 0}
!35 = !{!25, !25, i64 0}
!36 = !{!10, !27, i64 280}


; 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 uwtable
declare dso_local void @_ZNSt5stackIPN4Json5ValueESt5dequeIS2_SaIS2_EEEC2IS5_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Json9OurReaderC2ERKNS_11OurFeaturesE(ptr noundef nonnull align 8 dereferenceable(281) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZNSt5stackIPN4Json5ValueESt5dequeIS2_SaIS2_EEEC2IS5_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(80) %3, i8 0, i64 80, i1 false)
  invoke void @_ZNSt5dequeIN4Json9OurReader9ErrorInfoESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %4 unwind label %11

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 160
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  %6 = getelementptr inbounds i8, ptr %0, i64 192
  %7 = getelementptr inbounds i8, ptr %0, i64 232
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %6, i8 0, i64 40, i1 false)
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  %8 = getelementptr inbounds i8, ptr %0, i64 264
  store i32 0, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 268
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %1, i64 12, i1 false), !tbaa.struct !27
  %10 = getelementptr inbounds i8, ptr %0, i64 280
  store i8 0, ptr %10, align 8, !tbaa !30
  ret void

11:                                               ; preds = %2
  %12 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZNSt5stackIPN4Json5ValueESt5dequeIS2_SaIS2_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %0) #5
  resume { ptr, i32 } %12
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIN4Json9OurReader9ErrorInfoESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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, !24, i64 264}
!6 = !{!"_ZTSN4Json9OurReaderE", !7, i64 0, !17, i64 80, !22, i64 160, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !22, i64 232, !24, i64 264, !25, i64 268, !26, i64 280}
!7 = !{!"_ZTSSt5stackIPN4Json5ValueESt5dequeIS2_SaIS2_EEE", !8, i64 0}
!8 = !{!"_ZTSSt5dequeIPN4Json5ValueESaIS2_EE", !9, i64 0}
!9 = !{!"_ZTSSt11_Deque_baseIPN4Json5ValueESaIS2_EE", !10, i64 0}
!10 = !{!"_ZTSNSt11_Deque_baseIPN4Json5ValueESaIS2_EE11_Deque_implE", !11, i64 0}
!11 = !{!"_ZTSNSt11_Deque_baseIPN4Json5ValueESaIS2_EE16_Deque_impl_dataE", !12, i64 0, !15, i64 8, !16, i64 16, !16, i64 48}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"long", !13, i64 0}
!16 = !{!"_ZTSSt15_Deque_iteratorIPN4Json5ValueERS2_PS2_E", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!17 = !{!"_ZTSSt5dequeIN4Json9OurReader9ErrorInfoESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSNSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE11_Deque_implE", !20, i64 0}
!20 = !{!"_ZTSNSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE16_Deque_impl_dataE", !12, i64 0, !15, i64 8, !21, i64 16, !21, i64 48}
!21 = !{!"_ZTSSt15_Deque_iteratorIN4Json9OurReader9ErrorInfoERS2_PS2_E", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !15, i64 8, !13, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!24 = !{!"int", !13, i64 0}
!25 = !{!"_ZTSN4Json11OurFeaturesE", !26, i64 0, !26, i64 1, !26, i64 2, !26, i64 3, !26, i64 4, !26, i64 5, !26, i64 6, !26, i64 7, !24, i64 8}
!26 = !{!"bool", !13, i64 0}
!27 = !{i64 0, i64 1, !28, i64 1, i64 1, !28, i64 2, i64 1, !28, i64 3, i64 1, !28, i64 4, i64 1, !28, i64 5, i64 1, !28, i64 6, i64 1, !28, i64 7, i64 1, !28, i64 8, i64 4, !29}
!28 = !{!26, !26, i64 0}
!29 = !{!24, !24, i64 0}
!30 = !{!6, !26, i64 280}


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