#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 n, sum, i;
  n = __VERIFIER_nondet_int();
  __VERIFIER_assume(1 <= n && n <= 1000);
  sum = 0;
  for (i = 1; i <= n; i++) {
    sum = sum + i;
  }
  __VERIFIER_assert(2 * sum == n * (n + 1));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
mov    $0x1,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0xd(%rbp)
jg     1162 <main+0x32>
cmpl   $0x3e8,-0x4(%rbp)
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assume@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11a0 <main+0x70>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117d <main+0x4d>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
cmp    %ecx,%eax
sete   %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
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%ebp
xor    %edi,%edi
cmp    $0x3e8,%ebp
setb   %dil
call   1050 <__VERIFIER_assume@plt>
test   %ebx,%ebx
jle    1167 <main+0x37>
lea    -0x2(%rbx),%eax
imul   %eax,%ebp
lea    -0x2(%rbp,%rbx,4),%r14d
and    $0xfffffffe,%r14d
lea    0x1(%rbx),%eax
imul   %ebx,%eax
xor    %edi,%edi
cmp    %eax,%r14d
sete   %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
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp sle i32 1, %5
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %1
%9 = icmp sle i32 %8, 1000
br label %10
10: ; preds = %7, %0
%11 = phi i1 [ false, %0 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @__VERIFIER_assume(i32 %12)
store i32 0, i32* %2
store i32 1, i32* %3
br label %14
14: ; preds = %22, %10
%15 = load i32, i32* %3
%16 = load i32, i32* %1
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = add nsw i32 %19, %20
store i32 %21, i32* %2
br label %22
22: ; preds = %18
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %14
25: ; preds = %14
%26 = load i32, i32* %2
%27 = mul nsw i32 2, %26
%28 = load i32, i32* %1
%29 = load i32, i32* %1
%30 = add nsw i32 %29, 1
%31 = mul nsw i32 %28, %30
%32 = icmp eq i32 %27, %31
%33 = zext i1 %32 to i32
%34 = call i32 @__VERIFIER_assert(i32 %33)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = add i32 %1, -1
%3 = icmp ult i32 %2, 1000
%4 = zext i1 %3 to i32
%5 = tail call i32 @__VERIFIER_assume(i32 %4)
%6 = icmp slt i32 %1, 1
br i1 %6, label %14, label %7
7: ; preds = %0
%8 = shl i32 %1, 2
%9 = add nsw i32 %1, -2
%10 = mul i32 %2, %9
%11 = add i32 %10, %8
%12 = add i32 %11, -2
%13 = and i32 %12, -2
br label %14
14: ; preds = %7, %0
%15 = phi i32 [ 0, %0 ], [ %13, %7 ]
%16 = add nsw i32 %1, 1
%17 = mul nsw i32 %16, %1
%18 = icmp eq i32 %15, %17
%19 = zext i1 %18 to i32
%20 = tail call i32 @__VERIFIER_assert(i32 %19)
ret void
}