; LLVM IR from aap/librw :: src/d3d/d3d9.ll (ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii)

; 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::Error" = type { i32, i32 }
%"struct.rw::d3d9::VertexElement" = type { i16, i16, i8, i8, i8, i8 }
%"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::InstanceDataHeader" = type { i32 }
%"struct.rw::d3d9::InstanceDataHeader" = type { %"struct.rw::InstanceDataHeader", i32, i32, ptr, i32, [2 x %"struct.rw::d3d9::VertexStream"], i32, ptr, i32, i32, ptr }
%"struct.rw::d3d9::VertexStream" = type { ptr, i32, i32, i16, i8, i8 }
%"struct.rw::d3d9::InstanceData" = type { i32, i32, ptr, i32, ptr, i32, i32, i32, i32 }

@_ZN2rw6Engine8memfuncsE = external global %"struct.rw::MemoryFunctions", align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii = external hidden unnamed_addr constant [72 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw4d3d923createVertexDeclarationEPNS0_13VertexElementE(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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef, i32 noundef, ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.rw::Error", align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.rw::Error", align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca [12 x %"struct.rw::d3d9::VertexElement"], align 16
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca ptr, align 8
  %30 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %31, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %32, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %33, label %45, label %34

34:                                               ; preds = %5
  br label %35

35:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %36 = getelementptr inbounds %"struct.rw::Error", ptr %14, i32 0, i32 0
  store i32 2, ptr %36, align 4, !tbaa !11
  %37 = getelementptr inbounds %"struct.rw::Error", ptr %14, i32 0, i32 1
  store i32 -2147483644, ptr %37, align 4, !tbaa !13
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 156) #6
  %40 = load ptr, ptr @stderr, align 8, !tbaa !5
  %41 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.4)
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.3, ptr noundef %41) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %43

43:                                               ; preds = %35
  br label %44

44:                                               ; preds = %43
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %394

45:                                               ; preds = %5
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = call noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8) %46)
  store i32 %47, ptr %13, align 4, !tbaa !9
  %48 = load i32, ptr %13, align 4, !tbaa !9
  %49 = icmp ne i32 %48, 9
  br i1 %49, label %50, label %62

50:                                               ; preds = %45
  br label %51

51:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %52 = getelementptr inbounds %"struct.rw::Error", ptr %16, i32 0, i32 0
  store i32 2, ptr %52, align 4, !tbaa !11
  %53 = getelementptr inbounds %"struct.rw::Error", ptr %16, i32 0, i32 1
  store i32 -2147483642, ptr %53, align 4, !tbaa !13
  %54 = load ptr, ptr @stderr, align 8, !tbaa !5
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 161) #6
  %56 = load ptr, ptr @stderr, align 8, !tbaa !5
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483642, i32 noundef %57)
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef @.str.3, ptr noundef %58) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %60

60:                                               ; preds = %51
  br label %61

61:                                               ; preds = %60
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %394

62:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %63 = call noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef 112, i32 noundef 196623, ptr noundef @.str.5)
  store ptr %63, ptr %17, align 8, !tbaa !5
  %64 = load ptr, ptr %17, align 8, !tbaa !5
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.rw::Geometry", ptr %65, i32 0, i32 13
  store ptr %64, ptr %66, align 8, !tbaa !14
  %67 = load ptr, ptr %17, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.rw::InstanceDataHeader", ptr %67, i32 0, i32 0
  store i32 9, ptr %68, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %69)
  store i32 %70, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %71 = load i32, ptr %18, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = mul i64 %72, 1
  %74 = call noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef %73, i32 noundef 65551, ptr noundef @.str.6)
  store ptr %74, ptr %19, align 8, !tbaa !5
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = load ptr, ptr %19, align 8, !tbaa !5
  %77 = load i32, ptr %18, align 4, !tbaa !9
  %78 = load ptr, ptr %75, align 8, !tbaa !21
  %79 = getelementptr inbounds ptr, ptr %78, i64 4
  %80 = load ptr, ptr %79, align 8
  %81 = call noundef i32 %80(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef %76, i32 noundef %77)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %82 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %82, ptr %20, align 8, !tbaa !5
  %83 = load ptr, ptr %20, align 8, !tbaa !5
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = load ptr, ptr %17, align 8, !tbaa !5
  %86 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %85, i32 0, i32 1
  store i32 %84, ptr %86, align 4, !tbaa !23
  %87 = load ptr, ptr %20, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %87, i64 4
  store ptr %88, ptr %20, align 8, !tbaa !5
  %89 = load ptr, ptr %20, align 8, !tbaa !5
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = load ptr, ptr %17, align 8, !tbaa !5
  %92 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %91, i32 0, i32 2
  store i32 %90, ptr %92, align 8, !tbaa !25
  %93 = load ptr, ptr %20, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %93, i64 4
  store ptr %94, ptr %20, align 8, !tbaa !5
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  %96 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %95, i32 0, i32 3
  store ptr null, ptr %96, align 8, !tbaa !26
  %97 = load ptr, ptr %20, align 8, !tbaa !5
  %98 = getelementptr inbounds i8, ptr %97, i64 4
  store ptr %98, ptr %20, align 8, !tbaa !5
  %99 = load ptr, ptr %20, align 8, !tbaa !5
  %100 = load i32, ptr %99, align 4, !tbaa !9
  %101 = load ptr, ptr %17, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %101, i32 0, i32 4
  store i32 %100, ptr %102, align 8, !tbaa !27
  %103 = load ptr, ptr %20, align 8, !tbaa !5
  %104 = getelementptr inbounds i8, ptr %103, i64 4
  store ptr %104, ptr %20, align 8, !tbaa !5
  %105 = load ptr, ptr %20, align 8, !tbaa !5
  %106 = getelementptr inbounds i8, ptr %105, i64 32
  store ptr %106, ptr %20, align 8, !tbaa !5
  %107 = load ptr, ptr %20, align 8, !tbaa !5
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = load ptr, ptr %17, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %109, i32 0, i32 6
  store i32 %108, ptr %110, align 8, !tbaa !28
  %111 = load ptr, ptr %20, align 8, !tbaa !5
  %112 = getelementptr inbounds i8, ptr %111, i64 4
  store ptr %112, ptr %20, align 8, !tbaa !5
  %113 = load ptr, ptr %17, align 8, !tbaa !5
  %114 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %113, i32 0, i32 7
  store ptr null, ptr %114, align 8, !tbaa !29
  %115 = load ptr, ptr %20, align 8, !tbaa !5
  %116 = getelementptr inbounds i8, ptr %115, i64 4
  store ptr %116, ptr %20, align 8, !tbaa !5
  %117 = load ptr, ptr %20, align 8, !tbaa !5
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = load ptr, ptr %17, align 8, !tbaa !5
  %120 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %119, i32 0, i32 8
  store i32 %118, ptr %120, align 8, !tbaa !30
  %121 = load ptr, ptr %20, align 8, !tbaa !5
  %122 = getelementptr inbounds i8, ptr %121, i64 4
  store ptr %122, ptr %20, align 8, !tbaa !5
  %123 = load ptr, ptr %20, align 8, !tbaa !5
  %124 = load i32, ptr %123, align 4, !tbaa !9
  %125 = load ptr, ptr %17, align 8, !tbaa !5
  %126 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %125, i32 0, i32 9
  store i32 %124, ptr %126, align 4, !tbaa !31
  %127 = load ptr, ptr %20, align 8, !tbaa !5
  %128 = getelementptr inbounds i8, ptr %127, i64 4
  store ptr %128, ptr %20, align 8, !tbaa !5
  %129 = load ptr, ptr %17, align 8, !tbaa !5
  %130 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %129, i32 0, i32 2
  %131 = load i32, ptr %130, align 8, !tbaa !25
  %132 = zext i32 %131 to i64
  %133 = mul i64 %132, 48
  %134 = call noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef %133, i32 noundef 196623, ptr noundef @.str.7)
  %135 = load ptr, ptr %17, align 8, !tbaa !5
  %136 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %135, i32 0, i32 10
  store ptr %134, ptr %136, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %137 = load ptr, ptr %17, align 8, !tbaa !5
  %138 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %137, i32 0, i32 10
  %139 = load ptr, ptr %138, align 8, !tbaa !32
  store ptr %139, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %208, %62
  %141 = load i32, ptr %22, align 4, !tbaa !9
  %142 = load ptr, ptr %17, align 8, !tbaa !5
  %143 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %142, i32 0, i32 2
  %144 = load i32, ptr %143, align 8, !tbaa !25
  %145 = icmp ult i32 %141, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %140
  store i32 6, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %211

