#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 */
scalar_t__ data_atvertex(int, int);
int robber_atvert(int player, int vert) {
  int i;
  for (i = 1; i < 4; i++)
    if (data_atvertex((player + i) % 4, vert) > 0)
      return (player + i) % 4;
  return -1;
}


x86 assembly (clang, -O0):
<robber_atvert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    117a <robber_atvert+0x6a>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
mov    -0xc(%rbp),%esi
call   1030 <data_atvertex@plt>
cmp    $0x0,%rax
jle    1167 <robber_atvert+0x57>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
jmp    1181 <robber_atvert+0x71>
jmp    116c <robber_atvert+0x5c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1125 <robber_atvert+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<robber_atvert>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0x1(%rbx),%eax
lea    0x4(%rbx),%ecx
test   %eax,%eax
cmovns %eax,%ecx
mov    %esi,%r14d
and    $0xfffffffc,%ecx
neg    %ecx
lea    (%rbx,%rcx,1),%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1030 <data_atvertex@plt>
test   %rax,%rax
jg     118a <robber_atvert+0x7a>
lea    0x2(%rbx),%eax
lea    0x5(%rbx),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
neg    %ecx
lea    (%rbx,%rcx,1),%ebp
add    $0x2,%ebp
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <data_atvertex@plt>
test   %rax,%rax
jg     118a <robber_atvert+0x7a>
lea    0x3(%rbx),%eax
lea    0x6(%rbx),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
neg    %ecx
add    %ecx,%ebx
add    $0x3,%ebx
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <data_atvertex@plt>
test   %rax,%rax
mov    $0xffffffff,%ebp
cmovg  %ebx,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @robber_atvert(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 1, i32* %6
br label %7
7: ; preds = %24, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
%14 = srem i32 %13, 4
%15 = load i32, i32* %5
%16 = call i64 @data_atvertex(i32 %14, i32 %15)
%17 = icmp sgt i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %10
%19 = load i32, i32* %4
%20 = load i32, i32* %6
%21 = add nsw i32 %19, %20
%22 = srem i32 %21, 4
store i32 %22, i32* %3
br label %28
23: ; preds = %10
br label %24
24: ; preds = %23
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %7
27: ; preds = %7
store i32 -1, i32* %3
br label %28
28: ; preds = %27, %18
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @robber_atvert(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 1
%4 = srem i32 %3, 4
%5 = tail call i64 @data_atvertex(i32 %4, i32 %1)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %2
%8 = add nsw i32 %0, 2
%9 = srem i32 %8, 4
%10 = tail call i64 @data_atvertex(i32 %9, i32 %1)
%11 = icmp sgt i64 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %7
%13 = add nsw i32 %0, 3
%14 = srem i32 %13, 4
%15 = tail call i64 @data_atvertex(i32 %14, i32 %1)
%16 = icmp sgt i64 %15, 0
%17 = select i1 %16, i32 %14, i32 -1
br label %18
18: ; preds = %12, %7, %2
%19 = phi i32 [ %4, %2 ], [ %9, %7 ], [ %17, %12 ]
ret i32 %19
}