; LLVM IR from Razakhel/RaZ :: extern/openxr/src/external/jsoncpp/src/lib_json (json_reader)

; 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.17", %"class.std::__cxx11::basic_string", ptr, ptr, ptr, ptr, ptr, i8, [7 x i8], %"class.std::__cxx11::basic_string", %"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.17" = type { %"class.std::_Deque_base.18" }
%"class.std::_Deque_base.18" = 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.22", %"struct.std::_Deque_iterator.22" }
%"struct.std::_Deque_iterator.22" = 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, i8, i8, i64 }

@.str.30 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4Json9OurReader7skipBomEb(ptr noundef nonnull align 8 dereferenceable(297) %0, i1 noundef zeroext %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  %5 = zext i1 %1 to i8
  store i8 %5, ptr %4, align 1, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  %7 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %8 = trunc i8 %7 to i1
  br i1 %8, label %9, label %31

9:                                                ; preds = %2
  %10 = getelementptr inbounds %"class.Json::OurReader", ptr %6, i32 0, i32 4
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %12 = getelementptr inbounds %"class.Json::OurReader", ptr %6, i32 0, i32 3
  %13 = load ptr, ptr %12, align 8, !tbaa !30
  %14 = ptrtoint ptr %11 to i64
  %15 = ptrtoint ptr %13 to i64
  %16 = sub i64 %14, %15
  %17 = icmp sge i64 %16, 3
  br i1 %17, label %18, label %30

18:                                               ; preds = %9
  %19 = getelementptr inbounds %"class.Json::OurReader", ptr %6, i32 0, i32 3
  %20 = load ptr, ptr %19, align 8, !tbaa !30
  %21 = call i32 @strncmp(ptr noundef %20, ptr noundef @.str.30, i64 noundef 3) #2
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %30

23:                                               ; preds = %18
  %24 = getelementptr inbounds %"class.Json::OurReader", ptr %6, i32 0, i32 3
  %25 = load ptr, ptr %24, align 8, !tbaa !30
  %26 = getelementptr inbounds i8, ptr %25, i64 3
  store ptr %26, ptr %24, align 8, !tbaa !30
  %27 = getelementptr inbounds %"class.Json::OurReader", ptr %6, i32 0, i32 3
  %28 = load ptr, ptr %27, align 8, !tbaa !30
  %29 = getelementptr inbounds %"class.Json::OurReader", ptr %6, i32 0, i32 5
  store ptr %28, ptr %29, align 8, !tbaa !31
  br label %30

30:                                               ; preds = %23, %18, %9
  br label %31

31:                                               ; preds = %30, %2
  ret void
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #1

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 = { nounwind willreturn memory(read) "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 willreturn memory(read) }

!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !6, i64 200}
!14 = !{!"_ZTSN4Json9OurReaderE", !15, i64 0, !22, i64 80, !27, i64 160, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !10, i64 232, !27, i64 240, !29, i64 272, !10, i64 296}
!15 = !{!"_ZTSSt5stackIPN4Json5ValueESt5dequeIS2_SaIS2_EEE", !16, i64 0}
!16 = !{!"_ZTSSt5dequeIPN4Json5ValueESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSSt11_Deque_baseIPN4Json5ValueESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSNSt11_Deque_baseIPN4Json5ValueESaIS2_EE11_Deque_implE", !19, i64 0}
!19 = !{!"_ZTSNSt11_Deque_baseIPN4Json5ValueESaIS2_EE16_Deque_impl_dataE", !6, i64 0, !20, i64 8, !21, i64 16, !21, i64 48}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSSt15_Deque_iteratorIPN4Json5ValueERS2_PS2_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!22 = !{!"_ZTSSt5dequeIN4Json9OurReader9ErrorInfoESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSNSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE11_Deque_implE", !25, i64 0}
!25 = !{!"_ZTSNSt11_Deque_baseIN4Json9OurReader9ErrorInfoESaIS2_EE16_Deque_impl_dataE", !6, i64 0, !20, i64 8, !26, i64 16, !26, i64 48}
!26 = !{!"_ZTSSt15_Deque_iteratorIN4Json9OurReader9ErrorInfoERS2_PS2_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !28, i64 0, !20, i64 8, !7, i64 16}
!28 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!29 = !{!"_ZTSN4Json11OurFeaturesE", !10, i64 0, !10, i64 1, !10, i64 2, !10, i64 3, !10, i64 4, !10, i64 5, !10, i64 6, !10, i64 7, !10, i64 8, !10, i64 9, !20, i64 16}
!30 = !{!14, !6, i64 192}
!31 = !{!14, !6, i64 208}


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

@.str.30 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @_ZN4Json9OurReader7skipBomEb(ptr nocapture noundef nonnull align 8 dereferenceable(297) %0, i1 noundef zeroext %1) local_unnamed_addr #0 align 2 {
  br i1 %1, label %3, label %18

3:                                                ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 200
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 192
  %7 = load ptr, ptr %6, align 8, !tbaa !26
  %8 = ptrtoint ptr %5 to i64
  %9 = ptrtoint ptr %7 to i64
  %10 = sub i64 %8, %9
  %11 = icmp sgt i64 %10, 2
  br i1 %11, label %12, label %18

12:                                               ; preds = %3
  %13 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.30, i64 noundef 3) #2
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %18

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %7, i64 3
  store ptr %16, ptr %6, align 8, !tbaa !26
  %17 = getelementptr inbounds i8, ptr %0, i64 208
  store ptr %16, ptr %17, align 8, !tbaa !27
  br label %18

18:                                               ; preds = %3, %12, %15, %2
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nofree nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) 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 nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }

!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, !12, i64 200}
!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, !24, i64 232, !22, i64 240, !25, i64 272, !24, i64 296}
!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 = !{!"bool", !13, i64 0}
!25 = !{!"_ZTSN4Json11OurFeaturesE", !24, i64 0, !24, i64 1, !24, i64 2, !24, i64 3, !24, i64 4, !24, i64 5, !24, i64 6, !24, i64 7, !24, i64 8, !24, i64 9, !15, i64 16}
!26 = !{!6, !12, i64 192}
!27 = !{!6, !12, i64 208}


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