147:                                              ; preds = %140
  %148 = load ptr, ptr %20, align 8, !tbaa !5
  %149 = load i32, ptr %148, align 4, !tbaa !9
  %150 = load ptr, ptr %21, align 8, !tbaa !5
  %151 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %150, i32 0, i32 0
  store i32 %149, ptr %151, align 8, !tbaa !33
  %152 = load ptr, ptr %20, align 8, !tbaa !5
  %153 = getelementptr inbounds i8, ptr %152, i64 4
  store ptr %153, ptr %20, align 8, !tbaa !5
  %154 = load ptr, ptr %20, align 8, !tbaa !5
  %155 = load i32, ptr %154, align 4, !tbaa !9
  %156 = load ptr, ptr %21, align 8, !tbaa !5
  %157 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %156, i32 0, i32 1
  store i32 %155, ptr %157, align 4, !tbaa !35
  %158 = load ptr, ptr %20, align 8, !tbaa !5
  %159 = getelementptr inbounds i8, ptr %158, i64 4
  store ptr %159, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %160 = load ptr, ptr %20, align 8, !tbaa !5
  %161 = load i32, ptr %160, align 4, !tbaa !9
  store i32 %161, ptr %23, align 4, !tbaa !9
  %162 = load ptr, ptr %20, align 8, !tbaa !5
  %163 = getelementptr inbounds i8, ptr %162, i64 4
  store ptr %163, ptr %20, align 8, !tbaa !5
  %164 = load ptr, ptr %12, align 8, !tbaa !5
  %165 = getelementptr inbounds %"struct.rw::Geometry", ptr %164, i32 0, i32 11
  %166 = getelementptr inbounds %"struct.rw::MaterialList", ptr %165, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8, !tbaa !36
  %168 = load i32, ptr %23, align 4, !tbaa !9
  %169 = zext i32 %168 to i64
  %170 = getelementptr inbounds ptr, ptr %167, i64 %169
  %171 = load ptr, ptr %170, align 8, !tbaa !5
  %172 = load ptr, ptr %21, align 8, !tbaa !5
  %173 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %172, i32 0, i32 2
  store ptr %171, ptr %173, align 8, !tbaa !37
  %174 = load ptr, ptr %20, align 8, !tbaa !5
  %175 = load i32, ptr %174, align 4, !tbaa !9
  %176 = load ptr, ptr %21, align 8, !tbaa !5
  %177 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %176, i32 0, i32 3
  store i32 %175, ptr %177, align 8, !tbaa !38
  %178 = load ptr, ptr %20, align 8, !tbaa !5
  %179 = getelementptr inbounds i8, ptr %178, i64 4
  store ptr %179, ptr %20, align 8, !tbaa !5
  %180 = load ptr, ptr %21, align 8, !tbaa !5
  %181 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %180, i32 0, i32 4
  store ptr null, ptr %181, align 8, !tbaa !39
  %182 = load ptr, ptr %20, align 8, !tbaa !5
  %183 = getelementptr inbounds i8, ptr %182, i64 4
  store ptr %183, ptr %20, align 8, !tbaa !5
  %184 = load ptr, ptr %21, align 8, !tbaa !5
  %185 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %184, i32 0, i32 5
  store i32 0, ptr %185, align 8, !tbaa !40
  %186 = load ptr, ptr %20, align 8, !tbaa !5
  %187 = getelementptr inbounds i8, ptr %186, i64 4
  store ptr %187, ptr %20, align 8, !tbaa !5
  %188 = load ptr, ptr %20, align 8, !tbaa !5
  %189 = load i32, ptr %188, align 4, !tbaa !9
  %190 = load ptr, ptr %21, align 8, !tbaa !5
  %191 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %190, i32 0, i32 6
  store i32 %189, ptr %191, align 4, !tbaa !41
  %192 = load ptr, ptr %20, align 8, !tbaa !5
  %193 = getelementptr inbounds i8, ptr %192, i64 4
  store ptr %193, ptr %20, align 8, !tbaa !5
  %194 = load ptr, ptr %20, align 8, !tbaa !5
  %195 = load i32, ptr %194, align 4, !tbaa !9
  %196 = load ptr, ptr %21, align 8, !tbaa !5
  %197 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %196, i32 0, i32 7
  store i32 %195, ptr %197, align 8, !tbaa !42
  %198 = load ptr, ptr %20, align 8, !tbaa !5
  %199 = getelementptr inbounds i8, ptr %198, i64 4
  store ptr %199, ptr %20, align 8, !tbaa !5
  %200 = load ptr, ptr %20, align 8, !tbaa !5
  %201 = load i32, ptr %200, align 4, !tbaa !9
  %202 = load ptr, ptr %21, align 8, !tbaa !5
  %203 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %202, i32 0, i32 8
  store i32 %201, ptr %203, align 4, !tbaa !43
  %204 = load ptr, ptr %20, align 8, !tbaa !5
  %205 = getelementptr inbounds i8, ptr %204, i64 4
  store ptr %205, ptr %20, align 8, !tbaa !5
  %206 = load ptr, ptr %21, align 8, !tbaa !5
  %207 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %206, i32 1
  store ptr %207, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %208

