#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 */
struct bitmap {
  int dummy;
};

/* Variables and functions */
int getbit(struct bitmap *, int, int);
int jb2_direct_context(struct bitmap *bm, int x, int y) {
  return getbit(bm, x - 1, y - 2) << 9 | getbit(bm, x, y - 2) << 8 |
         getbit(bm, x + 1, y - 2) << 7 | getbit(bm, x - 2, y - 1) << 6 |
         getbit(bm, x - 1, y - 1) << 5 | getbit(bm, x, y - 1) << 4 |
         getbit(bm, x + 1, y - 1) << 3 | getbit(bm, x + 2, y - 1) << 2 |
         getbit(bm, x - 2, y) << 1 | getbit(bm, x - 1, y);
}


x86 assembly (clang, -O0):
<jb2_direct_context>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
sub    $0x2,%edx
call   1030 <getbit@plt>
shl    $0x9,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    $0x2,%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
sub    $0x2,%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
shl    $0x7,%ecx
or     %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x2,%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
shl    $0x6,%ecx
or     %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
shl    $0x5,%ecx
or     %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
shl    $0x3,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x2,%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x2,%esi
mov    -0x10(%rbp),%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <getbit@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
or     %ecx,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jb2_direct_context>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,%r13d
mov    %rdi,%r15
lea    -0x1(%r13),%esi
mov    %esi,0xc(%rsp)
lea    -0x2(%rdx),%r14d
mov    %rdx,%r12
mov    %rdx,0x20(%rsp)
mov    %r14d,%edx
call   1030 <getbit@plt>
mov    %eax,%ebx
shl    $0x9,%ebx
mov    %r15,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
call   1030 <getbit@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
or     %ebx,%ebp
lea    0x1(%r13),%esi
mov    %esi,0x10(%rsp)
mov    %r15,%rdi
mov    %r14d,%edx
call   1030 <getbit@plt>
mov    %eax,%ebx
shl    $0x7,%ebx
lea    -0x2(%r13),%esi
mov    %esi,0x14(%rsp)
mov    %r13,0x18(%rsp)
lea    -0x1(%r12),%r14d
mov    %r15,%rdi
mov    %r14d,%edx
call   1030 <getbit@plt>
mov    %eax,%r12d
shl    $0x6,%r12d
or     %ebx,%r12d
or     %ebp,%r12d
mov    %r15,%rdi
mov    0xc(%rsp),%esi
mov    %r14d,%edx
call   1030 <getbit@plt>
mov    %eax,%ebx
shl    $0x5,%ebx
mov    %r15,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
call   1030 <getbit@plt>
mov    %eax,%r13d
shl    $0x4,%r13d
or     %ebx,%r13d
mov    %r15,%rdi
mov    0x10(%rsp),%esi
mov    %r14d,%edx
call   1030 <getbit@plt>
mov    %eax,%ebp
shl    $0x3,%ebp
or     %r13d,%ebp
or     %r12d,%ebp
mov    0x18(%rsp),%rsi
add    $0x2,%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1030 <getbit@plt>
mov    %eax,%r14d
shl    $0x2,%r14d
mov    %r15,%rdi
mov    0x14(%rsp),%esi
mov    0x20(%rsp),%r12
mov    %r12d,%edx
call   1030 <getbit@plt>
mov    %eax,%ebx
add    %eax,%ebx
or     %r14d,%ebx
mov    %r15,%rdi
mov    0xc(%rsp),%esi
mov    %r12d,%edx
call   1030 <getbit@plt>
or     %ebx,%eax
or     %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.bitmap = type { i32 }
define i32 @jb2_direct_context(%struct.bitmap* %0, i32 %1, i32 %2) {
%4 = alloca %struct.bitmap*
%5 = alloca i32
%6 = alloca i32
store %struct.bitmap* %0, %struct.bitmap** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.bitmap*, %struct.bitmap** %4
%8 = load i32, i32* %5
%9 = sub nsw i32 %8, 1
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 2
%12 = call i32 @getbit(%struct.bitmap* %7, i32 %9, i32 %11)
%13 = shl i32 %12, 9
%14 = load %struct.bitmap*, %struct.bitmap** %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = sub nsw i32 %16, 2
%18 = call i32 @getbit(%struct.bitmap* %14, i32 %15, i32 %17)
%19 = shl i32 %18, 8
%20 = or i32 %13, %19
%21 = load %struct.bitmap*, %struct.bitmap** %4
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
%24 = load i32, i32* %6
%25 = sub nsw i32 %24, 2
%26 = call i32 @getbit(%struct.bitmap* %21, i32 %23, i32 %25)
%27 = shl i32 %26, 7
%28 = or i32 %20, %27
%29 = load %struct.bitmap*, %struct.bitmap** %4
%30 = load i32, i32* %5
%31 = sub nsw i32 %30, 2
%32 = load i32, i32* %6
%33 = sub nsw i32 %32, 1
%34 = call i32 @getbit(%struct.bitmap* %29, i32 %31, i32 %33)
%35 = shl i32 %34, 6
%36 = or i32 %28, %35
%37 = load %struct.bitmap*, %struct.bitmap** %4
%38 = load i32, i32* %5
%39 = sub nsw i32 %38, 1
%40 = load i32, i32* %6
%41 = sub nsw i32 %40, 1
%42 = call i32 @getbit(%struct.bitmap* %37, i32 %39, i32 %41)
%43 = shl i32 %42, 5
%44 = or i32 %36, %43
%45 = load %struct.bitmap*, %struct.bitmap** %4
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = sub nsw i32 %47, 1
%49 = call i32 @getbit(%struct.bitmap* %45, i32 %46, i32 %48)
%50 = shl i32 %49, 4
%51 = or i32 %44, %50
%52 = load %struct.bitmap*, %struct.bitmap** %4
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
%55 = load i32, i32* %6
%56 = sub nsw i32 %55, 1
%57 = call i32 @getbit(%struct.bitmap* %52, i32 %54, i32 %56)
%58 = shl i32 %57, 3
%59 = or i32 %51, %58
%60 = load %struct.bitmap*, %struct.bitmap** %4
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 2
%63 = load i32, i32* %6
%64 = sub nsw i32 %63, 1
%65 = call i32 @getbit(%struct.bitmap* %60, i32 %62, i32 %64)
%66 = shl i32 %65, 2
%67 = or i32 %59, %66
%68 = load %struct.bitmap*, %struct.bitmap** %4
%69 = load i32, i32* %5
%70 = sub nsw i32 %69, 2
%71 = load i32, i32* %6
%72 = call i32 @getbit(%struct.bitmap* %68, i32 %70, i32 %71)
%73 = shl i32 %72, 1
%74 = or i32 %67, %73
%75 = load %struct.bitmap*, %struct.bitmap** %4
%76 = load i32, i32* %5
%77 = sub nsw i32 %76, 1
%78 = load i32, i32* %6
%79 = call i32 @getbit(%struct.bitmap* %75, i32 %77, i32 %78)
%80 = or i32 %74, %79
ret i32 %80
}

