#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 argc, char *argv[]) {
  int c1 = 4000;
  int c2 = 2000;
  int c3 = 10000;
  int n, v;
  int i, k, j;
  n = __VERIFIER_nondet_int();
  __VERIFIER_assume(0 <= n && n < 10);
  k = 0;
  i = 0;
  while (i < n) {
    i++;
    v = __VERIFIER_nondet_int();
    __VERIFIER_assume(0 <= v && n < 2);
    if (v == 0)
      k += c1;
    else if (v == 1)
      k += c2;
    else
      k += c3;
  }
  j = 0;
  while (j < n) {
    __VERIFIER_assert(k > 0);
    j++;
    k--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xfa0,-0x14(%rbp)
movl   $0x7d0,-0x18(%rbp)
movl   $0x2710,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x20(%rbp),%ecx
mov    %al,-0x31(%rbp)
jg     117f <main+0x4f>
cmpl   $0xa,-0x20(%rbp)
setl   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assume@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1223 <main+0xf3>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x24(%rbp),%ecx
mov    %al,-0x32(%rbp)
jg     11d3 <main+0xa3>
cmpl   $0x2,-0x20(%rbp)
setl   %al
mov    %al,-0x32(%rbp)
mov    -0x32(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assume@plt>
cmpl   $0x0,-0x24(%rbp)
jne    11f8 <main+0xc8>
mov    -0x14(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    121e <main+0xee>
cmpl   $0x1,-0x24(%rbp)
jne    1210 <main+0xe0>
mov    -0x18(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1219 <main+0xe9>
mov    -0x1c(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    121e <main+0xee>
jmp    119a <main+0x6a>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    125e <main+0x12e>
cmpl   $0x0,-0x2c(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    122a <main+0xfa>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%r12d
xor    %edi,%edi
cmp    $0xa,%eax
setb   %dil
call   1050 <__VERIFIER_assume@plt>
test   %r12d,%r12d
jle    11d6 <main+0xa6>
mov    $0xfa0,%r15d
mov    %r12d,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x1,%r12d
sete   %r13b
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x1,%eax
mov    $0x2710,%r14d
mov    $0x7d0,%ecx
cmove  %ecx,%r14d
test   %eax,%eax
setns  %al
cmove  %r15d,%r14d
and    %r13b,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assume@plt>
add    %r14d,%ebp
add    $0xffffffff,%ebx
jne    1170 <main+0x40>
test   %r12d,%r12d
jle    11d6 <main+0xa6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
test   %ebp,%ebp
setg   %dil
call   1040 <__VERIFIER_assert@plt>
add    $0xffffffff,%ebp
add    $0xffffffff,%r12d
jne    11c0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4000, i32* %6
store i32 2000, i32* %7
store i32 10000, i32* %8
%14 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp sle i32 0, %15
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* %9
%19 = icmp slt i32 %18, 10
br label %20
20: ; preds = %17, %2
%21 = phi i1 [ false, %2 ], [ %19, %17 ]
%22 = zext i1 %21 to i32
%23 = call i32 @__VERIFIER_assume(i32 %22)
store i32 0, i32* %12
store i32 0, i32* %11
br label %24
24: ; preds = %59, %20
%25 = load i32, i32* %11
%26 = load i32, i32* %9
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %60
28: ; preds = %24
%29 = load i32, i32* %11
%30 = add nsw i32 %29, 1
store i32 %30, i32* %11
%31 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %31, i32* %10
%32 = load i32, i32* %10
%33 = icmp sle i32 0, %32
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = load i32, i32* %9
%36 = icmp slt i32 %35, 2
br label %37
37: ; preds = %34, %28
%38 = phi i1 [ false, %28 ], [ %36, %34 ]
%39 = zext i1 %38 to i32
%40 = call i32 @__VERIFIER_assume(i32 %39)
%41 = load i32, i32* %10
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %37
%44 = load i32, i32* %6
%45 = load i32, i32* %12
%46 = add nsw i32 %45, %44
store i32 %46, i32* %12
br label %59
47: ; preds = %37
%48 = load i32, i32* %10
%49 = icmp eq i32 %48, 1
br i1 %49, label %50, label %54
50: ; preds = %47
%51 = load i32, i32* %7
%52 = load i32, i32* %12
%53 = add nsw i32 %52, %51
store i32 %53, i32* %12
br label %58
54: ; preds = %47
%55 = load i32, i32* %8
%56 = load i32, i32* %12
%57 = add nsw i32 %56, %55
store i32 %57, i32* %12
br label %58
58: ; preds = %54, %50
br label %59
59: ; preds = %58, %43
br label %24
60: ; preds = %24
store i32 0, i32* %13
br label %61
61: ; preds = %65, %60
%62 = load i32, i32* %13
%63 = load i32, i32* %9
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %74
65: ; preds = %61
%66 = load i32, i32* %12
%67 = icmp sgt i32 %66, 0
%68 = zext i1 %67 to i32
%69 = call i32 @__VERIFIER_assert(i32 %68)
%70 = load i32, i32* %13
%71 = add nsw i32 %70, 1
store i32 %71, i32* %13
%72 = load i32, i32* %12
%73 = add nsw i32 %72, -1
store i32 %73, i32* %12
br label %61
74: ; preds = %61
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @__VERIFIER_nondet_int()
%4 = icmp ult i32 %3, 10
%5 = zext i1 %4 to i32
%6 = tail call i32 @__VERIFIER_assume(i32 %5)
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %35
8: ; preds = %2
%9 = icmp eq i32 %3, 1
br label %11
10: ; preds = %11
br i1 %7, label %26, label %35
11: ; preds = %8, %11
%12 = phi i32 [ 0, %8 ], [ %24, %11 ]
%13 = phi i32 [ 0, %8 ], [ %14, %11 ]
%14 = add nuw nsw i32 %13, 1
%15 = tail call i32 (...) @__VERIFIER_nondet_int()
%16 = icmp sgt i32 %15, -1
%17 = select i1 %16, i1 %9, i1 false
%18 = zext i1 %17 to i32
%19 = tail call i32 @__VERIFIER_assume(i32 %18)
%20 = icmp eq i32 %15, 1
%21 = select i1 %20, i32 2000, i32 10000
%22 = icmp eq i32 %15, 0
%23 = select i1 %22, i32 4000, i32 %21
%24 = add nuw nsw i32 %12, %23
%25 = icmp eq i32 %14, %3
br i1 %25, label %10, label %11
26: ; preds = %10, %26
%27 = phi i32 [ %32, %26 ], [ 0, %10 ]
%28 = phi i32 [ %33, %26 ], [ %24, %10 ]
%29 = icmp sgt i32 %28, 0
%30 = zext i1 %29 to i32
%31 = tail call i32 @__VERIFIER_assert(i32 %30)
%32 = add nuw nsw i32 %27, 1
%33 = add nsw i32 %28, -1
%34 = icmp eq i32 %32, %3
br i1 %34, label %35, label %26
35: ; preds = %26, %2, %10
ret i32 0
}