; LLVM IR from zeux/meshoptimizer :: gltf (write)

; 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 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.StreamFormat = type { i32, i32, i8, i64, i32 }
%struct.Settings = type { i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, float, float, i8, i8, i8, float, i32, i8, i8, i8, i8, i8, [4 x float], [4 x i32], [4 x i32], [4 x i32], i32, i8, i8, i8, i8, i32 }
%struct.BufferView = type { i32, i32, i32, i64, i32, %"class.std::__cxx11::basic_string", i64 }

declare void @_Z5commaRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z13getBufferViewRSt6vectorI10BufferViewSaIS0_EENS0_4KindEN12StreamFormat6FilterENS0_11CompressionEmi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef, i64 noundef, i32 noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorI10BufferViewSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL13writeAccessorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmm10cgltf_type20cgltf_component_typebmPKfS9_m(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef, i32 noundef, i32 noundef, i1 noundef zeroext, i64 noundef, ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z16writeMeshIndicesRSt6vectorI10BufferViewSaIS0_EERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERmRKS_IjSaIjEE20cgltf_primitive_typeRK8Settings(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %4, ptr noundef nonnull align 4 dereferenceable(148) %5) #1 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  %14 = alloca %struct.StreamFormat, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #4
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  invoke void @_Z16writeIndexStreamRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIjSaIjEE(ptr dead_on_unwind writable sret(%struct.StreamFormat) align 8 %14, ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(24) %21)
          to label %22 unwind label %71

22:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %23 = load ptr, ptr %12, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.Settings, ptr %23, i32 0, i32 38
  %25 = load i8, ptr %24, align 1, !tbaa !11, !range !16, !noundef !17
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %32

27:                                               ; preds = %22
  %28 = load i32, ptr %11, align 4, !tbaa !9
  %29 = icmp eq i32 %28, 5
  %30 = zext i1 %29 to i64
  %31 = select i1 %29, i32 1, i32 2
  br label %33

32:                                               ; preds = %22
  br label %33

33:                                               ; preds = %32, %27
  %34 = phi i32 [ %31, %27 ], [ -1, %32 ]
  store i32 %34, ptr %17, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load i32, ptr %17, align 4, !tbaa !18
  %37 = getelementptr inbounds %struct.StreamFormat, ptr %14, i32 0, i32 3
  %38 = load i64, ptr %37, align 8, !tbaa !20
  %39 = invoke noundef i64 @_Z13getBufferViewRSt6vectorI10BufferViewSaIS0_EENS0_4KindEN12StreamFormat6FilterENS0_11CompressionEmi(ptr noundef nonnull align 8 dereferenceable(24) %35, i32 noundef 1, i32 noundef 0, i32 noundef %36, i64 noundef %38, i32 noundef 0)
          to label %40 unwind label %75

40:                                               ; preds = %33
  store i64 %39, ptr %18, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load i64, ptr %18, align 8, !tbaa !26
  %43 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorI10BufferViewSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %42) #4
  %44 = getelementptr inbounds %struct.BufferView, ptr %43, i32 0, i32 5
  %45 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %44) #4
  store i64 %45, ptr %19, align 8, !tbaa !26
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = load i64, ptr %18, align 8, !tbaa !26
  %48 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorI10BufferViewSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #4
  %49 = getelementptr inbounds %struct.BufferView, ptr %48, i32 0, i32 5
  %50 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %49, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %51 unwind label %79

51:                                               ; preds = %40
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_Z5commaRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %52)
          to label %53 unwind label %79

53:                                               ; preds = %51
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = load i64, ptr %18, align 8, !tbaa !26
  %56 = load i64, ptr %19, align 8, !tbaa !26
  %57 = getelementptr inbounds %struct.StreamFormat, ptr %14, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !27
  %59 = getelementptr inbounds %struct.StreamFormat, ptr %14, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !28
  %61 = getelementptr inbounds %struct.StreamFormat, ptr %14, i32 0, i32 2
  %62 = load i8, ptr %61, align 8, !tbaa !29, !range !16, !noundef !17
  %63 = trunc i8 %62 to i1
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %64) #4
  invoke void @_ZL13writeAccessorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmm10cgltf_type20cgltf_component_typebmPKfS9_m(ptr noundef nonnull align 8 dereferenceable(32) %54, i64 noundef %55, i64 noundef %56, i32 noundef %58, i32 noundef %60, i1 noundef zeroext %63, i64 noundef %65, ptr noundef null, ptr noundef null, i64 noundef 0)
          to label %66 unwind label %79

66:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = load i64, ptr %67, align 8, !tbaa !26
  %69 = add i64 %68, 1
  store i64 %69, ptr %67, align 8, !tbaa !26
  store i64 %68, ptr %20, align 8, !tbaa !26
  %70 = load i64, ptr %20, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #4
  ret i64 %70

71:                                               ; preds = %6
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %15, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %16, align 4
  br label %84

75:                                               ; preds = %33
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %15, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %16, align 4
  br label %83

79:                                               ; preds = %53, %51, %40
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %15, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %83

83:                                               ; preds = %79, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %84

84:                                               ; preds = %83, %71
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #4
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %15, align 8
  %87 = load i32, ptr %16, align 4
  %88 = insertvalue { ptr, i32 } poison, ptr %86, 0
  %89 = insertvalue { ptr, i32 } %88, i32 %87, 1
  resume { ptr, i32 } %89
}

declare void @_Z16writeIndexStreamRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIjSaIjEE(ptr dead_on_unwind writable sret(%struct.StreamFormat) align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) #0

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

attributes #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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = !{!"_ZTS20cgltf_primitive_type", !7, i64 0}
!11 = !{!12, !14, i64 141}
!12 = !{!"_ZTS8Settings", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !14, i64 16, !14, i64 17, !14, i64 18, !14, i64 19, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !14, i64 36, !14, i64 37, !14, i64 38, !14, i64 39, !14, i64 40, !14, i64 41, !14, i64 42, !14, i64 43, !15, i64 44, !15, i64 48, !14, i64 52, !14, i64 53, !14, i64 54, !15, i64 56, !13, i64 60, !14, i64 64, !14, i64 65, !14, i64 66, !14, i64 67, !14, i64 68, !7, i64 72, !7, i64 88, !7, i64 104, !7, i64 120, !13, i64 136, !14, i64 140, !14, i64 141, !14, i64 142, !14, i64 143, !13, i64 144}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !19, i64 0}
!19 = !{!"_ZTSN10BufferView11CompressionE", !7, i64 0}
!20 = !{!21, !24, i64 16}
!21 = !{!"_ZTS12StreamFormat", !22, i64 0, !23, i64 4, !14, i64 8, !24, i64 16, !25, i64 24}
!22 = !{!"_ZTS10cgltf_type", !7, i64 0}
!23 = !{!"_ZTS20cgltf_component_type", !7, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!"_ZTSN12StreamFormat6FilterE", !7, i64 0}
!26 = !{!24, !24, i64 0}
!27 = !{!21, !22, i64 0}
!28 = !{!21, !23, i64 4}
!29 = !{!21, !14, i64 8}


; 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 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.StreamFormat = type { i32, i32, i8, i64, i32 }

