#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_F5(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 & 0X0000000000020000ULL) & (discs_player << 9);
  flipped |= (discs_opponent & 0X0000000002000000ULL) & (discs_player << 1);
  flipped |= (discs_opponent & 0X0000000200000000ULL) & (discs_player >> 7);
  my_discs = discs_player & 0X0000000000000404ULL;
  opp_discs = (discs_opponent & 0X0000000000040400ULL) | 0X0000000003FBF800ULL;
  r = ((my_discs << 8) + opp_discs) & 0X0000000004000000ULL;
  if (r != 0) {
    flipped |= (0X0000000004000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000000040400ULL;
  }
  my_discs = discs_player & 0X0404040000000000ULL;
  opp_discs = (discs_opponent & 0X0004040400000000ULL) | 0X03FBFBF800000000ULL;
  r = (opp_discs + 0X0000000400000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0004040400000000ULL;
  }
  my_discs = discs_player & 0X4020100000000000ULL;
  opp_discs = (discs_opponent & 0X0020100800000000ULL) | 0X3FDFEFF000000000ULL;
  r = (opp_discs + 0X0000000800000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0020100800000000ULL;
  }
  my_discs = discs_player & 0X0000000000001020ULL;
  opp_discs = (discs_opponent & 0X0000000000081000ULL) | 0X0000000003F7E000ULL;
  r = ((my_discs << 7) + opp_discs) & 0X0000000004000000ULL;
  if (r != 0) {
    flipped |= (0X0000000004000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000000081000ULL;
  }
  my_discs = discs_player & 0X00000000F0000000ULL;
  r = (discs_opponent + 0X0000000008000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X00000000F8000000ULL;
  }
  return flipped;
}


x86 assembly (clang, -O0):
<flip_F5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x20000,%rax
mov    -0x8(%rbp),%rcx
shl    $0x9,%rcx
and    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
and    $0x2000000,%rax
mov    -0x8(%rbp),%rcx
shl    $0x1,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x200000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x7,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x404,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x40400,%rax
or     $0x3fbf800,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
add    -0x20(%rbp),%rax
and    $0x4000000,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11e8 <flip_F5+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    $0x4000000,%eax
sub    %rcx,%rax
and    $0x40400,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x404040000000000,%rax
04 04 04
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x4040400000000,%rax
and    -0x10(%rbp),%rax
movabs $0x3fbfbf800000000,%rcx
fb fb 03
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x400000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1257 <flip_F5+0x147>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x4040400000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x4020100000000000,%rax
10 20 40
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x20100800000000,%rax
and    -0x10(%rbp),%rax
movabs $0x3fdfeff000000000,%rcx
ef df 3f
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x800000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12c6 <flip_F5+0x1b6>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x20100800000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1020,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x81000,%rax
or     $0x3f7e000,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x7,%rax
add    -0x20(%rbp),%rax
and    $0x4000000,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1337 <flip_F5+0x227>
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    $0x4000000,%eax
sub    %rcx,%rax
and    $0x81000,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0xf0000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8000000,%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1383 <flip_F5+0x273>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0xf8000000,%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_F5>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
mov    %r14d,%eax
shl    $0x9,%eax
and    %r12d,%eax
and    $0x20000,%eax
lea    (%rdi,%rdi,1),%ecx
and    %r12d,%ecx
and    $0x2000000,%ecx
or     %rax,%rcx
mov    %rdi,%rax
shr    $0x7,%rax
and    %rsi,%rax
movabs $0x200000000,%r15
and    %rax,%r15
or     %rcx,%r15
and    $0x404,%edi
mov    %r12d,%eax
and    $0x40400,%eax
mov    %edi,%ecx
shl    $0x8,%ecx
add    %ecx,%eax
add    $0x3fbf800,%eax
test   $0x4000000,%eax
je     1190 <flip_F5+0x80>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x40400,%edx
or     %rdx,%r15
movabs $0x4040400000000,%rax
mov    %r12,%rcx
and    %rax,%rcx
movabs $0x3fbfbfc00000000,%rdx
fb fb 03
add    %rcx,%rdx
and    %r14,%rdx
movabs $0x404040000000000,%rcx
04 04 04
and    %rdx,%rcx
lea    -0x1(%rcx),%rdx
and    %rax,%rdx
test   %rcx,%rcx
cmove  %rcx,%rdx
movabs $0x20100800000000,%rax
mov    %r12,%rcx
and    %rax,%rcx
movabs $0x3fdfeff800000000,%rsi
ef df 3f
add    %rcx,%rsi
and    %r14,%rsi
movabs $0x4020100000000000,%rcx
10 20 40
and    %rsi,%rcx
lea    -0x1(%rcx),%rbx
and    %rax,%rbx
test   %rcx,%rcx
cmove  %rcx,%rbx
or     %rdx,%rbx
or     %r15,%rbx
mov    %r14d,%edi
and    $0x1020,%edi
mov    %r12d,%eax
and    $0x81000,%eax
mov    %edi,%ecx
shl    $0x7,%ecx
add    %ecx,%eax
add    $0x3f7e000,%eax
test   $0x4000000,%eax
je     124a <flip_F5+0x13a>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x81000,%edx
or     %rdx,%rbx
add    $0x8000000,%r12d
and    %r14d,%r12d
and    $0xf0000000,%r12d
lea    -0x1(%r12),%eax
and    $0xf8000000,%eax
test   %r12,%r12
cmove  %r12,%rax
or     %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @flip_F5(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, 131072
%11 = load i64, i64* %3
%12 = shl i64 %11, 9
%13 = and i64 %10, %12
store i64 %13, i64* %8
%14 = load i64, i64* %4
%15 = and i64 %14, 33554432
%16 = load i64, i64* %3
%17 = shl i64 %16, 1
%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, 8589934592
%23 = load i64, i64* %3
%24 = lshr i64 %23, 7
%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, 1028
store i64 %29, i64* %5
%30 = load i64, i64* %4
%31 = and i64 %30, 263168
%32 = or i64 %31, 66844672
store i64 %32, i64* %6
%33 = load i64, i64* %5
%34 = shl i64 %33, 8
%35 = load i64, i64* %6
%36 = add i64 %34, %35
%37 = and i64 %36, 67108864
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 67108864, %44
%46 = and i64 %45, 263168
%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, 289360674105065472
store i64 %51, i64* %5
%52 = load i64, i64* %4
%53 = and i64 %52, 1130315133222912
%54 = or i64 %53, 287100043838619648
store i64 %54, i64* %6
%55 = load i64, i64* %6
%56 = add i64 %55, 17179869184
%57 = load i64, i64* %5
%58 = and i64 %56, %57
store i64 %58, i64* %7
%59 = load i64, i64* %7
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %67
61: ; preds = %49
%62 = load i64, i64* %7
%63 = sub i64 %62, 1
%64 = and i64 %63, 1130315133222912
%65 = load i64, i64* %8
%66 = or i64 %65, %64
store i64 %66, i64* %8
br label %67
67: ; preds = %61, %49
%68 = load i64, i64* %3
%69 = and i64 %68, 4620710809868173312
store i64 %69, i64* %5
%70 = load i64, i64* %4
%71 = and i64 %70, 9024825800523776
%72 = or i64 %71, 4602661158267125760
store i64 %72, i64* %6
%73 = load i64, i64* %6
%74 = add i64 %73, 34359738368
%75 = load i64, i64* %5
%76 = and i64 %74, %75
store i64 %76, i64* %7
%77 = load i64, i64* %7
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %85
79: ; preds = %67
%80 = load i64, i64* %7
%81 = sub i64 %80, 1
%82 = and i64 %81, 9024825800523776
%83 = load i64, i64* %8
%84 = or i64 %83, %82
store i64 %84, i64* %8
br label %85
85: ; preds = %79, %67
%86 = load i64, i64* %3
%87 = and i64 %86, 4128
store i64 %87, i64* %5
%88 = load i64, i64* %4
%89 = and i64 %88, 528384
%90 = or i64 %89, 66576384
store i64 %90, i64* %6
%91 = load i64, i64* %5
%92 = shl i64 %91, 7
%93 = load i64, i64* %6
%94 = add i64 %92, %93
%95 = and i64 %94, 67108864
store i64 %95, i64* %7
%96 = load i64, i64* %7
%97 = icmp ne i64 %96, 0
br i1 %97, label %98, label %107
98: ; preds = %85
%99 = load i64, i64* %5
%100 = call i32 @last_bit(i64 %99)
%101 = zext i32 %100 to i64
%102 = shl i64 2, %101
%103 = sub i64 67108864, %102
%104 = and i64 %103, 528384
%105 = load i64, i64* %8
%106 = or i64 %105, %104
store i64 %106, i64* %8
br label %107
107: ; preds = %98, %85
%108 = load i64, i64* %3
%109 = and i64 %108, 4026531840
store i64 %109, i64* %5
%110 = load i64, i64* %4
%111 = add i64 %110, 134217728
%112 = load i64, i64* %5
%113 = and i64 %111, %112
store i64 %113, i64* %7
%114 = load i64, i64* %7
%115 = icmp ne i64 %114, 0
br i1 %115, label %116, label %122
116: ; preds = %107
%117 = load i64, i64* %7
%118 = sub i64 %117, 1
%119 = and i64 %118, 4160749568
%120 = load i64, i64* %8
%121 = or i64 %120, %119
store i64 %121, i64* %8
br label %122
122: ; preds = %116, %107
%123 = load i64, i64* %8
ret i64 %123
}

LLVM IR (-O2):
define i64 @flip_F5(i64 %0, i64 %1) {
%3 = and i64 %1, 131072
%4 = shl i64 %0, 9
%5 = and i64 %3, %4
%6 = and i64 %1, 33554432
%7 = shl i64 %0, 1
%8 = and i64 %6, %7
%9 = or i64 %5, %8
%10 = and i64 %1, 8589934592
%11 = lshr i64 %0, 7
%12 = and i64 %10, %11
%13 = or i64 %9, %12
%14 = and i64 %0, 1028
%15 = and i64 %1, 263168
%16 = or i64 %15, 66844672
%17 = shl nuw nsw i64 %14, 8
%18 = add nuw nsw i64 %16, %17
%19 = and i64 %18, 67108864
%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, 263168
%26 = or i64 %25, %13
br label %27
27: ; preds = %21, %2
%28 = phi i64 [ %26, %21 ], [ %13, %2 ]
%29 = and i64 %0, 289360674105065472
%30 = and i64 %1, 1130315133222912
%31 = add nuw nsw i64 %30, 287100061018488832
%32 = and i64 %29, %31
%33 = icmp eq i64 %32, 0
%34 = add nuw nsw i64 %32, 2251799813685247
%35 = and i64 %34, 1130315133222912
%36 = select i1 %33, i64 0, i64 %35
%37 = and i64 %0, 4620710809868173312
%38 = and i64 %1, 9024825800523776
%39 = add nuw nsw i64 %38, 4602661192626864128
%40 = and i64 %37, %39
%41 = icmp eq i64 %40, 0
%42 = add nuw nsw i64 %40, 18014398509481983
%43 = and i64 %42, 9024825800523776
%44 = select i1 %41, i64 0, i64 %43
%45 = or i64 %44, %36
%46 = or i64 %45, %28
%47 = and i64 %0, 4128
%48 = and i64 %1, 528384
%49 = or i64 %48, 66576384
%50 = shl nuw nsw i64 %47, 7
%51 = add nuw nsw i64 %49, %50
%52 = and i64 %51, 67108864
%53 = icmp eq i64 %52, 0
br i1 %53, label %60, label %54
54: ; preds = %27
%55 = tail call i32 @last_bit(i64 %47)
%56 = zext i32 %55 to i64
%57 = shl i64 -2, %56
%58 = and i64 %57, 528384
%59 = or i64 %58, %46
br label %60
60: ; preds = %54, %27
%61 = phi i64 [ %59, %54 ], [ %46, %27 ]
%62 = and i64 %0, 4026531840
%63 = add i64 %1, 134217728
%64 = and i64 %62, %63
%65 = icmp eq i64 %64, 0
%66 = add nuw nsw i64 %64, 4294967295
%67 = and i64 %66, 4160749568
%68 = select i1 %65, i64 0, i64 %67
%69 = or i64 %61, %68
ret i64 %69
}