; LLVM IR from Razakhel/RaZ :: extern/fastgltf/src (fastgltf)

; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.30 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.30 = type { i64, [8 x i8] }
%"class.fastgltf::Expected.500" = type { i64, %"struct.fastgltf::ExportResult" }
%"struct.fastgltf::ExportResult" = type { %"class.std::__cxx11::basic_string", %"class.std::vector.461", %"class.std::vector.461" }
%"class.std::vector.461" = type { %"struct.std::_Vector_base.462" }
%"struct.std::_Vector_base.462" = type { %"struct.std::_Vector_base<std::optional<std::filesystem::__cxx11::path>, std::allocator<std::optional<std::filesystem::__cxx11::path>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::optional<std::filesystem::__cxx11::path>, std::allocator<std::optional<std::filesystem::__cxx11::path>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::optional<std::filesystem::__cxx11::path>, std::allocator<std::optional<std::filesystem::__cxx11::path>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::optional<std::filesystem::__cxx11::path>, std::allocator<std::optional<std::filesystem::__cxx11::path>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.fastgltf::Exporter" = type { i64, i64, i8, %"class.std::filesystem::__cxx11::path", %"class.std::filesystem::__cxx11::path", ptr, ptr, %"class.std::vector.461", %"class.std::vector.461" }
%"class.std::filesystem::__cxx11::path" = type { %"class.std::__cxx11::basic_string", %"struct.std::filesystem::__cxx11::path::_List" }
%"struct.std::filesystem::__cxx11::path::_List" = type { %"class.std::unique_ptr.31" }
%"class.std::unique_ptr.31" = type { %"struct.std::__uniq_ptr_data.32" }
%"struct.std::__uniq_ptr_data.32" = type { %"class.std::__uniq_ptr_impl.33" }
%"class.std::__uniq_ptr_impl.33" = type { %"class.std::tuple.34" }
%"class.std::tuple.34" = type { %"struct.std::_Tuple_impl.35" }
%"struct.std::_Tuple_impl.35" = type { %"struct.std::_Head_base.38" }
%"struct.std::_Head_base.38" = type { ptr }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN8fastgltf8validateERKNS_5AssetE(ptr noundef nonnull align 8 dereferenceable(580)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8fastgltf8Exporter9writeJsonB5cxx11ERKNS_5AssetE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(580)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN8fastgltf6hasBitINS_13ExportOptionsES1_EEbT_T0_(i64 noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8fastgltf8Exporter13writeGltfJsonB5cxx11ERKNS_5AssetENS_13ExportOptionsE(ptr dead_on_unwind noalias writable sret(%"class.fastgltf::Expected.500") align 8 %0, ptr noundef nonnull align 8 dereferenceable(168) %1, ptr noundef nonnull align 8 dereferenceable(580) %2, i64 noundef %3) #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.fastgltf::ExportResult", align 8
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i64 %3, ptr %8, align 8, !tbaa !9
  %15 = load ptr, ptr %6, align 8
  %16 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 7
  call void @_ZNSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #4
  %17 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 8
  call void @_ZNSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #4
  %18 = load i64, ptr %8, align 8, !tbaa !9
  %19 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 1
  store i64 %18, ptr %19, align 8, !tbaa !11
  %20 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 2
  store i8 0, ptr %20, align 8, !tbaa !30
  %21 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 1
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = call noundef zeroext i1 @_ZN8fastgltf6hasBitINS_13ExportOptionsES1_EEbT_T0_(i64 noundef %22, i64 noundef 2)
  br i1 %23, label %24, label %35

24:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = call noundef i64 @_ZN8fastgltf8validateERKNS_5AssetE(ptr noundef nonnull align 8 dereferenceable(580) %25)
  store i64 %26, ptr %9, align 8, !tbaa !31
  %27 = load i64, ptr %9, align 8, !tbaa !31
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %24
  %30 = load i64, ptr %9, align 8, !tbaa !31
  call void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2ENS_5ErrorE(ptr noundef nonnull align 8 dereferenceable(88) %0, i64 noundef %30)
  store i32 1, ptr %10, align 4
  br label %32

31:                                               ; preds = %24
  store i32 0, ptr %10, align 4
  br label %32

32:                                               ; preds = %31, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %33 = load i32, ptr %10, align 4
  switch i32 %33, label %70 [
    i32 0, label %34
    i32 1, label %64
  ]

34:                                               ; preds = %32
  br label %35

35:                                               ; preds = %34, %4
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #4
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN8fastgltf8Exporter9writeJsonB5cxx11ERKNS_5AssetE(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %11, ptr noundef nonnull align 8 dereferenceable(168) %15, ptr noundef nonnull align 8 dereferenceable(580) %36)
  %37 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 0
  %38 = load i64, ptr %37, align 8, !tbaa !32
  %39 = icmp ne i64 %38, 0
  br i1 %39, label %40, label %48

40:                                               ; preds = %35
  %41 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 0
  %42 = load i64, ptr %41, align 8, !tbaa !32
  invoke void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2ENS_5ErrorE(ptr noundef nonnull align 8 dereferenceable(88) %0, i64 noundef %42)
          to label %43 unwind label %44

43:                                               ; preds = %40
  store i32 1, ptr %10, align 4
  br label %62

44:                                               ; preds = %40
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %12, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %13, align 4
  br label %63

48:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 80, ptr %14) #4
  call void @_ZN8fastgltf12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %14) #4
  %49 = getelementptr inbounds %"struct.fastgltf::ExportResult", ptr %14, i32 0, i32 0
  %50 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %49, ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  %51 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 7
  %52 = getelementptr inbounds %"struct.fastgltf::ExportResult", ptr %14, i32 0, i32 1
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EEaSEOS6_(ptr noundef nonnull align 8 dereferenceable(24) %52, ptr noundef nonnull align 8 dereferenceable(24) %51) #4
  %54 = getelementptr inbounds %"class.fastgltf::Exporter", ptr %15, i32 0, i32 8
  %55 = getelementptr inbounds %"struct.fastgltf::ExportResult", ptr %14, i32 0, i32 2
  %56 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EEaSEOS6_(ptr noundef nonnull align 8 dereferenceable(24) %55, ptr noundef nonnull align 8 dereferenceable(24) %54) #4
  invoke void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2EOS8_(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 8 dereferenceable(80) %14)
          to label %57 unwind label %58

57:                                               ; preds = %48
  store i32 1, ptr %10, align 4
  call void @_ZN8fastgltf12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %14) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %14) #4
  br label %62