208:                                              ; preds = %147
  %209 = load i32, ptr %22, align 4, !tbaa !9
  %210 = add i32 %209, 1
  store i32 %210, ptr %22, align 4, !tbaa !9
  br label %140, !llvm.loop !44

211:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 96, ptr %24) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  %212 = load ptr, ptr %7, align 8, !tbaa !5
  %213 = call noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8) %212)
  store i32 %213, ptr %25, align 4, !tbaa !9
  %214 = load ptr, ptr %7, align 8, !tbaa !5
  %215 = getelementptr inbounds [12 x %"struct.rw::d3d9::VertexElement"], ptr %24, i64 0, i64 0
  %216 = load i32, ptr %25, align 4, !tbaa !9
  %217 = mul i32 %216, 8
  %218 = load ptr, ptr %214, align 8, !tbaa !21
  %219 = getelementptr inbounds ptr, ptr %218, i64 4
  %220 = load ptr, ptr %219, align 8
  %221 = call noundef i32 %220(ptr noundef nonnull align 8 dereferenceable(8) %214, ptr noundef %215, i32 noundef %217)
  %222 = getelementptr inbounds [12 x %"struct.rw::d3d9::VertexElement"], ptr %24, i64 0, i64 0
  %223 = call noundef ptr @_ZN2rw4d3d923createVertexDeclarationEPNS0_13VertexElementE(ptr noundef %222)
  %224 = load ptr, ptr %17, align 8, !tbaa !5
  %225 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %224, i32 0, i32 7
  store ptr %223, ptr %225, align 8, !tbaa !29
  %226 = load ptr, ptr %17, align 8, !tbaa !5
  %227 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %226, i32 0, i32 3
  %228 = load ptr, ptr %227, align 8, !tbaa !26
  %229 = icmp eq ptr %228, null
  br i1 %229, label %230, label %231

230:                                              ; preds = %211
  br label %233

231:                                              ; preds = %211
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.2, i32 noundef 203, ptr noundef @__PRETTY_FUNCTION__._ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii) #7
  unreachable

232:                                              ; No predecessors!
  br label %233

233:                                              ; preds = %232, %230
  %234 = load ptr, ptr %17, align 8, !tbaa !5
  %235 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %234, i32 0, i32 8
  %236 = load i32, ptr %235, align 8, !tbaa !30
  %237 = mul i32 %236, 2
  %238 = call noundef ptr @_ZN2rw3d3d17createIndexBufferEjb(i32 noundef %237, i1 noundef zeroext false)
  %239 = load ptr, ptr %17, align 8, !tbaa !5
  %240 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %239, i32 0, i32 3
  store ptr %238, ptr %240, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  %241 = load ptr, ptr %17, align 8, !tbaa !5
  %242 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %241, i32 0, i32 3
  %243 = load ptr, ptr %242, align 8, !tbaa !26
  %244 = call noundef ptr @_ZN2rw3d3d11lockIndicesEPvjjj(ptr noundef %243, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  store ptr %244, ptr %26, align 8, !tbaa !5
  %245 = load ptr, ptr %7, align 8, !tbaa !5
  %246 = load ptr, ptr %26, align 8, !tbaa !5
  %247 = load ptr, ptr %17, align 8, !tbaa !5
  %248 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %247, i32 0, i32 8
  %249 = load i32, ptr %248, align 8, !tbaa !30
  %250 = mul i32 2, %249
  %251 = load ptr, ptr %245, align 8, !tbaa !21
  %252 = getelementptr inbounds ptr, ptr %251, i64 4
  %253 = load ptr, ptr %252, align 8
  %254 = call noundef i32 %253(ptr noundef nonnull align 8 dereferenceable(8) %245, ptr noundef %246, i32 noundef %250)
  %255 = load ptr, ptr %17, align 8, !tbaa !5
  %256 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %255, i32 0, i32 3
  %257 = load ptr, ptr %256, align 8, !tbaa !26
  call void @_ZN2rw3d3d13unlockIndicesEPv(ptr noundef %257)
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %258 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %258, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #6
  store i32 0, ptr %28, align 4, !tbaa !9
  br label %259

259:                                              ; preds = %353, %233
  %260 = load i32, ptr %28, align 4, !tbaa !9
  %261 = icmp slt i32 %260, 2
  br i1 %261, label %263, label %262

262:                                              ; preds = %259
  store i32 9, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #6
  br label %356

263:                                              ; preds = %259
  %264 = load ptr, ptr %7, align 8, !tbaa !5
  %265 = load ptr, ptr %20, align 8, !tbaa !5
  %266 = load ptr, ptr %264, align 8, !tbaa !21
  %267 = getelementptr inbounds ptr, ptr %266, i64 4
  %268 = load ptr, ptr %267, align 8
  %269 = call noundef i32 %268(ptr noundef nonnull align 8 dereferenceable(8) %264, ptr noundef %265, i32 noundef 16)
  %270 = load ptr, ptr %17, align 8, !tbaa !5
  %271 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %270, i32 0, i32 5
  %272 = load i32, ptr %28, align 4, !tbaa !9
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds [2 x %"struct.rw::d3d9::VertexStream"], ptr %271, i64 0, i64 %273
  store ptr %274, ptr %27, align 8, !tbaa !5
  %275 = load ptr, ptr %20, align 8, !tbaa !5
  %276 = load i32, ptr %275, align 4, !tbaa !9
  %277 = zext i32 %276 to i64
  %278 = inttoptr i64 %277 to ptr
  %279 = load ptr, ptr %27, align 8, !tbaa !5
  %280 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %279, i32 0, i32 0
  store ptr %278, ptr %280, align 8, !tbaa !46
  %281 = load ptr, ptr %20, align 8, !tbaa !5
  %282 = getelementptr inbounds i8, ptr %281, i64 4
  store ptr %282, ptr %20, align 8, !tbaa !5
  %283 = load ptr, ptr %27, align 8, !tbaa !5
  %284 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %283, i32 0, i32 1
  store i32 0, ptr %284, align 8, !tbaa !48
  %285 = load ptr, ptr %20, align 8, !tbaa !5
  %286 = getelementptr inbounds i8, ptr %285, i64 4
  store ptr %286, ptr %20, align 8, !tbaa !5
  %287 = load ptr, ptr %20, align 8, !tbaa !5
  %288 = load i32, ptr %287, align 4, !tbaa !9
  %289 = load ptr, ptr %27, align 8, !tbaa !5
  %290 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %289, i32 0, i32 2
  store i32 %288, ptr %290, align 4, !tbaa !49
  %291 = load ptr, ptr %20, align 8, !tbaa !5
  %292 = getelementptr inbounds i8, ptr %291, i64 4
  store ptr %292, ptr %20, align 8, !tbaa !5
  %293 = load ptr, ptr %20, align 8, !tbaa !5
  %294 = load i16, ptr %293, align 2, !tbaa !50
  %295 = load ptr, ptr %27, align 8, !tbaa !5
  %296 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %295, i32 0, i32 3
  store i16 %294, ptr %296, align 8, !tbaa !51
  %297 = load ptr, ptr %20, align 8, !tbaa !5
  %298 = getelementptr inbounds i8, ptr %297, i64 2
  store ptr %298, ptr %20, align 8, !tbaa !5
  %299 = load ptr, ptr %20, align 8, !tbaa !5
  %300 = getelementptr inbounds i8, ptr %299, i32 1
  store ptr %300, ptr %20, align 8, !tbaa !5
  %301 = load i8, ptr %299, align 1, !tbaa !52
  %302 = load ptr, ptr %27, align 8, !tbaa !5
  %303 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %302, i32 0, i32 4
  store i8 %301, ptr %303, align 2, !tbaa !53
  %304 = load ptr, ptr %20, align 8, !tbaa !5
  %305 = getelementptr inbounds i8, ptr %304, i32 1
  store ptr %305, ptr %20, align 8, !tbaa !5
  %306 = load i8, ptr %304, align 1, !tbaa !52
  %307 = load ptr, ptr %27, align 8, !tbaa !5
  %308 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %307, i32 0, i32 5
  store i8 %306, ptr %308, align 1, !tbaa !54
  %309 = load ptr, ptr %27, align 8, !tbaa !5
  %310 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %309, i32 0, i32 0
  %311 = load ptr, ptr %310, align 8, !tbaa !46
  %312 = icmp eq ptr %311, null
  br i1 %312, label %313, label %314

313:                                              ; preds = %263
  br label %353

314:                                              ; preds = %263
  %315 = load ptr, ptr %27, align 8, !tbaa !5
  %316 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %315, i32 0, i32 0
  %317 = load ptr, ptr %316, align 8, !tbaa !46
  %318 = icmp eq ptr %317, null
  br i1 %318, label %319, label %320

319:                                              ; preds = %314
  br label %322

320:                                              ; preds = %314
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.2, i32 noundef 224, ptr noundef @__PRETTY_FUNCTION__._ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii) #7
  unreachable

