; LLVM IR from aap/librw :: src/gl/wdgl.ll (ZN2rw4wdgl16skinUninstanceCBEPNS_8GeometryE)

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

%"struct.rw::MemoryFunctions" = type { ptr, ptr, ptr, ptr, ptr }
%"struct.rw::Geometry" = type { %"struct.rw::Object", i32, i16, i32, i32, i32, i32, ptr, ptr, [8 x ptr], ptr, %"struct.rw::MaterialList", ptr, ptr, i32 }
%"struct.rw::Object" = type { i8, i8, i8, i8, ptr }
%"struct.rw::MaterialList" = type { ptr, i32, i32 }
%"struct.rw::Skin" = type { i32, i32, i32, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32 }
%"struct.rw::wdgl::InstanceDataHeader" = type { %"struct.rw::InstanceDataHeader", i32, ptr, i32, ptr, i32, i32 }
%"struct.rw::InstanceDataHeader" = type { i32 }
%"struct.rw::wdgl::AttribDesc" = type { i32, i32, i32, i32, i32, i32 }

@_ZN2rw6Engine8memfuncsE = external global %"struct.rw::MemoryFunctions", align 8

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; 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 dso_local void @_ZN2rw4wdgl12unpackattribEPfPhPNS0_10AttribDescEf(ptr noundef, ptr noundef, ptr noundef, float noundef) #2

