#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int d, a;
  scanf("%d", &a);
  d = 0;
  while (a != -1) {
    scanf("%d", &a);
    d = 10 * d + a;
  }
  printf("%d", d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     116f <main+0x4f>
lea    0xea9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
imul   $0xa,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x26>
mov    -0x8(%rbp),%esi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,0xc(%rsp)
je     116c <main+0x4c>
xor    %ebx,%ebx
lea    0xeb6(%rip),%r14
lea    0xc(%rsp),%r15
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
lea    (%rbx,%rbx,4),%eax
mov    0xc(%rsp),%ecx
lea    (%rcx,%rax,2),%ebx
cmp    $0xffffffff,%ecx
jne    1150 <main+0x30>
jmp    116e <main+0x4e>
xor    %ebx,%ebx
lea    0xe8b(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, -1
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %2
%11 = mul nsw i32 10, %10
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
store i32 %13, i32* %2
br label %5
14: ; preds = %5
%15 = load i32, i32* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, -1
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %11, %6 ], [ 0, %0 ]
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = mul nsw i32 %7, 10
%10 = load i32, i32* %1
%11 = add nsw i32 %10, %9
%12 = icmp eq i32 %10, -1
br i1 %12, label %13, label %6
13: ; preds = %6, %0
%14 = phi i32 [ 0, %0 ], [ %11, %6 ]
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}