321:                                              ; No predecessors!
  br label %322

322:                                              ; preds = %321, %319
  %323 = load ptr, ptr %27, align 8, !tbaa !5
  %324 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %323, i32 0, i32 2
  %325 = load i32, ptr %324, align 4, !tbaa !49
  %326 = load ptr, ptr %17, align 8, !tbaa !5
  %327 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %326, i32 0, i32 9
  %328 = load i32, ptr %327, align 4, !tbaa !31
  %329 = mul i32 %325, %328
  %330 = call noundef ptr @_ZN2rw3d3d18createVertexBufferEjjb(i32 noundef %329, i32 noundef 0, i1 noundef zeroext false)
  %331 = load ptr, ptr %27, align 8, !tbaa !5
  %332 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %331, i32 0, i32 0
  store ptr %330, ptr %332, align 8, !tbaa !46
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #6
  %333 = load ptr, ptr %27, align 8, !tbaa !5
  %334 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %333, i32 0, i32 0
  %335 = load ptr, ptr %334, align 8, !tbaa !46
  %336 = call noundef ptr @_ZN2rw3d3d12lockVerticesEPvjjj(ptr noundef %335, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  store ptr %336, ptr %29, align 8, !tbaa !5
  %337 = load ptr, ptr %7, align 8, !tbaa !5
  %338 = load ptr, ptr %29, align 8, !tbaa !5
  %339 = load ptr, ptr %27, align 8, !tbaa !5
  %340 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %339, i32 0, i32 2
  %341 = load i32, ptr %340, align 4, !tbaa !49
  %342 = load ptr, ptr %17, align 8, !tbaa !5
  %343 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %342, i32 0, i32 9
  %344 = load i32, ptr %343, align 4, !tbaa !31
  %345 = mul i32 %341, %344
  %346 = load ptr, ptr %337, align 8, !tbaa !21
  %347 = getelementptr inbounds ptr, ptr %346, i64 4
  %348 = load ptr, ptr %347, align 8
  %349 = call noundef i32 %348(ptr noundef nonnull align 8 dereferenceable(8) %337, ptr noundef %338, i32 noundef %345)
  %350 = load ptr, ptr %27, align 8, !tbaa !5
  %351 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %350, i32 0, i32 0
  %352 = load ptr, ptr %351, align 8, !tbaa !46
  call void @_ZN2rw3d3d14unlockVerticesEPv(ptr noundef %352)
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #6
  br label %353

353:                                              ; preds = %322, %313
  %354 = load i32, ptr %28, align 4, !tbaa !9
  %355 = add nsw i32 %354, 1
  store i32 %355, ptr %28, align 4, !tbaa !9
  br label %259, !llvm.loop !55

356:                                              ; preds = %262
  %357 = load ptr, ptr %17, align 8, !tbaa !5
  %358 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %357, i32 0, i32 10
  %359 = load ptr, ptr %358, align 8, !tbaa !32
  store ptr %359, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #6
  store i32 0, ptr %30, align 4, !tbaa !9
  br label %360

360:                                              ; preds = %387, %356
  %361 = load i32, ptr %30, align 4, !tbaa !9
  %362 = load ptr, ptr %17, align 8, !tbaa !5
  %363 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %362, i32 0, i32 2
  %364 = load i32, ptr %363, align 8, !tbaa !25
  %365 = icmp ult i32 %361, %364
  br i1 %365, label %367, label %366

366:                                              ; preds = %360
  store i32 12, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #6
  br label %390

367:                                              ; preds = %360
  %368 = load ptr, ptr %21, align 8, !tbaa !5
  %369 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %368, i32 0, i32 1
  %370 = load i32, ptr %369, align 4, !tbaa !35
  %371 = load ptr, ptr %17, align 8, !tbaa !5
  %372 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %371, i32 0, i32 5
  %373 = getelementptr inbounds [2 x %"struct.rw::d3d9::VertexStream"], ptr %372, i64 0, i64 0
  %374 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %373, i32 0, i32 1
  %375 = load i32, ptr %374, align 8, !tbaa !48
  %376 = load ptr, ptr %17, align 8, !tbaa !5
  %377 = getelementptr inbounds %"struct.rw::d3d9::InstanceDataHeader", ptr %376, i32 0, i32 5
  %378 = getelementptr inbounds [2 x %"struct.rw::d3d9::VertexStream"], ptr %377, i64 0, i64 0
  %379 = getelementptr inbounds %"struct.rw::d3d9::VertexStream", ptr %378, i32 0, i32 2
  %380 = load i32, ptr %379, align 4, !tbaa !49
  %381 = udiv i32 %375, %380
  %382 = add i32 %370, %381
  %383 = load ptr, ptr %21, align 8, !tbaa !5
  %384 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %383, i32 0, i32 5
  store i32 %382, ptr %384, align 8, !tbaa !40
  %385 = load ptr, ptr %21, align 8, !tbaa !5
  %386 = getelementptr inbounds %"struct.rw::d3d9::InstanceData", ptr %385, i32 1
  store ptr %386, ptr %21, align 8, !tbaa !5
  br label %387

387:                                              ; preds = %367
  %388 = load i32, ptr %30, align 4, !tbaa !9
  %389 = add i32 %388, 1
  store i32 %389, ptr %30, align 4, !tbaa !9
  br label %360, !llvm.loop !56

390:                                              ; preds = %366
  %391 = load ptr, ptr getelementptr inbounds (%"struct.rw::MemoryFunctions", ptr @_ZN2rw6Engine8memfuncsE, i32 0, i32 2), align 8, !tbaa !57
  %392 = load ptr, ptr %19, align 8, !tbaa !5
  call void %391(ptr noundef %392)
  %393 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %393, ptr %6, align 8
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 96, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %394

394:                                              ; preds = %390, %61, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %395 = load ptr, ptr %6, align 8
  ret ptr %395
}

