#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 */

/* Variables and functions */
int count_ones(unsigned int);
unsigned int hamming74_enc_symbol(unsigned int _p) {
  unsigned int x0 = count_ones(_p & 0x0d) % 2;
  unsigned int x1 = count_ones(_p & 0x0b) % 2;
  unsigned int x2 = count_ones(_p & 0x08) % 2;
  unsigned int x3 = count_ones(_p & 0x07) % 2;
  unsigned int x4 = count_ones(_p & 0x04) % 2;
  unsigned int x5 = count_ones(_p & 0x02) % 2;
  unsigned int x6 = count_ones(_p & 0x01) % 2;
  unsigned int x = (x0 << 6) | (x1 << 5) | (x2 << 4) | (x3 << 3) | (x4 << 2) |
                   (x5 << 1) | (x6);
  return x;
}


x86 assembly (clang, -O0):
<hamming74_enc_symbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
and    $0xd,%edi
call   1030 <count_ones@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%edi
and    $0xb,%edi
call   1030 <count_ones@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
and    $0x8,%edi
call   1030 <count_ones@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
and    $0x7,%edi
call   1030 <count_ones@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
and    $0x4,%edi
call   1030 <count_ones@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
and    $0x2,%edi
call   1030 <count_ones@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
and    $0x1,%edi
call   1030 <count_ones@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x6,%eax
mov    -0xc(%rbp),%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
or     %ecx,%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hamming74_enc_symbol>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
and    $0xd,%edi
call   1030 <count_ones@plt>
mov    %eax,%r15d
mov    %r14d,%edi
and    $0xb,%edi
call   1030 <count_ones@plt>
mov    %eax,%ebp
mov    %r14d,%edi
and    $0x8,%edi
call   1030 <count_ones@plt>
mov    %eax,%ebx
mov    %r14d,%edi
and    $0x7,%edi
call   1030 <count_ones@plt>
movd   %r15d,%xmm0
movd   %ebp,%xmm2
punpckldq %xmm0,%xmm2
movd   %ebx,%xmm0
movd   %eax,%xmm1
punpckldq %xmm1,%xmm0
punpcklqdq %xmm0,%xmm2
movdqa %xmm2,%xmm0
psrld  $0x1f,%xmm0
paddd  %xmm2,%xmm0
psrad  $0x1,%xmm0
paddd  %xmm0,%xmm0
psubd  %xmm0,%xmm2
movdqa %xmm2,(%rsp)
mov    %r14d,%edi
and    $0x4,%edi
call   1030 <count_ones@plt>
mov    %eax,%ebp
shr    $0x1f,%eax
add    %ebp,%eax
and    $0x3ffffffe,%eax
sub    %eax,%ebp
mov    %r14d,%edi
and    $0x2,%edi
call   1030 <count_ones@plt>
mov    %eax,%ebx
shr    $0x1f,%eax
add    %ebx,%eax
and    $0x7ffffffe,%eax
sub    %eax,%ebx
and    $0x1,%r14d
mov    %r14d,%edi
call   1030 <count_ones@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
movdqa (%rsp),%xmm1
pshufd $0xf5,%xmm1,%xmm0
pmuludq 0xe1d(%rip),%xmm1
sub    %ecx,%eax
pshufd $0xe8,%xmm1,%xmm1
pmuludq 0xe1e(%rip),%xmm0
pshufd $0xe8,%xmm0,%xmm0
punpckldq %xmm0,%xmm1
shl    $0x2,%ebp
add    %ebx,%ebx
or     %ebp,%ebx
or     %ebx,%eax
pshufd $0xee,%xmm1,%xmm0
por    %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
por    %xmm0,%xmm1
movd   %xmm1,%ecx
or     %ecx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @hamming74_enc_symbol(i32 %0) {
%2 = and i32 %0, 13
%3 = tail call i32 @count_ones(i32 %2)
%4 = and i32 %0, 11
%5 = tail call i32 @count_ones(i32 %4)
%6 = and i32 %0, 8
%7 = tail call i32 @count_ones(i32 %6)
%8 = and i32 %0, 7
%9 = tail call i32 @count_ones(i32 %8)
%10 = insertelement <4 x i32> poison, i32 %5, i64 0
%11 = insertelement <4 x i32> %10, i32 %3, i64 1
%12 = insertelement <4 x i32> %11, i32 %7, i64 2
%13 = insertelement <4 x i32> %12, i32 %9, i64 3
%14 = srem <4 x i32> %13, <i32 2, i32 2, i32 2, i32 2>
%15 = and i32 %0, 4
%16 = tail call i32 @count_ones(i32 %15)
%17 = srem i32 %16, 2
%18 = and i32 %0, 2
%19 = tail call i32 @count_ones(i32 %18)
%20 = srem i32 %19, 2
%21 = and i32 %0, 1
%22 = tail call i32 @count_ones(i32 %21)
%23 = srem i32 %22, 2
%24 = shl nsw <4 x i32> %14, <i32 5, i32 6, i32 4, i32 3>
%25 = shl nsw i32 %17, 2
%26 = shl nsw i32 %20, 1
%27 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> %24)
%28 = or i32 %27, %25
%29 = or i32 %28, %26
%30 = or i32 %29, %23
ret i32 %30
}