; LLVM IR from aap/librw :: src/geometry.ll (ZN2rw8Geometry10streamReadEPNS_6StreamE)

; 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::PluginList" = type { i32, i32, %"struct.rw::LinkList" }
%"struct.rw::LinkList" = type { %"struct.rw::LLLink" }
%"struct.rw::LLLink" = type { ptr, ptr }
%"struct.rw::SurfaceProperties" = type { float, float, float }
%"struct.rw::GeoStreamData" = type { i32, i32, i32, i32 }
%"struct.rw::Error" = type { i32, i32 }
%"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::Triangle" = type { [3 x i16], i16 }
%"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 }

@_ZN2rw8Geometry9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZZN2rw8Geometry10streamReadEPNS_6StreamEE5reset = external hidden global %"struct.rw::SurfaceProperties", align 4
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@_ZN2rwL19defaultSurfacePropsE = external hidden global %"struct.rw::SurfaceProperties", align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw8Geometry6createEiij(i32 noundef, i32 noundef, i32 noundef) #0 align 2

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

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

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

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) #3

; 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
declare dso_local void @_ZN2rw8Geometry15addMorphTargetsEi(ptr noundef nonnull align 8 dereferenceable(168), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw8Geometry10streamReadEPNS_6StreamE(ptr noundef %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"struct.rw::GeoStreamData", align 4
  %6 = alloca %"struct.rw::SurfaceProperties", align 4
  %7 = alloca ptr, align 8
  %8 = alloca %"struct.rw::Error", align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [2 x i32], align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.rw::Error", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %19, i32 noundef 1, ptr noundef null, ptr noundef %4)
  br i1 %20, label %32, label %21

21:                                               ; preds = %1
  br label %22

22:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %23 = getelementptr inbounds %"struct.rw::Error", ptr %8, i32 0, i32 0
  store i32 15, ptr %23, align 4, !tbaa !9
  %24 = getelementptr inbounds %"struct.rw::Error", ptr %8, i32 0, i32 1
  store i32 -2147483644, ptr %24, align 4, !tbaa !12
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 143) #5
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.6)
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str.4, ptr noundef %28) #5
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %30

30:                                               ; preds = %22
  br label %31

31:                                               ; preds = %30
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %260

32:                                               ; preds = %1
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %33, ptr noundef %5, i32 noundef 16)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %35 = getelementptr inbounds %"struct.rw::GeoStreamData", ptr %5, i32 0, i32 2
  %36 = load i32, ptr %35, align 4, !tbaa !13
  %37 = getelementptr inbounds %"struct.rw::GeoStreamData", ptr %5, i32 0, i32 1
  %38 = load i32, ptr %37, align 4, !tbaa !15
  %39 = getelementptr inbounds %"struct.rw::GeoStreamData", ptr %5, i32 0, i32 0
  %40 = load i32, ptr %39, align 4, !tbaa !16
  %41 = call noundef ptr @_ZN2rw8Geometry6createEiij(i32 noundef %36, i32 noundef %38, i32 noundef %40)
  store ptr %41, ptr %10, align 8, !tbaa !5
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %45

44:                                               ; preds = %32
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %259

45:                                               ; preds = %32
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.rw::GeoStreamData", ptr %5, i32 0, i32 3
  %48 = load i32, ptr %47, align 4, !tbaa !17
  %49 = sub nsw i32 %48, 1
  call void @_ZN2rw8Geometry15addMorphTargetsEi(ptr noundef nonnull align 8 dereferenceable(168) %46, i32 noundef %49)
  %50 = load i32, ptr %4, align 4, !tbaa !18
  %51 = icmp ult i32 %50, 212992
  br i1 %51, label %52, label %55

52:                                               ; preds = %45
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %53, ptr noundef %6, i32 noundef 12)
  br label %55

55:                                               ; preds = %52, %45
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.rw::Geometry", ptr %56, i32 0, i32 1
  %58 = load i32, ptr %57, align 8, !tbaa !19
  %59 = and i32 %58, 16777216
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %166, label %61

61:                                               ; preds = %55
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.rw::Geometry", ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 8, !tbaa !19
  %65 = and i32 %64, 8
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %80

