#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_C5(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 & 0X0000004000000000ULL) & (discs_player >> 9);
  flipped |= (discs_opponent & 0X0000000000400000ULL) & (discs_player << 7);
  flipped |= (discs_opponent & 0X0000000040000000ULL) & (discs_player >> 1);
  my_discs = discs_player & 0X0000000000000804ULL;
  opp_discs = (discs_opponent & 0X0000000000100800ULL) | 0X000000001FEFF000ULL;
  r = ((my_discs << 9) + opp_discs) & 0X0000000020000000ULL;
  if (r != 0) {
    flipped |= (0X0000000020000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000000100800ULL;
  }
  my_discs = discs_player & 0X0000000000002020ULL;
  opp_discs = (discs_opponent & 0X0000000000202000ULL) | 0X000000001FDFC000ULL;
  r = ((my_discs << 8) + opp_discs) & 0X0000000020000000ULL;
  if (r != 0) {
    flipped |= (0X0000000020000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000000202000ULL;
  }
  my_discs = discs_player & 0X000000000F000000ULL;
  r = ((my_discs << 1) + discs_opponent) & 0X0000000020000000ULL;
  if (r != 0) {
    flipped |= 0X0000000020000000ULL - (0X2ULL << last_bit(my_discs));
  }
  my_discs = discs_player & 0X0204080000000000ULL;
  opp_discs = (discs_opponent & 0X0004081000000000ULL) | 0X01FBF7E000000000ULL;
  r = (opp_discs + 0X0000001000000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0004081000000000ULL;
  }
  my_discs = discs_player & 0X2020200000000000ULL;
  opp_discs = (discs_opponent & 0X0020202000000000ULL) | 0X1FDFDFC000000000ULL;
  r = (opp_discs + 0X0000002000000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0020202000000000ULL;
  }
  return flipped;
}


x86 assembly (clang, -O0):
<flip_C5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x4000000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x9,%rcx
and    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
and    $0x400000,%rax
mov    -0x8(%rbp),%rcx
shl    $0x7,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
and    $0x40000000,%rax
mov    -0x8(%rbp),%rcx
shr    $0x1,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x804,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x100800,%rax
or     $0x1feff000,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x9,%rax
add    -0x20(%rbp),%rax
and    $0x20000000,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11e8 <flip_C5+0xd8>
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    $0x20000000,%eax
sub    %rcx,%rax
and    $0x100800,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x2020,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x202000,%rax
or     $0x1fdfc000,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
add    -0x20(%rbp),%rax
and    $0x20000000,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1259 <flip_C5+0x149>
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    $0x20000000,%eax
sub    %rcx,%rax
and    $0x202000,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0xf000000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x1,%rax
add    -0x10(%rbp),%rax
and    $0x20000000,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12b0 <flip_C5+0x1a0>
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    $0x20000000,%eax
sub    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x204080000000000,%rax
08 04 02
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x4081000000000,%rax
and    -0x10(%rbp),%rax
movabs $0x1fbf7e000000000,%rcx
f7 fb 01
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x1000000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     131f <flip_C5+0x20f>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x4081000000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x2020200000000000,%rax
20 20 20
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x20202000000000,%rax
and    -0x10(%rbp),%rax
movabs $0x1fdfdfc000000000,%rcx
df df 1f
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x2000000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     138e <flip_C5+0x27e>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x20202000000000,%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_C5>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rdi,%rax
shr    $0x9,%rax
and    %rsi,%rax
movabs $0x4000000000,%rcx
and    %rax,%rcx
mov    %r14d,%eax
shl    $0x7,%eax
and    %r15d,%eax
and    $0x400000,%eax
or     %rcx,%rax
mov    %r14d,%ebx
shr    %ebx
and    %r15d,%ebx
and    $0x40000000,%ebx
or     %rax,%rbx
and    $0x804,%edi
mov    %r15d,%eax
and    $0x100800,%eax
mov    %edi,%ecx
shl    $0x9,%ecx
add    %ecx,%eax
add    $0x1feff000,%eax
test   $0x20000000,%eax
je     118f <flip_C5+0x7f>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x100800,%edx
or     %rdx,%rbx
mov    %r14d,%edi
and    $0x2020,%edi
mov    %r15d,%eax
and    $0x202000,%eax
mov    %edi,%ecx
shl    $0x8,%ecx
add    %ecx,%eax
add    $0x1fdfc000,%eax
test   $0x20000000,%eax
je     11cd <flip_C5+0xbd>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x202000,%edx
or     %rdx,%rbx
mov    %r14d,%edi
and    $0xf000000,%edi
lea    (%r15,%rdi,2),%eax
test   $0x20000000,%eax
je     11fc <flip_C5+0xec>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
add    $0x20000000,%rdx
or     %rdx,%rbx
movabs $0x4081000000000,%rax
mov    %r15,%rcx
and    %rax,%rcx
movabs $0x1fbf7f000000000,%rdx
f7 fb 01
add    %rcx,%rdx
and    %r14,%rdx
movabs $0x204080000000000,%rcx
08 04 02
and    %rdx,%rcx
lea    -0x1(%rcx),%rdx
and    %rax,%rdx
test   %rcx,%rcx
cmove  %rcx,%rdx
movabs $0x20202000000000,%rcx
and    %rcx,%r15
movabs $0x1fdfdfe000000000,%rax
df df 1f
add    %r15,%rax
and    %r14,%rax
movabs $0x2020200000000000,%rsi
20 20 20
and    %rax,%rsi
lea    -0x1(%rsi),%rax
and    %rcx,%rax
test   %rsi,%rsi
cmove  %rsi,%rax
or     %rdx,%rax
or     %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @flip_C5(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, 274877906944
%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, 4194304
%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, 1073741824
%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, 2052
store i64 %29, i64* %5
%30 = load i64, i64* %4
%31 = and i64 %30, 1050624
%32 = or i64 %31, 535818240
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, 536870912
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 536870912, %44
%46 = and i64 %45, 1050624
%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, 8224
store i64 %51, i64* %5
%52 = load i64, i64* %4
%53 = and i64 %52, 2105344
%54 = or i64 %53, 534757376
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, 536870912
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 536870912, %66
%68 = and i64 %67, 2105344
%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, 251658240
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, 536870912
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 536870912, %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, 145249884075720704
store i64 %91, i64* %5
%92 = load i64, i64* %4
%93 = and i64 %92, 1134764719341568
%94 = or i64 %93, 142980354637037568
store i64 %94, i64* %6
%95 = load i64, i64* %6
%96 = add i64 %95, 68719476736
%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, 1134764719341568
%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, 2314885392840523776
store i64 %109, i64* %5
%110 = load i64, i64* %4
%111 = and i64 %110, 9042521065783296
%112 = or i64 %111, 2296800350708957184
store i64 %112, i64* %6
%113 = load i64, i64* %6
%114 = add i64 %113, 137438953472
%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, 9042521065783296
%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_C5(i64 %0, i64 %1) {
%3 = and i64 %1, 274877906944
%4 = lshr i64 %0, 9
%5 = and i64 %3, %4
%6 = and i64 %1, 4194304
%7 = shl i64 %0, 7
%8 = and i64 %6, %7
%9 = or i64 %5, %8
%10 = and i64 %1, 1073741824
%11 = lshr i64 %0, 1
%12 = and i64 %10, %11
%13 = or i64 %9, %12
%14 = and i64 %0, 2052
%15 = and i64 %1, 1050624
%16 = or i64 %15, 535818240
%17 = shl nuw nsw i64 %14, 9
%18 = add nuw nsw i64 %16, %17
%19 = and i64 %18, 536870912
%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, 1050624
%26 = or i64 %25, %13
br label %27
27: ; preds = %21, %2
%28 = phi i64 [ %26, %21 ], [ %13, %2 ]
%29 = and i64 %0, 8224
%30 = and i64 %1, 2105344
%31 = or i64 %30, 534757376
%32 = shl nuw nsw i64 %29, 8
%33 = add nuw nsw i64 %31, %32
%34 = and i64 %33, 536870912
%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, 2105344
%41 = or i64 %40, %28
br label %42
42: ; preds = %36, %27
%43 = phi i64 [ %41, %36 ], [ %28, %27 ]
%44 = and i64 %0, 251658240
%45 = shl nuw nsw i64 %44, 1
%46 = add i64 %45, %1
%47 = and i64 %46, 536870912
%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, 536870912
%54 = or i64 %53, %43
br label %55
55: ; preds = %49, %42
%56 = phi i64 [ %54, %49 ], [ %43, %42 ]
%57 = and i64 %0, 145249884075720704
%58 = and i64 %1, 1134764719341568
%59 = add nuw nsw i64 %58, 142980423356514304
%60 = and i64 %57, %59
%61 = icmp eq i64 %60, 0
%62 = add nuw nsw i64 %60, 2251799813685247
%63 = and i64 %62, 1134764719341568
%64 = select i1 %61, i64 0, i64 %63
%65 = and i64 %0, 2314885392840523776
%66 = and i64 %1, 9042521065783296
%67 = add nuw nsw i64 %66, 2296800488147910656
%68 = and i64 %65, %67
%69 = icmp eq i64 %68, 0
%70 = add nuw nsw i64 %68, 18014398509481983
%71 = and i64 %70, 9042521065783296
%72 = select i1 %69, i64 0, i64 %71
%73 = or i64 %72, %64
%74 = or i64 %73, %56
ret i64 %74
}