; LLVM IR from aap/librw :: src/userdata.ll (ZN2rw17UserDataExtension3addEPKcii)

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

@_ZN2rw6Engine8memfuncsE = external global %"struct.rw::MemoryFunctions", align 8
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [60 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw17UserDataExtension3addEPKcii = external hidden unnamed_addr constant [61 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #3

; 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 i32 @_ZN2rw17UserDataExtension3addEPKcii(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #4 align 2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  %15 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %32, %4
  %17 = load i32, ptr %10, align 4, !tbaa !9
  %18 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 0
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = icmp slt i32 %17, %19
  br i1 %20, label %21, label %35

21:                                               ; preds = %16
  %22 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 1
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = load i32, ptr %10, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %23, i64 %25
  %27 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 8, !tbaa !14
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %21
  br label %61

31:                                               ; preds = %21
  br label %32

32:                                               ; preds = %31
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %10, align 4, !tbaa !9
  br label %16, !llvm.loop !16

35:                                               ; preds = %16
  %36 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 0
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = add nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = mul i64 %39, 24
  %41 = call noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef %40, i32 noundef 196895, ptr noundef @.str.1)
  store ptr %41, ptr %13, align 8, !tbaa !5
  %42 = load ptr, ptr %13, align 8, !tbaa !5
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %45

44:                                               ; preds = %35
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %138

45:                                               ; preds = %35
  %46 = load ptr, ptr %13, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !13
  %49 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !11
  %51 = sext i32 %50 to i64
  %52 = mul i64 %51, 24
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %46, ptr align 8 %48, i64 %52, i1 false)
  %53 = load ptr, ptr getelementptr inbounds (%"struct.rw::MemoryFunctions", ptr @_ZN2rw6Engine8memfuncsE, i32 0, i32 2), align 8, !tbaa !18
  %54 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  call void %53(ptr noundef %55)
  %56 = load ptr, ptr %13, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 1
  store ptr %56, ptr %57, align 8, !tbaa !13
  %58 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !11
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %58, align 8, !tbaa !11
  store i32 %59, ptr %10, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %45, %30
  %62 = getelementptr inbounds %"struct.rw::UserDataExtension", ptr %15, i32 0, i32 1
  %63 = load ptr, ptr %62, align 8, !tbaa !13
  %64 = load i32, ptr %10, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %63, i64 %65
  store ptr %66, ptr %13, align 8, !tbaa !5
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = call i64 @strlen(ptr noundef %67) #9
  %69 = trunc i64 %68 to i32
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %11, align 4, !tbaa !9
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = add nsw i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = call noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef %73, i32 noundef 196895, ptr noundef @.str.2)
  %75 = load ptr, ptr %13, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %75, i32 0, i32 0
  store ptr %74, ptr %76, align 8, !tbaa !20
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !20
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %82

81:                                               ; preds = %61
  br label %84

82:                                               ; preds = %61
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 252, ptr noundef @__PRETTY_FUNCTION__._ZN2rw17UserDataExtension3addEPKcii) #10
  unreachable

83:                                               ; No predecessors!
  br label %84

84:                                               ; preds = %83, %81
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !20
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = load i32, ptr %11, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = call ptr @strncpy(ptr noundef %87, ptr noundef %88, i64 noundef %90) #8
  %92 = load i32, ptr %8, align 4, !tbaa !9
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %93, i32 0, i32 1
  store i32 %92, ptr %94, align 8, !tbaa !14
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %96, i32 0, i32 2
  store i32 %95, ptr %97, align 4, !tbaa !21
  %98 = load i32, ptr %8, align 4, !tbaa !9
  %99 = icmp eq i32 %98, 1
  br i1 %99, label %100, label %101

100:                                              ; preds = %84
  br label %112

101:                                              ; preds = %84
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = icmp eq i32 %102, 2
  br i1 %103, label %104, label %105

104:                                              ; preds = %101
  br label %110

105:                                              ; preds = %101
  %106 = load i32, ptr %8, align 4, !tbaa !9
  %107 = icmp eq i32 %106, 3
  %108 = zext i1 %107 to i64
  %109 = select i1 %107, i64 8, i64 0
  br label %110

110:                                              ; preds = %105, %104
  %111 = phi i64 [ 4, %104 ], [ %109, %105 ]
  br label %112

112:                                              ; preds = %110, %100
  %113 = phi i64 [ 4, %100 ], [ %111, %110 ]
  %114 = trunc i64 %113 to i32
  store i32 %114, ptr %12, align 4, !tbaa !9
  %115 = load i32, ptr %12, align 4, !tbaa !9
  %116 = load i32, ptr %9, align 4, !tbaa !9
  %117 = mul nsw i32 %115, %116
  %118 = sext i32 %117 to i64
  %119 = call noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef %118, i32 noundef 196895, ptr noundef @.str.5)
  %120 = load ptr, ptr %13, align 8, !tbaa !5
  %121 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %120, i32 0, i32 3
  store ptr %119, ptr %121, align 8, !tbaa !22
  %122 = load ptr, ptr %13, align 8, !tbaa !5
  %123 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %122, i32 0, i32 3
  %124 = load ptr, ptr %123, align 8, !tbaa !22
  %125 = icmp ne ptr %124, null
  br i1 %125, label %126, label %127

126:                                              ; preds = %112
  br label %129