declare void @_Z5commaRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z13getBufferViewRSt6vectorI10BufferViewSaIS0_EENS0_4KindEN12StreamFormat6FilterENS0_11CompressionEmi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorI10BufferViewSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLERKS4_(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 hidden void @_ZL13writeAccessorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmm10cgltf_type20cgltf_component_typebmPKfS9_m(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef, i32 noundef, i32 noundef, i1 noundef zeroext, i64 noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z16writeMeshIndicesRSt6vectorI10BufferViewSaIS0_EERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERmRKS_IjSaIjEE20cgltf_primitive_typeRK8Settings(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr nocapture noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %4, ptr nocapture noundef nonnull readonly align 4 dereferenceable(148) %5) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %struct.StreamFormat, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #4
  invoke void @_Z16writeIndexStreamRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIjSaIjEE(ptr dead_on_unwind nonnull writable sret(%struct.StreamFormat) align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %9 unwind label %38

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %5, i64 141
  %11 = load i8, ptr %10, align 1, !tbaa !5, !range !12, !noundef !13
  %12 = trunc nuw i8 %11 to i1
  %13 = icmp eq i32 %4, 5
  %14 = select i1 %13, i32 1, i32 2
  %15 = select i1 %12, i32 %14, i32 -1
  %16 = getelementptr inbounds i8, ptr %8, i64 16
  %17 = load i64, ptr %16, align 8, !tbaa !14
  %18 = invoke noundef i64 @_Z13getBufferViewRSt6vectorI10BufferViewSaIS0_EENS0_4KindEN12StreamFormat6FilterENS0_11CompressionEmi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 1, i32 noundef 0, i32 noundef %15, i64 noundef %17, i32 noundef 0)
          to label %19 unwind label %40

19:                                               ; preds = %9
  %20 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorI10BufferViewSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %18) #4
  %21 = getelementptr inbounds i8, ptr %20, i64 32
  %22 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %21) #4
  %23 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorI10BufferViewSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %18) #4
  %24 = getelementptr inbounds i8, ptr %23, i64 32
  %25 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %26 unwind label %42

26:                                               ; preds = %19
  invoke void @_Z5commaRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %27 unwind label %42

27:                                               ; preds = %26
  %28 = load i32, ptr %8, align 8, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %8, i64 4
  %30 = load i32, ptr %29, align 4, !tbaa !21
  %31 = getelementptr inbounds i8, ptr %8, i64 8
  %32 = load i8, ptr %31, align 8, !tbaa !22, !range !12, !noundef !13
  %33 = trunc nuw i8 %32 to i1
  %34 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  invoke void @_ZL13writeAccessorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmm10cgltf_type20cgltf_component_typebmPKfS9_m(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %18, i64 noundef %22, i32 noundef %28, i32 noundef %30, i1 noundef zeroext %33, i64 noundef %34, ptr noundef null, ptr noundef null, i64 noundef 0)
          to label %35 unwind label %42

35:                                               ; preds = %27
  %36 = load i64, ptr %2, align 8, !tbaa !23
  %37 = add i64 %36, 1
  store i64 %37, ptr %2, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #4
  ret i64 %36

38:                                               ; preds = %6
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %44

40:                                               ; preds = %9
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %44

42:                                               ; preds = %27, %26, %19
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %44

44:                                               ; preds = %40, %42, %38
  %.pn.pn = phi { ptr, i32 } [ %39, %38 ], [ %43, %42 ], [ %41, %40 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #4
  resume { ptr, i32 } %.pn.pn
}

declare void @_Z16writeIndexStreamRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIjSaIjEE(ptr dead_on_unwind writable sret(%struct.StreamFormat) align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0

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

attributes #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 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 141}
!6 = !{!"_ZTS8Settings", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 17, !10, i64 18, !10, i64 19, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !10, i64 36, !10, i64 37, !10, i64 38, !10, i64 39, !10, i64 40, !10, i64 41, !10, i64 42, !10, i64 43, !11, i64 44, !11, i64 48, !10, i64 52, !10, i64 53, !10, i64 54, !11, i64 56, !7, i64 60, !10, i64 64, !10, i64 65, !10, i64 66, !10, i64 67, !10, i64 68, !8, i64 72, !8, i64 88, !8, i64 104, !8, i64 120, !7, i64 136, !10, i64 140, !10, i64 141, !10, i64 142, !10, i64 143, !7, i64 144}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!15, !18, i64 16}
!15 = !{!"_ZTS12StreamFormat", !16, i64 0, !17, i64 4, !10, i64 8, !18, i64 16, !19, i64 24}
!16 = !{!"_ZTS10cgltf_type", !8, i64 0}
!17 = !{!"_ZTS20cgltf_component_type", !8, i64 0}
!18 = !{!"long", !8, i64 0}
!19 = !{!"_ZTSN12StreamFormat6FilterE", !8, i64 0}
!20 = !{!15, !16, i64 0}
!21 = !{!15, !17, i64 4}
!22 = !{!15, !10, i64 8}
!23 = !{!18, !18, i64 0}


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