#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 */
scalar_t__ bit_is_set(int, int);
uint8_t rev_byte_0(uint8_t old_byte) {
  uint8_t new_byte = 0;
  if (bit_is_set(old_byte, 7))
    new_byte = new_byte | (1 << (0));
  if (bit_is_set(old_byte, 6))
    new_byte = new_byte | (1 << (1));
  if (bit_is_set(old_byte, 5))
    new_byte = new_byte | (1 << (2));
  if (bit_is_set(old_byte, 4))
    new_byte = new_byte | (1 << (3));
  if (bit_is_set(old_byte, 3))
    new_byte = new_byte | (1 << (4));
  if (bit_is_set(old_byte, 2))
    new_byte = new_byte | (1 << (5));
  if (bit_is_set(old_byte, 1))
    new_byte = new_byte | (1 << (6));
  if (bit_is_set(old_byte, 0))
    new_byte = new_byte | (1 << (7));
  return new_byte;
}


x86 assembly (clang, -O0):
<rev_byte_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x7,%esi
call   1030 <bit_is_set@plt>
cmp    $0x0,%rax
je     1142 <rev_byte_0+0x32>
mov    -0x8(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x6,%esi
call   1030 <bit_is_set@plt>
cmp    $0x0,%rax
je     1162 <rev_byte_0+0x52>
mov    -0x8(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x5,%esi
call   1030 <bit_is_set@plt>
cmp    $0x0,%rax
je     1182 <rev_byte_0+0x72>
mov    -0x8(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1030 <bit_is_set@plt>
cmp    $0x0,%rax
je     11a2 <rev_byte_0+0x92>
mov    -0x8(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
call   1030 <bit_is_set@plt>
cmp    $0x0,%rax
je     11c2 <rev_byte_0+0xb2>
mov    -0x8(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <bit_is_set@plt>
cmp    $0x0,%rax
je     11e2 <rev_byte_0+0xd2>
mov    -0x8(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <bit_is_set@plt>
cmp    $0x0,%rax
je     1202 <rev_byte_0+0xf2>
mov    -0x8(%rbp),%eax
or     $0x40,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <bit_is_set@plt>
cmp    $0x0,%rax
je     1221 <rev_byte_0+0x111>
mov    -0x8(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_byte_0>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    $0x7,%esi
call   1030 <bit_is_set@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %r14d,%edi
mov    $0x6,%esi
call   1030 <bit_is_set@plt>
lea    0x2(%rbx),%ebp
test   %rax,%rax
cmove  %ebx,%ebp
mov    %r14d,%edi
mov    $0x5,%esi
call   1030 <bit_is_set@plt>
lea    0x4(%rbp),%ebx
test   %rax,%rax
cmove  %ebp,%ebx
mov    %r14d,%edi
mov    $0x4,%esi
call   1030 <bit_is_set@plt>
lea    0x8(%rbx),%ebp
test   %rax,%rax
cmove  %ebx,%ebp
mov    %r14d,%edi
mov    $0x3,%esi
call   1030 <bit_is_set@plt>
mov    %ebp,%ebx
or     $0x10,%ebx
test   %rax,%rax
cmove  %ebp,%ebx
mov    %r14d,%edi
mov    $0x2,%esi
call   1030 <bit_is_set@plt>
mov    %ebx,%ebp
or     $0x20,%ebp
test   %rax,%rax
cmove  %ebx,%ebp
mov    %r14d,%edi
mov    $0x1,%esi
call   1030 <bit_is_set@plt>
mov    %ebp,%ebx
or     $0x40,%ebx
test   %rax,%rax
cmove  %ebp,%ebx
mov    %r14d,%edi
xor    %esi,%esi
call   1030 <bit_is_set@plt>
mov    %ebx,%ecx
or     $0x80,%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rev_byte_0(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = call i64 @bit_is_set(i32 %4, i32 7)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = or i32 %8, 1
store i32 %9, i32* %3
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* %2
%12 = call i64 @bit_is_set(i32 %11, i32 6)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %3
%16 = or i32 %15, 2
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %2
%19 = call i64 @bit_is_set(i32 %18, i32 5)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %3
%23 = or i32 %22, 4
store i32 %23, i32* %3
br label %24
24: ; preds = %21, %17
%25 = load i32, i32* %2
%26 = call i64 @bit_is_set(i32 %25, i32 4)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %3
%30 = or i32 %29, 8
store i32 %30, i32* %3
br label %31
31: ; preds = %28, %24
%32 = load i32, i32* %2
%33 = call i64 @bit_is_set(i32 %32, i32 3)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %3
%37 = or i32 %36, 16
store i32 %37, i32* %3
br label %38
38: ; preds = %35, %31
%39 = load i32, i32* %2
%40 = call i64 @bit_is_set(i32 %39, i32 2)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* %3
%44 = or i32 %43, 32
store i32 %44, i32* %3
br label %45
45: ; preds = %42, %38
%46 = load i32, i32* %2
%47 = call i64 @bit_is_set(i32 %46, i32 1)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i32, i32* %3
%51 = or i32 %50, 64
store i32 %51, i32* %3
br label %52
52: ; preds = %49, %45
%53 = load i32, i32* %2
%54 = call i64 @bit_is_set(i32 %53, i32 0)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load i32, i32* %3
%58 = or i32 %57, 128
store i32 %58, i32* %3
br label %59
59: ; preds = %56, %52
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
define i32 @rev_byte_0(i32 %0) {
%2 = tail call i64 @bit_is_set(i32 %0, i32 7)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i64 @bit_is_set(i32 %0, i32 6)
%6 = icmp eq i64 %5, 0
%7 = or i32 %4, 2
%8 = select i1 %6, i32 %4, i32 %7
%9 = tail call i64 @bit_is_set(i32 %0, i32 5)
%10 = icmp eq i64 %9, 0
%11 = or i32 %8, 4
%12 = select i1 %10, i32 %8, i32 %11
%13 = tail call i64 @bit_is_set(i32 %0, i32 4)
%14 = icmp eq i64 %13, 0
%15 = or i32 %12, 8
%16 = select i1 %14, i32 %12, i32 %15
%17 = tail call i64 @bit_is_set(i32 %0, i32 3)
%18 = icmp eq i64 %17, 0
%19 = or i32 %16, 16
%20 = select i1 %18, i32 %16, i32 %19
%21 = tail call i64 @bit_is_set(i32 %0, i32 2)
%22 = icmp eq i64 %21, 0
%23 = or i32 %20, 32
%24 = select i1 %22, i32 %20, i32 %23
%25 = tail call i64 @bit_is_set(i32 %0, i32 1)
%26 = icmp eq i64 %25, 0
%27 = or i32 %24, 64
%28 = select i1 %26, i32 %24, i32 %27
%29 = tail call i64 @bit_is_set(i32 %0, i32 0)
%30 = icmp eq i64 %29, 0
%31 = or i32 %28, 128
%32 = select i1 %30, i32 %28, i32 %31
ret i32 %32
}