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

/* Variables and functions */
uint8_t rev_byte_7(uint8_t x) {
  uint8_t r = (x & (1 << 7)) >> 7;
  r |= (x & (1 << 6)) >> 5;
  r |= (x & (1 << 5)) >> 3;
  r |= (x & (1 << 4)) >> 1;
  r |= (x & (1 << 3)) << 1;
  r |= (x & (1 << 2)) << 3;
  r |= (x & (1 << 1)) << 5;
  r |= (x & (1 << 0)) << 7;
  return r;
}


x86 assembly (clang, -O0):
<rev_byte_7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
sar    $0x7,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x40,%eax
sar    $0x5,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x20,%eax
sar    $0x3,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x10,%eax
sar    $0x1,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8,%eax
shl    $0x1,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4,%eax
shl    $0x3,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
shl    $0x5,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
shl    $0x7,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_byte_7>:
rol    $0x4,%dil
mov    %edi,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%dil
and    $0x33,%dil
or     %al,%dil
mov    %edi,%eax
and    $0x55,%al
add    %al,%al
shr    %dil
and    $0x55,%dil
or     %al,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @rev_byte_7(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 128
%6 = ashr i32 %5, 7
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = and i32 %7, 64
%9 = ashr i32 %8, 5
%10 = load i32, i32* %3
%11 = or i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = and i32 %12, 32
%14 = ashr i32 %13, 3
%15 = load i32, i32* %3
%16 = or i32 %15, %14
store i32 %16, i32* %3
%17 = load i32, i32* %2
%18 = and i32 %17, 16
%19 = ashr i32 %18, 1
%20 = load i32, i32* %3
%21 = or i32 %20, %19
store i32 %21, i32* %3
%22 = load i32, i32* %2
%23 = and i32 %22, 8
%24 = shl i32 %23, 1
%25 = load i32, i32* %3
%26 = or i32 %25, %24
store i32 %26, i32* %3
%27 = load i32, i32* %2
%28 = and i32 %27, 4
%29 = shl i32 %28, 3
%30 = load i32, i32* %3
%31 = or i32 %30, %29
store i32 %31, i32* %3
%32 = load i32, i32* %2
%33 = and i32 %32, 2
%34 = shl i32 %33, 5
%35 = load i32, i32* %3
%36 = or i32 %35, %34
store i32 %36, i32* %3
%37 = load i32, i32* %2
%38 = and i32 %37, 1
%39 = shl i32 %38, 7
%40 = load i32, i32* %3
%41 = or i32 %40, %39
store i32 %41, i32* %3
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
define i32 @rev_byte_7(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = tail call i8 @llvm.bitreverse.i8(i8 %2)
%4 = zext i8 %3 to i32
ret i32 %4
}