67:                                               ; preds = %61
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = getelementptr inbounds %"struct.rw::Geometry", ptr %69, i32 0, i32 8
  %71 = load ptr, ptr %70, align 8, !tbaa !24
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.rw::Geometry", ptr %72, i32 0, i32 4
  %74 = load i32, ptr %73, align 4, !tbaa !25
  %75 = mul nsw i32 4, %74
  %76 = load ptr, ptr %68, align 8, !tbaa !26
  %77 = getelementptr inbounds ptr, ptr %76, i64 4
  %78 = load ptr, ptr %77, align 8
  %79 = call noundef i32 %78(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef %71, i32 noundef %75)
  br label %80

80:                                               ; preds = %67, %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !18
  br label %81

81:                                               ; preds = %102, %80
  %82 = load i32, ptr %11, align 4, !tbaa !18
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.rw::Geometry", ptr %83, i32 0, i32 6
  %85 = load i32, ptr %84, align 4, !tbaa !28
  %86 = icmp slt i32 %82, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %81
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %105

88:                                               ; preds = %81
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = getelementptr inbounds %"struct.rw::Geometry", ptr %90, i32 0, i32 9
  %92 = load i32, ptr %11, align 4, !tbaa !18
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [8 x ptr], ptr %91, i64 0, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = getelementptr inbounds %"struct.rw::Geometry", ptr %96, i32 0, i32 4
  %98 = load i32, ptr %97, align 4, !tbaa !25
  %99 = mul nsw i32 2, %98
  %100 = mul nsw i32 %99, 4
  %101 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef %95, i32 noundef %100)
  br label %102

102:                                              ; preds = %88
  %103 = load i32, ptr %11, align 4, !tbaa !18
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %11, align 4, !tbaa !18
  br label %81, !llvm.loop !29

105:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !18
  br label %106

106:                                              ; preds = %162, %105
  %107 = load i32, ptr %12, align 4, !tbaa !18
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  %109 = getelementptr inbounds %"struct.rw::Geometry", ptr %108, i32 0, i32 3
  %110 = load i32, ptr %109, align 8, !tbaa !31
  %111 = icmp slt i32 %107, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %106
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %165

113:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 0
  %116 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %114, ptr noundef %115, i32 noundef 8)
  %117 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 0
  %118 = load i32, ptr %117, align 4, !tbaa !18
  %119 = lshr i32 %118, 16
  %120 = trunc i32 %119 to i16
  %121 = load ptr, ptr %10, align 8, !tbaa !5
  %122 = getelementptr inbounds %"struct.rw::Geometry", ptr %121, i32 0, i32 7
  %123 = load ptr, ptr %122, align 8, !tbaa !32
  %124 = load i32, ptr %12, align 4, !tbaa !18
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds %"struct.rw::Triangle", ptr %123, i64 %125
  %127 = getelementptr inbounds %"struct.rw::Triangle", ptr %126, i32 0, i32 0
  %128 = getelementptr inbounds [3 x i16], ptr %127, i64 0, i64 0
  store i16 %120, ptr %128, align 2, !tbaa !33
  %129 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 0
  %130 = load i32, ptr %129, align 4, !tbaa !18
  %131 = trunc i32 %130 to i16
  %132 = load ptr, ptr %10, align 8, !tbaa !5
  %133 = getelementptr inbounds %"struct.rw::Geometry", ptr %132, i32 0, i32 7
  %134 = load ptr, ptr %133, align 8, !tbaa !32
  %135 = load i32, ptr %12, align 4, !tbaa !18
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds %"struct.rw::Triangle", ptr %134, i64 %136
  %138 = getelementptr inbounds %"struct.rw::Triangle", ptr %137, i32 0, i32 0
  %139 = getelementptr inbounds [3 x i16], ptr %138, i64 0, i64 1
  store i16 %131, ptr %139, align 2, !tbaa !33
  %140 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 1
  %141 = load i32, ptr %140, align 4, !tbaa !18
  %142 = lshr i32 %141, 16
  %143 = trunc i32 %142 to i16
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = getelementptr inbounds %"struct.rw::Geometry", ptr %144, i32 0, i32 7
  %146 = load ptr, ptr %145, align 8, !tbaa !32
  %147 = load i32, ptr %12, align 4, !tbaa !18
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds %"struct.rw::Triangle", ptr %146, i64 %148
  %150 = getelementptr inbounds %"struct.rw::Triangle", ptr %149, i32 0, i32 0
  %151 = getelementptr inbounds [3 x i16], ptr %150, i64 0, i64 2
  store i16 %143, ptr %151, align 2, !tbaa !33
  %152 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 1
  %153 = load i32, ptr %152, align 4, !tbaa !18
  %154 = trunc i32 %153 to i16
  %155 = load ptr, ptr %10, align 8, !tbaa !5
  %156 = getelementptr inbounds %"struct.rw::Geometry", ptr %155, i32 0, i32 7
  %157 = load ptr, ptr %156, align 8, !tbaa !32
  %158 = load i32, ptr %12, align 4, !tbaa !18
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds %"struct.rw::Triangle", ptr %157, i64 %159
  %161 = getelementptr inbounds %"struct.rw::Triangle", ptr %160, i32 0, i32 1
  store i16 %154, ptr %161, align 2, !tbaa !34
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %162

