; LLVM IR from aap/librw :: src/geometry.ll (ZN2rw8Geometry11streamWriteEPNS_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::GeoStreamData" = type { i32, i32, i32, i32 }
%"struct.rw::Geometry" = type { %"struct.rw::Object", i32, i16, i32, i32, i32, i32, ptr, ptr, [8 x ptr], ptr, %"struct.rw::MaterialList", ptr, ptr, i32 }
%"struct.rw::Object" = type { i8, i8, i8, i8, ptr }
%"struct.rw::MaterialList" = type { ptr, i32, i32 }
%"struct.rw::Triangle" = type { [3 x i16], i16 }
%"struct.rw::MorphTarget" = type { ptr, %"struct.rw::Sphere", ptr, ptr }
%"struct.rw::Sphere" = type { %"struct.rw::V3d", float }
%"struct.rw::V3d" = type { float, float, float }

@_ZN2rw8Geometry9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8
@_ZZN2rw8Geometry11streamWriteEPNS_6StreamEE4fbuf = external hidden global [3 x float], align 4
@_ZN2rw7versionE = external global i32, align 4

; 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2rw8Geometry11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.rw::GeoStreamData", align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca [2 x i32], align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = call noundef i32 @_ZN2rw8Geometry13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(168) %11)
  %14 = call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %12, i32 noundef 15, i32 noundef %13)
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = call noundef i32 @_ZN2rwL13geoStructSizeEPNS_8GeometryE(ptr noundef %11)
  %17 = call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %15, i32 noundef 1, i32 noundef %16)
  %18 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 1
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 6
  %21 = load i32, ptr %20, align 4, !tbaa !15
  %22 = shl i32 %21, 16
  %23 = or i32 %19, %22
  %24 = getelementptr inbounds %"struct.rw::GeoStreamData", ptr %5, i32 0, i32 0
  store i32 %23, ptr %24, align 4, !tbaa !16
  %25 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 3
  %26 = load i32, ptr %25, align 8, !tbaa !18
  %27 = getelementptr inbounds %"struct.rw::GeoStreamData", ptr %5, i32 0, i32 1
  store i32 %26, ptr %27, align 4, !tbaa !19
  %28 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 4
  %29 = load i32, ptr %28, align 4, !tbaa !20
  %30 = getelementptr inbounds %"struct.rw::GeoStreamData", ptr %5, i32 0, i32 2
  store i32 %29, ptr %30, align 4, !tbaa !21
  %31 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 5
  %32 = load i32, ptr %31, align 8, !tbaa !22
  %33 = getelementptr inbounds %"struct.rw::GeoStreamData", ptr %5, i32 0, i32 3
  store i32 %32, ptr %33, align 4, !tbaa !23
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef %5, i32 noundef 16)
  %36 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !24
  %37 = icmp slt i32 %36, 212992
  br i1 %37, label %38, label %41

38:                                               ; preds = %2
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr noundef @_ZZN2rw8Geometry11streamWriteEPNS_6StreamEE4fbuf, i32 noundef 12)
  br label %41

41:                                               ; preds = %38, %2
  %42 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 1
  %43 = load i32, ptr %42, align 8, !tbaa !9
  %44 = and i32 %43, 16777216
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %140, label %46

46:                                               ; preds = %41
  %47 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !9
  %49 = and i32 %48, 8
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %62

51:                                               ; preds = %46
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 8
  %54 = load ptr, ptr %53, align 8, !tbaa !25
  %55 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 4
  %56 = load i32, ptr %55, align 4, !tbaa !20
  %57 = mul nsw i32 4, %56
  %58 = load ptr, ptr %52, align 8, !tbaa !26
  %59 = getelementptr inbounds ptr, ptr %58, i64 3
  %60 = load ptr, ptr %59, align 8
  %61 = call noundef i32 %60(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef %54, i32 noundef %57)
  br label %62

62:                                               ; preds = %51, %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !24
  br label %63

63:                                               ; preds = %81, %62
  %64 = load i32, ptr %6, align 4, !tbaa !24
  %65 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 6
  %66 = load i32, ptr %65, align 4, !tbaa !15
  %67 = icmp slt i32 %64, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %84

69:                                               ; preds = %63
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 9
  %72 = load i32, ptr %6, align 4, !tbaa !24
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [8 x ptr], ptr %71, i64 0, i64 %73
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 4
  %77 = load i32, ptr %76, align 4, !tbaa !20
  %78 = mul nsw i32 2, %77
  %79 = mul nsw i32 %78, 4
  %80 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef %75, i32 noundef %79)
  br label %81