declare noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

declare noundef ptr @_ZN2rw9dbgsprintEjz(i32 noundef, ...) #3

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) #3

declare noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8)) #3

declare noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

declare noundef ptr @_ZN2rw3d3d17createIndexBufferEjb(i32 noundef, i1 noundef zeroext) #3

declare noundef ptr @_ZN2rw3d3d11lockIndicesEPvjjj(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #3

declare void @_ZN2rw3d3d13unlockIndicesEPv(ptr noundef) #3

declare noundef ptr @_ZN2rw3d3d18createVertexBufferEjjb(i32 noundef, i32 noundef, i1 noundef zeroext) #3

declare noundef ptr @_ZN2rw3d3d12lockVerticesEPvjjj(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #3

declare void @_ZN2rw3d3d14unlockVerticesEPv(ptr noundef) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 #5 = { noreturn 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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN2rw5ErrorE", !10, i64 0, !10, i64 4}
!13 = !{!12, !10, i64 4}
!14 = !{!15, !6, i64 152}
!15 = !{!"_ZTSN2rw8GeometryE", !16, i64 0, !10, i64 16, !17, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !18, i64 128, !6, i64 144, !6, i64 152, !10, i64 160}
!16 = !{!"_ZTSN2rw6ObjectE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !6, i64 8}
!17 = !{!"short", !7, i64 0}
!18 = !{!"_ZTSN2rw12MaterialListE", !6, i64 0, !10, i64 8, !10, i64 12}
!19 = !{!20, !10, i64 0}
!20 = !{!"_ZTSN2rw18InstanceDataHeaderE", !10, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"vtable pointer", !8, i64 0}
!23 = !{!24, !10, i64 4}
!24 = !{!"_ZTSN2rw4d3d918InstanceDataHeaderE", !20, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !10, i64 24, !7, i64 32, !10, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !6, i64 104}
!25 = !{!24, !10, i64 8}
!26 = !{!24, !6, i64 16}
!27 = !{!24, !10, i64 24}
!28 = !{!24, !10, i64 80}
!29 = !{!24, !6, i64 88}
!30 = !{!24, !10, i64 96}
!31 = !{!24, !10, i64 100}
!32 = !{!24, !6, i64 104}
!33 = !{!34, !10, i64 0}
!34 = !{!"_ZTSN2rw4d3d912InstanceDataE", !10, i64 0, !10, i64 4, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44}
!35 = !{!34, !10, i64 4}
!36 = !{!15, !6, i64 128}
!37 = !{!34, !6, i64 8}
!38 = !{!34, !10, i64 16}
!39 = !{!34, !6, i64 24}
!40 = !{!34, !10, i64 32}
!41 = !{!34, !10, i64 36}
!42 = !{!34, !10, i64 40}
!43 = !{!34, !10, i64 44}
!44 = distinct !{!44, !45}
!45 = !{!"llvm.loop.mustprogress"}
!46 = !{!47, !6, i64 0}
!47 = !{!"_ZTSN2rw4d3d912VertexStreamE", !6, i64 0, !10, i64 8, !10, i64 12, !17, i64 16, !7, i64 18, !7, i64 19}
!48 = !{!47, !10, i64 8}
!49 = !{!47, !10, i64 12}
!50 = !{!17, !17, i64 0}
!51 = !{!47, !17, i64 16}
!52 = !{!7, !7, i64 0}
!53 = !{!47, !7, i64 18}
!54 = !{!47, !7, i64 19}
!55 = distinct !{!55, !45}
!56 = distinct !{!56, !45}
!57 = !{!58, !6, i64 16}
!58 = !{!"_ZTSN2rw15MemoryFunctionsE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}


; 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::Error" = type { i32, i32 }
%"struct.rw::d3d9::VertexElement" = type { i16, i16, i8, i8, i8, i8 }

@_ZN2rw6Engine8memfuncsE = external local_unnamed_addr global %"struct.rw::MemoryFunctions", align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii = external hidden unnamed_addr constant [72 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw4d3d923createVertexDeclarationEPNS0_13VertexElementE(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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; 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 uwtable
define dso_local noundef ptr @_ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii(ptr noundef %0, i32 noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca %"struct.rw::Error", align 4
  %7 = alloca %"struct.rw::Error", align 4
  %8 = alloca [12 x %"struct.rw::d3d9::VertexElement"], align 16
  %9 = tail call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %0, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %9, label %17, label %10

10:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i32 2, ptr %6, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %6, i64 4
  store i32 -2147483644, ptr %11, align 4, !tbaa !10
  %12 = load ptr, ptr @stderr, align 8, !tbaa !11
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 156) #7
  %14 = load ptr, ptr @stderr, align 8, !tbaa !11
  %15 = tail call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.4)
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.3, ptr noundef %15) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %192

17:                                               ; preds = %5
  %18 = tail call noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %.not = icmp eq i32 %18, 9
  br i1 %.not, label %26, label %19

19:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  store i32 2, ptr %7, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 -2147483642, ptr %20, align 4, !tbaa !10
  %21 = load ptr, ptr @stderr, align 8, !tbaa !11
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 161) #7
  %23 = load ptr, ptr @stderr, align 8, !tbaa !11
  %24 = tail call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483642, i32 noundef %18)
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.3, ptr noundef %24) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %192

26:                                               ; preds = %17
  %27 = tail call noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef 112, i32 noundef 196623, ptr noundef nonnull @.str.5)
  %28 = getelementptr inbounds i8, ptr %2, i64 152
  store ptr %27, ptr %28, align 8, !tbaa !13
  store i32 9, ptr %27, align 8, !tbaa !18
  %29 = tail call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %30 = sext i32 %29 to i64
  %31 = tail call noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef %30, i32 noundef 65551, ptr noundef nonnull @.str.6)
  %32 = load ptr, ptr %0, align 8, !tbaa !20
  %33 = getelementptr inbounds i8, ptr %32, i64 32
  %34 = load ptr, ptr %33, align 8
  %35 = tail call noundef i32 %34(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %31, i32 noundef %29)
  %36 = load i32, ptr %31, align 4, !tbaa !22
  %37 = getelementptr inbounds i8, ptr %27, i64 4
  store i32 %36, ptr %37, align 4, !tbaa !23
  %38 = getelementptr inbounds i8, ptr %31, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !22
  %40 = getelementptr inbounds i8, ptr %27, i64 8
  store i32 %39, ptr %40, align 8, !tbaa !25
  %41 = getelementptr inbounds i8, ptr %27, i64 16
  store ptr null, ptr %41, align 8, !tbaa !26
  %42 = getelementptr inbounds i8, ptr %31, i64 12
  %43 = load i32, ptr %42, align 4, !tbaa !22
  %44 = getelementptr inbounds i8, ptr %27, i64 24
  store i32 %43, ptr %44, align 8, !tbaa !27
  %45 = getelementptr inbounds i8, ptr %31, i64 48
  %46 = load i32, ptr %45, align 4, !tbaa !22
  %47 = getelementptr inbounds i8, ptr %27, i64 80
  store i32 %46, ptr %47, align 8, !tbaa !28
  %48 = getelementptr inbounds i8, ptr %27, i64 88
  store ptr null, ptr %48, align 8, !tbaa !29
  %49 = getelementptr inbounds i8, ptr %31, i64 56
  %50 = load i32, ptr %49, align 4, !tbaa !22
  %51 = getelementptr inbounds i8, ptr %27, i64 96
  store i32 %50, ptr %51, align 8, !tbaa !30
  %52 = getelementptr inbounds i8, ptr %31, i64 60
  %53 = load i32, ptr %52, align 4, !tbaa !22
  %54 = getelementptr inbounds i8, ptr %27, i64 100
  store i32 %53, ptr %54, align 4, !tbaa !31
  %55 = zext i32 %39 to i64
  %56 = mul nuw nsw i64 %55, 48
  %57 = tail call noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef %56, i32 noundef 196623, ptr noundef nonnull @.str.7)
  %58 = getelementptr inbounds i8, ptr %27, i64 104
  store ptr %57, ptr %58, align 8, !tbaa !32
  %59 = load i32, ptr %40, align 8, !tbaa !25
  %.not144 = icmp eq i32 %59, 0
  br i1 %.not144, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %26
  %60 = getelementptr inbounds i8, ptr %31, i64 64
  %61 = getelementptr inbounds i8, ptr %2, i64 128
  %62 = load ptr, ptr %61, align 8, !tbaa !33
  br label %72