162:                                              ; preds = %113
  %163 = load i32, ptr %12, align 4, !tbaa !18
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %12, align 4, !tbaa !18
  br label %106, !llvm.loop !36

165:                                              ; preds = %112
  br label %166

166:                                              ; preds = %165, %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !18
  br label %167

167:                                              ; preds = %217, %166
  %168 = load i32, ptr %14, align 4, !tbaa !18
  %169 = load ptr, ptr %10, align 8, !tbaa !5
  %170 = getelementptr inbounds %"struct.rw::Geometry", ptr %169, i32 0, i32 5
  %171 = load i32, ptr %170, align 8, !tbaa !37
  %172 = icmp slt i32 %168, %171
  br i1 %172, label %174, label %173

173:                                              ; preds = %167
  store i32 10, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %220

174:                                              ; preds = %167
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %175 = load ptr, ptr %10, align 8, !tbaa !5
  %176 = getelementptr inbounds %"struct.rw::Geometry", ptr %175, i32 0, i32 10
  %177 = load ptr, ptr %176, align 8, !tbaa !38
  %178 = load i32, ptr %14, align 4, !tbaa !18
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %177, i64 %179
  store ptr %180, ptr %15, align 8, !tbaa !5
  %181 = load ptr, ptr %3, align 8, !tbaa !5
  %182 = load ptr, ptr %15, align 8, !tbaa !5
  %183 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %182, i32 0, i32 1
  %184 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %181, ptr noundef %183, i32 noundef 16)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %185 = load ptr, ptr %3, align 8, !tbaa !5
  %186 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %185)
  store i32 %186, ptr %16, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %187 = load ptr, ptr %3, align 8, !tbaa !5
  %188 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %187)
  store i32 %188, ptr %17, align 4, !tbaa !18
  %189 = load i32, ptr %16, align 4, !tbaa !18
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %191, label %202

191:                                              ; preds = %174
  %192 = load ptr, ptr %3, align 8, !tbaa !5
  %193 = load ptr, ptr %15, align 8, !tbaa !5
  %194 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %193, i32 0, i32 2
  %195 = load ptr, ptr %194, align 8, !tbaa !39
  %196 = load ptr, ptr %10, align 8, !tbaa !5
  %197 = getelementptr inbounds %"struct.rw::Geometry", ptr %196, i32 0, i32 4
  %198 = load i32, ptr %197, align 4, !tbaa !25
  %199 = mul nsw i32 3, %198
  %200 = mul nsw i32 %199, 4
  %201 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %192, ptr noundef %195, i32 noundef %200)
  br label %202

202:                                              ; preds = %191, %174
  %203 = load i32, ptr %17, align 4, !tbaa !18
  %204 = icmp ne i32 %203, 0
  br i1 %204, label %205, label %216

