#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();
void 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);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf4240,-0x4(%rbp)
jge    11a1 <main+0x71>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
mov    $0x1,%ecx
cmp    -0xc(%rbp),%ecx
mov    %al,-0xd(%rbp)
jg     117d <main+0x4d>
cmpl   $0xf4240,-0xc(%rbp)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assume@plt>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
cmpl   $0xf4240,-0x8(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
add    $0x10,%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
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <__VERIFIER_assert@plt>

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

LLVM IR (-O2):
define void @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 void
}