; LLVM IR from aap/librw :: src/clump.ll (ZN2rw5Clump10streamReadEPNS_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::MemoryFunctions" = type { ptr, ptr, ptr, ptr, ptr }
%"struct.rw::Error" = type { i32, i32 }
%"struct.rw::FrameList_" = type { i32, ptr }

@_ZN2rw5Clump9s_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 [57 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZN2rw6Engine8memfuncsE = external global %"struct.rw::MemoryFunctions", align 8
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2rw5Clump8setFrameEPNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) #5 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw5Clump10streamReadEPNS_6StreamE(ptr noundef %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [3 x i32], align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %"struct.rw::Error", align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.rw::FrameList_", align 8
  %16 = alloca %"struct.rw::Error", align 4
  %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
  %21 = alloca i32, align 4
  %22 = alloca %"struct.rw::Error", align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca %"struct.rw::Error", align 4
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca %"struct.rw::Error", align 4
  %30 = alloca %"struct.rw::Error", align 4
  %31 = alloca ptr, align 8
  %32 = alloca i32, align 4
  %33 = alloca %"struct.rw::Error", align 4
  %34 = alloca %"struct.rw::Error", align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %37, i32 noundef 1, ptr noundef %4, ptr noundef %5)
  br i1 %38, label %50, label %39

39:                                               ; preds = %1
  br label %40

40:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %41 = getelementptr inbounds %"struct.rw::Error", ptr %10, i32 0, i32 0
  store i32 2, ptr %41, align 4, !tbaa !9
  %42 = getelementptr inbounds %"struct.rw::Error", ptr %10, i32 0, i32 1
  store i32 -2147483644, 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.2, ptr noundef @.str.3, i32 noundef 157) #7
  %45 = load ptr, ptr @stderr, align 8, !tbaa !5
  %46 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.12)
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef @.str.4, ptr noundef %46) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %48

48:                                               ; preds = %40
  br label %49

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

50:                                               ; preds = %1
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds [3 x i32], ptr %6, i64 0, i64 0
  %53 = load i32, ptr %4, align 4, !tbaa !13
  %54 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef %52, i32 noundef %53)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %55 = getelementptr inbounds [3 x i32], ptr %6, i64 0, i64 0
  %56 = load i32, ptr %55, align 4, !tbaa !13
  store i32 %56, ptr %12, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !13
  %57 = load i32, ptr %5, align 4, !tbaa !13
  %58 = icmp ugt i32 %57, 208896
  br i1 %58, label %59, label %64

59:                                               ; preds = %50
  %60 = getelementptr inbounds [3 x i32], ptr %6, i64 0, i64 1
  %61 = load i32, ptr %60, align 4, !tbaa !13
  store i32 %61, ptr %13, align 4, !tbaa !13
  %62 = getelementptr inbounds [3 x i32], ptr %6, i64 0, i64 2
  %63 = load i32, ptr %62, align 4, !tbaa !13
  store i32 %63, ptr %14, align 4, !tbaa !13
  br label %64

64:                                               ; preds = %59, %50
  %65 = call noundef ptr @_ZN2rw5Clump6createEv()
  store ptr %65, ptr %7, align 8, !tbaa !5
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = icmp eq ptr %66, null
  br i1 %67, label %68, label %69

68:                                               ; preds = %64
  store ptr null, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %413

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #7
  %70 = getelementptr inbounds %"struct.rw::FrameList_", ptr %15, i32 0, i32 1
  store ptr null, ptr %70, align 8, !tbaa !14
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %71, i32 noundef 14, ptr noundef null, ptr noundef null)
  br i1 %72, label %84, label %73

73:                                               ; preds = %69
  br label %74

74:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %75 = getelementptr inbounds %"struct.rw::Error", ptr %16, i32 0, i32 0
  store i32 2, ptr %75, align 4, !tbaa !9
  %76 = getelementptr inbounds %"struct.rw::Error", ptr %16, i32 0, i32 1
  store i32 -2147483644, ptr %76, align 4, !tbaa !12
  %77 = load ptr, ptr @stderr, align 8, !tbaa !5
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 176) #7
  %79 = load ptr, ptr @stderr, align 8, !tbaa !5
  %80 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.13)
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef @.str.4, ptr noundef %80) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %82

82:                                               ; preds = %74
  br label %83

83:                                               ; preds = %82
  br label %407

84:                                               ; preds = %69
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = call noundef ptr @_ZN2rw10FrameList_10streamReadEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef %85)
  %87 = icmp eq ptr %86, null
  br i1 %87, label %88, label %89

88:                                               ; preds = %84
  br label %407

89:                                               ; preds = %84
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %"struct.rw::FrameList_", ptr %15, i32 0, i32 1
  %92 = load ptr, ptr %91, align 8, !tbaa !14
  %93 = getelementptr inbounds ptr, ptr %92, i64 0
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  call void @_ZN2rw5Clump8setFrameEPNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(88) %90, ptr noundef %94)
  store i32 0, ptr %8, align 4, !tbaa !13
  store ptr null, ptr %9, align 8, !tbaa !5
  %95 = load i32, ptr %5, align 4, !tbaa !13
  %96 = icmp uge i32 %95, 197632
  br i1 %96, label %97, label %197

97:                                               ; preds = %89
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %98, i32 noundef 26, ptr noundef null, ptr noundef null)
  br i1 %99, label %111, label %100

100:                                              ; preds = %97
  br label %101

101:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %102 = getelementptr inbounds %"struct.rw::Error", ptr %17, i32 0, i32 0
  store i32 2, ptr %102, align 4, !tbaa !9
  %103 = getelementptr inbounds %"struct.rw::Error", ptr %17, i32 0, i32 1
  store i32 -2147483644, ptr %103, align 4, !tbaa !12
  %104 = load ptr, ptr @stderr, align 8, !tbaa !5
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 188) #7
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.14)
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str.4, ptr noundef %107) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %17)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %109

109:                                              ; preds = %101
  br label %110

110:                                              ; preds = %109
  br label %407

111:                                              ; preds = %97
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %112, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %113, label %125, label %114

114:                                              ; preds = %111
  br label %115

115:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %116 = getelementptr inbounds %"struct.rw::Error", ptr %18, i32 0, i32 0
  store i32 2, ptr %116, align 4, !tbaa !9
  %117 = getelementptr inbounds %"struct.rw::Error", ptr %18, i32 0, i32 1
  store i32 -2147483644, ptr %117, align 4, !tbaa !12
  %118 = load ptr, ptr @stderr, align 8, !tbaa !5
  %119 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 192) #7
  %120 = load ptr, ptr @stderr, align 8, !tbaa !5
  %121 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.12)
  %122 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %120, ptr noundef @.str.4, ptr noundef %121) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %123

123:                                              ; preds = %115
  br label %124

124:                                              ; preds = %123
  br label %407

125:                                              ; preds = %111
  %126 = load ptr, ptr %3, align 8, !tbaa !5
  %127 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %126)
  store i32 %127, ptr %8, align 4, !tbaa !13
  %128 = load i32, ptr %8, align 4, !tbaa !13
  %129 = icmp ne i32 %128, 0
  br i1 %129, label %130, label %156

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %131 = load i32, ptr %8, align 4, !tbaa !13
  %132 = sext i32 %131 to i64
  %133 = mul i64 %132, 8
  store i64 %133, ptr %19, align 8, !tbaa !16
  %134 = load i64, ptr %19, align 8, !tbaa !16
  %135 = call noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef %134, i32 noundef 65552, ptr noundef @.str.15)
  store ptr %135, ptr %9, align 8, !tbaa !5
  %136 = load ptr, ptr %9, align 8, !tbaa !5
  %137 = icmp eq ptr %136, null
  br i1 %137, label %138, label %150

138:                                              ; preds = %130
  br label %139

139:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %140 = getelementptr inbounds %"struct.rw::Error", ptr %20, i32 0, i32 0
  store i32 2, ptr %140, align 4, !tbaa !9
  %141 = getelementptr inbounds %"struct.rw::Error", ptr %20, i32 0, i32 1
  store i32 -2147483646, ptr %141, align 4, !tbaa !12
  %142 = load ptr, ptr @stderr, align 8, !tbaa !5
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 200) #7
  %144 = load ptr, ptr @stderr, align 8, !tbaa !5
  %145 = load i64, ptr %19, align 8, !tbaa !16
  %146 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483646, i64 noundef %145)
  %147 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %144, ptr noundef @.str.4, ptr noundef %146) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %148

148:                                              ; preds = %139
  br label %149

149:                                              ; preds = %148
  store i32 6, ptr %11, align 4
  br label %153

150:                                              ; preds = %130
  %151 = load ptr, ptr %9, align 8, !tbaa !5
  %152 = load i64, ptr %19, align 8, !tbaa !16
  call void @llvm.memset.p0.i64(ptr align 8 %151, i8 0, i64 %152, i1 false)
  store i32 0, ptr %11, align 4
  br label %153

153:                                              ; preds = %150, %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  %154 = load i32, ptr %11, align 4
  switch i32 %154, label %412 [
    i32 0, label %155
    i32 6, label %407
  ]

155:                                              ; preds = %153
  br label %156

156:                                              ; preds = %155, %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !13
  br label %157

157:                                              ; preds = %191, %156
  %158 = load i32, ptr %21, align 4, !tbaa !13
  %159 = load i32, ptr %8, align 4, !tbaa !13
  %160 = icmp slt i32 %158, %159
  br i1 %160, label %162, label %161

161:                                              ; preds = %157
  store i32 13, ptr %11, align 4
  br label %194

162:                                              ; preds = %157
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %163, i32 noundef 15, ptr noundef null, ptr noundef null)
  br i1 %164, label %176, label %165

165:                                              ; preds = %162
  br label %166

166:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %167 = getelementptr inbounds %"struct.rw::Error", ptr %22, i32 0, i32 0
  store i32 2, ptr %167, align 4, !tbaa !9
  %168 = getelementptr inbounds %"struct.rw::Error", ptr %22, i32 0, i32 1
  store i32 -2147483644, ptr %168, align 4, !tbaa !12
  %169 = load ptr, ptr @stderr, align 8, !tbaa !5
  %170 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %169, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 207) #7
  %171 = load ptr, ptr @stderr, align 8, !tbaa !5
  %172 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.16)
  %173 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %171, ptr noundef @.str.4, ptr noundef %172) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %22)
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %174

174:                                              ; preds = %166
  br label %175

175:                                              ; preds = %174
  store i32 18, ptr %11, align 4
  br label %194

176:                                              ; preds = %162
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = call noundef ptr @_ZN2rw8Geometry10streamReadEPNS_6StreamE(ptr noundef %177)
  %179 = load ptr, ptr %9, align 8, !tbaa !5
  %180 = load i32, ptr %21, align 4, !tbaa !13
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds ptr, ptr %179, i64 %181
  store ptr %178, ptr %182, align 8, !tbaa !5
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  %184 = load i32, ptr %21, align 4, !tbaa !13
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds ptr, ptr %183, i64 %185
  %187 = load ptr, ptr %186, align 8, !tbaa !5
  %188 = icmp eq ptr %187, null
  br i1 %188, label %189, label %190

189:                                              ; preds = %176
  store i32 18, ptr %11, align 4
  br label %194

190:                                              ; preds = %176
  br label %191

191:                                              ; preds = %190
  %192 = load i32, ptr %21, align 4, !tbaa !13
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %21, align 4, !tbaa !13
  br label %157, !llvm.loop !18

194:                                              ; preds = %189, %175, %161
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  %195 = load i32, ptr %11, align 4
  switch i32 %195, label %412 [
    i32 13, label %196
    i32 18, label %381
  ]

196:                                              ; preds = %194
  br label %197

197:                                              ; preds = %196, %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 0, ptr %24, align 4, !tbaa !13
  br label %198

198:                                              ; preds = %227, %197
  %199 = load i32, ptr %24, align 4, !tbaa !13
  %200 = load i32, ptr %12, align 4, !tbaa !13
  %201 = icmp slt i32 %199, %200
  br i1 %201, label %203, label %202

202:                                              ; preds = %198
  store i32 19, ptr %11, align 4
  br label %230

203:                                              ; preds = %198
  %204 = load ptr, ptr %3, align 8, !tbaa !5
  %205 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %204, i32 noundef 20, ptr noundef null, ptr noundef null)
  br i1 %205, label %217, label %206

206:                                              ; preds = %203
  br label %207

