; LLVM IR from aap/librw :: src/frame.ll (ZN2rw10FrameList_11streamWriteEPNS_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::FrameStreamData" = type { %"struct.rw::V3d", %"struct.rw::V3d", %"struct.rw::V3d", %"struct.rw::V3d", i32, i32 }
%"struct.rw::V3d" = type { float, float, float }
%"struct.rw::FrameList_" = type { i32, ptr }
%"struct.rw::Frame" = type { %"struct.rw::Object", %"struct.rw::LLLink", %"struct.rw::LinkList", %"struct.rw::Matrix", %"struct.rw::Matrix", ptr, ptr, ptr }
%"struct.rw::Object" = type { i8, i8, i8, i8, ptr }
%"struct.rw::Matrix" = type { %"struct.rw::V3d", i32, %"struct.rw::V3d", i32, %"struct.rw::V3d", i32, %"struct.rw::V3d", i32 }

@_ZN2rw5Frame9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNK2rw5Frame9getParentEv(ptr noundef nonnull align 8 dereferenceable(200)) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw10FrameList_11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.rw::FrameStreamData", align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  %13 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = sext i32 %14 to i64
  %16 = mul i64 %15, 56
  %17 = add i64 4, %16
  %18 = trunc i64 %17 to i32
  store i32 %18, ptr %7, align 4, !tbaa !9
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = add nsw i32 12, %19
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = add nsw i32 %21, %20
  store i32 %22, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %40, %2
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !11
  %27 = icmp slt i32 %24, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %43

29:                                               ; preds = %23
  %30 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 1
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds ptr, ptr %31, i64 %33
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = call noundef i32 @_ZN2rw10PluginList13streamGetSizeEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw5Frame9s_plglistE, ptr noundef %35)
  %37 = add nsw i32 12, %36
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = add nsw i32 %38, %37
  store i32 %39, ptr %6, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %29
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %8, align 4, !tbaa !9
  br label %23, !llvm.loop !14

43:                                               ; preds = %28
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %44, i32 noundef 14, i32 noundef %45)
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %47, i32 noundef 1, i32 noundef %48)
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !11
  %53 = call noundef i32 @_ZN2rw6Stream8writeU32Ej(ptr noundef nonnull align 8 dereferenceable(8) %50, i32 noundef %52)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %94, %43
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 0
  %57 = load i32, ptr %56, align 8, !tbaa !11
  %58 = icmp slt i32 %55, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %97

60:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %61 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !13
  %63 = load i32, ptr %9, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds ptr, ptr %62, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  store ptr %66, ptr %10, align 8, !tbaa !5
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.rw::Frame", ptr %67, i32 0, i32 3
  %69 = getelementptr inbounds %"struct.rw::Matrix", ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds %"struct.rw::FrameStreamData", ptr %5, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %70, ptr align 8 %69, i64 12, i1 false), !tbaa.struct !16
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.rw::Frame", ptr %71, i32 0, i32 3
  %73 = getelementptr inbounds %"struct.rw::Matrix", ptr %72, i32 0, i32 2
  %74 = getelementptr inbounds %"struct.rw::FrameStreamData", ptr %5, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %74, ptr align 8 %73, i64 12, i1 false), !tbaa.struct !16
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.rw::Frame", ptr %75, i32 0, i32 3
  %77 = getelementptr inbounds %"struct.rw::Matrix", ptr %76, i32 0, i32 4
  %78 = getelementptr inbounds %"struct.rw::FrameStreamData", ptr %5, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %78, ptr align 8 %77, i64 12, i1 false), !tbaa.struct !16
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.rw::Frame", ptr %79, i32 0, i32 3
  %81 = getelementptr inbounds %"struct.rw::Matrix", ptr %80, i32 0, i32 6
  %82 = getelementptr inbounds %"struct.rw::FrameStreamData", ptr %5, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %82, ptr align 8 %81, i64 12, i1 false), !tbaa.struct !16
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = call noundef ptr @_ZNK2rw5Frame9getParentEv(ptr noundef nonnull align 8 dereferenceable(200) %83)
  %85 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !13
  %87 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 0
  %88 = load i32, ptr %87, align 8, !tbaa !11
  %89 = call noundef i32 @_ZN2rw11findPointerEPvPS0_i(ptr noundef %84, ptr noundef %86, i32 noundef %88)
  %90 = getelementptr inbounds %"struct.rw::FrameStreamData", ptr %5, i32 0, i32 4
  store i32 %89, ptr %90, align 4, !tbaa !19
  %91 = getelementptr inbounds %"struct.rw::FrameStreamData", ptr %5, i32 0, i32 5
  store i32 0, ptr %91, align 4, !tbaa !22
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %92, ptr noundef %5, i32 noundef 56)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %94