81:                                               ; preds = %69
  %82 = load i32, ptr %6, align 4, !tbaa !24
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %6, align 4, !tbaa !24
  br label %63, !llvm.loop !28

84:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !24
  br label %85

85:                                               ; preds = %136, %84
  %86 = load i32, ptr %7, align 4, !tbaa !24
  %87 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 3
  %88 = load i32, ptr %87, align 8, !tbaa !18
  %89 = icmp slt i32 %86, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %139

91:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %92 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 7
  %93 = load ptr, ptr %92, align 8, !tbaa !30
  %94 = load i32, ptr %7, align 4, !tbaa !24
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds %"struct.rw::Triangle", ptr %93, i64 %95
  %97 = getelementptr inbounds %"struct.rw::Triangle", ptr %96, i32 0, i32 0
  %98 = getelementptr inbounds [3 x i16], ptr %97, i64 0, i64 0
  %99 = load i16, ptr %98, align 2, !tbaa !31
  %100 = zext i16 %99 to i32
  %101 = shl i32 %100, 16
  %102 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 7
  %103 = load ptr, ptr %102, align 8, !tbaa !30
  %104 = load i32, ptr %7, align 4, !tbaa !24
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds %"struct.rw::Triangle", ptr %103, i64 %105
  %107 = getelementptr inbounds %"struct.rw::Triangle", ptr %106, i32 0, i32 0
  %108 = getelementptr inbounds [3 x i16], ptr %107, i64 0, i64 1
  %109 = load i16, ptr %108, align 2, !tbaa !31
  %110 = zext i16 %109 to i32
  %111 = or i32 %101, %110
  %112 = getelementptr inbounds [2 x i32], ptr %8, i64 0, i64 0
  store i32 %111, ptr %112, align 4, !tbaa !24
  %113 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 7
  %114 = load ptr, ptr %113, align 8, !tbaa !30
  %115 = load i32, ptr %7, align 4, !tbaa !24
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds %"struct.rw::Triangle", ptr %114, i64 %116
  %118 = getelementptr inbounds %"struct.rw::Triangle", ptr %117, i32 0, i32 0
  %119 = getelementptr inbounds [3 x i16], ptr %118, i64 0, i64 2
  %120 = load i16, ptr %119, align 2, !tbaa !31
  %121 = zext i16 %120 to i32
  %122 = shl i32 %121, 16
  %123 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 7
  %124 = load ptr, ptr %123, align 8, !tbaa !30
  %125 = load i32, ptr %7, align 4, !tbaa !24
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds %"struct.rw::Triangle", ptr %124, i64 %126
  %128 = getelementptr inbounds %"struct.rw::Triangle", ptr %127, i32 0, i32 1
  %129 = load i16, ptr %128, align 2, !tbaa !32
  %130 = zext i16 %129 to i32
  %131 = or i32 %122, %130
  %132 = getelementptr inbounds [2 x i32], ptr %8, i64 0, i64 1
  store i32 %131, ptr %132, align 4, !tbaa !24
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds [2 x i32], ptr %8, i64 0, i64 0
  %135 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %133, ptr noundef %134, i32 noundef 8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %136

136:                                              ; preds = %91
  %137 = load i32, ptr %7, align 4, !tbaa !24
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %7, align 4, !tbaa !24
  br label %85, !llvm.loop !34

139:                                              ; preds = %90
  br label %140

140:                                              ; preds = %139, %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !24
  br label %141

141:                                              ; preds = %212, %140
  %142 = load i32, ptr %9, align 4, !tbaa !24
  %143 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 5
  %144 = load i32, ptr %143, align 8, !tbaa !22
  %145 = icmp slt i32 %142, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %215

147:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %148 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 10
  %149 = load ptr, ptr %148, align 8, !tbaa !35
  %150 = load i32, ptr %9, align 4, !tbaa !24
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %149, i64 %151
  store ptr %152, ptr %10, align 8, !tbaa !5
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = load ptr, ptr %10, align 8, !tbaa !5
  %155 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %154, i32 0, i32 1
  %156 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %153, ptr noundef %155, i32 noundef 16)
  %157 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 1
  %158 = load i32, ptr %157, align 8, !tbaa !9
  %159 = and i32 %158, 16777216
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %206, label %161

