#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 adjacentscore(int, int);
int /*<<< orphan*/ assert(int);
int basescore(int, int);
int treescore(int x, int y) {
  assert(x >= 0);
  assert(x < (256));
  assert(y >= 0);
  assert(y < (256));
  return basescore(x, y) *
         (2 * (adjacentscore(x + 1, y) + adjacentscore(x - 1, y) +
               adjacentscore(x, y + 1) + adjacentscore(x, y - 1)) +
          adjacentscore(x - 1, y - 1) + adjacentscore(x + 1, y - 1) +
          adjacentscore(x - 1, y + 1) + adjacentscore(x + 1, y + 1));
}


x86 assembly (clang, -O0):
<treescore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x100,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x100,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <basescore@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1050 <adjacentscore@plt>
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
call   1050 <adjacentscore@plt>
mov    -0x10(%rbp),%ecx
mov    %eax,%edx
mov    -0xc(%rbp),%eax
add    %edx,%ecx
imul   %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<treescore>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
not    %edi
shr    $0x1f,%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x100,%ebp
setl   %dil
call   1040 <assert@plt>
mov    %ebx,%edi
not    %edi
shr    $0x1f,%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x100,%ebx
setl   %dil
call   1040 <assert@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <basescore@plt>
mov    %eax,0x4(%rsp)
lea    0x1(%rbp),%edi
mov    %edi,(%rsp)
mov    %ebx,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%r13d
lea    -0x1(%rbp),%r12d
mov    %r12d,%edi
mov    %ebx,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%r14d
add    %r13d,%r14d
lea    0x1(%rbx),%r13d
mov    %ebp,%edi
mov    %r13d,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%r15d
add    %r14d,%r15d
add    $0xffffffff,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ebp
add    %r15d,%ebp
mov    %r12d,%edi
mov    %ebx,%esi
call   1050 <adjacentscore@plt>
lea    (%rax,%rbp,2),%ebp
mov    (%rsp),%r14d
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r12d,%edi
mov    %r13d,%esi
call   1050 <adjacentscore@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r14d,%edi
mov    %r13d,%esi
call   1050 <adjacentscore@plt>
add    %ebp,%eax
imul   0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @treescore(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 256
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %4
%14 = icmp sge i32 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 256
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i32 @basescore(i32 %21, i32 %22)
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
%26 = load i32, i32* %4
%27 = call i32 @adjacentscore(i32 %25, i32 %26)
%28 = load i32, i32* %3
%29 = sub nsw i32 %28, 1
%30 = load i32, i32* %4
%31 = call i32 @adjacentscore(i32 %29, i32 %30)
%32 = add nsw i32 %27, %31
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
%36 = call i32 @adjacentscore(i32 %33, i32 %35)
%37 = add nsw i32 %32, %36
%38 = load i32, i32* %3
%39 = load i32, i32* %4
%40 = sub nsw i32 %39, 1
%41 = call i32 @adjacentscore(i32 %38, i32 %40)
%42 = add nsw i32 %37, %41
%43 = mul nsw i32 2, %42
%44 = load i32, i32* %3
%45 = sub nsw i32 %44, 1
%46 = load i32, i32* %4
%47 = sub nsw i32 %46, 1
%48 = call i32 @adjacentscore(i32 %45, i32 %47)
%49 = add nsw i32 %43, %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
%52 = load i32, i32* %4
%53 = sub nsw i32 %52, 1
%54 = call i32 @adjacentscore(i32 %51, i32 %53)
%55 = add nsw i32 %49, %54
%56 = load i32, i32* %3
%57 = sub nsw i32 %56, 1
%58 = load i32, i32* %4
%59 = add nsw i32 %58, 1
%60 = call i32 @adjacentscore(i32 %57, i32 %59)
%61 = add nsw i32 %55, %60
%62 = load i32, i32* %3
%63 = add nsw i32 %62, 1
%64 = load i32, i32* %4
%65 = add nsw i32 %64, 1
%66 = call i32 @adjacentscore(i32 %63, i32 %65)
%67 = add nsw i32 %61, %66
%68 = mul nsw i32 %23, %67
ret i32 %68
}

LLVM IR (-O2):
define i32 @treescore(i32 %0, i32 %1) {
%3 = xor i32 %0, -1
%4 = lshr i32 %3, 31
%5 = tail call i32 @assert(i32 %4)
%6 = icmp slt i32 %0, 256
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = xor i32 %1, -1
%10 = lshr i32 %9, 31
%11 = tail call i32 @assert(i32 %10)
%12 = icmp slt i32 %1, 256
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @basescore(i32 %0, i32 %1)
%16 = add nsw i32 %0, 1
%17 = tail call i32 @adjacentscore(i32 %16, i32 %1)
%18 = add nsw i32 %0, -1
%19 = tail call i32 @adjacentscore(i32 %18, i32 %1)
%20 = add nsw i32 %19, %17
%21 = add nsw i32 %1, 1
%22 = tail call i32 @adjacentscore(i32 %0, i32 %21)
%23 = add nsw i32 %20, %22
%24 = add nsw i32 %1, -1
%25 = tail call i32 @adjacentscore(i32 %0, i32 %24)
%26 = add nsw i32 %23, %25
%27 = shl nsw i32 %26, 1
%28 = tail call i32 @adjacentscore(i32 %18, i32 %24)
%29 = add nsw i32 %27, %28
%30 = tail call i32 @adjacentscore(i32 %16, i32 %24)
%31 = add nsw i32 %29, %30
%32 = tail call i32 @adjacentscore(i32 %18, i32 %21)
%33 = add nsw i32 %31, %32
%34 = tail call i32 @adjacentscore(i32 %16, i32 %21)
%35 = add nsw i32 %33, %34
%36 = mul nsw i32 %35, %15
ret i32 %36
}