#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 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));
  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)
xor    %eax,%eax
mov    $0x1,%ecx
cmp    -0x8(%rbp),%ecx
mov    %al,-0x11(%rbp)
jg     1169 <main+0x39>
cmpl   $0x3e8,-0x8(%rbp)
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assume@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a7 <main+0x77>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1184 <main+0x54>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
cmp    %ecx,%eax
sete   %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
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
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
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp sle i32 1, %6
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* %2
%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)
store i32 0, i32* %3
store i32 1, i32* %4
br label %15
15: ; preds = %23, %11
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = add nsw i32 %20, %21
store i32 %22, i32* %3
br label %23
23: ; preds = %19
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %15
26: ; preds = %15
%27 = load i32, i32* %3
%28 = mul nsw i32 2, %27
%29 = load i32, i32* %2
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
%32 = mul nsw i32 %29, %31
%33 = icmp eq i32 %28, %32
%34 = zext i1 %33 to i32
%35 = call i32 @__VERIFIER_assert(i32 %34)
ret i32 0
}

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