#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 */
uint32_t reflect32(uint32_t in_byte) {
  uint32_t temp = 0;
  uint32_t i;
  for (i = 0; i < 16; i++) {
    temp = temp | ((in_byte & (0x80000000 >> i)) >> (31 - 2 * i)) |
           ((in_byte & (0x00000001 << i)) << (31 - 2 * i));
  }
  return temp;
}


x86 assembly (clang, -O0):
<reflect32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    117b <reflect32+0x7b>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0x80000000,%esi
shr    %cl,%esi
mov    %esi,%ecx
and    %ecx,%edx
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
mov    $0x1f,%ecx
sub    %esi,%ecx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0x1,%esi
shl    %cl,%esi
mov    %esi,%ecx
and    %ecx,%edx
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
mov    $0x1f,%ecx
sub    %esi,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <reflect32+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reflect32>:
xor    %r10d,%r10d
mov    $0x1d,%r9d
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
mov    $0x80000000,%r11d
mov    %r10d,%ecx
shr    %cl,%r11d
and    %edi,%r11d
lea    0x2(%r9),%r8d
mov    %r8d,%ecx
shr    %cl,%r11d
mov    $0x1,%esi
mov    %r10d,%ecx
shl    %cl,%esi
and    %edi,%esi
mov    %r8d,%ecx
shl    %cl,%esi
lea    0x1(%r10),%r8d
mov    $0x80000000,%edx
mov    %r8d,%ecx
shr    %cl,%edx
and    %edi,%edx
mov    %r9d,%ecx
shr    %cl,%edx
or     %eax,%r11d
or     %esi,%edx
or     %r11d,%edx
mov    $0x1,%eax
mov    %r8d,%ecx
shl    %cl,%eax
and    %edi,%eax
mov    %r9d,%ecx
shl    %cl,%eax
or     %edx,%eax
add    $0xfffffffc,%r9d
add    $0x2,%r10d
cmp    $0x10,%r10d
jne    1110 <reflect32+0x10>
ret

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

LLVM IR (-O2):
define i32 @reflect32(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %26, %2 ]
%4 = phi i32 [ 0, %1 ], [ %25, %2 ]
%5 = lshr i32 -2147483648, %3
%6 = and i32 %5, %0
%7 = mul nsw i32 %3, -2
%8 = add nsw i32 %7, 31
%9 = lshr i32 %6, %8
%10 = or i32 %9, %4
%11 = shl nuw nsw i32 1, %3
%12 = and i32 %11, %0
%13 = shl i32 %12, %8
%14 = or i32 %10, %13
%15 = or i32 %3, 1
%16 = lshr i32 -2147483648, %15
%17 = and i32 %16, %0
%18 = mul nsw i32 %15, -2
%19 = add nsw i32 %18, 31
%20 = lshr i32 %17, %19
%21 = or i32 %20, %14
%22 = shl nuw nsw i32 1, %15
%23 = and i32 %22, %0
%24 = shl i32 %23, %19
%25 = or i32 %21, %24
%26 = add nuw nsw i32 %3, 2
%27 = icmp eq i32 %26, 16
br i1 %27, label %28, label %2
28: ; preds = %2
ret i32 %25
}