#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, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int num_cases;
  int cur_year, cur_month, cur_day;
  int bir_year, bir_month, bir_day;
  int i, age;
  scanf("%d\n", &num_cases);
  for (i = 1; i <= num_cases; i++) {
    scanf("%2d/%2d/%4d\n", &cur_day, &cur_month, &cur_year);
    scanf("%2d/%2d/%4d\n", &bir_day, &bir_month, &bir_year);
    age = cur_year - bir_year;
    if ((cur_month < bir_month) ||
        (cur_month == bir_month && cur_day < bir_day))
      --age;
    if (age > 130)
      printf("Case #%d: Check birth date\n", i);
    else if (age < 0)
      printf("Case #%d: Invalid birth date\n", i);
    else
      printf("Case #%d: %d\n", i, age);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf1b(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     122d <main+0x10d>
lea    0xea5(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0xc(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe8b(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11b5 <main+0x95>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11be <main+0x9e>
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11be <main+0x9e>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x82,-0x28(%rbp)
jle    11e1 <main+0xc1>
mov    -0x24(%rbp),%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121a <main+0xfa>
cmpl   $0x0,-0x28(%rbp)
jge    1201 <main+0xe1>
mov    -0x24(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1215 <main+0xf5>
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121a <main+0xfa>
jmp    121f <main+0xff>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xf1c(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1216 <main+0xf6>
lea    0xead(%rip),%rbx
lea    0x24(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0x14(%rsp),%rbp
lea    0x18(%rsp),%r14
xor    %r15d,%r15d
jmp    118c <main+0x6c>
nopl   0x0(%rax)
lea    0xe96(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0xc(%rsp),%r15d
jge    1216 <main+0xf6>
mov    %rbx,%rdi
lea    0x1c(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x24(%rsp),%edx
sub    0x18(%rsp),%edx
mov    0x14(%rsp),%eax
cmp    %eax,0x20(%rsp)
jge    11d0 <main+0xb0>
add    $0xffffffff,%edx
jmp    11e0 <main+0xc0>
nopl   (%rax)
jne    11e0 <main+0xc0>
mov    0x1c(%rsp),%eax
cmp    0x10(%rsp),%eax
jl     11c8 <main+0xa8>
nopl   0x0(%rax)
add    $0x1,%r15d
cmp    $0x83,%edx
jge    1170 <main+0x50>
test   %edx,%edx
js     120a <main+0xea>
lea    0xe50(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0xc(%rsp),%r15d
jl     118c <main+0x6c>
jmp    1216 <main+0xf6>
lea    0xe18(%rip),%rdi
jmp    1177 <main+0x57>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [13 x i8] c"%2d/%2d/%4d\0A\00"
@.str.2 = [28 x i8] c"Case #%d: Check birth date\0A\00"
@.str.3 = [30 x i8] c"Case #%d: Invalid birth date\0A\00"
@.str.4 = [14 x i8] c"Case #%d: %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
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %9
br label %12
12: ; preds = %54, %0
%13 = load i32, i32* %9
%14 = load i32, i32* %2
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %57
16: ; preds = %12
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %4, i32* %3)
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %8, i32* %7, i32* %6)
%19 = load i32, i32* %3
%20 = load i32, i32* %6
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %10
%22 = load i32, i32* %4
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br i1 %24, label %33, label %25
25: ; preds = %16
%26 = load i32, i32* %4
%27 = load i32, i32* %7
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %36
29: ; preds = %25
%30 = load i32, i32* %5
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %29, %16
%34 = load i32, i32* %10
%35 = add nsw i32 %34, -1
store i32 %35, i32* %10
br label %36
36: ; preds = %33, %29, %25
%37 = load i32, i32* %10
%38 = icmp sgt i32 %37, 130
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %9
%41 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %53
42: ; preds = %36
%43 = load i32, i32* %10
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = load i32, i32* %9
%47 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %46)
br label %52
48: ; preds = %42
%49 = load i32, i32* %9
%50 = load i32, i32* %10
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %49, i32 %50)
br label %52
52: ; preds = %48, %45
br label %53
53: ; preds = %52, %39
br label %54
54: ; preds = %53
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %12
57: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [13 x i8] c"%2d/%2d/%4d\0A\00"
@.str.2 = [28 x i8] c"Case #%d: Check birth date\0A\00"
@.str.3 = [30 x i8] c"Case #%d: Invalid birth date\0A\00"
@.str.4 = [14 x i8] c"Case #%d: %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 = bitcast i32* %1 to i8*
%9 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = icmp slt i32 %16, 1
br i1 %17, label %51, label %18
18: ; preds = %0, %47
%19 = phi i32 [ %48, %47 ], [ 1, %0 ]
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %3, i32* %2)
%21 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %6, i32* %5)
%22 = load i32, i32* %2
%23 = load i32, i32* %5
%24 = sub nsw i32 %22, %23
%25 = load i32, i32* %3
%26 = load i32, i32* %6
%27 = icmp slt i32 %25, %26
br i1 %27, label %34, label %28
28: ; preds = %18
%29 = icmp eq i32 %25, %26
br i1 %29, label %30, label %36
30: ; preds = %28
%31 = load i32, i32* %4
%32 = load i32, i32* %7
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %36
34: ; preds = %30, %18
%35 = add nsw i32 %24, -1
br label %36
36: ; preds = %34, %30, %28
%37 = phi i32 [ %35, %34 ], [ %24, %30 ], [ %24, %28 ]
%38 = icmp sgt i32 %37, 130
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %47
41: ; preds = %36
%42 = icmp slt i32 %37, 0
br i1 %42, label %43, label %45
43: ; preds = %41
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %47
45: ; preds = %41
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %19, i32 %37)
br label %47
47: ; preds = %39, %45, %43
%48 = add nuw nsw i32 %19, 1
%49 = load i32, i32* %1
%50 = icmp slt i32 %19, %49
br i1 %50, label %18, label %51
51: ; preds = %47, %0
ret i32 0
}