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

/* Variables and functions */
int calc_parity(int);
uint8_t enc_secded_64_57(const uint8_t bytes[8]) {
  uint64_t word = ((uint64_t)bytes[0] << 0) | ((uint64_t)bytes[1] << 8) |
                  ((uint64_t)bytes[2] << 16) | ((uint64_t)bytes[3] << 24) |
                  ((uint64_t)bytes[4] << 32) | ((uint64_t)bytes[5] << 40) |
                  ((uint64_t)bytes[6] << 48) | ((uint64_t)bytes[7] << 56);
  return (calc_parity(word & 0x103fff800007fff) << 0) |
         (calc_parity(word & 0x17c1ff801ff801f) << 1) |
         (calc_parity(word & 0x1bde1f87e0781e1) << 2) |
         (calc_parity(word & 0x1deee3b8e388e22) << 3) |
         (calc_parity(word & 0x1ef76cdb2c93244) << 4) |
         (calc_parity(word & 0x1f7bb56d5525488) << 5) |
         (calc_parity(word & 0x1fbdda769a46910) << 6);
}


x86 assembly (clang, -O0):
<enc_secded_64_57>:
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    -0x8(%rbp),%rcx
mov    0x10(%rcx),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x14(%rcx),%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x18(%rcx),%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x1c(%rcx),%edx
mov    $0x38,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
movabs $0x103fff800007fff,%rcx
ff 03 01
and    %rcx,%rax
mov    %eax,%edi
call   1030 <calc_parity@plt>
shl    $0x0,%eax
mov    %eax,-0x24(%rbp)
movslq -0xc(%rbp),%rax
movabs $0x17c1ff801ff801f,%rcx
1f 7c 01
and    %rcx,%rax
mov    %eax,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x20(%rbp)
movslq -0xc(%rbp),%rax
movabs $0x1bde1f87e0781e1,%rcx
e1 bd 01
and    %rcx,%rax
mov    %eax,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
movslq -0xc(%rbp),%rax
movabs $0x1deee3b8e388e22,%rcx
ee de 01
and    %rcx,%rax
mov    %eax,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
shl    $0x3,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
movslq -0xc(%rbp),%rax
movabs $0x1ef76cdb2c93244,%rcx
76 ef 01
and    %rcx,%rax
mov    %eax,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
movslq -0xc(%rbp),%rax
movabs $0x1f7bb56d5525488,%rcx
bb f7 01
and    %rcx,%rax
mov    %eax,%edi
call   1030 <calc_parity@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x5,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
movslq -0xc(%rbp),%rax
movabs $0x1fbdda769a46910,%rcx
dd fb 01
and    %rcx,%rax
mov    %eax,%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_64_57>:
push   %rbp
push   %r14
push   %rbx
call   1030 <calc_parity@plt>
mov    %eax,%ebx
call   1030 <calc_parity@plt>
mov    %eax,%ebp
add    %eax,%ebp
or     %ebx,%ebp
call   1030 <calc_parity@plt>
mov    %eax,%r14d
shl    $0x2,%r14d
call   1030 <calc_parity@plt>
mov    %eax,%ebx
shl    $0x3,%ebx
or     %r14d,%ebx
or     %ebp,%ebx
call   1030 <calc_parity@plt>
mov    %eax,%r14d
shl    $0x4,%r14d
call   1030 <calc_parity@plt>
mov    %eax,%ebp
shl    $0x5,%ebp
or     %r14d,%ebp
call   1030 <calc_parity@plt>
shl    $0x6,%eax
or     %ebp,%eax
or     %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @enc_secded_64_57(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
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i64 4
%25 = load i32, i32* %24
%26 = shl i32 %25, 32
%27 = or i32 %22, %26
%28 = load i32*, i32** %2
%29 = getelementptr inbounds i32, i32* %28, i64 5
%30 = load i32, i32* %29
%31 = shl i32 %30, 40
%32 = or i32 %27, %31
%33 = load i32*, i32** %2
%34 = getelementptr inbounds i32, i32* %33, i64 6
%35 = load i32, i32* %34
%36 = shl i32 %35, 48
%37 = or i32 %32, %36
%38 = load i32*, i32** %2
%39 = getelementptr inbounds i32, i32* %38, i64 7
%40 = load i32, i32* %39
%41 = shl i32 %40, 56
%42 = or i32 %37, %41
store i32 %42, i32* %3
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = and i64 %44, 73183459585064959
%46 = trunc i64 %45 to i32
%47 = call i32 @calc_parity(i32 %46)
%48 = shl i32 %47, 0
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = and i64 %50, 106995641195921439
%52 = trunc i64 %51 to i32
%53 = call i32 @calc_parity(i32 %52)
%54 = shl i32 %53, 1
%55 = or i32 %48, %54
%56 = load i32, i32* %3
%57 = sext i32 %56 to i64
%58 = and i64 %57, 125504822018802145
%59 = trunc i64 %58 to i32
%60 = call i32 @calc_parity(i32 %59)
%61 = shl i32 %60, 2
%62 = or i32 %55, %61
%63 = load i32, i32* %3
%64 = sext i32 %63 to i64
%65 = and i64 %64, 134806978424245794
%66 = trunc i64 %65 to i32
%67 = call i32 @calc_parity(i32 %66)
%68 = shl i32 %67, 3
%69 = or i32 %62, %68
%70 = load i32, i32* %3
%71 = sext i32 %70 to i64
%72 = and i64 %71, 139460739311678020
%73 = trunc i64 %72 to i32
%74 = call i32 @calc_parity(i32 %73)
%75 = shl i32 %74, 4
%76 = or i32 %69, %75
%77 = load i32, i32* %3
%78 = sext i32 %77 to i64
%79 = and i64 %78, 141787894905984136
%80 = trunc i64 %79 to i32
%81 = call i32 @calc_parity(i32 %80)
%82 = shl i32 %81, 5
%83 = or i32 %76, %82
%84 = load i32, i32* %3
%85 = sext i32 %84 to i64
%86 = and i64 %85, 142951524293962000
%87 = trunc i64 %86 to i32
%88 = call i32 @calc_parity(i32 %87)
%89 = shl i32 %88, 6
%90 = or i32 %83, %89
ret i32 %90
}

LLVM IR (-O2):
define i32 @enc_secded_64_57(i32* nocapture readnone %0) {
%2 = tail call i32 @calc_parity(i32 poison)
%3 = tail call i32 @calc_parity(i32 poison)
%4 = shl i32 %3, 1
%5 = or i32 %4, %2
%6 = tail call i32 @calc_parity(i32 poison)
%7 = shl i32 %6, 2
%8 = or i32 %5, %7
%9 = tail call i32 @calc_parity(i32 poison)
%10 = shl i32 %9, 3
%11 = or i32 %8, %10
%12 = tail call i32 @calc_parity(i32 poison)
%13 = shl i32 %12, 4
%14 = or i32 %11, %13
%15 = tail call i32 @calc_parity(i32 poison)
%16 = shl i32 %15, 5
%17 = or i32 %14, %16
%18 = tail call i32 @calc_parity(i32 poison)
%19 = shl i32 %18, 6
%20 = or i32 %17, %19
ret i32 %20
}