161:                                              ; preds = %147
  %162 = load ptr, ptr %4, align 8, !tbaa !5
  %163 = load ptr, ptr %10, align 8, !tbaa !5
  %164 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %163, i32 0, i32 2
  %165 = load ptr, ptr %164, align 8, !tbaa !36
  %166 = icmp ne ptr %165, null
  %167 = zext i1 %166 to i32
  %168 = call noundef i32 @_ZN2rw6Stream8writeI32Ei(ptr noundef nonnull align 8 dereferenceable(8) %162, i32 noundef %167)
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = load ptr, ptr %10, align 8, !tbaa !5
  %171 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %170, i32 0, i32 3
  %172 = load ptr, ptr %171, align 8, !tbaa !41
  %173 = icmp ne ptr %172, null
  %174 = zext i1 %173 to i32
  %175 = call noundef i32 @_ZN2rw6Stream8writeI32Ei(ptr noundef nonnull align 8 dereferenceable(8) %169, i32 noundef %174)
  %176 = load ptr, ptr %10, align 8, !tbaa !5
  %177 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %176, i32 0, i32 2
  %178 = load ptr, ptr %177, align 8, !tbaa !36
  %179 = icmp ne ptr %178, null
  br i1 %179, label %180, label %190

180:                                              ; preds = %161
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = load ptr, ptr %10, align 8, !tbaa !5
  %183 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %182, i32 0, i32 2
  %184 = load ptr, ptr %183, align 8, !tbaa !36
  %185 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 4
  %186 = load i32, ptr %185, align 4, !tbaa !20
  %187 = mul nsw i32 3, %186
  %188 = mul nsw i32 %187, 4
  %189 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %181, ptr noundef %184, i32 noundef %188)
  br label %190

190:                                              ; preds = %180, %161
  %191 = load ptr, ptr %10, align 8, !tbaa !5
  %192 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %191, i32 0, i32 3
  %193 = load ptr, ptr %192, align 8, !tbaa !41
  %194 = icmp ne ptr %193, null
  br i1 %194, label %195, label %205

195:                                              ; preds = %190
  %196 = load ptr, ptr %4, align 8, !tbaa !5
  %197 = load ptr, ptr %10, align 8, !tbaa !5
  %198 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %197, i32 0, i32 3
  %199 = load ptr, ptr %198, align 8, !tbaa !41
  %200 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 4
  %201 = load i32, ptr %200, align 4, !tbaa !20
  %202 = mul nsw i32 3, %201
  %203 = mul nsw i32 %202, 4
  %204 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %196, ptr noundef %199, i32 noundef %203)
  br label %205

205:                                              ; preds = %195, %190
  br label %211

206:                                              ; preds = %147
  %207 = load ptr, ptr %4, align 8, !tbaa !5
  %208 = call noundef i32 @_ZN2rw6Stream8writeI32Ei(ptr noundef nonnull align 8 dereferenceable(8) %207, i32 noundef 0)
  %209 = load ptr, ptr %4, align 8, !tbaa !5
  %210 = call noundef i32 @_ZN2rw6Stream8writeI32Ei(ptr noundef nonnull align 8 dereferenceable(8) %209, i32 noundef 0)
  br label %211

211:                                              ; preds = %206, %205
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %212

212:                                              ; preds = %211
  %213 = load i32, ptr %9, align 4, !tbaa !24
  %214 = add nsw i32 %213, 1
  store i32 %214, ptr %9, align 4, !tbaa !24
  br label %141, !llvm.loop !42

215:                                              ; preds = %146
  %216 = getelementptr inbounds %"struct.rw::Geometry", ptr %11, i32 0, i32 11
  %217 = load ptr, ptr %4, align 8, !tbaa !5
  %218 = call noundef zeroext i1 @_ZN2rw12MaterialList11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16) %216, ptr noundef %217)
  %219 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN2rw10PluginList11streamWriteEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw8Geometry9s_plglistE, ptr noundef %219, ptr noundef %11)
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  ret i1 true
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN2rw8Geometry13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(168)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN2rwL13geoStructSizeEPNS_8GeometryE(ptr noundef) #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2rw12MaterialList11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #1 align 2

