#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*/ assert(int);
unsigned int nondet_uint();
int main() {
  unsigned int i, n = nondet_uint(), sn = 0;
  for (i = 0; i <= n; i++) {
    sn = sn + i;
  }
  assert(sn == (n * (n + 1)) / 2 || sn == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <nondet_uint@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
ja     116a <main+0x4a>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <main+0x27>
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
mov    -0xc(%rbp),%eax
add    $0x1,%eax
imul   %eax,%edx
shr    $0x1,%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     1193 <main+0x73>
cmpl   $0x0,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <nondet_uint@plt>
mov    %eax,%ecx
lea    -0x1(%rax),%edx
imul   %rcx,%rdx
shr    %rdx
lea    0x1(%rax),%ecx
imul   %eax,%ecx
shr    %ecx
add    %eax,%edx
sete   %al
cmp    %ecx,%edx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
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 (...) @nondet_uint()
store i32 %5, i32* %3
store i32 0, i32* %4
store i32 0, i32* %2
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp ule i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = add i32 %11, %12
store i32 %13, i32* %4
br label %14
14: ; preds = %10
%15 = load i32, i32* %2
%16 = add i32 %15, 1
store i32 %16, i32* %2
br label %6
17: ; preds = %6
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = load i32, i32* %3
%21 = add i32 %20, 1
%22 = mul i32 %19, %21
%23 = udiv i32 %22, 2
%24 = icmp eq i32 %18, %23
br i1 %24, label %28, label %25
25: ; preds = %17
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 0
br label %28
28: ; preds = %25, %17
%29 = phi i1 [ true, %17 ], [ %27, %25 ]
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @nondet_uint()
%2 = zext i32 %1 to i33
%3 = add i32 %1, -1
%4 = zext i32 %3 to i33
%5 = mul i33 %2, %4
%6 = lshr i33 %5, 1
%7 = trunc i33 %6 to i32
%8 = add i32 %1, %7
%9 = add nuw i32 %1, 1
%10 = mul i32 %9, %1
%11 = lshr i32 %10, 1
%12 = icmp eq i32 %8, %11
%13 = icmp eq i32 %8, 0
%14 = or i1 %12, %13
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
ret i32 0
}