#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*/ getch();
int getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int numstore[1000];
  int i = 0, c;
  while ((c = getchar()) != '0') {
    scanf("%d", &numstore[i]);
    ++i;
  }
  printf("%d", numstore[1] + numstore[0]);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xfb4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xfb8(%rbp)
cmp    $0x30,%eax
je     11a7 <main+0x67>
movslq -0xfb4(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe72(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    115c <main+0x1c>
mov    -0xfac(%rbp),%esi
add    -0xfb0(%rbp),%esi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xfa8,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %rsp,%rbx
lea    0xea5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x4,%rbx
cmp    $0x30,%eax
jne    1160 <main+0x20>
mov    (%rsp),%esi
add    0x4(%rsp),%esi
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0xfa8,%rsp
pop    %rbx
pop    %r14
ret

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

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