; LLVM IR from zchrissirhcz/pixel :: src (px_rgb_to_nv21)

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

%"class.(anonymous namespace)::RgbToYuv_Converter_v2" = type { i8 }
%struct.px_image_t = type { ptr, i32, i32, i32, i32 }

@.str = external hidden unnamed_addr constant [27 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__.px_rgb_to_nv21 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @px_rgb_to_nv21(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"class.(anonymous namespace)::RgbToYuv_Converter_v2", align 1
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call zeroext i1 @px_is_valid_rgb_image(ptr noundef %25)
  br i1 %26, label %27, label %28

27:                                               ; preds = %3
  br label %30

28:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 103, ptr noundef @__PRETTY_FUNCTION__.px_rgb_to_nv21) #5
  unreachable

29:                                               ; No predecessors!
  br label %30

30:                                               ; preds = %29, %27
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = call zeroext i1 @px_is_valid_yuv420sp_image_pair(ptr noundef %31, ptr noundef %32)
  br i1 %33, label %34, label %35

34:                                               ; preds = %30
  br label %37

35:                                               ; preds = %30
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 104, ptr noundef @__PRETTY_FUNCTION__.px_rgb_to_nv21) #5
  unreachable

36:                                               ; No predecessors!
  br label %37

37:                                               ; preds = %36, %34
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = call zeroext i1 @px_image_equal_in_size(ptr noundef %38, ptr noundef %39)
  br i1 %40, label %41, label %42

41:                                               ; preds = %37
  br label %44

42:                                               ; preds = %37
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 105, ptr noundef @__PRETTY_FUNCTION__.px_rgb_to_nv21) #5
  unreachable

43:                                               ; No predecessors!
  br label %44

44:                                               ; preds = %43, %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.px_image_t, ptr %45, i32 0, i32 1
  %47 = load i32, ptr %46, align 8, !tbaa !9
  store i32 %47, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.px_image_t, ptr %48, i32 0, i32 2
  %50 = load i32, ptr %49, align 4, !tbaa !13
  store i32 %50, ptr %8, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 2, ptr %9, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.px_image_t, ptr %51, i32 0, i32 3
  %53 = load i32, ptr %52, align 8, !tbaa !14
  store i32 %53, ptr %10, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !12
  br label %54

54:                                               ; preds = %155, %44
  %55 = load i32, ptr %19, align 4, !tbaa !12
  %56 = load i32, ptr %8, align 4, !tbaa !12
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 2, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %158

59:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.px_image_t, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !15
  %63 = load i32, ptr %19, align 4, !tbaa !12
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.px_image_t, ptr %64, i32 0, i32 4
  %66 = load i32, ptr %65, align 4, !tbaa !16
  %67 = mul nsw i32 %63, %66
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i8, ptr %62, i64 %68
  store ptr %69, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.px_image_t, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !15
  %73 = load i32, ptr %19, align 4, !tbaa !12
  %74 = sdiv i32 %73, 2
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.px_image_t, ptr %75, i32 0, i32 4
  %77 = load i32, ptr %76, align 4, !tbaa !16
  %78 = mul nsw i32 %74, %77
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i8, ptr %72, i64 %79
  store ptr %80, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.px_image_t, ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %82, align 8, !tbaa !15
  %84 = load i32, ptr %19, align 4, !tbaa !12
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.px_image_t, ptr %85, i32 0, i32 4
  %87 = load i32, ptr %86, align 4, !tbaa !16
  %88 = mul nsw i32 %84, %87
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i8, ptr %83, i64 %89
  store ptr %90, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !12
  br label %91

91:                                               ; preds = %151, %59
  %92 = load i32, ptr %24, align 4, !tbaa !12
  %93 = load i32, ptr %7, align 4, !tbaa !12
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 5, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %154

