; LLVM IR from aap/librw :: src/ps2/ps2raster.ll (ZN2rw3ps217readNativeTextureEPNS_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::Error" = type { i32, i32 }
%"struct.rw::ps2::StreamRasterExt" = type { i32, i32, i32, i16, i16, i64, i32, i32, i64, i64, i32, i32, i32, i32 }
%"struct.rw::Texture" = type { ptr, ptr, %"struct.rw::LLLink", [32 x i8], [32 x i8], i32, i32, %"struct.rw::LLLink" }
%"struct.rw::LLLink" = type { ptr, ptr }
%"struct.rw::ps2::Ps2Raster" = type { i64, i32, i16, i8, i8, i64, i64, i32, i32, i32, i8, ptr, i32 }
%"struct.rw::Raster" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, ptr, i32, i32 }
%"struct.rw::ps2::Ps2Raster::PixelPtr" = type { ptr, i32, i32 }

@_ZN2rw3ps218nativeRasterOffsetE = external dso_local global i32, align 4
@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 [65 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZN2rw7versionE = external global i32, align 4
@_ZN2rw3ps2L17noNewStyleRastersE = external hidden global i32, align 4
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE = external hidden unnamed_addr constant [46 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [20 x i8], align 1

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

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

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

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

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2rw3ps28calcTEX1EPNS_6RasterEPmi(ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw3ps217readNativeTextureEPNS_6StreamE(ptr noundef %0) #5 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %"struct.rw::Error", align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.rw::Error", align 4
  %13 = alloca ptr, align 8
  %14 = alloca %"struct.rw::Error", align 4
  %15 = alloca %"struct.rw::Error", align 4
  %16 = alloca %"struct.rw::ps2::StreamRasterExt", align 8
  %17 = alloca %"struct.rw::Error", align 4
  %18 = alloca %"struct.rw::Error", align 4
  %19 = alloca i64, align 8
  %20 = 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) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %21, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %22, label %34, label %23

23:                                               ; preds = %1
  br label %24

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

32:                                               ; preds = %24
  br label %33

33:                                               ; preds = %32
  store ptr null, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %422

34:                                               ; preds = %1
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = call noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8) %35)
  store i32 %36, ptr %7, align 4, !tbaa !13
  %37 = load i32, ptr %7, align 4, !tbaa !13
  %38 = icmp ne i32 %37, 3298128
  br i1 %38, label %39, label %51

39:                                               ; preds = %34
  br label %40

40:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %41 = getelementptr inbounds %"struct.rw::Error", ptr %12, i32 0, i32 0
  store i32 2816, ptr %41, align 4, !tbaa !9
  %42 = getelementptr inbounds %"struct.rw::Error", ptr %12, i32 0, i32 1
  store i32 -2147483642, ptr %42, align 4, !tbaa !12
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 2016) #6
  %45 = load ptr, ptr @stderr, align 8, !tbaa !5
  %46 = load i32, ptr %7, align 4, !tbaa !13
  %47 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483642, i32 noundef %46)
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef @.str.3, ptr noundef %47) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %49

49:                                               ; preds = %40
  br label %50

50:                                               ; preds = %49
  store ptr null, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %422

51:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %52 = call noundef ptr @_ZN2rw7Texture6createEPNS_6RasterE(ptr noundef null)
  store ptr %52, ptr %13, align 8, !tbaa !5
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %56

55:                                               ; preds = %51
  store ptr null, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %421

56:                                               ; preds = %51
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = call noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8) %57)
  %59 = load ptr, ptr %13, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.rw::Texture", ptr %59, i32 0, i32 5
  store i32 %58, ptr %60, align 8, !tbaa !14
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %61, i32 noundef 2, ptr noundef %4, ptr noundef null)
  br i1 %62, label %74, label %63

63:                                               ; preds = %56
  br label %64

64:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %65 = getelementptr inbounds %"struct.rw::Error", ptr %14, i32 0, i32 0
  store i32 2816, ptr %65, align 4, !tbaa !9
  %66 = getelementptr inbounds %"struct.rw::Error", ptr %14, i32 0, i32 1
  store i32 -2147483644, ptr %66, align 4, !tbaa !12
  %67 = load ptr, ptr @stderr, align 8, !tbaa !5
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 2026) #6
  %69 = load ptr, ptr @stderr, align 8, !tbaa !5
  %70 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.13)
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef @.str.3, ptr noundef %70) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %72

72:                                               ; preds = %64
  br label %73

73:                                               ; preds = %72
  br label %419

74:                                               ; preds = %56
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = getelementptr inbounds %"struct.rw::Texture", ptr %76, i32 0, i32 3
  %78 = getelementptr inbounds [32 x i8], ptr %77, i64 0, i64 0
  %79 = load i32, ptr %4, align 4, !tbaa !13
  %80 = load ptr, ptr %75, align 8, !tbaa !17
  %81 = getelementptr inbounds ptr, ptr %80, i64 4
  %82 = load ptr, ptr %81, align 8
  %83 = call noundef i32 %82(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef %78, i32 noundef %79)
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %84, i32 noundef 2, ptr noundef %4, ptr noundef null)
  br i1 %85, label %97, label %86

86:                                               ; preds = %74
  br label %87

87:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %88 = getelementptr inbounds %"struct.rw::Error", ptr %15, i32 0, i32 0
  store i32 2816, ptr %88, align 4, !tbaa !9
  %89 = getelementptr inbounds %"struct.rw::Error", ptr %15, i32 0, i32 1
  store i32 -2147483644, ptr %89, align 4, !tbaa !12
  %90 = load ptr, ptr @stderr, align 8, !tbaa !5
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %90, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 2031) #6
  %92 = load ptr, ptr @stderr, align 8, !tbaa !5
  %93 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.13)
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef @.str.3, ptr noundef %93) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %15)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %95

95:                                               ; preds = %87
  br label %96

96:                                               ; preds = %95
  br label %419

