; 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.cgltf_image = type { ptr, ptr, ptr, ptr, %struct.cgltf_extras, i64, ptr }
%struct.cgltf_extras = type { i64, i64, ptr }
%struct.ImageInfo = type { i32, i8, i8, 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 }

@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10writeImageRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorI10BufferViewSaIS7_EERK11cgltf_imageRK9ImageInfoPKS4_mPKcSK_RK8Settings(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(72) %2, ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef nonnull align 4 dereferenceable(148) %8) #3 personality ptr @__gxx_personality_v0 {
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i8, align 1
  %20 = alloca i32, align 4
  %21 = alloca %"class.std::__cxx11::basic_string", align 8
  %22 = alloca %"class.std::__cxx11::basic_string", align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store i64 %5, ptr %15, align 8, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  store ptr %8, ptr %18, align 8, !tbaa !5
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.cgltf_image, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %42

29:                                               ; preds = %9
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.cgltf_image, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !11
  %33 = load i8, ptr %32, align 1, !tbaa !14
  %34 = icmp ne i8 %33, 0
  br i1 %34, label %35, label %42

35:                                               ; preds = %29
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %36, ptr noundef @.str.14)
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.cgltf_image, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %37, ptr noundef %40)
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %41, ptr noundef @.str.47)
  br label %42

42:                                               ; preds = %35, %29, %9
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %76

45:                                               ; preds = %42
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = call noundef i32 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmPKc(ptr noundef nonnull align 8 dereferenceable(32) %46, i64 noundef 0, i64 noundef 5, ptr noundef @.str.48)
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %59

49:                                               ; preds = %45
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = load i64, ptr %15, align 8, !tbaa !9
  %52 = trunc i64 %51 to i32
  %53 = sext i32 %52 to i64
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.cgltf_image, ptr %54, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !15
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %57) #5
  call void @_ZL15writeImageErrorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcmS7_S7_(ptr noundef nonnull align 8 dereferenceable(32) %50, ptr noundef @.str.49, i64 noundef %53, ptr noundef %56, ptr noundef %58)
  br label %75

59:                                               ; preds = %45
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = load i64, ptr %15, align 8, !tbaa !9
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.cgltf_image, ptr %63, i32 0, i32 1
  %65 = load ptr, ptr %64, align 8, !tbaa !15
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = load ptr, ptr %17, align 8, !tbaa !5
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.ImageInfo, ptr %68, i32 0, i32 0
  %70 = load i32, ptr %69, align 4, !tbaa !16
  %71 = load ptr, ptr %18, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.Settings, ptr %71, i32 0, i32 28
  %73 = load i8, ptr %72, align 1, !tbaa !21, !range !24, !noundef !25
  %74 = trunc i8 %73 to i1
  call void @_ZL14writeImageDataRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorI10BufferViewSaIS7_EEmPKcSC_RKS4_SC_11TextureKindb(ptr noundef nonnull align 8 dereferenceable(32) %60, ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %62, ptr noundef %65, ptr noundef @.str.50, ptr noundef nonnull align 8 dereferenceable(32) %66, ptr noundef %67, i32 noundef %70, i1 noundef zeroext %74)
  br label %75

75:                                               ; preds = %59, %49
  br label %145

76:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #5
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.cgltf_image, ptr %77, i32 0, i32 1
  %79 = load ptr, ptr %78, align 8, !tbaa !15
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %87

81:                                               ; preds = %76
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.cgltf_image, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !15
  %85 = call i32 @strncmp(ptr noundef %84, ptr noundef @.str.51, i64 noundef 5) #6
  %86 = icmp eq i32 %85, 0
  br label %87

87:                                               ; preds = %81, %76
  %88 = phi i1 [ false, %76 ], [ %86, %81 ]
  %89 = zext i1 %88 to i8
  store i8 %89, ptr %19, align 1, !tbaa !26
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.cgltf_image, ptr %90, i32 0, i32 1
  %92 = load ptr, ptr %91, align 8, !tbaa !15
  %93 = icmp ne ptr %92, null
  br i1 %93, label %94, label %109

