#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_F4(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 & 0X0000000200000000ULL) & (discs_player << 1);
  flipped |= (discs_opponent & 0X0000020000000000ULL) & (discs_player >> 7);
  flipped |= (discs_opponent & 0X0000000002000000ULL) & (discs_player << 9);
  my_discs = discs_player & 0X0000000000040404ULL;
  opp_discs = (discs_opponent & 0X0000000004040400ULL) | 0X00000003FBFBF800ULL;
  r = ((my_discs << 8) + opp_discs) & 0X0000000400000000ULL;
  if (r != 0) {
    flipped |= (0X0000000400000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000004040400ULL;
  }
  my_discs = discs_player & 0X0404000000000000ULL;
  opp_discs = (discs_opponent & 0X0004040000000000ULL) | 0X03FBF80000000000ULL;
  r = (opp_discs + 0X0000040000000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0004040000000000ULL;
  }
  my_discs = discs_player & 0X2010000000000000ULL;
  opp_discs = (discs_opponent & 0X0010080000000000ULL) | 0X1FEFF00000000000ULL;
  r = (opp_discs + 0X0000080000000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X0010080000000000ULL;
  }
  my_discs = discs_player & 0X0000000000102040ULL;
  opp_discs = (discs_opponent & 0X0000000008102000ULL) | 0X00000003F7EFC000ULL;
  r = ((my_discs << 7) + opp_discs) & 0X0000000400000000ULL;
  if (r != 0) {
    flipped |= (0X0000000400000000ULL - (0X2ULL << last_bit(my_discs))) &
               0X0000000008102000ULL;
  }
  my_discs = discs_player & 0X000000F000000000ULL;
  r = (discs_opponent + 0X0000000800000000ULL) & my_discs;
  if (r != 0) {
    flipped |= (r - 1) & 0X000000F800000000ULL;
  }
  return flipped;
}