205:                                              ; preds = %202
  %206 = load ptr, ptr %3, align 8, !tbaa !5
  %207 = load ptr, ptr %15, align 8, !tbaa !5
  %208 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %207, i32 0, i32 3
  %209 = load ptr, ptr %208, align 8, !tbaa !44
  %210 = load ptr, ptr %10, align 8, !tbaa !5
  %211 = getelementptr inbounds %"struct.rw::Geometry", ptr %210, i32 0, i32 4
  %212 = load i32, ptr %211, align 4, !tbaa !25
  %213 = mul nsw i32 3, %212
  %214 = mul nsw i32 %213, 4
  %215 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %206, ptr noundef %209, i32 noundef %214)
  br label %216

216:                                              ; preds = %205, %202
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %217

217:                                              ; preds = %216
  %218 = load i32, ptr %14, align 4, !tbaa !18
  %219 = add nsw i32 %218, 1
  store i32 %219, ptr %14, align 4, !tbaa !18
  br label %167, !llvm.loop !45

220:                                              ; preds = %173
  %221 = load ptr, ptr %3, align 8, !tbaa !5
  %222 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %221, i32 noundef 8, ptr noundef null, ptr noundef null)
  br i1 %222, label %234, label %223

223:                                              ; preds = %220
  br label %224

224:                                              ; preds = %223
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %225 = getelementptr inbounds %"struct.rw::Error", ptr %18, i32 0, i32 0
  store i32 15, ptr %225, align 4, !tbaa !9
  %226 = getelementptr inbounds %"struct.rw::Error", ptr %18, i32 0, i32 1
  store i32 -2147483644, ptr %226, align 4, !tbaa !12
  %227 = load ptr, ptr @stderr, align 8, !tbaa !5
  %228 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %227, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 183) #5
  %229 = load ptr, ptr @stderr, align 8, !tbaa !5
  %230 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.7)
  %231 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %229, ptr noundef @.str.4, ptr noundef %230) #5
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %232

232:                                              ; preds = %224
  br label %233

233:                                              ; preds = %232
  br label %257

234:                                              ; preds = %220
  %235 = load i32, ptr %4, align 4, !tbaa !18
  %236 = icmp ult i32 %235, 212992
  br i1 %236, label %237, label %238

237:                                              ; preds = %234
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_ZN2rwL19defaultSurfacePropsE, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !46
  br label %238

238:                                              ; preds = %237, %234
  %239 = load ptr, ptr %3, align 8, !tbaa !5
  %240 = load ptr, ptr %10, align 8, !tbaa !5
  %241 = getelementptr inbounds %"struct.rw::Geometry", ptr %240, i32 0, i32 11
  %242 = call noundef ptr @_ZN2rw12MaterialList10streamReadEPNS_6StreamEPS0_(ptr noundef %239, ptr noundef %241)
  store ptr %242, ptr %7, align 8, !tbaa !5
  %243 = load i32, ptr %4, align 4, !tbaa !18
  %244 = icmp ult i32 %243, 212992
  br i1 %244, label %245, label %246

245:                                              ; preds = %238
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @_ZN2rwL19defaultSurfacePropsE, ptr align 4 @_ZZN2rw8Geometry10streamReadEPNS_6StreamEE5reset, i64 12, i1 false), !tbaa.struct !46
  br label %246

246:                                              ; preds = %245, %238
  %247 = load ptr, ptr %7, align 8, !tbaa !5
  %248 = icmp eq ptr %247, null
  br i1 %248, label %249, label %250

249:                                              ; preds = %246
  br label %257

250:                                              ; preds = %246
  %251 = load ptr, ptr %3, align 8, !tbaa !5
  %252 = load ptr, ptr %10, align 8, !tbaa !5
  %253 = call noundef zeroext i1 @_ZN2rw10PluginList10streamReadEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw8Geometry9s_plglistE, ptr noundef %251, ptr noundef %252)
  br i1 %253, label %254, label %256

254:                                              ; preds = %250
  %255 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %255, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %259

256:                                              ; preds = %250
  br label %257

257:                                              ; preds = %256, %249, %233
  %258 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168) %258)
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %259

259:                                              ; preds = %257, %254, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %260