207:                                              ; preds = %206
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %208 = getelementptr inbounds %"struct.rw::Error", ptr %25, i32 0, i32 0
  store i32 2, ptr %208, align 4, !tbaa !9
  %209 = getelementptr inbounds %"struct.rw::Error", ptr %25, i32 0, i32 1
  store i32 -2147483644, ptr %209, align 4, !tbaa !12
  %210 = load ptr, ptr @stderr, align 8, !tbaa !5
  %211 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %210, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 220) #7
  %212 = load ptr, ptr @stderr, align 8, !tbaa !5
  %213 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.17)
  %214 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %212, ptr noundef @.str.4, ptr noundef %213) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %25)
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %215

215:                                              ; preds = %207
  br label %216

216:                                              ; preds = %215
  store i32 18, ptr %11, align 4
  br label %230

217:                                              ; preds = %203
  %218 = load ptr, ptr %3, align 8, !tbaa !5
  %219 = load ptr, ptr %9, align 8, !tbaa !5
  %220 = call noundef ptr @_ZN2rw6Atomic15streamReadClumpEPNS_6StreamEPNS_10FrameList_EPPNS_8GeometryE(ptr noundef %218, ptr noundef %15, ptr noundef %219)
  store ptr %220, ptr %23, align 8, !tbaa !5
  %221 = load ptr, ptr %23, align 8, !tbaa !5
  %222 = icmp eq ptr %221, null
  br i1 %222, label %223, label %224

223:                                              ; preds = %217
  store i32 18, ptr %11, align 4
  br label %230

224:                                              ; preds = %217
  %225 = load ptr, ptr %7, align 8, !tbaa !5
  %226 = load ptr, ptr %23, align 8, !tbaa !5
  call void @_ZN2rw5Clump9addAtomicEPNS_6AtomicE(ptr noundef nonnull align 8 dereferenceable(88) %225, ptr noundef %226)
  br label %227

227:                                              ; preds = %224
  %228 = load i32, ptr %24, align 4, !tbaa !13
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %24, align 4, !tbaa !13
  br label %198, !llvm.loop !20

230:                                              ; preds = %223, %216, %202
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  %231 = load i32, ptr %11, align 4
  switch i32 %231, label %412 [
    i32 19, label %232
    i32 18, label %381
  ]

232:                                              ; preds = %230
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #7
  store i32 0, ptr %28, align 4, !tbaa !13
  br label %233

233:                                              ; preds = %284, %232
  %234 = load i32, ptr %28, align 4, !tbaa !13
  %235 = load i32, ptr %13, align 4, !tbaa !13
  %236 = icmp slt i32 %234, %235
  br i1 %236, label %238, label %237

237:                                              ; preds = %233
  store i32 24, ptr %11, align 4
  br label %287

238:                                              ; preds = %233
  %239 = load ptr, ptr %3, align 8, !tbaa !5
  %240 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %239, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %240, label %252, label %241

241:                                              ; preds = %238
  br label %242

242:                                              ; preds = %241
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  %243 = getelementptr inbounds %"struct.rw::Error", ptr %29, i32 0, i32 0
  store i32 2, ptr %243, align 4, !tbaa !9
  %244 = getelementptr inbounds %"struct.rw::Error", ptr %29, i32 0, i32 1
  store i32 -2147483644, ptr %244, align 4, !tbaa !12
  %245 = load ptr, ptr @stderr, align 8, !tbaa !5
  %246 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %245, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 234) #7
  %247 = load ptr, ptr @stderr, align 8, !tbaa !5
  %248 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.12)
  %249 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %247, ptr noundef @.str.4, ptr noundef %248) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %29)
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  br label %250

250:                                              ; preds = %242
  br label %251

251:                                              ; preds = %250
  store i32 18, ptr %11, align 4
  br label %287

252:                                              ; preds = %238
  %253 = load ptr, ptr %3, align 8, !tbaa !5
  %254 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %253)
  store i32 %254, ptr %26, align 4, !tbaa !13
  %255 = load ptr, ptr %3, align 8, !tbaa !5
  %256 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %255, i32 noundef 18, ptr noundef null, ptr noundef null)
  br i1 %256, label %268, label %257

257:                                              ; preds = %252
  br label %258

258:                                              ; preds = %257
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  %259 = getelementptr inbounds %"struct.rw::Error", ptr %30, i32 0, i32 0
  store i32 2, ptr %259, align 4, !tbaa !9
  %260 = getelementptr inbounds %"struct.rw::Error", ptr %30, i32 0, i32 1
  store i32 -2147483644, ptr %260, align 4, !tbaa !12
  %261 = load ptr, ptr @stderr, align 8, !tbaa !5
  %262 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %261, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 239) #7
  %263 = load ptr, ptr @stderr, align 8, !tbaa !5
  %264 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.18)
  %265 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %263, ptr noundef @.str.4, ptr noundef %264) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %30)
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  br label %266

266:                                              ; preds = %258
  br label %267

267:                                              ; preds = %266
  store i32 18, ptr %11, align 4
  br label %287

268:                                              ; preds = %252
  %269 = load ptr, ptr %3, align 8, !tbaa !5
  %270 = call noundef ptr @_ZN2rw5Light10streamReadEPNS_6StreamE(ptr noundef %269)
  store ptr %270, ptr %27, align 8, !tbaa !5
  %271 = load ptr, ptr %27, align 8, !tbaa !5
  %272 = icmp eq ptr %271, null
  br i1 %272, label %273, label %274

273:                                              ; preds = %268
  store i32 18, ptr %11, align 4
  br label %287

274:                                              ; preds = %268
  %275 = load ptr, ptr %27, align 8, !tbaa !5
  %276 = getelementptr inbounds %"struct.rw::FrameList_", ptr %15, i32 0, i32 1
  %277 = load ptr, ptr %276, align 8, !tbaa !14
  %278 = load i32, ptr %26, align 4, !tbaa !13
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds ptr, ptr %277, i64 %279
  %281 = load ptr, ptr %280, align 8, !tbaa !5
  call void @_ZN2rw5Light8setFrameEPNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(120) %275, ptr noundef %281)
  %282 = load ptr, ptr %7, align 8, !tbaa !5
  %283 = load ptr, ptr %27, align 8, !tbaa !5
  call void @_ZN2rw5Clump8addLightEPNS_5LightE(ptr noundef nonnull align 8 dereferenceable(88) %282, ptr noundef %283)
  br label %284