97:                                               ; preds = %74
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = getelementptr inbounds %"struct.rw::Texture", ptr %99, i32 0, i32 4
  %101 = getelementptr inbounds [32 x i8], ptr %100, i64 0, i64 0
  %102 = load i32, ptr %4, align 4, !tbaa !13
  %103 = load ptr, ptr %98, align 8, !tbaa !17
  %104 = getelementptr inbounds ptr, ptr %103, i64 4
  %105 = load ptr, ptr %104, align 8
  %106 = call noundef i32 %105(ptr noundef nonnull align 8 dereferenceable(8) %98, ptr noundef %101, i32 noundef %102)
  %107 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !13
  store i32 %107, ptr %5, align 4, !tbaa !13
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %108, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %109, label %121, label %110

110:                                              ; preds = %97
  br label %111

111:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %112 = getelementptr inbounds %"struct.rw::Error", ptr %17, i32 0, i32 0
  store i32 2816, ptr %112, align 4, !tbaa !9
  %113 = getelementptr inbounds %"struct.rw::Error", ptr %17, i32 0, i32 1
  store i32 -2147483644, ptr %113, align 4, !tbaa !12
  %114 = load ptr, ptr @stderr, align 8, !tbaa !5
  %115 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 2040) #6
  %116 = load ptr, ptr @stderr, align 8, !tbaa !5
  %117 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.12)
  %118 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %116, ptr noundef @.str.3, ptr noundef %117) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %17)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %119

119:                                              ; preds = %111
  br label %120

120:                                              ; preds = %119
  br label %419

121:                                              ; preds = %97
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %122, i32 noundef 1, ptr noundef null, ptr noundef %6)
  br i1 %123, label %135, label %124

124:                                              ; preds = %121
  br label %125

125:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %126 = getelementptr inbounds %"struct.rw::Error", ptr %18, i32 0, i32 0
  store i32 2816, ptr %126, align 4, !tbaa !9
  %127 = getelementptr inbounds %"struct.rw::Error", ptr %18, i32 0, i32 1
  store i32 -2147483644, ptr %127, align 4, !tbaa !12
  %128 = load ptr, ptr @stderr, align 8, !tbaa !5
  %129 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %128, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 2044) #6
  %130 = load ptr, ptr @stderr, align 8, !tbaa !5
  %131 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.12)
  %132 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %130, ptr noundef @.str.3, ptr noundef %131) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %133

133:                                              ; preds = %125
  br label %134

134:                                              ; preds = %133
  br label %419

135:                                              ; preds = %121
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = load ptr, ptr %136, align 8, !tbaa !17
  %138 = getelementptr inbounds ptr, ptr %137, i64 4
  %139 = load ptr, ptr %138, align 8
  %140 = call noundef i32 %139(ptr noundef nonnull align 8 dereferenceable(8) %136, ptr noundef %16, i32 noundef 64)
  %141 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 4
  %142 = load i16, ptr %141, align 2, !tbaa !19
  %143 = sext i16 %142 to i32
  %144 = icmp slt i32 %143, 2
  %145 = zext i1 %144 to i32
  store i32 %145, ptr @_ZN2rw3ps2L17noNewStyleRastersE, align 4, !tbaa !13
  %146 = load i32, ptr %6, align 4, !tbaa !13
  store i32 %146, ptr @_ZN2rw7versionE, align 4, !tbaa !13
  %147 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 0
  %148 = load i32, ptr %147, align 8, !tbaa !23
  %149 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 1
  %150 = load i32, ptr %149, align 4, !tbaa !24
  %151 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 2
  %152 = load i32, ptr %151, align 8, !tbaa !25
  %153 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 3
  %154 = load i16, ptr %153, align 4, !tbaa !26
  %155 = zext i16 %154 to i32
  %156 = call noundef ptr @_ZN2rw6Raster6createEiiiii(i32 noundef %148, i32 noundef %150, i32 noundef %152, i32 noundef %155, i32 noundef 4)
  store ptr %156, ptr %8, align 8, !tbaa !5
  store i32 0, ptr @_ZN2rw3ps2L17noNewStyleRastersE, align 4, !tbaa !13
  %157 = load i32, ptr %5, align 4, !tbaa !13
  store i32 %157, ptr @_ZN2rw7versionE, align 4, !tbaa !13
  %158 = load ptr, ptr %8, align 8, !tbaa !5
  %159 = load ptr, ptr %13, align 8, !tbaa !5
  %160 = getelementptr inbounds %"struct.rw::Texture", ptr %159, i32 0, i32 0
  store ptr %158, ptr %160, align 8, !tbaa !27
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  %162 = load i32, ptr @_ZN2rw3ps218nativeRasterOffsetE, align 4, !tbaa !13
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds i8, ptr %161, i64 %163
  store ptr %164, ptr %9, align 8, !tbaa !5
  %165 = load ptr, ptr %8, align 8, !tbaa !5
  %166 = load ptr, ptr %13, align 8, !tbaa !5
  %167 = getelementptr inbounds %"struct.rw::Texture", ptr %166, i32 0, i32 5
  %168 = load i32, ptr %167, align 8, !tbaa !14
  %169 = and i32 %168, 15
  call void @_ZN2rw3ps28calcTEX1EPNS_6RasterEPmi(ptr noundef %165, ptr noundef %19, i32 noundef %169)
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %170, i32 0, i32 7
  %172 = load i32, ptr %171, align 8, !tbaa !28
  %173 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 10
  %174 = load i32, ptr %173, align 8, !tbaa !30
  %175 = icmp uge i32 %172, %174
  br i1 %175, label %176, label %177

176:                                              ; preds = %135
  br label %179

177:                                              ; preds = %135
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.2, i32 noundef 2086, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

178:                                              ; No predecessors!
  br label %179

179:                                              ; preds = %178, %176
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %180, i32 0, i32 8
  %182 = load i32, ptr %181, align 4, !tbaa !31
  %183 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 11
  %184 = load i32, ptr %183, align 4, !tbaa !32
  %185 = icmp uge i32 %182, %184
  br i1 %185, label %186, label %187

186:                                              ; preds = %179
  br label %189

187:                                              ; preds = %179
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.2, i32 noundef 2087, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

188:                                              ; No predecessors!
  br label %189