96:                                               ; preds = %91
  %97 = load ptr, ptr %23, align 8, !tbaa !5
  %98 = getelementptr inbounds i8, ptr %97, i64 0
  %99 = load i8, ptr %98, align 1, !tbaa !17
  %100 = zext i8 %99 to i32
  store i32 %100, ptr %12, align 4, !tbaa !12
  %101 = load ptr, ptr %23, align 8, !tbaa !5
  %102 = getelementptr inbounds i8, ptr %101, i64 1
  %103 = load i8, ptr %102, align 1, !tbaa !17
  %104 = zext i8 %103 to i32
  store i32 %104, ptr %13, align 4, !tbaa !12
  %105 = load ptr, ptr %23, align 8, !tbaa !5
  %106 = getelementptr inbounds i8, ptr %105, i64 2
  %107 = load i8, ptr %106, align 1, !tbaa !17
  %108 = zext i8 %107 to i32
  store i32 %108, ptr %14, align 4, !tbaa !12
  %109 = load i32, ptr %10, align 4, !tbaa !12
  %110 = load ptr, ptr %23, align 8, !tbaa !5
  %111 = sext i32 %109 to i64
  %112 = getelementptr inbounds i8, ptr %110, i64 %111
  store ptr %112, ptr %23, align 8, !tbaa !5
  %113 = load i32, ptr %12, align 4, !tbaa !12
  %114 = load i32, ptr %13, align 4, !tbaa !12
  %115 = load i32, ptr %14, align 4, !tbaa !12
  %116 = call noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_yEiiib(i32 noundef %113, i32 noundef %114, i32 noundef %115, i1 noundef zeroext true)
  store i32 %116, ptr %15, align 4, !tbaa !12
  %117 = load i32, ptr %15, align 4, !tbaa !12
  %118 = call i32 @px_clamp(i32 noundef %117, i32 noundef 0, i32 noundef 255)
  %119 = trunc i32 %118 to i8
  %120 = load ptr, ptr %21, align 8, !tbaa !5
  %121 = getelementptr inbounds i8, ptr %120, i32 1
  store ptr %121, ptr %21, align 8, !tbaa !5
  store i8 %119, ptr %120, align 1, !tbaa !17
  %122 = load i32, ptr %19, align 4, !tbaa !12
  %123 = srem i32 %122, 2
  %124 = icmp eq i32 %123, 0
  br i1 %124, label %125, label %150

125:                                              ; preds = %96
  %126 = load i32, ptr %24, align 4, !tbaa !12
  %127 = srem i32 %126, 2
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %150

129:                                              ; preds = %125
  %130 = load i32, ptr %12, align 4, !tbaa !12
  %131 = load i32, ptr %13, align 4, !tbaa !12
  %132 = load i32, ptr %14, align 4, !tbaa !12
  %133 = call noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_uEiii(i32 noundef %130, i32 noundef %131, i32 noundef %132)
  store i32 %133, ptr %16, align 4, !tbaa !12
  %134 = load i32, ptr %12, align 4, !tbaa !12
  %135 = load i32, ptr %13, align 4, !tbaa !12
  %136 = load i32, ptr %14, align 4, !tbaa !12
  %137 = call noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_vEiii(i32 noundef %134, i32 noundef %135, i32 noundef %136)
  store i32 %137, ptr %17, align 4, !tbaa !12
  %138 = load i32, ptr %16, align 4, !tbaa !12
  %139 = call i32 @px_clamp(i32 noundef %138, i32 noundef 0, i32 noundef 255)
  %140 = trunc i32 %139 to i8
  %141 = load ptr, ptr %22, align 8, !tbaa !5
  %142 = getelementptr inbounds i8, ptr %141, i64 1
  store i8 %140, ptr %142, align 1, !tbaa !17
  %143 = load i32, ptr %17, align 4, !tbaa !12
  %144 = call i32 @px_clamp(i32 noundef %143, i32 noundef 0, i32 noundef 255)
  %145 = trunc i32 %144 to i8
  %146 = load ptr, ptr %22, align 8, !tbaa !5
  %147 = getelementptr inbounds i8, ptr %146, i64 0
  store i8 %145, ptr %147, align 1, !tbaa !17
  %148 = load ptr, ptr %22, align 8, !tbaa !5
  %149 = getelementptr inbounds i8, ptr %148, i64 2
  store ptr %149, ptr %22, align 8, !tbaa !5
  br label %150