declare void @_ZN2rw10PluginList11streamWriteEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 16}
!10 = !{!"_ZTSN2rw8GeometryE", !11, i64 0, !12, i64 16, !13, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !14, i64 128, !6, i64 144, !6, i64 152, !12, i64 160}
!11 = !{!"_ZTSN2rw6ObjectE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!"_ZTSN2rw12MaterialListE", !6, i64 0, !12, i64 8, !12, i64 12}
!15 = !{!10, !12, i64 36}
!16 = !{!17, !12, i64 0}
!17 = !{!"_ZTSN2rw13GeoStreamDataE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!18 = !{!10, !12, i64 24}
!19 = !{!17, !12, i64 4}
!20 = !{!10, !12, i64 28}
!21 = !{!17, !12, i64 8}
!22 = !{!10, !12, i64 32}
!23 = !{!17, !12, i64 12}
!24 = !{!12, !12, i64 0}
!25 = !{!10, !6, i64 48}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !8, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!10, !6, i64 40}
!31 = !{!13, !13, i64 0}
!32 = !{!33, !13, i64 6}
!33 = !{!"_ZTSN2rw8TriangleE", !7, i64 0, !13, i64 6}
!34 = distinct !{!34, !29}
!35 = !{!10, !6, i64 120}
!36 = !{!37, !6, i64 24}
!37 = !{!"_ZTSN2rw11MorphTargetE", !6, i64 0, !38, i64 8, !6, i64 24, !6, i64 32}
!38 = !{!"_ZTSN2rw6SphereE", !39, i64 0, !40, i64 12}
!39 = !{!"_ZTSN2rw3V3dE", !40, i64 0, !40, i64 4, !40, i64 8}
!40 = !{!"float", !7, i64 0}
!41 = !{!37, !6, i64 32}
!42 = distinct !{!42, !29}


; 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::GeoStreamData" = type { i32, i32, i32, i32 }
%"struct.rw::Triangle" = type { [3 x i16], i16 }
%"struct.rw::MorphTarget" = type { ptr, %"struct.rw::Sphere", ptr, ptr }
%"struct.rw::Sphere" = type { %"struct.rw::V3d", float }
%"struct.rw::V3d" = type { float, float, float }

@_ZN2rw8Geometry9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8
@_ZZN2rw8Geometry11streamWriteEPNS_6StreamEE4fbuf = external hidden global [3 x float], align 4
@_ZN2rw7versionE = external local_unnamed_addr global i32, align 4

; 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2rw8Geometry11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"struct.rw::GeoStreamData", align 4
  %4 = alloca [2 x i32], align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  %5 = tail call noundef i32 @_ZN2rw8Geometry13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(168) %0)
  %6 = tail call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %1, i32 noundef 15, i32 noundef %5)
  %7 = tail call noundef i32 @_ZN2rwL13geoStructSizeEPNS_8GeometryE(ptr noundef nonnull %0)
  %8 = tail call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %1, i32 noundef 1, i32 noundef %7)
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 36
  %12 = load i32, ptr %11, align 4, !tbaa !14
  %13 = shl i32 %12, 16
  %14 = or i32 %13, %10
  store i32 %14, ptr %3, align 4, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %16 = getelementptr inbounds i8, ptr %3, i64 4
  %17 = getelementptr inbounds i8, ptr %0, i64 28
  %18 = load <2 x i32>, ptr %15, align 8, !tbaa !17
  store <2 x i32> %18, ptr %16, align 4, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %0, i64 32
  %20 = load i32, ptr %19, align 8, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %3, i64 12
  store i32 %20, ptr %21, align 4, !tbaa !19
  %22 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %3, i32 noundef 16)
  %23 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !17
  %24 = icmp slt i32 %23, 212992
  br i1 %24, label %25, label %27

25:                                               ; preds = %2
  %26 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull @_ZZN2rw8Geometry11streamWriteEPNS_6StreamEE4fbuf, i32 noundef 12)
  br label %27

27:                                               ; preds = %25, %2
  %28 = load i32, ptr %9, align 8, !tbaa !5
  %29 = and i32 %28, 16777216
  %.not = icmp eq i32 %29, 0
  br i1 %.not, label %30, label %.loopexit

30:                                               ; preds = %27
  %31 = and i32 %28, 8
  %.not39 = icmp eq i32 %31, 0
  br i1 %.not39, label %41, label %32