94:                                               ; preds = %60
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %9, align 4, !tbaa !9
  br label %54, !llvm.loop !23

97:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %112, %97
  %99 = load i32, ptr %11, align 4, !tbaa !9
  %100 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !11
  %102 = icmp slt i32 %99, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %115

104:                                              ; preds = %98
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %"struct.rw::FrameList_", ptr %12, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !13
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds ptr, ptr %107, i64 %109
  %111 = load ptr, ptr %110, align 8, !tbaa !5
  call void @_ZN2rw10PluginList11streamWriteEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw5Frame9s_plglistE, ptr noundef %105, ptr noundef %111)
  br label %112

112:                                              ; preds = %104
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %11, align 4, !tbaa !9
  br label %98, !llvm.loop !24

115:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 56, ptr %5) #5
  ret void
}

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

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

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

declare noundef i32 @_ZN2rw11findPointerEPvPS0_i(ptr noundef, ptr noundef, i32 noundef) #4

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

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

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


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

@_ZN2rw5Frame9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNK2rw5Frame9getParentEv(ptr noundef nonnull align 8 dereferenceable(200)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw10FrameList_11streamWriteEPNS_6StreamE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %0, ptr noundef %1) local_unnamed_addr #3 align 2 {
  %3 = alloca %"struct.rw::FrameStreamData", align 4
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #5
  %4 = load i32, ptr %0, align 8, !tbaa !5
  %5 = mul i32 %4, 56
  %6 = or disjoint i32 %5, 4
  %7 = add nsw i32 %5, 16
  %8 = icmp sgt i32 %4, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  br label %22

._crit_edge:                                      ; preds = %22, %2
  %.024.lcssa = phi i32 [ %7, %2 ], [ %28, %22 ]
  %10 = tail call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %1, i32 noundef 14, i32 noundef %.024.lcssa)
  %11 = tail call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %1, i32 noundef 1, i32 noundef %6)
  %12 = load i32, ptr %0, align 8, !tbaa !5
  %13 = tail call noundef i32 @_ZN2rw6Stream8writeU32Ej(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %12)
  %14 = load i32, ptr %0, align 8, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph31, label %._crit_edge34

.lr.ph31:                                         ; preds = %._crit_edge
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = getelementptr inbounds i8, ptr %3, i64 12
  %18 = getelementptr inbounds i8, ptr %3, i64 24
  %19 = getelementptr inbounds i8, ptr %3, i64 36
  %20 = getelementptr inbounds i8, ptr %3, i64 48
  %21 = getelementptr inbounds i8, ptr %3, i64 52
  br label %34

22:                                               ; preds = %.lr.ph, %22
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %22 ]
  %.02428 = phi i32 [ %7, %.lr.ph ], [ %28, %22 ]
  %23 = load ptr, ptr %9, align 8, !tbaa !11
  %24 = getelementptr inbounds ptr, ptr %23, i64 %indvars.iv
  %25 = load ptr, ptr %24, align 8, !tbaa !12
  %26 = tail call noundef i32 @_ZN2rw10PluginList13streamGetSizeEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw5Frame9s_plglistE, ptr noundef %25)
  %27 = add i32 %.02428, 12
  %28 = add i32 %27, %26
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr %0, align 8, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next, %30
  br i1 %31, label %22, label %._crit_edge, !llvm.loop !13

