#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int, ...);
scalar_t__ scanf(char *, ...);
int main(void) {
  int i = 0, d1, m1, y1, d2, m2, y2, age;
  scanf("%*d");
  while (scanf("%d/%d/%d %d/%d/%d", &d1, &m1, &y1, &d2, &m2, &y2) != EOF) {
    age = y1 - y2 - (m1 < m2 || (m1 == m2 && d1 < d2));
    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    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
lea    -0x1c(%rbp),%r9
lea    -0x20(%rbp),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <scanf@plt>
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%rax
je     123f <main+0x11f>
mov    -0x14(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%ecx
mov    $0x1,%al
cmp    -0x1c(%rbp),%ecx
mov    %al,-0x25(%rbp)
jl     11bb <main+0x9b>
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x1c(%rbp),%ecx
mov    %al,-0x2d(%rbp)
jne    11b5 <main+0x95>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
setl   %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
mov    %al,-0x25(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x25(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    11f2 <main+0xd2>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x8(%rbp)
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123a <main+0x11a>
cmpl   $0x82,-0x24(%rbp)
jle    121b <main+0xfb>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x8(%rbp)
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x8(%rbp)
mov    -0x24(%rbp),%edx
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123a <main+0x11a>
jmp    1144 <main+0x24>
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    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
lea    0xeb8(%rip),%rdi
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x14(%rsp),%r9
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x2e75(%rip),%r12
cmp    (%r12),%rax
jne    118a <main+0x6a>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x20(%rsp),%r13
lea    0x1c(%rsp),%rbx
lea    0x18(%rsp),%rbp
lea    0x14(%rsp),%r14
xor    %r15d,%r15d
jmp    11ef <main+0xcf>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe5f(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
lea    0xe33(%rip),%rdi
lea    0x24(%rsp),%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    (%r12),%rax
je     1179 <main+0x59>
mov    0x1c(%rsp),%edx
sub    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    $0x1,%al
cmp    %ecx,0x20(%rsp)
jl     1213 <main+0xf3>
sete   %cl
mov    0x24(%rsp),%eax
cmp    0x18(%rsp),%eax
setl   %al
and    %cl,%al
movzbl %al,%eax
add    $0x1,%r15d
sub    %eax,%edx
js     11b0 <main+0x90>
cmp    $0x83,%edx
jb     1230 <main+0x110>
lea    0xe07(%rip),%rdi
jmp    11b7 <main+0x97>
nop
lea    0xe19(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11c1 <main+0xa1>

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

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