#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 *, unsigned long *);
int t_day(int, int *, int);
int t_digit(int *);
int t_month(int *, int);
int main() {
  unsigned long int enter;
  int box[12] = {0};
  int i;
  int month;
  int day;
  scanf("%lu", &enter);
  while (enter != 0) {
    if (i < 10) {
      box[i] = enter % 10;
      enter = enter / 10;
      i++;
    } else {
      printf("0\n");
      return 0;
    }
  }
  month = (box[7] * 10) + box[6];
  day = (box[5] * 10) + box[4];
  if (month > 40) {
    month = month - 40;
  }
  if (month > 20) {
    month = month - 20;
  }
  if (t_month(box, month) == 1 && t_day(month, box, day) == 1 &&
      t_digit(box) == 1) {
    printf("1\n");
  } else {
    printf("0\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1070 <memset@plt>
lea    0xe7a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1080 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11f9 <main+0x99>
cmpl   $0xa,-0x44(%rbp)
jge    11dc <main+0x7c>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %edx,%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11f4 <main+0x94>
lea    0xe21(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1296 <main+0x136>
jmp    118f <main+0x2f>
imul   $0xa,-0x24(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x48(%rbp)
imul   $0xa,-0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x28,-0x48(%rbp)
jle    1220 <main+0xc0>
mov    -0x48(%rbp),%eax
sub    $0x28,%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x14,-0x48(%rbp)
jle    1233 <main+0xd3>
mov    -0x48(%rbp),%eax
sub    $0x14,%eax
mov    %eax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%esi
call   1030 <t_month@plt>
cmp    $0x1,%eax
jne    1283 <main+0x123>
mov    -0x48(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0x4c(%rbp),%edx
call   1040 <t_day@plt>
cmp    $0x1,%eax
jne    1283 <main+0x123>
lea    -0x40(%rbp),%rdi
call   1060 <t_digit@plt>
cmp    $0x1,%eax
jne    1283 <main+0x123>
lea    0xd8e(%rip),%rdi
call   1050 <printf@plt>
jmp    128f <main+0x12f>
lea    0xd7a(%rip),%rdi
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
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xe92(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
lea    0xe87(%rip),%rbx
cmpq   $0x0,0x8(%rsp)
jne    11c1 <main+0x71>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1040 <t_month@plt>
cmp    $0x1,%eax
jne    11c1 <main+0x71>
lea    0x10(%rsp),%rsi
xor    %edi,%edi
xor    %edx,%edx
call   1050 <t_day@plt>
cmp    $0x1,%eax
jne    11c1 <main+0x71>
lea    0x10(%rsp),%rdi
call   1060 <t_digit@plt>
cmp    $0x1,%eax
jne    11c1 <main+0x71>
lea    0xe43(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
@str.3 = [2 x i8] c"1\00"
@str.4 = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [12 x i32]
%3 = bitcast i64* %1 to i8*
%4 = bitcast [12 x i32]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%6 = load i64, i64* %1
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %0
%9 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 0
%10 = call i32 @t_month(i32* %9, i32 0)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = call i32 @t_day(i32 0, i32* %9, i32 0)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @t_digit(i32* %9)
%17 = icmp eq i32 %16, 1
br i1 %17, label %19, label %18
18: ; preds = %15, %12, %8
br label %19
19: ; preds = %15, %0, %18
%20 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), %18 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), %0 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0), %15 ]
%21 = call i32 @puts(i8* dereferenceable(1) %20)
ret i32 0
}