#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 check(unsigned int *);
unsigned int getchar();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  const unsigned int max = 10;
  unsigned int egn[max];
  unsigned int i;
  for (i = 0; i < max; ++i) {
    egn[i] = getchar() - '0';
  }
  printf("%d\n", check(egn));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jae    117f <main+0x4f>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
sub    $0x30,%ecx
mov    -0x14(%rbp),%eax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x24>
lea    -0x40(%rbp),%rdi
call   1050 <check@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0x4(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0x8(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0x18(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0x1c(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0x20(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0xffffffd0,%eax
mov    %eax,0x24(%rsp)
mov    %rsp,%rdi
call   1050 <check@plt>
lea    0xe32(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%5 = call i8* @llvm.stacksave()
store i8* %5, i8** %3
%6 = alloca i32, i64 10
store i32 0, i32* %4
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %4
%9 = icmp ult i32 %8, 10
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = call i32 (...) @getchar()
%12 = sub i32 %11, 48
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %6, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %10
%17 = load i32, i32* %4
%18 = add i32 %17, 1
store i32 %18, i32* %4
br label %7
19: ; preds = %7
%20 = call i32 @check(i32* %6)
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
store i32 0, i32* %1
%22 = load i8*, i8** %3
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = tail call i32 (...) @getchar()
%3 = add i32 %2, -48
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 %3, i32* %4
%5 = tail call i32 (...) @getchar()
%6 = add i32 %5, -48
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 %6, i32* %7
%8 = tail call i32 (...) @getchar()
%9 = add i32 %8, -48
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
store i32 %9, i32* %10
%11 = tail call i32 (...) @getchar()
%12 = add i32 %11, -48
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
store i32 %12, i32* %13
%14 = tail call i32 (...) @getchar()
%15 = add i32 %14, -48
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 %15, i32* %16
%17 = tail call i32 (...) @getchar()
%18 = add i32 %17, -48
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32 %18, i32* %19
%20 = tail call i32 (...) @getchar()
%21 = add i32 %20, -48
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
store i32 %21, i32* %22
%23 = tail call i32 (...) @getchar()
%24 = add i32 %23, -48
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
store i32 %24, i32* %25
%26 = tail call i32 (...) @getchar()
%27 = add i32 %26, -48
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 %27, i32* %28
%29 = tail call i32 (...) @getchar()
%30 = add i32 %29, -48
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 %30, i32* %31
%32 = call i32 @check(i32* %4)
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
ret i32 0
}