._crit_edge:                                      ; preds = %72, %26
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %8) #6
  %63 = tail call noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %64 = shl i32 %63, 3
  %65 = load ptr, ptr %0, align 8, !tbaa !20
  %66 = getelementptr inbounds i8, ptr %65, i64 32
  %67 = load ptr, ptr %66, align 8
  %68 = call noundef i32 %67(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %8, i32 noundef %64)
  %69 = call noundef ptr @_ZN2rw4d3d923createVertexDeclarationEPNS0_13VertexElementE(ptr noundef nonnull %8)
  store ptr %69, ptr %48, align 8, !tbaa !29
  %70 = load ptr, ptr %41, align 8, !tbaa !26
  %71 = icmp eq ptr %70, null
  br i1 %71, label %101, label %100

72:                                               ; preds = %.lr.ph, %72
  %.0129136 = phi ptr [ %60, %.lr.ph ], [ %97, %72 ]
  %.0130135 = phi ptr [ %57, %.lr.ph ], [ %98, %72 ]
  %.0132134 = phi i32 [ 0, %.lr.ph ], [ %99, %72 ]
  %73 = load i32, ptr %.0129136, align 4, !tbaa !22
  store i32 %73, ptr %.0130135, align 8, !tbaa !34
  %74 = getelementptr inbounds i8, ptr %.0129136, i64 4
  %75 = load i32, ptr %74, align 4, !tbaa !22
  %76 = getelementptr inbounds i8, ptr %.0130135, i64 4
  store i32 %75, ptr %76, align 4, !tbaa !36
  %77 = getelementptr inbounds i8, ptr %.0129136, i64 8
  %78 = load i32, ptr %77, align 4, !tbaa !22
  %79 = getelementptr inbounds i8, ptr %.0129136, i64 12
  %80 = zext i32 %78 to i64
  %81 = getelementptr inbounds ptr, ptr %62, i64 %80
  %82 = load ptr, ptr %81, align 8, !tbaa !11
  %83 = getelementptr inbounds i8, ptr %.0130135, i64 8
  store ptr %82, ptr %83, align 8, !tbaa !37
  %84 = load i32, ptr %79, align 4, !tbaa !22
  %85 = getelementptr inbounds i8, ptr %.0130135, i64 16
  store i32 %84, ptr %85, align 8, !tbaa !38
  %86 = getelementptr inbounds i8, ptr %.0130135, i64 24
  store ptr null, ptr %86, align 8, !tbaa !39
  %87 = getelementptr inbounds i8, ptr %.0130135, i64 32
  store i32 0, ptr %87, align 8, !tbaa !40
  %88 = getelementptr inbounds i8, ptr %.0129136, i64 24
  %89 = load i32, ptr %88, align 4, !tbaa !22
  %90 = getelementptr inbounds i8, ptr %.0130135, i64 36
  store i32 %89, ptr %90, align 4, !tbaa !41
  %91 = getelementptr inbounds i8, ptr %.0129136, i64 28
  %92 = load i32, ptr %91, align 4, !tbaa !22
  %93 = getelementptr inbounds i8, ptr %.0130135, i64 40
  store i32 %92, ptr %93, align 8, !tbaa !42
  %94 = getelementptr inbounds i8, ptr %.0129136, i64 32
  %95 = load i32, ptr %94, align 4, !tbaa !22
  %96 = getelementptr inbounds i8, ptr %.0130135, i64 44
  store i32 %95, ptr %96, align 4, !tbaa !43
  %97 = getelementptr inbounds i8, ptr %.0129136, i64 36
  %98 = getelementptr inbounds i8, ptr %.0130135, i64 48
  %99 = add nuw i32 %.0132134, 1
  %exitcond.not = icmp eq i32 %99, %59
  br i1 %exitcond.not, label %._crit_edge, label %72, !llvm.loop !44