127:                                              ; preds = %112
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.4, i32 noundef 260, ptr noundef @__PRETTY_FUNCTION__._ZN2rw17UserDataExtension3addEPKcii) #10
  unreachable

128:                                              ; No predecessors!
  br label %129

129:                                              ; preds = %128, %126
  %130 = load ptr, ptr %13, align 8, !tbaa !5
  %131 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %130, i32 0, i32 3
  %132 = load ptr, ptr %131, align 8, !tbaa !22
  %133 = load i32, ptr %12, align 4, !tbaa !9
  %134 = load i32, ptr %9, align 4, !tbaa !9
  %135 = mul nsw i32 %133, %134
  %136 = sext i32 %135 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %132, i8 0, i64 %136, i1 false)
  %137 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %137, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %138

138:                                              ; preds = %129, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  %139 = load i32, ptr %5, align 4
  ret i32 %139
}

; 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) #5

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #6

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

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


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

@_ZN2rw6Engine8memfuncsE = external local_unnamed_addr global %"struct.rw::MemoryFunctions", align 8
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [60 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw17UserDataExtension3addEPKcii = external hidden unnamed_addr constant [61 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN2rw17UserDataExtension3addEPKcii(ptr nocapture noundef nonnull align 8 dereferenceable(16) %0, ptr nocapture noundef readonly %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #3 align 2 {
  %5 = load i32, ptr %0, align 8, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %wide.trip.count = zext nneg i32 %5 to i64
  br label %9

9:                                                ; preds = %.lr.ph, %13
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %13 ]
  %10 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %8, i64 %indvars.iv, i32 1
  %11 = load i32, ptr %10, align 8, !tbaa !12
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %.loopexit.loopexit, label %13

13:                                               ; preds = %9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %9, !llvm.loop !14

._crit_edge:                                      ; preds = %13, %4
  %14 = add nsw i32 %5, 1
  %15 = sext i32 %14 to i64
  %16 = mul nsw i64 %15, 24
  %17 = tail call noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef %16, i32 noundef 196895, ptr noundef nonnull @.str.1)
  %18 = icmp eq ptr %17, null
  br i1 %18, label %53, label %19

19:                                               ; preds = %._crit_edge
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = load i32, ptr %0, align 8, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = mul nsw i64 %23, 24
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %17, ptr align 8 %21, i64 %24, i1 false)
  %25 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN2rw6Engine8memfuncsE, i64 16), align 8, !tbaa !16
  %26 = load ptr, ptr %20, align 8, !tbaa !11
  tail call void %25(ptr noundef %26)
  store ptr %17, ptr %20, align 8, !tbaa !11
  %27 = load i32, ptr %0, align 8, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %0, align 8, !tbaa !5
  br label %.loopexit

.loopexit.loopexit:                               ; preds = %9
  %29 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %19
  %30 = phi ptr [ %17, %19 ], [ %8, %.loopexit.loopexit ]
  %.1 = phi i32 [ %27, %19 ], [ %29, %.loopexit.loopexit ]
  %31 = sext i32 %.1 to i64
  %32 = getelementptr inbounds %"struct.rw::UserDataArray", ptr %30, i64 %31
  %33 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #7
  %34 = shl i64 %33, 32
  %sext = add i64 %34, 8589934592
  %35 = ashr exact i64 %sext, 32
  %36 = tail call noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef %35, i32 noundef 196895, ptr noundef nonnull @.str.2)
  store ptr %36, ptr %32, align 8, !tbaa !18
  %.not = icmp eq ptr %36, null
  br i1 %.not, label %37, label %38

37:                                               ; preds = %.loopexit
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 252, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw17UserDataExtension3addEPKcii) #8
  unreachable

38:                                               ; preds = %.loopexit
  %sext37 = add i64 %34, 4294967296
  %39 = ashr exact i64 %sext37, 32
  %40 = tail call ptr @strncpy(ptr noundef nonnull %36, ptr noundef %1, i64 noundef %39) #9
  %41 = getelementptr inbounds i8, ptr %32, i64 8
  store i32 %2, ptr %41, align 8, !tbaa !12
  %42 = getelementptr inbounds i8, ptr %32, i64 12
  store i32 %3, ptr %42, align 4, !tbaa !19
  %43 = add i32 %2, -1
  %or.cond = icmp ult i32 %43, 2
  %44 = icmp eq i32 %2, 3
  %45 = select i1 %44, i32 8, i32 0
  %46 = select i1 %or.cond, i32 4, i32 %45
  %47 = mul nsw i32 %46, %3
  %48 = sext i32 %47 to i64
  %49 = tail call noundef ptr @_ZN2rw10malloc_LOCEmjPKc(i64 noundef %48, i32 noundef 196895, ptr noundef nonnull @.str.5)
  %50 = getelementptr inbounds i8, ptr %32, i64 16
  store ptr %49, ptr %50, align 8, !tbaa !20
  %.not38 = icmp eq ptr %49, null
  br i1 %.not38, label %51, label %52

51:                                               ; preds = %38
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.4, i32 noundef 260, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw17UserDataExtension3addEPKcii) #8
  unreachable

52:                                               ; preds = %38
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %49, i8 0, i64 %48, i1 false)
  br label %53

53:                                               ; preds = %._crit_edge, %52
  %.0 = phi i32 [ %.1, %52 ], [ -1, %._crit_edge ]
  ret i32 %.0
}

; 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) #4

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

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

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


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