; LLVM IR from aap/librw :: src/clump.ll (ZN2rw6Atomic16streamWriteClumpEPNS_6StreamEPNS_10FrameList_E)

; 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::Atomic" = type { %"struct.rw::ObjectWithFrame", ptr, %"struct.rw::Sphere", %"struct.rw::Sphere", ptr, %"struct.rw::LLLink", ptr, ptr, ptr, ptr }
%"struct.rw::ObjectWithFrame" = type { %"struct.rw::Object", %"struct.rw::LLLink", ptr }
%"struct.rw::Object" = type { i8, i8, i8, i8, ptr }
%"struct.rw::Sphere" = type { %"struct.rw::V3d", float }
%"struct.rw::V3d" = type { float, float, float }
%"struct.rw::FrameList_" = type { i32, ptr }
%"struct.rw::Clump" = type { %"struct.rw::Object", %"struct.rw::LinkList", %"struct.rw::LinkList", %"struct.rw::LinkList", ptr, %"struct.rw::LLLink" }

@_ZN2rw6Atomic9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8
@_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 nounwind uwtable
declare dso_local noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN2rw6Atomic9fromClumpEPNS_6LLLinkE(ptr noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2rw6Atomic8getFrameEv(ptr noundef nonnull align 8 dereferenceable(136)) #1 align 2

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

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

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

declare noundef zeroext i1 @_ZN2rw8Geometry11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2rw6Atomic16streamWriteClumpEPNS_6StreamEPNS_10FrameList_E(ptr noundef nonnull align 8 dereferenceable(136) %0, ptr noundef %1, ptr noundef %2) #4 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca [4 x i32], align 16
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  call void @llvm.memset.p0.i64(ptr align 16 %8, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %14 = getelementptr inbounds %"struct.rw::Atomic", ptr %13, i32 0, i32 4
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %9, align 8, !tbaa !5
  %16 = load ptr, ptr %9, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %101

19:                                               ; preds = %3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = call noundef i32 @_ZN2rw6Atomic13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(136) %13)
  %22 = call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %20, i32 noundef 20, i32 noundef %21)
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !17
  %25 = icmp slt i32 %24, 197632
  %26 = zext i1 %25 to i64
  %27 = select i1 %25, i32 12, i32 16
  %28 = call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %23, i32 noundef 1, i32 noundef %27)
  %29 = call noundef ptr @_ZNK2rw6Atomic8getFrameEv(ptr noundef nonnull align 8 dereferenceable(136) %13)
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.rw::FrameList_", ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.rw::FrameList_", ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !21
  %36 = call noundef i32 @_ZN2rw11findPointerEPvPS0_i(ptr noundef %29, ptr noundef %32, i32 noundef %35)
  %37 = getelementptr inbounds [4 x i32], ptr %8, i64 0, i64 0
  store i32 %36, ptr %37, align 16, !tbaa !17
  %38 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !17
  %39 = icmp slt i32 %38, 197632
  br i1 %39, label %40, label %54

40:                                               ; preds = %19
  %41 = getelementptr inbounds %"struct.rw::Atomic", ptr %13, i32 0, i32 0
  %42 = getelementptr inbounds %"struct.rw::ObjectWithFrame", ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %"struct.rw::Object", ptr %42, i32 0, i32 2
  %44 = load i8, ptr %43, align 2, !tbaa !22
  %45 = zext i8 %44 to i32
  %46 = getelementptr inbounds [4 x i32], ptr %8, i64 0, i64 1
  store i32 %45, ptr %46, align 4, !tbaa !17
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds [4 x i32], ptr %8, i64 0, i64 0
  %49 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef %48, i32 noundef 12)
  %50 = getelementptr inbounds %"struct.rw::Atomic", ptr %13, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !23
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = call noundef zeroext i1 @_ZN2rw8Geometry11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(168) %51, ptr noundef %52)
  br label %99

54:                                               ; preds = %19
  %55 = getelementptr inbounds [4 x i32], ptr %8, i64 0, i64 1
  store i32 0, ptr %55, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.rw::Clump", ptr %56, i32 0, i32 1
  %58 = getelementptr inbounds %"struct.rw::LinkList", ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds %"struct.rw::LLLink", ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8, !tbaa !24
  store ptr %60, ptr %12, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %84, %54
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.rw::LLLink", ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !27
  store ptr %64, ptr %11, align 8, !tbaa !5
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.rw::Clump", ptr %66, i32 0, i32 1
  %68 = call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %67)
  %69 = icmp ne ptr %65, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %61
  store i32 2, ptr %10, align 4
  br label %86

71:                                               ; preds = %61
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  %73 = call noundef ptr @_ZN2rw6Atomic9fromClumpEPNS_6LLLinkE(ptr noundef %72)
  %74 = getelementptr inbounds %"struct.rw::Atomic", ptr %73, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !23
  %76 = getelementptr inbounds %"struct.rw::Atomic", ptr %13, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !23
  %78 = icmp eq ptr %75, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %71
  store i32 5, ptr %10, align 4
  br label %86

