#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 */
scalar_t__ __VERIFIER_nondet_int();
int main() {
  char in[11];
  int i = 0;
  int j = 0;
  int c = 0;
  while (__VERIFIER_nondet_int()) {
    j = c;
    i = i * 10U + j;
    c = in[i];
  }
  if (!(i >= 0)) {
    goto ERROR;
  }
  return 0;
ERROR:
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
je     1166 <main+0x56>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0xa,-0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
movsbl -0xf(%rbp,%rax,1),%eax
mov    %eax,-0x1c(%rbp)
jmp    1134 <main+0x24>
cmpl   $0x0,-0x14(%rbp)
jge    1175 <main+0x65>
jmp    1181 <main+0x71>
movl   $0x0,-0x4(%rbp)
jmp    1188 <main+0x78>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     1150 <main+0x40>
xor    %ebx,%ebx
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
lea    (%r14,%r14,4),%eax
lea    (%rbx,%rax,2),%r14d
movslq %r14d,%rax
movsbl 0xd(%rsp,%rax,1),%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
jne    1130 <main+0x20>
sar    $0x1f,%r14d
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %9, %0
%7 = call i64 (...) @__VERIFIER_nondet_int()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %5
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = mul i32 %11, 10
%13 = load i32, i32* %4
%14 = add i32 %12, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = load i32, i32* %3
%22 = icmp sge i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %20
br label %25
24: ; preds = %20
store i32 0, i32* %1
br label %26
25: ; preds = %23
store i32 -1, i32* %1
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [11 x i8]
%2 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%3 = tail call i64 (...) @__VERIFIER_nondet_int()
%4 = icmp eq i64 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %13, %5 ], [ 0, %0 ]
%7 = phi i32 [ %9, %5 ], [ 0, %0 ]
%8 = mul i32 %7, 10
%9 = add i32 %8, %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = tail call i64 (...) @__VERIFIER_nondet_int()
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5
%17 = ashr i32 %9, 31
br label %18
18: ; preds = %16, %0
%19 = phi i32 [ 0, %0 ], [ %17, %16 ]
ret i32 %19
}