#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 */

/* Variables and functions */
int last_bit(unsigned long long);
unsigned long long flip_H5(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 & 0X00000000FC000000ULL;
  r = (discs_opponent + 0X0000000002000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X00000000FE000000ULL;
  }
  my_discs = discs_player & 0X0000000000000408ULL;
  opp_discs = (discs_opponent & 0X0000000000020400ULL) | 0X0000000000FDF800ULL;
  r = ((my_discs << 7) + opp_discs) & 0X0000000001000000ULL;
  if (r != 0) {
    flipped |= (0X0000000001000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000000020400ULL;
  }
  my_discs = discs_player & 0X1008040000000000ULL;
  opp_discs = (discs_opponent & 0X0008040200000000ULL) | 0X0FF7FBFC00000000ULL;
  r = (opp_discs + 0X0000000200000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0008040200000000ULL;
  }
  my_discs = discs_player & 0X0000000000000101ULL;
  opp_discs = (discs_opponent & 0X0000000000010100ULL) | 0X0000000000FEFE00ULL;
  r = ((my_discs << 8) + opp_discs) & 0X0000000001000000ULL;
  if (r != 0) {
    flipped |= (0X0000000001000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000000010100ULL;
  }
  my_discs = discs_player & 0X0101010000000000ULL;
  opp_discs = (discs_opponent & 0X0001010100000000ULL) | 0X00FEFEFE00000000ULL;
  r = (opp_discs + 0X0000000100000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0001010100000000ULL;
  }
  return flipped;
}


x86 assembly (clang, -O0):
<flip_H5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
movabs $0xfc000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2000000,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1174 <flip_H5+0x64>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0xfe000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x408,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x20400,%rax
or     $0xfdf800,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x7,%rax
add    -0x20(%rbp),%rax
and    $0x1000000,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11e5 <flip_H5+0xd5>
mov    -0x18(%rbp),%rdi
call   1030 <last_bit@plt>
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x2,%eax
shl    %cl,%rax
mov    %rax,%rcx
mov    $0x1000000,%eax
sub    %rcx,%rax
and    $0x20400,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x1008040000000000,%rax
04 08 10
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x8040200000000,%rax
and    -0x10(%rbp),%rax
movabs $0xff7fbfc00000000,%rcx
fb f7 0f
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x200000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1254 <flip_H5+0x144>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x8040200000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x101,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x10100,%rax
or     $0xfefe00,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
add    -0x20(%rbp),%rax
and    $0x1000000,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12c5 <flip_H5+0x1b5>
mov    -0x18(%rbp),%rdi
call   1030 <last_bit@plt>
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x2,%eax
shl    %cl,%rax
mov    %rax,%rcx
mov    $0x1000000,%eax
sub    %rcx,%rax
and    $0x10100,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x101010000000000,%rax
01 01 01
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x1010100000000,%rax
and    -0x10(%rbp),%rax
movabs $0xfefefe00000000,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x100000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1334 <flip_H5+0x224>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x1010100000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip_H5>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x2000000(%rsi),%eax
and    %r14d,%eax
and    $0xfc000000,%eax
lea    -0x1(%rax),%r12d
and    $0xfe000000,%r12d
test   %rax,%rax
cmove  %rax,%r12
and    $0x408,%edi
mov    %r15d,%eax
and    $0x20400,%eax
mov    %edi,%ecx
shl    $0x7,%ecx
add    %ecx,%eax
add    $0xfdf800,%eax
test   $0x1000000,%eax
je     1179 <flip_H5+0x69>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x20400,%edx
or     %rdx,%r12
movabs $0x8040200000000,%rax
mov    %r15,%rcx
and    %rax,%rcx
movabs $0xff7fbfe00000000,%rdx
fb f7 0f
add    %rcx,%rdx
and    %r14,%rdx
movabs $0x1008040000000000,%rcx
04 08 10
and    %rdx,%rcx
lea    -0x1(%rcx),%rbx
and    %rax,%rbx
test   %rcx,%rcx
cmove  %rcx,%rbx
or     %r12,%rbx
mov    %r14d,%edi
and    $0x101,%edi
mov    %r15d,%eax
and    $0x10100,%eax
mov    %edi,%ecx
shl    $0x8,%ecx
add    %ecx,%eax
add    $0xfefe00,%eax
test   $0x1000000,%eax
je     11f5 <flip_H5+0xe5>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x10100,%edx
or     %rdx,%rbx
movabs $0x1010100000000,%rcx
and    %rcx,%r15
movabs $0xfefeff00000000,%rax
add    %r15,%rax
and    %rax,%r14
movabs $0x101010000000000,%rdx
01 01 01
and    %r14,%rdx
lea    -0x1(%rdx),%rax
and    %rcx,%rax
test   %rdx,%rdx
cmove  %rdx,%rax
or     %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @flip_H5(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, 4227858432
store i64 %10, i64* %5
%11 = load i64, i64* %4
%12 = add i64 %11, 33554432
%13 = load i64, i64* %5
%14 = and i64 %12, %13
store i64 %14, i64* %7
%15 = load i64, i64* %7
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i64, i64* %7
%19 = sub i64 %18, 1
%20 = and i64 %19, 4261412864
%21 = load i64, i64* %8
%22 = or i64 %21, %20
store i64 %22, i64* %8
br label %23
23: ; preds = %17, %2
%24 = load i64, i64* %3
%25 = and i64 %24, 1032
store i64 %25, i64* %5
%26 = load i64, i64* %4
%27 = and i64 %26, 132096
%28 = or i64 %27, 16644096
store i64 %28, i64* %6
%29 = load i64, i64* %5
%30 = shl i64 %29, 7
%31 = load i64, i64* %6
%32 = add i64 %30, %31
%33 = and i64 %32, 16777216
store i64 %33, i64* %7
%34 = load i64, i64* %7
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %45
36: ; preds = %23
%37 = load i64, i64* %5
%38 = call i32 @last_bit(i64 %37)
%39 = zext i32 %38 to i64
%40 = shl i64 2, %39
%41 = sub i64 16777216, %40
%42 = and i64 %41, 132096
%43 = load i64, i64* %8
%44 = or i64 %43, %42
store i64 %44, i64* %8
br label %45
45: ; preds = %36, %23
%46 = load i64, i64* %3
%47 = and i64 %46, 1155177702467043328
store i64 %47, i64* %5
%48 = load i64, i64* %4
%49 = and i64 %48, 2256206450130944
%50 = or i64 %49, 1150665289566781440
store i64 %50, i64* %6
%51 = load i64, i64* %6
%52 = add i64 %51, 8589934592
%53 = load i64, i64* %5
%54 = and i64 %52, %53
store i64 %54, i64* %7
%55 = load i64, i64* %7
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %45
%58 = load i64, i64* %7
%59 = sub i64 %58, 1
%60 = and i64 %59, 2256206450130944
%61 = load i64, i64* %8
%62 = or i64 %61, %60
store i64 %62, i64* %8
br label %63
63: ; preds = %57, %45
%64 = load i64, i64* %3
%65 = and i64 %64, 257
store i64 %65, i64* %5
%66 = load i64, i64* %4
%67 = and i64 %66, 65792
%68 = or i64 %67, 16711168
store i64 %68, i64* %6
%69 = load i64, i64* %5
%70 = shl i64 %69, 8
%71 = load i64, i64* %6
%72 = add i64 %70, %71
%73 = and i64 %72, 16777216
store i64 %73, i64* %7
%74 = load i64, i64* %7
%75 = icmp ne i64 %74, 0
br i1 %75, label %76, label %85
76: ; preds = %63
%77 = load i64, i64* %5
%78 = call i32 @last_bit(i64 %77)
%79 = zext i32 %78 to i64
%80 = shl i64 2, %79
%81 = sub i64 16777216, %80
%82 = and i64 %81, 65792
%83 = load i64, i64* %8
%84 = or i64 %83, %82
store i64 %84, i64* %8
br label %85
85: ; preds = %76, %63
%86 = load i64, i64* %3
%87 = and i64 %86, 72340168526266368
store i64 %87, i64* %5
%88 = load i64, i64* %4
%89 = and i64 %88, 282578783305728
%90 = or i64 %89, 71775010959654912
store i64 %90, i64* %6
%91 = load i64, i64* %6
%92 = add i64 %91, 4294967296
%93 = load i64, i64* %5
%94 = and i64 %92, %93
store i64 %94, i64* %7
%95 = load i64, i64* %7
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %103
97: ; preds = %85
%98 = load i64, i64* %7
%99 = sub i64 %98, 1
%100 = and i64 %99, 282578783305728
%101 = load i64, i64* %8
%102 = or i64 %101, %100
store i64 %102, i64* %8
br label %103
103: ; preds = %97, %85
%104 = load i64, i64* %8
ret i64 %104
}

LLVM IR (-O2):
define i64 @flip_H5(i64 %0, i64 %1) {
%3 = and i64 %0, 4227858432
%4 = add i64 %1, 33554432
%5 = and i64 %3, %4
%6 = icmp eq i64 %5, 0
%7 = add nuw nsw i64 %5, 4294967295
%8 = and i64 %7, 4261412864
%9 = select i1 %6, i64 0, i64 %8
%10 = and i64 %0, 1032
%11 = and i64 %1, 132096
%12 = or i64 %11, 16644096
%13 = shl nuw nsw i64 %10, 7
%14 = add nuw nsw i64 %12, %13
%15 = and i64 %14, 16777216
%16 = icmp eq i64 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %2
%18 = tail call i32 @last_bit(i64 %10)
%19 = zext i32 %18 to i64
%20 = shl i64 -2, %19
%21 = and i64 %20, 132096
%22 = or i64 %21, %9
br label %23
23: ; preds = %17, %2
%24 = phi i64 [ %22, %17 ], [ %9, %2 ]
%25 = and i64 %0, 1155177702467043328
%26 = and i64 %1, 2256206450130944
%27 = add nuw nsw i64 %26, 1150665298156716032
%28 = and i64 %25, %27
%29 = icmp eq i64 %28, 0
%30 = add nuw nsw i64 %28, 4503599627370495
%31 = and i64 %30, 2256206450130944
%32 = select i1 %29, i64 0, i64 %31
%33 = or i64 %24, %32
%34 = and i64 %0, 257
%35 = and i64 %1, 65792
%36 = or i64 %35, 16711168
%37 = shl nuw nsw i64 %34, 8
%38 = add nuw nsw i64 %36, %37
%39 = and i64 %38, 16777216
%40 = icmp eq i64 %39, 0
br i1 %40, label %47, label %41
41: ; preds = %23
%42 = tail call i32 @last_bit(i64 %34)
%43 = zext i32 %42 to i64
%44 = shl i64 -2, %43
%45 = and i64 %44, 65792
%46 = or i64 %45, %33
br label %47
47: ; preds = %41, %23
%48 = phi i64 [ %46, %41 ], [ %33, %23 ]
%49 = and i64 %0, 72340168526266368
%50 = and i64 %1, 282578783305728
%51 = add nuw nsw i64 %50, 71775015254622208
%52 = and i64 %49, %51
%53 = icmp eq i64 %52, 0
%54 = add nuw nsw i64 %52, 562949953421311
%55 = and i64 %54, 282578783305728
%56 = select i1 %53, i64 0, i64 %55
%57 = or i64 %48, %56
ret i64 %57
}