189:                                              ; preds = %188, %186
  %190 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 5
  %191 = load i64, ptr %190, align 8, !tbaa !33
  %192 = and i64 %191, -16384
  store i64 %192, ptr %190, align 8, !tbaa !33
  %193 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 5
  %194 = load i64, ptr %193, align 8, !tbaa !33
  %195 = and i64 %194, -2251662374731777
  store i64 %195, ptr %193, align 8, !tbaa !33
  %196 = load ptr, ptr %9, align 8, !tbaa !5
  %197 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %196, i32 0, i32 0
  %198 = load i64, ptr %197, align 8, !tbaa !34
  %199 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 5
  %200 = load i64, ptr %199, align 8, !tbaa !33
  %201 = icmp eq i64 %198, %200
  br i1 %201, label %202, label %203

202:                                              ; preds = %189
  br label %205

203:                                              ; preds = %189
  call void @__assert_fail(ptr noundef @.str.16, ptr noundef @.str.2, i32 noundef 2114, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

204:                                              ; No predecessors!
  br label %205

205:                                              ; preds = %204, %202
  %206 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 5
  %207 = load i64, ptr %206, align 8, !tbaa !33
  %208 = load ptr, ptr %9, align 8, !tbaa !5
  %209 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %208, i32 0, i32 0
  store i64 %207, ptr %209, align 8, !tbaa !34
  %210 = load ptr, ptr %9, align 8, !tbaa !5
  %211 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %210, i32 0, i32 1
  %212 = load i32, ptr %211, align 8, !tbaa !35
  %213 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 6
  %214 = load i32, ptr %213, align 8, !tbaa !36
  %215 = icmp eq i32 %212, %214
  br i1 %215, label %216, label %217

216:                                              ; preds = %205
  br label %219

217:                                              ; preds = %205
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.2, i32 noundef 2116, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

218:                                              ; No predecessors!
  br label %219

219:                                              ; preds = %218, %216
  %220 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 6
  %221 = load i32, ptr %220, align 8, !tbaa !36
  %222 = load ptr, ptr %9, align 8, !tbaa !5
  %223 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %222, i32 0, i32 1
  store i32 %221, ptr %223, align 8, !tbaa !35
  %224 = load ptr, ptr %9, align 8, !tbaa !5
  %225 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %224, i32 0, i32 3
  %226 = load i8, ptr %225, align 2, !tbaa !37
  %227 = zext i8 %226 to i32
  %228 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 7
  %229 = load i32, ptr %228, align 4, !tbaa !38
  %230 = icmp eq i32 %227, %229
  br i1 %230, label %231, label %232

231:                                              ; preds = %219
  br label %234

232:                                              ; preds = %219
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.2, i32 noundef 2118, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

233:                                              ; No predecessors!
  br label %234

234:                                              ; preds = %233, %231
  %235 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 7
  %236 = load i32, ptr %235, align 4, !tbaa !38
  %237 = trunc i32 %236 to i8
  %238 = load ptr, ptr %9, align 8, !tbaa !5
  %239 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %238, i32 0, i32 3
  store i8 %237, ptr %239, align 2, !tbaa !37
  %240 = load ptr, ptr %9, align 8, !tbaa !5
  %241 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %240, i32 0, i32 5
  %242 = load i64, ptr %241, align 8, !tbaa !39
  %243 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 8
  %244 = load i64, ptr %243, align 8, !tbaa !40
  %245 = icmp eq i64 %242, %244
  br i1 %245, label %246, label %247

246:                                              ; preds = %234
  br label %249

247:                                              ; preds = %234
  call void @__assert_fail(ptr noundef @.str.19, ptr noundef @.str.2, i32 noundef 2120, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

248:                                              ; No predecessors!
  br label %249

249:                                              ; preds = %248, %246
  %250 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 8
  %251 = load i64, ptr %250, align 8, !tbaa !40
  %252 = load ptr, ptr %9, align 8, !tbaa !5
  %253 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %252, i32 0, i32 5
  store i64 %251, ptr %253, align 8, !tbaa !39
  %254 = load ptr, ptr %9, align 8, !tbaa !5
  %255 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %254, i32 0, i32 6
  %256 = load i64, ptr %255, align 8, !tbaa !41
  %257 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 9
  %258 = load i64, ptr %257, align 8, !tbaa !42
  %259 = icmp eq i64 %256, %258
  br i1 %259, label %260, label %261

260:                                              ; preds = %249
  br label %263

261:                                              ; preds = %249
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str.2, i32 noundef 2122, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

262:                                              ; No predecessors!
  br label %263

263:                                              ; preds = %262, %260
  %264 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 9
  %265 = load i64, ptr %264, align 8, !tbaa !42
  %266 = load ptr, ptr %9, align 8, !tbaa !5
  %267 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %266, i32 0, i32 6
  store i64 %265, ptr %267, align 8, !tbaa !41
  %268 = load ptr, ptr %9, align 8, !tbaa !5
  %269 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %268, i32 0, i32 7
  %270 = load i32, ptr %269, align 8, !tbaa !28
  %271 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 10
  %272 = load i32, ptr %271, align 8, !tbaa !30
  %273 = icmp eq i32 %270, %272
  br i1 %273, label %274, label %275

274:                                              ; preds = %263
  br label %277

275:                                              ; preds = %263
  call void @__assert_fail(ptr noundef @.str.21, ptr noundef @.str.2, i32 noundef 2124, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

276:                                              ; No predecessors!
  br label %277

277:                                              ; preds = %276, %274
  %278 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 10
  %279 = load i32, ptr %278, align 8, !tbaa !30
  %280 = load ptr, ptr %9, align 8, !tbaa !5
  %281 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %280, i32 0, i32 7
  store i32 %279, ptr %281, align 8, !tbaa !28
  %282 = load ptr, ptr %9, align 8, !tbaa !5
  %283 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %282, i32 0, i32 8
  %284 = load i32, ptr %283, align 4, !tbaa !31
  %285 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 11
  %286 = load i32, ptr %285, align 4, !tbaa !32
  %287 = icmp eq i32 %284, %286
  br i1 %287, label %288, label %289

288:                                              ; preds = %277
  br label %291

289:                                              ; preds = %277
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str.2, i32 noundef 2126, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

290:                                              ; No predecessors!
  br label %291

291:                                              ; preds = %290, %288
  %292 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 11
  %293 = load i32, ptr %292, align 4, !tbaa !32
  %294 = load ptr, ptr %9, align 8, !tbaa !5
  %295 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %294, i32 0, i32 8
  store i32 %293, ptr %295, align 4, !tbaa !31
  %296 = load ptr, ptr %9, align 8, !tbaa !5
  %297 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %296, i32 0, i32 9
  %298 = load i32, ptr %297, align 8, !tbaa !43
  %299 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 12
  %300 = load i32, ptr %299, align 8, !tbaa !44
  %301 = icmp eq i32 %298, %300
  br i1 %301, label %302, label %303

302:                                              ; preds = %291
  br label %305

303:                                              ; preds = %291
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.2, i32 noundef 2128, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

304:                                              ; No predecessors!
  br label %305

305:                                              ; preds = %304, %302
  %306 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 12
  %307 = load i32, ptr %306, align 8, !tbaa !44
  %308 = load ptr, ptr %9, align 8, !tbaa !5
  %309 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %308, i32 0, i32 9
  store i32 %307, ptr %309, align 8, !tbaa !43
  %310 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 13
  %311 = load i32, ptr %310, align 4, !tbaa !45
  %312 = trunc i32 %311 to i16
  %313 = load ptr, ptr %9, align 8, !tbaa !5
  %314 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %313, i32 0, i32 2
  store i16 %312, ptr %314, align 4, !tbaa !46
  %315 = load ptr, ptr %8, align 8, !tbaa !5
  %316 = load ptr, ptr %13, align 8, !tbaa !5
  %317 = getelementptr inbounds %"struct.rw::Texture", ptr %316, i32 0, i32 5
  %318 = load i32, ptr %317, align 8, !tbaa !14
  %319 = and i32 %318, 15
  call void @_ZN2rw3ps28calcTEX1EPNS_6RasterEPmi(ptr noundef %315, ptr noundef %19, i32 noundef %319)
  %320 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 4
  %321 = load i16, ptr %320, align 2, !tbaa !19
  %322 = sext i16 %321 to i32
  %323 = icmp slt i32 %322, 2
  br i1 %323, label %324, label %362

324:                                              ; preds = %305
  %325 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 4
  %326 = load i16, ptr %325, align 2, !tbaa !19
  %327 = sext i16 %326 to i32
  %328 = icmp eq i32 %327, 1
  br i1 %328, label %329, label %345

329:                                              ; preds = %324
  %330 = load ptr, ptr %9, align 8, !tbaa !5
  %331 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %330, i32 0, i32 10
  %332 = load i8, ptr %331, align 4, !tbaa !47
  %333 = sext i8 %332 to i32
  %334 = and i32 %333, 1
  %335 = icmp ne i32 %334, 0
  br i1 %335, label %343, label %336

336:                                              ; preds = %329
  %337 = load ptr, ptr %9, align 8, !tbaa !5
  %338 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %337, i32 0, i32 10
  %339 = load i8, ptr %338, align 4, !tbaa !47
  %340 = sext i8 %339 to i32
  %341 = or i32 %340, 2
  %342 = trunc i32 %341 to i8
  store i8 %342, ptr %338, align 4, !tbaa !47
  br label %344

343:                                              ; preds = %329
  call void @__assert_fail(ptr noundef @.str.24, ptr noundef @.str.2, i32 noundef 2147, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

344:                                              ; preds = %336
  br label %361

345:                                              ; preds = %324
  %346 = load ptr, ptr %9, align 8, !tbaa !5
  %347 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %346, i32 0, i32 10
  %348 = load i8, ptr %347, align 4, !tbaa !47
  %349 = sext i8 %348 to i32
  %350 = and i32 %349, 1
  %351 = icmp ne i32 %350, 0
  br i1 %351, label %359, label %352

352:                                              ; preds = %345
  %353 = load ptr, ptr %9, align 8, !tbaa !5
  %354 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %353, i32 0, i32 10
  %355 = load i8, ptr %354, align 4, !tbaa !47
  %356 = sext i8 %355 to i32
  %357 = and i32 %356, -3
  %358 = trunc i32 %357 to i8
  store i8 %358, ptr %354, align 4, !tbaa !47
  br label %360

359:                                              ; preds = %345
  call void @__assert_fail(ptr noundef @.str.24, ptr noundef @.str.2, i32 noundef 2153, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #7
  unreachable

360:                                              ; preds = %352
  br label %361

361:                                              ; preds = %360, %344
  br label %362

362:                                              ; preds = %361, %305
  %363 = load ptr, ptr %3, align 8, !tbaa !5
  %364 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %363, i32 noundef 1, ptr noundef %4, ptr noundef null)
  br i1 %364, label %376, label %365

365:                                              ; preds = %362
  br label %366

366:                                              ; preds = %365
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %367 = getelementptr inbounds %"struct.rw::Error", ptr %20, i32 0, i32 0
  store i32 2816, ptr %367, align 4, !tbaa !9
  %368 = getelementptr inbounds %"struct.rw::Error", ptr %20, i32 0, i32 1
  store i32 -2147483644, ptr %368, align 4, !tbaa !12
  %369 = load ptr, ptr @stderr, align 8, !tbaa !5
  %370 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %369, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 2158) #6
  %371 = load ptr, ptr @stderr, align 8, !tbaa !5
  %372 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.12)
  %373 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %371, ptr noundef @.str.3, ptr noundef %372) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %374

374:                                              ; preds = %366
  br label %375

375:                                              ; preds = %374
  br label %419

376:                                              ; preds = %362
  %377 = getelementptr inbounds %"struct.rw::ps2::StreamRasterExt", ptr %16, i32 0, i32 4
  %378 = load i16, ptr %377, align 2, !tbaa !19
  %379 = sext i16 %378 to i32
  %380 = icmp slt i32 %379, 2
  br i1 %380, label %381, label %391

381:                                              ; preds = %376
  %382 = load ptr, ptr %3, align 8, !tbaa !5
  %383 = load ptr, ptr %8, align 8, !tbaa !5
  %384 = getelementptr inbounds %"struct.rw::Raster", ptr %383, i32 0, i32 9
  %385 = load ptr, ptr %384, align 8, !tbaa !48
  %386 = load i32, ptr %4, align 4, !tbaa !13
  %387 = load ptr, ptr %382, align 8, !tbaa !17
  %388 = getelementptr inbounds ptr, ptr %387, i64 4
  %389 = load ptr, ptr %388, align 8
  %390 = call noundef i32 %389(ptr noundef nonnull align 8 dereferenceable(8) %382, ptr noundef %385, i32 noundef %386)
  br label %417

391:                                              ; preds = %376
  %392 = load ptr, ptr %3, align 8, !tbaa !5
  %393 = load ptr, ptr %8, align 8, !tbaa !5
  %394 = getelementptr inbounds %"struct.rw::Raster", ptr %393, i32 0, i32 11
  %395 = load ptr, ptr %394, align 8, !tbaa !50
  %396 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster::PixelPtr", ptr %395, i32 0, i32 0
  %397 = load ptr, ptr %396, align 8, !tbaa !51
  %398 = load ptr, ptr %9, align 8, !tbaa !5
  %399 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %398, i32 0, i32 7
  %400 = load i32, ptr %399, align 8, !tbaa !28
  %401 = load ptr, ptr %392, align 8, !tbaa !17
  %402 = getelementptr inbounds ptr, ptr %401, i64 4
  %403 = load ptr, ptr %402, align 8
  %404 = call noundef i32 %403(ptr noundef nonnull align 8 dereferenceable(8) %392, ptr noundef %397, i32 noundef %400)
  %405 = load ptr, ptr %3, align 8, !tbaa !5
  %406 = load ptr, ptr %8, align 8, !tbaa !5
  %407 = getelementptr inbounds %"struct.rw::Raster", ptr %406, i32 0, i32 10
  %408 = load ptr, ptr %407, align 8, !tbaa !53
  %409 = getelementptr inbounds i8, ptr %408, i64 -80
  %410 = load ptr, ptr %9, align 8, !tbaa !5
  %411 = getelementptr inbounds %"struct.rw::ps2::Ps2Raster", ptr %410, i32 0, i32 8
  %412 = load i32, ptr %411, align 4, !tbaa !31
  %413 = load ptr, ptr %405, align 8, !tbaa !17
  %414 = getelementptr inbounds ptr, ptr %413, i64 4
  %415 = load ptr, ptr %414, align 8
  %416 = call noundef i32 %415(ptr noundef nonnull align 8 dereferenceable(8) %405, ptr noundef %409, i32 noundef %412)
  br label %417

417:                                              ; preds = %391, %381
  %418 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %418, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %421

419:                                              ; preds = %375, %134, %120, %96, %73
  %420 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_ZN2rw7Texture7destroyEv(ptr noundef nonnull align 8 dereferenceable(120) %420)
  store ptr null, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %421

421:                                              ; preds = %419, %417, %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %422

422:                                              ; preds = %421, %50, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %423 = load ptr, ptr %2, align 8
  ret ptr %423
}

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

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