94:                                               ; preds = %87
  %95 = load i8, ptr %19, align 1, !tbaa !26, !range !24, !noundef !25
  %96 = trunc i8 %95 to i1
  br i1 %96, label %109, label %97

97:                                               ; preds = %94
  %98 = load ptr, ptr %18, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.Settings, ptr %98, i32 0, i32 29
  %100 = load i8, ptr %99, align 2, !tbaa !27, !range !24, !noundef !25
  %101 = trunc i8 %100 to i1
  br i1 %101, label %102, label %109

102:                                              ; preds = %97
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %103, ptr noundef @.str.52)
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.cgltf_image, ptr %105, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !15
  call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %104, ptr noundef %107)
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %108, ptr noundef @.str.15)
  store i32 1, ptr %20, align 4
  br label %143

109:                                              ; preds = %97, %94, %87
  call void @llvm.lifetime.start.p0(i64 32, ptr %21) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %22) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #5
  %110 = load ptr, ptr %12, align 8, !tbaa !5
  %111 = load ptr, ptr %16, align 8, !tbaa !5
  %112 = invoke noundef zeroext i1 @_Z9readImageRK11cgltf_imagePKcRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_(ptr noundef nonnull align 8 dereferenceable(72) %110, ptr noundef %111, ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef nonnull align 8 dereferenceable(32) %22)
          to label %113 unwind label %121

113:                                              ; preds = %109
  br i1 %112, label %125, label %114

114:                                              ; preds = %113
  %115 = load ptr, ptr %10, align 8, !tbaa !5
  %116 = load i64, ptr %15, align 8, !tbaa !9
  %117 = load ptr, ptr %12, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.cgltf_image, ptr %117, i32 0, i32 1
  %119 = load ptr, ptr %118, align 8, !tbaa !15
  invoke void @_ZL15writeImageErrorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcmS7_S7_(ptr noundef nonnull align 8 dereferenceable(32) %115, ptr noundef @.str.53, i64 noundef %116, ptr noundef %119, ptr noundef null)
          to label %120 unwind label %121

120:                                              ; preds = %114
  store i32 1, ptr %20, align 4
  br label %142

121:                                              ; preds = %125, %114, %109
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %23, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %24, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  br label %146

125:                                              ; preds = %113
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  %127 = load ptr, ptr %11, align 8, !tbaa !5
  %128 = load i64, ptr %15, align 8, !tbaa !9
  %129 = load ptr, ptr %12, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.cgltf_image, ptr %129, i32 0, i32 1
  %131 = load ptr, ptr %130, align 8, !tbaa !15
  %132 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %22) #5
  %133 = load ptr, ptr %17, align 8, !tbaa !5
  %134 = load ptr, ptr %13, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.ImageInfo, ptr %134, i32 0, i32 0
  %136 = load i32, ptr %135, align 4, !tbaa !16
  %137 = load ptr, ptr %18, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.Settings, ptr %137, i32 0, i32 28
  %139 = load i8, ptr %138, align 1, !tbaa !21, !range !24, !noundef !25
  %140 = trunc i8 %139 to i1
  invoke void @_ZL14writeImageDataRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorI10BufferViewSaIS7_EEmPKcSC_RKS4_SC_11TextureKindb(ptr noundef nonnull align 8 dereferenceable(32) %126, ptr noundef nonnull align 8 dereferenceable(24) %127, i64 noundef %128, ptr noundef %131, ptr noundef %132, ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef %133, i32 noundef %136, i1 noundef zeroext %140)
          to label %141 unwind label %121

141:                                              ; preds = %125
  store i32 0, ptr %20, align 4
  br label %142

142:                                              ; preds = %141, %120
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %22) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %22) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #5
  br label %143

143:                                              ; preds = %142, %102
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  %144 = load i32, ptr %20, align 4
  switch i32 %144, label %151 [
    i32 0, label %145
    i32 1, label %145
  ]

145:                                              ; preds = %143, %143, %75
  ret void

