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

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

@_ZN2rw5Clump9s_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 @_ZNK2rw5Clump8getFrameEv(ptr noundef nonnull align 8 dereferenceable(88)) #1 align 2

; 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 @_ZN2rw5Light9fromClumpEPNS_6LLLinkE(ptr noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN2rw5Clump13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(88) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  %13 = load i32, ptr %3, align 4, !tbaa !9
  %14 = add i32 %13, 12
  store i32 %14, ptr %3, align 4, !tbaa !9
  %15 = load i32, ptr %3, align 4, !tbaa !9
  %16 = add i32 %15, 4
  store i32 %16, ptr %3, align 4, !tbaa !9
  %17 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !9
  %18 = icmp sgt i32 %17, 208896
  br i1 %18, label %19, label %22

19:                                               ; preds = %1
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = add i32 %20, 8
  store i32 %21, ptr %3, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %19, %1
  %23 = call noundef ptr @_ZNK2rw5Clump8getFrameEv(ptr noundef nonnull align 8 dereferenceable(88) %12)
  %24 = call noundef i32 @_ZN2rw10FrameList_13streamGetSizeEPNS_5FrameE(ptr noundef %23)
  %25 = load i32, ptr %3, align 4, !tbaa !9
  %26 = add i32 %25, %24
  store i32 %26, ptr %3, align 4, !tbaa !9
  %27 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !9
  %28 = icmp sge i32 %27, 197632
  br i1 %28, label %29, label %57

29:                                               ; preds = %22
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = add i32 %30, 28
  store i32 %31, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %32 = getelementptr inbounds %"struct.rw::Clump", ptr %12, i32 0, i32 1
  %33 = getelementptr inbounds %"struct.rw::LinkList", ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds %"struct.rw::LLLink", ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  store ptr %35, ptr %5, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %54, %29
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.rw::LLLink", ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !16
  store ptr %39, ptr %4, align 8, !tbaa !5
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.rw::Clump", ptr %12, i32 0, i32 1
  %42 = call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %41)
  %43 = icmp ne ptr %40, %42
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %36
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = call noundef ptr @_ZN2rw6Atomic9fromClumpEPNS_6LLLinkE(ptr noundef %46)
  %48 = getelementptr inbounds %"struct.rw::Atomic", ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  %50 = call noundef i32 @_ZN2rw8Geometry13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(168) %49)
  %51 = add i32 12, %50
  %52 = load i32, ptr %3, align 4, !tbaa !9
  %53 = add i32 %52, %51
  store i32 %53, ptr %3, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %45
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %55, ptr %5, align 8, !tbaa !5
  br label %36, !llvm.loop !23

56:                                               ; preds = %44
  br label %57

57:                                               ; preds = %56, %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %58 = getelementptr inbounds %"struct.rw::Clump", ptr %12, i32 0, i32 1
  %59 = getelementptr inbounds %"struct.rw::LinkList", ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %"struct.rw::LLLink", ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !11
  store ptr %61, ptr %7, align 8, !tbaa !5
  br label %62

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

70:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %80

71:                                               ; preds = %62
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = call noundef ptr @_ZN2rw6Atomic9fromClumpEPNS_6LLLinkE(ptr noundef %72)
  %74 = call noundef i32 @_ZN2rw6Atomic13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(136) %73)
  %75 = add i32 12, %74
  %76 = load i32, ptr %3, align 4, !tbaa !9
  %77 = add i32 %76, %75
  store i32 %77, ptr %3, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %71
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %79, ptr %7, align 8, !tbaa !5
  br label %62, !llvm.loop !25

80:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %81 = getelementptr inbounds %"struct.rw::Clump", ptr %12, i32 0, i32 2
  %82 = getelementptr inbounds %"struct.rw::LinkList", ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds %"struct.rw::LLLink", ptr %82, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8, !tbaa !26
  store ptr %84, ptr %9, align 8, !tbaa !5
  br label %85

85:                                               ; preds = %101, %80
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.rw::LLLink", ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !16
  store ptr %88, ptr %8, align 8, !tbaa !5
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.rw::Clump", ptr %12, i32 0, i32 2
  %91 = call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %90)
  %92 = icmp ne ptr %89, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %103

