unsigned long long flip_H7(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 & 0X4020100804000000ULL;
  opp_discs = (discs_opponent & 0X0020100804020000ULL) | 0X3FDFEFF7FBFC0000ULL;
  r = (opp_discs + 0X0000000000020000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0020100804020000ULL;
  }
  my_discs = discs_player & 0X0101010101000000ULL;
  opp_discs = (discs_opponent & 0X0001010101010000ULL) | 0X00FEFEFEFEFE0000ULL;
  r = (opp_discs + 0X0000000000010000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0001010101010000ULL;
  }
  my_discs = discs_player & 0X000000000000FC00ULL;
  r = (discs_opponent + 0X0000000000000200ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X000000000000FE00ULL;
  }
  return flipped;
}


x86 assembly (clang, -O0):
<flip_H7>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
movabs $0x4020100804000000,%rax
10 20 40
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x20100804020000,%rax
and    -0x10(%rbp),%rax
movabs $0x3fdfeff7fbfc0000,%rcx
ef df 3f
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20000,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     117f <flip_H7+0x7f>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x20100804020000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x101010101000000,%rax
01 01 01
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x1010101010000,%rax
and    -0x10(%rbp),%rax
movabs $0xfefefefefe0000,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x10000,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11ea <flip_H7+0xea>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x1010101010000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfc00,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x200,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     122b <flip_H7+0x12b>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
and    $0xfe00,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip_H7>:
movabs $0x20100804020000,%r8
mov    %rsi,%r9
lea    0x200(%rsi),%edx
and    %r8,%rsi
movabs $0x3fdfeff7fbfe0000,%rax
ef df 3f
add    %rsi,%rax
movabs $0x4020100804000000,%rsi
10 20 40
and    %rdi,%rsi
and    %rax,%rsi
lea    -0x1(%rsi),%rcx
and    %r8,%rcx
test   %rsi,%rsi
cmove  %rsi,%rcx
movabs $0x1010101010000,%r8
and    %r8,%r9
movabs $0xfefefefeff0000,%rsi
add    %r9,%rsi
movabs $0x101010101000000,%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    $0xfc00,%edx
lea    -0x1(%rdx),%eax
and    $0xfe00,%eax
test   %rdx,%rdx
cmove  %rdx,%rax
or     %rsi,%rax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @flip_H7(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, 4620710844295020544
store i64 %10, i64* %5
%11 = load i64, i64* %4
%12 = and i64 %11, 9024825867763712
%13 = or i64 %12, 4602661192559493120
store i64 %13, i64* %6
%14 = load i64, i64* %6
%15 = add i64 %14, 131072
%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, 9024825867763712
%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, 72340172838010880
store i64 %28, i64* %5
%29 = load i64, i64* %4
%30 = and i64 %29, 282578800148480
%31 = or i64 %30, 71775015237713920
store i64 %31, i64* %6
%32 = load i64, i64* %6
%33 = add i64 %32, 65536
%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, 282578800148480
%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, 64512
store i64 %46, i64* %5
%47 = load i64, i64* %4
%48 = add i64 %47, 512
%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, 65024
%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_H7(i64 %0, i64 %1) {
%3 = and i64 %0, 4620710844295020544
%4 = and i64 %1, 9024825867763712
%5 = add nuw nsw i64 %4, 4602661192559624192
%6 = and i64 %3, %5
%7 = icmp eq i64 %6, 0
%8 = add nuw nsw i64 %6, 18014398509481983
%9 = and i64 %8, 9024825867763712
%10 = select i1 %7, i64 0, i64 %9
%11 = and i64 %0, 72340172838010880
%12 = and i64 %1, 282578800148480
%13 = add nuw nsw i64 %12, 71775015237779456
%14 = and i64 %11, %13
%15 = icmp eq i64 %14, 0
%16 = add nuw nsw i64 %14, 562949953421311
%17 = and i64 %16, 282578800148480
%18 = select i1 %15, i64 0, i64 %17
%19 = and i64 %0, 64512
%20 = add i64 %1, 512
%21 = and i64 %19, %20
%22 = icmp eq i64 %21, 0
%23 = add nuw nsw i64 %21, 65535
%24 = and i64 %23, 65024
%25 = select i1 %22, i64 0, i64 %24
%26 = or i64 %18, %25
%27 = or i64 %26, %10
ret i64 %27
}