declare noundef ptr @_ZN2rw7Texture6createEPNS_6RasterE(ptr noundef) #2

declare noundef ptr @_ZN2rw6Raster6createEiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

declare void @_ZN2rw7Texture7destroyEv(ptr noundef nonnull align 8 dereferenceable(120)) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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, !11, i64 0}
!10 = !{!"_ZTSN2rw5ErrorE", !11, i64 0, !11, i64 4}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !11, i64 96}
!15 = !{!"_ZTSN2rw7TextureE", !6, i64 0, !6, i64 8, !16, i64 16, !7, i64 32, !7, i64 64, !11, i64 96, !11, i64 100, !16, i64 104}
!16 = !{!"_ZTSN2rw6LLLinkE", !6, i64 0, !6, i64 8}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !8, i64 0}
!19 = !{!20, !21, i64 14}
!20 = !{!"_ZTSN2rw3ps215StreamRasterExtE", !11, i64 0, !11, i64 4, !11, i64 8, !21, i64 12, !21, i64 14, !22, i64 16, !11, i64 24, !11, i64 28, !22, i64 32, !22, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60}
!21 = !{!"short", !7, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!20, !11, i64 0}
!24 = !{!20, !11, i64 4}
!25 = !{!20, !11, i64 8}
!26 = !{!20, !21, i64 12}
!27 = !{!15, !6, i64 0}
!28 = !{!29, !11, i64 32}
!29 = !{!"_ZTSN2rw3ps29Ps2RasterE", !22, i64 0, !11, i64 8, !21, i64 12, !7, i64 14, !7, i64 15, !22, i64 16, !22, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !7, i64 44, !6, i64 48, !11, i64 56}
!30 = !{!20, !11, i64 48}
!31 = !{!29, !11, i64 36}
!32 = !{!20, !11, i64 52}
!33 = !{!20, !22, i64 16}
!34 = !{!29, !22, i64 0}
!35 = !{!29, !11, i64 8}
!36 = !{!20, !11, i64 24}
!37 = !{!29, !7, i64 14}
!38 = !{!20, !11, i64 28}
!39 = !{!29, !22, i64 16}
!40 = !{!20, !22, i64 32}
!41 = !{!29, !22, i64 24}
!42 = !{!20, !22, i64 40}
!43 = !{!29, !11, i64 40}
!44 = !{!20, !11, i64 56}
!45 = !{!20, !11, i64 60}
!46 = !{!29, !21, i64 12}
!47 = !{!29, !7, i64 44}
!48 = !{!49, !6, i64 40}
!49 = !{!"_ZTSN2rw6RasterE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !6, i64 80, !11, i64 88, !11, i64 92}
!50 = !{!49, !6, i64 56}
!51 = !{!52, !6, i64 0}
!52 = !{!"_ZTSN2rw3ps29Ps2Raster8PixelPtrE", !6, i64 0, !11, i64 8, !11, i64 12}
!53 = !{!49, !6, i64 48}


; 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::Error" = type { i32, i32 }
%"struct.rw::ps2::StreamRasterExt" = type { i32, i32, i32, i16, i16, i64, i32, i32, i64, i64, i32, i32, i32, i32 }

@_ZN2rw3ps218nativeRasterOffsetE = external dso_local local_unnamed_addr global i32, align 4
@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 [65 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZN2rw7versionE = external local_unnamed_addr global i32, align 4
@_ZN2rw3ps2L17noNewStyleRastersE = external hidden local_unnamed_addr global i32, align 4
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE = external hidden unnamed_addr constant [46 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [20 x i8], align 1

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

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

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

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

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2rw3ps28calcTEX1EPNS_6RasterEPmi(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw3ps217readNativeTextureEPNS_6StreamE(ptr noundef %0) local_unnamed_addr #5 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.rw::Error", align 4
  %5 = alloca %"struct.rw::Error", align 4
  %6 = alloca %"struct.rw::Error", align 4
  %7 = alloca %"struct.rw::Error", align 4
  %8 = alloca %"struct.rw::ps2::StreamRasterExt", align 8
  %9 = alloca %"struct.rw::Error", align 4
  %10 = alloca %"struct.rw::Error", align 4
  %11 = alloca i64, align 8
  %12 = alloca %"struct.rw::Error", align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %13 = tail call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %0, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %13, label %21, label %14

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

21:                                               ; preds = %1
  %22 = tail call noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %.not = icmp eq i32 %22, 3298128
  br i1 %.not, label %30, label %23

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

30:                                               ; preds = %21
  %31 = tail call noundef ptr @_ZN2rw7Texture6createEPNS_6RasterE(ptr noundef null)
  %32 = icmp eq ptr %31, null
  br i1 %32, label %228, label %33

33:                                               ; preds = %30
  %34 = tail call noundef i32 @_ZN2rw6Stream7readU32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %35 = getelementptr inbounds i8, ptr %31, i64 96
  store i32 %34, ptr %35, align 8, !tbaa !13
  %36 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 2, ptr noundef nonnull %2, ptr noundef null)
  br i1 %36, label %44, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i32 2816, ptr %6, align 4, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %6, i64 4
  store i32 -2147483644, ptr %38, align 4, !tbaa !10
  %39 = load ptr, ptr @stderr, align 8, !tbaa !11
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 2026) #7
  %41 = load ptr, ptr @stderr, align 8, !tbaa !11
  %42 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.13)
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef nonnull @.str.3, ptr noundef %42) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %227