94:                                               ; preds = %85
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = call noundef ptr @_ZN2rw5Light9fromClumpEPNS_6LLLinkE(ptr noundef %95)
  %97 = call noundef i32 @_ZN2rw5Light13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(120) %96)
  %98 = add i32 28, %97
  %99 = load i32, ptr %3, align 4, !tbaa !9
  %100 = add i32 %99, %98
  store i32 %100, ptr %3, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %94
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %102, ptr %9, align 8, !tbaa !5
  br label %85, !llvm.loop !27

103:                                              ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %104 = getelementptr inbounds %"struct.rw::Clump", ptr %12, i32 0, i32 3
  %105 = getelementptr inbounds %"struct.rw::LinkList", ptr %104, i32 0, i32 0
  %106 = getelementptr inbounds %"struct.rw::LLLink", ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !28
  store ptr %107, ptr %11, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %124, %103
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.rw::LLLink", ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !16
  store ptr %111, ptr %10, align 8, !tbaa !5
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = getelementptr inbounds %"struct.rw::Clump", ptr %12, i32 0, i32 3
  %114 = call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %113)
  %115 = icmp ne ptr %112, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %126

117:                                              ; preds = %108
  %118 = load ptr, ptr %11, align 8, !tbaa !5
  %119 = call noundef ptr @_ZN2rw6Camera9fromClumpEPNS_6LLLinkE(ptr noundef %118)
  %120 = call noundef i32 @_ZN2rw6Camera13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(600) %119)
  %121 = add i32 28, %120
  %122 = load i32, ptr %3, align 4, !tbaa !9
  %123 = add i32 %122, %121
  store i32 %123, ptr %3, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %117
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %125, ptr %11, align 8, !tbaa !5
  br label %108, !llvm.loop !29

126:                                              ; preds = %116
  %127 = call noundef i32 @_ZN2rw10PluginList13streamGetSizeEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw5Clump9s_plglistE, ptr noundef %12)
  %128 = add nsw i32 12, %127
  %129 = load i32, ptr %3, align 4, !tbaa !9
  %130 = add i32 %129, %128
  store i32 %130, ptr %3, align 4, !tbaa !9
  %131 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret i32 %131
}

declare noundef i32 @_ZN2rw8Geometry13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(168)) #3

declare noundef i32 @_ZN2rw10FrameList_13streamGetSizeEPNS_5FrameE(ptr noundef) #3

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

declare noundef i32 @_ZN2rw5Light13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(120)) #3