260:                                              ; preds = %259, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %261 = load ptr, ptr %2, align 8
  ret ptr %261
}

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

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

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

; 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) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw12MaterialList10streamReadEPNS_6StreamEPS0_(ptr noundef, ptr noundef) #0 align 2

declare noundef zeroext i1 @_ZN2rw10PluginList10streamReadEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !11, i64 0}
!10 = !{!"_ZTSN2rw5ErrorE", !11, i64 0, !11, i64 4}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!14, !11, i64 8}
!14 = !{!"_ZTSN2rw13GeoStreamDataE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!15 = !{!14, !11, i64 4}
!16 = !{!14, !11, i64 0}
!17 = !{!14, !11, i64 12}
!18 = !{!11, !11, i64 0}
!19 = !{!20, !11, i64 16}
!20 = !{!"_ZTSN2rw8GeometryE", !21, i64 0, !11, i64 16, !22, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !23, i64 128, !6, i64 144, !6, i64 152, !11, i64 160}
!21 = !{!"_ZTSN2rw6ObjectE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !6, i64 8}
!22 = !{!"short", !7, i64 0}
!23 = !{!"_ZTSN2rw12MaterialListE", !6, i64 0, !11, i64 8, !11, i64 12}
!24 = !{!20, !6, i64 48}
!25 = !{!20, !11, i64 28}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !8, i64 0}
!28 = !{!20, !11, i64 36}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!20, !11, i64 24}
!32 = !{!20, !6, i64 40}
!33 = !{!22, !22, i64 0}
!34 = !{!35, !22, i64 6}
!35 = !{!"_ZTSN2rw8TriangleE", !7, i64 0, !22, i64 6}
!36 = distinct !{!36, !30}
!37 = !{!20, !11, i64 32}
!38 = !{!20, !6, i64 120}
!39 = !{!40, !6, i64 24}
!40 = !{!"_ZTSN2rw11MorphTargetE", !6, i64 0, !41, i64 8, !6, i64 24, !6, i64 32}
!41 = !{!"_ZTSN2rw6SphereE", !42, i64 0, !43, i64 12}
!42 = !{!"_ZTSN2rw3V3dE", !43, i64 0, !43, i64 4, !43, i64 8}
!43 = !{!"float", !7, i64 0}
!44 = !{!40, !6, i64 32}
!45 = distinct !{!45, !30}
!46 = !{i64 0, i64 4, !47, i64 4, i64 4, !47, i64 8, i64 4, !47}
!47 = !{!43, !43, i64 0}


; 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::PluginList" = type { i32, i32, %"struct.rw::LinkList" }
%"struct.rw::LinkList" = type { %"struct.rw::LLLink" }
%"struct.rw::LLLink" = type { ptr, ptr }
%"struct.rw::SurfaceProperties" = type { float, float, float }
%"struct.rw::GeoStreamData" = type { i32, i32, i32, i32 }
%"struct.rw::Error" = type { i32, i32 }
%"struct.rw::Triangle" = type { [3 x i16], i16 }
%"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 }

@_ZN2rw8Geometry9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZZN2rw8Geometry10streamReadEPNS_6StreamEE5reset = external hidden local_unnamed_addr global %"struct.rw::SurfaceProperties", align 4
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@_ZN2rwL19defaultSurfacePropsE = external hidden local_unnamed_addr global %"struct.rw::SurfaceProperties", align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw8Geometry6createEiij(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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

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

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

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) local_unnamed_addr #3

; 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
declare dso_local void @_ZN2rw8Geometry15addMorphTargetsEi(ptr noundef nonnull align 8 dereferenceable(168), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw8Geometry10streamReadEPNS_6StreamE(ptr noundef %0) local_unnamed_addr #0 align 2 {
  %2 = alloca i32, align 4
  %3 = alloca %"struct.rw::GeoStreamData", align 4
  %4 = alloca %"struct.rw::SurfaceProperties", align 4
  %5 = alloca %"struct.rw::Error", align 4
  %6 = alloca [2 x i32], align 4
  %7 = alloca %"struct.rw::Error", align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #5
  %8 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %0, i32 noundef 1, ptr noundef null, ptr noundef nonnull %2)
  br i1 %8, label %16, label %9

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

