; LLVM IR from filipwasil/fillwave :: src/flf/loaders/textureloader (TextureFactory)

; 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::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { ptr }
%"struct.std::_Head_base.1" = type { ptr }
%class.anon.2 = type { i32 }
%"struct.flw::flc::TextureConfig" = type { %"struct.flw::flc::TextureConfig::Header", %"struct.flw::flc::TextureConfig::Content", i32, %"class.std::unique_ptr", %"class.std::vector" }
%"struct.flw::flc::TextureConfig::Header" = type { i32, i32, i32, i32, i32, i32 }
%"struct.flw::flc::TextureConfig::Content" = type { i32, i8, i8, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<flw::flc::TextureConfig::Mipmap, flw::AllocatorStack<flw::flc::TextureConfig::Mipmap>>::_Vector_impl" }
%"struct.std::_Vector_base<flw::flc::TextureConfig::Mipmap, flw::AllocatorStack<flw::flc::TextureConfig::Mipmap>>::_Vector_impl" = type { %"class.flw::AllocatorStack", %"struct.std::_Vector_base<flw::flc::TextureConfig::Mipmap, flw::AllocatorStack<flw::flc::TextureConfig::Mipmap>>::_Vector_impl_data" }
%"class.flw::AllocatorStack" = type { %"struct.std::array" }
%"struct.std::array" = type { [32 x %"struct.flw::flc::TextureConfig::Mipmap"] }
%"struct.flw::flc::TextureConfig::Mipmap" = type { i32, i32, i32, i32, %"class.std::unique_ptr" }
%"struct.std::_Vector_base<flw::flc::TextureConfig::Mipmap, flw::AllocatorStack<flw::flc::TextureConfig::Mipmap>>::_Vector_impl_data" = type { ptr, ptr, 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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

declare void @_ZN3flw3flc13TextureConfigC1Ev(ptr noundef nonnull align 8 dereferenceable(1112)) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3flw25make_pu_with_no_ownershipIhEESt10unique_ptrIT_PFvPS2_EES3_(ptr dead_on_unwind noalias writable sret(%"class.std::unique_ptr") align 8, ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10unique_ptrIhPFvPhEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIhPFvPhEED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN3flw3flf14TextureFactory20loadVirtualFileColorEjjhhhj(i32 noundef %0, i32 noundef %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i8 noundef zeroext %4, i32 noundef %5) #5 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %class.anon.2, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca %"class.std::unique_ptr", align 8
  store i32 %0, ptr %7, align 4, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !5
  store i8 %2, ptr %9, align 1, !tbaa !9
  store i8 %3, ptr %10, align 1, !tbaa !9
  store i8 %4, ptr %11, align 1, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %22 = getelementptr inbounds %class.anon.2, ptr %14, i32 0, i32 0
  %23 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %23, ptr %22, align 4, !tbaa !10
  %24 = call noundef i32 @"_ZZN3flw3flf14TextureFactory20loadVirtualFileColorEjjhhhjENK3$_0clEv"(ptr noundef nonnull align 4 dereferenceable(4) %14)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  store i32 %24, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %25 = load i32, ptr %13, align 4, !tbaa !5
  %26 = load i32, ptr %7, align 4, !tbaa !5
  %27 = mul i32 %25, %26
  %28 = load i32, ptr %8, align 4, !tbaa !5
  %29 = mul i32 %27, %28
  %30 = zext i32 %29 to i64
  %31 = mul i64 %30, 1
  %32 = trunc i64 %31 to i32
  store i32 %32, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %33 = load i32, ptr %15, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = call noalias noundef nonnull ptr @_Znam(i64 noundef %34) #8
  store ptr %35, ptr %16, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %64, %6
  %37 = load i32, ptr %17, align 4, !tbaa !5
  %38 = load i32, ptr %15, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %68

41:                                               ; preds = %36
  %42 = load i8, ptr %9, align 1, !tbaa !9
  %43 = load ptr, ptr %16, align 8, !tbaa !12
  %44 = load i32, ptr %17, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i8, ptr %43, i64 %45
  store i8 %42, ptr %46, align 1, !tbaa !9
  %47 = load i8, ptr %10, align 1, !tbaa !9
  %48 = load ptr, ptr %16, align 8, !tbaa !12
  %49 = load i32, ptr %17, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i8, ptr %48, i64 %51
  store i8 %47, ptr %52, align 1, !tbaa !9
  %53 = load i8, ptr %11, align 1, !tbaa !9
  %54 = load ptr, ptr %16, align 8, !tbaa !12
  %55 = load i32, ptr %17, align 4, !tbaa !5
  %56 = add nsw i32 %55, 2
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i8, ptr %54, i64 %57
  store i8 %53, ptr %58, align 1, !tbaa !9
  %59 = load ptr, ptr %16, align 8, !tbaa !12
  %60 = load i32, ptr %17, align 4, !tbaa !5
  %61 = add nsw i32 %60, 3
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %59, i64 %62
  store i8 1, ptr %63, align 1, !tbaa !9
  br label %64

64:                                               ; preds = %41
  %65 = load i32, ptr %13, align 4, !tbaa !5
  %66 = load i32, ptr %17, align 4, !tbaa !5
  %67 = add nsw i32 %66, %65
  store i32 %67, ptr %17, align 4, !tbaa !5
  br label %36, !llvm.loop !14

68:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %69 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 1112) #8
  invoke void @_ZN3flw3flc13TextureConfigC1Ev(ptr noundef nonnull align 8 dereferenceable(1112) %69)
          to label %70 unwind label %109

70:                                               ; preds = %68
  store ptr %69, ptr %18, align 8, !tbaa !12
  %71 = load i32, ptr %12, align 4, !tbaa !5
  %72 = load ptr, ptr %18, align 8, !tbaa !12
  %73 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %72, i32 0, i32 0
  %74 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Header", ptr %73, i32 0, i32 4
  store i32 %71, ptr %74, align 8, !tbaa !16
  %75 = load i32, ptr %12, align 4, !tbaa !5
  %76 = load ptr, ptr %18, align 8, !tbaa !12
  %77 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Header", ptr %77, i32 0, i32 0
  store i32 %75, ptr %78, align 8, !tbaa !35
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = load ptr, ptr %18, align 8, !tbaa !12
  %81 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Header", ptr %81, i32 0, i32 2
  store i32 %79, ptr %82, align 8, !tbaa !36
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = load ptr, ptr %18, align 8, !tbaa !12
  %85 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %84, i32 0, i32 0
  %86 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Header", ptr %85, i32 0, i32 1
  store i32 %83, ptr %86, align 4, !tbaa !37
  %87 = load ptr, ptr %18, align 8, !tbaa !12
  %88 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %87, i32 0, i32 0
  %89 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Header", ptr %88, i32 0, i32 3
  store i32 5121, ptr %89, align 4, !tbaa !38
  %90 = load ptr, ptr %18, align 8, !tbaa !12
  %91 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %90, i32 0, i32 1
  %92 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Content", ptr %91, i32 0, i32 1
  store i8 0, ptr %92, align 4, !tbaa !39
  %93 = load ptr, ptr %18, align 8, !tbaa !12
  %94 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %93, i32 0, i32 1
  %95 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Content", ptr %94, i32 0, i32 0
  store i32 0, ptr %95, align 8, !tbaa !40
  %96 = load ptr, ptr %18, align 8, !tbaa !12
  %97 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %96, i32 0, i32 1
  %98 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Content", ptr %97, i32 0, i32 2
  store i8 0, ptr %98, align 1, !tbaa !41
  %99 = load ptr, ptr %18, align 8, !tbaa !12
  %100 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %99, i32 0, i32 1
  %101 = getelementptr inbounds %"struct.flw::flc::TextureConfig::Content", ptr %100, i32 0, i32 3
  store i32 0, ptr %101, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #7
  %102 = load ptr, ptr %16, align 8, !tbaa !12
  call void @_ZN3flw25make_pu_with_no_ownershipIhEESt10unique_ptrIT_PFvPS2_EES3_(ptr dead_on_unwind writable sret(%"class.std::unique_ptr") align 8 %21, ptr noundef %102)
  %103 = load ptr, ptr %18, align 8, !tbaa !12
  %104 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %103, i32 0, i32 3
  %105 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10unique_ptrIhPFvPhEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16) %104, ptr noundef nonnull align 8 dereferenceable(16) %21) #7
  call void @_ZNSt10unique_ptrIhPFvPhEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %21) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #7
  %106 = load ptr, ptr %18, align 8, !tbaa !12
  %107 = getelementptr inbounds %"struct.flw::flc::TextureConfig", ptr %106, i32 0, i32 2
  store i32 2, ptr %107, align 8, !tbaa !43
  %108 = load ptr, ptr %18, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  ret ptr %108

