#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 */
void Interp8(uint32_t *pc, uint32_t c1, uint32_t c2) {
  if (c1 == c2) {
    *pc = c1;
    return;
  }
  *pc = ((((c1 & 0x00FF00) * 5 + (c2 & 0x00FF00) * 3) >> 3) & 0x00FF00) +
        ((((c1 & 0xFF00FF) * 5 + (c2 & 0xFF00FF) * 3) >> 3) & 0xFF00FF);
}


x86 assembly (clang, -O0):
<Interp8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1128 <Interp8+0x28>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    1172 <Interp8+0x72>
mov    -0xc(%rbp),%eax
and    $0xff00,%eax
imul   $0x5,%eax,%ecx
mov    -0x10(%rbp),%eax
and    $0xff00,%eax
imul   $0x3,%eax,%eax
add    %eax,%ecx
sar    $0x3,%ecx
and    $0xff00,%ecx
mov    -0xc(%rbp),%eax
and    $0xff00ff,%eax
imul   $0x5,%eax,%eax
mov    -0x10(%rbp),%edx
and    $0xff00ff,%edx
imul   $0x3,%edx,%edx
add    %edx,%eax
sar    $0x3,%eax
and    $0xff00ff,%eax
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Interp8>:
cmp    %edx,%esi
je     1143 <Interp8+0x43>
mov    %esi,%eax
and    $0xff00,%eax
lea    (%rax,%rax,4),%eax
mov    %edx,%ecx
and    $0xff00,%ecx
lea    (%rcx,%rcx,2),%ecx
add    %eax,%ecx
shr    $0x3,%ecx
and    $0xff00,%ecx
and    $0xff00ff,%esi
lea    (%rsi,%rsi,4),%eax
and    $0xff00ff,%edx
lea    (%rdx,%rdx,2),%esi
add    %eax,%esi
shr    $0x3,%esi
and    $0xff00ff,%esi
or     %ecx,%esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @Interp8(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
br label %34
13: ; preds = %3
%14 = load i32, i32* %5
%15 = and i32 %14, 65280
%16 = mul nsw i32 %15, 5
%17 = load i32, i32* %6
%18 = and i32 %17, 65280
%19 = mul nsw i32 %18, 3
%20 = add nsw i32 %16, %19
%21 = ashr i32 %20, 3
%22 = and i32 %21, 65280
%23 = load i32, i32* %5
%24 = and i32 %23, 16711935
%25 = mul nsw i32 %24, 5
%26 = load i32, i32* %6
%27 = and i32 %26, 16711935
%28 = mul nsw i32 %27, 3
%29 = add nsw i32 %25, %28
%30 = ashr i32 %29, 3
%31 = and i32 %30, 16711935
%32 = add nsw i32 %22, %31
%33 = load i32*, i32** %4
store i32 %32, i32* %33
br label %34
34: ; preds = %13, %10
ret void
}

LLVM IR (-O2):
define void @Interp8(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %21, label %5
5: ; preds = %3
%6 = and i32 %1, 65280
%7 = mul nuw nsw i32 %6, 5
%8 = and i32 %2, 65280
%9 = mul nuw nsw i32 %8, 3
%10 = add nuw nsw i32 %9, %7
%11 = lshr exact i32 %10, 3
%12 = and i32 %11, 65280
%13 = and i32 %1, 16711935
%14 = mul nuw nsw i32 %13, 5
%15 = and i32 %2, 16711935
%16 = mul nuw nsw i32 %15, 3
%17 = add nuw nsw i32 %16, %14
%18 = lshr i32 %17, 3
%19 = and i32 %18, 16711935
%20 = or i32 %12, %19
br label %21
21: ; preds = %3, %5
%22 = phi i32 [ %20, %5 ], [ %1, %3 ]
store i32 %22, i32* %0
ret void
}