#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_legit(int, int, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char egn[12];
  int year_int = 0, month_int = 0;
  scanf("%s", egn);
  int i;
  for (i = 0; i < 2; i++) {
    year_int = year_int * 10 + (egn[i] - '0');
  }
  for (i = 2; i < 4; i++) {
    month_int = month_int * 10 + (egn[i] - '0');
  }
  printf("%d", is_legit(month_int, year_int, egn));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x10(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1191 <main+0x61>
imul   $0xa,-0x14(%rbp),%eax
movslq -0x1c(%rbp),%rcx
movsbl -0x10(%rbp,%rcx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1164 <main+0x34>
movl   $0x2,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11c5 <main+0x95>
imul   $0xa,-0x18(%rbp),%eax
movslq -0x1c(%rbp),%rcx
movsbl -0x10(%rbp,%rcx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1198 <main+0x68>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0x10(%rbp),%rdx
call   1040 <is_legit@plt>
mov    %eax,%esi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
movsbl 0x4(%rsp),%eax
lea    (%rax,%rax,4),%eax
movsbl 0x5(%rsp),%ecx
movsbl 0x6(%rsp),%edx
lea    (%rdx,%rdx,4),%edx
movsbl 0x7(%rsp),%esi
lea    (%rsi,%rdx,2),%edi
add    $0xfffffdf0,%edi
lea    (%rcx,%rax,2),%esi
add    $0xfffffdf0,%esi
mov    %rbx,%rdx
call   1040 <is_legit@plt>
lea    0xe7f(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = mul nsw i32 %5, 10
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 1
%8 = load i8, i8* %7
%9 = add nsw i32 %6, -528
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = mul nsw i32 %12, 10
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = add nsw i32 %13, -528
%18 = add nsw i32 %17, %16
%19 = sext i8 %8 to i32
%20 = add nsw i32 %9, %19
%21 = call i32 @is_legit(i32 %18, i32 %20, i8* %2)
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %21)
ret i32 0
}