#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int strlen(char *);
int main() {
  int i, day = 0;
  char s[20];
  gets(s);
  if (s[5] == 'w') {
    if ((int)s[0] - 48 < 5 || (int)s[0] - 48 == 7) {
      printf("52\n");
    } else {
      printf("53\n");
    }
  } else {
    if (strlen(s) == 10) {
      if ((int)s[0] - 48 <= 29) {
        printf("12\n");
      } else if ((int)s[0] - 48 == 30) {
        printf("11\n");
      } else {
        printf("7\n");
      }
    } else {
      day = (int)s[0] - 48;
      day *= 10;
      day += (int)s[1] - 48;
      if (day <= 29) {
        printf("12\n");
      } else if (day == 30) {
        printf("11\n");
      } else {
        printf("7\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <gets@plt>
movsbl -0x1b(%rbp),%eax
cmp    $0x77,%eax
jne    119e <main+0x6e>
movsbl -0x20(%rbp),%eax
sub    $0x30,%eax
cmp    $0x5,%eax
jl     117c <main+0x4c>
movsbl -0x20(%rbp),%eax
sub    $0x30,%eax
cmp    $0x7,%eax
jne    118d <main+0x5d>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
jmp    1199 <main+0x69>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
jmp    1277 <main+0x147>
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xa,%eax
jne    1208 <main+0xd8>
movsbl -0x20(%rbp),%eax
sub    $0x30,%eax
cmp    $0x1d,%eax
jg     11d1 <main+0xa1>
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
jmp    1203 <main+0xd3>
movsbl -0x20(%rbp),%eax
sub    $0x30,%eax
cmp    $0x1e,%eax
jne    11f2 <main+0xc2>
lea    0xe24(%rip),%rdi
call   1040 <printf@plt>
jmp    11fe <main+0xce>
lea    0xe17(%rip),%rdi
call   1040 <printf@plt>
jmp    1203 <main+0xd3>
jmp    1272 <main+0x142>
movsbl -0x20(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
movsbl -0x1f(%rbp),%eax
sub    $0x30,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1d,-0xc(%rbp)
jg     1241 <main+0x111>
lea    0xdd1(%rip),%rdi
call   1040 <printf@plt>
jmp    126d <main+0x13d>
cmpl   $0x1e,-0xc(%rbp)
jne    125c <main+0x12c>
lea    0xdba(%rip),%rdi
call   1040 <printf@plt>
jmp    1268 <main+0x138>
lea    0xdad(%rip),%rdi
call   1040 <printf@plt>
jmp    126d <main+0x13d>
jmp    1272 <main+0x142>
jmp    1277 <main+0x147>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    %rsp,%rdi
call   1050 <gets@plt>
cmpb   $0x77,0x5(%rsp)
jne    1162 <main+0x32>
mov    (%rsp),%al
cmp    $0x37,%al
lea    0xebc(%rip),%rcx
lea    0xeb2(%rip),%rdi
cmove  %rcx,%rdi
cmp    $0x35,%al
cmovl  %rcx,%rdi
jmp    11aa <main+0x7a>
mov    %rsp,%rdi
call   1040 <strlen@plt>
movsbl (%rsp),%ecx
cmp    $0xa,%eax
jne    117d <main+0x4d>
cmp    $0x4e,%cl
jl     118f <main+0x5f>
cmp    $0x4e,%cl
jmp    1198 <main+0x68>
lea    (%rcx,%rcx,4),%eax
movsbl 0x1(%rsp),%ecx
lea    (%rcx,%rax,2),%eax
cmp    $0x22e,%eax
jge    1198 <main+0x68>
lea    0xe6f(%rip),%rdi
jmp    11aa <main+0x7a>
lea    0xe63(%rip),%rax
lea    0xe5a(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@str.7 = [2 x i8] c"7\00"
@str.8 = [3 x i8] c"11\00"
@str.9 = [3 x i8] c"12\00"
@str.10 = [3 x i8] c"53\00"
@str.11 = [3 x i8] c"52\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 5
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 119
br i1 %6, label %7, label %13
7: ; preds = %0
%8 = load i8, i8* %2
%9 = icmp slt i8 %8, 53
%10 = icmp eq i8 %8, 55
%11 = or i1 %9, %10
%12 = select i1 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.10, i64 0, i64 0)
br label %33
13: ; preds = %0
%14 = call i32 @strlen(i8* %2)
%15 = icmp eq i32 %14, 10
%16 = load i8, i8* %2
br i1 %15, label %17, label %22
17: ; preds = %13
%18 = icmp slt i8 %16, 78
br i1 %18, label %33, label %19
19: ; preds = %17
%20 = icmp eq i8 %16, 78
%21 = select i1 %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0)
br label %33
22: ; preds = %13
%23 = sext i8 %16 to i32
%24 = mul nsw i32 %23, 10
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = add nsw i32 %24, %27
%29 = icmp slt i32 %28, 558
br i1 %29, label %33, label %30
30: ; preds = %22
%31 = icmp eq i32 %28, 558
%32 = select i1 %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0)
br label %33
33: ; preds = %30, %22, %19, %17, %7
%34 = phi i8* [ %12, %7 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.9, i64 0, i64 0), %17 ], [ %21, %19 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.9, i64 0, i64 0), %22 ], [ %32, %30 ]
%35 = call i32 @puts(i8* dereferenceable(1) %34)
ret i32 0
}