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

; 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)::YuvToRgb_Converter_v2" = type { i8 }
%struct.px_image_t = type { ptr, i32, i32, i32, i32 }

@.str = external hidden unnamed_addr constant [51 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__.px_nv21_to_rgb = external hidden unnamed_addr constant [62 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 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_nv21_to_rgb(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 %"class.(anonymous namespace)::YuvToRgb_Converter_v2", align 1
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = 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
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call zeroext i1 @px_is_valid_yuv420sp_image_pair(ptr noundef %24, 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 107, ptr noundef @__PRETTY_FUNCTION__.px_nv21_to_rgb) #4
  unreachable

29:                                               ; No predecessors!
  br label %30

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

33:                                               ; preds = %30
  br label %36

34:                                               ; preds = %30
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 108, ptr noundef @__PRETTY_FUNCTION__.px_nv21_to_rgb) #4
  unreachable

35:                                               ; No predecessors!
  br label %36

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

40:                                               ; preds = %36
  br label %43

41:                                               ; preds = %36
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 109, ptr noundef @__PRETTY_FUNCTION__.px_nv21_to_rgb) #4
  unreachable

42:                                               ; No predecessors!
  br label %43

43:                                               ; preds = %42, %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.px_image_t, ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 8, !tbaa !9
  store i32 %46, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.px_image_t, ptr %47, i32 0, i32 2
  %49 = load i32, ptr %48, align 4, !tbaa !13
  store i32 %49, ptr %8, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 2, ptr %10, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 3, ptr %11, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !12
  br label %50

50:                                               ; preds = %243, %43
  %51 = load i32, ptr %13, align 4, !tbaa !12
  %52 = load i32, ptr %8, align 4, !tbaa !12
  %53 = sub nsw i32 %52, 2
  %54 = icmp sle i32 %51, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %50
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %246

56:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.px_image_t, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !14
  %60 = load i32, ptr %13, align 4, !tbaa !12
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.px_image_t, ptr %61, i32 0, i32 4
  %63 = load i32, ptr %62, align 4, !tbaa !15
  %64 = mul nsw i32 %60, %63
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i8, ptr %59, i64 %65
  store ptr %66, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.px_image_t, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !14
  %70 = load i32, ptr %13, align 4, !tbaa !12
  %71 = add nsw i32 %70, 1
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.px_image_t, ptr %72, i32 0, i32 4
  %74 = load i32, ptr %73, align 4, !tbaa !15
  %75 = mul nsw i32 %71, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %69, i64 %76
  store ptr %77, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.px_image_t, ptr %78, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8, !tbaa !14
  %81 = load i32, ptr %13, align 4, !tbaa !12
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.px_image_t, ptr %82, i32 0, i32 4
  %84 = load i32, ptr %83, align 4, !tbaa !15
  %85 = mul nsw i32 %81, %84
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i8, ptr %80, i64 %86
  store ptr %87, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.px_image_t, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !14
  %91 = load i32, ptr %13, align 4, !tbaa !12
  %92 = add nsw i32 %91, 1
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.px_image_t, ptr %93, i32 0, i32 4
  %95 = load i32, ptr %94, align 4, !tbaa !15
  %96 = mul nsw i32 %92, %95
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds i8, ptr %90, i64 %97
  store ptr %98, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.px_image_t, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !14
  %102 = load i32, ptr %13, align 4, !tbaa !12
  %103 = sdiv i32 %102, 2
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.px_image_t, ptr %104, i32 0, i32 4
  %106 = load i32, ptr %105, align 4, !tbaa !15
  %107 = mul nsw i32 %103, %106
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i8, ptr %101, i64 %108
  store ptr %109, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !12
  br label %110

110:                                              ; preds = %239, %56
  %111 = load i32, ptr %20, align 4, !tbaa !12
  %112 = load i32, ptr %7, align 4, !tbaa !12
  %113 = sub nsw i32 %112, 2
  %114 = icmp sle i32 %111, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %110
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %242

116:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %117 = load ptr, ptr %19, align 8, !tbaa !5
  %118 = getelementptr inbounds i8, ptr %117, i64 1
  %119 = load i8, ptr %118, align 1, !tbaa !16
  %120 = zext i8 %119 to i32
  store i32 %120, ptr %22, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %121 = load ptr, ptr %19, align 8, !tbaa !5
  %122 = getelementptr inbounds i8, ptr %121, i64 0
  %123 = load i8, ptr %122, align 1, !tbaa !16
  %124 = zext i8 %123 to i32
  store i32 %124, ptr %23, align 4, !tbaa !12
  %125 = load ptr, ptr %15, align 8, !tbaa !5
  %126 = getelementptr inbounds i8, ptr %125, i64 0
  %127 = load i8, ptr %126, align 1, !tbaa !16
  %128 = zext i8 %127 to i32
  store i32 %128, ptr %21, align 4, !tbaa !12
  %129 = load i32, ptr %21, align 4, !tbaa !12
  %130 = load i32, ptr %22, align 4, !tbaa !12
  %131 = load i32, ptr %23, align 4, !tbaa !12
  %132 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef %129, i32 noundef %130, i32 noundef %131)
  %133 = trunc i32 %132 to i8
  %134 = load ptr, ptr %17, align 8, !tbaa !5
  %135 = getelementptr inbounds i8, ptr %134, i64 0
  store i8 %133, ptr %135, align 1, !tbaa !16
  %136 = load i32, ptr %21, align 4, !tbaa !12
  %137 = load i32, ptr %22, align 4, !tbaa !12
  %138 = load i32, ptr %23, align 4, !tbaa !12
  %139 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_gEiii(i32 noundef %136, i32 noundef %137, i32 noundef %138)
  %140 = trunc i32 %139 to i8
  %141 = load ptr, ptr %17, align 8, !tbaa !5
  %142 = getelementptr inbounds i8, ptr %141, i64 1
  store i8 %140, ptr %142, align 1, !tbaa !16
  %143 = load i32, ptr %21, align 4, !tbaa !12
  %144 = load i32, ptr %22, align 4, !tbaa !12
  %145 = load i32, ptr %23, align 4, !tbaa !12
  %146 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(i32 noundef %143, i32 noundef %144, i32 noundef %145)
  %147 = trunc i32 %146 to i8
  %148 = load ptr, ptr %17, align 8, !tbaa !5
  %149 = getelementptr inbounds i8, ptr %148, i64 2
  store i8 %147, ptr %149, align 1, !tbaa !16
  %150 = load ptr, ptr %17, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i64 3
  store ptr %151, ptr %17, align 8, !tbaa !5
  %152 = load ptr, ptr %15, align 8, !tbaa !5
  %153 = getelementptr inbounds i8, ptr %152, i64 1
  %154 = load i8, ptr %153, align 1, !tbaa !16
  %155 = zext i8 %154 to i32
  store i32 %155, ptr %21, align 4, !tbaa !12
  %156 = load i32, ptr %21, align 4, !tbaa !12
  %157 = load i32, ptr %22, align 4, !tbaa !12
  %158 = load i32, ptr %23, align 4, !tbaa !12
  %159 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef %156, i32 noundef %157, i32 noundef %158)
  %160 = trunc i32 %159 to i8
  %161 = load ptr, ptr %17, align 8, !tbaa !5
  %162 = getelementptr inbounds i8, ptr %161, i64 0
  store i8 %160, ptr %162, align 1, !tbaa !16
  %163 = load i32, ptr %21, align 4, !tbaa !12
  %164 = load i32, ptr %22, align 4, !tbaa !12
  %165 = load i32, ptr %23, align 4, !tbaa !12
  %166 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_gEiii(i32 noundef %163, i32 noundef %164, i32 noundef %165)
  %167 = trunc i32 %166 to i8
  %168 = load ptr, ptr %17, align 8, !tbaa !5
  %169 = getelementptr inbounds i8, ptr %168, i64 1
  store i8 %167, ptr %169, align 1, !tbaa !16
  %170 = load i32, ptr %21, align 4, !tbaa !12
  %171 = load i32, ptr %22, align 4, !tbaa !12
  %172 = load i32, ptr %23, align 4, !tbaa !12
  %173 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(i32 noundef %170, i32 noundef %171, i32 noundef %172)
  %174 = trunc i32 %173 to i8
  %175 = load ptr, ptr %17, align 8, !tbaa !5
  %176 = getelementptr inbounds i8, ptr %175, i64 2
  store i8 %174, ptr %176, align 1, !tbaa !16
  %177 = load ptr, ptr %17, align 8, !tbaa !5
  %178 = getelementptr inbounds i8, ptr %177, i64 3
  store ptr %178, ptr %17, align 8, !tbaa !5
  %179 = load ptr, ptr %16, align 8, !tbaa !5
  %180 = getelementptr inbounds i8, ptr %179, i64 0
  %181 = load i8, ptr %180, align 1, !tbaa !16
  %182 = zext i8 %181 to i32
  store i32 %182, ptr %21, align 4, !tbaa !12
  %183 = load i32, ptr %21, align 4, !tbaa !12
  %184 = load i32, ptr %22, align 4, !tbaa !12
  %185 = load i32, ptr %23, align 4, !tbaa !12
  %186 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef %183, i32 noundef %184, i32 noundef %185)
  %187 = trunc i32 %186 to i8
  %188 = load ptr, ptr %18, align 8, !tbaa !5
  %189 = getelementptr inbounds i8, ptr %188, i64 0
  store i8 %187, ptr %189, align 1, !tbaa !16
  %190 = load i32, ptr %21, align 4, !tbaa !12
  %191 = load i32, ptr %22, align 4, !tbaa !12
  %192 = load i32, ptr %23, align 4, !tbaa !12
  %193 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_gEiii(i32 noundef %190, i32 noundef %191, i32 noundef %192)
  %194 = trunc i32 %193 to i8
  %195 = load ptr, ptr %18, align 8, !tbaa !5
  %196 = getelementptr inbounds i8, ptr %195, i64 1
  store i8 %194, ptr %196, align 1, !tbaa !16
  %197 = load i32, ptr %21, align 4, !tbaa !12
  %198 = load i32, ptr %22, align 4, !tbaa !12
  %199 = load i32, ptr %23, align 4, !tbaa !12
  %200 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(i32 noundef %197, i32 noundef %198, i32 noundef %199)
  %201 = trunc i32 %200 to i8
  %202 = load ptr, ptr %18, align 8, !tbaa !5
  %203 = getelementptr inbounds i8, ptr %202, i64 2
  store i8 %201, ptr %203, align 1, !tbaa !16
  %204 = load ptr, ptr %18, align 8, !tbaa !5
  %205 = getelementptr inbounds i8, ptr %204, i64 3
  store ptr %205, ptr %18, align 8, !tbaa !5
  %206 = load ptr, ptr %16, align 8, !tbaa !5
  %207 = getelementptr inbounds i8, ptr %206, i64 1
  %208 = load i8, ptr %207, align 1, !tbaa !16
  %209 = zext i8 %208 to i32
  store i32 %209, ptr %21, align 4, !tbaa !12
  %210 = load i32, ptr %21, align 4, !tbaa !12
  %211 = load i32, ptr %22, align 4, !tbaa !12
  %212 = load i32, ptr %23, align 4, !tbaa !12
  %213 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef %210, i32 noundef %211, i32 noundef %212)
  %214 = trunc i32 %213 to i8
  %215 = load ptr, ptr %18, align 8, !tbaa !5
  %216 = getelementptr inbounds i8, ptr %215, i64 0
  store i8 %214, ptr %216, align 1, !tbaa !16
  %217 = load i32, ptr %21, align 4, !tbaa !12
  %218 = load i32, ptr %22, align 4, !tbaa !12
  %219 = load i32, ptr %23, align 4, !tbaa !12
  %220 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_gEiii(i32 noundef %217, i32 noundef %218, i32 noundef %219)
  %221 = trunc i32 %220 to i8
  %222 = load ptr, ptr %18, align 8, !tbaa !5
  %223 = getelementptr inbounds i8, ptr %222, i64 1
  store i8 %221, ptr %223, align 1, !tbaa !16
  %224 = load i32, ptr %21, align 4, !tbaa !12
  %225 = load i32, ptr %22, align 4, !tbaa !12
  %226 = load i32, ptr %23, align 4, !tbaa !12
  %227 = call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(i32 noundef %224, i32 noundef %225, i32 noundef %226)
  %228 = trunc i32 %227 to i8
  %229 = load ptr, ptr %18, align 8, !tbaa !5
  %230 = getelementptr inbounds i8, ptr %229, i64 2
  store i8 %228, ptr %230, align 1, !tbaa !16
  %231 = load ptr, ptr %18, align 8, !tbaa !5
  %232 = getelementptr inbounds i8, ptr %231, i64 3
  store ptr %232, ptr %18, align 8, !tbaa !5
  %233 = load ptr, ptr %15, align 8, !tbaa !5
  %234 = getelementptr inbounds i8, ptr %233, i64 2
  store ptr %234, ptr %15, align 8, !tbaa !5
  %235 = load ptr, ptr %16, align 8, !tbaa !5
  %236 = getelementptr inbounds i8, ptr %235, i64 2
  store ptr %236, ptr %16, align 8, !tbaa !5
  %237 = load ptr, ptr %19, align 8, !tbaa !5
  %238 = getelementptr inbounds i8, ptr %237, i64 2
  store ptr %238, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %239