44:                                               ; preds = %33
  %45 = getelementptr inbounds i8, ptr %31, i64 32
  %46 = load i32, ptr %2, align 4, !tbaa !16
  %47 = load ptr, ptr %0, align 8, !tbaa !17
  %48 = getelementptr inbounds i8, ptr %47, i64 32
  %49 = load ptr, ptr %48, align 8
  %50 = call noundef i32 %49(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %45, i32 noundef %46)
  %51 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 2, ptr noundef nonnull %2, ptr noundef null)
  br i1 %51, label %59, label %52

52:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  store i32 2816, ptr %7, align 4, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 -2147483644, ptr %53, align 4, !tbaa !10
  %54 = load ptr, ptr @stderr, align 8, !tbaa !11
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 2031) #7
  %56 = load ptr, ptr @stderr, align 8, !tbaa !11
  %57 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.13)
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef nonnull @.str.3, ptr noundef %57) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %227

59:                                               ; preds = %44
  %60 = getelementptr inbounds i8, ptr %31, i64 64
  %61 = load i32, ptr %2, align 4, !tbaa !16
  %62 = load ptr, ptr %0, align 8, !tbaa !17
  %63 = getelementptr inbounds i8, ptr %62, i64 32
  %64 = load ptr, ptr %63, align 8
  %65 = call noundef i32 %64(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %60, i32 noundef %61)
  %66 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !16
  %67 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %67, label %75, label %68

68:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  store i32 2816, ptr %9, align 4, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %9, i64 4
  store i32 -2147483644, ptr %69, align 4, !tbaa !10
  %70 = load ptr, ptr @stderr, align 8, !tbaa !11
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 2040) #7
  %72 = load ptr, ptr @stderr, align 8, !tbaa !11
  %73 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.12)
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef nonnull @.str.3, ptr noundef %73) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %227

75:                                               ; preds = %59
  %76 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 1, ptr noundef null, ptr noundef nonnull %3)
  br i1 %76, label %84, label %77

77:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  store i32 2816, ptr %10, align 4, !tbaa !5
  %78 = getelementptr inbounds i8, ptr %10, i64 4
  store i32 -2147483644, ptr %78, align 4, !tbaa !10
  %79 = load ptr, ptr @stderr, align 8, !tbaa !11
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 2044) #7
  %81 = load ptr, ptr @stderr, align 8, !tbaa !11
  %82 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.12)
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef nonnull @.str.3, ptr noundef %82) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br label %227

84:                                               ; preds = %75
  %85 = load ptr, ptr %0, align 8, !tbaa !17
  %86 = getelementptr inbounds i8, ptr %85, i64 32
  %87 = load ptr, ptr %86, align 8
  %88 = call noundef i32 %87(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %8, i32 noundef 64)
  %89 = getelementptr inbounds i8, ptr %8, i64 14
  %90 = load i16, ptr %89, align 2, !tbaa !19
  %91 = icmp slt i16 %90, 2
  %92 = zext i1 %91 to i32
  store i32 %92, ptr @_ZN2rw3ps2L17noNewStyleRastersE, align 4, !tbaa !16
  %93 = load i32, ptr %3, align 4, !tbaa !16
  store i32 %93, ptr @_ZN2rw7versionE, align 4, !tbaa !16
  %94 = load i32, ptr %8, align 8, !tbaa !23
  %95 = getelementptr inbounds i8, ptr %8, i64 4
  %96 = load i32, ptr %95, align 4, !tbaa !24
  %97 = getelementptr inbounds i8, ptr %8, i64 8
  %98 = load i32, ptr %97, align 8, !tbaa !25
  %99 = getelementptr inbounds i8, ptr %8, i64 12
  %100 = load i16, ptr %99, align 4, !tbaa !26
  %101 = zext i16 %100 to i32
  %102 = call noundef ptr @_ZN2rw6Raster6createEiiiii(i32 noundef %94, i32 noundef %96, i32 noundef %98, i32 noundef %101, i32 noundef 4)
  store i32 0, ptr @_ZN2rw3ps2L17noNewStyleRastersE, align 4, !tbaa !16
  store i32 %66, ptr @_ZN2rw7versionE, align 4, !tbaa !16
  store ptr %102, ptr %31, align 8, !tbaa !27
  %103 = load i32, ptr @_ZN2rw3ps218nativeRasterOffsetE, align 4, !tbaa !16
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i8, ptr %102, i64 %104
  %106 = load i32, ptr %35, align 8, !tbaa !13
  %107 = and i32 %106, 15
  call void @_ZN2rw3ps28calcTEX1EPNS_6RasterEPmi(ptr noundef %102, ptr noundef nonnull %11, i32 noundef %107)
  %108 = getelementptr inbounds i8, ptr %105, i64 32
  %109 = load i32, ptr %108, align 8, !tbaa !28
  %110 = getelementptr inbounds i8, ptr %8, i64 48
  %111 = load i32, ptr %110, align 8, !tbaa !30
  %.not69 = icmp ult i32 %109, %111
  br i1 %.not69, label %112, label %113

112:                                              ; preds = %84
  call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.2, i32 noundef 2086, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

113:                                              ; preds = %84
  %114 = getelementptr inbounds i8, ptr %105, i64 36
  %115 = load i32, ptr %114, align 4, !tbaa !31
  %116 = getelementptr inbounds i8, ptr %8, i64 52
  %117 = load i32, ptr %116, align 4, !tbaa !32
  %.not70 = icmp ult i32 %115, %117
  br i1 %.not70, label %118, label %119

118:                                              ; preds = %113
  call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.2, i32 noundef 2087, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

119:                                              ; preds = %113
  %120 = getelementptr inbounds i8, ptr %8, i64 16
  %121 = load i64, ptr %120, align 8, !tbaa !33
  %122 = and i64 %121, -2251662374748160
  store i64 %122, ptr %120, align 8, !tbaa !33
  %123 = load i64, ptr %105, align 8, !tbaa !34
  %124 = icmp eq i64 %123, %122
  br i1 %124, label %126, label %125

125:                                              ; preds = %119
  call void @__assert_fail(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.2, i32 noundef 2114, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

126:                                              ; preds = %119
  %127 = getelementptr inbounds i8, ptr %105, i64 8
  %128 = load i32, ptr %127, align 8, !tbaa !35
  %129 = getelementptr inbounds i8, ptr %8, i64 24
  %130 = load i32, ptr %129, align 8, !tbaa !36
  %131 = icmp eq i32 %128, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %126
  call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.2, i32 noundef 2116, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

133:                                              ; preds = %126
  %134 = getelementptr inbounds i8, ptr %105, i64 14
  %135 = load i8, ptr %134, align 2, !tbaa !37
  %136 = zext i8 %135 to i32
  %137 = getelementptr inbounds i8, ptr %8, i64 28
  %138 = load i32, ptr %137, align 4, !tbaa !38
  %139 = icmp eq i32 %138, %136
  br i1 %139, label %141, label %140

140:                                              ; preds = %133
  call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.2, i32 noundef 2118, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

141:                                              ; preds = %133
  %142 = getelementptr inbounds i8, ptr %105, i64 16
  %143 = load i64, ptr %142, align 8, !tbaa !39
  %144 = getelementptr inbounds i8, ptr %8, i64 32
  %145 = load i64, ptr %144, align 8, !tbaa !40
  %146 = icmp eq i64 %143, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %141
  call void @__assert_fail(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.2, i32 noundef 2120, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

148:                                              ; preds = %141
  %149 = getelementptr inbounds i8, ptr %105, i64 24
  %150 = load i64, ptr %149, align 8, !tbaa !41
  %151 = getelementptr inbounds i8, ptr %8, i64 40
  %152 = load i64, ptr %151, align 8, !tbaa !42
  %153 = icmp eq i64 %150, %152
  br i1 %153, label %155, label %154

154:                                              ; preds = %148
  call void @__assert_fail(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.2, i32 noundef 2122, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

155:                                              ; preds = %148
  %156 = icmp eq i32 %109, %111
  br i1 %156, label %158, label %157

157:                                              ; preds = %155
  call void @__assert_fail(ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.2, i32 noundef 2124, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

158:                                              ; preds = %155
  %159 = icmp eq i32 %115, %117
  br i1 %159, label %161, label %160

160:                                              ; preds = %158
  call void @__assert_fail(ptr noundef nonnull @.str.22, ptr noundef nonnull @.str.2, i32 noundef 2126, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

161:                                              ; preds = %158
  %162 = getelementptr inbounds i8, ptr %105, i64 40
  %163 = load i32, ptr %162, align 8, !tbaa !43
  %164 = getelementptr inbounds i8, ptr %8, i64 56
  %165 = load i32, ptr %164, align 8, !tbaa !44
  %166 = icmp eq i32 %163, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %161
  call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.2, i32 noundef 2128, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

168:                                              ; preds = %161
  %169 = getelementptr inbounds i8, ptr %8, i64 60
  %170 = load i32, ptr %169, align 4, !tbaa !45
  %171 = trunc i32 %170 to i16
  %172 = getelementptr inbounds i8, ptr %105, i64 12
  store i16 %171, ptr %172, align 4, !tbaa !46
  %173 = load i32, ptr %35, align 8, !tbaa !13
  %174 = and i32 %173, 15
  call void @_ZN2rw3ps28calcTEX1EPNS_6RasterEPmi(ptr noundef nonnull %102, ptr noundef nonnull %11, i32 noundef %174)
  %175 = load i16, ptr %89, align 2, !tbaa !19
  %176 = icmp slt i16 %175, 2
  br i1 %176, label %177, label %190

177:                                              ; preds = %168
  %178 = icmp eq i16 %175, 1
  %179 = getelementptr inbounds i8, ptr %105, i64 44
  %180 = load i8, ptr %179, align 4, !tbaa !47
  %181 = and i8 %180, 1
  %.not72 = icmp eq i8 %181, 0
  br i1 %178, label %182, label %186

182:                                              ; preds = %177
  br i1 %.not72, label %183, label %185

183:                                              ; preds = %182
  %184 = or i8 %180, 2
  br label %.sink.split

185:                                              ; preds = %182
  call void @__assert_fail(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.2, i32 noundef 2147, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

186:                                              ; preds = %177
  br i1 %.not72, label %187, label %189

187:                                              ; preds = %186
  %188 = and i8 %180, -4
  br label %.sink.split

189:                                              ; preds = %186
  call void @__assert_fail(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.2, i32 noundef 2153, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3ps217readNativeTextureEPNS_6StreamE) #8
  unreachable

.sink.split:                                      ; preds = %187, %183
  %.sink = phi i8 [ %184, %183 ], [ %188, %187 ]
  store i8 %.sink, ptr %179, align 4, !tbaa !47
  br label %190

190:                                              ; preds = %.sink.split, %168
  %191 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef null)
  br i1 %191, label %199, label %192

192:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  store i32 2816, ptr %12, align 4, !tbaa !5
  %193 = getelementptr inbounds i8, ptr %12, i64 4
  store i32 -2147483644, ptr %193, align 4, !tbaa !10
  %194 = load ptr, ptr @stderr, align 8, !tbaa !11
  %195 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %194, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 2158) #7
  %196 = load ptr, ptr @stderr, align 8, !tbaa !11
  %197 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.12)
  %198 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %196, ptr noundef nonnull @.str.3, ptr noundef %197) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  br label %227

199:                                              ; preds = %190
  %200 = load i16, ptr %89, align 2, !tbaa !19
  %201 = icmp slt i16 %200, 2
  br i1 %201, label %202, label %210

202:                                              ; preds = %199
  %203 = getelementptr inbounds i8, ptr %102, i64 40
  %204 = load ptr, ptr %203, align 8, !tbaa !48
  %205 = load i32, ptr %2, align 4, !tbaa !16
  %206 = load ptr, ptr %0, align 8, !tbaa !17
  %207 = getelementptr inbounds i8, ptr %206, i64 32
  %208 = load ptr, ptr %207, align 8
  %209 = call noundef i32 %208(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %204, i32 noundef %205)
  br label %228

210:                                              ; preds = %199
  %211 = getelementptr inbounds i8, ptr %102, i64 56
  %212 = load ptr, ptr %211, align 8, !tbaa !50
  %213 = load ptr, ptr %212, align 8, !tbaa !51
  %214 = load i32, ptr %108, align 8, !tbaa !28
  %215 = load ptr, ptr %0, align 8, !tbaa !17
  %216 = getelementptr inbounds i8, ptr %215, i64 32
  %217 = load ptr, ptr %216, align 8
  %218 = call noundef i32 %217(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %213, i32 noundef %214)
  %219 = getelementptr inbounds i8, ptr %102, i64 48
  %220 = load ptr, ptr %219, align 8, !tbaa !53
  %221 = getelementptr inbounds i8, ptr %220, i64 -80
  %222 = load i32, ptr %114, align 4, !tbaa !31
  %223 = load ptr, ptr %0, align 8, !tbaa !17
  %224 = getelementptr inbounds i8, ptr %223, i64 32
  %225 = load ptr, ptr %224, align 8
  %226 = call noundef i32 %225(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %221, i32 noundef %222)
  br label %228

227:                                              ; preds = %192, %77, %68, %52, %37
  call void @_ZN2rw7Texture7destroyEv(ptr noundef nonnull align 8 dereferenceable(120) %31)
  br label %228

228:                                              ; preds = %227, %30, %210, %202, %23, %14
  %.1 = phi ptr [ null, %23 ], [ null, %14 ], [ null, %227 ], [ null, %30 ], [ %31, %210 ], [ %31, %202 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  ret ptr %.1
}

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

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

declare noundef ptr @_ZN2rw7Texture6createEPNS_6RasterE(ptr noundef) local_unnamed_addr #2

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

declare void @_ZN2rw7Texture7destroyEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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, !7, i64 96}
!14 = !{!"_ZTSN2rw7TextureE", !12, i64 0, !12, i64 8, !15, i64 16, !8, i64 32, !8, i64 64, !7, i64 96, !7, i64 100, !15, i64 104}
!15 = !{!"_ZTSN2rw6LLLinkE", !12, i64 0, !12, i64 8}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !9, i64 0}
!19 = !{!20, !21, i64 14}
!20 = !{!"_ZTSN2rw3ps215StreamRasterExtE", !7, i64 0, !7, i64 4, !7, i64 8, !21, i64 12, !21, i64 14, !22, i64 16, !7, i64 24, !7, i64 28, !22, i64 32, !22, i64 40, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60}
!21 = !{!"short", !8, i64 0}
!22 = !{!"long", !8, i64 0}
!23 = !{!20, !7, i64 0}
!24 = !{!20, !7, i64 4}
!25 = !{!20, !7, i64 8}
!26 = !{!20, !21, i64 12}
!27 = !{!14, !12, i64 0}
!28 = !{!29, !7, i64 32}
!29 = !{!"_ZTSN2rw3ps29Ps2RasterE", !22, i64 0, !7, i64 8, !21, i64 12, !8, i64 14, !8, i64 15, !22, i64 16, !22, i64 24, !7, i64 32, !7, i64 36, !7, i64 40, !8, i64 44, !12, i64 48, !7, i64 56}
!30 = !{!20, !7, i64 48}
!31 = !{!29, !7, i64 36}
!32 = !{!20, !7, i64 52}
!33 = !{!20, !22, i64 16}
!34 = !{!29, !22, i64 0}
!35 = !{!29, !7, i64 8}
!36 = !{!20, !7, i64 24}
!37 = !{!29, !8, i64 14}
!38 = !{!20, !7, i64 28}
!39 = !{!29, !22, i64 16}
!40 = !{!20, !22, i64 32}
!41 = !{!29, !22, i64 24}
!42 = !{!20, !22, i64 40}
!43 = !{!29, !7, i64 40}
!44 = !{!20, !7, i64 56}
!45 = !{!20, !7, i64 60}
!46 = !{!29, !21, i64 12}
!47 = !{!29, !8, i64 44}
!48 = !{!49, !12, i64 40}
!49 = !{!"_ZTSN2rw6RasterE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !7, i64 64, !7, i64 68, !7, i64 72, !12, i64 80, !7, i64 88, !7, i64 92}
!50 = !{!49, !12, i64 56}
!51 = !{!52, !12, i64 0}
!52 = !{!"_ZTSN2rw3ps29Ps2Raster8PixelPtrE", !12, i64 0, !7, i64 8, !7, i64 12}
!53 = !{!49, !12, i64 48}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass