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

/* Variables and functions */
int abs(int);
int rgb2yuv(int);
int Diff(uint32_t w1, uint32_t w2) {
  uint32_t YUV1 = rgb2yuv(w1);
  uint32_t YUV2 = rgb2yuv(w2);
  return ((abs((YUV1 & 0x00FF0000) - (YUV2 & 0x00FF0000)) > 0x00300000) ||
          (abs((YUV1 & 0x0000FF00) - (YUV2 & 0x0000FF00)) > 0x00000700) ||
          (abs((YUV1 & 0x000000FF) - (YUV2 & 0x000000FF)) > 0x00000006));
}


x86 assembly (clang, -O0):
<Diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <rgb2yuv@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <rgb2yuv@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
and    $0xff0000,%edi
mov    -0x10(%rbp),%eax
and    $0xff0000,%eax
sub    %eax,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x300000,%ecx
mov    %al,-0x11(%rbp)
jg     11bb <Diff+0x9b>
mov    -0xc(%rbp),%edi
and    $0xff00,%edi
mov    -0x10(%rbp),%eax
and    $0xff00,%eax
sub    %eax,%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x700,%ecx
mov    %al,-0x11(%rbp)
jg     11bb <Diff+0x9b>
mov    -0xc(%rbp),%edi
and    $0xff,%edi
mov    -0x10(%rbp),%eax
and    $0xff,%eax
sub    %eax,%edi
call   1030 <abs@plt>
cmp    $0x6,%eax
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Diff>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <rgb2yuv@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <rgb2yuv@plt>
mov    %ebx,%ecx
and    $0xff0000,%ecx
mov    %eax,%edx
and    $0xff0000,%edx
sub    %edx,%ecx
mov    %ecx,%edx
neg    %edx
cmovs  %ecx,%edx
mov    $0x1,%ecx
cmp    $0x300000,%edx
ja     1181 <Diff+0x71>
mov    %ebx,%edx
and    $0xff00,%edx
mov    %eax,%esi
and    $0xff00,%esi
sub    %esi,%edx
mov    %edx,%esi
neg    %esi
cmovs  %edx,%esi
cmp    $0x700,%esi
ja     1181 <Diff+0x71>
movzbl %bl,%ecx
movzbl %al,%eax
sub    %eax,%ecx
mov    %ecx,%eax
neg    %eax
cmovs  %ecx,%eax
xor    %ecx,%ecx
cmp    $0x7,%eax
setae  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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