#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 negamax_evaluate(int *, int, int, int, int, int, int, int, int, int *);
int negamax(int *map, int map_width, int map_height, int alpha_position,
            int beta_position, int alpha_move) {
  int map_moves[4] = {-1, -map_width, 1, map_width};
  int depth = 6;
  int alpha = -9999;
  int beta = 9999;
  return negamax_evaluate(map, map_width, map_height, alpha_position,
                          beta_position, alpha_move, depth, alpha, beta,
                          map_moves);
}


x86 assembly (clang, -O0):
<negamax>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0xffffffff,-0x40(%rbp)
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x1,-0x38(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
movl   $0x6,-0x44(%rbp)
movl   $0xffffd8f1,-0x48(%rbp)
movl   $0x270f,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x44(%rbp),%ebx
mov    -0x48(%rbp),%r11d
mov    -0x4c(%rbp),%r10d
lea    -0x40(%rbp),%rax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <negamax_evaluate@plt>
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<negamax>:
sub    $0x18,%rsp
movl   $0xffffffff,(%rsp)
mov    %esi,%eax
neg    %eax
mov    %eax,0x4(%rsp)
movl   $0x1,0x8(%rsp)
mov    %esi,0xc(%rsp)
mov    %rsp,%rax
push   %rax
push   $0x270f
push   $0xffffffffffffd8f1
push   $0x6
call   1030 <negamax_evaluate@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
define i32 @negamax(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [4 x i32]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %13, i64 0, i64 0
store i32 -1, i32* %17
%18 = getelementptr inbounds i32, i32* %17, i64 1
%19 = load i32, i32* %8
%20 = sub nsw i32 0, %19
store i32 %20, i32* %18
%21 = getelementptr inbounds i32, i32* %18, i64 1
store i32 1, i32* %21
%22 = getelementptr inbounds i32, i32* %21, i64 1
%23 = load i32, i32* %8
store i32 %23, i32* %22
store i32 6, i32* %14
store i32 -9999, i32* %15
store i32 9999, i32* %16
%24 = load i32*, i32** %7
%25 = load i32, i32* %8
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = load i32, i32* %12
%30 = load i32, i32* %14
%31 = load i32, i32* %15
%32 = load i32, i32* %16
%33 = getelementptr inbounds [4 x i32], [4 x i32]* %13, i64 0, i64 0
%34 = call i32 @negamax_evaluate(i32* %24, i32 %25, i32 %26, i32 %27, i32 %28, i32 %29, i32 %30, i32 %31, i32 %32, i32* %33)
ret i32 %34
}

LLVM IR (-O2):
define i32 @negamax(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [4 x i32]
%8 = bitcast [4 x i32]* %7 to i8*
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
store i32 -1, i32* %9
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 1
%11 = sub nsw i32 0, %1
store i32 %11, i32* %10
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 2
store i32 1, i32* %12
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 3
store i32 %1, i32* %13
%14 = call i32 @negamax_evaluate(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 6, i32 -9999, i32 9999, i32* %9)
ret i32 %14
}