109:                                              ; preds = %68
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %19, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %20, align 4
  call void @_ZdlPvm(ptr noundef %69, i64 noundef 1112) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %113

113:                                              ; preds = %109
  %114 = load ptr, ptr %19, align 8
  %115 = load i32, ptr %20, align 4
  %116 = insertvalue { ptr, i32 } poison, ptr %114, 0
  %117 = insertvalue { ptr, i32 } %116, i32 %115, 1
  resume { ptr, i32 } %117
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @"_ZZN3flw3flf14TextureFactory20loadVirtualFileColorEjjhhhjENK3$_0clEv"(ptr noundef nonnull align 4 dereferenceable(4)) #6 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin allocsize(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 = { "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 = { nobuiltin nounwind "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 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 #5 = { 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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 0}
!11 = !{!"_ZTSZN3flw3flf14TextureFactory20loadVirtualFileColorEjjhhhjE3$_0", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !6, i64 16}
!17 = !{!"_ZTSN3flw3flc13TextureConfigE", !18, i64 0, !19, i64 24, !20, i64 40, !21, i64 48, !29, i64 64}
!18 = !{!"_ZTSN3flw3flc13TextureConfig6HeaderE", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!19 = !{!"_ZTSN3flw3flc13TextureConfig7ContentE", !6, i64 0, !7, i64 4, !7, i64 5, !6, i64 8, !6, i64 12}
!20 = !{!"_ZTSN3flw3flc17EMemoryAllocationE", !7, i64 0}
!21 = !{!"_ZTSSt10unique_ptrIhPFvPhEE", !22, i64 0}
!22 = !{!"_ZTSSt15__uniq_ptr_dataIhPFvPhELb1ELb1EE", !23, i64 0}
!23 = !{!"_ZTSSt15__uniq_ptr_implIhPFvPhEE", !24, i64 0}
!24 = !{!"_ZTSSt5tupleIJPhPFvS0_EEE", !25, i64 0}
!25 = !{!"_ZTSSt11_Tuple_implILm0EJPhPFvS0_EEE", !26, i64 0, !28, i64 8}
!26 = !{!"_ZTSSt11_Tuple_implILm1EJPFvPhEEE", !27, i64 0}
!27 = !{!"_ZTSSt10_Head_baseILm1EPFvPhELb0EE", !13, i64 0}
!28 = !{!"_ZTSSt10_Head_baseILm0EPhLb0EE", !13, i64 0}
!29 = !{!"_ZTSSt6vectorIN3flw3flc13TextureConfig6MipmapENS0_14AllocatorStackIS3_EEE", !30, i64 0}
!30 = !{!"_ZTSSt12_Vector_baseIN3flw3flc13TextureConfig6MipmapENS0_14AllocatorStackIS3_EEE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIN3flw3flc13TextureConfig6MipmapENS0_14AllocatorStackIS3_EEE12_Vector_implE", !32, i64 0, !34, i64 1024}
!32 = !{!"_ZTSN3flw14AllocatorStackINS_3flc13TextureConfig6MipmapEEE", !33, i64 0}
!33 = !{!"_ZTSSt5arrayIN3flw3flc13TextureConfig6MipmapELm32EE", !7, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIN3flw3flc13TextureConfig6MipmapENS0_14AllocatorStackIS3_EEE17_Vector_impl_dataE", !13, i64 0, !13, i64 8, !13, i64 16}
!35 = !{!17, !6, i64 0}
!36 = !{!17, !6, i64 8}
!37 = !{!17, !6, i64 4}
!38 = !{!17, !6, i64 12}
!39 = !{!17, !7, i64 28}
!40 = !{!17, !6, i64 24}
!41 = !{!17, !7, i64 29}
!42 = !{!17, !6, i64 32}
!43 = !{!17, !20, i64 40}


; 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::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { ptr }
%"struct.std::_Head_base.1" = type { ptr }
%class.anon.2 = type { i32 }

; 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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

declare void @_ZN3flw3flc13TextureConfigC1Ev(ptr noundef nonnull align 8 dereferenceable(1112)) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3flw25make_pu_with_no_ownershipIhEESt10unique_ptrIT_PFvPS2_EES3_(ptr dead_on_unwind noalias writable sret(%"class.std::unique_ptr") align 8, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10unique_ptrIhPFvPhEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIhPFvPhEED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @_ZN3flw3flf14TextureFactory20loadVirtualFileColorEjjhhhj(i32 noundef %0, i32 noundef %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i8 noundef zeroext %4, i32 noundef %5) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %class.anon.2, align 4
  %8 = alloca %"class.std::unique_ptr", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  store i32 %5, ptr %7, align 4, !tbaa !5
  %9 = call noundef i32 @"_ZZN3flw3flf14TextureFactory20loadVirtualFileColorEjjhhhjENK3$_0clEv"(ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  %10 = mul i32 %1, %0
  %11 = mul i32 %10, %9
  %12 = sext i32 %11 to i64
  %13 = call noalias noundef nonnull ptr @_Znam(i64 noundef %12) #8
  %14 = icmp sgt i32 %11, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %6
  %15 = sext i32 %9 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %6
  %16 = call noalias noundef nonnull dereferenceable(1112) ptr @_Znwm(i64 noundef 1112) #8
  invoke void @_ZN3flw3flc13TextureConfigC1Ev(ptr noundef nonnull align 8 dereferenceable(1112) %16)
          to label %22 unwind label %34

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %17 = getelementptr inbounds i8, ptr %13, i64 %indvars.iv
  store i8 %2, ptr %17, align 1, !tbaa !10
  %18 = getelementptr i8, ptr %17, i64 1
  store i8 %3, ptr %18, align 1, !tbaa !10
  %19 = getelementptr i8, ptr %17, i64 2
  store i8 %4, ptr %19, align 1, !tbaa !10
  %20 = getelementptr i8, ptr %17, i64 3
  store i8 1, ptr %20, align 1, !tbaa !10
  %indvars.iv.next = add nsw i64 %indvars.iv, %15
  %21 = icmp slt i64 %indvars.iv.next, %12
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !11

22:                                               ; preds = %._crit_edge
  %23 = getelementptr inbounds i8, ptr %16, i64 16
  store i32 %5, ptr %23, align 8, !tbaa !13
  store i32 %5, ptr %16, align 8, !tbaa !33
  %24 = getelementptr inbounds i8, ptr %16, i64 8
  store i32 %0, ptr %24, align 8, !tbaa !34
  %25 = getelementptr inbounds i8, ptr %16, i64 4
  store i32 %1, ptr %25, align 4, !tbaa !35
  %26 = getelementptr inbounds i8, ptr %16, i64 12
  store i32 5121, ptr %26, align 4, !tbaa !36
  %27 = getelementptr inbounds i8, ptr %16, i64 24
  %28 = getelementptr inbounds i8, ptr %16, i64 28
  store i8 0, ptr %28, align 4, !tbaa !37
  store i32 0, ptr %27, align 8, !tbaa !38
  %29 = getelementptr inbounds i8, ptr %16, i64 29
  store i8 0, ptr %29, align 1, !tbaa !39
  %30 = getelementptr inbounds i8, ptr %16, i64 32
  store i32 0, ptr %30, align 8, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #7
  call void @_ZN3flw25make_pu_with_no_ownershipIhEESt10unique_ptrIT_PFvPS2_EES3_(ptr dead_on_unwind nonnull writable sret(%"class.std::unique_ptr") align 8 %8, ptr noundef nonnull %13)
  %31 = getelementptr inbounds i8, ptr %16, i64 48
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10unique_ptrIhPFvPhEEaSEOS3_(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 8 dereferenceable(16) %8) #7
  call void @_ZNSt10unique_ptrIhPFvPhEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  %33 = getelementptr inbounds i8, ptr %16, i64 40
  store i32 2, ptr %33, align 8, !tbaa !41
  ret ptr %16

34:                                               ; preds = %._crit_edge
  %35 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %16, i64 noundef 1112) #9
  resume { ptr, i32 } %35
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @"_ZZN3flw3flf14TextureFactory20loadVirtualFileColorEjjhhhjENK3$_0clEv"(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin allocsize(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 = { "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 = { nobuiltin nounwind "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 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 #5 = { 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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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, !7, i64 0}
!6 = !{!"_ZTSZN3flw3flf14TextureFactory20loadVirtualFileColorEjjhhhjE3$_0", !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!8, !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !7, i64 16}
!14 = !{!"_ZTSN3flw3flc13TextureConfigE", !15, i64 0, !16, i64 24, !17, i64 40, !18, i64 48, !27, i64 64}
!15 = !{!"_ZTSN3flw3flc13TextureConfig6HeaderE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!16 = !{!"_ZTSN3flw3flc13TextureConfig7ContentE", !7, i64 0, !8, i64 4, !8, i64 5, !7, i64 8, !7, i64 12}
!17 = !{!"_ZTSN3flw3flc17EMemoryAllocationE", !8, i64 0}
!18 = !{!"_ZTSSt10unique_ptrIhPFvPhEE", !19, i64 0}
!19 = !{!"_ZTSSt15__uniq_ptr_dataIhPFvPhELb1ELb1EE", !20, i64 0}
!20 = !{!"_ZTSSt15__uniq_ptr_implIhPFvPhEE", !21, i64 0}
!21 = !{!"_ZTSSt5tupleIJPhPFvS0_EEE", !22, i64 0}
!22 = !{!"_ZTSSt11_Tuple_implILm0EJPhPFvS0_EEE", !23, i64 0, !26, i64 8}
!23 = !{!"_ZTSSt11_Tuple_implILm1EJPFvPhEEE", !24, i64 0}
!24 = !{!"_ZTSSt10_Head_baseILm1EPFvPhELb0EE", !25, i64 0}
!25 = !{!"any pointer", !8, i64 0}
!26 = !{!"_ZTSSt10_Head_baseILm0EPhLb0EE", !25, i64 0}
!27 = !{!"_ZTSSt6vectorIN3flw3flc13TextureConfig6MipmapENS0_14AllocatorStackIS3_EEE", !28, i64 0}
!28 = !{!"_ZTSSt12_Vector_baseIN3flw3flc13TextureConfig6MipmapENS0_14AllocatorStackIS3_EEE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIN3flw3flc13TextureConfig6MipmapENS0_14AllocatorStackIS3_EEE12_Vector_implE", !30, i64 0, !32, i64 1024}
!30 = !{!"_ZTSN3flw14AllocatorStackINS_3flc13TextureConfig6MipmapEEE", !31, i64 0}
!31 = !{!"_ZTSSt5arrayIN3flw3flc13TextureConfig6MipmapELm32EE", !8, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIN3flw3flc13TextureConfig6MipmapENS0_14AllocatorStackIS3_EEE17_Vector_impl_dataE", !25, i64 0, !25, i64 8, !25, i64 16}
!33 = !{!14, !7, i64 0}
!34 = !{!14, !7, i64 8}
!35 = !{!14, !7, i64 4}
!36 = !{!14, !7, i64 12}
!37 = !{!14, !8, i64 28}
!38 = !{!14, !7, i64 24}
!39 = !{!14, !8, i64 29}
!40 = !{!14, !7, i64 32}
!41 = !{!14, !17, i64 40}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass