unsigned long long flip_H8(const unsigned long long discs_player,
                           const unsigned long long discs_opponent) {
  unsigned long long my_discs, opp_discs, r, flipped = 0ULL;
  my_discs = discs_player & 0X8040201008040000ULL;
  opp_discs = (discs_opponent & 0X0040201008040200ULL) | 0X7FBFDFEFF7FBFC00ULL;
  r = (opp_discs + 0X0000000000000200ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0040201008040200ULL;
  }
  my_discs = discs_player & 0X0101010101010000ULL;
  opp_discs = (discs_opponent & 0X0001010101010100ULL) | 0X00FEFEFEFEFEFE00ULL;
  r = (opp_discs + 0X0000000000000100ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0001010101010100ULL;
  }
  my_discs = discs_player & 0X00000000000000FCULL;
  r = (discs_opponent + 0X0000000000000002ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X00000000000000FEULL;
  }
  return flipped;
}


x86 assembly (clang, -O0):
<flip_H8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
movabs $0x8040201008040000,%rax
20 40 80
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x40201008040200,%rax
and    -0x10(%rbp),%rax
movabs $0x7fbfdfeff7fbfc00,%rcx
df bf 7f
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x200,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     117f <flip_H8+0x7f>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x40201008040200,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x101010101010000,%rax
01 01 01
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x1010101010100,%rax
and    -0x10(%rbp),%rax
movabs $0xfefefefefefe00,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x100,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11ea <flip_H8+0xea>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x1010101010100,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfc,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1229 <flip_H8+0x129>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
and    $0xfe,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip_H8>:
movabs $0x40201008040200,%r8
mov    %rsi,%r9
lea    0x2(%rsi),%edx
and    %r8,%rsi
movabs $0x7fbfdfeff7fbfe00,%rax
df bf 7f
add    %rsi,%rax
movabs $0x8040201008040000,%rsi
20 40 80
and    %rdi,%rsi
and    %rax,%rsi
lea    -0x1(%rsi),%rcx
and    %r8,%rcx
test   %rsi,%rsi
cmove  %rsi,%rcx
movabs $0x1010101010100,%r8
and    %r8,%r9
movabs $0xfefefefefeff00,%rsi
add    %r9,%rsi
movabs $0x101010101010000,%rax
01 01 01
and    %rdi,%rax
and    %rsi,%rax
lea    -0x1(%rax),%rsi
and    %r8,%rsi
test   %rax,%rax
cmove  %rax,%rsi
and    %edi,%edx
and    $0xfc,%edx
lea    -0x1(%rdx),%eax
and    $0xfe,%eax
test   %rdx,%rdx
cmove  %rdx,%rax
or     %rsi,%rax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @flip_H8(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
store i64 0, i64* %8
%9 = load i64, i64* %3
%10 = and i64 %9, -9205322385119248384
store i64 %10, i64* %5
%11 = load i64, i64* %4
%12 = and i64 %11, 18049651735527936
%13 = or i64 %12, 9205322385119247360
store i64 %13, i64* %6
%14 = load i64, i64* %6
%15 = add i64 %14, 512
%16 = load i64, i64* %5
%17 = and i64 %15, %16
store i64 %17, i64* %7
%18 = load i64, i64* %7
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %2
%21 = load i64, i64* %7
%22 = sub i64 %21, 1
%23 = and i64 %22, 18049651735527936
%24 = load i64, i64* %8
%25 = or i64 %24, %23
store i64 %25, i64* %8
br label %26
26: ; preds = %20, %2
%27 = load i64, i64* %3
%28 = and i64 %27, 72340172838076416
store i64 %28, i64* %5
%29 = load i64, i64* %4
%30 = and i64 %29, 282578800148736
%31 = or i64 %30, 71775015237778944
store i64 %31, i64* %6
%32 = load i64, i64* %6
%33 = add i64 %32, 256
%34 = load i64, i64* %5
%35 = and i64 %33, %34
store i64 %35, i64* %7
%36 = load i64, i64* %7
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %26
%39 = load i64, i64* %7
%40 = sub i64 %39, 1
%41 = and i64 %40, 282578800148736
%42 = load i64, i64* %8
%43 = or i64 %42, %41
store i64 %43, i64* %8
br label %44
44: ; preds = %38, %26
%45 = load i64, i64* %3
%46 = and i64 %45, 252
store i64 %46, i64* %5
%47 = load i64, i64* %4
%48 = add i64 %47, 2
%49 = load i64, i64* %5
%50 = and i64 %48, %49
store i64 %50, i64* %7
%51 = load i64, i64* %7
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %59
53: ; preds = %44
%54 = load i64, i64* %7
%55 = sub i64 %54, 1
%56 = and i64 %55, 254
%57 = load i64, i64* %8
%58 = or i64 %57, %56
store i64 %58, i64* %8
br label %59
59: ; preds = %53, %44
%60 = load i64, i64* %8
ret i64 %60
}

LLVM IR (-O2):
define i64 @flip_H8(i64 %0, i64 %1) {
%3 = and i64 %0, -9205322385119248384
%4 = and i64 %1, 18049651735527936
%5 = add nuw i64 %4, 9205322385119247872
%6 = and i64 %3, %5
%7 = icmp eq i64 %6, 0
%8 = add nuw nsw i64 %6, 36028797018963967
%9 = and i64 %8, 18049651735527936
%10 = select i1 %7, i64 0, i64 %9
%11 = and i64 %0, 72340172838076416
%12 = and i64 %1, 282578800148736
%13 = add nuw nsw i64 %12, 71775015237779200
%14 = and i64 %11, %13
%15 = icmp eq i64 %14, 0
%16 = add nuw nsw i64 %14, 562949953421311
%17 = and i64 %16, 282578800148736
%18 = select i1 %15, i64 0, i64 %17
%19 = and i64 %0, 252
%20 = add i64 %1, 2
%21 = and i64 %19, %20
%22 = icmp eq i64 %21, 0
%23 = add nuw nsw i64 %21, 255
%24 = and i64 %23, 254
%25 = select i1 %22, i64 0, i64 %24
%26 = or i64 %18, %25
%27 = or i64 %26, %10
ret i64 %27
}