#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char temp;
  int label = 0;
  int i = 0, j = 0, num = 0, a[10];
  printf("Please input a string:\n");
  temp = getchar();
  while (1) {
    if ((temp >= '0') && (temp <= '9')) {
      num = num * 10 + temp - 48;
      label = 1;
      temp = getchar();
    } else {
      if (label == 1) {
        a[i++] = num;
        num = 0;
        label = 0;
        j++;
      }
      if (temp == '\0' || (temp >= 9 && temp <= 13))
        break;
      temp = getchar();
    }
  }
  for (i = 0; i < j; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     11a3 <main+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     11a3 <main+0x83>
imul   $0xa,-0x18(%rbp),%eax
movsbl -0x5(%rbp),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
jmp    120e <main+0xee>
cmpl   $0x1,-0xc(%rbp)
jne    11d8 <main+0xb8>
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
cltq
mov    %ecx,-0x40(%rbp,%rax,4)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
je     11ff <main+0xdf>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jl     1204 <main+0xe4>
movsbl -0x5(%rbp),%eax
cmp    $0xd,%eax
jg     1204 <main+0xe4>
jmp    1213 <main+0xf3>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
jmp    1163 <main+0x43>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    124a <main+0x12a>
movslq -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    121a <main+0xfa>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
mov    $0x3e01,%r14d
xor    %r12d,%r12d
xor    %r15d,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     11a0 <main+0x60>
movzbl %al,%eax
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%ebx
add    $0xffffffd0,%ebx
mov    $0x1,%bpl
jmp    1180 <main+0x40>
test   $0x1,%bpl
je     11b6 <main+0x76>
movslq %r12d,%rcx
add    $0x1,%r12d
mov    %ebx,(%rsp,%rcx,4)
add    $0x1,%r15d
xor    %ebx,%ebx
cmp    $0xd,%al
ja     1170 <main+0x30>
movzbl %al,%eax
bt     %rax,%r14
jae    1170 <main+0x30>
test   %r15d,%r15d
jle    11f6 <main+0xb6>
mov    %r15d,%ebp
lea    0xe2e(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11e0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Please input a string:\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [10 x i32]
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %2
br label %10
10: ; preds = %0, %52
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 48
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 57
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %6
%20 = mul nsw i32 %19, 10
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = add nsw i32 %20, %22
%24 = sub nsw i32 %23, 48
store i32 %24, i32* %6
store i32 1, i32* %3
%25 = call signext i8 (...) @getchar()
store i8 %25, i8* %2
br label %52
26: ; preds = %14, %10
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load i32, i32* %6
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
%33 = sext i32 %31 to i64
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 %33
store i32 %30, i32* %34
store i32 0, i32* %6
store i32 0, i32* %3
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %37
37: ; preds = %29, %26
%38 = load i8, i8* %2
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 0
br i1 %40, label %49, label %41
41: ; preds = %37
%42 = load i8, i8* %2
%43 = sext i8 %42 to i32
%44 = icmp sge i32 %43, 9
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = load i8, i8* %2
%47 = sext i8 %46 to i32
%48 = icmp sle i32 %47, 13
br i1 %48, label %49, label %50
49: ; preds = %45, %37
br label %53
50: ; preds = %45, %41
%51 = call signext i8 (...) @getchar()
store i8 %51, i8* %2
br label %52
52: ; preds = %50, %18
br label %10
53: ; preds = %49
store i32 0, i32* %4
br label %54
54: ; preds = %64, %53
%55 = load i32, i32* %4
%56 = load i32, i32* %5
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %67
58: ; preds = %54
%59 = load i32, i32* %4
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %58
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 1
store i32 %66, i32* %4
br label %54
67: ; preds = %54
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
@str = [23 x i8] c"Please input a string:\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %0, %25
%5 = phi i32 [ 0, %0 ], [ %26, %25 ]
%6 = phi i32 [ 0, %0 ], [ %27, %25 ]
%7 = phi i32 [ 0, %0 ], [ %28, %25 ]
br label %8
8: ; preds = %4, %14
%9 = phi i1 [ true, %14 ], [ false, %4 ]
%10 = phi i32 [ %18, %14 ], [ %7, %4 ]
%11 = tail call signext i8 (...) @getchar()
%12 = add i8 %11, -48
%13 = icmp ult i8 %12, 10
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = zext i8 %11 to i32
%16 = mul nsw i32 %10, 10
%17 = add nsw i32 %15, -48
%18 = add i32 %17, %16
br label %8
19: ; preds = %8
br i1 %9, label %20, label %25
20: ; preds = %19
%21 = add nsw i32 %5, 1
%22 = sext i32 %5 to i64
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %22
store i32 %10, i32* %23
%24 = add nsw i32 %6, 1
br label %25
25: ; preds = %20, %19
%26 = phi i32 [ %21, %20 ], [ %5, %19 ]
%27 = phi i32 [ %24, %20 ], [ %6, %19 ]
%28 = phi i32 [ 0, %20 ], [ %10, %19 ]
switch i8 %11, label %4 [
i8 13, label %29
i8 12, label %29
i8 11, label %29
i8 10, label %29
i8 9, label %29
i8 0, label %29
]
29: ; preds = %25, %25, %25, %25, %25, %25
%30 = icmp sgt i32 %27, 0
br i1 %30, label %31, label %40
31: ; preds = %29
%32 = zext i32 %27 to i64
br label %33
33: ; preds = %31, %33
%34 = phi i64 [ 0, %31 ], [ %38, %33 ]
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = add nuw nsw i64 %34, 1
%39 = icmp eq i64 %38, %32
br i1 %39, label %40, label %33
40: ; preds = %33, %29
%41 = tail call i32 @putchar(i32 10)
ret i32 0
}