#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 __VERIFIER_nondet_int();
int random2d() {
  int N;
  int x;
  int y;
  int i;
  int r;
  x = 0;
  y = 0;
  i = 0;
  while (i < N) {
    i = i + 1;
    r = __VERIFIER_nondet_int();
    if (r >= 0 && r <= 3) {
      if (r == 0)
        x = x + 1;
      else if (r == 1)
        x = x - 1;
      else if (r == 2)
        y = y + 1;
      else if (r == 3)
        y = y - 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<random2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d4 <random2d+0xc4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11cf <random2d+0xbf>
cmpl   $0x3,-0x14(%rbp)
jg     11cf <random2d+0xbf>
cmpl   $0x0,-0x14(%rbp)
jne    1178 <random2d+0x68>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ca <random2d+0xba>
cmpl   $0x1,-0x14(%rbp)
jne    1190 <random2d+0x80>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c5 <random2d+0xb5>
cmpl   $0x2,-0x14(%rbp)
jne    11a8 <random2d+0x98>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <random2d+0xb0>
cmpl   $0x3,-0x14(%rbp)
jne    11bb <random2d+0xab>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <random2d+0xb0>
jmp    11c5 <random2d+0xb5>
jmp    11ca <random2d+0xba>
jmp    11cf <random2d+0xbf>
jmp    112d <random2d+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random2d>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @random2d() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %47, %0
%7 = load i32, i32* %4
%8 = load i32, i32* %1
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %48
10: ; preds = %6
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %47
16: ; preds = %10
%17 = load i32, i32* %5
%18 = icmp sle i32 %17, 3
br i1 %18, label %19, label %47
19: ; preds = %16
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %46
25: ; preds = %19
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %2
%30 = sub nsw i32 %29, 1
store i32 %30, i32* %2
br label %45
31: ; preds = %25
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 2
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %44
37: ; preds = %31
%38 = load i32, i32* %5
%39 = icmp eq i32 %38, 3
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* %3
%42 = sub nsw i32 %41, 1
store i32 %42, i32* %3
br label %43
43: ; preds = %40, %37
br label %44
44: ; preds = %43, %34
br label %45
45: ; preds = %44, %28
br label %46
46: ; preds = %45, %22
br label %47
47: ; preds = %46, %16, %10
br label %6
48: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @random2d() {
ret i32 0
}