#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 scanf(char *, int *, ...);
int main() {
  int d1, d2, m1, m2, y1, y2, age, t, i;
  while (scanf("%d", &t) == 1) {
    for (i = 1; i <= t; i++) {
      scanf("%d/%d/%d", &d2, &m2, &y2);
      scanf("%d/%d/%d", &d1, &m1, &y1);
      if (d1 > d2) {
        d2 = d2 + 30;
        m1 = m1 + 1;
      }
      if (m1 > m2) {
        m2 = m2 + 12;
        y1 = y1 + 1;
      }
      age = y2 - y1;
      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
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    124a <main+0x12a>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1245 <main+0x125>
lea    0xe9c(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe82(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11af <main+0x8f>
mov    -0xc(%rbp),%eax
add    $0x1e,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11cd <main+0xad>
mov    -0x14(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    11f6 <main+0xd6>
mov    -0x28(%rbp),%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
cmpl   $0x82,-0x20(%rbp)
jle    1219 <main+0xf9>
mov    -0x28(%rbp),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122d <main+0x10d>
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1232 <main+0x112>
jmp    1237 <main+0x117>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1151 <main+0x31>
jmp    112f <main+0xf>
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    0xed1(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1266 <main+0x146>
lea    0xeaf(%rip),%rbx
lea    0x20(%rsp),%rbp
lea    0x24(%rsp),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
jmp    118c <main+0x6c>
nopw   0x0(%rax,%rax,1)
lea    0xe8f(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1266 <main+0x146>
cmpl   $0x0,0xc(%rsp)
jle    1170 <main+0x50>
xor    %r13d,%r13d
jmp    11b8 <main+0x98>
nopl   0x0(%rax,%rax,1)
lea    0xe62(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    0xc(%rsp),%r13d
jge    1170 <main+0x50>
mov    %rbx,%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x1c(%rsp),%eax
cmp    %eax,0x24(%rsp)
jle    1200 <main+0xe0>
add    $0x1e,%eax
mov    %eax,0x1c(%rsp)
mov    0x14(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x14(%rsp)
jmp    1204 <main+0xe4>
mov    0x14(%rsp),%eax
mov    0x18(%rsp),%ecx
cmp    %ecx,%eax
jle    1220 <main+0x100>
add    $0xc,%ecx
mov    %ecx,0x18(%rsp)
mov    0x10(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x10(%rsp)
jmp    1224 <main+0x104>
mov    0x10(%rsp),%eax
add    $0x1,%r13d
mov    0x20(%rsp),%edx
sub    %eax,%edx
js     11a0 <main+0x80>
cmp    $0x83,%edx
jb     1250 <main+0x130>
lea    0xde4(%rip),%rdi
jmp    11a7 <main+0x87>
nopl   0x0(%rax,%rax,1)
lea    0xdec(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11b1 <main+0x91>
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 = [9 x i8] c"%d/%d/%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 i32
store i32 0, i32* %1
br label %11
11: ; preds = %63, %0
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %64
14: ; preds = %11
store i32 1, i32* %10
br label %15
15: ; preds = %60, %14
%16 = load i32, i32* %10
%17 = load i32, i32* %9
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %63
19: ; preds = %15
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %5, i32* %7)
%21 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %4, i32* %6)
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %30
25: ; preds = %19
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 30
store i32 %27, i32* %3
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %30
30: ; preds = %25, %19
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 12
store i32 %36, i32* %5
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %39
39: ; preds = %34, %30
%40 = load i32, i32* %7
%41 = load i32, i32* %6
%42 = sub nsw i32 %40, %41
store i32 %42, i32* %8
%43 = load i32, i32* %8
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %39
%46 = load i32, i32* %10
%47 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %46)
br label %59
48: ; preds = %39
%49 = load i32, i32* %8
%50 = icmp sgt i32 %49, 130
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i32, i32* %10
%53 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %52)
br label %58
54: ; preds = %48
%55 = load i32, i32* %10
%56 = load i32, i32* %8
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %55, i32 %56)
br label %58
58: ; preds = %54, %51
br label %59
59: ; preds = %58, %45
br label %60
60: ; preds = %59
%61 = load i32, i32* %10
%62 = add nsw i32 %61, 1
store i32 %62, i32* %10
br label %15
63: ; preds = %15
br label %11
64: ; preds = %11
ret i32 0
}

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