#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_UCN_validity(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char string[12];
  int UCN[12];
  scanf("%s", string);
  if (strlen(string) != 10) {
    printf("0");
    return 0;
  }
  for (int i = 0; i < 10; i++)
    UCN[i] = string[i] - '0';
  printf("%d", check_UCN_validity(UCN));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
je     118b <main+0x4b>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11de <main+0x9e>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11be <main+0x7e>
movslq -0x44(%rbp),%rax
movsbl -0x10(%rbp,%rax,1),%ecx
sub    $0x30,%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1192 <main+0x52>
lea    -0x40(%rbp),%rdi
call   1030 <check_UCN_validity@plt>
mov    %eax,%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    $0xa,%eax
jne    11ec <main+0x9c>
movd   0x4(%rsp),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
psrad  $0x18,%xmm0
movdqa 0xe6f(%rip),%xmm1
paddd  %xmm1,%xmm0
movdqa %xmm0,0x10(%rsp)
movd   0x8(%rsp),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
psrad  $0x18,%xmm0
paddd  %xmm1,%xmm0
movdqa %xmm0,0x20(%rsp)
movsbl 0xc(%rsp),%eax
add    $0xffffffd0,%eax
mov    %eax,0x30(%rsp)
movsbl 0xd(%rsp),%eax
add    $0xffffffd0,%eax
mov    %eax,0x34(%rsp)
lea    0x10(%rsp),%rdi
call   1040 <check_UCN_validity@plt>
lea    0xe32(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11f6 <main+0xa6>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = alloca [12 x i32]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%4 = bitcast [12 x i32]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @strlen(i8* %3)
%7 = icmp eq i32 %6, 10
br i1 %7, label %8, label %34
8: ; preds = %0
%9 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 0
%10 = bitcast [12 x i8]* %1 to <4 x i8>*
%11 = load <4 x i8>, <4 x i8>* %10
%12 = sext <4 x i8> %11 to <4 x i32>
%13 = add nsw <4 x i32> %12, <i32 -48, i32 -48, i32 -48, i32 -48>
%14 = bitcast [12 x i32]* %2 to <4 x i32>*
store <4 x i32> %13, <4 x i32>* %14
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 4
%16 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 4
%17 = bitcast i8* %15 to <4 x i8>*
%18 = load <4 x i8>, <4 x i8>* %17
%19 = sext <4 x i8> %18 to <4 x i32>
%20 = add nsw <4 x i32> %19, <i32 -48, i32 -48, i32 -48, i32 -48>
%21 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> %20, <4 x i32>* %21
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 8
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = add nsw i32 %24, -48
%26 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 8
store i32 %25, i32* %26
%27 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 9
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = add nsw i32 %29, -48
%31 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 9
store i32 %30, i32* %31
%32 = call i32 @check_UCN_validity(i32* %9)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %36
34: ; preds = %0
%35 = call i32 @putchar(i32 48)
br label %36
36: ; preds = %8, %34
ret i32 0
}