#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 */
typedef int /*<<< orphan*/ num;

/* Variables and functions */
int /*<<< orphan*/ add(char *, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ revert(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main() {
  int i = 0;
  char sum[102] = {0};
  char num[101] = {0};
  int max_len = 0;
  sum[0] = '0';
  for (i = 0; i < 100; i++) {
    scanf("%s", num);
    if (!strcmp("0", num)) {
      break;
    }
    sscanf(num, "%*[^1-9]%s", num);
    revert(num, strlen(sum));
    add(sum, num);
    memset(num, 0, sizeof(num));
  }
  revert(sum, strlen(sum));
  printf("%s\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x66,%edx
call   1060 <memset@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1060 <memset@plt>
movl   $0x0,-0xe4(%rbp)
movb   $0x30,-0x70(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    127f <main+0xff>
lea    -0xe0(%rbp),%rsi
lea    0xe21(%rip),%rdi
call   1090 <scanf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe04(%rip),%rdi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    120f <main+0x8f>
jmp    127f <main+0xff>
lea    -0xe0(%rbp),%rdi
lea    -0xe0(%rbp),%rdx
lea    0xdde(%rip),%rsi
call   1080 <sscanf@plt>
lea    -0xe0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xf0(%rbp),%rdi
mov    %eax,%esi
call   10a0 <revert@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1030 <add@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1060 <memset@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d1 <main+0x51>
lea    -0x70(%rbp),%rax
mov    %rax,-0xf8(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xf8(%rbp),%rdi
mov    %eax,%esi
call   10a0 <revert@plt>
lea    -0x70(%rbp),%rsi
lea    0xd61(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x5e(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movq   $0x0,0xcd(%rsp)
movb   $0x30,(%rsp)
mov    $0x64,%ebp
lea    0xe17(%rip),%r14
lea    0x70(%rsp),%rbx
lea    0xe03(%rip),%r15
mov    %rsp,%r12
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
cmpw   $0x30,0x70(%rsp)
je     1252 <main+0xe2>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1070 <sscanf@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1090 <revert@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <add@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x65,%edx
call   1060 <memset@plt>
add    $0xffffffff,%ebp
jne    1200 <main+0x90>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1090 <revert@plt>
lea    0xd9d(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [11 x i8] c"%*[^1-9]%s\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [102 x i8]
%4 = alloca [101 x i8]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%6 = bitcast [102 x i8]* %3 to i8*
%7 = bitcast [101 x i8]* %4 to i8*
store i32 0, i32* %5
%8 = getelementptr inbounds [102 x i8], [102 x i8]* %3, i64 0, i64 0
store i8 48, i8* %8
store i32 0, i32* %2
br label %9
9: ; preds = %32, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 100
br i1 %11, label %12, label %35
12: ; preds = %9
%13 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%16 = call i32 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %12
br label %35
19: ; preds = %12
%20 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%21 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%22 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [102 x i8], [102 x i8]* %3, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = call i32 @revert(i8* %23, i32 %25)
%27 = getelementptr inbounds [102 x i8], [102 x i8]* %3, i64 0, i64 0
%28 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%29 = call i32 @add(i8* %27, i8* %28)
%30 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%31 = call i32 @memset(i8* %30, i32 0, i32 101)
br label %32
32: ; preds = %19
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %9
35: ; preds = %18, %9
%36 = getelementptr inbounds [102 x i8], [102 x i8]* %3, i64 0, i64 0
%37 = getelementptr inbounds [102 x i8], [102 x i8]* %3, i64 0, i64 0
%38 = call i32 @strlen(i8* %37)
%39 = call i32 @revert(i8* %36, i32 %38)
%40 = getelementptr inbounds [102 x i8], [102 x i8]* %3, i64 0, i64 0
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.2 = [11 x i8] c"%*[^1-9]%s\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [102 x i8]
%2 = alloca [101 x i8]
%3 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
store i8 48, i8* %3
%5 = bitcast [101 x i8]* %2 to i16*
br label %6
6: ; preds = %0, %11
%7 = phi i32 [ 0, %0 ], [ %17, %11 ]
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = load i16, i16* %5
%10 = icmp eq i16 %9, 48
br i1 %10, label %19, label %11
11: ; preds = %6
%12 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%13 = call i32 @strlen(i8* %3)
%14 = call i32 @revert(i8* %4, i32 %13)
%15 = call i32 @add(i8* %3, i8* %4)
%16 = call i32 @memset(i8* %4, i32 0, i32 101)
%17 = add nuw nsw i32 %7, 1
%18 = icmp eq i32 %17, 100
br i1 %18, label %19, label %6
19: ; preds = %6, %11
%20 = call i32 @strlen(i8* %3)
%21 = call i32 @revert(i8* %3, i32 %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %3)
ret i32 0
}