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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    (%rcx),%eax
jg     1217 <main+0xf7>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1217 <main+0xf7>
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
mov    %al,-0x21(%rbp)
je     11cd <main+0xad>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11dd <main+0xbd>
jmp    1212 <main+0xf2>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jg     1203 <main+0xe3>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    120d <main+0xed>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    11a6 <main+0x86>
jmp    1217 <main+0xf7>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%r15)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,(%r14)
mov    (%r15),%ecx
test   %ecx,%ecx
js     1178 <main+0x58>
cmp    %eax,%ecx
jge    1178 <main+0x58>
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    (%r15),%eax
add    $0x1,%eax
mov    %eax,(%rbx)
cmp    (%r15),%eax
jne    1187 <main+0x67>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %ecx,(%rbx)
cmp    (%r15),%ecx
je     1178 <main+0x58>
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %eax,%eax
je     1178 <main+0x58>
mov    (%rbx),%eax
xor    %ecx,%ecx
cmp    (%r14),%eax
jg     1180 <main+0x60>
add    $0x1,%eax
mov    %eax,%ecx
jmp    1180 <main+0x60>

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* @alloca(i32 4)
store i32* %5, i32** %2
%6 = call i32* @alloca(i32 4)
store i32* %6, i32** %3
%7 = call i32 (...) @__VERIFIER_nondet_int()
%8 = load i32*, i32** %2
store i32 %7, i32* %8
%9 = call i32 (...) @__VERIFIER_nondet_int()
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = icmp sle i32 0, %12
br i1 %13, label %14, label %52
14: ; preds = %0
%15 = load i32*, i32** %2
%16 = load i32, i32* %15
%17 = load i32*, i32** %3
%18 = load i32, i32* %17
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %52
20: ; preds = %14
%21 = call i32* @alloca(i32 4)
store i32* %21, i32** %4
%22 = load i32*, i32** %2
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
%25 = load i32*, i32** %4
store i32 %24, i32* %25
br label %26
26: ; preds = %50, %20
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = load i32*, i32** %2
%30 = load i32, i32* %29
%31 = icmp ne i32 %28, %30
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = call i32 (...) @__VERIFIER_nondet_int()
%34 = icmp ne i32 %33, 0
br label %35
35: ; preds = %32, %26
%36 = phi i1 [ false, %26 ], [ %34, %32 ]
br i1 %36, label %37, label %51
37: ; preds = %35
%38 = load i32*, i32** %4
%39 = load i32, i32* %38
%40 = load i32*, i32** %3
%41 = load i32, i32* %40
%42 = icmp sle i32 %39, %41
br i1 %42, label %43, label %48
43: ; preds = %37
%44 = load i32*, i32** %4
%45 = load i32, i32* %44
%46 = add nsw i32 %45, 1
%47 = load i32*, i32** %4
store i32 %46, i32* %47
br label %50
48: ; preds = %37
%49 = load i32*, i32** %4
store i32 0, i32* %49
br label %50
50: ; preds = %48, %43
br label %26
51: ; preds = %35
br label %52
52: ; preds = %51, %14, %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @alloca(i32 4)
%2 = tail call i32* @alloca(i32 4)
%3 = tail call i32 (...) @__VERIFIER_nondet_int()
store i32 %3, i32* %1
%4 = tail call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, -1
%7 = icmp slt i32 %5, %4
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %9, label %26
9: ; preds = %0
%10 = tail call i32* @alloca(i32 4)
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %10
%13 = load i32, i32* %1
%14 = icmp eq i32 %12, %13
br i1 %14, label %26, label %15
15: ; preds = %9, %18
%16 = tail call i32 (...) @__VERIFIER_nondet_int()
%17 = icmp eq i32 %16, 0
br i1 %17, label %26, label %18
18: ; preds = %15
%19 = load i32, i32* %10
%20 = load i32, i32* %2
%21 = icmp sgt i32 %19, %20
%22 = add nsw i32 %19, 1
%23 = select i1 %21, i32 0, i32 %22
store i32 %23, i32* %10
%24 = load i32, i32* %1
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %15
26: ; preds = %18, %15, %9, %0
ret i32 0
}