#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 COUNT(uint32_t c, int op_32) {
  if (c & (1 << 30))
    return ((c & 0xff) - ((c >> 8) & 0xff));
  if (c & (1 << 31)) {
    if (op_32 & 0x100)
      return (c >> 8) & 0xff;
    return c & 0xff;
  }
  return (c & ~((1 << 31) | (1 << 30) |
                ((1 << 29) | (1 << 28) | (1 << 27) | (1 << 26))));
}


x86 assembly (clang, -O0):
<COUNT>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x40000000,%eax
cmp    $0x0,%eax
je     1139 <COUNT+0x39>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    -0x8(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <COUNT+0x89>
mov    -0x8(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     117e <COUNT+0x7e>
mov    -0xc(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     116e <COUNT+0x6e>
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <COUNT+0x89>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <COUNT+0x89>
mov    -0x8(%rbp),%eax
and    $0x3ffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<COUNT>:
mov    %edi,%ecx
test   $0x40000000,%edi
jne    1117 <COUNT+0x17>
test   %ecx,%ecx
js     1120 <COUNT+0x20>
and    $0x3ffffff,%ecx
mov    %ecx,%eax
ret
movzbl %cl,%eax
movzbl %ch,%ecx
sub    %ecx,%eax
ret
test   $0x100,%esi
jne    112c <COUNT+0x2c>
movzbl %cl,%eax
ret
movzbl %ch,%eax
ret

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

LLVM IR (-O2):
define i32 @COUNT(i32 %0, i32 %1) {
%3 = and i32 %0, 1073741824
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = and i32 %0, 255
%7 = lshr i32 %0, 8
%8 = and i32 %7, 255
%9 = sub nsw i32 %6, %8
br label %22
10: ; preds = %2
%11 = icmp sgt i32 %0, -1
br i1 %11, label %20, label %12
12: ; preds = %10
%13 = and i32 %1, 256
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = lshr i32 %0, 8
%17 = and i32 %16, 255
br label %22
18: ; preds = %12
%19 = and i32 %0, 255
br label %22
20: ; preds = %10
%21 = and i32 %0, 67108863
br label %22
22: ; preds = %20, %18, %15, %5
%23 = phi i32 [ %9, %5 ], [ %17, %15 ], [ %19, %18 ], [ %21, %20 ]
ret i32 %23
}