x86 assembly (clang, -O0):
<flip_F4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x200000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shl    $0x1,%rcx
and    %rcx,%rax
mov    %rax,-0x30(%rbp)
movabs $0x20000000000,%rax
and    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x7,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
and    $0x2000000,%rax
mov    -0x8(%rbp),%rcx
shl    $0x9,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x40404,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x4040400,%rax
movabs $0x3fbfbf800,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
add    -0x20(%rbp),%rax
movabs $0x400000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11ff <flip_F4+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 $0x400000000,%rax
sub    %rcx,%rax
and    $0x4040400,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x404000000000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x4040000000000,%rax
and    -0x10(%rbp),%rax
movabs $0x3fbf80000000000,%rcx
f8 fb 03
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x40000000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     126e <flip_F4+0x15e>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x4040000000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x2010000000000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x10080000000000,%rax
and    -0x10(%rbp),%rax
movabs $0x1feff00000000000,%rcx
f0 ef 1f
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
movabs $0x80000000000,%rax
add    -0x20(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12dd <flip_F4+0x1cd>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0x10080000000000,%rcx
and    %rcx,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
and    $0x102040,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x8102000,%rax
movabs $0x3f7efc000,%rcx
or     %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x7,%rax
add    -0x20(%rbp),%rax
movabs $0x400000000,%rcx
and    %rcx,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1361 <flip_F4+0x251>
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 $0x400000000,%rax
sub    %rcx,%rax
and    $0x8102000,%rax
or     -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0xf000000000,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movabs $0x800000000,%rax
add    -0x10(%rbp),%rax
and    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     13b1 <flip_F4+0x2a1>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
movabs $0xf800000000,%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_F4>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
movabs $0x400000000,%r15
lea    (%rdi,%rdi,1),%rax
and    %rsi,%rax
movabs $0x200000000,%rcx
and    %rax,%rcx
mov    %rdi,%rax
shr    $0x7,%rax
and    %rsi,%rax
movabs $0x20000000000,%rdx
and    %rax,%rdx
or     %rcx,%rdx
mov    %r14d,%r13d
shl    $0x9,%r13d
and    %r12d,%r13d
and    $0x2000000,%r13d
or     %rdx,%r13
and    $0x40404,%edi
mov    %r12d,%eax
and    $0x4040400,%eax
or     %r15,%rax
mov    %rdi,%rcx
shl    $0x8,%rcx
add    %rcx,%rax
add    $0xfffffffffbfbf800,%rax
bt     $0x22,%rax
jae    11ad <flip_F4+0x9d>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x4040400,%edx
or     %rdx,%r13
movabs $0x4040000000000,%rax
mov    %r12,%rcx
and    %rax,%rcx
movabs $0x3fbfc0000000000,%rdx
fc fb 03
add    %rcx,%rdx
and    %r14,%rdx
movabs $0x404000000000000,%rcx
and    %rdx,%rcx
lea    -0x1(%rcx),%rdx
and    %rax,%rdx
test   %rcx,%rcx
cmove  %rcx,%rdx
movabs $0x10080000000000,%rax
mov    %r12,%rcx
and    %rax,%rcx
movabs $0x1feff80000000000,%rsi
f8 ef 1f
add    %rcx,%rsi
and    %r14,%rsi
movabs $0x2010000000000000,%rcx
and    %rsi,%rcx
lea    -0x1(%rcx),%rbx
and    %rax,%rbx
test   %rcx,%rcx
cmove  %rcx,%rbx
or     %rdx,%rbx
or     %r13,%rbx
mov    %r14d,%edi
and    $0x102040,%edi
mov    %r12d,%eax
and    $0x8102000,%eax
lea    -0x8104000(%r15),%rcx
or     %rax,%rcx
mov    %rdi,%rax
shl    $0x7,%rax
add    %rcx,%rax
test   %r15,%rax
je     126d <flip_F4+0x15d>
call   1030 <last_bit@plt>
mov    $0xfffffffffffffffe,%rdx
mov    %eax,%ecx
shl    %cl,%rdx
and    $0x8102000,%edx
or     %rdx,%rbx
movabs $0x800000000,%rax
add    %rax,%r12
and    %r12,%r14
movabs $0xf000000000,%rcx
and    %r14,%rcx
lea    -0x1(%rcx),%rdx
movabs $0xf800000000,%rax
and    %rdx,%rax
test   %rcx,%rcx
cmove  %rcx,%rax
or     %rbx,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @flip_F4(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, 8589934592
%11 = load i64, i64* %3
%12 = shl i64 %11, 1
%13 = and i64 %10, %12
store i64 %13, i64* %8
%14 = load i64, i64* %4
%15 = and i64 %14, 2199023255552
%16 = load i64, i64* %3
%17 = lshr 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, 33554432
%23 = load i64, i64* %3
%24 = shl 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, 263172
store i64 %29, i64* %5
%30 = load i64, i64* %4
%31 = and i64 %30, 67372032
%32 = or i64 %31, 17112496128
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, 17179869184
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 17179869184, %44
%46 = and i64 %45, 67372032
%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, 289356276058554368
store i64 %51, i64* %5
%52 = load i64, i64* %4
%53 = and i64 %52, 1130297953353728
%54 = or i64 %53, 287095680151846912
store i64 %54, i64* %6
%55 = load i64, i64* %6
%56 = add i64 %55, 4398046511104
%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, 1130297953353728
%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, 2310346608841064448
store i64 %69, i64* %5
%70 = load i64, i64* %4
%71 = and i64 %70, 4512395720392704
%72 = or i64 %71, 2301321817400279040
store i64 %72, i64* %6
%73 = load i64, i64* %6
%74 = add i64 %73, 8796093022208
%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, 4512395720392704
%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, 1056832
store i64 %87, i64* %5
%88 = load i64, i64* %4
%89 = and i64 %88, 135274496
%90 = or i64 %89, 17044586496
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, 17179869184
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 17179869184, %102
%104 = and i64 %103, 135274496
%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, 1030792151040
store i64 %109, i64* %5
%110 = load i64, i64* %4
%111 = add i64 %110, 34359738368
%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, 1065151889408
%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_F4(i64 %0, i64 %1) {
%3 = and i64 %1, 8589934592
%4 = shl i64 %0, 1
%5 = and i64 %3, %4
%6 = and i64 %1, 2199023255552
%7 = lshr i64 %0, 7
%8 = and i64 %6, %7
%9 = or i64 %5, %8
%10 = and i64 %1, 33554432
%11 = shl i64 %0, 9
%12 = and i64 %10, %11
%13 = or i64 %9, %12
%14 = and i64 %0, 263172
%15 = and i64 %1, 67372032
%16 = or i64 %15, 17112496128
%17 = shl nuw nsw i64 %14, 8
%18 = add nuw nsw i64 %16, %17
%19 = and i64 %18, 17179869184
%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, 67372032
%26 = or i64 %25, %13
br label %27
27: ; preds = %21, %2
%28 = phi i64 [ %26, %21 ], [ %13, %2 ]
%29 = and i64 %0, 289356276058554368
%30 = and i64 %1, 1130297953353728
%31 = add nuw nsw i64 %30, 287100078198358016
%32 = and i64 %29, %31
%33 = icmp eq i64 %32, 0
%34 = add nuw nsw i64 %32, 2251799813685247
%35 = and i64 %34, 1130297953353728
%36 = select i1 %33, i64 0, i64 %35
%37 = and i64 %0, 2310346608841064448
%38 = and i64 %1, 4512395720392704
%39 = add nuw nsw i64 %38, 2301330613493301248
%40 = and i64 %37, %39
%41 = icmp eq i64 %40, 0
%42 = add nuw nsw i64 %40, 9007199254740991
%43 = and i64 %42, 4512395720392704
%44 = select i1 %41, i64 0, i64 %43
%45 = or i64 %44, %36
%46 = or i64 %45, %28
%47 = and i64 %0, 1056832
%48 = and i64 %1, 135274496
%49 = or i64 %48, 17044586496
%50 = shl nuw nsw i64 %47, 7
%51 = add nuw nsw i64 %49, %50
%52 = and i64 %51, 17179869184
%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, 135274496
%59 = or i64 %58, %46
br label %60
60: ; preds = %54, %27
%61 = phi i64 [ %59, %54 ], [ %46, %27 ]
%62 = and i64 %0, 1030792151040
%63 = add i64 %1, 34359738368
%64 = and i64 %62, %63
%65 = icmp eq i64 %64, 0
%66 = add nuw nsw i64 %64, 1099511627775
%67 = and i64 %66, 1065151889408
%68 = select i1 %65, i64 0, i64 %67
%69 = or i64 %61, %68
ret i64 %69
}