LLVM IR (-O2):
%struct.bitmap = type { i32 }
define i32 @jb2_direct_context(%struct.bitmap* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -1
%5 = add nsw i32 %2, -2
%6 = tail call i32 @getbit(%struct.bitmap* %0, i32 %4, i32 %5)
%7 = shl i32 %6, 9
%8 = tail call i32 @getbit(%struct.bitmap* %0, i32 %1, i32 %5)
%9 = shl i32 %8, 8
%10 = or i32 %9, %7
%11 = add nsw i32 %1, 1
%12 = tail call i32 @getbit(%struct.bitmap* %0, i32 %11, i32 %5)
%13 = shl i32 %12, 7
%14 = or i32 %10, %13
%15 = add nsw i32 %1, -2
%16 = add nsw i32 %2, -1
%17 = tail call i32 @getbit(%struct.bitmap* %0, i32 %15, i32 %16)
%18 = shl i32 %17, 6
%19 = or i32 %14, %18
%20 = tail call i32 @getbit(%struct.bitmap* %0, i32 %4, i32 %16)
%21 = shl i32 %20, 5
%22 = or i32 %19, %21
%23 = tail call i32 @getbit(%struct.bitmap* %0, i32 %1, i32 %16)
%24 = shl i32 %23, 4
%25 = or i32 %22, %24
%26 = tail call i32 @getbit(%struct.bitmap* %0, i32 %11, i32 %16)
%27 = shl i32 %26, 3
%28 = or i32 %25, %27
%29 = add nsw i32 %1, 2
%30 = tail call i32 @getbit(%struct.bitmap* %0, i32 %29, i32 %16)
%31 = shl i32 %30, 2
%32 = or i32 %28, %31
%33 = tail call i32 @getbit(%struct.bitmap* %0, i32 %15, i32 %2)
%34 = shl i32 %33, 1
%35 = or i32 %32, %34
%36 = tail call i32 @getbit(%struct.bitmap* %0, i32 %4, i32 %2)
%37 = or i32 %35, %36
ret i32 %37
}