100:                                              ; preds = %._crit_edge
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2, i32 noundef 203, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii) #8
  unreachable

101:                                              ; preds = %._crit_edge
  %102 = load i32, ptr %51, align 8, !tbaa !30
  %103 = shl i32 %102, 1
  %104 = call noundef ptr @_ZN2rw3d3d17createIndexBufferEjb(i32 noundef %103, i1 noundef zeroext false)
  store ptr %104, ptr %41, align 8, !tbaa !26
  %105 = call noundef ptr @_ZN2rw3d3d11lockIndicesEPvjjj(ptr noundef %104, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  %106 = load i32, ptr %51, align 8, !tbaa !30
  %107 = shl i32 %106, 1
  %108 = load ptr, ptr %0, align 8, !tbaa !20
  %109 = getelementptr inbounds i8, ptr %108, i64 32
  %110 = load ptr, ptr %109, align 8
  %111 = call noundef i32 %110(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %105, i32 noundef %107)
  %112 = load ptr, ptr %41, align 8, !tbaa !26
  call void @_ZN2rw3d3d13unlockIndicesEPv(ptr noundef %112)
  %113 = getelementptr inbounds i8, ptr %27, i64 32
  %114 = load ptr, ptr %0, align 8, !tbaa !20
  %115 = getelementptr inbounds i8, ptr %114, i64 32
  %116 = load ptr, ptr %115, align 8
  %117 = call noundef i32 %116(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %31, i32 noundef 16)
  %118 = load i32, ptr %31, align 4, !tbaa !22
  %119 = zext i32 %118 to i64
  %120 = inttoptr i64 %119 to ptr
  store ptr %120, ptr %113, align 8, !tbaa !46
  %121 = getelementptr inbounds i8, ptr %27, i64 40
  store i32 0, ptr %121, align 8, !tbaa !48
  %122 = getelementptr inbounds i8, ptr %31, i64 8
  %123 = load i32, ptr %122, align 4, !tbaa !22
  %124 = getelementptr inbounds i8, ptr %27, i64 44
  store i32 %123, ptr %124, align 4, !tbaa !49
  %125 = load i16, ptr %42, align 2, !tbaa !50
  %126 = getelementptr inbounds i8, ptr %27, i64 48
  store i16 %125, ptr %126, align 8, !tbaa !51
  %127 = getelementptr inbounds i8, ptr %31, i64 14
  %128 = getelementptr inbounds i8, ptr %31, i64 15
  %129 = load i8, ptr %127, align 1, !tbaa !52
  %130 = getelementptr inbounds i8, ptr %27, i64 50
  store i8 %129, ptr %130, align 2, !tbaa !53
  %131 = load i8, ptr %128, align 1, !tbaa !52
  %132 = getelementptr inbounds i8, ptr %27, i64 51
  store i8 %131, ptr %132, align 1, !tbaa !54
  %133 = icmp eq i32 %118, 0
  br i1 %133, label %142, label %141

.lr.ph142:                                        ; preds = %166
  %134 = load ptr, ptr %58, align 8, !tbaa !32
  %135 = getelementptr inbounds i8, ptr %27, i64 40
  %136 = load i32, ptr %135, align 8, !tbaa !48
  %137 = getelementptr inbounds i8, ptr %27, i64 44
  %138 = load i32, ptr %137, align 4, !tbaa !49
  %139 = udiv i32 %136, %138
  %xtraiter = and i32 %167, 3
  %140 = icmp ult i32 %167, 4
  br i1 %140, label %._crit_edge143.loopexit.unr-lcssa, label %.lr.ph142.new

.lr.ph142.new:                                    ; preds = %.lr.ph142
  %unroll_iter = and i32 %167, -4
  br label %174

141:                                              ; preds = %142, %101
  call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.2, i32 noundef 224, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw4d3d914readNativeDataEPNS_6StreamEiPvii) #8
  unreachable

142:                                              ; preds = %101
  %143 = getelementptr inbounds i8, ptr %31, i64 16
  %144 = load ptr, ptr %0, align 8, !tbaa !20
  %145 = getelementptr inbounds i8, ptr %144, i64 32
  %146 = load ptr, ptr %145, align 8
  %147 = call noundef i32 %146(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %143, i32 noundef 16)
  %148 = getelementptr inbounds i8, ptr %27, i64 56
  %149 = load i32, ptr %143, align 4, !tbaa !22
  %150 = zext i32 %149 to i64
  %151 = inttoptr i64 %150 to ptr
  store ptr %151, ptr %148, align 8, !tbaa !46
  %152 = getelementptr inbounds i8, ptr %27, i64 64
  store i32 0, ptr %152, align 8, !tbaa !48
  %153 = getelementptr inbounds i8, ptr %31, i64 24
  %154 = load i32, ptr %153, align 4, !tbaa !22
  %155 = getelementptr inbounds i8, ptr %27, i64 68
  store i32 %154, ptr %155, align 4, !tbaa !49
  %156 = getelementptr inbounds i8, ptr %31, i64 28
  %157 = load i16, ptr %156, align 2, !tbaa !50
  %158 = getelementptr inbounds i8, ptr %27, i64 72
  store i16 %157, ptr %158, align 8, !tbaa !51
  %159 = getelementptr inbounds i8, ptr %31, i64 30
  %160 = getelementptr inbounds i8, ptr %31, i64 31
  %161 = load i8, ptr %159, align 1, !tbaa !52
  %162 = getelementptr inbounds i8, ptr %27, i64 74
  store i8 %161, ptr %162, align 2, !tbaa !53
  %163 = load i8, ptr %160, align 1, !tbaa !52
  %164 = getelementptr inbounds i8, ptr %27, i64 75
  store i8 %163, ptr %164, align 1, !tbaa !54
  %165 = icmp eq i32 %149, 0
  br i1 %165, label %166, label %141

166:                                              ; preds = %142
  %167 = load i32, ptr %40, align 8, !tbaa !25
  %.not145 = icmp eq i32 %167, 0
  br i1 %.not145, label %._crit_edge143, label %.lr.ph142

