#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_E3(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 & 0X0004000000000000ULL) & (discs_player >> 7);
  flipped |= (discs_opponent & 0X0008000000000000ULL) & (discs_player >> 8);
  flipped |= (discs_opponent & 0X0010000000000000ULL) & (discs_player >> 9);
  my_discs = discs_player & 0X0000000002010000ULL;
  opp_discs = (discs_opponent & 0X0000000402000000ULL) | 0X000007FBFC000000ULL;
  r = ((my_discs << 9) + opp_discs) & 0X0000080000000000ULL;
  if (r != 0) {
    flipped |= (0X0000080000000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000402000000ULL;
  }
  my_discs = discs_player & 0X0000000008080808ULL;
  opp_discs = (discs_opponent & 0X0000000808080800ULL) | 0X000007F7F7F7F000ULL;
  r = ((my_discs << 8) + opp_discs) & 0X0000080000000000ULL;
  if (r != 0) {
    flipped |= (0X0000080000000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000808080800ULL;
  }
  my_discs = discs_player & 0X0000030000000000ULL;
  r = ((my_discs << 1) + discs_opponent) & 0X0000080000000000ULL;
  if (r != 0) {
    flipped |= 0X0000080000000000ULL - (0X2ULL << last_bit(my_discs));
  }
  my_discs = discs_player & 0X0000000020408000ULL;
  opp_discs = (discs_opponent & 0X0000001020400000ULL) | 0X000007EFDF800000ULL;
  r = ((my_discs << 7) + opp_discs) & 0X0000080000000000ULL;
  if (r != 0) {
    flipped |= (0X0000080000000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000001020400000ULL;
  }
  my_discs = discs_player & 0X0000E00000000000ULL;
  r = (discs_opponent + 0X0000100000000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0000F00000000000ULL;
  }
  return flipped;
}


x86 assembly (clang, -O0):
<flip_E3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x4000000000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x7,%rcx
and    %rcx,%rax
mov    %rax,-0x30(%rbp)
movabs $0x8000000000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x8,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x10000000000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x9,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x2010000,%rax
mov    %rax,-0x18(%rbp)
movabs $0x402000000,%rax
and    -0x10(%rbp),%rax
movabs $0x7fbfc000000,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x9,%rax
add    -0x20(%rbp),%rax
movabs $0x80000000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     120e <flip_E3+0xfe>
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 $0x80000000000,%rax
sub    %rcx,%rax
movabs $0x402000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x8080808,%rax
mov    %rax,-0x18(%rbp)
movabs $0x808080800,%rax
and    -0x10(%rbp),%rax
movabs $0x7f7f7f7f000,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
add    -0x20(%rbp),%rax
movabs $0x80000000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     129d <flip_E3+0x18d>
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 $0x80000000000,%rax
sub    %rcx,%rax
movabs $0x808080800,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x30000000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x1,%rax
add    -0x10(%rbp),%rax
movabs $0x80000000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1304 <flip_E3+0x1f4>
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 $0x80000000000,%rax
sub    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x20408000,%rax
mov    %rax,-0x18(%rbp)
movabs $0x1020400000,%rax
and    -0x10(%rbp),%rax
movabs $0x7efdf800000,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x7,%rax
add    -0x20(%rbp),%rax
movabs $0x80000000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1393 <flip_E3+0x283>
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 $0x80000000000,%rax
sub    %rcx,%rax
movabs $0x1020400000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0xe00000000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x100000000000,%rax
add    -0x10(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     13e3 <flip_E3+0x2d3>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0xf00000000000,%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_E3>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
movabs $0x80000000000,%r12
movabs $0x402000000,%r13
mov    %rdi,%rax
shr    $0x7,%rax
and    %rsi,%rax
movabs $0x4000000000000,%rcx
and    %rax,%rcx
mov    %rdi,%rax
shr    $0x8,%rax
and    %rsi,%rax
movabs $0x8000000000000,%rdx
and    %rax,%rdx
or     %rcx,%rdx
mov    %rdi,%rax
shr    $0x9,%rax
and    %rsi,%rax
movabs $0x10000000000000,%r15
and    %rax,%r15
or     %rdx,%r15
and    $0x2010000,%edi
mov    %rsi,%rax
and    %r13,%rax
mov    %rdi,%rcx
shl    $0x9,%rcx
add    %rax,%rcx
movabs $0x7fbfc000000,%rax
add    %rcx,%rax
bt     $0x2b,%rax
jae    11bf <flip_E3+0xaf>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    %r13,%rdx
or     %rdx,%r15
movabs $0x808080800,%r13
mov    %r14d,%edi
and    $0x8080808,%edi
mov    %rbx,%rax
and    %r13,%rax
mov    %rdi,%rcx
shl    $0x8,%rcx
add    %rax,%rcx
movabs $0x7f7f7f7f000,%rax
add    %rcx,%rax
test   %r12,%rax
je     120b <flip_E3+0xfb>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    %r13,%rdx
or     %rdx,%r15
movabs $0x30000000000,%rdi
and    %r14,%rdi
lea    (%rbx,%rdi,2),%rax
test   %r12,%rax
je     1238 <flip_E3+0x128>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
add    %r12,%rdx
or     %rdx,%r15
movabs $0x1020400000,%r13
mov    %r14d,%edi
and    $0x20408000,%edi
mov    %rbx,%rax
and    %r13,%rax
mov    %rdi,%rcx
shl    $0x7,%rcx
add    %rax,%rcx
movabs $0x7efdf800000,%rax
add    %rcx,%rax
test   %r12,%rax
je     1284 <flip_E3+0x174>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    %r13,%rdx
or     %rdx,%r15
movabs $0x100000000000,%rax
add    %rax,%rbx
and    %rbx,%r14
movabs $0xe00000000000,%rcx
and    %r14,%rcx
lea    -0x1(%rcx),%rdx
movabs $0xf00000000000,%rax
and    %rdx,%rax
test   %rcx,%rcx
cmove  %rcx,%rax
or     %r15,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @flip_E3(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, 1125899906842624
%11 = load i64, i64* %3
%12 = lshr i64 %11, 7
%13 = and i64 %10, %12
store i64 %13, i64* %8
%14 = load i64, i64* %4
%15 = and i64 %14, 2251799813685248
%16 = load i64, i64* %3
%17 = lshr i64 %16, 8
%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, 4503599627370496
%23 = load i64, i64* %3
%24 = lshr i64 %23, 9
%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, 33619968
store i64 %29, i64* %5
%30 = load i64, i64* %4
%31 = and i64 %30, 17213423616
%32 = or i64 %31, 8778846044160
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, 8796093022208
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 8796093022208, %44
%46 = and i64 %45, 17213423616
%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, 134744072
store i64 %51, i64* %5
%52 = load i64, i64* %4
%53 = and i64 %52, 34494482432
%54 = or i64 %53, 8761598537728
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, 8796093022208
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 8796093022208, %66
%68 = and i64 %67, 34494482432
%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, 3298534883328
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, 8796093022208
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 8796093022208, %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, 541097984
store i64 %91, i64* %5
%92 = load i64, i64* %4
%93 = and i64 %92, 69260541952
%94 = or i64 %93, 8726828285952
store i64 %94, i64* %6
%95 = load i64, i64* %5
%96 = shl i64 %95, 7
%97 = load i64, i64* %6
%98 = add i64 %96, %97
%99 = and i64 %98, 8796093022208
store i64 %99, i64* %7
%100 = load i64, i64* %7
%101 = icmp ne i64 %100, 0
br i1 %101, label %102, label %111
102: ; preds = %89
%103 = load i64, i64* %5
%104 = call i32 @last_bit(i64 %103)
%105 = zext i32 %104 to i64
%106 = shl i64 2, %105
%107 = sub i64 8796093022208, %106
%108 = and i64 %107, 69260541952
%109 = load i64, i64* %8
%110 = or i64 %109, %108
store i64 %110, i64* %8
br label %111
111: ; preds = %102, %89
%112 = load i64, i64* %3
%113 = and i64 %112, 246290604621824
store i64 %113, i64* %5
%114 = load i64, i64* %4
%115 = add i64 %114, 17592186044416
%116 = load i64, i64* %5
%117 = and i64 %115, %116
store i64 %117, i64* %7
%118 = load i64, i64* %7
%119 = icmp ne i64 %118, 0
br i1 %119, label %120, label %126
120: ; preds = %111
%121 = load i64, i64* %7
%122 = sub i64 %121, 1
%123 = and i64 %122, 263882790666240
%124 = load i64, i64* %8
%125 = or i64 %124, %123
store i64 %125, i64* %8
br label %126
126: ; preds = %120, %111
%127 = load i64, i64* %8
ret i64 %127
}

LLVM IR (-O2):
define i64 @flip_E3(i64 %0, i64 %1) {
%3 = and i64 %1, 1125899906842624
%4 = lshr i64 %0, 7
%5 = and i64 %3, %4
%6 = and i64 %1, 2251799813685248
%7 = lshr i64 %0, 8
%8 = and i64 %6, %7
%9 = or i64 %5, %8
%10 = and i64 %1, 4503599627370496
%11 = lshr i64 %0, 9
%12 = and i64 %10, %11
%13 = or i64 %9, %12
%14 = and i64 %0, 33619968
%15 = and i64 %1, 17213423616
%16 = or i64 %15, 8778846044160
%17 = shl nuw nsw i64 %14, 9
%18 = add nuw nsw i64 %16, %17
%19 = and i64 %18, 8796093022208
%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, 17213423616
%26 = or i64 %25, %13
br label %27
27: ; preds = %21, %2
%28 = phi i64 [ %26, %21 ], [ %13, %2 ]
%29 = and i64 %0, 134744072
%30 = and i64 %1, 34494482432
%31 = or i64 %30, 8761598537728
%32 = shl nuw nsw i64 %29, 8
%33 = add nuw nsw i64 %31, %32
%34 = and i64 %33, 8796093022208
%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, 34494482432
%41 = or i64 %40, %28
br label %42
42: ; preds = %36, %27
%43 = phi i64 [ %41, %36 ], [ %28, %27 ]
%44 = and i64 %0, 3298534883328
%45 = shl nuw nsw i64 %44, 1
%46 = add i64 %45, %1
%47 = and i64 %46, 8796093022208
%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, 8796093022208
%54 = or i64 %53, %43
br label %55
55: ; preds = %49, %42
%56 = phi i64 [ %54, %49 ], [ %43, %42 ]
%57 = and i64 %0, 541097984
%58 = and i64 %1, 69260541952
%59 = or i64 %58, 8726828285952
%60 = shl nuw nsw i64 %57, 7
%61 = add nuw nsw i64 %59, %60
%62 = and i64 %61, 8796093022208
%63 = icmp eq i64 %62, 0
br i1 %63, label %70, label %64
64: ; preds = %55
%65 = tail call i32 @last_bit(i64 %57)
%66 = zext i32 %65 to i64
%67 = shl i64 -2, %66
%68 = and i64 %67, 69260541952
%69 = or i64 %68, %56
br label %70
70: ; preds = %64, %55
%71 = phi i64 [ %69, %64 ], [ %56, %55 ]
%72 = and i64 %0, 246290604621824
%73 = add i64 %1, 17592186044416
%74 = and i64 %72, %73
%75 = icmp eq i64 %74, 0
%76 = add nuw nsw i64 %74, 281474976710655
%77 = and i64 %76, 263882790666240
%78 = select i1 %75, i64 0, i64 %77
%79 = or i64 %71, %78
ret i64 %79
}