#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*/ sbuf;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getchar();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char sbuf[256];
  int slen = 0;
  int c, n;
  while ((c = getchar()) != EOF) {
    if (c >= '0' && c <= '9') {
      sbuf[slen] = '\0';
      puts(sbuf);
      n = 0;
      do {
        n *= 10;
        n += (c - '0');
      } while ((c = getchar()) != EOF && c >= '0' && c <= '9');
      slen -= n;
      if (slen < 0 || slen >= sizeof(sbuf) - 1) {
        fprintf(stderr, "bad backlength %d... exiting.\n", slen);
        exit(1);
      }
    }
    if (slen >= sizeof(sbuf) - 1) {
      fprintf(stderr, "word too long... exiting.\n");
      exit(1);
    }
    sbuf[slen++] = c;
  }
  sbuf[slen] = '\0';
  puts(sbuf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x114(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x118(%rbp)
mov    0x2e71(%rip),%rcx
cmp    (%rcx),%eax
je     12f4 <main+0x1b4>
cmpl   $0x30,-0x118(%rbp)
jl     1299 <main+0x159>
cmpl   $0x39,-0x118(%rbp)
jg     1299 <main+0x159>
movslq -0x114(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x11c(%rbp)
imul   $0xa,-0x11c(%rbp),%eax
mov    %eax,-0x11c(%rbp)
mov    -0x118(%rbp),%eax
sub    $0x30,%eax
add    -0x11c(%rbp),%eax
mov    %eax,-0x11c(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x118(%rbp)
xor    %eax,%eax
mov    0x2df0(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x11d(%rbp)
je     122b <main+0xeb>
xor    %eax,%eax
cmpl   $0x30,-0x118(%rbp)
mov    %al,-0x11d(%rbp)
jl     122b <main+0xeb>
cmpl   $0x39,-0x118(%rbp)
setle  %al
mov    %al,-0x11d(%rbp)
mov    -0x11d(%rbp),%al
test   $0x1,%al
jne    11be <main+0x7e>
mov    -0x11c(%rbp),%ecx
mov    -0x114(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x114(%rbp)
cmpl   $0x0,-0x114(%rbp)
jl     126d <main+0x12d>
movslq -0x114(%rbp),%rax
cmp    $0xff,%rax
jb     1294 <main+0x154>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
mov    -0x114(%rbp),%edx
lea    0xd7d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    1299 <main+0x159>
movslq -0x114(%rbp),%rax
cmp    $0xff,%rax
jb     12cd <main+0x18d>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
lea    0xd63(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x118(%rbp),%eax
mov    %al,%cl
mov    -0x114(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x114(%rbp)
cltq
mov    %cl,-0x110(%rbp,%rax,1)
jmp    1163 <main+0x23>
movslq -0x114(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e89(%rip),%r15
cmp    (%r15),%eax
je     1213 <main+0xd3>
mov    %eax,%ebx
mov    %rsp,%r14
xor    %r12d,%r12d
jmp    11a5 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0xff,%r12d
jae    1231 <main+0xf1>
mov    %r12d,%eax
add    $0x1,%r12d
mov    %bl,(%rsp,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
je     1210 <main+0xd0>
lea    -0x30(%rbx),%eax
cmp    $0x9,%eax
ja     1180 <main+0x40>
mov    %r12d,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
xchg   %ax,%ax
lea    0x0(%rbp,%rbp,4),%eax
lea    (%rbx,%rax,2),%ebp
add    $0xffffffd0,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
lea    -0x30(%rbx),%eax
cmp    $0x9,%eax
ja     11e0 <main+0xa0>
cmp    (%r15),%ebx
jne    11c0 <main+0x80>
sub    %ebp,%r12d
cmp    $0xff,%r12d
jb     118d <main+0x4d>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    %r12d,%ebp
movb   $0x0,(%rsp,%rbp,1)
mov    %rsp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xdde(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EOF = global i32 0
@stderr = global i32 0
@.str = [31 x i8] c"bad backlength %d... exiting.\0A\00"
@.str.1 = [27 x i8] c"word too long... exiting.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %10
10: ; preds = %69, %2
%11 = call i32 (...) @getchar()
store i32 %11, i32* %8
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %76
14: ; preds = %10
%15 = load i32, i32* %8
%16 = icmp sge i32 %15, 48
br i1 %16, label %17, label %61
17: ; preds = %14
%18 = load i32, i32* %8
%19 = icmp sle i32 %18, 57
br i1 %19, label %20, label %61
20: ; preds = %17
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %22
store i8 0, i8* %23
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%25 = call i32 @puts(i8* %24)
store i32 0, i32* %9
br label %26
26: ; preds = %43, %20
%27 = load i32, i32* %9
%28 = mul nsw i32 %27, 10
store i32 %28, i32* %9
%29 = load i32, i32* %8
%30 = sub nsw i32 %29, 48
%31 = load i32, i32* %9
%32 = add nsw i32 %31, %30
store i32 %32, i32* %9
br label %33
33: ; preds = %26
%34 = call i32 (...) @getchar()
store i32 %34, i32* %8
%35 = load i32, i32* @EOF
%36 = icmp ne i32 %34, %35
br i1 %36, label %37, label %43
37: ; preds = %33
%38 = load i32, i32* %8
%39 = icmp sge i32 %38, 48
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* %8
%42 = icmp sle i32 %41, 57
br label %43
43: ; preds = %40, %37, %33
%44 = phi i1 [ false, %37 ], [ false, %33 ], [ %42, %40 ]
br i1 %44, label %26, label %45
45: ; preds = %43
%46 = load i32, i32* %9
%47 = load i32, i32* %7
%48 = sub nsw i32 %47, %46
store i32 %48, i32* %7
%49 = load i32, i32* %7
%50 = icmp slt i32 %49, 0
br i1 %50, label %55, label %51
51: ; preds = %45
%52 = load i32, i32* %7
%53 = sext i32 %52 to i64
%54 = icmp uge i64 %53, 255
br i1 %54, label %55, label %60
55: ; preds = %51, %45
%56 = load i32, i32* @stderr
%57 = load i32, i32* %7
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %57)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %51
br label %61
61: ; preds = %60, %17, %14
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = icmp uge i64 %63, 255
br i1 %64, label %65, label %69
65: ; preds = %61
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %61
%70 = load i32, i32* %8
%71 = trunc i32 %70 to i8
%72 = load i32, i32* %7
%73 = add nsw i32 %72, 1
store i32 %73, i32* %7
%74 = sext i32 %72 to i64
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %74
store i8 %71, i8* %75
br label %10
76: ; preds = %10
%77 = load i32, i32* %7
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %78
store i8 0, i8* %79
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%81 = call i32 @puts(i8* %80)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@stderr = global i32 0
@.str = [31 x i8] c"bad backlength %d... exiting.\0A\00"
@.str.1 = [27 x i8] c"word too long... exiting.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %54, label %8
8: ; preds = %2, %42
%9 = phi i32 [ %49, %42 ], [ %5, %2 ]
%10 = phi i32 [ %47, %42 ], [ 0, %2 ]
%11 = add i32 %9, -48
%12 = icmp ult i32 %11, 10
br i1 %12, label %13, label %36
13: ; preds = %8
%14 = zext i32 %10 to i64
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %14
store i8 0, i8* %15
%16 = call i32 @puts(i8* %4)
br label %17
17: ; preds = %17, %13
%18 = phi i32 [ %9, %13 ], [ %23, %17 ]
%19 = phi i32 [ 0, %13 ], [ %22, %17 ]
%20 = mul nsw i32 %19, 10
%21 = add nsw i32 %18, -48
%22 = add nsw i32 %21, %20
%23 = tail call i32 (...) @getchar()
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %23, %24
%26 = add i32 %23, -48
%27 = icmp ult i32 %26, 10
%28 = and i1 %27, %25
br i1 %28, label %17, label %29
29: ; preds = %17
%30 = sub nsw i32 %10, %22
%31 = icmp ugt i32 %30, 254
br i1 %31, label %32, label %42
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %30)
%35 = tail call i32 @exit(i32 1)
unreachable
36: ; preds = %8
%37 = icmp ugt i32 %10, 254
br i1 %37, label %38, label %42
38: ; preds = %36
%39 = load i32, i32* @stderr
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%41 = tail call i32 @exit(i32 1)
unreachable
42: ; preds = %29, %36
%43 = phi i32 [ %9, %36 ], [ %23, %29 ]
%44 = phi i32 [ %10, %36 ], [ %30, %29 ]
%45 = zext i32 %44 to i64
%46 = trunc i32 %43 to i8
%47 = add nuw nsw i32 %44, 1
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %45
store i8 %46, i8* %48
%49 = tail call i32 (...) @getchar()
%50 = load i32, i32* @EOF
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %8
52: ; preds = %42
%53 = zext i32 %47 to i64
br label %54
54: ; preds = %52, %2
%55 = phi i64 [ 0, %2 ], [ %53, %52 ]
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %55
store i8 0, i8* %56
%57 = call i32 @puts(i8* %4)
ret i32 0
}