146:                                              ; preds = %121
  %147 = load ptr, ptr %23, align 8
  %148 = load i32, ptr %24, align 4
  %149 = insertvalue { ptr, i32 } poison, ptr %147, 0
  %150 = insertvalue { ptr, i32 } %149, i32 %148, 1
  resume { ptr, i32 } %150

151:                                              ; preds = %143
  unreachable
}

declare noundef i32 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmPKc(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL15writeImageErrorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcmS7_S7_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef, ptr noundef, ptr noundef) #3

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

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

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

declare noundef zeroext i1 @_Z9readImageRK11cgltf_imagePKcRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #0

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS11cgltf_image", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !10, i64 56, !6, i64 64}
!13 = !{!"_ZTS12cgltf_extras", !10, i64 0, !10, i64 8, !6, i64 16}
!14 = !{!7, !7, i64 0}
!15 = !{!12, !6, i64 8}
!16 = !{!17, !18, i64 0}
!17 = !{!"_ZTS9ImageInfo", !18, i64 0, !19, i64 4, !19, i64 5, !20, i64 8}
!18 = !{!"_ZTS11TextureKind", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!22, !19, i64 65}
!22 = !{!"_ZTS8Settings", !20, i64 0, !20, i64 4, !20, i64 8, !20, i64 12, !19, i64 16, !19, i64 17, !19, i64 18, !19, i64 19, !20, i64 20, !20, i64 24, !20, i64 28, !20, i64 32, !19, i64 36, !19, i64 37, !19, i64 38, !19, i64 39, !19, i64 40, !19, i64 41, !19, i64 42, !19, i64 43, !23, i64 44, !23, i64 48, !19, i64 52, !19, i64 53, !19, i64 54, !23, i64 56, !20, i64 60, !19, i64 64, !19, i64 65, !19, i64 66, !19, i64 67, !19, i64 68, !7, i64 72, !7, i64 88, !7, i64 104, !7, i64 120, !20, i64 136, !19, i64 140, !19, i64 141, !19, i64 142, !19, i64 143, !20, i64 144}
!23 = !{!"float", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!19, !19, i64 0}
!27 = !{!22, !19, i64 66}


; 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] }

@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10writeImageRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorI10BufferViewSaIS7_EERK11cgltf_imageRK9ImageInfoPKS4_mPKcSK_RK8Settings(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(72) %2, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, ptr noundef %7, ptr nocapture noundef nonnull readonly align 4 dereferenceable(148) %8) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %17, label %13

13:                                               ; preds = %9
  %14 = load i8, ptr %12, align 1, !tbaa !12
  %.not44 = icmp eq i8 %14, 0
  br i1 %.not44, label %17, label %15

15:                                               ; preds = %13
  tail call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.14)
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %16)
  tail call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.47)
  br label %17

17:                                               ; preds = %15, %13, %9
  %.not45 = icmp eq ptr %4, null
  br i1 %.not45, label %33, label %18

18:                                               ; preds = %17
  %19 = tail call noundef i32 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmPKc(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef 0, i64 noundef 5, ptr noundef nonnull @.str.48)
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %26

21:                                               ; preds = %18
  %sext = shl i64 %5, 32
  %22 = ashr exact i64 %sext, 32
  %23 = getelementptr inbounds i8, ptr %2, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = tail call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  tail call void @_ZL15writeImageErrorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcmS7_S7_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.49, i64 noundef %22, ptr noundef %24, ptr noundef %25)
  br label %58

26:                                               ; preds = %18
  %27 = getelementptr inbounds i8, ptr %2, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  %29 = load i32, ptr %3, align 4, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %8, i64 65
  %31 = load i8, ptr %30, align 1, !tbaa !19, !range !22, !noundef !23
  %32 = trunc nuw i8 %31 to i1
  tail call void @_ZL14writeImageDataRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorI10BufferViewSaIS7_EEmPKcSC_RKS4_SC_11TextureKindb(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %5, ptr noundef %28, ptr noundef nonnull @.str.50, ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef %7, i32 noundef %29, i1 noundef zeroext %32)
  br label %58