declare noundef i32 @_ZN2rw6Camera13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(600)) #3

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

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 = { 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 = { "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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTSN2rw5ClumpE", !13, i64 0, !14, i64 16, !14, i64 32, !14, i64 48, !6, i64 64, !15, i64 72}
!13 = !{!"_ZTSN2rw6ObjectE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !6, i64 8}
!14 = !{!"_ZTSN2rw8LinkListE", !15, i64 0}
!15 = !{!"_ZTSN2rw6LLLinkE", !6, i64 0, !6, i64 8}
!16 = !{!15, !6, i64 0}
!17 = !{!18, !6, i64 40}
!18 = !{!"_ZTSN2rw6AtomicE", !19, i64 0, !6, i64 40, !20, i64 48, !20, i64 64, !6, i64 80, !15, i64 88, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128}
!19 = !{!"_ZTSN2rw15ObjectWithFrameE", !13, i64 0, !15, i64 16, !6, i64 32}
!20 = !{!"_ZTSN2rw6SphereE", !21, i64 0, !22, i64 12}
!21 = !{!"_ZTSN2rw3V3dE", !22, i64 0, !22, i64 4, !22, i64 8}
!22 = !{!"float", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !24}
!26 = !{!12, !6, i64 32}
!27 = distinct !{!27, !24}
!28 = !{!12, !6, i64 48}
!29 = distinct !{!29, !24}


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

@_ZN2rw5Clump9s_plglistE = external dso_local global %"struct.rw::PluginList", align 8
@_ZN2rw7versionE = external local_unnamed_addr global i32, align 4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN2rw5Clump13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(88) %0) local_unnamed_addr #1 align 2 {
  %2 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 208896
  %spec.select = select i1 %3, i32 24, i32 16
  %4 = tail call noundef ptr @_ZNK2rw5Clump8getFrameEv(ptr noundef nonnull align 8 dereferenceable(88) %0)
  %5 = tail call noundef i32 @_ZN2rw10FrameList_13streamGetSizeEPNS_5FrameE(ptr noundef %4)
  %6 = add i32 %spec.select, %5
  %7 = load i32, ptr @_ZN2rw7versionE, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 197631
  br i1 %8, label %9, label %.loopexit

9:                                                ; preds = %1
  %10 = add i32 %6, 28
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %.not34 = icmp eq ptr %12, %14
  br i1 %.not34, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %9, %.lr.ph
  %15 = phi ptr [ %22, %.lr.ph ], [ %13, %9 ]
  %.02936 = phi ptr [ %15, %.lr.ph ], [ %12, %9 ]
  %.135 = phi i32 [ %21, %.lr.ph ], [ %10, %9 ]
  %16 = tail call noundef ptr @_ZN2rw6Atomic9fromClumpEPNS_6LLLinkE(ptr noundef nonnull %.02936)
  %17 = getelementptr inbounds i8, ptr %16, i64 40
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %19 = tail call noundef i32 @_ZN2rw8Geometry13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(168) %18)
  %20 = add i32 %.135, 12
  %21 = add i32 %20, %19
  %22 = load ptr, ptr %15, align 8, !tbaa !15
  %23 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %.not = icmp eq ptr %15, %23
  br i1 %.not, label %.loopexit, label %.lr.ph, !llvm.loop !22

.loopexit:                                        ; preds = %.lr.ph, %9, %1
  %.2 = phi i32 [ %6, %1 ], [ %10, %9 ], [ %21, %.lr.ph ]
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %24)
  %.not3137 = icmp eq ptr %25, %27
  br i1 %.not3137, label %._crit_edge, label %.lr.ph40

._crit_edge:                                      ; preds = %.lr.ph40, %.loopexit
  %.3.lcssa = phi i32 [ %.2, %.loopexit ], [ %36, %.lr.ph40 ]
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  %29 = load ptr, ptr %28, align 8, !tbaa !24
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %28)
  %.not3242 = icmp eq ptr %29, %31
  br i1 %.not3242, label %._crit_edge47, label %.lr.ph46

.lr.ph40:                                         ; preds = %.loopexit, %.lr.ph40
  %32 = phi ptr [ %37, %.lr.ph40 ], [ %26, %.loopexit ]
  %.02839 = phi ptr [ %32, %.lr.ph40 ], [ %25, %.loopexit ]
  %.338 = phi i32 [ %36, %.lr.ph40 ], [ %.2, %.loopexit ]
  %33 = tail call noundef ptr @_ZN2rw6Atomic9fromClumpEPNS_6LLLinkE(ptr noundef nonnull %.02839)
  %34 = tail call noundef i32 @_ZN2rw6Atomic13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(136) %33)
  %35 = add i32 %.338, 12
  %36 = add i32 %35, %34
  %37 = load ptr, ptr %32, align 8, !tbaa !15
  %38 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %24)
  %.not31 = icmp eq ptr %32, %38
  br i1 %.not31, label %._crit_edge, label %.lr.ph40, !llvm.loop !25

._crit_edge47:                                    ; preds = %.lr.ph46, %._crit_edge
  %.4.lcssa = phi i32 [ %.3.lcssa, %._crit_edge ], [ %47, %.lr.ph46 ]
  %39 = getelementptr inbounds i8, ptr %0, i64 48
  %40 = load ptr, ptr %39, align 8, !tbaa !26
  %41 = load ptr, ptr %40, align 8, !tbaa !15
  %42 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %39)
  %.not3349 = icmp eq ptr %40, %42
  br i1 %.not3349, label %._crit_edge54, label %.lr.ph53

