#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 */
void symmetrize_piece(const uint8_t *piece, uint8_t *dest) {
  int tmp, i;
  for (i = 0; i < 5; i++) {
    tmp = (piece[i] & 16) >> 4;
    tmp |= (piece[i] & 8) >> 2;
    tmp |= (piece[i] & 4);
    tmp |= (piece[i] & 2) << 2;
    tmp |= (piece[i] & 1) << 4;
    dest[i] = tmp;
  }
}


x86 assembly (clang, -O0):
<symmetrize_piece>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    11a6 <symmetrize_piece+0xa6>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x10,%eax
sar    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x8,%eax
sar    $0x2,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x4,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x2,%eax
shl    $0x2,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
and    $0x1,%eax
shl    $0x4,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1113 <symmetrize_piece+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<symmetrize_piece>:
mov    (%rdi),%al
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x54,%cl
add    %cl,%cl
shr    %al
and    $0x50,%al
or     %cl,%al
shr    $0x3,%al
movzbl %al,%eax
mov    %eax,(%rsi)
mov    0x4(%rdi),%al
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x54,%cl
add    %cl,%cl
shr    %al
and    $0x50,%al
or     %cl,%al
shr    $0x3,%al
movzbl %al,%eax
mov    %eax,0x4(%rsi)
mov    0x8(%rdi),%al
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x54,%cl
add    %cl,%cl
shr    %al
and    $0x50,%al
or     %cl,%al
shr    $0x3,%al
movzbl %al,%eax
mov    %eax,0x8(%rsi)
mov    0xc(%rdi),%al
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x54,%cl
add    %cl,%cl
shr    %al
and    $0x50,%al
or     %cl,%al
shr    $0x3,%al
movzbl %al,%eax
mov    %eax,0xc(%rsi)
mov    0x10(%rdi),%al
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x54,%cl
add    %cl,%cl
shr    %al
and    $0x50,%al
or     %cl,%al
shr    $0x3,%al
movzbl %al,%eax
mov    %eax,0x10(%rsi)
ret

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

LLVM IR (-O2):
define void @symmetrize_piece(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = trunc i32 %3 to i5
%5 = tail call i5 @llvm.bitreverse.i5(i5 %4)
%6 = zext i5 %5 to i32
store i32 %6, i32* %1
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = load i32, i32* %7
%9 = trunc i32 %8 to i5
%10 = tail call i5 @llvm.bitreverse.i5(i5 %9)
%11 = zext i5 %10 to i32
%12 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %11, i32* %12
%13 = getelementptr inbounds i32, i32* %0, i64 2
%14 = load i32, i32* %13
%15 = trunc i32 %14 to i5
%16 = tail call i5 @llvm.bitreverse.i5(i5 %15)
%17 = zext i5 %16 to i32
%18 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %17, i32* %18
%19 = getelementptr inbounds i32, i32* %0, i64 3
%20 = load i32, i32* %19
%21 = trunc i32 %20 to i5
%22 = tail call i5 @llvm.bitreverse.i5(i5 %21)
%23 = zext i5 %22 to i32
%24 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %23, i32* %24
%25 = getelementptr inbounds i32, i32* %0, i64 4
%26 = load i32, i32* %25
%27 = trunc i32 %26 to i5
%28 = tail call i5 @llvm.bitreverse.i5(i5 %27)
%29 = zext i5 %28 to i32
%30 = getelementptr inbounds i32, i32* %1, i64 4
store i32 %29, i32* %30
ret void
}