239:                                              ; preds = %116
  %240 = load i32, ptr %20, align 4, !tbaa !12
  %241 = add nsw i32 %240, 2
  store i32 %241, ptr %20, align 4, !tbaa !12
  br label %110, !llvm.loop !17

242:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %243

243:                                              ; preds = %242
  %244 = load i32, ptr %13, align 4, !tbaa !12
  %245 = add nsw i32 %244, 2
  store i32 %245, ptr %13, align 4, !tbaa !12
  br label %50, !llvm.loop !19

246:                                              ; preds = %55
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

declare zeroext i1 @px_is_valid_yuv420sp_image_pair(ptr noundef, 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_rgb_image(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 uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef, i32 noundef, i32 noundef) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(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 = { noreturn nounwind }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !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, !6, i64 0}
!15 = !{!10, !11, i64 20}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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 [51 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@__PRETTY_FUNCTION__.px_nv21_to_rgb = external hidden unnamed_addr constant [62 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 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_nv21_to_rgb(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call zeroext i1 @px_is_valid_yuv420sp_image_pair(ptr noundef %0, ptr noundef %1)
  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 107, ptr noundef nonnull @__PRETTY_FUNCTION__.px_nv21_to_rgb) #3
  unreachable

6:                                                ; preds = %3
  %7 = tail call zeroext i1 @px_is_valid_rgb_image(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 108, ptr noundef nonnull @__PRETTY_FUNCTION__.px_nv21_to_rgb) #3
  unreachable

9:                                                ; preds = %6
  %10 = tail call zeroext i1 @px_image_equal_in_size(ptr noundef %2, ptr noundef %0)
  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 109, ptr noundef nonnull @__PRETTY_FUNCTION__.px_nv21_to_rgb) #3
  unreachable

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = add nsw i32 %14, -2
  %.not102 = icmp slt i32 %14, 2
  br i1 %.not102, label %._crit_edge106, label %.lr.ph105

.lr.ph105:                                        ; preds = %12
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %0, i64 20
  %19 = getelementptr inbounds i8, ptr %2, i64 20
  %20 = getelementptr inbounds i8, ptr %1, i64 20
  %21 = add nsw i32 %17, -2
  %.not9495 = icmp slt i32 %17, 2
  br i1 %.not9495, label %._crit_edge106, label %.lr.ph

._crit_edge106:                                   ; preds = %._crit_edge, %.lr.ph105, %12
  ret void

.lr.ph:                                           ; preds = %.lr.ph105, %._crit_edge
  %.0103 = phi i32 [ %45, %._crit_edge ], [ 0, %.lr.ph105 ]
  %22 = load ptr, ptr %0, align 8, !tbaa !12
  %23 = load i32, ptr %18, align 4, !tbaa !13
  %24 = mul nsw i32 %23, %.0103
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %22, i64 %25
  %27 = or disjoint i32 %.0103, 1
  %28 = mul nsw i32 %23, %27
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %22, i64 %29
  %31 = load ptr, ptr %2, align 8, !tbaa !12
  %32 = load i32, ptr %19, align 4, !tbaa !13
  %33 = mul nsw i32 %32, %.0103
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %31, i64 %34
  %36 = mul nsw i32 %32, %27
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i8, ptr %31, i64 %37
  %39 = load ptr, ptr %1, align 8, !tbaa !12
  %40 = lshr exact i32 %.0103, 1
  %41 = load i32, ptr %20, align 4, !tbaa !13
  %42 = mul nsw i32 %41, %40
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i8, ptr %39, i64 %43
  br label %46

._crit_edge:                                      ; preds = %46
  %45 = add nuw nsw i32 %.0103, 2
  %.not = icmp sgt i32 %45, %15
  br i1 %.not, label %._crit_edge106, label %.lr.ph, !llvm.loop !14

46:                                               ; preds = %.lr.ph, %46
  %.088101 = phi ptr [ %26, %.lr.ph ], [ %98, %46 ]
  %.089100 = phi i32 [ 0, %.lr.ph ], [ %101, %46 ]
  %.09099 = phi ptr [ %44, %.lr.ph ], [ %100, %46 ]
  %.09198 = phi ptr [ %38, %.lr.ph ], [ %97, %46 ]
  %.09297 = phi ptr [ %35, %.lr.ph ], [ %74, %46 ]
  %.09396 = phi ptr [ %30, %.lr.ph ], [ %99, %46 ]
  %47 = getelementptr inbounds i8, ptr %.09099, i64 1
  %48 = load i8, ptr %47, align 1, !tbaa !16
  %49 = zext i8 %48 to i32
  %50 = load i8, ptr %.09099, align 1, !tbaa !16
  %51 = zext i8 %50 to i32
  %52 = load i8, ptr %.088101, align 1, !tbaa !16
  %53 = zext i8 %52 to i32
  %54 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef %53, i32 noundef %49, i32 noundef %51)
  %55 = trunc i32 %54 to i8
  store i8 %55, ptr %.09297, align 1, !tbaa !16
  %56 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_gEiii(i32 noundef %53, i32 noundef %49, i32 noundef %51)
  %57 = trunc i32 %56 to i8
  %58 = getelementptr inbounds i8, ptr %.09297, i64 1
  store i8 %57, ptr %58, align 1, !tbaa !16
  %59 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(i32 noundef %53, i32 noundef %49, i32 noundef %51)
  %60 = trunc i32 %59 to i8
  %61 = getelementptr inbounds i8, ptr %.09297, i64 2
  store i8 %60, ptr %61, align 1, !tbaa !16
  %62 = getelementptr inbounds i8, ptr %.09297, i64 3
  %63 = getelementptr inbounds i8, ptr %.088101, i64 1
  %64 = load i8, ptr %63, align 1, !tbaa !16
  %65 = zext i8 %64 to i32
  %66 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef %65, i32 noundef %49, i32 noundef %51)
  %67 = trunc i32 %66 to i8
  store i8 %67, ptr %62, align 1, !tbaa !16
  %68 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_gEiii(i32 noundef %65, i32 noundef %49, i32 noundef %51)
  %69 = trunc i32 %68 to i8
  %70 = getelementptr inbounds i8, ptr %.09297, i64 4
  store i8 %69, ptr %70, align 1, !tbaa !16
  %71 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(i32 noundef %65, i32 noundef %49, i32 noundef %51)
  %72 = trunc i32 %71 to i8
  %73 = getelementptr inbounds i8, ptr %.09297, i64 5
  store i8 %72, ptr %73, align 1, !tbaa !16
  %74 = getelementptr inbounds i8, ptr %.09297, i64 6
  %75 = load i8, ptr %.09396, align 1, !tbaa !16
  %76 = zext i8 %75 to i32
  %77 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef %76, i32 noundef %49, i32 noundef %51)
  %78 = trunc i32 %77 to i8
  store i8 %78, ptr %.09198, align 1, !tbaa !16
  %79 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_gEiii(i32 noundef %76, i32 noundef %49, i32 noundef %51)
  %80 = trunc i32 %79 to i8
  %81 = getelementptr inbounds i8, ptr %.09198, i64 1
  store i8 %80, ptr %81, align 1, !tbaa !16
  %82 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(i32 noundef %76, i32 noundef %49, i32 noundef %51)
  %83 = trunc i32 %82 to i8
  %84 = getelementptr inbounds i8, ptr %.09198, i64 2
  store i8 %83, ptr %84, align 1, !tbaa !16
  %85 = getelementptr inbounds i8, ptr %.09198, i64 3
  %86 = getelementptr inbounds i8, ptr %.09396, i64 1
  %87 = load i8, ptr %86, align 1, !tbaa !16
  %88 = zext i8 %87 to i32
  %89 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef %88, i32 noundef %49, i32 noundef %51)
  %90 = trunc i32 %89 to i8
  store i8 %90, ptr %85, align 1, !tbaa !16
  %91 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_gEiii(i32 noundef %88, i32 noundef %49, i32 noundef %51)
  %92 = trunc i32 %91 to i8
  %93 = getelementptr inbounds i8, ptr %.09198, i64 4
  store i8 %92, ptr %93, align 1, !tbaa !16
  %94 = tail call noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(i32 noundef %88, i32 noundef %49, i32 noundef %51)
  %95 = trunc i32 %94 to i8
  %96 = getelementptr inbounds i8, ptr %.09198, i64 5
  store i8 %95, ptr %96, align 1, !tbaa !16
  %97 = getelementptr inbounds i8, ptr %.09198, i64 6
  %98 = getelementptr inbounds i8, ptr %.088101, i64 2
  %99 = getelementptr inbounds i8, ptr %.09396, i64 2
  %100 = getelementptr inbounds i8, ptr %.09099, i64 2
  %101 = add nuw nsw i32 %.089100, 2
  %.not94 = icmp sgt i32 %101, %21
  br i1 %.not94, label %._crit_edge, label %46, !llvm.loop !17
}

declare zeroext i1 @px_is_valid_yuv420sp_image_pair(ptr noundef, 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_rgb_image(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 uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_rEiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_121YuvToRgb_Converter_v25get_bEiii(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 = { 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 12}
!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 8}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !10, i64 20}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !15}


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