150:                                              ; preds = %129, %125, %96
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %24, align 4, !tbaa !12
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %24, align 4, !tbaa !12
  br label %91, !llvm.loop !18

154:                                              ; preds = %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %19, align 4, !tbaa !12
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %19, align 4, !tbaa !12
  br label %54, !llvm.loop !20

158:                                              ; preds = %58
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret void
}

declare zeroext i1 @px_is_valid_rgb_image(ptr noundef) #1

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

declare zeroext i1 @px_is_valid_yuv420sp_image_pair(ptr noundef, ptr noundef) #1

declare zeroext i1 @px_image_equal_in_size(ptr noundef, ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_yEiiib(i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #4 align 2

declare i32 @px_clamp(i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_uEiii(i32 noundef, i32 noundef, i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_vEiii(i32 noundef, i32 noundef, i32 noundef) #0 align 2

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

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 = { "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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { noreturn nounwind }
attributes #6 = { 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, !11, i64 8}
!10 = !{!"_ZTS10px_image_t", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 12}
!14 = !{!10, !11, i64 16}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !11, i64 20}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !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 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__.px_rgb_to_nv21 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @px_rgb_to_nv21(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call zeroext i1 @px_is_valid_rgb_image(ptr noundef %0)
  br i1 %4, label %6, label %5

5:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 103, ptr noundef nonnull @__PRETTY_FUNCTION__.px_rgb_to_nv21) #4
  unreachable

6:                                                ; preds = %3
  %7 = tail call zeroext i1 @px_is_valid_yuv420sp_image_pair(ptr noundef %1, ptr noundef %2)
  br i1 %7, label %9, label %8

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

9:                                                ; preds = %6
  %10 = tail call zeroext i1 @px_image_equal_in_size(ptr noundef %0, ptr noundef %1)
  br i1 %10, label %12, label %11

11:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 105, ptr noundef nonnull @__PRETTY_FUNCTION__.px_rgb_to_nv21) #4
  unreachable

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  %14 = load i32, ptr %13, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %1, i64 12
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph56, label %._crit_edge57

.lr.ph56:                                         ; preds = %12
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = load i32, ptr %18, align 8, !tbaa !12
  %20 = getelementptr inbounds i8, ptr %1, i64 20
  %21 = getelementptr inbounds i8, ptr %2, i64 20
  %22 = getelementptr inbounds i8, ptr %0, i64 20
  %23 = icmp sgt i32 %14, 0
  %24 = sext i32 %19 to i64
  br i1 %23, label %.lr.ph.us, label %._crit_edge57

.lr.ph.us:                                        ; preds = %.lr.ph56, %._crit_edge.us
  %.04854.us = phi i32 [ %68, %._crit_edge.us ], [ 0, %.lr.ph56 ]
  %25 = load ptr, ptr %1, align 8, !tbaa !13
  %26 = load i32, ptr %20, align 4, !tbaa !14
  %27 = mul nsw i32 %26, %.04854.us
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %25, i64 %28
  %30 = load ptr, ptr %2, align 8, !tbaa !13
  %31 = lshr i32 %.04854.us, 1
  %32 = load i32, ptr %21, align 4, !tbaa !14
  %33 = mul nsw i32 %32, %31
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %30, i64 %34
  %36 = load ptr, ptr %0, align 8, !tbaa !13
  %37 = load i32, ptr %22, align 4, !tbaa !14
  %38 = mul nsw i32 %37, %.04854.us
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i8, ptr %36, i64 %39
  br label %41

41:                                               ; preds = %.lr.ph.us, %66
  %.053.us = phi i32 [ 0, %.lr.ph.us ], [ %67, %66 ]
  %.04552.us = phi ptr [ %40, %.lr.ph.us ], [ %50, %66 ]
  %.04651.us = phi ptr [ %35, %.lr.ph.us ], [ %.1.us, %66 ]
  %.04750.us = phi ptr [ %29, %.lr.ph.us ], [ %54, %66 ]
  %42 = load i8, ptr %.04552.us, align 1, !tbaa !15
  %43 = zext i8 %42 to i32
  %44 = getelementptr inbounds i8, ptr %.04552.us, i64 1
  %45 = load i8, ptr %44, align 1, !tbaa !15
  %46 = zext i8 %45 to i32
  %47 = getelementptr inbounds i8, ptr %.04552.us, i64 2
  %48 = load i8, ptr %47, align 1, !tbaa !15
  %49 = zext i8 %48 to i32
  %50 = getelementptr inbounds i8, ptr %.04552.us, i64 %24
  %51 = tail call noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_yEiiib(i32 noundef %43, i32 noundef %46, i32 noundef %49, i1 noundef zeroext true)
  %52 = tail call i32 @px_clamp(i32 noundef %51, i32 noundef 0, i32 noundef 255)
  %53 = trunc i32 %52 to i8
  %54 = getelementptr inbounds i8, ptr %.04750.us, i64 1
  store i8 %53, ptr %.04750.us, align 1, !tbaa !15
  %55 = or i32 %.053.us, %.04854.us
  %56 = and i32 %55, 1
  %or.cond.us = icmp eq i32 %56, 0
  br i1 %or.cond.us, label %57, label %66

57:                                               ; preds = %41
  %58 = tail call noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_uEiii(i32 noundef %43, i32 noundef %46, i32 noundef %49)
  %59 = tail call noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_vEiii(i32 noundef %43, i32 noundef %46, i32 noundef %49)
  %60 = tail call i32 @px_clamp(i32 noundef %58, i32 noundef 0, i32 noundef 255)
  %61 = trunc i32 %60 to i8
  %62 = getelementptr inbounds i8, ptr %.04651.us, i64 1
  store i8 %61, ptr %62, align 1, !tbaa !15
  %63 = tail call i32 @px_clamp(i32 noundef %59, i32 noundef 0, i32 noundef 255)
  %64 = trunc i32 %63 to i8
  store i8 %64, ptr %.04651.us, align 1, !tbaa !15
  %65 = getelementptr inbounds i8, ptr %.04651.us, i64 2
  br label %66

66:                                               ; preds = %57, %41
  %.1.us = phi ptr [ %65, %57 ], [ %.04651.us, %41 ]
  %67 = add nuw nsw i32 %.053.us, 1
  %exitcond.not = icmp eq i32 %67, %14
  br i1 %exitcond.not, label %._crit_edge.us, label %41, !llvm.loop !16

._crit_edge.us:                                   ; preds = %66
  %68 = add nuw nsw i32 %.04854.us, 1
  %exitcond59.not = icmp eq i32 %68, %16
  br i1 %exitcond59.not, label %._crit_edge57, label %.lr.ph.us, !llvm.loop !18

._crit_edge57:                                    ; preds = %._crit_edge.us, %.lr.ph56, %12
  ret void
}

declare zeroext i1 @px_is_valid_rgb_image(ptr noundef) local_unnamed_addr #1

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

declare zeroext i1 @px_is_valid_yuv420sp_image_pair(ptr noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i1 @px_image_equal_in_size(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_yEiiib(i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #3 align 2

declare i32 @px_clamp(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_uEiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121RgbToYuv_Converter_v25get_vEiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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

!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 8}
!6 = !{!"_ZTS10px_image_t", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 12}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !10, i64 20}
!15 = !{!8, !8, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass