#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int validation_for_checkpoint(int *);
int validation_for_months(int *);
int main() {
  char inp_egn[12];
  int pegn[12];
  int i, valid1 = -2, valid2 = -2;
  scanf("%s", inp_egn);
  for (i = 0; i < 10; i++) {
    pegn[i] = inp_egn[i] - '0';
  }
  valid1 = validation_for_months(pegn);
  valid2 = validation_for_checkpoint(pegn);
  if ((valid2 == pegn[9]) && valid1 == 1)
    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   1050 <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   1030 <validation_for_months@plt>
mov    %eax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
call   1060 <validation_for_checkpoint@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11df <main+0x9f>
cmpl   $0x1,-0x48(%rbp)
jne    11df <main+0x9f>
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
jmp    11eb <main+0xab>
lea    0xe1f(%rip),%rdi
call   1040 <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   1050 <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   1040 <validation_for_months@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <validation_for_checkpoint@plt>
xor    0x34(%rsp),%eax
xor    $0x1,%ebp
xor    %edi,%edi
or     %eax,%ebp
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 @validation_for_months(i32* %26)
store i32 %27, i32* %5
%28 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 0
%29 = call i32 @validation_for_checkpoint(i32* %28)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 9
%32 = load i32, i32* %31
%33 = icmp eq i32 %30, %32
br i1 %33, label %34, label %39
34: ; preds = %25
%35 = load i32, i32* %5
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %41
39: ; preds = %34, %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 @validation_for_months(i32* %6)
%30 = call i32 @validation_for_checkpoint(i32* %6)
%31 = load i32, i32* %28
%32 = icmp eq i32 %30, %31
%33 = icmp eq i32 %29, 1
%34 = select i1 %32, i1 %33, i1 false
%35 = select i1 %34, i32 49, i32 48
%36 = call i32 @putchar(i32 %35)
ret i32 0
}