284:                                              ; preds = %274
  %285 = load i32, ptr %28, align 4, !tbaa !13
  %286 = add nsw i32 %285, 1
  store i32 %286, ptr %28, align 4, !tbaa !13
  br label %233, !llvm.loop !21

287:                                              ; preds = %273, %267, %251, %237
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  %288 = load i32, ptr %11, align 4
  switch i32 %288, label %412 [
    i32 24, label %289
    i32 18, label %381
  ]

289:                                              ; preds = %287
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #7
  store i32 0, ptr %32, align 4, !tbaa !13
  br label %290

290:                                              ; preds = %341, %289
  %291 = load i32, ptr %32, align 4, !tbaa !13
  %292 = load i32, ptr %14, align 4, !tbaa !13
  %293 = icmp slt i32 %291, %292
  br i1 %293, label %295, label %294

294:                                              ; preds = %290
  store i32 31, ptr %11, align 4
  br label %344

295:                                              ; preds = %290
  %296 = load ptr, ptr %3, align 8, !tbaa !5
  %297 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %296, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %297, label %309, label %298

298:                                              ; preds = %295
  br label %299

299:                                              ; preds = %298
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #7
  %300 = getelementptr inbounds %"struct.rw::Error", ptr %33, i32 0, i32 0
  store i32 2, ptr %300, align 4, !tbaa !9
  %301 = getelementptr inbounds %"struct.rw::Error", ptr %33, i32 0, i32 1
  store i32 -2147483644, ptr %301, align 4, !tbaa !12
  %302 = load ptr, ptr @stderr, align 8, !tbaa !5
  %303 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %302, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 253) #7
  %304 = load ptr, ptr @stderr, align 8, !tbaa !5
  %305 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.12)
  %306 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %304, ptr noundef @.str.4, ptr noundef %305) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %33)
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  br label %307

307:                                              ; preds = %299
  br label %308

308:                                              ; preds = %307
  store i32 18, ptr %11, align 4
  br label %344

309:                                              ; preds = %295
  %310 = load ptr, ptr %3, align 8, !tbaa !5
  %311 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %310)
  store i32 %311, ptr %26, align 4, !tbaa !13
  %312 = load ptr, ptr %3, align 8, !tbaa !5
  %313 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %312, i32 noundef 5, ptr noundef null, ptr noundef null)
  br i1 %313, label %325, label %314

314:                                              ; preds = %309
  br label %315

315:                                              ; preds = %314
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #7
  %316 = getelementptr inbounds %"struct.rw::Error", ptr %34, i32 0, i32 0
  store i32 2, ptr %316, align 4, !tbaa !9
  %317 = getelementptr inbounds %"struct.rw::Error", ptr %34, i32 0, i32 1
  store i32 -2147483644, ptr %317, align 4, !tbaa !12
  %318 = load ptr, ptr @stderr, align 8, !tbaa !5
  %319 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %318, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 258) #7
  %320 = load ptr, ptr @stderr, align 8, !tbaa !5
  %321 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef @.str.19)
  %322 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %320, ptr noundef @.str.4, ptr noundef %321) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %34)
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  br label %323

323:                                              ; preds = %315
  br label %324

324:                                              ; preds = %323
  store i32 18, ptr %11, align 4
  br label %344

325:                                              ; preds = %309
  %326 = load ptr, ptr %3, align 8, !tbaa !5
  %327 = call noundef ptr @_ZN2rw6Camera10streamReadEPNS_6StreamE(ptr noundef %326)
  store ptr %327, ptr %31, align 8, !tbaa !5
  %328 = load ptr, ptr %31, align 8, !tbaa !5
  %329 = icmp eq ptr %328, null
  br i1 %329, label %330, label %331

330:                                              ; preds = %325
  store i32 18, ptr %11, align 4
  br label %344

331:                                              ; preds = %325
  %332 = load ptr, ptr %31, align 8, !tbaa !5
  %333 = getelementptr inbounds %"struct.rw::FrameList_", ptr %15, i32 0, i32 1
  %334 = load ptr, ptr %333, align 8, !tbaa !14
  %335 = load i32, ptr %26, align 4, !tbaa !13
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds ptr, ptr %334, i64 %336
  %338 = load ptr, ptr %337, align 8, !tbaa !5
  call void @_ZN2rw6Camera8setFrameEPNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(600) %332, ptr noundef %338)
  %339 = load ptr, ptr %7, align 8, !tbaa !5
  %340 = load ptr, ptr %31, align 8, !tbaa !5
  call void @_ZN2rw5Clump9addCameraEPNS_6CameraE(ptr noundef nonnull align 8 dereferenceable(88) %339, ptr noundef %340)
  br label %341

341:                                              ; preds = %331
  %342 = load i32, ptr %32, align 4, !tbaa !13
  %343 = add nsw i32 %342, 1
  store i32 %343, ptr %32, align 4, !tbaa !13
  br label %290, !llvm.loop !22

344:                                              ; preds = %330, %324, %308, %294
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #7
  %345 = load i32, ptr %11, align 4
  switch i32 %345, label %412 [
    i32 31, label %346
    i32 18, label %381
  ]

346:                                              ; preds = %344
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #7
  store i32 0, ptr %35, align 4, !tbaa !13
  br label %347

347:                                              ; preds = %366, %346
  %348 = load i32, ptr %35, align 4, !tbaa !13
  %349 = load i32, ptr %8, align 4, !tbaa !13
  %350 = icmp slt i32 %348, %349
  br i1 %350, label %352, label %351

351:                                              ; preds = %347
  store i32 38, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  br label %369

352:                                              ; preds = %347
  %353 = load ptr, ptr %9, align 8, !tbaa !5
  %354 = load i32, ptr %35, align 4, !tbaa !13
  %355 = sext i32 %354 to i64
  %356 = getelementptr inbounds ptr, ptr %353, i64 %355
  %357 = load ptr, ptr %356, align 8, !tbaa !5
  %358 = icmp ne ptr %357, null
  br i1 %358, label %359, label %365

359:                                              ; preds = %352
  %360 = load ptr, ptr %9, align 8, !tbaa !5
  %361 = load i32, ptr %35, align 4, !tbaa !13
  %362 = sext i32 %361 to i64
  %363 = getelementptr inbounds ptr, ptr %360, i64 %362
  %364 = load ptr, ptr %363, align 8, !tbaa !5
  call void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168) %364)
  br label %365