32:                                               ; preds = %30
  %33 = getelementptr inbounds i8, ptr %0, i64 48
  %34 = load ptr, ptr %33, align 8, !tbaa !20
  %35 = load i32, ptr %17, align 4, !tbaa !21
  %36 = shl nsw i32 %35, 2
  %37 = load ptr, ptr %1, align 8, !tbaa !22
  %38 = getelementptr inbounds i8, ptr %37, i64 24
  %39 = load ptr, ptr %38, align 8
  %40 = call noundef i32 %39(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %34, i32 noundef %36)
  br label %41

41:                                               ; preds = %32, %30
  %42 = load i32, ptr %11, align 4, !tbaa !14
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %41
  %44 = getelementptr inbounds i8, ptr %0, i64 56
  br label %49

.preheader:                                       ; preds = %49, %41
  %45 = load i32, ptr %15, align 8, !tbaa !24
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph45, label %.loopexit

.lr.ph45:                                         ; preds = %.preheader
  %47 = getelementptr inbounds i8, ptr %0, i64 40
  %48 = getelementptr inbounds i8, ptr %4, i64 4
  br label %58

49:                                               ; preds = %.lr.ph, %49
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %49 ]
  %50 = getelementptr inbounds [8 x ptr], ptr %44, i64 0, i64 %indvars.iv
  %51 = load ptr, ptr %50, align 8, !tbaa !25
  %52 = load i32, ptr %17, align 4, !tbaa !21
  %53 = shl nsw i32 %52, 3
  %54 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %51, i32 noundef %53)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = load i32, ptr %11, align 4, !tbaa !14
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next, %56
  br i1 %57, label %49, label %.preheader, !llvm.loop !26

58:                                               ; preds = %.lr.ph45, %58
  %indvars.iv49 = phi i64 [ 0, %.lr.ph45 ], [ %indvars.iv.next50, %58 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %59 = load ptr, ptr %47, align 8, !tbaa !28
  %60 = getelementptr inbounds %"struct.rw::Triangle", ptr %59, i64 %indvars.iv49
  %61 = load i16, ptr %60, align 2, !tbaa !29
  %62 = zext i16 %61 to i32
  %63 = shl nuw i32 %62, 16
  %64 = getelementptr inbounds i8, ptr %60, i64 2
  %65 = load i16, ptr %64, align 2, !tbaa !29
  %66 = zext i16 %65 to i32
  %67 = or disjoint i32 %63, %66
  store i32 %67, ptr %4, align 4, !tbaa !17
  %68 = getelementptr inbounds i8, ptr %60, i64 4
  %69 = load i16, ptr %68, align 2, !tbaa !29
  %70 = zext i16 %69 to i32
  %71 = shl nuw i32 %70, 16
  %72 = getelementptr inbounds i8, ptr %60, i64 6
  %73 = load i16, ptr %72, align 2, !tbaa !30
  %74 = zext i16 %73 to i32
  %75 = or disjoint i32 %71, %74
  store i32 %75, ptr %48, align 4, !tbaa !17
  %76 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %4, i32 noundef 8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %77 = load i32, ptr %15, align 8, !tbaa !24
  %78 = sext i32 %77 to i64
  %79 = icmp slt i64 %indvars.iv.next50, %78
  br i1 %79, label %58, label %.loopexit, !llvm.loop !32

.loopexit:                                        ; preds = %58, %.preheader, %27
  %80 = load i32, ptr %19, align 8, !tbaa !18
  %81 = icmp sgt i32 %80, 0
  br i1 %81, label %.lr.ph47, label %._crit_edge

.lr.ph47:                                         ; preds = %.loopexit
  %82 = getelementptr inbounds i8, ptr %0, i64 120
  br label %85

._crit_edge:                                      ; preds = %117, %.loopexit
  %83 = getelementptr inbounds i8, ptr %0, i64 128
  %84 = call noundef zeroext i1 @_ZN2rw12MaterialList11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16) %83, ptr noundef nonnull %1)
  call void @_ZN2rw10PluginList11streamWriteEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw8Geometry9s_plglistE, ptr noundef nonnull %1, ptr noundef nonnull %0)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  ret i1 true

85:                                               ; preds = %.lr.ph47, %117
  %indvars.iv52 = phi i64 [ 0, %.lr.ph47 ], [ %indvars.iv.next53, %117 ]
  %86 = load ptr, ptr %82, align 8, !tbaa !33
  %87 = getelementptr inbounds %"struct.rw::MorphTarget", ptr %86, i64 %indvars.iv52
  %88 = getelementptr inbounds i8, ptr %87, i64 8
  %89 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %88, i32 noundef 16)
  %90 = load i32, ptr %9, align 8, !tbaa !5
  %91 = and i32 %90, 16777216
  %.not40 = icmp eq i32 %91, 0
  br i1 %.not40, label %92, label %114

