#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_C4(const unsigned long long discs_player,
                           const unsigned long long discs_opponent) {
  unsigned long long my_discs, opp_discs, r;
  unsigned long long flipped =
      (discs_opponent & 0X0000400000000000ULL) & (discs_player >> 9);
  flipped |= (discs_opponent & 0X0000000040000000ULL) & (discs_player << 7);
  flipped |= (discs_opponent & 0X0000004000000000ULL) & (discs_player >> 1);
  my_discs = discs_player & 0X0000000000080402ULL;
  opp_discs = (discs_opponent & 0X0000000010080400ULL) | 0X0000001FEFF7F800ULL;
  r = ((my_discs << 9) + opp_discs) & 0X0000002000000000ULL;
  if (r != 0) {
    flipped |= (0X0000002000000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000010080400ULL;
  }
  my_discs = discs_player & 0X0000000000202020ULL;
  opp_discs = (discs_opponent & 0X0000000020202000ULL) | 0X0000001FDFDFC000ULL;
  r = ((my_discs << 8) + opp_discs) & 0X0000002000000000ULL;
  if (r != 0) {
    flipped |= (0X0000002000000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000020202000ULL;
  }
  my_discs = discs_player & 0X0000000F00000000ULL;
  r = ((my_discs << 1) + discs_opponent) & 0X0000002000000000ULL;
  if (r != 0) {
    flipped |= 0X0000002000000000ULL - (0X2ULL << last_bit(my_discs));
  }
  my_discs = discs_player & 0X0408000000000000ULL;
  opp_discs = (discs_opponent & 0X0008100000000000ULL) | 0X03F7E00000000000ULL;
  r = (opp_discs + 0X0000100000000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0008100000000000ULL;
  }
  my_discs = discs_player & 0X2020000000000000ULL;
  opp_discs = (discs_opponent & 0X0020200000000000ULL) | 0X1FDFC00000000000ULL;
  r = (opp_discs + 0X0000200000000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0020200000000000ULL;
  }
  return flipped;
}


x86 assembly (clang, -O0):
<flip_C4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x400000000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x9,%rcx
and    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
and    $0x40000000,%rax
mov    -0x8(%rbp),%rcx
shl    $0x7,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x4000000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x1,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x80402,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x10080400,%rax
movabs $0x1feff7f800,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x9,%rax
add    -0x20(%rbp),%rax
movabs $0x2000000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11ff <flip_C4+0xef>
mov    -0x18(%rbp),%rdi
call   1030 <last_bit@plt>
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x2,%eax
shl    %cl,%rax
mov    %rax,%rcx
movabs $0x2000000000,%rax
sub    %rcx,%rax
and    $0x10080400,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x202020,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x20202000,%rax
movabs $0x1fdfdfc000,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
add    -0x20(%rbp),%rax
movabs $0x2000000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1283 <flip_C4+0x173>
mov    -0x18(%rbp),%rdi
call   1030 <last_bit@plt>
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x2,%eax
shl    %cl,%rax
mov    %rax,%rcx
movabs $0x2000000000,%rax
sub    %rcx,%rax
and    $0x20202000,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0xf00000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x1,%rax
add    -0x10(%rbp),%rax
movabs $0x2000000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12ea <flip_C4+0x1da>
mov    -0x18(%rbp),%rdi
call   1030 <last_bit@plt>
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x2,%eax
shl    %cl,%rax
mov    %rax,%rcx
movabs $0x2000000000,%rax
sub    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x408000000000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x8100000000000,%rax
and    -0x10(%rbp),%rax
movabs $0x3f7e00000000000,%rcx
e0 f7 03
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x100000000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1359 <flip_C4+0x249>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x8100000000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x2020000000000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x20200000000000,%rax
and    -0x10(%rbp),%rax
movabs $0x1fdfc00000000000,%rcx
c0 df 1f
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x200000000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     13c8 <flip_C4+0x2b8>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x20200000000000,%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_C4>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movabs $0x2000000000,%r12
mov    %rdi,%rax
shr    $0x9,%rax
and    %rsi,%rax
movabs $0x400000000000,%rcx
and    %rax,%rcx
mov    %r14d,%eax
shl    $0x7,%eax
and    %ebx,%eax
and    $0x40000000,%eax
or     %rcx,%rax
mov    %rdi,%rcx
shr    %rcx
and    %rsi,%rcx
movabs $0x4000000000,%r15
and    %rcx,%r15
or     %rax,%r15
and    $0x80402,%edi
mov    %ebx,%eax
and    $0x10080400,%eax
or     %r12,%rax
mov    %rdi,%rcx
shl    $0x9,%rcx
add    %rcx,%rax
add    $0xffffffffeff7f800,%rax
bt     $0x25,%rax
jae    11a9 <flip_C4+0x99>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x10080400,%edx
or     %rdx,%r15
mov    %r14d,%edi
and    $0x202020,%edi
mov    %ebx,%eax
and    $0x20202000,%eax
lea    -0x20204000(%r12),%rcx
df
or     %rax,%rcx
mov    %rdi,%rax
shl    $0x8,%rax
add    %rcx,%rax
test   %r12,%rax
je     11ed <flip_C4+0xdd>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x20202000,%edx
or     %rdx,%r15
movabs $0xf00000000,%rdi
and    %r14,%rdi
lea    (%rbx,%rdi,2),%rax
test   %r12,%rax
je     121a <flip_C4+0x10a>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
add    %r12,%rdx
or     %rdx,%r15
movabs $0x8100000000000,%rax
mov    %rbx,%rcx
and    %rax,%rcx
movabs $0x3f7f00000000000,%rdx
f0 f7 03
add    %rcx,%rdx
and    %r14,%rdx
movabs $0x408000000000000,%rcx
and    %rdx,%rcx
lea    -0x1(%rcx),%rdx
and    %rax,%rdx
test   %rcx,%rcx
cmove  %rcx,%rdx
movabs $0x20200000000000,%rcx
and    %rcx,%rbx
movabs $0x1fdfe00000000000,%rax
e0 df 1f
add    %rbx,%rax
and    %r14,%rax
movabs $0x2020000000000000,%rsi
and    %rax,%rsi
lea    -0x1(%rsi),%rax
and    %rcx,%rax
test   %rsi,%rsi
cmove  %rsi,%rax
or     %rdx,%rax
or     %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @flip_C4(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
%9 = load i64, i64* %4
%10 = and i64 %9, 70368744177664
%11 = load i64, i64* %3
%12 = lshr i64 %11, 9
%13 = and i64 %10, %12
store i64 %13, i64* %8
%14 = load i64, i64* %4
%15 = and i64 %14, 1073741824
%16 = load i64, i64* %3
%17 = shl i64 %16, 7
%18 = and i64 %15, %17
%19 = load i64, i64* %8
%20 = or i64 %19, %18
store i64 %20, i64* %8
%21 = load i64, i64* %4
%22 = and i64 %21, 274877906944
%23 = load i64, i64* %3
%24 = lshr i64 %23, 1
%25 = and i64 %22, %24
%26 = load i64, i64* %8
%27 = or i64 %26, %25
store i64 %27, i64* %8
%28 = load i64, i64* %3
%29 = and i64 %28, 525314
store i64 %29, i64* %5
%30 = load i64, i64* %4
%31 = and i64 %30, 268960768
%32 = or i64 %31, 137169991680
store i64 %32, i64* %6
%33 = load i64, i64* %5
%34 = shl i64 %33, 9
%35 = load i64, i64* %6
%36 = add i64 %34, %35
%37 = and i64 %36, 137438953472
store i64 %37, i64* %7
%38 = load i64, i64* %7
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %49
40: ; preds = %2
%41 = load i64, i64* %5
%42 = call i32 @last_bit(i64 %41)
%43 = zext i32 %42 to i64
%44 = shl i64 2, %43
%45 = sub i64 137438953472, %44
%46 = and i64 %45, 268960768
%47 = load i64, i64* %8
%48 = or i64 %47, %46
store i64 %48, i64* %8
br label %49
49: ; preds = %40, %2
%50 = load i64, i64* %3
%51 = and i64 %50, 2105376
store i64 %51, i64* %5
%52 = load i64, i64* %4
%53 = and i64 %52, 538976256
%54 = or i64 %53, 136899969024
store i64 %54, i64* %6
%55 = load i64, i64* %5
%56 = shl i64 %55, 8
%57 = load i64, i64* %6
%58 = add i64 %56, %57
%59 = and i64 %58, 137438953472
store i64 %59, i64* %7
%60 = load i64, i64* %7
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %71
62: ; preds = %49
%63 = load i64, i64* %5
%64 = call i32 @last_bit(i64 %63)
%65 = zext i32 %64 to i64
%66 = shl i64 2, %65
%67 = sub i64 137438953472, %66
%68 = and i64 %67, 538976256
%69 = load i64, i64* %8
%70 = or i64 %69, %68
store i64 %70, i64* %8
br label %71
71: ; preds = %62, %49
%72 = load i64, i64* %3
%73 = and i64 %72, 64424509440
store i64 %73, i64* %5
%74 = load i64, i64* %5
%75 = shl i64 %74, 1
%76 = load i64, i64* %4
%77 = add i64 %75, %76
%78 = and i64 %77, 137438953472
store i64 %78, i64* %7
%79 = load i64, i64* %7
%80 = icmp ne i64 %79, 0
br i1 %80, label %81, label %89
81: ; preds = %71
%82 = load i64, i64* %5
%83 = call i32 @last_bit(i64 %82)
%84 = zext i32 %83 to i64
%85 = shl i64 2, %84
%86 = sub i64 137438953472, %85
%87 = load i64, i64* %8
%88 = or i64 %87, %86
store i64 %88, i64* %8
br label %89
89: ; preds = %81, %71
%90 = load i64, i64* %3
%91 = and i64 %90, 290482175965396992
store i64 %91, i64* %5
%92 = load i64, i64* %4
%93 = and i64 %92, 2269391999729664
%94 = or i64 %93, 285943391965937664
store i64 %94, i64* %6
%95 = load i64, i64* %6
%96 = add i64 %95, 17592186044416
%97 = load i64, i64* %5
%98 = and i64 %96, %97
store i64 %98, i64* %7
%99 = load i64, i64* %7
%100 = icmp ne i64 %99, 0
br i1 %100, label %101, label %107
101: ; preds = %89
%102 = load i64, i64* %7
%103 = sub i64 %102, 1
%104 = and i64 %103, 2269391999729664
%105 = load i64, i64* %8
%106 = or i64 %105, %104
store i64 %106, i64* %8
br label %107
107: ; preds = %101, %89
%108 = load i64, i64* %3
%109 = and i64 %108, 2314850208468434944
store i64 %109, i64* %5
%110 = load i64, i64* %4
%111 = and i64 %110, 9042383626829824
%112 = or i64 %111, 2296765441214775296
store i64 %112, i64* %6
%113 = load i64, i64* %6
%114 = add i64 %113, 35184372088832
%115 = load i64, i64* %5
%116 = and i64 %114, %115
store i64 %116, i64* %7
%117 = load i64, i64* %7
%118 = icmp ne i64 %117, 0
br i1 %118, label %119, label %125
119: ; preds = %107
%120 = load i64, i64* %7
%121 = sub i64 %120, 1
%122 = and i64 %121, 9042383626829824
%123 = load i64, i64* %8
%124 = or i64 %123, %122
store i64 %124, i64* %8
br label %125
125: ; preds = %119, %107
%126 = load i64, i64* %8
ret i64 %126
}

LLVM IR (-O2):
define i64 @flip_C4(i64 %0, i64 %1) {
%3 = and i64 %1, 70368744177664
%4 = lshr i64 %0, 9
%5 = and i64 %3, %4
%6 = and i64 %1, 1073741824
%7 = shl i64 %0, 7
%8 = and i64 %6, %7
%9 = or i64 %5, %8
%10 = and i64 %1, 274877906944
%11 = lshr i64 %0, 1
%12 = and i64 %10, %11
%13 = or i64 %9, %12
%14 = and i64 %0, 525314
%15 = and i64 %1, 268960768
%16 = or i64 %15, 137169991680
%17 = shl nuw nsw i64 %14, 9
%18 = add nuw nsw i64 %16, %17
%19 = and i64 %18, 137438953472
%20 = icmp eq i64 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %2
%22 = tail call i32 @last_bit(i64 %14)
%23 = zext i32 %22 to i64
%24 = shl i64 -2, %23
%25 = and i64 %24, 268960768
%26 = or i64 %25, %13
br label %27
27: ; preds = %21, %2
%28 = phi i64 [ %26, %21 ], [ %13, %2 ]
%29 = and i64 %0, 2105376
%30 = and i64 %1, 538976256
%31 = or i64 %30, 136899969024
%32 = shl nuw nsw i64 %29, 8
%33 = add nuw nsw i64 %31, %32
%34 = and i64 %33, 137438953472
%35 = icmp eq i64 %34, 0
br i1 %35, label %42, label %36
36: ; preds = %27
%37 = tail call i32 @last_bit(i64 %29)
%38 = zext i32 %37 to i64
%39 = shl i64 -2, %38
%40 = and i64 %39, 538976256
%41 = or i64 %40, %28
br label %42
42: ; preds = %36, %27
%43 = phi i64 [ %41, %36 ], [ %28, %27 ]
%44 = and i64 %0, 64424509440
%45 = shl nuw nsw i64 %44, 1
%46 = add i64 %45, %1
%47 = and i64 %46, 137438953472
%48 = icmp eq i64 %47, 0
br i1 %48, label %55, label %49
49: ; preds = %42
%50 = tail call i32 @last_bit(i64 %44)
%51 = zext i32 %50 to i64
%52 = shl i64 -2, %51
%53 = add i64 %52, 137438953472
%54 = or i64 %53, %43
br label %55
55: ; preds = %49, %42
%56 = phi i64 [ %54, %49 ], [ %43, %42 ]
%57 = and i64 %0, 290482175965396992
%58 = and i64 %1, 2269391999729664
%59 = add nuw nsw i64 %58, 285960984151982080
%60 = and i64 %57, %59
%61 = icmp eq i64 %60, 0
%62 = add nuw nsw i64 %60, 4503599627370495
%63 = and i64 %62, 2269391999729664
%64 = select i1 %61, i64 0, i64 %63
%65 = and i64 %0, 2314850208468434944
%66 = and i64 %1, 9042383626829824
%67 = add nuw nsw i64 %66, 2296800625586864128
%68 = and i64 %65, %67
%69 = icmp eq i64 %68, 0
%70 = add nuw nsw i64 %68, 18014398509481983
%71 = and i64 %70, 9042383626829824
%72 = select i1 %69, i64 0, i64 %71
%73 = or i64 %72, %64
%74 = or i64 %73, %56
ret i64 %74
}