365:                                              ; preds = %359, %352
  br label %366

366:                                              ; preds = %365
  %367 = load i32, ptr %35, align 4, !tbaa !13
  %368 = add nsw i32 %367, 1
  store i32 %368, ptr %35, align 4, !tbaa !13
  br label %347, !llvm.loop !23

369:                                              ; preds = %351
  %370 = load ptr, ptr getelementptr inbounds (%"struct.rw::MemoryFunctions", ptr @_ZN2rw6Engine8memfuncsE, i32 0, i32 2), align 8, !tbaa !24
  %371 = load ptr, ptr %9, align 8, !tbaa !5
  call void %370(ptr noundef %371)
  %372 = load ptr, ptr getelementptr inbounds (%"struct.rw::MemoryFunctions", ptr @_ZN2rw6Engine8memfuncsE, i32 0, i32 2), align 8, !tbaa !24
  %373 = getelementptr inbounds %"struct.rw::FrameList_", ptr %15, i32 0, i32 1
  %374 = load ptr, ptr %373, align 8, !tbaa !14
  call void %372(ptr noundef %374)
  %375 = load ptr, ptr %3, align 8, !tbaa !5
  %376 = load ptr, ptr %7, align 8, !tbaa !5
  %377 = call noundef zeroext i1 @_ZN2rw10PluginList10streamReadEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw5Clump9s_plglistE, ptr noundef %375, ptr noundef %376)
  br i1 %377, label %378, label %380

378:                                              ; preds = %369
  %379 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %379, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %412

380:                                              ; preds = %369
  br label %381

381:                                              ; preds = %380, %344, %287, %230, %194
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #7
  store i32 0, ptr %36, align 4, !tbaa !13
  br label %382

382:                                              ; preds = %401, %381
  %383 = load i32, ptr %36, align 4, !tbaa !13
  %384 = load i32, ptr %8, align 4, !tbaa !13
  %385 = icmp slt i32 %383, %384
  br i1 %385, label %387, label %386

386:                                              ; preds = %382
  store i32 41, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #7
  br label %404

387:                                              ; preds = %382
  %388 = load ptr, ptr %9, align 8, !tbaa !5
  %389 = load i32, ptr %36, align 4, !tbaa !13
  %390 = sext i32 %389 to i64
  %391 = getelementptr inbounds ptr, ptr %388, i64 %390
  %392 = load ptr, ptr %391, align 8, !tbaa !5
  %393 = icmp ne ptr %392, null
  br i1 %393, label %394, label %400

394:                                              ; preds = %387
  %395 = load ptr, ptr %9, align 8, !tbaa !5
  %396 = load i32, ptr %36, align 4, !tbaa !13
  %397 = sext i32 %396 to i64
  %398 = getelementptr inbounds ptr, ptr %395, i64 %397
  %399 = load ptr, ptr %398, align 8, !tbaa !5
  call void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168) %399)
  br label %400

400:                                              ; preds = %394, %387
  br label %401

401:                                              ; preds = %400
  %402 = load i32, ptr %36, align 4, !tbaa !13
  %403 = add nsw i32 %402, 1
  store i32 %403, ptr %36, align 4, !tbaa !13
  br label %382, !llvm.loop !26

404:                                              ; preds = %386
  %405 = load ptr, ptr getelementptr inbounds (%"struct.rw::MemoryFunctions", ptr @_ZN2rw6Engine8memfuncsE, i32 0, i32 2), align 8, !tbaa !24
  %406 = load ptr, ptr %9, align 8, !tbaa !5
  call void %405(ptr noundef %406)
  br label %407

407:                                              ; preds = %404, %153, %124, %110, %88, %83
  %408 = load ptr, ptr getelementptr inbounds (%"struct.rw::MemoryFunctions", ptr @_ZN2rw6Engine8memfuncsE, i32 0, i32 2), align 8, !tbaa !24
  %409 = getelementptr inbounds %"struct.rw::FrameList_", ptr %15, i32 0, i32 1
  %410 = load ptr, ptr %409, align 8, !tbaa !14
  call void %408(ptr noundef %410)
  %411 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN2rw5Clump7destroyEv(ptr noundef nonnull align 8 dereferenceable(88) %411)
  store ptr null, ptr %2, align 8
  store i32 1, ptr %11, align 4
  br label %412

412:                                              ; preds = %407, %378, %344, %287, %230, %194, %153
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  br label %413

413:                                              ; preds = %412, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %414

414:                                              ; preds = %413, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  %415 = load ptr, ptr %2, align 8
  ret ptr %415
}

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

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

declare noundef ptr @_ZN2rw10FrameList_10streamReadEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #4

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

declare noundef ptr @_ZN2rw8Geometry10streamReadEPNS_6StreamE(ptr noundef) #4

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

declare noundef ptr @_ZN2rw5Light10streamReadEPNS_6StreamE(ptr noundef) #4

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

declare noundef ptr @_ZN2rw6Camera10streamReadEPNS_6StreamE(ptr noundef) #4

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

declare void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168)) #4