92:                                               ; preds = %85
  %93 = getelementptr inbounds i8, ptr %87, i64 24
  %94 = load ptr, ptr %93, align 8, !tbaa !34
  %95 = icmp ne ptr %94, null
  %96 = zext i1 %95 to i32
  %97 = call noundef i32 @_ZN2rw6Stream8writeI32Ei(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %96)
  %98 = getelementptr inbounds i8, ptr %87, i64 32
  %99 = load ptr, ptr %98, align 8, !tbaa !39
  %100 = icmp ne ptr %99, null
  %101 = zext i1 %100 to i32
  %102 = call noundef i32 @_ZN2rw6Stream8writeI32Ei(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %101)
  %103 = load ptr, ptr %93, align 8, !tbaa !34
  %.not41 = icmp eq ptr %103, null
  br i1 %.not41, label %108, label %104

104:                                              ; preds = %92
  %105 = load i32, ptr %17, align 4, !tbaa !21
  %106 = mul i32 %105, 12
  %107 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %103, i32 noundef %106)
  br label %108

108:                                              ; preds = %104, %92
  %109 = load ptr, ptr %98, align 8, !tbaa !39
  %.not42 = icmp eq ptr %109, null
  br i1 %.not42, label %117, label %110

110:                                              ; preds = %108
  %111 = load i32, ptr %17, align 4, !tbaa !21
  %112 = mul i32 %111, 12
  %113 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %109, i32 noundef %112)
  br label %117

114:                                              ; preds = %85
  %115 = call noundef i32 @_ZN2rw6Stream8writeI32Ei(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 0)
  %116 = call noundef i32 @_ZN2rw6Stream8writeI32Ei(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 0)
  br label %117

117:                                              ; preds = %108, %110, %114
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %118 = load i32, ptr %19, align 8, !tbaa !18
  %119 = sext i32 %118 to i64
  %120 = icmp slt i64 %indvars.iv.next53, %119
  br i1 %120, label %85, label %._crit_edge, !llvm.loop !40
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN2rw8Geometry13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(168)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN2rwL13geoStructSizeEPNS_8GeometryE(ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2rw12MaterialList11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #1 align 2

declare void @_ZN2rw10PluginList11streamWriteEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 16}
!6 = !{!"_ZTSN2rw8GeometryE", !7, i64 0, !11, i64 16, !12, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !10, i64 40, !10, i64 48, !8, i64 56, !10, i64 120, !13, i64 128, !10, i64 144, !10, i64 152, !11, i64 160}
!7 = !{!"_ZTSN2rw6ObjectE", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !10, i64 8}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"_ZTSN2rw12MaterialListE", !10, i64 0, !11, i64 8, !11, i64 12}
!14 = !{!6, !11, i64 36}
!15 = !{!16, !11, i64 0}
!16 = !{!"_ZTSN2rw13GeoStreamDataE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!17 = !{!11, !11, i64 0}
!18 = !{!6, !11, i64 32}
!19 = !{!16, !11, i64 12}
!20 = !{!6, !10, i64 48}
!21 = !{!6, !11, i64 28}
!22 = !{!23, !23, i64 0}
!23 = !{!"vtable pointer", !9, i64 0}
!24 = !{!6, !11, i64 24}
!25 = !{!10, !10, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!6, !10, i64 40}
!29 = !{!12, !12, i64 0}
!30 = !{!31, !12, i64 6}
!31 = !{!"_ZTSN2rw8TriangleE", !8, i64 0, !12, i64 6}
!32 = distinct !{!32, !27}
!33 = !{!6, !10, i64 120}
!34 = !{!35, !10, i64 24}
!35 = !{!"_ZTSN2rw11MorphTargetE", !10, i64 0, !36, i64 8, !10, i64 24, !10, i64 32}
!36 = !{!"_ZTSN2rw6SphereE", !37, i64 0, !38, i64 12}
!37 = !{!"_ZTSN2rw3V3dE", !38, i64 0, !38, i64 4, !38, i64 8}
!38 = !{!"float", !8, i64 0}
!39 = !{!35, !10, i64 32}
!40 = distinct !{!40, !27}


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