#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 control_digit_validation(int *);
int date_validation(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char entered_EGN[12];
  int real_EGN[12], counter, validation_one = -2, validation_two = -2;
  scanf("%s", entered_EGN);
  for (counter = 0; counter < 10; counter++) {
    real_EGN[counter] = entered_EGN[counter] - '0';
  }
  validation_one = date_validation(real_EGN);
  validation_two = control_digit_validation(real_EGN);
  if (validation_one == 1 && (validation_two == real_EGN[9]))
    printf("1");
  else
    printf("0");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffffe,-0x48(%rbp)
movl   $0xfffffffe,-0x4c(%rbp)
lea    -0x10(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1060 <scanf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11a0 <main+0x60>
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    1174 <main+0x34>
lea    -0x40(%rbp),%rdi
call   1050 <date_validation@plt>
mov    %eax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <control_digit_validation@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x1,-0x48(%rbp)
jne    11df <main+0x9f>
mov    -0x4c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11df <main+0x9f>
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
jmp    11eb <main+0xab>
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
lea    0xec3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movd   0x4(%rsp),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
psrad  $0x18,%xmm0
movdqa 0xe8e(%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),%rbx
mov    %rbx,%rdi
call   1050 <date_validation@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <control_digit_validation@plt>
xor    $0x1,%ebp
xor    0x34(%rsp),%eax
xor    %edi,%edi
or     %ebp,%eax
sete   %dil
or     $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\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 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 0
%7 = bitcast [12 x i8]* %1 to <4 x i8>*
%8 = load <4 x i8>, <4 x i8>* %7
%9 = sext <4 x i8> %8 to <4 x i32>
%10 = add nsw <4 x i32> %9, <i32 -48, i32 -48, i32 -48, i32 -48>
%11 = bitcast [12 x i32]* %2 to <4 x i32>*
store <4 x i32> %10, <4 x i32>* %11
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 4
%13 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 4
%14 = bitcast i8* %12 to <4 x i8>*
%15 = load <4 x i8>, <4 x i8>* %14
%16 = sext <4 x i8> %15 to <4 x i32>
%17 = add nsw <4 x i32> %16, <i32 -48, i32 -48, i32 -48, i32 -48>
%18 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %18
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 8
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = add nsw i32 %21, -48
%23 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 8
store i32 %22, i32* %23
%24 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 9
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = add nsw i32 %26, -48
%28 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 9
store i32 %27, i32* %28
%29 = call i32 @date_validation(i32* %6)
%30 = call i32 @control_digit_validation(i32* %6)
%31 = icmp eq i32 %29, 1
%32 = load i32, i32* %28
%33 = icmp eq i32 %30, %32
%34 = select i1 %31, i1 %33, i1 false
%35 = select i1 %34, i32 49, i32 48
%36 = call i32 @putchar(i32 %35)
ret i32 0
}