; LLVM IR from aap/librw :: src/image.ll (ZN2rw5Image11convertTo32Ev)

; 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::Image" = type { i32, i32, i32, i32, i32, i32, ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw5Image11convertTo32Ev = external hidden unnamed_addr constant [30 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [73 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2rw5Image4freeEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2rw5Image9setPixelsEPh(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw5Image11convertTo32Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %13 = load ptr, ptr %2, align 8
  %14 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 6
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %1
  br label %20

18:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.2, i32 noundef 628, ptr noundef @__PRETTY_FUNCTION__._ZN2rw5Image11convertTo32Ev) #6
  unreachable

19:                                               ; No predecessors!
  br label %20

20:                                               ; preds = %19, %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %21 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 6
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  store ptr %22, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %23 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 1
  %24 = load i32, ptr %23, align 4, !tbaa !12
  %25 = mul nsw i32 %24, 4
  store i32 %25, ptr %4, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store ptr null, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 3
  %27 = load i32, ptr %26, align 4, !tbaa !14
  switch i32 %27, label %38 [
    i32 4, label %28
    i32 8, label %28
    i32 16, label %36
    i32 24, label %37
  ]

28:                                               ; preds = %20, %20
  %29 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 7
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %28
  br label %35

33:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.2, i32 noundef 637, ptr noundef @__PRETTY_FUNCTION__._ZN2rw5Image11convertTo32Ev) #6
  unreachable

34:                                               ; No predecessors!
  br label %35

35:                                               ; preds = %34, %32
  call void @_ZN2rw5Image11unpalettizeEb(ptr noundef nonnull align 8 dereferenceable(40) %13, i1 noundef zeroext true)
  store i32 1, ptr %7, align 4
  br label %98

36:                                               ; preds = %20
  store ptr @_ZN2rw27conv_RGBA8888_from_ARGB1555EPhS0_, ptr %6, align 8, !tbaa !5
  br label %39

37:                                               ; preds = %20
  store ptr @_ZN2rw25conv_RGBA8888_from_RGB888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %39

38:                                               ; preds = %20
  store i32 1, ptr %7, align 4
  br label %98

39:                                               ; preds = %37, %36
  %40 = load i32, ptr %4, align 4, !tbaa !13
  %41 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 2
  %42 = load i32, ptr %41, align 8, !tbaa !16
  %43 = mul nsw i32 %40, %42
  %44 = sext i32 %43 to i64
  %45 = mul i64 %44, 1
  %46 = call noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef %45, i32 noundef 196632, ptr noundef @.str.8)
  store ptr %46, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %47, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !13
  br label %48

48:                                               ; preds = %87, %39
  %49 = load i32, ptr %9, align 4, !tbaa !13
  %50 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 2
  %51 = load i32, ptr %50, align 8, !tbaa !16
  %52 = icmp slt i32 %49, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %48
  store i32 3, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %90

54:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %55, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %56, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !13
  br label %57

57:                                               ; preds = %74, %54
  %58 = load i32, ptr %12, align 4, !tbaa !13
  %59 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !12
  %61 = icmp slt i32 %58, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %57
  store i32 6, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %77

63:                                               ; preds = %57
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  call void %64(ptr noundef %65, ptr noundef %66)
  %67 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 4
  %68 = load i32, ptr %67, align 8, !tbaa !17
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = sext i32 %68 to i64
  %71 = getelementptr inbounds i8, ptr %69, i64 %70
  store ptr %71, ptr %10, align 8, !tbaa !5
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 4
  store ptr %73, ptr %11, align 8, !tbaa !5
  br label %74

74:                                               ; preds = %63
  %75 = load i32, ptr %12, align 4, !tbaa !13
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %12, align 4, !tbaa !13
  br label %57, !llvm.loop !18

77:                                               ; preds = %62
  %78 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 5
  %79 = load i32, ptr %78, align 4, !tbaa !20
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = sext i32 %79 to i64
  %82 = getelementptr inbounds i8, ptr %80, i64 %81
  store ptr %82, ptr %3, align 8, !tbaa !5
  %83 = load i32, ptr %4, align 4, !tbaa !13
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = sext i32 %83 to i64
  %86 = getelementptr inbounds i8, ptr %84, i64 %85
  store ptr %86, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %87

87:                                               ; preds = %77
  %88 = load i32, ptr %9, align 4, !tbaa !13
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %9, align 4, !tbaa !13
  br label %48, !llvm.loop !21

90:                                               ; preds = %53
  call void @_ZN2rw5Image4freeEv(ptr noundef nonnull align 8 dereferenceable(40) %13)
  %91 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 3
  store i32 32, ptr %91, align 4, !tbaa !14
  %92 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 4
  store i32 4, ptr %92, align 8, !tbaa !17
  %93 = load i32, ptr %4, align 4, !tbaa !13
  %94 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 5
  store i32 %93, ptr %94, align 4, !tbaa !20
  %95 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 6
  store ptr null, ptr %95, align 8, !tbaa !9
  %96 = getelementptr inbounds %"struct.rw::Image", ptr %13, i32 0, i32 7
  store ptr null, ptr %96, align 8, !tbaa !15
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN2rw5Image9setPixelsEPh(ptr noundef nonnull align 8 dereferenceable(40) %13, ptr noundef %97)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  store i32 0, ptr %7, align 4
  br label %98

98:                                               ; preds = %90, %38, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  %99 = load i32, ptr %7, align 4
  switch i32 %99, label %101 [
    i32 0, label %100
    i32 1, label %100
  ]

100:                                              ; preds = %98, %98
  ret void

101:                                              ; preds = %98
  unreachable
}

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

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

declare void @_ZN2rw27conv_RGBA8888_from_ARGB1555EPhS0_(ptr noundef, ptr noundef) #5