80:                                               ; preds = %71
  %81 = getelementptr inbounds [4 x i32], ptr %8, i64 0, i64 1
  %82 = load i32, ptr %81, align 4, !tbaa !17
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %81, align 4, !tbaa !17
  br label %84

84:                                               ; preds = %80
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %85, ptr %12, align 8, !tbaa !5
  br label %61, !llvm.loop !28

86:                                               ; preds = %79, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %87 = load i32, ptr %10, align 4
  switch i32 %87, label %101 [
    i32 2, label %88
    i32 5, label %89
  ]

88:                                               ; preds = %86
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %101

89:                                               ; preds = %86
  %90 = getelementptr inbounds %"struct.rw::Atomic", ptr %13, i32 0, i32 0
  %91 = getelementptr inbounds %"struct.rw::ObjectWithFrame", ptr %90, i32 0, i32 0
  %92 = getelementptr inbounds %"struct.rw::Object", ptr %91, i32 0, i32 2
  %93 = load i8, ptr %92, align 2, !tbaa !22
  %94 = zext i8 %93 to i32
  %95 = getelementptr inbounds [4 x i32], ptr %8, i64 0, i64 2
  store i32 %94, ptr %95, align 8, !tbaa !17
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = getelementptr inbounds [4 x i32], ptr %8, i64 0, i64 0
  %98 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %96, ptr noundef %97, i32 noundef 16)
  br label %99

99:                                               ; preds = %89, %40
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN2rw10PluginList11streamWriteEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw6Atomic9s_plglistE, ptr noundef %100, ptr noundef %13)
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %101

101:                                              ; preds = %99, %88, %86, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  %102 = load i1, ptr %4, align 1
  ret i1 %102
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN2rw6Atomic13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(136)) #4 align 2

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: write) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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, !6, i64 80}
!10 = !{!"_ZTSN2rw6AtomicE", !11, i64 0, !6, i64 40, !14, i64 48, !14, i64 64, !6, i64 80, !13, i64 88, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128}
!11 = !{!"_ZTSN2rw15ObjectWithFrameE", !12, i64 0, !13, i64 16, !6, i64 32}
!12 = !{!"_ZTSN2rw6ObjectE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !6, i64 8}
!13 = !{!"_ZTSN2rw6LLLinkE", !6, i64 0, !6, i64 8}
!14 = !{!"_ZTSN2rw6SphereE", !15, i64 0, !16, i64 12}
!15 = !{!"_ZTSN2rw3V3dE", !16, i64 0, !16, i64 4, !16, i64 8}
!16 = !{!"float", !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!20, !6, i64 8}
!20 = !{!"_ZTSN2rw10FrameList_E", !18, i64 0, !6, i64 8}
!21 = !{!20, !18, i64 0}
!22 = !{!10, !7, i64 2}
!23 = !{!10, !6, i64 40}
!24 = !{!25, !6, i64 16}
!25 = !{!"_ZTSN2rw5ClumpE", !12, i64 0, !26, i64 16, !26, i64 32, !26, i64 48, !6, i64 64, !13, i64 72}
!26 = !{!"_ZTSN2rw8LinkListE", !13, i64 0}
!27 = !{!13, !6, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


; 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 }

@_ZN2rw6Atomic9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8
@_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 nounwind uwtable
declare dso_local noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN2rw6Atomic9fromClumpEPNS_6LLLinkE(ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2rw6Atomic8getFrameEv(ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #1 align 2

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

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

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

declare noundef zeroext i1 @_ZN2rw8Geometry11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2rw6Atomic16streamWriteClumpEPNS_6StreamEPNS_10FrameList_E(ptr noundef nonnull align 8 dereferenceable(136) %0, ptr noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #4 align 2 {
  %4 = alloca [4 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  %5 = getelementptr inbounds i8, ptr %0, i64 80
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %.loopexit, label %8

8:                                                ; preds = %3
  %9 = tail call noundef i32 @_ZN2rw6Atomic13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(136) %0)
  %10 = tail call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %1, i32 noundef 20, i32 noundef %9)
  %11 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !16
  %12 = icmp slt i32 %11, 197632
  %13 = select i1 %12, i32 12, i32 16
  %14 = tail call noundef zeroext i1 @_ZN2rw16writeChunkHeaderEPNS_6StreamEii(ptr noundef %1, i32 noundef 1, i32 noundef %13)
  %15 = tail call noundef ptr @_ZNK2rw6Atomic8getFrameEv(ptr noundef nonnull align 8 dereferenceable(136) %0)
  %16 = getelementptr inbounds i8, ptr %2, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !18
  %18 = load i32, ptr %2, align 8, !tbaa !20
  %19 = tail call noundef i32 @_ZN2rw11findPointerEPvPS0_i(ptr noundef %15, ptr noundef %17, i32 noundef %18)
  store i32 %19, ptr %4, align 16, !tbaa !16
  %20 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !16
  %21 = icmp slt i32 %20, 197632
  br i1 %21, label %22, label %31

22:                                               ; preds = %8
  %23 = getelementptr inbounds i8, ptr %0, i64 2
  %24 = load i8, ptr %23, align 2, !tbaa !21
  %25 = zext i8 %24 to i32
  %26 = getelementptr inbounds i8, ptr %4, i64 4
  store i32 %25, ptr %26, align 4, !tbaa !16
  %27 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %4, i32 noundef 12)
  %28 = getelementptr inbounds i8, ptr %0, i64 40
  %29 = load ptr, ptr %28, align 8, !tbaa !22
  %30 = call noundef zeroext i1 @_ZN2rw8Geometry11streamWriteEPNS_6StreamE(ptr noundef nonnull align 8 dereferenceable(168) %29, ptr noundef nonnull %1)
  br label %56

31:                                               ; preds = %8
  %32 = getelementptr inbounds i8, ptr %4, i64 4
  %33 = getelementptr inbounds i8, ptr %6, i64 16
  %34 = load ptr, ptr %33, align 8, !tbaa !23
  %35 = load ptr, ptr %34, align 8, !tbaa !26
  %36 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %33)
  %.not23 = icmp eq ptr %34, %36
  br i1 %.not23, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %31
  %37 = getelementptr inbounds i8, ptr %0, i64 40
  br label %38

38:                                               ; preds = %.lr.ph, %46
  %39 = phi ptr [ %35, %.lr.ph ], [ %48, %46 ]
  %.024 = phi ptr [ %34, %.lr.ph ], [ %39, %46 ]
  %40 = phi i32 [ 0, %.lr.ph ], [ %47, %46 ]
  %41 = tail call noundef ptr @_ZN2rw6Atomic9fromClumpEPNS_6LLLinkE(ptr noundef nonnull %.024)
  %42 = getelementptr inbounds i8, ptr %41, i64 40
  %43 = load ptr, ptr %42, align 8, !tbaa !22
  %44 = load ptr, ptr %37, align 8, !tbaa !22
  %45 = icmp eq ptr %43, %44
  br i1 %45, label %50, label %46

46:                                               ; preds = %38
  %47 = add nuw nsw i32 %40, 1
  %48 = load ptr, ptr %39, align 8, !tbaa !26
  %49 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %33)
  %.not = icmp eq ptr %39, %49
  br i1 %.not, label %.loopexit, label %38, !llvm.loop !27

50:                                               ; preds = %38
  store i32 %40, ptr %32, align 4, !tbaa !16
  %51 = getelementptr inbounds i8, ptr %0, i64 2
  %52 = load i8, ptr %51, align 2, !tbaa !21
  %53 = zext i8 %52 to i32
  %54 = getelementptr inbounds i8, ptr %4, i64 8
  store i32 %53, ptr %54, align 8, !tbaa !16
  %55 = call noundef i32 @_ZN2rw6Stream7write32EPKvj(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %4, i32 noundef 16)
  br label %56

56:                                               ; preds = %50, %22
  call void @_ZN2rw10PluginList11streamWriteEPNS_6StreamEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw6Atomic9s_plglistE, ptr noundef %1, ptr noundef nonnull %0)
  br label %.loopexit

.loopexit:                                        ; preds = %46, %31, %3, %56
  %.018 = phi i1 [ true, %56 ], [ false, %3 ], [ false, %31 ], [ false, %46 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  ret i1 %.018
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN2rw6Atomic13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #4 align 2

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: write) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 80}
!6 = !{!"_ZTSN2rw6AtomicE", !7, i64 0, !11, i64 40, !13, i64 48, !13, i64 64, !11, i64 80, !12, i64 88, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128}
!7 = !{!"_ZTSN2rw15ObjectWithFrameE", !8, i64 0, !12, i64 16, !11, i64 32}
!8 = !{!"_ZTSN2rw6ObjectE", !9, i64 0, !9, i64 1, !9, i64 2, !9, i64 3, !11, i64 8}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTSN2rw6LLLinkE", !11, i64 0, !11, i64 8}
!13 = !{!"_ZTSN2rw6SphereE", !14, i64 0, !15, i64 12}
!14 = !{!"_ZTSN2rw3V3dE", !15, i64 0, !15, i64 4, !15, i64 8}
!15 = !{!"float", !9, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !9, i64 0}
!18 = !{!19, !11, i64 8}
!19 = !{!"_ZTSN2rw10FrameList_E", !17, i64 0, !11, i64 8}
!20 = !{!19, !17, i64 0}
!21 = !{!6, !9, i64 2}
!22 = !{!6, !11, i64 40}
!23 = !{!24, !11, i64 16}
!24 = !{!"_ZTSN2rw5ClumpE", !8, i64 0, !25, i64 16, !25, i64 32, !25, i64 48, !11, i64 64, !12, i64 72}
!25 = !{!"_ZTSN2rw8LinkListE", !12, i64 0}
!26 = !{!12, !11, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


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