#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint32_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
int abs(scalar_t__);
int yuv_diff(uint32_t yuv1, uint32_t yuv2) {
  return ((abs((int32_t)(yuv1 & 0x00FF0000) - (int32_t)(yuv2 & 0x00FF0000)) >
           0x00300000) ||
          (abs((int32_t)(yuv1 & 0x0000FF00) - (int32_t)(yuv2 & 0x0000FF00)) >
           0x00000700) ||
          (abs((int32_t)(yuv1 & 0x000000FF) - (int32_t)(yuv2 & 0x000000FF)) >
           0x00000006));
}


x86 assembly (clang, -O0):
<yuv_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
movslq %eax,%rdi
mov    -0x8(%rbp),%eax
and    $0xff0000,%eax
cltq
sub    %rax,%rdi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x300000,%ecx
mov    %al,-0x9(%rbp)
jg     11a4 <yuv_diff+0x94>
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
movslq %eax,%rdi
mov    -0x8(%rbp),%eax
and    $0xff00,%eax
cltq
sub    %rax,%rdi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x700,%ecx
mov    %al,-0x9(%rbp)
jg     11a4 <yuv_diff+0x94>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
movslq %eax,%rdi
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cltq
sub    %rax,%rdi
call   1030 <abs@plt>
cmp    $0x6,%eax
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yuv_diff>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
and    $0xff0000,%edi
mov    %esi,%eax
and    $0xff0000,%eax
sub    %rax,%rdi
call   1030 <abs@plt>
mov    $0x1,%ebx
cmp    $0x300000,%eax
jg     1171 <yuv_diff+0x61>
mov    %ebp,%edi
and    $0xff00,%edi
mov    %r14d,%eax
and    $0xff00,%eax
sub    %rax,%rdi
call   1030 <abs@plt>
cmp    $0x700,%eax
jg     1171 <yuv_diff+0x61>
movzbl %bpl,%edi
movzbl %r14b,%eax
sub    %rax,%rdi
call   1030 <abs@plt>
xor    %ebx,%ebx
cmp    $0x7,%eax
setge  %bl
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @yuv_diff(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = and i32 %5, 16711680
%7 = sext i32 %6 to i64
%8 = load i32, i32* %4
%9 = and i32 %8, 16711680
%10 = sext i32 %9 to i64
%11 = sub nsw i64 %7, %10
%12 = call i32 @abs(i64 %11)
%13 = icmp sgt i32 %12, 3145728
br i1 %13, label %34, label %14
14: ; preds = %2
%15 = load i32, i32* %3
%16 = and i32 %15, 65280
%17 = sext i32 %16 to i64
%18 = load i32, i32* %4
%19 = and i32 %18, 65280
%20 = sext i32 %19 to i64
%21 = sub nsw i64 %17, %20
%22 = call i32 @abs(i64 %21)
%23 = icmp sgt i32 %22, 1792
br i1 %23, label %34, label %24
24: ; preds = %14
%25 = load i32, i32* %3
%26 = and i32 %25, 255
%27 = sext i32 %26 to i64
%28 = load i32, i32* %4
%29 = and i32 %28, 255
%30 = sext i32 %29 to i64
%31 = sub nsw i64 %27, %30
%32 = call i32 @abs(i64 %31)
%33 = icmp sgt i32 %32, 6
br label %34
34: ; preds = %24, %14, %2
%35 = phi i1 [ true, %14 ], [ true, %2 ], [ %33, %24 ]
%36 = zext i1 %35 to i32
ret i32 %36
}

LLVM IR (-O2):
define i32 @yuv_diff(i32 %0, i32 %1) {
%3 = and i32 %0, 16711680
%4 = zext i32 %3 to i64
%5 = and i32 %1, 16711680
%6 = zext i32 %5 to i64
%7 = sub nsw i64 %4, %6
%8 = tail call i32 @abs(i64 %7)
%9 = icmp sgt i32 %8, 3145728
br i1 %9, label %27, label %10
10: ; preds = %2
%11 = and i32 %0, 65280
%12 = zext i32 %11 to i64
%13 = and i32 %1, 65280
%14 = zext i32 %13 to i64
%15 = sub nsw i64 %12, %14
%16 = tail call i32 @abs(i64 %15)
%17 = icmp sgt i32 %16, 1792
br i1 %17, label %27, label %18
18: ; preds = %10
%19 = and i32 %0, 255
%20 = zext i32 %19 to i64
%21 = and i32 %1, 255
%22 = zext i32 %21 to i64
%23 = sub nsw i64 %20, %22
%24 = tail call i32 @abs(i64 %23)
%25 = icmp sgt i32 %24, 6
%26 = zext i1 %25 to i32
br label %27
27: ; preds = %18, %10, %2
%28 = phi i32 [ 1, %10 ], [ 1, %2 ], [ %26, %18 ]
ret i32 %28
}