declare noundef zeroext i1 @_ZN2rw10PluginList10streamReadEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef) #4

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { "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 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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, !6, i64 8}
!15 = !{!"_ZTSN2rw10FrameList_E", !11, i64 0, !6, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = !{!25, !6, i64 16}
!25 = !{!"_ZTSN2rw15MemoryFunctionsE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!26 = distinct !{!26, !19}


; 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::MemoryFunctions" = type { ptr, ptr, ptr, ptr, ptr }
%"struct.rw::Error" = type { i32, i32 }
%"struct.rw::FrameList_" = type { i32, ptr }

@_ZN2rw5Clump9s_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 [57 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZN2rw6Engine8memfuncsE = external local_unnamed_addr global %"struct.rw::MemoryFunctions", align 8
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) local_unnamed_addr #4

; 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 nounwind uwtable
declare dso_local void @_ZN2rw5Clump8setFrameEPNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) local_unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw5Clump10streamReadEPNS_6StreamE(ptr noundef %0) local_unnamed_addr #0 align 2 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [3 x i32], align 4
  %5 = alloca %"struct.rw::Error", align 4
  %6 = alloca %"struct.rw::FrameList_", align 8
  %7 = alloca %"struct.rw::Error", align 4
  %8 = alloca %"struct.rw::Error", align 4
  %9 = alloca %"struct.rw::Error", align 4
  %10 = alloca %"struct.rw::Error", align 4
  %11 = alloca %"struct.rw::Error", align 4
  %12 = alloca %"struct.rw::Error", align 4
  %13 = alloca %"struct.rw::Error", align 4
  %14 = alloca %"struct.rw::Error", align 4
  %15 = alloca %"struct.rw::Error", align 4
  %16 = alloca %"struct.rw::Error", align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  %17 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef %0, i32 noundef 1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  br i1 %17, label %25, label %18

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

25:                                               ; preds = %1
  %26 = load i32, ptr %2, align 4, !tbaa !13
  %27 = call noundef i32 @_ZN2rw6Stream6read32EPvj(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull %4, i32 noundef %26)
  %28 = load i32, ptr %4, align 4, !tbaa !13
  %29 = load i32, ptr %3, align 4, !tbaa !13
  %.fr147 = freeze i32 %29
  %30 = icmp ugt i32 %.fr147, 208896
  %31 = getelementptr inbounds i8, ptr %4, i64 4
  %32 = load i32, ptr %31, align 4
  %33 = getelementptr inbounds i8, ptr %4, i64 8
  %34 = load i32, ptr %33, align 4
  %35 = call noundef ptr @_ZN2rw5Clump6createEv()
  %36 = icmp eq ptr %35, null
  br i1 %36, label %185, label %37

37:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %38 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr null, ptr %38, align 8, !tbaa !14
  %39 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 14, ptr noundef null, ptr noundef null)
  br i1 %39, label %47, label %40

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

47:                                               ; preds = %37
  %48 = call noundef ptr @_ZN2rw10FrameList_10streamReadEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull %0)
  %49 = icmp eq ptr %48, null
  br i1 %49, label %181, label %50

50:                                               ; preds = %47
  %51 = load ptr, ptr %38, align 8, !tbaa !14
  %52 = load ptr, ptr %51, align 8, !tbaa !11
  call void @_ZN2rw5Clump8setFrameEPNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(88) %35, ptr noundef %52)
  %53 = load i32, ptr %3, align 4, !tbaa !13
  %54 = icmp ugt i32 %53, 197631
  br i1 %54, label %55, label %.loopexit

55:                                               ; preds = %50
  %56 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 26, ptr noundef null, ptr noundef null)
  br i1 %56, label %64, label %57

57:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  store i32 2, ptr %8, align 4, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %8, i64 4
  store i32 -2147483644, ptr %58, align 4, !tbaa !10
  %59 = load ptr, ptr @stderr, align 8, !tbaa !11
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 188) #8
  %61 = load ptr, ptr @stderr, align 8, !tbaa !11
  %62 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.14)
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef nonnull @.str.4, ptr noundef %62) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br label %181

64:                                               ; preds = %55
  %65 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %65, label %73, label %66

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

73:                                               ; preds = %64
  %74 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %.not = icmp eq i32 %74, 0
  br i1 %.not, label %.loopexit, label %75

75:                                               ; preds = %73
  %76 = sext i32 %74 to i64
  %77 = shl nsw i64 %76, 3
  %78 = call noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef %77, i32 noundef 65552, ptr noundef nonnull @.str.15)
  %79 = icmp eq ptr %78, null
  br i1 %79, label %80, label %87

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  store i32 2, ptr %10, align 4, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %10, i64 4
  store i32 -2147483646, ptr %81, align 4, !tbaa !10
  %82 = load ptr, ptr @stderr, align 8, !tbaa !11
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 200) #8
  %84 = load ptr, ptr @stderr, align 8, !tbaa !11
  %85 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483646, i64 noundef %77)
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef nonnull @.str.4, ptr noundef %85) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %181

87:                                               ; preds = %75
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %78, i8 0, i64 %77, i1 false)
  %88 = icmp sgt i32 %74, 0
  br i1 %88, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %87
  %wide.trip.count = zext nneg i32 %74 to i64
  br label %.lr.ph

89:                                               ; preds = %98
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !16

.lr.ph:                                           ; preds = %.lr.ph.preheader, %89
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %89 ]
  %90 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 15, ptr noundef null, ptr noundef null)
  br i1 %90, label %98, label %91

91:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  store i32 2, ptr %11, align 4, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 -2147483644, ptr %92, align 4, !tbaa !10
  %93 = load ptr, ptr @stderr, align 8, !tbaa !11
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 207) #8
  %95 = load ptr, ptr @stderr, align 8, !tbaa !11
  %96 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.16)
  %97 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef nonnull @.str.4, ptr noundef %96) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br label %.thread110

98:                                               ; preds = %.lr.ph
  %99 = call noundef ptr @_ZN2rw8Geometry10streamReadEPNS_6StreamE(ptr noundef nonnull %0)
  %100 = getelementptr inbounds ptr, ptr %78, i64 %indvars.iv
  store ptr %99, ptr %100, align 8, !tbaa !11
  %101 = icmp eq ptr %99, null
  br i1 %101, label %.thread110, label %89

.loopexit:                                        ; preds = %89, %73, %87, %50
  %.191 = phi ptr [ null, %50 ], [ %78, %87 ], [ null, %73 ], [ %78, %89 ]
  %.087 = phi i32 [ 0, %50 ], [ %74, %87 ], [ 0, %73 ], [ %74, %89 ]
  %102 = icmp sgt i32 %28, 0
  br i1 %102, label %.lr.ph130, label %.preheader124

.preheader124:                                    ; preds = %116, %.loopexit
  %103 = icmp sgt i32 %32, 0
  %104 = select i1 %30, i1 %103, i1 false
  br i1 %104, label %.lr.ph132.split, label %.preheader123

.lr.ph130:                                        ; preds = %.loopexit, %116
  %.089129 = phi i32 [ %117, %116 ], [ 0, %.loopexit ]
  %105 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 20, ptr noundef null, ptr noundef null)
  br i1 %105, label %113, label %106

106:                                              ; preds = %.lr.ph130
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  store i32 2, ptr %12, align 4, !tbaa !5
  %107 = getelementptr inbounds i8, ptr %12, i64 4
  store i32 -2147483644, ptr %107, align 4, !tbaa !10
  %108 = load ptr, ptr @stderr, align 8, !tbaa !11
  %109 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %108, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 220) #8
  %110 = load ptr, ptr @stderr, align 8, !tbaa !11
  %111 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.17)
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %110, ptr noundef nonnull @.str.4, ptr noundef %111) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  br label %.thread110

113:                                              ; preds = %.lr.ph130
  %114 = call noundef ptr @_ZN2rw6Atomic15streamReadClumpEPNS_6StreamEPNS_10FrameList_EPPNS_8GeometryE(ptr noundef nonnull %0, ptr noundef nonnull %6, ptr noundef %.191)
  %115 = icmp eq ptr %114, null
  br i1 %115, label %.thread110, label %116

116:                                              ; preds = %113
  call void @_ZN2rw5Clump9addAtomicEPNS_6AtomicE(ptr noundef nonnull align 8 dereferenceable(88) %35, ptr noundef nonnull %114)
  %117 = add nuw nsw i32 %.089129, 1
  %exitcond152.not = icmp eq i32 %117, %28
  br i1 %exitcond152.not, label %.preheader124, label %.lr.ph130, !llvm.loop !18

.preheader123:                                    ; preds = %137, %.preheader124
  %118 = icmp sgt i32 %34, 0
  %119 = select i1 %30, i1 %118, i1 false
  br i1 %119, label %.lr.ph136.split, label %.preheader

.lr.ph132.split:                                  ; preds = %.preheader124, %137
  %.086131 = phi i32 [ %142, %137 ], [ 0, %.preheader124 ]
  %120 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %120, label %126, label %.split.us

.split.us:                                        ; preds = %.lr.ph132.split
  %.pre = load ptr, ptr @stderr, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  store i32 2, ptr %13, align 4, !tbaa !5
  %121 = getelementptr inbounds i8, ptr %13, i64 4
  store i32 -2147483644, ptr %121, align 4, !tbaa !10
  %122 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.pre, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 234) #8
  %123 = load ptr, ptr @stderr, align 8, !tbaa !11
  %124 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.12)
  %125 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %123, ptr noundef nonnull @.str.4, ptr noundef %124) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %13)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  br label %.thread110

126:                                              ; preds = %.lr.ph132.split
  %127 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %128 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 18, ptr noundef null, ptr noundef null)
  br i1 %128, label %134, label %.split134.us

.split134.us:                                     ; preds = %126
  %.pre165 = load ptr, ptr @stderr, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #7
  store i32 2, ptr %14, align 4, !tbaa !5
  %129 = getelementptr inbounds i8, ptr %14, i64 4
  store i32 -2147483644, ptr %129, align 4, !tbaa !10
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.pre165, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 239) #8
  %131 = load ptr, ptr @stderr, align 8, !tbaa !11
  %132 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.18)
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %131, ptr noundef nonnull @.str.4, ptr noundef %132) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  br label %.thread110

134:                                              ; preds = %126
  %135 = call noundef ptr @_ZN2rw5Light10streamReadEPNS_6StreamE(ptr noundef nonnull %0)
  %136 = icmp eq ptr %135, null
  br i1 %136, label %.thread110, label %137

137:                                              ; preds = %134
  %138 = load ptr, ptr %38, align 8, !tbaa !14
  %139 = sext i32 %127 to i64
  %140 = getelementptr inbounds ptr, ptr %138, i64 %139
  %141 = load ptr, ptr %140, align 8, !tbaa !11
  call void @_ZN2rw5Light8setFrameEPNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(120) %135, ptr noundef %141)
  call void @_ZN2rw5Clump8addLightEPNS_5LightE(ptr noundef nonnull align 8 dereferenceable(88) %35, ptr noundef nonnull %135)
  %142 = add nuw nsw i32 %.086131, 1
  %exitcond153.not = icmp eq i32 %142, %32
  br i1 %exitcond153.not, label %.preheader123, label %.lr.ph132.split, !llvm.loop !19

.preheader:                                       ; preds = %161, %.preheader123
  %143 = icmp sgt i32 %.087, 0
  br i1 %143, label %.lr.ph143.preheader, label %._crit_edge

.lr.ph143.preheader:                              ; preds = %.preheader
  %wide.trip.count158 = zext nneg i32 %.087 to i64
  br label %.lr.ph143

.lr.ph136.split:                                  ; preds = %.preheader123, %161
  %.084135 = phi i32 [ %166, %161 ], [ 0, %.preheader123 ]
  %144 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 1, ptr noundef null, ptr noundef null)
  br i1 %144, label %150, label %.split138.us

.split138.us:                                     ; preds = %.lr.ph136.split
  %.pre167 = load ptr, ptr @stderr, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #7
  store i32 2, ptr %15, align 4, !tbaa !5
  %145 = getelementptr inbounds i8, ptr %15, i64 4
  store i32 -2147483644, ptr %145, align 4, !tbaa !10
  %146 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.pre167, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 253) #8
  %147 = load ptr, ptr @stderr, align 8, !tbaa !11
  %148 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.12)
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %147, ptr noundef nonnull @.str.4, ptr noundef %148) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %15)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  br label %.thread110

150:                                              ; preds = %.lr.ph136.split
  %151 = call noundef i32 @_ZN2rw6Stream7readI32Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %152 = call noundef zeroext i1 @_ZN2rw9findChunkEPNS_6StreamEjPjS2_(ptr noundef nonnull %0, i32 noundef 5, ptr noundef null, ptr noundef null)
  br i1 %152, label %158, label %.split140.us

.split140.us:                                     ; preds = %150
  %.pre168 = load ptr, ptr @stderr, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  store i32 2, ptr %16, align 4, !tbaa !5
  %153 = getelementptr inbounds i8, ptr %16, i64 4
  store i32 -2147483644, ptr %153, align 4, !tbaa !10
  %154 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %.pre168, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 258) #8
  %155 = load ptr, ptr @stderr, align 8, !tbaa !11
  %156 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483644, ptr noundef nonnull @.str.19)
  %157 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %155, ptr noundef nonnull @.str.4, ptr noundef %156) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  br label %.thread110

158:                                              ; preds = %150
  %159 = call noundef ptr @_ZN2rw6Camera10streamReadEPNS_6StreamE(ptr noundef nonnull %0)
  %160 = icmp eq ptr %159, null
  br i1 %160, label %.thread110, label %161