16:                                               ; preds = %1
  %17 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %3, i32 noundef 16)
  %18 = getelementptr inbounds i8, ptr %3, i64 8
  %19 = load i32, ptr %18, align 4, !tbaa !13
  %20 = getelementptr inbounds i8, ptr %3, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !15
  %22 = load i32, ptr %3, align 4, !tbaa !16
  %23 = call noundef ptr @_ZN2rw8Geometry6createEiij(i32 noundef %19, i32 noundef %21, i32 noundef %22)
  %24 = icmp eq ptr %23, null
  br i1 %24, label %139, label %25

25:                                               ; preds = %16
  %26 = getelementptr inbounds i8, ptr %3, i64 12
  %27 = load i32, ptr %26, align 4, !tbaa !17
  %28 = add nsw i32 %27, -1
  call void @_ZN2rw8Geometry15addMorphTargetsEi(ptr noundef nonnull align 8 dereferenceable(168) %23, i32 noundef %28)
  %29 = load i32, ptr %2, align 4, !tbaa !18
  %30 = icmp ult i32 %29, 212992
  br i1 %30, label %31, label %33

31:                                               ; preds = %25
  %32 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %4, i32 noundef 12)
  br label %33

33:                                               ; preds = %31, %25
  %34 = getelementptr inbounds i8, ptr %23, i64 16
  %35 = load i32, ptr %34, align 8, !tbaa !19
  %36 = and i32 %35, 16777216
  %.not = icmp eq i32 %36, 0
  br i1 %.not, label %37, label %.loopexit

37:                                               ; preds = %33
  %38 = and i32 %35, 8
  %.not58 = icmp eq i32 %38, 0
  br i1 %.not58, label %49, label %39

39:                                               ; preds = %37
  %40 = getelementptr inbounds i8, ptr %23, i64 48
  %41 = load ptr, ptr %40, align 8, !tbaa !24
  %42 = getelementptr inbounds i8, ptr %23, i64 28
  %43 = load i32, ptr %42, align 4, !tbaa !25
  %44 = shl nsw i32 %43, 2
  %45 = load ptr, ptr %0, align 8, !tbaa !26
  %46 = getelementptr inbounds i8, ptr %45, i64 32
  %47 = load ptr, ptr %46, align 8
  %48 = call noundef i32 %47(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %41, i32 noundef %44)
  br label %49

49:                                               ; preds = %39, %37
  %50 = getelementptr inbounds i8, ptr %23, i64 36
  %51 = load i32, ptr %50, align 4, !tbaa !28
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %49
  %53 = getelementptr inbounds i8, ptr %23, i64 56
  %54 = getelementptr inbounds i8, ptr %23, i64 28
  br label %60

.preheader:                                       ; preds = %60, %49
  %55 = getelementptr inbounds i8, ptr %23, i64 24
  %56 = load i32, ptr %55, align 8, !tbaa !29
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %.lr.ph63, label %.loopexit

.lr.ph63:                                         ; preds = %.preheader
  %58 = getelementptr inbounds i8, ptr %23, i64 40
  %59 = getelementptr inbounds i8, ptr %6, i64 4
  br label %69

60:                                               ; preds = %.lr.ph, %60
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %60 ]
  %61 = getelementptr inbounds [8 x ptr], ptr %53, i64 0, i64 %indvars.iv
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = load i32, ptr %54, align 4, !tbaa !25
  %64 = shl nsw i32 %63, 3
  %65 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %62, i32 noundef %64)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %66 = load i32, ptr %50, align 4, !tbaa !28
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next, %67
  br i1 %68, label %60, label %.preheader, !llvm.loop !30

