#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*/ char_to_int(char);
int /*<<< orphan*/ clear_digits_array();
int /*<<< orphan*/ print_digits_array();
int /*<<< orphan*/ process_digit(int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char input_digit;
  int i = 0;
  clear_digits_array();
  while (i < 10) {
    scanf("%c", &input_digit);
    if (input_digit >= '0' && input_digit <= '9') {
      process_digit(char_to_int(input_digit), i);
      i++;
    } else if (input_digit == '\n')
      break;
  }
  print_digits_array();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <clear_digits_array@plt>
cmpl   $0xa,-0xc(%rbp)
jge    11de <main+0x8e>
lea    0xe82(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     11c2 <main+0x72>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     11c2 <main+0x72>
movsbl -0x5(%rbp),%edi
call   1040 <char_to_int@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%esi
call   1070 <process_digit@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d9 <main+0x89>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    11d4 <main+0x84>
jmp    11de <main+0x8e>
jmp    11d9 <main+0x89>
jmp    116d <main+0x1d>
mov    $0x0,%al
call   1030 <print_digits_array@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <clear_digits_array@plt>
lea    0xe97(%rip),%r14
lea    0xf(%rsp),%r15
jmp    1189 <main+0x39>
movsbl %al,%edi
call   1040 <char_to_int@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1070 <process_digit@plt>
add    $0x1,%ebx
cmp    $0xa,%ebx
jge    11a5 <main+0x55>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
movzbl 0xf(%rsp),%eax
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
jbe    1170 <main+0x20>
cmp    $0xa,%al
jne    1184 <main+0x34>
xor    %eax,%eax
call   1030 <print_digits_array@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 (...) @clear_digits_array()
br label %5
5: ; preds = %30, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %31
8: ; preds = %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp sge i32 %11, 48
br i1 %12, label %13, label %24
13: ; preds = %8
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp sle i32 %15, 57
br i1 %16, label %17, label %24
17: ; preds = %13
%18 = load i8, i8* %2
%19 = call i32 @char_to_int(i8 signext %18)
%20 = load i32, i32* %3
%21 = call i32 @process_digit(i32 %19, i32 %20)
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %30
24: ; preds = %13, %8
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 10
br i1 %27, label %28, label %29
28: ; preds = %24
br label %31
29: ; preds = %24
br label %30
30: ; preds = %29, %17
br label %5
31: ; preds = %28, %5
%32 = call i32 (...) @print_digits_array()
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (...) @clear_digits_array()
br label %3
3: ; preds = %0, %15
%4 = phi i32 [ 0, %0 ], [ %16, %15 ]
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
%7 = add i8 %6, -48
%8 = icmp ult i8 %7, 10
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = call i32 @char_to_int(i8 signext %6)
%11 = call i32 @process_digit(i32 %10, i32 %4)
%12 = add nsw i32 %4, 1
br label %15
13: ; preds = %3
%14 = icmp eq i8 %6, 10
br i1 %14, label %18, label %15
15: ; preds = %13, %9
%16 = phi i32 [ %12, %9 ], [ %4, %13 ]
%17 = icmp slt i32 %16, 10
br i1 %17, label %3, label %18
18: ; preds = %13, %15
%19 = call i32 (...) @print_digits_array()
ret i32 0
}