161:                                              ; preds = %158
  %162 = load ptr, ptr %38, align 8, !tbaa !14
  %163 = sext i32 %151 to i64
  %164 = getelementptr inbounds ptr, ptr %162, i64 %163
  %165 = load ptr, ptr %164, align 8, !tbaa !11
  call void @_ZN2rw6Camera8setFrameEPNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(600) %159, ptr noundef %165)
  call void @_ZN2rw5Clump9addCameraEPNS_6CameraE(ptr noundef nonnull align 8 dereferenceable(88) %35, ptr noundef nonnull %159)
  %166 = add nuw nsw i32 %.084135, 1
  %exitcond154.not = icmp eq i32 %166, %34
  br i1 %exitcond154.not, label %.preheader, label %.lr.ph136.split, !llvm.loop !20

._crit_edge:                                      ; preds = %174, %.preheader
  %167 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN2rw6Engine8memfuncsE, i64 16), align 8, !tbaa !21
  call void %167(ptr noundef %.191)
  %168 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN2rw6Engine8memfuncsE, i64 16), align 8, !tbaa !21
  %169 = load ptr, ptr %38, align 8, !tbaa !14
  call void %168(ptr noundef %169)
  %170 = call noundef zeroext i1 @_ZN2rw10PluginList10streamReadEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw5Clump9s_plglistE, ptr noundef nonnull %0, ptr noundef nonnull %35)
  br i1 %170, label %184, label %.thread110

.lr.ph143:                                        ; preds = %.lr.ph143.preheader, %174
  %indvars.iv155 = phi i64 [ 0, %.lr.ph143.preheader ], [ %indvars.iv.next156, %174 ]
  %171 = getelementptr inbounds ptr, ptr %.191, i64 %indvars.iv155
  %172 = load ptr, ptr %171, align 8, !tbaa !11
  %.not108 = icmp eq ptr %172, null
  br i1 %.not108, label %174, label %173

173:                                              ; preds = %.lr.ph143
  call void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168) %172)
  br label %174

174:                                              ; preds = %.lr.ph143, %173
  %indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1
  %exitcond159.not = icmp eq i64 %indvars.iv.next156, %wide.trip.count158
  br i1 %exitcond159.not, label %._crit_edge, label %.lr.ph143, !llvm.loop !23

.thread110:                                       ; preds = %98, %113, %134, %158, %.split138.us, %.split140.us, %.split.us, %.split134.us, %106, %91, %._crit_edge
  %.292 = phi ptr [ %.191, %._crit_edge ], [ %78, %91 ], [ %.191, %106 ], [ %.191, %.split134.us ], [ %.191, %.split.us ], [ %.191, %.split140.us ], [ %.191, %.split138.us ], [ %.191, %158 ], [ %.191, %134 ], [ %.191, %113 ], [ %78, %98 ]
  %.188 = phi i32 [ %.087, %._crit_edge ], [ %74, %91 ], [ %.087, %106 ], [ %.087, %.split134.us ], [ %.087, %.split.us ], [ %.087, %.split140.us ], [ %.087, %.split138.us ], [ %.087, %158 ], [ %.087, %134 ], [ %.087, %113 ], [ %74, %98 ]
  %175 = icmp sgt i32 %.188, 0
  br i1 %175, label %.lr.ph145.preheader, label %._crit_edge146

.lr.ph145.preheader:                              ; preds = %.thread110
  %wide.trip.count163 = zext nneg i32 %.188 to i64
  br label %.lr.ph145

._crit_edge146:                                   ; preds = %180, %.thread110
  %176 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN2rw6Engine8memfuncsE, i64 16), align 8, !tbaa !21
  call void %176(ptr noundef %.292)
  br label %181

.lr.ph145:                                        ; preds = %.lr.ph145.preheader, %180
  %indvars.iv160 = phi i64 [ 0, %.lr.ph145.preheader ], [ %indvars.iv.next161, %180 ]
  %177 = getelementptr inbounds ptr, ptr %.292, i64 %indvars.iv160
  %178 = load ptr, ptr %177, align 8, !tbaa !11
  %.not107 = icmp eq ptr %178, null
  br i1 %.not107, label %180, label %179

179:                                              ; preds = %.lr.ph145
  call void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168) %178)
  br label %180

180:                                              ; preds = %.lr.ph145, %179
  %indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
  %exitcond164.not = icmp eq i64 %indvars.iv.next161, %wide.trip.count163
  br i1 %exitcond164.not, label %._crit_edge146, label %.lr.ph145, !llvm.loop !24

181:                                              ; preds = %80, %47, %._crit_edge146, %66, %57, %40
  %182 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN2rw6Engine8memfuncsE, i64 16), align 8, !tbaa !21
  %183 = load ptr, ptr %38, align 8, !tbaa !14
  call void %182(ptr noundef %183)
  call void @_ZN2rw5Clump7destroyEv(ptr noundef nonnull align 8 dereferenceable(88) %35)
  br label %184

184:                                              ; preds = %._crit_edge, %181
  %.085 = phi ptr [ null, %181 ], [ %35, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  br label %185

185:                                              ; preds = %184, %25, %18
  %.2 = phi ptr [ null, %18 ], [ %.085, %184 ], [ null, %25 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  ret ptr %.2
}

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

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

declare noundef ptr @_ZN2rw10FrameList_10streamReadEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

declare noundef ptr @_ZN2rw8Geometry10streamReadEPNS_6StreamE(ptr noundef) local_unnamed_addr #4

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

declare noundef ptr @_ZN2rw5Light10streamReadEPNS_6StreamE(ptr noundef) local_unnamed_addr #4

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

declare noundef ptr @_ZN2rw6Camera10streamReadEPNS_6StreamE(ptr noundef) local_unnamed_addr #4

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

declare void @_ZN2rw8Geometry7destroyEv(ptr noundef nonnull align 8 dereferenceable(168)) local_unnamed_addr #4

declare noundef zeroext i1 @_ZN2rw10PluginList10streamReadEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { "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 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!7, !7, i64 0}
!14 = !{!15, !12, i64 8}
!15 = !{!"_ZTSN2rw10FrameList_E", !7, i64 0, !12, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}
!21 = !{!22, !12, i64 16}
!22 = !{!"_ZTSN2rw15MemoryFunctionsE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!23 = distinct !{!23, !17}
!24 = distinct !{!24, !17}


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