.lr.ph46:                                         ; preds = %._crit_edge, %.lr.ph46
  %43 = phi ptr [ %48, %.lr.ph46 ], [ %30, %._crit_edge ]
  %.02744 = phi ptr [ %43, %.lr.ph46 ], [ %29, %._crit_edge ]
  %.443 = phi i32 [ %47, %.lr.ph46 ], [ %.3.lcssa, %._crit_edge ]
  %44 = tail call noundef ptr @_ZN2rw5Light9fromClumpEPNS_6LLLinkE(ptr noundef nonnull %.02744)
  %45 = tail call noundef i32 @_ZN2rw5Light13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(120) %44)
  %46 = add i32 %.443, 28
  %47 = add i32 %46, %45
  %48 = load ptr, ptr %43, align 8, !tbaa !15
  %49 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %28)
  %.not32 = icmp eq ptr %43, %49
  br i1 %.not32, label %._crit_edge47, label %.lr.ph46, !llvm.loop !27

._crit_edge54:                                    ; preds = %.lr.ph53, %._crit_edge47
  %.5.lcssa = phi i32 [ %.4.lcssa, %._crit_edge47 ], [ %57, %.lr.ph53 ]
  %50 = tail call noundef i32 @_ZN2rw10PluginList13streamGetSizeEPv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN2rw5Clump9s_plglistE, ptr noundef nonnull %0)
  %51 = add i32 %.5.lcssa, 12
  %52 = add i32 %51, %50
  ret i32 %52

.lr.ph53:                                         ; preds = %._crit_edge47, %.lr.ph53
  %53 = phi ptr [ %58, %.lr.ph53 ], [ %41, %._crit_edge47 ]
  %.051 = phi ptr [ %53, %.lr.ph53 ], [ %40, %._crit_edge47 ]
  %.550 = phi i32 [ %57, %.lr.ph53 ], [ %.4.lcssa, %._crit_edge47 ]
  %54 = tail call noundef ptr @_ZN2rw6Camera9fromClumpEPNS_6LLLinkE(ptr noundef nonnull %.051)
  %55 = tail call noundef i32 @_ZN2rw6Camera13streamGetSizeEv(ptr noundef nonnull align 8 dereferenceable(600) %54)
  %56 = add i32 %.550, 28
  %57 = add i32 %56, %55
  %58 = load ptr, ptr %53, align 8, !tbaa !15
  %59 = tail call noundef ptr @_ZN2rw8LinkList3endEv(ptr noundef nonnull align 8 dereferenceable(16) %39)
  %.not33 = icmp eq ptr %53, %59
  br i1 %.not33, label %._crit_edge54, label %.lr.ph53, !llvm.loop !28
}

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

declare noundef i32 @_ZN2rw10FrameList_13streamGetSizeEPNS_5FrameE(ptr noundef) local_unnamed_addr #2

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

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

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

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

attributes #0 = { 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 #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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 16}
!10 = !{!"_ZTSN2rw5ClumpE", !11, i64 0, !13, i64 16, !13, i64 32, !13, i64 48, !12, i64 64, !14, i64 72}
!11 = !{!"_ZTSN2rw6ObjectE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !12, i64 8}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"_ZTSN2rw8LinkListE", !14, i64 0}
!14 = !{!"_ZTSN2rw6LLLinkE", !12, i64 0, !12, i64 8}
!15 = !{!14, !12, i64 0}
!16 = !{!17, !12, i64 40}
!17 = !{!"_ZTSN2rw6AtomicE", !18, i64 0, !12, i64 40, !19, i64 48, !19, i64 64, !12, i64 80, !14, i64 88, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128}
!18 = !{!"_ZTSN2rw15ObjectWithFrameE", !11, i64 0, !14, i64 16, !12, i64 32}
!19 = !{!"_ZTSN2rw6SphereE", !20, i64 0, !21, i64 12}
!20 = !{!"_ZTSN2rw3V3dE", !21, i64 0, !21, i64 4, !21, i64 8}
!21 = !{!"float", !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!10, !12, i64 32}
!25 = distinct !{!25, !23}
!26 = !{!10, !12, i64 48}
!27 = distinct !{!27, !23}
!28 = distinct !{!28, !23}


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