58:                                               ; preds = %48
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %12, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %13, align 4
  call void @_ZN8fastgltf12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %14) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %14) #4
  br label %63

62:                                               ; preds = %57, %43
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  br label %64

63:                                               ; preds = %58, %44
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  br label %65

64:                                               ; preds = %62, %32
  ret void

65:                                               ; preds = %63
  %66 = load ptr, ptr %12, align 8
  %67 = load i32, ptr %13, align 4
  %68 = insertvalue { ptr, i32 } poison, ptr %66, 0
  %69 = insertvalue { ptr, i32 } %68, i32 %67, 1
  resume { ptr, i32 } %69

70:                                               ; preds = %32
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2ENS_5ErrorE(ptr noundef nonnull align 8 dereferenceable(88), i64 noundef) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2EOS8_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 = { 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 = !{!"_ZTSN8fastgltf13ExportOptionsE", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTSN8fastgltf8ExporterE", !13, i64 0, !10, i64 8, !14, i64 16, !15, i64 24, !15, i64 64, !6, i64 104, !6, i64 112, !26, i64 120, !26, i64 144}
!13 = !{!"_ZTSN8fastgltf5ErrorE", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSNSt10filesystem7__cxx114pathE", !16, i64 0, !19, i64 32}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTSNSt10filesystem7__cxx114path5_ListE", !20, i64 0}
!20 = !{!"_ZTSSt10unique_ptrINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEE", !21, i64 0}
!21 = !{!"_ZTSSt15__uniq_ptr_dataINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterELb1ELb1EE", !22, i64 0}
!22 = !{!"_ZTSSt15__uniq_ptr_implINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEE", !23, i64 0}
!23 = !{!"_ZTSSt5tupleIJPNSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEEE", !24, i64 0}
!24 = !{!"_ZTSSt11_Tuple_implILm0EJPNSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEEE", !25, i64 0}
!25 = !{!"_ZTSSt10_Head_baseILm0EPNSt10filesystem7__cxx114path5_List5_ImplELb0EE", !6, i64 0}
!26 = !{!"_ZTSSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{!12, !14, i64 16}
!31 = !{!13, !13, i64 0}
!32 = !{!12, !13, i64 0}


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.30 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.30 = type { i64, [8 x i8] }
%"class.fastgltf::Expected.500" = type { i64, %"struct.fastgltf::ExportResult" }
%"struct.fastgltf::ExportResult" = type { %"class.std::__cxx11::basic_string", %"class.std::vector.461", %"class.std::vector.461" }
%"class.std::vector.461" = type { %"struct.std::_Vector_base.462" }
%"struct.std::_Vector_base.462" = type { %"struct.std::_Vector_base<std::optional<std::filesystem::__cxx11::path>, std::allocator<std::optional<std::filesystem::__cxx11::path>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::optional<std::filesystem::__cxx11::path>, std::allocator<std::optional<std::filesystem::__cxx11::path>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::optional<std::filesystem::__cxx11::path>, std::allocator<std::optional<std::filesystem::__cxx11::path>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::optional<std::filesystem::__cxx11::path>, std::allocator<std::optional<std::filesystem::__cxx11::path>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8fastgltf8Exporter9writeJsonB5cxx11ERKNS_5AssetE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(580)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN8fastgltf6hasBitINS_13ExportOptionsES1_EEbT_T0_(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8fastgltf8Exporter13writeGltfJsonB5cxx11ERKNS_5AssetENS_13ExportOptionsE(ptr dead_on_unwind noalias writable sret(%"class.fastgltf::Expected.500") align 8 %0, ptr noundef nonnull align 8 dereferenceable(168) %1, ptr noundef nonnull align 8 dereferenceable(580) %2, i64 noundef %3) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"struct.fastgltf::ExportResult", align 8
  %7 = getelementptr inbounds i8, ptr %1, i64 120
  tail call void @_ZNSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  %8 = getelementptr inbounds i8, ptr %1, i64 144
  tail call void @_ZNSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 %3, ptr %9, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 16
  store i8 0, ptr %10, align 8, !tbaa !28
  %11 = tail call noundef zeroext i1 @_ZN8fastgltf6hasBitINS_13ExportOptionsES1_EEbT_T0_(i64 noundef %3, i64 noundef 2)
  br i1 %11, label %12, label %.thread

12:                                               ; preds = %4
  %13 = tail call noundef i64 @_ZN8fastgltf8validateERKNS_5AssetE(ptr noundef nonnull align 8 dereferenceable(580) %2)
  %.not.not = icmp eq i64 %13, 0
  br i1 %.not.not, label %.thread, label %14

14:                                               ; preds = %12
  tail call void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2ENS_5ErrorE(ptr noundef nonnull align 8 dereferenceable(88) %0, i64 noundef %13)
  br label %24

.thread:                                          ; preds = %12, %4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @_ZN8fastgltf8Exporter9writeJsonB5cxx11ERKNS_5AssetE(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull align 8 dereferenceable(168) %1, ptr noundef nonnull align 8 dereferenceable(580) %2)
  %15 = load i64, ptr %1, align 8, !tbaa !29
  %.not8 = icmp eq i64 %15, 0
  br i1 %.not8, label %17, label %16

16:                                               ; preds = %.thread
  call void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2ENS_5ErrorE(ptr noundef nonnull align 8 dereferenceable(88) %0, i64 noundef %15)
  br label %23

17:                                               ; preds = %.thread
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %6) #4
  call void @_ZN8fastgltf12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #4
  %18 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  %19 = getelementptr inbounds i8, ptr %6, i64 32
  %20 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EEaSEOS6_(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  %21 = getelementptr inbounds i8, ptr %6, i64 56
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EEaSEOS6_(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  call void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2EOS8_(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 8 dereferenceable(80) %6)
  call void @_ZN8fastgltf12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %6) #4
  br label %23

23:                                               ; preds = %17, %16
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  br label %24

24:                                               ; preds = %14, %23
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2ENS_5ErrorE(ptr noundef nonnull align 8 dereferenceable(88), i64 noundef) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8fastgltf8ExpectedINS_12ExportResultINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2EOS8_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 = { 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, !10, i64 8}
!6 = !{!"_ZTSN8fastgltf8ExporterE", !7, i64 0, !10, i64 8, !11, i64 16, !12, i64 24, !12, i64 64, !15, i64 104, !15, i64 112, !24, i64 120, !24, i64 144}
!7 = !{!"_ZTSN8fastgltf5ErrorE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN8fastgltf13ExportOptionsE", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSNSt10filesystem7__cxx114pathE", !13, i64 0, !17, i64 32}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !16, i64 8, !8, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !15, i64 0}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!"_ZTSNSt10filesystem7__cxx114path5_ListE", !18, i64 0}
!18 = !{!"_ZTSSt10unique_ptrINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEE", !19, i64 0}
!19 = !{!"_ZTSSt15__uniq_ptr_dataINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterELb1ELb1EE", !20, i64 0}
!20 = !{!"_ZTSSt15__uniq_ptr_implINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEE", !21, i64 0}
!21 = !{!"_ZTSSt5tupleIJPNSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEEE", !22, i64 0}
!22 = !{!"_ZTSSt11_Tuple_implILm0EJPNSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEEE", !23, i64 0}
!23 = !{!"_ZTSSt10_Head_baseILm0EPNSt10filesystem7__cxx114path5_List5_ImplELb0EE", !15, i64 0}
!24 = !{!"_ZTSSt6vectorISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseISt8optionalINSt10filesystem7__cxx114pathEESaIS4_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!28 = !{!6, !11, i64 16}
!29 = !{!6, !7, i64 0}


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