; LLVM IR from aap/librw :: src/d3d/d3d8.ll (ZN2rw4d3d817defaultInstanceCBEPNS_8GeometryEPNS0_12InstanceDataE)

; 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::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::d3d8::InstanceData" = type { i32, i32, i32, i32, ptr, i32, i32, ptr, ptr, i32, i8, i8, i8 }
%"struct.rw::MorphTarget" = type { ptr, %"struct.rw::Sphere", ptr, ptr }
%"struct.rw::Sphere" = type { %"struct.rw::V3d", float }
%"struct.rw::V3d" = type { float, float, float }
%"struct.rw::RGBA" = type { i8, i8, i8, i8 }
%"struct.rw::TexCoords" = type { float, float }

@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw4d3d817defaultInstanceCBEPNS_8GeometryEPNS0_12InstanceDataE = external hidden unnamed_addr constant [61 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN2rw4d3d818makeFVFDeclarationEji(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN2rw4d3d89getStrideEji(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw4d3d817defaultInstanceCBEPNS_8GeometryEPNS0_12InstanceDataE(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %"struct.rw::Geometry", ptr %7, i32 0, i32 1
  %9 = load i32, ptr %8, align 8, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.rw::Geometry", ptr %10, i32 0, i32 6
  %12 = load i32, ptr %11, align 4, !tbaa !15
  %13 = call noundef i32 @_ZN2rw4d3d818makeFVFDeclarationEji(i32 noundef %9, i32 noundef %12)
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %14, i32 0, i32 5
  store i32 %13, ptr %15, align 8, !tbaa !16
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.rw::Geometry", ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.rw::Geometry", ptr %19, i32 0, i32 6
  %21 = load i32, ptr %20, align 4, !tbaa !15
  %22 = call noundef i32 @_ZN2rw4d3d89getStrideEji(i32 noundef %18, i32 noundef %21)
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %23, i32 0, i32 1
  store i32 %22, ptr %24, align 4, !tbaa !18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %25, i32 0, i32 8
  %27 = load ptr, ptr %26, align 8, !tbaa !19
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %30

29:                                               ; preds = %2
  br label %32

30:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 373, ptr noundef @__PRETTY_FUNCTION__._ZN2rw4d3d817defaultInstanceCBEPNS_8GeometryEPNS0_12InstanceDataE) #5
  unreachable

31:                                               ; No predecessors!
  br label %32

32:                                               ; preds = %31, %29
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %33, i32 0, i32 2
  %35 = load i32, ptr %34, align 8, !tbaa !20
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %36, i32 0, i32 1
  %38 = load i32, ptr %37, align 4, !tbaa !18
  %39 = mul nsw i32 %35, %38
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %40, i32 0, i32 5
  %42 = load i32, ptr %41, align 8, !tbaa !16
  %43 = call noundef ptr @_ZN2rw3d3d18createVertexBufferEjjb(i32 noundef %39, i32 noundef %42, i1 noundef zeroext false)
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %44, i32 0, i32 8
  store ptr %43, ptr %45, align 8, !tbaa !19
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %46, i32 0, i32 11
  store i8 1, ptr %47, align 1, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %48, i32 0, i32 8
  %50 = load ptr, ptr %49, align 8, !tbaa !19
  %51 = call noundef ptr @_ZN2rw3d3d12lockVerticesEPvjjj(ptr noundef %50, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  store ptr %51, ptr %5, align 8, !tbaa !5
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.rw::Geometry", ptr %53, i32 0, i32 10
  %55 = load ptr, ptr %54, align 8, !tbaa !22
  %56 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %55, i64 0
  %57 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !23
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %59, i32 0, i32 0
  %61 = load i32, ptr %60, align 8, !tbaa !28
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds %"struct.rw::V3d", ptr %58, i64 %62
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %64, i32 0, i32 2
  %66 = load i32, ptr %65, align 8, !tbaa !20
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 4, !tbaa !18
  call void @_ZN2rw7instV3dEiPhPNS_3V3dEjj(i32 noundef 8, ptr noundef %52, ptr noundef %63, i32 noundef %66, i32 noundef %69)
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %70, i64 12
  store ptr %71, ptr %5, align 8, !tbaa !5
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.rw::Geometry", ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 8, !tbaa !9
  %75 = and i32 %74, 16
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %98

77:                                               ; preds = %32
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.rw::Geometry", ptr %79, i32 0, i32 10
  %81 = load ptr, ptr %80, align 8, !tbaa !22
  %82 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %81, i64 0
  %83 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %82, i32 0, i32 3
  %84 = load ptr, ptr %83, align 8, !tbaa !29
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %85, i32 0, i32 0
  %87 = load i32, ptr %86, align 8, !tbaa !28
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds %"struct.rw::V3d", ptr %84, i64 %88
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 8, !tbaa !20
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %93, i32 0, i32 1
  %95 = load i32, ptr %94, align 4, !tbaa !18
  call void @_ZN2rw7instV3dEiPhPNS_3V3dEjj(i32 noundef 8, ptr noundef %78, ptr noundef %89, i32 noundef %92, i32 noundef %95)
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds i8, ptr %96, i64 12
  store ptr %97, ptr %5, align 8, !tbaa !5
  br label %98

98:                                               ; preds = %77, %32
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %99, i32 0, i32 10
  store i8 0, ptr %100, align 4, !tbaa !30
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.rw::Geometry", ptr %101, i32 0, i32 1
  %103 = load i32, ptr %102, align 8, !tbaa !9
  %104 = and i32 %103, 8
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %128

106:                                              ; preds = %98
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %"struct.rw::Geometry", ptr %108, i32 0, i32 8
  %110 = load ptr, ptr %109, align 8, !tbaa !31
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 8, !tbaa !28
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds %"struct.rw::RGBA", ptr %110, i64 %114
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %116, i32 0, i32 2
  %118 = load i32, ptr %117, align 8, !tbaa !20
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %119, i32 0, i32 1
  %121 = load i32, ptr %120, align 4, !tbaa !18
  %122 = call noundef i32 @_ZN2rw9instColorEiPhPNS_4RGBAEjj(i32 noundef 10, ptr noundef %107, ptr noundef %115, i32 noundef %118, i32 noundef %121)
  %123 = trunc i32 %122 to i8
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %124, i32 0, i32 10
  store i8 %123, ptr %125, align 4, !tbaa !30
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = getelementptr inbounds i8, ptr %126, i64 4
  store ptr %127, ptr %5, align 8, !tbaa !5
  br label %128

128:                                              ; preds = %106, %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !32
  br label %129

129:                                              ; preds = %157, %128
  %130 = load i32, ptr %6, align 4, !tbaa !32
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %"struct.rw::Geometry", ptr %131, i32 0, i32 6
  %133 = load i32, ptr %132, align 4, !tbaa !15
  %134 = icmp slt i32 %130, %133
  br i1 %134, label %136, label %135

135:                                              ; preds = %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %160

136:                                              ; preds = %129
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  %139 = getelementptr inbounds %"struct.rw::Geometry", ptr %138, i32 0, i32 9
  %140 = load i32, ptr %6, align 4, !tbaa !32
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [8 x ptr], ptr %139, i64 0, i64 %141
  %143 = load ptr, ptr %142, align 8, !tbaa !5
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %144, i32 0, i32 0
  %146 = load i32, ptr %145, align 8, !tbaa !28
  %147 = zext i32 %146 to i64
  %148 = getelementptr inbounds %"struct.rw::TexCoords", ptr %143, i64 %147
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %149, i32 0, i32 2
  %151 = load i32, ptr %150, align 8, !tbaa !20
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %152, i32 0, i32 1
  %154 = load i32, ptr %153, align 4, !tbaa !18
  call void @_ZN2rw13instTexCoordsEiPhPNS_9TexCoordsEjj(i32 noundef 7, ptr noundef %137, ptr noundef %148, i32 noundef %151, i32 noundef %154)
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds i8, ptr %155, i64 8
  store ptr %156, ptr %5, align 8, !tbaa !5
  br label %157

157:                                              ; preds = %136
  %158 = load i32, ptr %6, align 4, !tbaa !32
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %6, align 4, !tbaa !32
  br label %129, !llvm.loop !33

160:                                              ; preds = %135
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %"struct.rw::d3d8::InstanceData", ptr %161, i32 0, i32 8
  %163 = load ptr, ptr %162, align 8, !tbaa !19
  call void @_ZN2rw3d3d14unlockVerticesEPv(ptr noundef %163)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void
}

declare void @_ZN2rw7instV3dEiPhPNS_3V3dEjj(i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

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

declare void @_ZN2rw13instTexCoordsEiPhPNS_9TexCoordsEjj(i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { noreturn nounwind }
attributes #6 = { 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, !12, i64 16}
!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 = !{!10, !12, i64 36}
!16 = !{!17, !12, i64 24}
!17 = !{!"_ZTSN2rw4d3d812InstanceDataE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !6, i64 16, !12, i64 24, !12, i64 28, !6, i64 32, !6, i64 40, !12, i64 48, !7, i64 52, !7, i64 53, !7, i64 54}
!18 = !{!17, !12, i64 4}
!19 = !{!17, !6, i64 40}
!20 = !{!17, !12, i64 8}
!21 = !{!17, !7, i64 53}
!22 = !{!10, !6, i64 120}
!23 = !{!24, !6, i64 24}
!24 = !{!"_ZTSN2rw11MorphTargetE", !6, i64 0, !25, i64 8, !6, i64 24, !6, i64 32}
!25 = !{!"_ZTSN2rw6SphereE", !26, i64 0, !27, i64 12}
!26 = !{!"_ZTSN2rw3V3dE", !27, i64 0, !27, i64 4, !27, i64 8}
!27 = !{!"float", !7, i64 0}
!28 = !{!17, !12, i64 0}
!29 = !{!24, !6, i64 32}
!30 = !{!17, !7, i64 52}
!31 = !{!10, !6, i64 48}
!32 = !{!12, !12, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}


; 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::V3d" = type { float, float, float }
%"struct.rw::RGBA" = type { i8, i8, i8, i8 }
%"struct.rw::TexCoords" = type { float, float }

@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw4d3d817defaultInstanceCBEPNS_8GeometryEPNS0_12InstanceDataE = external hidden unnamed_addr constant [61 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN2rw4d3d818makeFVFDeclarationEji(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN2rw4d3d89getStrideEji(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

declare noundef ptr @_ZN2rw3d3d12lockVerticesEPvjjj(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @_ZN2rw3d3d14unlockVerticesEPv(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw4d3d817defaultInstanceCBEPNS_8GeometryEPNS0_12InstanceDataE(ptr nocapture noundef readonly %0, ptr nocapture noundef %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 36
  %6 = load i32, ptr %5, align 4, !tbaa !14
  %7 = tail call noundef i32 @_ZN2rw4d3d818makeFVFDeclarationEji(i32 noundef %4, i32 noundef %6)
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  store i32 %7, ptr %8, align 8, !tbaa !15
  %9 = load i32, ptr %3, align 8, !tbaa !5
  %10 = load i32, ptr %5, align 4, !tbaa !14
  %11 = tail call noundef i32 @_ZN2rw4d3d89getStrideEji(i32 noundef %9, i32 noundef %10)
  %12 = getelementptr inbounds i8, ptr %1, i64 4
  store i32 %11, ptr %12, align 4, !tbaa !17
  %13 = getelementptr inbounds i8, ptr %1, i64 40
  %14 = load ptr, ptr %13, align 8, !tbaa !18
  %15 = icmp eq ptr %14, null
  br i1 %15, label %17, label %16

16:                                               ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 373, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw4d3d817defaultInstanceCBEPNS_8GeometryEPNS0_12InstanceDataE) #4
  unreachable

17:                                               ; preds = %2
  %18 = getelementptr inbounds i8, ptr %1, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !19
  %20 = mul nsw i32 %19, %11
  %21 = load i32, ptr %8, align 8, !tbaa !15
  %22 = tail call noundef ptr @_ZN2rw3d3d18createVertexBufferEjjb(i32 noundef %20, i32 noundef %21, i1 noundef zeroext false)
  store ptr %22, ptr %13, align 8, !tbaa !18
  %23 = getelementptr inbounds i8, ptr %1, i64 53
  store i8 1, ptr %23, align 1, !tbaa !20
  %24 = tail call noundef ptr @_ZN2rw3d3d12lockVerticesEPvjjj(ptr noundef %22, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  %25 = getelementptr inbounds i8, ptr %0, i64 120
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  %27 = getelementptr inbounds i8, ptr %26, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !22
  %29 = load i32, ptr %1, align 8, !tbaa !27
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds %"struct.rw::V3d", ptr %28, i64 %30
  %32 = load i32, ptr %18, align 8, !tbaa !19
  %33 = load i32, ptr %12, align 4, !tbaa !17
  tail call void @_ZN2rw7instV3dEiPhPNS_3V3dEjj(i32 noundef 8, ptr noundef %24, ptr noundef %31, i32 noundef %32, i32 noundef %33)
  %34 = getelementptr inbounds i8, ptr %24, i64 12
  %35 = load i32, ptr %3, align 8, !tbaa !5
  %36 = and i32 %35, 16
  %.not = icmp eq i32 %36, 0
  br i1 %.not, label %47, label %37

37:                                               ; preds = %17
  %38 = load ptr, ptr %25, align 8, !tbaa !21
  %39 = getelementptr inbounds i8, ptr %38, i64 32
  %40 = load ptr, ptr %39, align 8, !tbaa !28
  %41 = load i32, ptr %1, align 8, !tbaa !27
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds %"struct.rw::V3d", ptr %40, i64 %42
  %44 = load i32, ptr %18, align 8, !tbaa !19
  %45 = load i32, ptr %12, align 4, !tbaa !17
  tail call void @_ZN2rw7instV3dEiPhPNS_3V3dEjj(i32 noundef 8, ptr noundef nonnull %34, ptr noundef %43, i32 noundef %44, i32 noundef %45)
  %46 = getelementptr inbounds i8, ptr %24, i64 24
  %.pre = load i32, ptr %3, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %37, %17
  %48 = phi i32 [ %.pre, %37 ], [ %35, %17 ]
  %.045 = phi ptr [ %46, %37 ], [ %34, %17 ]
  %49 = getelementptr inbounds i8, ptr %1, i64 52
  store i8 0, ptr %49, align 4, !tbaa !29
  %50 = and i32 %48, 8
  %.not46 = icmp eq i32 %50, 0
  br i1 %.not46, label %62, label %51

51:                                               ; preds = %47
  %52 = getelementptr inbounds i8, ptr %0, i64 48
  %53 = load ptr, ptr %52, align 8, !tbaa !30
  %54 = load i32, ptr %1, align 8, !tbaa !27
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds %"struct.rw::RGBA", ptr %53, i64 %55
  %57 = load i32, ptr %18, align 8, !tbaa !19
  %58 = load i32, ptr %12, align 4, !tbaa !17
  %59 = tail call noundef i32 @_ZN2rw9instColorEiPhPNS_4RGBAEjj(i32 noundef 10, ptr noundef nonnull %.045, ptr noundef %56, i32 noundef %57, i32 noundef %58)
  %60 = trunc i32 %59 to i8
  store i8 %60, ptr %49, align 4, !tbaa !29
  %61 = getelementptr inbounds i8, ptr %.045, i64 4
  br label %62

62:                                               ; preds = %51, %47
  %.1 = phi ptr [ %61, %51 ], [ %.045, %47 ]
  %63 = load i32, ptr %5, align 4, !tbaa !14
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %62
  %65 = getelementptr inbounds i8, ptr %0, i64 56
  br label %67

._crit_edge:                                      ; preds = %67, %62
  %66 = load ptr, ptr %13, align 8, !tbaa !18
  tail call void @_ZN2rw3d3d14unlockVerticesEPv(ptr noundef %66)
  ret void

67:                                               ; preds = %.lr.ph, %67
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %67 ]
  %.247 = phi ptr [ %.1, %.lr.ph ], [ %75, %67 ]
  %68 = getelementptr inbounds [8 x ptr], ptr %65, i64 0, i64 %indvars.iv
  %69 = load ptr, ptr %68, align 8, !tbaa !31
  %70 = load i32, ptr %1, align 8, !tbaa !27
  %71 = zext i32 %70 to i64
  %72 = getelementptr inbounds %"struct.rw::TexCoords", ptr %69, i64 %71
  %73 = load i32, ptr %18, align 8, !tbaa !19
  %74 = load i32, ptr %12, align 4, !tbaa !17
  tail call void @_ZN2rw13instTexCoordsEiPhPNS_9TexCoordsEjj(i32 noundef 7, ptr noundef nonnull %.247, ptr noundef %72, i32 noundef %73, i32 noundef %74)
  %75 = getelementptr inbounds i8, ptr %.247, i64 8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %76 = load i32, ptr %5, align 4, !tbaa !14
  %77 = sext i32 %76 to i64
  %78 = icmp slt i64 %indvars.iv.next, %77
  br i1 %78, label %67, label %._crit_edge, !llvm.loop !32
}

declare void @_ZN2rw7instV3dEiPhPNS_3V3dEjj(i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare noundef i32 @_ZN2rw9instColorEiPhPNS_4RGBAEjj(i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @_ZN2rw13instTexCoordsEiPhPNS_9TexCoordsEjj(i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #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" }
attributes #4 = { 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, !11, i64 16}
!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 = !{!6, !11, i64 36}
!15 = !{!16, !11, i64 24}
!16 = !{!"_ZTSN2rw4d3d812InstanceDataE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !10, i64 16, !11, i64 24, !11, i64 28, !10, i64 32, !10, i64 40, !11, i64 48, !8, i64 52, !8, i64 53, !8, i64 54}
!17 = !{!16, !11, i64 4}
!18 = !{!16, !10, i64 40}
!19 = !{!16, !11, i64 8}
!20 = !{!16, !8, i64 53}
!21 = !{!6, !10, i64 120}
!22 = !{!23, !10, i64 24}
!23 = !{!"_ZTSN2rw11MorphTargetE", !10, i64 0, !24, i64 8, !10, i64 24, !10, i64 32}
!24 = !{!"_ZTSN2rw6SphereE", !25, i64 0, !26, i64 12}
!25 = !{!"_ZTSN2rw3V3dE", !26, i64 0, !26, i64 4, !26, i64 8}
!26 = !{!"float", !8, i64 0}
!27 = !{!16, !11, i64 0}
!28 = !{!23, !10, i64 32}
!29 = !{!16, !8, i64 52}
!30 = !{!6, !10, i64 48}
!31 = !{!10, !10, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


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