#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 main() {
  int id, maxId, tmp;
  id = __VERIFIER_nondet_int();
  maxId = __VERIFIER_nondet_int();
  if (0 <= id && id < maxId) {
    tmp = id + 1;
    while (tmp != id && __VERIFIER_nondet_int() != 0) {
      if (tmp <= maxId) {
        tmp = tmp + 1;
      } else {
        tmp = 0;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jg     11af <main+0x9f>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11af <main+0x9f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x11(%rbp)
je     1174 <main+0x64>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1184 <main+0x74>
jmp    11aa <main+0x9a>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     119e <main+0x8e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a5 <main+0x95>
movl   $0x0,-0x10(%rbp)
jmp    1153 <main+0x43>
jmp    11af <main+0x9f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %ebx,%ebx
js     115b <main+0x4b>
mov    %eax,%r15d
cmp    %eax,%ebx
jge    115b <main+0x4b>
lea    0x1(%rbx),%ebp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     115b <main+0x4b>
cmp    %r15d,%ebp
lea    0x1(%rbp),%eax
cmovg  %r14d,%eax
mov    %eax,%ebp
cmp    %ebx,%eax
jne    1140 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %2
%6 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = icmp sle i32 0, %7
br i1 %8, label %9, label %35
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %35
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %16
16: ; preds = %33, %13
%17 = load i32, i32* %4
%18 = load i32, i32* %2
%19 = icmp ne i32 %17, %18
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = call i32 (...) @__VERIFIER_nondet_int()
%22 = icmp ne i32 %21, 0
br label %23
23: ; preds = %20, %16
%24 = phi i1 [ false, %16 ], [ %22, %20 ]
br i1 %24, label %25, label %34
25: ; preds = %23
%26 = load i32, i32* %4
%27 = load i32, i32* %3
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %33
32: ; preds = %25
store i32 0, i32* %4
br label %33
33: ; preds = %32, %29
br label %16
34: ; preds = %23
br label %35
35: ; preds = %34, %9, %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = icmp sgt i32 %1, -1
%4 = icmp slt i32 %1, %2
%5 = select i1 %3, i1 %4, i1 false
br i1 %5, label %6, label %17
6: ; preds = %0
%7 = add nuw nsw i32 %1, 1
br label %8
8: ; preds = %6, %12
%9 = phi i32 [ %7, %6 ], [ %15, %12 ]
%10 = tail call i32 (...) @__VERIFIER_nondet_int()
%11 = icmp eq i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = icmp sgt i32 %9, %2
%14 = add nsw i32 %9, 1
%15 = select i1 %13, i32 0, i32 %14
%16 = icmp eq i32 %15, %1
br i1 %16, label %17, label %8
17: ; preds = %8, %12, %0
ret i32 0
}