#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 t, i, a1, b1, c1, a2, b2, c2;
  char a, b, c, d;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    scanf("%d %c %d %c %d %d %c %d %c %d", &a1, &a, &b1, &b, &c1, &a2, &c, &b2,
          &d, &c2);
    if (a2 > a1)
      b2 += 1;
    if (b2 > b1)
      c2 += 1;
    int age = c1 - c2;
    if (age < 0)
      printf("Case #%d: Invalid birth date\n", i);
    else if (age > 130)
      printf("Case #%d: Check birth date\n", i);
    else
      printf("Case #%d: %d\n", i, age);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
movl   $0x0,-0x14(%rbp)
lea    0xee2(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1247 <main+0x127>
lea    0xea2(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x35(%rbp),%rdx
lea    -0x24(%rbp),%rcx
lea    -0x36(%rbp),%r8
lea    -0x28(%rbp),%r9
lea    -0x2c(%rbp),%r14
lea    -0x37(%rbp),%rbx
lea    -0x30(%rbp),%r11
lea    -0x38(%rbp),%r10
lea    -0x34(%rbp),%rax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    11ba <main+0x9a>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    11cf <main+0xaf>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%eax
sub    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    11f8 <main+0xd8>
mov    -0x1c(%rbp),%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1234 <main+0x114>
cmpl   $0x82,-0x3c(%rbp)
jle    121b <main+0xfb>
mov    -0x1c(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0x10f>
mov    -0x1c(%rbp),%esi
mov    -0x3c(%rbp),%edx
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1234 <main+0x114>
jmp    1239 <main+0x119>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <main+0x2b>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xee6(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jle    123c <main+0x11c>
lea    0xb(%rsp),%r12
lea    0x20(%rsp),%r13
lea    0xa(%rsp),%r15
lea    0x1c(%rsp),%rbp
xor    %r14d,%r14d
jmp    118c <main+0x6c>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xea7(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0x14(%rsp),%r14d
jge    123c <main+0x11c>
sub    $0x8,%rsp
lea    0xe69(%rip),%rdi
lea    0x2c(%rsp),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r15,%r8
mov    %rbp,%r9
xor    %eax,%eax
lea    0x14(%rsp),%rbx
push   %rbx
lea    0x18(%rsp),%rbx
push   %rbx
lea    0x28(%rsp),%rbx
push   %rbx
lea    0x29(%rsp),%rbx
push   %rbx
lea    0x40(%rsp),%rbx
push   %rbx
call   1040 <scanf@plt>
add    $0x30,%rsp
mov    0x18(%rsp),%eax
mov    0x10(%rsp),%ecx
cmp    0x24(%rsp),%eax
jle    11e6 <main+0xc6>
add    $0x1,%ecx
mov    %ecx,0x10(%rsp)
mov    0xc(%rsp),%eax
cmp    0x20(%rsp),%ecx
jle    11f7 <main+0xd7>
add    $0x1,%eax
mov    %eax,0xc(%rsp)
add    $0x1,%r14d
mov    0x1c(%rsp),%edx
sub    %eax,%edx
js     1170 <main+0x50>
cmp    $0x83,%edx
jb     1220 <main+0x100>
lea    0xe26(%rip),%rdi
jmp    1177 <main+0x57>
nopl   0x0(%rax,%rax,1)
lea    0xe31(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0x14(%rsp),%r14d
jl     118c <main+0x6c>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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