#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__ fabs(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int q;
  scanf("%d", &q);
  for (int a0 = 0; a0 < q; a0++) {
    int cata;
    int catb;
    int mouse;
    scanf("%d %d %d", &cata, &catb, &mouse);
    if (fabs(mouse - cata) == fabs(mouse - catb)) {
      printf("Mouse C \n");
    }
    if (fabs(mouse - cata) > fabs(mouse - catb)) {
      printf("Cat B\n");
    }
    if (fabs(mouse - cata) < fabs(mouse - catb)) {
      printf("Cat A\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1233 <main+0x103>
lea    0xe95(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1040 <fabs@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1040 <fabs@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    11b4 <main+0x84>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1040 <fabs@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1040 <fabs@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jle    11ea <main+0xba>
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1040 <fabs@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1040 <fabs@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jge    1220 <main+0xf0>
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
jmp    1225 <main+0xf5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <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    $0x18,%rsp
lea    0xec1(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jle    1235 <main+0x105>
lea    0xe9d(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%rbx
xor    %r13d,%r13d
jmp    118f <main+0x5f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13d
cmp    0x14(%rsp),%r13d
jge    1235 <main+0x105>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%edi
sub    0x10(%rsp),%edi
call   1040 <fabs@plt>
mov    %rax,%rbp
mov    0x8(%rsp),%edi
sub    0xc(%rsp),%edi
call   1040 <fabs@plt>
cmp    %rax,%rbp
jne    11d0 <main+0xa0>
lea    0xe4a(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%edi
sub    0x10(%rsp),%edi
call   1040 <fabs@plt>
mov    %rax,%rbp
mov    0x8(%rsp),%edi
sub    0xc(%rsp),%edi
call   1040 <fabs@plt>
cmp    %rax,%rbp
jle    11fe <main+0xce>
lea    0xe16(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%edi
sub    0x10(%rsp),%edi
call   1040 <fabs@plt>
mov    %rax,%rbp
mov    0x8(%rsp),%edi
sub    0xc(%rsp),%edi
call   1040 <fabs@plt>
cmp    %rax,%rbp
jge    1180 <main+0x50>
lea    0xdde(%rip),%rdi
call   1030 <puts@plt>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%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 = [10 x i8] c"Mouse C \0A\00"
@.str.3 = [7 x i8] c"Cat B\0A\00"
@.str.4 = [7 x i8] c"Cat A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %8
8: ; preds = %50, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %53
12: ; preds = %8
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = sub nsw i32 %14, %15
%17 = call i64 @fabs(i32 %16)
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = sub nsw i32 %18, %19
%21 = call i64 @fabs(i32 %20)
%22 = icmp eq i64 %17, %21
br i1 %22, label %23, label %25
23: ; preds = %12
%24 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %12
%26 = load i32, i32* %6
%27 = load i32, i32* %4
%28 = sub nsw i32 %26, %27
%29 = call i64 @fabs(i32 %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %5
%32 = sub nsw i32 %30, %31
%33 = call i64 @fabs(i32 %32)
%34 = icmp sgt i64 %29, %33
br i1 %34, label %35, label %37
35: ; preds = %25
%36 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %25
%38 = load i32, i32* %6
%39 = load i32, i32* %4
%40 = sub nsw i32 %38, %39
%41 = call i64 @fabs(i32 %40)
%42 = load i32, i32* %6
%43 = load i32, i32* %5
%44 = sub nsw i32 %42, %43
%45 = call i64 @fabs(i32 %44)
%46 = icmp slt i64 %41, %45
br i1 %46, label %47, label %49
47: ; preds = %37
%48 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %47, %37
br label %50
50: ; preds = %49
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %8
53: ; preds = %8
ret i32 0
}

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