#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 uint16_t;

/* Variables and functions */
int calc_parity(int);
uint8_t enc_secded_22_16(const uint8_t bytes[2]) {
  uint16_t word = ((uint16_t)bytes[0] << 0) | ((uint16_t)bytes[1] << 8);
  return (calc_parity(word & 0x496e) << 0) | (calc_parity(word & 0xf20b) << 1) |
         (calc_parity(word & 0x8ed8) << 2) | (calc_parity(word & 0x7714) << 3) |
         (calc_parity(word & 0xaca5) << 4) | (calc_parity(word & 0x11f3) << 5);
}


x86 assembly (clang, -O0):
<enc_secded_22_16>:
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    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
and    $0x496e,%edi
call   1030 <calc_parity@plt>
shl    $0x0,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
and    $0xf20b,%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    $0x8ed8,%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    $0x7714,%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    $0xaca5,%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    $0x11f3,%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_22_16>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x4(%rdi),%ebx
shl    $0x8,%ebx
or     (%rdi),%ebx
mov    %ebx,%edi
and    $0x496e,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r14d
mov    %ebx,%edi
and    $0xf20b,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r15d
add    %eax,%r15d
or     %r14d,%r15d
mov    %ebx,%edi
and    $0x8ed8,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r14d
shl    $0x2,%r14d
mov    %ebx,%edi
and    $0x7714,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ebp
shl    $0x3,%ebp
or     %r14d,%ebp
or     %r15d,%ebp
mov    %ebx,%edi
and    $0xaca5,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r14d
shl    $0x4,%r14d
and    $0x11f3,%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_22_16(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
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = and i32 %13, 18798
%15 = call i32 @calc_parity(i32 %14)
%16 = shl i32 %15, 0
%17 = load i32, i32* %3
%18 = and i32 %17, 61963
%19 = call i32 @calc_parity(i32 %18)
%20 = shl i32 %19, 1
%21 = or i32 %16, %20
%22 = load i32, i32* %3
%23 = and i32 %22, 36568
%24 = call i32 @calc_parity(i32 %23)
%25 = shl i32 %24, 2
%26 = or i32 %21, %25
%27 = load i32, i32* %3
%28 = and i32 %27, 30484
%29 = call i32 @calc_parity(i32 %28)
%30 = shl i32 %29, 3
%31 = or i32 %26, %30
%32 = load i32, i32* %3
%33 = and i32 %32, 44197
%34 = call i32 @calc_parity(i32 %33)
%35 = shl i32 %34, 4
%36 = or i32 %31, %35
%37 = load i32, i32* %3
%38 = and i32 %37, 4595
%39 = call i32 @calc_parity(i32 %38)
%40 = shl i32 %39, 5
%41 = or i32 %36, %40
ret i32 %41
}

LLVM IR (-O2):
define i32 @enc_secded_22_16(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 = and i32 %6, 18798
%8 = tail call i32 @calc_parity(i32 %7)
%9 = and i32 %6, 61963
%10 = tail call i32 @calc_parity(i32 %9)
%11 = shl i32 %10, 1
%12 = or i32 %11, %8
%13 = and i32 %6, 36568
%14 = tail call i32 @calc_parity(i32 %13)
%15 = shl i32 %14, 2
%16 = or i32 %12, %15
%17 = and i32 %6, 30484
%18 = tail call i32 @calc_parity(i32 %17)
%19 = shl i32 %18, 3
%20 = or i32 %16, %19
%21 = and i32 %6, 44197
%22 = tail call i32 @calc_parity(i32 %21)
%23 = shl i32 %22, 4
%24 = or i32 %20, %23
%25 = and i32 %6, 4595
%26 = tail call i32 @calc_parity(i32 %25)
%27 = shl i32 %26, 5
%28 = or i32 %24, %27
ret i32 %28
}