#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 n, c_date, c_mon, c_year, b_date, b_mon, b_year, age;
  int date, mon, year, total, i = 1;
  scanf("%d", &n);
  while (n--) {
    scanf("%d/%d/%d", &c_date, &c_mon, &c_year);
    scanf("%d/%d/%d", &b_date, &b_mon, &b_year);
    total = (c_year - b_year) * 365 + (c_mon - b_mon) * 30 + (c_date - b_date);
    if (total >= 0) {
      age = total / 365;
    } else {
      age = total;
    }
    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);
    }
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x38(%rbp)
lea    0xec9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     123f <main+0x11f>
lea    0xe9d(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe83(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
sub    -0x20(%rbp),%eax
imul   $0x16d,%eax,%eax
mov    -0x10(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
imul   $0x1e,%ecx,%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
sub    -0x18(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     11cf <main+0xaf>
mov    -0x34(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
jmp    11d5 <main+0xb5>
mov    -0x34(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    11f5 <main+0xd5>
mov    -0x38(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x111>
cmpl   $0x82,-0x24(%rbp)
jle    1218 <main+0xf8>
mov    -0x38(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122c <main+0x10c>
mov    -0x38(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x111>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x40,%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>
subl   $0x1,0xc(%rsp)
jae    1159 <main+0x39>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ebx
lea    0xe9b(%rip),%r14
lea    0x1c(%rsp),%r13
lea    0x18(%rsp),%rbp
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
jmp    119a <main+0x7a>
nopl   0x0(%rax,%rax,1)
lea    0xe82(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
subl   $0x1,0xc(%rsp)
jb     1148 <main+0x28>
mov    %r14,%rdi
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x1c(%rsp),%eax
sub    0x10(%rsp),%eax
imul   $0x16d,%eax,%eax
mov    0x20(%rsp),%ecx
sub    0x14(%rsp),%ecx
mov    %ecx,%esi
shl    $0x5,%esi
sub    %ecx,%esi
sub    %ecx,%esi
add    %eax,%esi
mov    0x24(%rsp),%edx
sub    0x18(%rsp),%edx
add    %esi,%edx
js     120b <main+0xeb>
movslq %edx,%rdx
imul   $0xffffffffb38cf9b1,%rdx,%rax
shr    $0x20,%rax
add    %eax,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0x8,%edx
add    %eax,%edx
test   %edx,%edx
js     1180 <main+0x60>
cmp    $0x83,%edx
jb     1230 <main+0x110>
lea    0xe05(%rip),%rdi
jmp    1187 <main+0x67>
nopw   0x0(%rax,%rax,1)
lea    0xe0c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1190 <main+0x70>

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