._crit_edge143.loopexit.unr-lcssa:                ; preds = %174, %.lr.ph142
  %.1131139.unr = phi ptr [ %134, %.lr.ph142 ], [ %191, %174 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge143, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge143.loopexit.unr-lcssa, %.epil.preheader
  %.1131139.epil = phi ptr [ %172, %.epil.preheader ], [ %.1131139.unr, %._crit_edge143.loopexit.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge143.loopexit.unr-lcssa ]
  %168 = getelementptr inbounds i8, ptr %.1131139.epil, i64 4
  %169 = load i32, ptr %168, align 4, !tbaa !36
  %170 = add i32 %139, %169
  %171 = getelementptr inbounds i8, ptr %.1131139.epil, i64 32
  store i32 %170, ptr %171, align 8, !tbaa !40
  %172 = getelementptr inbounds i8, ptr %.1131139.epil, i64 48
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge143, label %.epil.preheader, !llvm.loop !55

._crit_edge143:                                   ; preds = %._crit_edge143.loopexit.unr-lcssa, %.epil.preheader, %166
  %173 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN2rw6Engine8memfuncsE, i64 16), align 8, !tbaa !57
  call void %173(ptr noundef nonnull %31)
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %8) #6
  br label %192

174:                                              ; preds = %174, %.lr.ph142.new
  %.1131139 = phi ptr [ %134, %.lr.ph142.new ], [ %191, %174 ]
  %niter = phi i32 [ 0, %.lr.ph142.new ], [ %niter.next.3, %174 ]
  %175 = getelementptr inbounds i8, ptr %.1131139, i64 4
  %176 = load i32, ptr %175, align 4, !tbaa !36
  %177 = add i32 %139, %176
  %178 = getelementptr inbounds i8, ptr %.1131139, i64 32
  store i32 %177, ptr %178, align 8, !tbaa !40
  %179 = getelementptr inbounds i8, ptr %.1131139, i64 52
  %180 = load i32, ptr %179, align 4, !tbaa !36
  %181 = add i32 %139, %180
  %182 = getelementptr inbounds i8, ptr %.1131139, i64 80
  store i32 %181, ptr %182, align 8, !tbaa !40
  %183 = getelementptr inbounds i8, ptr %.1131139, i64 100
  %184 = load i32, ptr %183, align 4, !tbaa !36
  %185 = add i32 %139, %184
  %186 = getelementptr inbounds i8, ptr %.1131139, i64 128
  store i32 %185, ptr %186, align 8, !tbaa !40
  %187 = getelementptr inbounds i8, ptr %.1131139, i64 148
  %188 = load i32, ptr %187, align 4, !tbaa !36
  %189 = add i32 %139, %188
  %190 = getelementptr inbounds i8, ptr %.1131139, i64 176
  store i32 %189, ptr %190, align 8, !tbaa !40
  %191 = getelementptr inbounds i8, ptr %.1131139, i64 192
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge143.loopexit.unr-lcssa, label %174, !llvm.loop !59

192:                                              ; preds = %._crit_edge143, %19, %10
  %.0127 = phi ptr [ null, %19 ], [ %0, %._crit_edge143 ], [ null, %10 ]
  ret ptr %.0127
}

declare noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

declare noundef ptr @_ZN2rw9dbgsprintEjz(i32 noundef, ...) local_unnamed_addr #3

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) local_unnamed_addr #3

declare noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

declare noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

declare noundef ptr @_ZN2rw3d3d17createIndexBufferEjb(i32 noundef, i1 noundef zeroext) local_unnamed_addr #3

declare noundef ptr @_ZN2rw3d3d11lockIndicesEPvjjj(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @_ZN2rw3d3d13unlockIndicesEPv(ptr noundef) local_unnamed_addr #3

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { nofree 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 #5 = { noreturn 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 #6 = { nounwind }
attributes #7 = { cold nounwind }
attributes #8 = { noreturn 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 = !{!"_ZTSN2rw5ErrorE", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!14, !12, i64 152}
!14 = !{!"_ZTSN2rw8GeometryE", !15, i64 0, !7, i64 16, !16, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !12, i64 40, !12, i64 48, !8, i64 56, !12, i64 120, !17, i64 128, !12, i64 144, !12, i64 152, !7, i64 160}
!15 = !{!"_ZTSN2rw6ObjectE", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !12, i64 8}
!16 = !{!"short", !8, i64 0}
!17 = !{!"_ZTSN2rw12MaterialListE", !12, i64 0, !7, i64 8, !7, i64 12}
!18 = !{!19, !7, i64 0}
!19 = !{!"_ZTSN2rw18InstanceDataHeaderE", !7, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"vtable pointer", !9, i64 0}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !7, i64 4}
!24 = !{!"_ZTSN2rw4d3d918InstanceDataHeaderE", !19, i64 0, !7, i64 4, !7, i64 8, !12, i64 16, !7, i64 24, !8, i64 32, !7, i64 80, !12, i64 88, !7, i64 96, !7, i64 100, !12, i64 104}
!25 = !{!24, !7, i64 8}
!26 = !{!24, !12, i64 16}
!27 = !{!24, !7, i64 24}
!28 = !{!24, !7, i64 80}
!29 = !{!24, !12, i64 88}
!30 = !{!24, !7, i64 96}
!31 = !{!24, !7, i64 100}
!32 = !{!24, !12, i64 104}
!33 = !{!14, !12, i64 128}
!34 = !{!35, !7, i64 0}
!35 = !{!"_ZTSN2rw4d3d912InstanceDataE", !7, i64 0, !7, i64 4, !12, i64 8, !7, i64 16, !12, i64 24, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44}
!36 = !{!35, !7, i64 4}
!37 = !{!35, !12, i64 8}
!38 = !{!35, !7, i64 16}
!39 = !{!35, !12, i64 24}
!40 = !{!35, !7, i64 32}
!41 = !{!35, !7, i64 36}
!42 = !{!35, !7, i64 40}
!43 = !{!35, !7, i64 44}
!44 = distinct !{!44, !45}
!45 = !{!"llvm.loop.mustprogress"}
!46 = !{!47, !12, i64 0}
!47 = !{!"_ZTSN2rw4d3d912VertexStreamE", !12, i64 0, !7, i64 8, !7, i64 12, !16, i64 16, !8, i64 18, !8, i64 19}
!48 = !{!47, !7, i64 8}
!49 = !{!47, !7, i64 12}
!50 = !{!16, !16, i64 0}
!51 = !{!47, !16, i64 16}
!52 = !{!8, !8, i64 0}
!53 = !{!47, !8, i64 18}
!54 = !{!47, !8, i64 19}
!55 = distinct !{!55, !56}
!56 = !{!"llvm.loop.unroll.disable"}
!57 = !{!58, !12, i64 16}
!58 = !{!"_ZTSN2rw15MemoryFunctionsE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!59 = distinct !{!59, !45}


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