69:                                               ; preds = %.lr.ph63, %69
  %indvars.iv67 = phi i64 [ 0, %.lr.ph63 ], [ %indvars.iv.next68, %69 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %70 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %6, i32 noundef 8)
  %71 = load i32, ptr %6, align 4, !tbaa !18
  %72 = lshr i32 %71, 16
  %73 = trunc nuw i32 %72 to i16
  %74 = load ptr, ptr %58, align 8, !tbaa !32
  %75 = getelementptr inbounds %"struct.rw::Triangle", ptr %74, i64 %indvars.iv67
  store i16 %73, ptr %75, align 2, !tbaa !33
  %76 = trunc i32 %71 to i16
  %77 = getelementptr inbounds %"struct.rw::Triangle", ptr %74, i64 %indvars.iv67, i32 0, i64 1
  store i16 %76, ptr %77, align 2, !tbaa !33
  %78 = load i32, ptr %59, align 4, !tbaa !18
  %79 = lshr i32 %78, 16
  %80 = trunc nuw i32 %79 to i16
  %81 = getelementptr inbounds %"struct.rw::Triangle", ptr %74, i64 %indvars.iv67, i32 0, i64 2
  store i16 %80, ptr %81, align 2, !tbaa !33
  %82 = trunc i32 %78 to i16
  %83 = getelementptr inbounds %"struct.rw::Triangle", ptr %74, i64 %indvars.iv67, i32 1
  store i16 %82, ptr %83, align 2, !tbaa !34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %84 = load i32, ptr %55, align 8, !tbaa !29
  %85 = sext i32 %84 to i64
  %86 = icmp slt i64 %indvars.iv.next68, %85
  br i1 %86, label %69, label %.loopexit, !llvm.loop !36

.loopexit:                                        ; preds = %69, %.preheader, %33
  %87 = getelementptr inbounds i8, ptr %23, i64 32
  %88 = load i32, ptr %87, align 8, !tbaa !37
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph65, label %._crit_edge

.lr.ph65:                                         ; preds = %.loopexit
  %90 = getelementptr inbounds i8, ptr %23, i64 120
  %91 = getelementptr inbounds i8, ptr %23, i64 28
  br label %93

._crit_edge:                                      ; preds = %113, %.loopexit
  %92 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 8, ptr noundef null, ptr noundef null)
  br i1 %92, label %124, label %117

93:                                               ; preds = %.lr.ph65, %113
  %indvars.iv70 = phi i64 [ 0, %.lr.ph65 ], [ %indvars.iv.next71, %113 ]
  %94 = load ptr, ptr %90, align 8, !tbaa !38
  %95 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %94, i64 %indvars.iv70
  %96 = getelementptr inbounds i8, ptr %95, i64 8
  %97 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %96, i32 noundef 16)
  %98 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %99 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %.not59 = icmp eq i32 %98, 0
  br i1 %.not59, label %106, label %100

100:                                              ; preds = %93
  %101 = getelementptr inbounds i8, ptr %95, i64 24
  %102 = load ptr, ptr %101, align 8, !tbaa !39
  %103 = load i32, ptr %91, align 4, !tbaa !25
  %104 = mul i32 %103, 12
  %105 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %102, i32 noundef %104)
  br label %106

106:                                              ; preds = %100, %93
  %.not60 = icmp eq i32 %99, 0
  br i1 %.not60, label %113, label %107

107:                                              ; preds = %106
  %108 = getelementptr inbounds i8, ptr %95, i64 32
  %109 = load ptr, ptr %108, align 8, !tbaa !44
  %110 = load i32, ptr %91, align 4, !tbaa !25
  %111 = mul i32 %110, 12
  %112 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %109, i32 noundef %111)
  br label %113

113:                                              ; preds = %107, %106
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %114 = load i32, ptr %87, align 8, !tbaa !37
  %115 = sext i32 %114 to i64
  %116 = icmp slt i64 %indvars.iv.next71, %115
  br i1 %116, label %93, label %._crit_edge, !llvm.loop !45

117:                                              ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store i32 15, ptr %7, align 4, !tbaa !5
  %118 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 -2147483644, ptr %118, align 4, !tbaa !10
  %119 = load ptr, ptr @stderr, align 8, !tbaa !11
  %120 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %119, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 183) #6
  %121 = load ptr, ptr @stderr, align 8, !tbaa !11
  %122 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.7)
  %123 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %121, ptr noundef nonnull @.str.4, ptr noundef %122) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %138

124:                                              ; preds = %._crit_edge
  %125 = load i32, ptr %2, align 4, !tbaa !18
  %126 = icmp ult i32 %125, 212992
  br i1 %126, label %127, label %128

127:                                              ; preds = %124
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) @_ZN2rwL19defaultSurfacePropsE, ptr noundef nonnull align 4 dereferenceable(12) %4, i64 12, i1 false), !tbaa.struct !46
  br label %128

128:                                              ; preds = %127, %124
  %129 = getelementptr inbounds i8, ptr %23, i64 128
  %130 = call noundef ptr @_ZN2rw12MaterialList10streamReadEPNS_6StreamEPS0_(ptr noundef nonnull %0, ptr noundef nonnull %129)
  %131 = load i32, ptr %2, align 4, !tbaa !18
  %132 = icmp ult i32 %131, 212992
  br i1 %132, label %133, label %134

133:                                              ; preds = %128
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) @_ZN2rwL19defaultSurfacePropsE, ptr noundef nonnull align 4 dereferenceable(12) @_ZZN2rw8Geometry10streamReadEPNS_6StreamEE5reset, i64 12, i1 false), !tbaa.struct !46
  br label %134

134:                                              ; preds = %133, %128
  %135 = icmp eq ptr %130, null
  br i1 %135, label %138, label %136

136:                                              ; preds = %134
  %137 = call noundef zeroext i1 @_ZN2rw10PluginList10streamReadEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw8Geometry9s_plglistE, ptr noundef nonnull %0, ptr noundef nonnull %23)
  br i1 %137, label %139, label %138

138:                                              ; preds = %136, %134, %117
  call void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168) %23)
  br label %139

139:                                              ; preds = %138, %16, %136, %9
  %.1 = phi ptr [ null, %9 ], [ null, %138 ], [ null, %16 ], [ %23, %136 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  ret ptr %.1
}

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

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

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

; 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) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw12MaterialList10streamReadEPNS_6StreamEPS0_(ptr noundef, ptr noundef) local_unnamed_addr #0 align 2

declare noundef zeroext i1 @_ZN2rw10PluginList10streamReadEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, 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 = { 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 #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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { cold 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, !7, i64 8}
!14 = !{!"_ZTSN2rw13GeoStreamDataE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!15 = !{!14, !7, i64 4}
!16 = !{!14, !7, i64 0}
!17 = !{!14, !7, i64 12}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !7, i64 16}
!20 = !{!"_ZTSN2rw8GeometryE", !21, i64 0, !7, i64 16, !22, 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, !23, i64 128, !12, i64 144, !12, i64 152, !7, i64 160}
!21 = !{!"_ZTSN2rw6ObjectE", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !12, i64 8}
!22 = !{!"short", !8, i64 0}
!23 = !{!"_ZTSN2rw12MaterialListE", !12, i64 0, !7, i64 8, !7, i64 12}
!24 = !{!20, !12, i64 48}
!25 = !{!20, !7, i64 28}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !9, i64 0}
!28 = !{!20, !7, i64 36}
!29 = !{!20, !7, i64 24}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!20, !12, i64 40}
!33 = !{!22, !22, i64 0}
!34 = !{!35, !22, i64 6}
!35 = !{!"_ZTSN2rw8TriangleE", !8, i64 0, !22, i64 6}
!36 = distinct !{!36, !31}
!37 = !{!20, !7, i64 32}
!38 = !{!20, !12, i64 120}
!39 = !{!40, !12, i64 24}
!40 = !{!"_ZTSN2rw11MorphTargetE", !12, i64 0, !41, i64 8, !12, i64 24, !12, i64 32}
!41 = !{!"_ZTSN2rw6SphereE", !42, i64 0, !43, i64 12}
!42 = !{!"_ZTSN2rw3V3dE", !43, i64 0, !43, i64 4, !43, i64 8}
!43 = !{!"float", !8, i64 0}
!44 = !{!40, !12, i64 32}
!45 = distinct !{!45, !31}
!46 = !{i64 0, i64 4, !47, i64 4, i64 4, !47, i64 8, i64 4, !47}
!47 = !{!43, !43, i64 0}


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