33:                                               ; preds = %17
  %34 = getelementptr inbounds i8, ptr %2, i64 8
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %.not46 = icmp eq ptr %35, null
  br i1 %.not46, label %.thread, label %36

36:                                               ; preds = %33
  %37 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %35, ptr noundef nonnull dereferenceable(1) @.str.51, i64 noundef 5) #6
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %.thread, label %39

39:                                               ; preds = %36
  %40 = getelementptr inbounds i8, ptr %8, i64 66
  %41 = load i8, ptr %40, align 2, !tbaa !24, !range !22, !noundef !23
  %42 = trunc nuw i8 %41 to i1
  br i1 %42, label %43, label %.thread

43:                                               ; preds = %39
  tail call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.52)
  %44 = load ptr, ptr %34, align 8, !tbaa !13
  tail call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %44)
  tail call void @_Z6appendRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.15)
  br label %58

.thread:                                          ; preds = %33, %36, %39
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  %45 = invoke noundef zeroext i1 @_Z9readImageRK11cgltf_imagePKcRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_(ptr noundef nonnull align 8 dereferenceable(72) %2, ptr noundef %6, ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %46 unwind label %49

46:                                               ; preds = %.thread
  %47 = load ptr, ptr %34, align 8, !tbaa !13
  br i1 %45, label %51, label %48

48:                                               ; preds = %46
  invoke void @_ZL15writeImageErrorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcmS7_S7_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.53, i64 noundef %5, ptr noundef %47, ptr noundef null)
          to label %57 unwind label %49

49:                                               ; preds = %51, %48, %.thread
  %50 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #5
  resume { ptr, i32 } %50

51:                                               ; preds = %46
  %52 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  %53 = load i32, ptr %3, align 4, !tbaa !14
  %54 = getelementptr inbounds i8, ptr %8, i64 65
  %55 = load i8, ptr %54, align 1, !tbaa !19, !range !22, !noundef !23
  %56 = trunc nuw i8 %55 to i1
  invoke void @_ZL14writeImageDataRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorI10BufferViewSaIS7_EEmPKcSC_RKS4_SC_11TextureKindb(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %5, ptr noundef %47, ptr noundef %52, ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef %7, i32 noundef %53, i1 noundef zeroext %56)
          to label %57 unwind label %49

57:                                               ; preds = %51, %48
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #5
  br label %58

58:                                               ; preds = %43, %57, %21, %26
  ret void
}

declare noundef i32 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmPKc(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL15writeImageErrorRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcmS7_S7_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

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

declare noundef zeroext i1 @_Z9readImageRK11cgltf_imagePKcRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { 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, !7, i64 0}
!6 = !{!"_ZTS11cgltf_image", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 56, !7, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS12cgltf_extras", !11, i64 0, !11, i64 8, !7, i64 16}
!11 = !{!"long", !8, i64 0}
!12 = !{!8, !8, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!15, !16, i64 0}
!15 = !{!"_ZTS9ImageInfo", !16, i64 0, !17, i64 4, !17, i64 5, !18, i64 8}
!16 = !{!"_ZTS11TextureKind", !8, i64 0}
!17 = !{!"bool", !8, i64 0}
!18 = !{!"int", !8, i64 0}
!19 = !{!20, !17, i64 65}
!20 = !{!"_ZTS8Settings", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !17, i64 16, !17, i64 17, !17, i64 18, !17, i64 19, !18, i64 20, !18, i64 24, !18, i64 28, !18, i64 32, !17, i64 36, !17, i64 37, !17, i64 38, !17, i64 39, !17, i64 40, !17, i64 41, !17, i64 42, !17, i64 43, !21, i64 44, !21, i64 48, !17, i64 52, !17, i64 53, !17, i64 54, !21, i64 56, !18, i64 60, !17, i64 64, !17, i64 65, !17, i64 66, !17, i64 67, !17, i64 68, !8, i64 72, !8, i64 88, !8, i64 104, !8, i64 120, !18, i64 136, !17, i64 140, !17, i64 141, !17, i64 142, !17, i64 143, !18, i64 144}
!21 = !{!"float", !8, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!20, !17, i64 66}


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