#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 *malloc(int);
void main() {
  int n = __VERIFIER_nondet_int();
  __VERIFIER_assume(0 <= n && n <= 1000);
  int *x = malloc(n * sizeof(int));
  for (int i = 0; i < n; i++)
    x[i] = 0;
  for (int i = 0; i < n; i++)
    __VERIFIER_assert(x[i] == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0x19(%rbp)
jg     116f <main+0x2f>
cmpl   $0x3e8,-0x4(%rbp)
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <__VERIFIER_assume@plt>
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11bf <main+0x7f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1196 <main+0x56>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f9 <main+0xb9>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assert@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c6 <main+0x86>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%r14d
xor    %edi,%edi
cmp    $0x3e9,%eax
setb   %dil
call   1070 <__VERIFIER_assume@plt>
lea    0x0(,%r14,4),%edi
call   1050 <malloc@plt>
test   %r14d,%r14d
jle    11b9 <main+0x69>
mov    %rax,%r15
mov    %r14d,%r14d
lea    0x0(,%r14,4),%rdx
xor    %ebx,%ebx
mov    %rax,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
cmpl   $0x0,(%r15,%rbx,4)
sete   %dil
call   1060 <__VERIFIER_assert@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    11a0 <main+0x50>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp sle i32 0, %6
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* %1
%10 = icmp sle i32 %9, 1000
br label %11
11: ; preds = %8, %0
%12 = phi i1 [ false, %0 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
%14 = call i32 @__VERIFIER_assume(i32 %13)
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = mul i64 %16, 4
%18 = trunc i64 %17 to i32
%19 = call i32* @malloc(i32 %18)
store i32* %19, i32** %2
store i32 0, i32* %3
br label %20
20: ; preds = %29, %11
%21 = load i32, i32* %3
%22 = load i32, i32* %1
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i32*, i32** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
store i32 0, i32* %28
br label %29
29: ; preds = %24
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %20
32: ; preds = %20
store i32 0, i32* %4
br label %33
33: ; preds = %46, %32
%34 = load i32, i32* %4
%35 = load i32, i32* %1
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %49
37: ; preds = %33
%38 = load i32*, i32** %2
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 0
%44 = zext i1 %43 to i32
%45 = call i32 @__VERIFIER_assert(i32 %44)
br label %46
46: ; preds = %37
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %33
49: ; preds = %33
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = icmp ult i32 %1, 1001
%3 = zext i1 %2 to i32
%4 = tail call i32 @__VERIFIER_assume(i32 %3)
%5 = shl i32 %1, 2
%6 = tail call i32* @malloc(i32 %5)
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = bitcast i32* %6 to i8*
%10 = zext i32 %1 to i64
%11 = shl nuw nsw i64 %10, 2
%12 = zext i32 %1 to i64
br label %14
13: ; preds = %14, %0
ret void
14: ; preds = %8, %14
%15 = phi i64 [ 0, %8 ], [ %21, %14 ]
%16 = getelementptr inbounds i32, i32* %6, i64 %15
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @__VERIFIER_assert(i32 %19)
%21 = add nuw nsw i64 %15, 1
%22 = icmp eq i64 %21, %12
br i1 %22, label %13, label %14
}