declare void @_ZN2rw4Skin4initEiii(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef, i32 noundef, i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN2rw4Skin3getEPKNS_8GeometryE(ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw4wdgl16skinUninstanceCBEPNS_8GeometryE(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %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 i32, align 4
  %14 = alloca float, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.rw::Geometry", ptr %16, i32 0, i32 13
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  store ptr %18, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = call noundef ptr @_ZN2rw4Skin3getEPKNS_8GeometryE(ptr noundef %19)
  store ptr %20, ptr %4, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %1
  store i32 1, ptr %5, align 4
  br label %198

24:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.rw::Skin", ptr %25, i32 0, i32 13
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  store ptr %27, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.rw::Skin", ptr %28, i32 0, i32 4
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  store ptr %30, ptr %7, align 8, !tbaa !5
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.rw::Skin", ptr %32, i32 0, i32 0
  %34 = load i32, ptr %33, align 8, !tbaa !18
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.rw::Skin", ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 8, !tbaa !18
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.rw::Geometry", ptr %38, i32 0, i32 4
  %40 = load i32, ptr %39, align 4, !tbaa !19
  call void @_ZN2rw4Skin4initEiii(ptr noundef nonnull align 8 dereferenceable(112) %31, i32 noundef %34, i32 noundef %37, i32 noundef %40)
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.rw::Skin", ptr %41, i32 0, i32 4
  %43 = load ptr, ptr %42, align 8, !tbaa !17
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.rw::Skin", ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !18
  %48 = mul nsw i32 %47, 64
  %49 = sext i32 %48 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %43, ptr align 4 %44, i64 %49, i1 false)
  %50 = load ptr, ptr getelementptr inbounds (%"struct.rw::MemoryFunctions", ptr @_ZN2rw6Engine8memfuncsE, i32 0, i32 2), align 8, !tbaa !20
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  call void %50(ptr noundef %51)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.rw::Skin", ptr %52, i32 0, i32 6
  %54 = load ptr, ptr %53, align 8, !tbaa !22
  store ptr %54, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.rw::Skin", ptr %55, i32 0, i32 5
  %57 = load ptr, ptr %56, align 8, !tbaa !23
  store ptr %57, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !24
  br label %58

58:                                               ; preds = %186, %24
  %59 = load i32, ptr %11, align 4, !tbaa !24
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.rw::wdgl::InstanceDataHeader", ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !25
  %63 = icmp slt i32 %59, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %58
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %189

65:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.rw::wdgl::InstanceDataHeader", ptr %66, i32 0, i32 2
  %68 = load ptr, ptr %67, align 8, !tbaa !28
  %69 = load i32, ptr %11, align 4, !tbaa !24
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds %"struct.rw::wdgl::AttribDesc", ptr %68, i64 %70
  store ptr %71, ptr %12, align 8, !tbaa !5
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.rw::wdgl::InstanceDataHeader", ptr %72, i32 0, i32 4
  %74 = load ptr, ptr %73, align 8, !tbaa !29
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.rw::wdgl::AttribDesc", ptr %75, i32 0, i32 5
  %77 = load i32, ptr %76, align 4, !tbaa !30
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds i8, ptr %74, i64 %78
  store ptr %79, ptr %8, align 8, !tbaa !5
  %80 = load ptr, ptr %12, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.rw::wdgl::AttribDesc", ptr %80, i32 0, i32 0
  %82 = load i32, ptr %81, align 4, !tbaa !32
  switch i32 %82, label %185 [
    i32 4, label %83
    i32 5, label %146
  ]

83:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !24
  br label %84

84:                                               ; preds = %142, %83
  %85 = load i32, ptr %13, align 4, !tbaa !24
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.rw::Geometry", ptr %86, i32 0, i32 4
  %88 = load i32, ptr %87, align 4, !tbaa !19
  %89 = icmp slt i32 %85, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %84
  store i32 6, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %145

91:                                               ; preds = %84
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN2rw4wdgl12unpackattribEPfPhPNS0_10AttribDescEf(ptr noundef %92, ptr noundef %93, ptr noundef %94, float noundef 1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = getelementptr inbounds float, ptr %95, i64 0
  %97 = load float, ptr %96, align 4, !tbaa !33
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = getelementptr inbounds float, ptr %98, i64 1
  %100 = load float, ptr %99, align 4, !tbaa !33
  %101 = fadd float %97, %100
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = getelementptr inbounds float, ptr %102, i64 2
  %104 = load float, ptr %103, align 4, !tbaa !33
  %105 = fadd float %101, %104
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = getelementptr inbounds float, ptr %106, i64 3
  %108 = load float, ptr %107, align 4, !tbaa !33
  %109 = fadd float %105, %108
  store float %109, ptr %14, align 4, !tbaa !33
  %110 = load float, ptr %14, align 4, !tbaa !33
  %111 = fcmp une float %110, 0.000000e+00
  br i1 %111, label %112, label %133

112:                                              ; preds = %91
  %113 = load float, ptr %14, align 4, !tbaa !33
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = getelementptr inbounds float, ptr %114, i64 0
  %116 = load float, ptr %115, align 4, !tbaa !33
  %117 = fdiv float %116, %113
  store float %117, ptr %115, align 4, !tbaa !33
  %118 = load float, ptr %14, align 4, !tbaa !33
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = getelementptr inbounds float, ptr %119, i64 1
  %121 = load float, ptr %120, align 4, !tbaa !33
  %122 = fdiv float %121, %118
  store float %122, ptr %120, align 4, !tbaa !33
  %123 = load float, ptr %14, align 4, !tbaa !33
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds float, ptr %124, i64 2
  %126 = load float, ptr %125, align 4, !tbaa !33
  %127 = fdiv float %126, %123
  store float %127, ptr %125, align 4, !tbaa !33
  %128 = load float, ptr %14, align 4, !tbaa !33
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  %130 = getelementptr inbounds float, ptr %129, i64 3
  %131 = load float, ptr %130, align 4, !tbaa !33
  %132 = fdiv float %131, %128
  store float %132, ptr %130, align 4, !tbaa !33
  br label %133

133:                                              ; preds = %112, %91
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = getelementptr inbounds float, ptr %134, i64 4
  store ptr %135, ptr %9, align 8, !tbaa !5
  %136 = load ptr, ptr %12, align 8, !tbaa !5
  %137 = getelementptr inbounds %"struct.rw::wdgl::AttribDesc", ptr %136, i32 0, i32 4
  %138 = load i32, ptr %137, align 4, !tbaa !35
  %139 = load ptr, ptr %8, align 8, !tbaa !5
  %140 = zext i32 %138 to i64
  %141 = getelementptr inbounds i8, ptr %139, i64 %140
  store ptr %141, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %142

142:                                              ; preds = %133
  %143 = load i32, ptr %13, align 4, !tbaa !24
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %13, align 4, !tbaa !24
  br label %84, !llvm.loop !36

145:                                              ; preds = %90
  br label %185

146:                                              ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !24
  br label %147

147:                                              ; preds = %181, %146
  %148 = load i32, ptr %15, align 4, !tbaa !24
  %149 = load ptr, ptr %2, align 8, !tbaa !5
  %150 = getelementptr inbounds %"struct.rw::Geometry", ptr %149, i32 0, i32 4
  %151 = load i32, ptr %150, align 4, !tbaa !19
  %152 = icmp slt i32 %148, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %147
  store i32 9, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %184

154:                                              ; preds = %147
  %155 = load ptr, ptr %8, align 8, !tbaa !5
  %156 = getelementptr inbounds i8, ptr %155, i64 0
  %157 = load i8, ptr %156, align 1, !tbaa !38
  %158 = load ptr, ptr %10, align 8, !tbaa !5
  %159 = getelementptr inbounds i8, ptr %158, i32 1
  store ptr %159, ptr %10, align 8, !tbaa !5
  store i8 %157, ptr %158, align 1, !tbaa !38
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = getelementptr inbounds i8, ptr %160, i64 1
  %162 = load i8, ptr %161, align 1, !tbaa !38
  %163 = load ptr, ptr %10, align 8, !tbaa !5
  %164 = getelementptr inbounds i8, ptr %163, i32 1
  store ptr %164, ptr %10, align 8, !tbaa !5
  store i8 %162, ptr %163, align 1, !tbaa !38
  %165 = load ptr, ptr %8, align 8, !tbaa !5
  %166 = getelementptr inbounds i8, ptr %165, i64 2
  %167 = load i8, ptr %166, align 1, !tbaa !38
  %168 = load ptr, ptr %10, align 8, !tbaa !5
  %169 = getelementptr inbounds i8, ptr %168, i32 1
  store ptr %169, ptr %10, align 8, !tbaa !5
  store i8 %167, ptr %168, align 1, !tbaa !38
  %170 = load ptr, ptr %8, align 8, !tbaa !5
  %171 = getelementptr inbounds i8, ptr %170, i64 3
  %172 = load i8, ptr %171, align 1, !tbaa !38
  %173 = load ptr, ptr %10, align 8, !tbaa !5
  %174 = getelementptr inbounds i8, ptr %173, i32 1
  store ptr %174, ptr %10, align 8, !tbaa !5
  store i8 %172, ptr %173, align 1, !tbaa !38
  %175 = load ptr, ptr %12, align 8, !tbaa !5
  %176 = getelementptr inbounds %"struct.rw::wdgl::AttribDesc", ptr %175, i32 0, i32 4
  %177 = load i32, ptr %176, align 4, !tbaa !35
  %178 = load ptr, ptr %8, align 8, !tbaa !5
  %179 = zext i32 %177 to i64
  %180 = getelementptr inbounds i8, ptr %178, i64 %179
  store ptr %180, ptr %8, align 8, !tbaa !5
  br label %181

181:                                              ; preds = %154
  %182 = load i32, ptr %15, align 4, !tbaa !24
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %15, align 4, !tbaa !24
  br label %147, !llvm.loop !39

184:                                              ; preds = %153
  br label %185

185:                                              ; preds = %184, %145, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %186

186:                                              ; preds = %185
  %187 = load i32, ptr %11, align 4, !tbaa !24
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %11, align 4, !tbaa !24
  br label %58, !llvm.loop !40

189:                                              ; preds = %64
  %190 = load ptr, ptr %4, align 8, !tbaa !5
  %191 = load ptr, ptr %2, align 8, !tbaa !5
  %192 = getelementptr inbounds %"struct.rw::Geometry", ptr %191, i32 0, i32 4
  %193 = load i32, ptr %192, align 4, !tbaa !19
  call void @_ZN2rw4Skin14findNumWeightsEi(ptr noundef nonnull align 8 dereferenceable(112) %190, i32 noundef %193)
  %194 = load ptr, ptr %4, align 8, !tbaa !5
  %195 = load ptr, ptr %2, align 8, !tbaa !5
  %196 = getelementptr inbounds %"struct.rw::Geometry", ptr %195, i32 0, i32 4
  %197 = load i32, ptr %196, align 4, !tbaa !19
  call void @_ZN2rw4Skin13findUsedBonesEi(ptr noundef nonnull align 8 dereferenceable(112) %194, i32 noundef %197)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  store i32 0, ptr %5, align 4
  br label %198

198:                                              ; preds = %189, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  %199 = load i32, ptr %5, align 4
  switch i32 %199, label %201 [
    i32 0, label %200
    i32 1, label %200
  ]

200:                                              ; preds = %198, %198
  ret void

201:                                              ; preds = %198
  unreachable
}

declare void @_ZN2rw4Skin14findNumWeightsEi(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef) #3

declare void @_ZN2rw4Skin13findUsedBonesEi(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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 = { "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 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 = { 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, !6, i64 152}
!10 = !{!"_ZTSN2rw8GeometryE", !11, i64 0, !12, i64 16, !13, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !14, i64 128, !6, i64 144, !6, i64 152, !12, i64 160}
!11 = !{!"_ZTSN2rw6ObjectE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!"_ZTSN2rw12MaterialListE", !6, i64 0, !12, i64 8, !12, i64 12}
!15 = !{!16, !6, i64 88}
!16 = !{!"_ZTSN2rw4SkinE", !12, i64 0, !12, i64 4, !12, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104}
!17 = !{!16, !6, i64 24}
!18 = !{!16, !12, i64 0}
!19 = !{!10, !12, i64 28}
!20 = !{!21, !6, i64 16}
!21 = !{!"_ZTSN2rw15MemoryFunctionsE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!22 = !{!16, !6, i64 40}
!23 = !{!16, !6, i64 32}
!24 = !{!12, !12, i64 0}
!25 = !{!26, !12, i64 4}
!26 = !{!"_ZTSN2rw4wdgl18InstanceDataHeaderE", !27, i64 0, !12, i64 4, !6, i64 8, !12, i64 16, !6, i64 24, !12, i64 32, !12, i64 36}
!27 = !{!"_ZTSN2rw18InstanceDataHeaderE", !12, i64 0}
!28 = !{!26, !6, i64 8}
!29 = !{!26, !6, i64 24}
!30 = !{!31, !12, i64 20}
!31 = !{!"_ZTSN2rw4wdgl10AttribDescE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!32 = !{!31, !12, i64 0}
!33 = !{!34, !34, i64 0}
!34 = !{!"float", !7, i64 0}
!35 = !{!31, !12, i64 16}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{!7, !7, i64 0}
!39 = distinct !{!39, !37}
!40 = distinct !{!40, !37}


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

%"struct.rw::MemoryFunctions" = type { ptr, ptr, ptr, ptr, ptr }
%"struct.rw::wdgl::AttribDesc" = type { i32, i32, i32, i32, i32, i32 }

@_ZN2rw6Engine8memfuncsE = external local_unnamed_addr global %"struct.rw::MemoryFunctions", align 8

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2rw4wdgl12unpackattribEPfPhPNS0_10AttribDescEf(ptr noundef, ptr noundef, ptr noundef, float noundef) local_unnamed_addr #1

declare void @_ZN2rw4Skin4initEiii(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN2rw4Skin3getEPKNS_8GeometryE(ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw4wdgl16skinUninstanceCBEPNS_8GeometryE(ptr noundef %0) local_unnamed_addr #3 {
  %2 = getelementptr inbounds i8, ptr %0, i64 152
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = tail call noundef ptr @_ZN2rw4Skin3getEPKNS_8GeometryE(ptr noundef %0)
  %5 = icmp eq ptr %4, null
  br i1 %5, label %84, label %6

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %4, i64 88
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %4, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !16
  %11 = load i32, ptr %4, align 8, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %0, i64 28
  %13 = load i32, ptr %12, align 4, !tbaa !18
  tail call void @_ZN2rw4Skin4initEiii(ptr noundef nonnull align 8 dereferenceable(112) %4, i32 noundef %11, i32 noundef %11, i32 noundef %13)
  %14 = load ptr, ptr %9, align 8, !tbaa !16
  %15 = load i32, ptr %4, align 8, !tbaa !17
  %16 = shl nsw i32 %15, 6
  %17 = sext i32 %16 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %10, i64 %17, i1 false)
  %18 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN2rw6Engine8memfuncsE, i64 16), align 8, !tbaa !19
  tail call void %18(ptr noundef %8)
  %19 = getelementptr inbounds i8, ptr %3, i64 4
  %20 = load i32, ptr %19, align 4, !tbaa !21
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph84, label %._crit_edge

.lr.ph84:                                         ; preds = %6
  %22 = getelementptr inbounds i8, ptr %4, i64 32
  %23 = load ptr, ptr %22, align 8, !tbaa !24
  %24 = getelementptr inbounds i8, ptr %4, i64 40
  %25 = load ptr, ptr %24, align 8, !tbaa !25
  %26 = getelementptr inbounds i8, ptr %3, i64 8
  %27 = getelementptr inbounds i8, ptr %3, i64 24
  br label %30

._crit_edge:                                      ; preds = %.loopexit, %6
  %28 = load i32, ptr %12, align 4, !tbaa !18
  tail call void @_ZN2rw4Skin14findNumWeightsEi(ptr noundef nonnull align 8 dereferenceable(112) %4, i32 noundef %28)
  %29 = load i32, ptr %12, align 4, !tbaa !18
  tail call void @_ZN2rw4Skin13findUsedBonesEi(ptr noundef nonnull align 8 dereferenceable(112) %4, i32 noundef %29)
  br label %84

30:                                               ; preds = %.lr.ph84, %.loopexit
  %indvars.iv = phi i64 [ 0, %.lr.ph84 ], [ %indvars.iv.next, %.loopexit ]
  %.06482 = phi ptr [ %23, %.lr.ph84 ], [ %.2, %.loopexit ]
  %.06681 = phi ptr [ %25, %.lr.ph84 ], [ %.268, %.loopexit ]
  %31 = load ptr, ptr %26, align 8, !tbaa !26
  %32 = getelementptr inbounds %"struct.rw::wdgl::AttribDesc", ptr %31, i64 %indvars.iv
  %33 = load ptr, ptr %27, align 8, !tbaa !27
  %34 = getelementptr inbounds i8, ptr %32, i64 20
  %35 = load i32, ptr %34, align 4, !tbaa !28
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %33, i64 %36
  %38 = load i32, ptr %32, align 4, !tbaa !30
  switch i32 %38, label %.loopexit [
    i32 4, label %.preheader
    i32 5, label %.preheader71
  ]

.preheader71:                                     ; preds = %30
  %39 = load i32, ptr %12, align 4, !tbaa !18
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader71
  %41 = getelementptr inbounds i8, ptr %32, i64 16
  br label %63

.preheader:                                       ; preds = %30
  %42 = load i32, ptr %12, align 4, !tbaa !18
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %.lr.ph79, label %.loopexit

.lr.ph79:                                         ; preds = %.preheader
  %44 = getelementptr inbounds i8, ptr %32, i64 16
  br label %45

45:                                               ; preds = %.lr.ph79, %55
  %.06178 = phi i32 [ 0, %.lr.ph79 ], [ %60, %55 ]
  %.06277 = phi ptr [ %37, %.lr.ph79 ], [ %59, %55 ]
  %.16776 = phi ptr [ %.06681, %.lr.ph79 ], [ %56, %55 ]
  tail call void @_ZN2rw4wdgl12unpackattribEPfPhPNS0_10AttribDescEf(ptr noundef %.16776, ptr noundef %.06277, ptr noundef nonnull %32, float noundef 1.000000e+00)
  %46 = load <4 x float>, ptr %.16776, align 4, !tbaa !31
  %shift = shufflevector <4 x float> %46, <4 x float> poison, <4 x i32> <i32 1, i32 poison, i32 poison, i32 poison>
  %47 = fadd <4 x float> %46, %shift
  %shift92 = shufflevector <4 x float> %46, <4 x float> poison, <4 x i32> <i32 2, i32 poison, i32 poison, i32 poison>
  %48 = fadd <4 x float> %47, %shift92
  %shift93 = shufflevector <4 x float> %46, <4 x float> poison, <4 x i32> <i32 3, i32 poison, i32 poison, i32 poison>
  %49 = fadd <4 x float> %48, %shift93
  %50 = extractelement <4 x float> %49, i64 0
  %51 = fcmp une float %50, 0.000000e+00
  br i1 %51, label %52, label %55

52:                                               ; preds = %45
  %53 = shufflevector <4 x float> %49, <4 x float> poison, <4 x i32> zeroinitializer
  %54 = fdiv <4 x float> %46, %53
  store <4 x float> %54, ptr %.16776, align 4, !tbaa !31
  br label %55

55:                                               ; preds = %52, %45
  %56 = getelementptr inbounds i8, ptr %.16776, i64 16
  %57 = load i32, ptr %44, align 4, !tbaa !33
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %.06277, i64 %58
  %60 = add nuw nsw i32 %.06178, 1
  %61 = load i32, ptr %12, align 4, !tbaa !18
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %45, label %.loopexit, !llvm.loop !34

63:                                               ; preds = %.lr.ph, %63
  %.075 = phi i32 [ 0, %.lr.ph ], [ %78, %63 ]
  %.174 = phi ptr [ %37, %.lr.ph ], [ %77, %63 ]
  %.16573 = phi ptr [ %.06482, %.lr.ph ], [ %74, %63 ]
  %64 = load i8, ptr %.174, align 1, !tbaa !36
  %65 = getelementptr inbounds i8, ptr %.16573, i64 1
  store i8 %64, ptr %.16573, align 1, !tbaa !36
  %66 = getelementptr inbounds i8, ptr %.174, i64 1
  %67 = load i8, ptr %66, align 1, !tbaa !36
  %68 = getelementptr inbounds i8, ptr %.16573, i64 2
  store i8 %67, ptr %65, align 1, !tbaa !36
  %69 = getelementptr inbounds i8, ptr %.174, i64 2
  %70 = load i8, ptr %69, align 1, !tbaa !36
  %71 = getelementptr inbounds i8, ptr %.16573, i64 3
  store i8 %70, ptr %68, align 1, !tbaa !36
  %72 = getelementptr inbounds i8, ptr %.174, i64 3
  %73 = load i8, ptr %72, align 1, !tbaa !36
  %74 = getelementptr inbounds i8, ptr %.16573, i64 4
  store i8 %73, ptr %71, align 1, !tbaa !36
  %75 = load i32, ptr %41, align 4, !tbaa !33
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %.174, i64 %76
  %78 = add nuw nsw i32 %.075, 1
  %79 = load i32, ptr %12, align 4, !tbaa !18
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %63, label %.loopexit, !llvm.loop !37

.loopexit:                                        ; preds = %63, %55, %.preheader71, %.preheader, %30
  %.268 = phi ptr [ %.06681, %30 ], [ %.06681, %.preheader ], [ %.06681, %.preheader71 ], [ %56, %55 ], [ %.06681, %63 ]
  %.2 = phi ptr [ %.06482, %30 ], [ %.06482, %.preheader ], [ %.06482, %.preheader71 ], [ %.06482, %55 ], [ %74, %63 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %81 = load i32, ptr %19, align 4, !tbaa !21
  %82 = sext i32 %81 to i64
  %83 = icmp slt i64 %indvars.iv.next, %82
  br i1 %83, label %30, label %._crit_edge, !llvm.loop !38

84:                                               ; preds = %1, %._crit_edge
  ret void
}

declare void @_ZN2rw4Skin14findNumWeightsEi(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef) local_unnamed_addr #2

declare void @_ZN2rw4Skin13findUsedBonesEi(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree 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 = { "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" }

!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 152}
!6 = !{!"_ZTSN2rw8GeometryE", !7, i64 0, !11, i64 16, !12, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !10, i64 40, !10, i64 48, !8, i64 56, !10, i64 120, !13, i64 128, !10, i64 144, !10, i64 152, !11, i64 160}
!7 = !{!"_ZTSN2rw6ObjectE", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !10, i64 8}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"_ZTSN2rw12MaterialListE", !10, i64 0, !11, i64 8, !11, i64 12}
!14 = !{!15, !10, i64 88}
!15 = !{!"_ZTSN2rw4SkinE", !11, i64 0, !11, i64 4, !11, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !11, i64 104}
!16 = !{!15, !10, i64 24}
!17 = !{!15, !11, i64 0}
!18 = !{!6, !11, i64 28}
!19 = !{!20, !10, i64 16}
!20 = !{!"_ZTSN2rw15MemoryFunctionsE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!21 = !{!22, !11, i64 4}
!22 = !{!"_ZTSN2rw4wdgl18InstanceDataHeaderE", !23, i64 0, !11, i64 4, !10, i64 8, !11, i64 16, !10, i64 24, !11, i64 32, !11, i64 36}
!23 = !{!"_ZTSN2rw18InstanceDataHeaderE", !11, i64 0}
!24 = !{!15, !10, i64 32}
!25 = !{!15, !10, i64 40}
!26 = !{!22, !10, i64 8}
!27 = !{!22, !10, i64 24}
!28 = !{!29, !11, i64 20}
!29 = !{!"_ZTSN2rw4wdgl10AttribDescE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!30 = !{!29, !11, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"float", !8, i64 0}
!33 = !{!29, !11, i64 16}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}
!36 = !{!8, !8, i64 0}
!37 = distinct !{!37, !35}
!38 = distinct !{!38, !35}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass