#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 digit_10(int *);
int month(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int n[13], i = 0;
  char s[13];
  int flag = 1, fg = 1;
  scanf("%s", s);
  for (i = 0; i < 10; i++) {
    n[i] = s[i] - '0';
  }
  flag = month(n);
  if (digit_10(n) != n[9]) {
    fg = 0;
  }
  if (flag == 0 || fg == 0) {
    printf("0");
  } else {
    printf("1");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x1,-0x58(%rbp)
movl   $0x1,-0x5c(%rbp)
lea    -0x51(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1060 <scanf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11a7 <main+0x67>
movslq -0x44(%rbp),%rax
movsbl -0x51(%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    117b <main+0x3b>
lea    -0x40(%rbp),%rdi
call   1030 <month@plt>
mov    %eax,-0x58(%rbp)
lea    -0x40(%rbp),%rdi
call   1050 <digit_10@plt>
cmp    -0x1c(%rbp),%eax
je     11cc <main+0x8c>
movl   $0x0,-0x5c(%rbp)
cmpl   $0x0,-0x58(%rbp)
je     11e0 <main+0xa0>
cmpl   $0x0,-0x5c(%rbp)
jne    11f1 <main+0xb1>
lea    0xe1c(%rip),%rdi
call   1040 <printf@plt>
jmp    11fd <main+0xbd>
lea    0xe0d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
lea    0xec3(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
movd   (%rsp),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
psrad  $0x18,%xmm0
movdqa 0xe91(%rip),%xmm1
paddd  %xmm1,%xmm0
movdqa %xmm0,0x10(%rsp)
movd   0x4(%rsp),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
psrad  $0x18,%xmm0
paddd  %xmm1,%xmm0
movdqa %xmm0,0x20(%rsp)
movsbl 0x8(%rsp),%eax
add    $0xffffffd0,%eax
mov    %eax,0x30(%rsp)
movsbl 0x9(%rsp),%eax
add    $0xffffffd0,%eax
mov    %eax,0x34(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <month@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <digit_10@plt>
cmp    0x34(%rsp),%eax
setne  %al
test   %ebp,%ebp
sete   %cl
or     %al,%cl
movzbl %cl,%edi
xor    $0x31,%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"0\00"
@.str.2 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i32]
%3 = alloca i32
%4 = alloca [13 x i8]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %5
store i32 1, i32* %6
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %4, 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* %3
br label %9
9: ; preds = %22, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [13 x i8], [13 x i8]* %4, 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* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %20
store i32 %18, i32* %21
br label %22
22: ; preds = %12
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %9
25: ; preds = %9
%26 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 0
%27 = call i32 @month(i32* %26)
store i32 %27, i32* %5
%28 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 0
%29 = call i32 @digit_10(i32* %28)
%30 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 9
%31 = load i32, i32* %30
%32 = icmp ne i32 %29, %31
br i1 %32, label %33, label %34
33: ; preds = %25
store i32 0, i32* %6
br label %34
34: ; preds = %33, %25
%35 = load i32, i32* %5
%36 = icmp eq i32 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = load i32, i32* %6
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37, %34
%41 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %44
42: ; preds = %37
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
ret i32 0
}

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