#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*/ clear_digits_array();
int getchar();
int /*<<< orphan*/ print_digits_array();
int /*<<< orphan*/ process_digit(int, int);
int main(void) {
  int digit = 0;
  clear_digits_array();
  while (digit < 7) {
    int input = getchar();
    if (input <= '9' && input >= '0') {
      process_digit(input, digit);
      digit += 1;
    } else if (input == '\n') {
      break;
    } else {
      continue;
    }
  }
  print_digits_array();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <clear_digits_array@plt>
cmpl   $0x7,-0x8(%rbp)
jge    11b7 <main+0x77>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x39,-0xc(%rbp)
jg     119e <main+0x5e>
cmpl   $0x30,-0xc(%rbp)
jl     119e <main+0x5e>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <process_digit@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b2 <main+0x72>
cmpl   $0xa,-0xc(%rbp)
jne    11ad <main+0x6d>
jmp    11b7 <main+0x77>
jmp    115d <main+0x1d>
jmp    115d <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   %rbx
xor    %eax,%eax
call   1050 <clear_digits_array@plt>
xor    %ebx,%ebx
jmp    1161 <main+0x21>
nopl   0x0(%rax)
mov    %eax,%edi
mov    %ebx,%esi
call   1060 <process_digit@plt>
add    $0x1,%ebx
cmp    $0x7,%ebx
jge    1175 <main+0x35>
xor    %eax,%eax
call   1040 <getchar@plt>
lea    -0x30(%rax),%ecx
cmp    $0x9,%ecx
jbe    1150 <main+0x10>
cmp    $0xa,%eax
jne    115c <main+0x1c>
xor    %eax,%eax
call   1030 <print_digits_array@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 (...) @clear_digits_array()
br label %5
5: ; preds = %26, %25, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 7
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = call i32 (...) @getchar()
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp sle i32 %10, 57
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 48
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = call i32 @process_digit(i32 %16, i32 %17)
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %26
21: ; preds = %12, %8
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 10
br i1 %23, label %24, label %25
24: ; preds = %21
br label %27
25: ; preds = %21
br label %5
26: ; preds = %15
br label %5
27: ; preds = %24, %5
%28 = call i32 (...) @print_digits_array()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @clear_digits_array()
br label %2
2: ; preds = %0, %12
%3 = phi i32 [ 0, %0 ], [ %13, %12 ]
%4 = tail call i32 (...) @getchar()
%5 = add i32 %4, -48
%6 = icmp ult i32 %5, 10
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @process_digit(i32 %4, i32 %3)
%9 = add nsw i32 %3, 1
br label %12
10: ; preds = %2
%11 = icmp eq i32 %4, 10
br i1 %11, label %15, label %12
12: ; preds = %10, %7
%13 = phi i32 [ %9, %7 ], [ %3, %10 ]
%14 = icmp slt i32 %13, 7
br i1 %14, label %2, label %15
15: ; preds = %10, %12
%16 = tail call i32 (...) @print_digits_array()
ret i32 0
}