#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 scanf(char *, int *, int *, int *);
int main() {
  int y = 0;
  int m = 0;
  int d = 0;
  int cnt = 0;
  int day = 30;
  int days = 0;
  do {
    printf("Please year-month-day : ");
    cnt = scanf("%d-%d-%d", &y, &m, &d);
    if ((y % 400 != 0) || ((y % 4 == 0) && (y % 100 != 0))) {
      if (d != 28)
        continue;
    }
  } while (cnt != 3 || (m < 1 || m > 12 || d < 1));
  int j;
  for (j = 1; j < m; j++) {
    switch (j) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
      days += 31;
      break;
    case 4:
    case 6:
    case 9:
    case 11:
      days += 30;
      break;
    default:
      if ((y % 400 != 0) || ((y % 4 == 0) && (y % 100 != 0))) {
        days += 28;
      } else {
        days += 29;
      }
      break;
    }
  }
  days += d;
  printf("days of year : %d\n", days);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1e,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeab(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11be <main+0x9e>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d2 <main+0xb2>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11d2 <main+0xb2>
cmpl   $0x1c,-0x10(%rbp)
je     11cd <main+0xad>
jmp    11d7 <main+0xb7>
jmp    11d2 <main+0xb2>
jmp    11d7 <main+0xb7>
mov    $0x1,%al
cmpl   $0x3,-0x14(%rbp)
mov    %al,-0x21(%rbp)
jne    1214 <main+0xf4>
mov    $0x1,%al
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x22(%rbp)
jl     120e <main+0xee>
mov    $0x1,%al
cmpl   $0xc,-0xc(%rbp)
mov    %al,-0x22(%rbp)
jg     120e <main+0xee>
cmpl   $0x1,-0x10(%rbp)
setl   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1159 <main+0x39>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1369 <main+0x249>
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1,%eax
je     12e2 <main+0x1c2>
jmp    1246 <main+0x126>
mov    -0x28(%rbp),%eax
sub    $0x3,%eax
je     12e2 <main+0x1c2>
jmp    1257 <main+0x137>
mov    -0x28(%rbp),%eax
sub    $0x4,%eax
je     12f0 <main+0x1d0>
jmp    1268 <main+0x148>
mov    -0x28(%rbp),%eax
sub    $0x5,%eax
je     12e2 <main+0x1c2>
jmp    1279 <main+0x159>
mov    -0x28(%rbp),%eax
sub    $0x6,%eax
je     12f0 <main+0x1d0>
jmp    128a <main+0x16a>
mov    -0x28(%rbp),%eax
add    $0xfffffff9,%eax
sub    $0x2,%eax
jb     12e2 <main+0x1c2>
jmp    129e <main+0x17e>
mov    -0x28(%rbp),%eax
sub    $0x9,%eax
je     12f0 <main+0x1d0>
jmp    12af <main+0x18f>
mov    -0x28(%rbp),%eax
sub    $0xa,%eax
je     12e2 <main+0x1c2>
jmp    12c0 <main+0x1a0>
mov    -0x28(%rbp),%eax
sub    $0xb,%eax
je     12f0 <main+0x1d0>
jmp    12d1 <main+0x1b1>
mov    -0x28(%rbp),%eax
sub    $0xc,%eax
jne    12fe <main+0x1de>
jmp    12e2 <main+0x1c2>
mov    -0x1c(%rbp),%eax
add    $0x1f,%eax
mov    %eax,-0x1c(%rbp)
jmp    1356 <main+0x236>
mov    -0x1c(%rbp),%eax
add    $0x1e,%eax
mov    %eax,-0x1c(%rbp)
jmp    1356 <main+0x236>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    133a <main+0x21a>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1348 <main+0x228>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1348 <main+0x228>
mov    -0x1c(%rbp),%eax
add    $0x1c,%eax
mov    %eax,-0x1c(%rbp)
jmp    1351 <main+0x231>
mov    -0x1c(%rbp),%eax
add    $0x1d,%eax
mov    %eax,-0x1c(%rbp)
jmp    1356 <main+0x236>
jmp    135b <main+0x23b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1226 <main+0x106>
mov    -0x10(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xeb4(%rip),%r14
lea    0xec6(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1040 <scanf@plt>
cmp    $0x3,%eax
jne    1170 <main+0x50>
mov    0x8(%rsp),%eax
lea    -0xd(%rax),%ecx
cmp    $0xfffffff4,%ecx
jb     1170 <main+0x50>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    1170 <main+0x50>
xor    %esi,%esi
cmp    $0x2,%eax
jb     1222 <main+0x102>
mov    0xc(%rsp),%edx
imul   $0xc28f5c29,%edx,%esi
add    $0x51eb850,%esi
mov    %esi,%edi
ror    $0x4,%edi
cmp    $0xa3d70b,%edi
setae  %dil
test   $0x3,%dl
sete   %dl
ror    $0x2,%esi
cmp    $0x28f5c29,%esi
setae  %bl
and    %dl,%bl
or     %dil,%bl
movzbl %bl,%r9d
xor    $0x1d,%r9d
add    $0xffffffff,%eax
lea    0xe45(%rip),%rdi
xor    %ebx,%ebx
mov    $0xffd,%r8d
xor    %esi,%esi
jmp    120d <main+0xed>
nop
add    %edx,%esi
add    $0x4,%rdi
add    $0x1,%ebx
cmp    %ebx,%eax
je     1222 <main+0x102>
mov    %r9d,%edx
cmp    $0xb,%ebx
ja     1200 <main+0xe0>
bt     %ebx,%r8d
mov    %r9d,%edx
jae    1200 <main+0xe0>
mov    (%rdi),%edx
jmp    1200 <main+0xe0>
add    %ecx,%esi
lea    0xdf7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"Please year-month-day : \00"
@.str.1 = [9 x i8] c"%d-%d-%d\00"
@.str.2 = [19 x i8] c"days of year : %d\0A\00"
@switch.table.main = [12 x i32] [i32 31, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %7
7: ; preds = %11, %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%10 = icmp eq i32 %9, 3
br i1 %10, label %12, label %11
11: ; preds = %7, %12
br label %7
12: ; preds = %7
%13 = load i32, i32* %2
%14 = add i32 %13, -13
%15 = icmp ult i32 %14, -12
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 1
%18 = select i1 %15, i1 true, i1 %17
br i1 %18, label %11, label %19
19: ; preds = %12
%20 = icmp ugt i32 %13, 1
br i1 %20, label %21, label %51
21: ; preds = %19
%22 = load i32, i32* %1
%23 = srem i32 %22, 400
%24 = icmp ne i32 %23, 0
%25 = and i32 %22, 3
%26 = icmp eq i32 %25, 0
%27 = srem i32 %22, 100
%28 = icmp ne i32 %27, 0
%29 = and i1 %26, %28
%30 = select i1 %24, i1 true, i1 %29
%31 = select i1 %30, i32 28, i32 29
br label %32
32: ; preds = %21, %46
%33 = phi i32 [ 1, %21 ], [ %49, %46 ]
%34 = phi i32 [ 0, %21 ], [ %48, %46 ]
%35 = add nsw i32 %33, -1
%36 = icmp ult i32 %35, 12
br i1 %36, label %37, label %46
37: ; preds = %32
%38 = trunc i32 %35 to i16
%39 = lshr i16 4093, %38
%40 = and i16 %39, 1
%41 = icmp eq i16 %40, 0
br i1 %41, label %46, label %42
42: ; preds = %37
%43 = sext i32 %35 to i64
%44 = getelementptr inbounds [12 x i32], [12 x i32]* @switch.table.main, i64 0, i64 %43
%45 = load i32, i32* %44
br label %46
46: ; preds = %32, %37, %42
%47 = phi i32 [ %45, %42 ], [ %31, %37 ], [ %31, %32 ]
%48 = add nuw nsw i32 %34, %47
%49 = add nuw nsw i32 %33, 1
%50 = icmp eq i32 %49, %13
br i1 %50, label %51, label %32
51: ; preds = %46, %19
%52 = phi i32 [ 0, %19 ], [ %48, %46 ]
%53 = add nsw i32 %52, %16
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %53)
ret i32 0
}