#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_39_32(const uint8_t bytes[4]) {
  uint32_t word = ((uint32_t)bytes[0] << 0) | ((uint32_t)bytes[1] << 8) |
                  ((uint32_t)bytes[2] << 16) | ((uint32_t)bytes[3] << 24);
  return (calc_parity(word & 0x2606bd25) << 0) |
         (calc_parity(word & 0xdeba8050) << 1) |
         (calc_parity(word & 0x413d89aa) << 2) |
         (calc_parity(word & 0x31234ed1) << 3) |
         (calc_parity(word & 0xc2c1323b) << 4) |
         (calc_parity(word & 0x2dcc624c) << 5) |
         (calc_parity(word & 0x98505586) << 6);
}


x86 assembly (clang, -O0):
<enc_secded_39_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    -0x8(%rbp),%rcx
mov    0xc(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
and    $0x2606bd25,%edi
call   1030 <calc_parity@plt>
shl    $0x0,%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%edi
and    $0xdeba8050,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
and    $0x413d89aa,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
and    $0x31234ed1,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
shl    $0x3,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
and    $0xc2c1323b,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
and    $0x2dcc624c,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x5,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
and    $0x98505586,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
shl    $0x6,%ecx
or     %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enc_secded_39_32>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%ecx
shl    $0x8,%eax
or     (%rdi),%eax
shl    $0x10,%ecx
mov    0xc(%rdi),%ebx
shl    $0x18,%ebx
or     %ecx,%ebx
or     %eax,%ebx
mov    %ebx,%edi
and    $0x2606bd25,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ebp
mov    %ebx,%edi
and    $0xdeba8050,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r14d
add    %eax,%r14d
or     %ebp,%r14d
mov    %ebx,%edi
and    $0x413d89aa,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r15d
shl    $0x2,%r15d
mov    %ebx,%edi
and    $0x31234ed1,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r12d
shl    $0x3,%r12d
or     %r15d,%r12d
or     %r14d,%r12d
mov    %ebx,%edi
and    $0xc2c1323b,%edi
call   1030 <calc_parity@plt>
mov    %eax,%r14d
shl    $0x4,%r14d
mov    %ebx,%edi
and    $0x2dcc624c,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ebp
shl    $0x5,%ebp
or     %r14d,%ebp
and    $0x98505586,%ebx
mov    %ebx,%edi
call   1030 <calc_parity@plt>
shl    $0x6,%eax
or     %ebp,%eax
or     %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @enc_secded_39_32(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
%18 = load i32*, i32** %2
%19 = getelementptr inbounds i32, i32* %18, i64 3
%20 = load i32, i32* %19
%21 = shl i32 %20, 24
%22 = or i32 %17, %21
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = and i32 %23, 637975845
%25 = call i32 @calc_parity(i32 %24)
%26 = shl i32 %25, 0
%27 = load i32, i32* %3
%28 = and i32 %27, -558202800
%29 = call i32 @calc_parity(i32 %28)
%30 = shl i32 %29, 1
%31 = or i32 %26, %30
%32 = load i32, i32* %3
%33 = and i32 %32, 1094551978
%34 = call i32 @calc_parity(i32 %33)
%35 = shl i32 %34, 2
%36 = or i32 %31, %35
%37 = load i32, i32* %3
%38 = and i32 %37, 824397521
%39 = call i32 @calc_parity(i32 %38)
%40 = shl i32 %39, 3
%41 = or i32 %36, %40
%42 = load i32, i32* %3
%43 = and i32 %42, -1027526085
%44 = call i32 @calc_parity(i32 %43)
%45 = shl i32 %44, 4
%46 = or i32 %41, %45
%47 = load i32, i32* %3
%48 = and i32 %47, 768369228
%49 = call i32 @calc_parity(i32 %48)
%50 = shl i32 %49, 5
%51 = or i32 %46, %50
%52 = load i32, i32* %3
%53 = and i32 %52, -1739565690
%54 = call i32 @calc_parity(i32 %53)
%55 = shl i32 %54, 6
%56 = or i32 %51, %55
ret i32 %56
}

LLVM IR (-O2):
define i32 @enc_secded_39_32(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 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = shl i32 %12, 24
%14 = or i32 %10, %13
%15 = and i32 %14, 637975845
%16 = tail call i32 @calc_parity(i32 %15)
%17 = and i32 %14, -558202800
%18 = tail call i32 @calc_parity(i32 %17)
%19 = shl i32 %18, 1
%20 = or i32 %19, %16
%21 = and i32 %14, 1094551978
%22 = tail call i32 @calc_parity(i32 %21)
%23 = shl i32 %22, 2
%24 = or i32 %20, %23
%25 = and i32 %14, 824397521
%26 = tail call i32 @calc_parity(i32 %25)
%27 = shl i32 %26, 3
%28 = or i32 %24, %27
%29 = and i32 %14, -1027526085
%30 = tail call i32 @calc_parity(i32 %29)
%31 = shl i32 %30, 4
%32 = or i32 %28, %31
%33 = and i32 %14, 768369228
%34 = tail call i32 @calc_parity(i32 %33)
%35 = shl i32 %34, 5
%36 = or i32 %32, %35
%37 = and i32 %14, -1739565690
%38 = tail call i32 @calc_parity(i32 %37)
%39 = shl i32 %38, 6
%40 = or i32 %36, %39
ret i32 %40
}