#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 is_valid(int *);
int is_valid_int(char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char egn[12];
  int egn_int[10], i;
  scanf("%s", egn);
  if (strlen(egn) != 10) {
    printf("0\n");
  } else {
    for (i = 0; i < 10; i++) {
      egn_int[i] = is_valid_int(egn[i]);
      if (egn_int[i] == -1) {
        printf("0\n");
        return 0;
      }
    }
  }
  printf("%d\n", is_valid(egn_int));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xa,%eax
je     1194 <main+0x44>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fe <main+0xae>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11f9 <main+0xa9>
movslq -0x44(%rbp),%rax
movsbl -0x10(%rbp,%rax,1),%edi
call   1050 <is_valid_int@plt>
mov    %eax,%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
movslq -0x44(%rbp),%rax
cmpl   $0xffffffff,-0x40(%rbp,%rax,4)
jne    11e6 <main+0x96>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121e <main+0xce>
jmp    11eb <main+0x9b>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    119b <main+0x4b>
jmp    11fe <main+0xae>
lea    -0x40(%rbp),%rdi
call   1060 <is_valid@plt>
mov    %eax,%esi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <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    0xe94(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
jne    1262 <main+0x102>
movsbl 0x4(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x10(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0x5(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x14(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0x6(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x18(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0x7(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x1c(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0x8(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x20(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0x9(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x24(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0xa(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x28(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0xb(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x2c(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0xc(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x30(%rsp)
cmp    $0xffffffff,%eax
je     1254 <main+0xf4>
movsbl 0xd(%rsp),%edi
call   1060 <is_valid_int@plt>
mov    %eax,0x34(%rsp)
cmp    $0xffffffff,%eax
jne    126e <main+0x10e>
lea    0xdac(%rip),%rdi
call   1030 <puts@plt>
jmp    1288 <main+0x128>
lea    0xd9e(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
call   1070 <is_valid@plt>
lea    0xd84(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
%3 = alloca [10 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 ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %37
12: ; preds = %0
store i32 0, i32* %4
br label %13
13: ; preds = %33, %12
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %36
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 = call i32 @is_valid_int(i8 signext %20)
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %23
store i32 %21, i32* %24
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %16
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %41
32: ; preds = %16
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %13
36: ; preds = %13
br label %37
37: ; preds = %36, %10
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%39 = call i32 @is_valid(i32* %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %39)
store i32 0, i32* %1
br label %41
41: ; preds = %37, %30
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str.3 = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = alloca [10 x i32]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%4 = bitcast [10 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 %13
8: ; preds = %0
%9 = load i8, i8* %3
%10 = call i32 @is_valid_int(i8 signext %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32 %10, i32* %11
%12 = icmp eq i32 %10, -1
br i1 %12, label %69, label %15
13: ; preds = %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
br label %71
15: ; preds = %8
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 1
%17 = load i8, i8* %16
%18 = call i32 @is_valid_int(i8 signext %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
store i32 %18, i32* %19
%20 = icmp eq i32 %18, -1
br i1 %20, label %69, label %21
21: ; preds = %15
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 2
%23 = load i8, i8* %22
%24 = call i32 @is_valid_int(i8 signext %23)
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
store i32 %24, i32* %25
%26 = icmp eq i32 %24, -1
br i1 %26, label %69, label %27
27: ; preds = %21
%28 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 3
%29 = load i8, i8* %28
%30 = call i32 @is_valid_int(i8 signext %29)
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
store i32 %30, i32* %31
%32 = icmp eq i32 %30, -1
br i1 %32, label %69, label %33
33: ; preds = %27
%34 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 4
%35 = load i8, i8* %34
%36 = call i32 @is_valid_int(i8 signext %35)
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
store i32 %36, i32* %37
%38 = icmp eq i32 %36, -1
br i1 %38, label %69, label %39
39: ; preds = %33
%40 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 5
%41 = load i8, i8* %40
%42 = call i32 @is_valid_int(i8 signext %41)
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 5
store i32 %42, i32* %43
%44 = icmp eq i32 %42, -1
br i1 %44, label %69, label %45
45: ; preds = %39
%46 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 6
%47 = load i8, i8* %46
%48 = call i32 @is_valid_int(i8 signext %47)
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 6
store i32 %48, i32* %49
%50 = icmp eq i32 %48, -1
br i1 %50, label %69, label %51
51: ; preds = %45
%52 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 7
%53 = load i8, i8* %52
%54 = call i32 @is_valid_int(i8 signext %53)
%55 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 7
store i32 %54, i32* %55
%56 = icmp eq i32 %54, -1
br i1 %56, label %69, label %57
57: ; preds = %51
%58 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 8
%59 = load i8, i8* %58
%60 = call i32 @is_valid_int(i8 signext %59)
%61 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 8
store i32 %60, i32* %61
%62 = icmp eq i32 %60, -1
br i1 %62, label %69, label %63
63: ; preds = %57
%64 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 9
%65 = load i8, i8* %64
%66 = call i32 @is_valid_int(i8 signext %65)
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
store i32 %66, i32* %67
%68 = icmp eq i32 %66, -1
br i1 %68, label %69, label %71
69: ; preds = %63, %57, %51, %45, %39, %33, %27, %21, %15, %8
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
br label %75
71: ; preds = %63, %13
%72 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%73 = call i32 @is_valid(i32* %72)
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %73)
br label %75
75: ; preds = %71, %69
ret i32 0
}