#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;
typedef int uint32_t;

/* Variables and functions */
int calc_parity(int);
uint8_t enc_secded_28_22(const uint8_t bytes[3]) {
  uint32_t word = ((uint32_t)bytes[0] << 0) | ((uint32_t)bytes[1] << 8) |
                  ((uint32_t)bytes[2] << 16);
  return (calc_parity(word & 0x3003ff) << 0) |
         (calc_parity(word & 0x10fc0f) << 1) |
         (calc_parity(word & 0x271c71) << 2) |
         (calc_parity(word & 0x3b6592) << 3) |
         (calc_parity(word & 0x3daaa4) << 4) |
         (calc_parity(word & 0x3ed348) << 5);
}


x86 assembly (clang, -O0):
<enc_secded_28_22>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x0,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
and    $0x3003ff,%edi
call   1030 <calc_parity@plt>
shl    $0x0,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
and    $0x10fc0f,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
and    $0x271c71,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
and    $0x3b6592,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
shl    $0x3,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
and    $0x3daaa4,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
and    $0x3ed348,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
shl    $0x5,%ecx
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enc_secded_28_22>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x4(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
mov    0x8(%rdi),%ebx
shl    $0x10,%ebx
or     %eax,%ebx
mov    %ebx,%edi
and    $0x3003ff,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r14d
mov    %ebx,%edi
and    $0x10fc0f,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r15d
add    %eax,%r15d
or     %r14d,%r15d
mov    %ebx,%edi
and    $0x271c71,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r14d
shl    $0x2,%r14d
mov    %ebx,%edi
and    $0x3b6592,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ebp
shl    $0x3,%ebp
or     %r14d,%ebp
or     %r15d,%ebp
mov    %ebx,%edi
and    $0x3daaa4,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r14d
shl    $0x4,%r14d
and    $0x3ed348,%ebx
mov    %ebx,%edi
call   1030 <calc_parity@plt>
shl    $0x5,%eax
or     %r14d,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @enc_secded_28_22(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = shl i32 %6, 0
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = shl i32 %10, 8
%12 = or i32 %7, %11
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 2
%15 = load i32, i32* %14
%16 = shl i32 %15, 16
%17 = or i32 %12, %16
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = and i32 %18, 3146751
%20 = call i32 @calc_parity(i32 %19)
%21 = shl i32 %20, 0
%22 = load i32, i32* %3
%23 = and i32 %22, 1113103
%24 = call i32 @calc_parity(i32 %23)
%25 = shl i32 %24, 1
%26 = or i32 %21, %25
%27 = load i32, i32* %3
%28 = and i32 %27, 2563185
%29 = call i32 @calc_parity(i32 %28)
%30 = shl i32 %29, 2
%31 = or i32 %26, %30
%32 = load i32, i32* %3
%33 = and i32 %32, 3892626
%34 = call i32 @calc_parity(i32 %33)
%35 = shl i32 %34, 3
%36 = or i32 %31, %35
%37 = load i32, i32* %3
%38 = and i32 %37, 4041380
%39 = call i32 @calc_parity(i32 %38)
%40 = shl i32 %39, 4
%41 = or i32 %36, %40
%42 = load i32, i32* %3
%43 = and i32 %42, 4117320
%44 = call i32 @calc_parity(i32 %43)
%45 = shl i32 %44, 5
%46 = or i32 %41, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @enc_secded_28_22(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = shl i32 %8, 16
%10 = or i32 %6, %9
%11 = and i32 %10, 3146751
%12 = tail call i32 @calc_parity(i32 %11)
%13 = and i32 %10, 1113103
%14 = tail call i32 @calc_parity(i32 %13)
%15 = shl i32 %14, 1
%16 = or i32 %15, %12
%17 = and i32 %10, 2563185
%18 = tail call i32 @calc_parity(i32 %17)
%19 = shl i32 %18, 2
%20 = or i32 %16, %19
%21 = and i32 %10, 3892626
%22 = tail call i32 @calc_parity(i32 %21)
%23 = shl i32 %22, 3
%24 = or i32 %20, %23
%25 = and i32 %10, 4041380
%26 = tail call i32 @calc_parity(i32 %25)
%27 = shl i32 %26, 4
%28 = or i32 %24, %27
%29 = and i32 %10, 4117320
%30 = tail call i32 @calc_parity(i32 %29)
%31 = shl i32 %30, 5
%32 = or i32 %28, %31
ret i32 %32
}