#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 tech_fest_bot_move(int, int, int *, int /*<<< orphan*/ *);
int /*<<< orphan*/ tech_fest_bot_update_state(int **);
int bot(int grid[6][7], int move) {
  int column_to_return = 0;
  int temp = 3;
  tech_fest_bot_update_state(grid);
  if (move == 1)
    column_to_return = tech_fest_bot_move(1, 7, &temp, NULL);
  if (move == -1)
    column_to_return = tech_fest_bot_move(0, 7, &temp, NULL);
  return column_to_return;
}


x86 assembly (clang, -O0):
<bot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <tech_fest_bot_update_state@plt>
cmpl   $0x1,-0xc(%rbp)
jne    116a <bot+0x4a>
mov    $0x1,%edi
mov    $0x7,%esi
lea    -0x14(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <tech_fest_bot_move@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    118b <bot+0x6b>
xor    %edi,%edi
mov    $0x7,%esi
lea    -0x14(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <tech_fest_bot_move@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
movl   $0x3,0xc(%rsp)
call   1040 <tech_fest_bot_update_state@plt>
cmp    $0x1,%ebx
je     1142 <bot+0x22>
xor    %eax,%eax
cmp    $0xffffffff,%ebx
jne    1155 <bot+0x35>
xor    %ebx,%ebx
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
mov    $0x7,%esi
xor    %ecx,%ecx
call   1030 <tech_fest_bot_move@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @bot([7 x i32]* %0, i32 %1) {
%3 = alloca [7 x i32]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [7 x i32]* %0, [7 x i32]** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 3, i32* %6
%7 = load [7 x i32]*, [7 x i32]** %3
%8 = bitcast [7 x i32]* %7 to i32**
%9 = call i32 @tech_fest_bot_update_state(i32** %8)
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @tech_fest_bot_move(i32 1, i32 7, i32* %6, i32* null)
store i32 %13, i32* %5
br label %14
14: ; preds = %12, %2
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @tech_fest_bot_move(i32 0, i32 7, i32* %6, i32* null)
store i32 %18, i32* %5
br label %19
19: ; preds = %17, %14
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @bot([7 x i32]* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 3, i32* %3
%5 = bitcast [7 x i32]* %0 to i32**
%6 = tail call i32 @tech_fest_bot_update_state(i32** %5)
switch i32 %1, label %11 [
i32 1, label %8
i32 -1, label %7
]
7: ; preds = %2
br label %8
8: ; preds = %2, %7
%9 = phi i32 [ 0, %7 ], [ %1, %2 ]
%10 = call i32 @tech_fest_bot_move(i32 %9, i32 7, i32* %3, i32* null)
br label %11
11: ; preds = %8, %2
%12 = phi i32 [ 0, %2 ], [ %10, %8 ]
ret i32 %12
}