.preheader:                                       ; preds = %34
  %32 = icmp sgt i32 %47, 0
  br i1 %32, label %.lr.ph33, label %._crit_edge34

.lr.ph33:                                         ; preds = %.preheader
  %33 = getelementptr inbounds i8, ptr %0, i64 8
  br label %50

34:                                               ; preds = %.lr.ph31, %34
  %indvars.iv36 = phi i64 [ 0, %.lr.ph31 ], [ %indvars.iv.next37, %34 ]
  %35 = load ptr, ptr %16, align 8, !tbaa !11
  %36 = getelementptr inbounds ptr, ptr %35, i64 %indvars.iv36
  %37 = load ptr, ptr %36, align 8, !tbaa !12
  %38 = getelementptr inbounds i8, ptr %37, i64 48
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 8 dereferenceable(12) %38, i64 12, i1 false), !tbaa.struct !15
  %39 = getelementptr inbounds i8, ptr %37, i64 64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %17, ptr noundef nonnull align 8 dereferenceable(12) %39, i64 12, i1 false), !tbaa.struct !15
  %40 = getelementptr inbounds i8, ptr %37, i64 80
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %18, ptr noundef nonnull align 8 dereferenceable(12) %40, i64 12, i1 false), !tbaa.struct !15
  %41 = getelementptr inbounds i8, ptr %37, i64 96
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 8 dereferenceable(12) %41, i64 12, i1 false), !tbaa.struct !15
  %42 = call noundef ptr @_ZNK2rw5Frame9getParentEv(ptr noundef nonnull align 8 dereferenceable(200) %37)
  %43 = load ptr, ptr %16, align 8, !tbaa !11
  %44 = load i32, ptr %0, align 8, !tbaa !5
  %45 = call noundef i32 @_ZN2rw11findPointerEPvPS0_i(ptr noundef %42, ptr noundef %43, i32 noundef %44)
  store i32 %45, ptr %20, align 4, !tbaa !18
  store i32 0, ptr %21, align 4, !tbaa !21
  %46 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %3, i32 noundef 56)
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %47 = load i32, ptr %0, align 8, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %indvars.iv.next37, %48
  br i1 %49, label %34, label %.preheader, !llvm.loop !22

._crit_edge34:                                    ; preds = %50, %._crit_edge, %.preheader
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #5
  ret void

50:                                               ; preds = %.lr.ph33, %50
  %indvars.iv39 = phi i64 [ 0, %.lr.ph33 ], [ %indvars.iv.next40, %50 ]
  %51 = load ptr, ptr %33, align 8, !tbaa !11
  %52 = getelementptr inbounds ptr, ptr %51, i64 %indvars.iv39
  %53 = load ptr, ptr %52, align 8, !tbaa !12
  call void @_ZN2rw10PluginList11streamWriteEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw5Frame9s_plglistE, ptr noundef nonnull %1, ptr noundef %53)
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %54 = load i32, ptr %0, align 8, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next40, %55
  br i1 %56, label %50, label %._crit_edge34, !llvm.loop !23
}

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

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

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

declare noundef i32 @_ZN2rw11findPointerEPvPS0_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { 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 = !{!"_ZTSN2rw10FrameList_E", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!10, !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{i64 0, i64 4, !16, i64 4, i64 4, !16, i64 8, i64 4, !16}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !8, i64 0}
!18 = !{!19, !7, i64 48}
!19 = !{!"_ZTSN2rw15FrameStreamDataE", !20, i64 0, !20, i64 12, !20, i64 24, !20, i64 36, !7, i64 48, !7, i64 52}
!20 = !{!"_ZTSN2rw3V3dE", !17, i64 0, !17, i64 4, !17, i64 8}
!21 = !{!19, !7, i64 52}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}


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