#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__ EOF;
int /*<<< orphan*/ puts(char *);
scalar_t__ scanf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, long);
long strtol(char *, int /*<<< orphan*/ *, int);
int main() {
  char str[100];
  long sum = 0;
  while (scanf("%s", str) != EOF) {
    str[12] = '\0';
    long tmp = strtol(str, NULL, 10);
    sum += tmp;
  }
  sprintf(str, "%ld", sum);
  str[10] = '\0';
  puts(str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%rax
je     11a5 <main+0x65>
movb   $0x0,-0x64(%rbp)
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
add    -0x78(%rbp),%rax
mov    %rax,-0x78(%rbp)
jmp    115a <main+0x1a>
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rdx
lea    0xe4f(%rip),%rsi
call   1060 <sprintf@plt>
movb   $0x0,-0x66(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xeae(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    0x2e87(%rip),%r12
cmp    (%r12),%rax
jne    116b <main+0x2b>
xor    %ebx,%ebx
jmp    11a8 <main+0x68>
xor    %ebx,%ebx
mov    %rsp,%r14
lea    0xe89(%rip),%r15
nopw   0x0(%rax,%rax,1)
movb   $0x0,0xc(%rsp)
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
add    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmp    (%r12),%rax
jne    1180 <main+0x40>
lea    0xe54(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
call   1060 <sprintf@plt>
movb   $0x0,0xa(%rsp)
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%ld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %3
br label %5
5: ; preds = %10, %0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 12
store i8 0, i8* %11
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%13 = call i64 @strtol(i8* %12, i32* null, i32 10)
store i64 %13, i64* %4
%14 = load i64, i64* %4
%15 = load i64, i64* %3
%16 = add nsw i64 %15, %14
store i64 %16, i64* %3
br label %5
17: ; preds = %5
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%19 = load i64, i64* %3
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %19)
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 10
store i8 0, i8* %21
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%23 = call i32 @puts(i8* %22)
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%ld\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 12
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %11, %8 ]
store i8 0, i8* %7
%10 = call i64 @strtol(i8* nocapture %2, i32* null, i32 10)
%11 = add nsw i64 %10, %9
%12 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %8
15: ; preds = %8, %0
%16 = phi i64 [ 0, %0 ], [ %11, %8 ]
%17 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 10
store i8 0, i8* %18
%19 = call i32 @puts(i8* %2)
ret i32 0
}