#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 n = __VERIFIER_nondet_int();
  int m = __VERIFIER_nondet_int();
  int v1, v2;
  if (n >= 0 && m > 0) {
    v1 = n;
    v2 = 0;
    while (v1 > 0) {
      if (v2 < m) {
        v2++;
        v1--;
      } else {
        v2 = 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)
cmpl   $0x0,-0x8(%rbp)
jl     1192 <main+0x82>
cmpl   $0x0,-0xc(%rbp)
jle    1192 <main+0x82>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    118d <main+0x7d>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1181 <main+0x71>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1188 <main+0x78>
movl   $0x0,-0x14(%rbp)
jmp    1154 <main+0x44>
jmp    1192 <main+0x82>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %ebx,%ebx
jle    1142 <main+0x32>
test   %eax,%eax
jle    1142 <main+0x32>
xor    %ecx,%ecx
xor    %edx,%edx
nopl   (%rax)
xor    %esi,%esi
cmp    %eax,%edx
lea    0x1(%rdx),%edx
setl   %sil
cmovge %ecx,%edx
sub    %esi,%ebx
jne    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %6, i32* %2
%7 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %30
10: ; preds = %0
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load i32, i32* %2
store i32 %14, i32* %4
store i32 0, i32* %5
br label %15
15: ; preds = %28, %13
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %15
%19 = load i32, i32* %5
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
%25 = load i32, i32* %4
%26 = add nsw i32 %25, -1
store i32 %26, i32* %4
br label %28
27: ; preds = %18
store i32 0, i32* %5
br label %28
28: ; preds = %27, %22
br label %15
29: ; preds = %15
br label %30
30: ; preds = %29, %10, %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 %2, 0
%4 = icmp sgt i32 %1, 0
%5 = select i1 %4, i1 %3, i1 false
br i1 %5, label %6, label %15
6: ; preds = %0, %6
%7 = phi i32 [ %13, %6 ], [ 0, %0 ]
%8 = phi i32 [ %12, %6 ], [ %1, %0 ]
%9 = icmp slt i32 %7, %2
%10 = add nsw i32 %7, 1
%11 = sext i1 %9 to i32
%12 = add nsw i32 %8, %11
%13 = select i1 %9, i32 %10, i32 0
%14 = icmp eq i32 %12, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %0
ret i32 0
}