declare void @_ZN2rw25conv_RGBA8888_from_RGB888EPhS0_(ptr noundef, ptr noundef) #5

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


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

@.str.2 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw5Image11convertTo32Ev = external hidden unnamed_addr constant [30 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [73 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2rw5Image4freeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2rw5Image9setPixelsEPh(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2rw5Image11convertTo32Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i32 noundef 628, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw5Image11convertTo32Ev) #7
  unreachable

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = shl nsw i32 %7, 2
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  %10 = load i32, ptr %9, align 4, !tbaa !12
  %11 = add i32 %10, -4
  %12 = tail call i32 @llvm.fshl.i32(i32 %11, i32 %11, i32 30)
  switch i32 %12, label %52 [
    i32 0, label %13
    i32 1, label %13
    i32 3, label %19
    i32 5, label %18
  ]

13:                                               ; preds = %5, %5
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %.not25 = icmp eq ptr %15, null
  br i1 %.not25, label %16, label %17

16:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.2, i32 noundef 637, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw5Image11convertTo32Ev) #7
  unreachable

17:                                               ; preds = %13
  tail call void @_ZN2rw5Image11unpalettizeEb(ptr noundef nonnull align 8 dereferenceable(40) %0, i1 noundef zeroext true)
  br label %52

18:                                               ; preds = %5
  br label %19

19:                                               ; preds = %5, %18
  %.022 = phi ptr [ @_ZN2rw25conv_RGBA8888_from_RGB888EPhS0_, %18 ], [ @_ZN2rw27conv_RGBA8888_from_ARGB1555EPhS0_, %5 ]
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = load i32, ptr %20, align 8, !tbaa !14
  %22 = mul nsw i32 %21, %8
  %23 = sext i32 %22 to i64
  %24 = tail call noundef ptr @_ZN2rw14mustmalloc_LOCEmjPKc(i64 noundef %23, i32 noundef 196632, ptr noundef nonnull @.str.8)
  %25 = load i32, ptr %20, align 8, !tbaa !14
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.preheader.lr.ph, label %._crit_edge32

.preheader.lr.ph:                                 ; preds = %19
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = getelementptr inbounds i8, ptr %0, i64 20
  %29 = sext i32 %8 to i64
  %30 = load i32, ptr %6, align 4, !tbaa !11
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.preheader, label %._crit_edge32

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %32 = phi i32 [ %37, %._crit_edge ], [ %25, %.preheader.lr.ph ]
  %33 = phi i32 [ %38, %._crit_edge ], [ %30, %.preheader.lr.ph ]
  %.02031 = phi i32 [ %43, %._crit_edge ], [ 0, %.preheader.lr.ph ]
  %.02130 = phi ptr [ %41, %._crit_edge ], [ %3, %.preheader.lr.ph ]
  %.02329 = phi ptr [ %42, %._crit_edge ], [ %24, %.preheader.lr.ph ]
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph, label %._crit_edge

._crit_edge32:                                    ; preds = %._crit_edge, %.preheader.lr.ph, %19
  tail call void @_ZN2rw5Image4freeEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  store i32 32, ptr %9, align 4, !tbaa !12
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 4, ptr %35, align 8, !tbaa !15
  %36 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %8, ptr %36, align 4, !tbaa !16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, i8 0, i64 16, i1 false)
  tail call void @_ZN2rw5Image9setPixelsEPh(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef %24)
  br label %52

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr %20, align 8, !tbaa !14
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %37 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %32, %.preheader ]
  %38 = phi i32 [ %50, %._crit_edge.loopexit ], [ %33, %.preheader ]
  %39 = load i32, ptr %28, align 4, !tbaa !16
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i8, ptr %.02130, i64 %40
  %42 = getelementptr inbounds i8, ptr %.02329, i64 %29
  %43 = add nuw nsw i32 %.02031, 1
  %44 = icmp slt i32 %43, %37
  br i1 %44, label %.preheader, label %._crit_edge32, !llvm.loop !17

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.028 = phi i32 [ %49, %.lr.ph ], [ 0, %.preheader ]
  %.01827 = phi ptr [ %48, %.lr.ph ], [ %.02329, %.preheader ]
  %.01926 = phi ptr [ %47, %.lr.ph ], [ %.02130, %.preheader ]
  tail call void %.022(ptr noundef %.01827, ptr noundef %.01926), !callees !20
  %45 = load i32, ptr %27, align 8, !tbaa !15
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i8, ptr %.01926, i64 %46
  %48 = getelementptr inbounds i8, ptr %.01827, i64 4
  %49 = add nuw nsw i32 %.028, 1
  %50 = load i32, ptr %6, align 4, !tbaa !11
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !21

52:                                               ; preds = %5, %._crit_edge32, %17
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2rw5Image11unpalettizeEb(ptr noundef nonnull align 8 dereferenceable(40), i1 noundef zeroext) local_unnamed_addr #0 align 2

declare void @_ZN2rw27conv_RGBA8888_from_ARGB1555EPhS0_(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @_ZN2rw25conv_RGBA8888_from_RGB888EPhS0_(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.fshl.i32(i32, i32, i32) #5

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

attributes #0 = { 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 #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 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 #3 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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, !10, i64 24}
!6 = !{!"_ZTSN2rw5ImageE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 12}
!13 = !{!6, !10, i64 32}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !7, i64 20}
!17 = distinct !{!17, !18, !19}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = !{ptr @_ZN2rw25conv_RGBA8888_from_RGB888EPhS0_, ptr @_ZN2rw27conv_RGBA8888_from_ARGB1555EPhS0_}
!21 = distinct !{!21, !18}


; Effective O3 passes: CalledValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass