#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 /*<<< orphan*/ __VERIFIER_assert(int);
int /*<<< orphan*/ __VERIFIER_assume(int);
int __VERIFIER_nondet_int();
int main() {
  int i = 0;
  int k = 0;
  while (i < 1000000) {
    int j = __VERIFIER_nondet_int();
    __VERIFIER_assume(1 <= j && j < 1000000);
    i = i + j;
    k++;
  }
  __VERIFIER_assert(k <= 1000000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xf4240,-0x8(%rbp)
jge    11a8 <main+0x78>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
mov    $0x1,%ecx
cmp    -0x10(%rbp),%ecx
mov    %al,-0x11(%rbp)
jg     1184 <main+0x54>
cmpl   $0xf4240,-0x10(%rbp)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assume@plt>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x1d>
cmpl   $0xf4240,-0xc(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffffff,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%r14d
lea    -0x1(%r14),%eax
xor    %edi,%edi
cmp    $0xf423f,%eax
setb   %dil
call   1050 <__VERIFIER_assume@plt>
add    %r14d,%ebx
add    $0x1,%ebp
cmp    $0xf4240,%ebx
jl     1140 <main+0x10>
xor    %edi,%edi
cmp    $0xf4240,%ebp
setb   %dil
call   1040 <__VERIFIER_assert@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
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
store i32 0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1000000
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp sle i32 1, %10
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 1000000
br label %15
15: ; preds = %12, %8
%16 = phi i1 [ false, %8 ], [ %14, %12 ]
%17 = zext i1 %16 to i32
%18 = call i32 @__VERIFIER_assume(i32 %17)
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = add nsw i32 %19, %20
store i32 %21, i32* %2
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
%25 = load i32, i32* %3
%26 = icmp sle i32 %25, 1000000
%27 = zext i1 %26 to i32
%28 = call i32 @__VERIFIER_assert(i32 %27)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %9, %1 ]
%3 = phi i32 [ 0, %0 ], [ %10, %1 ]
%4 = tail call i32 (...) @__VERIFIER_nondet_int()
%5 = add i32 %4, -1
%6 = icmp ult i32 %5, 999999
%7 = zext i1 %6 to i32
%8 = tail call i32 @__VERIFIER_assume(i32 %7)
%9 = add nsw i32 %4, %2
%10 = add nuw nsw i32 %3, 1
%11 = icmp slt i32 %9, 1000000
br i1 %11, label %1, label %12
12: ; preds = %1
%13 = icmp ult i32 %3, 1000000
%14 = zext i1 %13 to i32
%15 = tail call i32 @__VERIFIER_assert(i32 %14)
ret i32 0
}