#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 /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int n;
  int a, b;
  scanf("%d", &n);
  while (n--) {
    scanf("%d%d", &a, &b);
    if (b > a) {
      printf("nao encaixa\n");
    } else if (b == a) {
      printf("encaixa\n");
    } else {
      while (b >= 10) {
        if (a % 10 != b % 10) {
          break;
        }
        a /= 10;
        b /= 10;
      }
      if (b == a % 10) {
        printf("encaixa\n");
      } else {
        printf("nao encaixa\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecc(%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     1248 <main+0x128>
lea    0xea4(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1188 <main+0x68>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
jmp    1243 <main+0x123>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11a5 <main+0x85>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    123e <main+0x11e>
jmp    11aa <main+0x8a>
cmpl   $0xa,-0x10(%rbp)
jl     1200 <main+0xe0>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x14(%rbp),%edx
cmp    %eax,%edx
je     11df <main+0xbf>
jmp    1200 <main+0xe0>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    11aa <main+0x8a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
cmp    %edx,%eax
jne    122d <main+0x10d>
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
jmp    1239 <main+0x119>
lea    0xdd1(%rip),%rdi
call   1030 <printf@plt>
jmp    123e <main+0x11e>
jmp    1243 <main+0x123>
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x20,%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    0xecd(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x14(%rsp)
jae    1159 <main+0x39>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea0(%rip),%rbx
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0xe94(%rip),%r13
mov    $0xcccccccd,%r14d
jmp    11be <main+0x9e>
mov    %ecx,%edx
mov    %ebp,%esi
movslq %edx,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cmp    %eax,%esi
mov    %r13,%rdi
lea    0xe62(%rip),%rax
cmove  %rax,%rdi
lea    0xe4e(%rip),%rbx
call   1030 <puts@plt>
subl   $0x1,0x14(%rsp)
jb     1148 <main+0x28>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebp
mov    0x10(%rsp),%ecx
mov    %r13,%rdi
cmp    %ecx,%ebp
jg     11b2 <main+0x92>
lea    0xe25(%rip),%rdi
je     11b2 <main+0x92>
cmp    $0xa,%ebp
jl     1179 <main+0x59>
nopl   0x0(%rax,%rax,1)
movslq %ecx,%rdi
imul   $0x66666667,%rdi,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edi
mov    %ebp,%esi
imul   %r14,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%ebx
lea    (%rbx,%rbx,4),%ebx
mov    %ebp,%eax
sub    %ebx,%eax
cmp    %eax,%edi
jne    1179 <main+0x59>
mov    %edx,0x10(%rsp)
mov    %esi,0xc(%rsp)
mov    %edx,%ecx
cmp    $0x63,%ebp
mov    %esi,%ebp
ja     11f0 <main+0xd0>
jmp    117d <main+0x5d>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [13 x i8] c"nao encaixa\0A\00"
@.str.3 = [9 x i8] c"encaixa\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %50, %0
%7 = load i32, i32* %2
%8 = add nsw i32 %7, -1
store i32 %8, i32* %2
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %51
10: ; preds = %6
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %50
17: ; preds = %10
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %49
23: ; preds = %17
br label %24
24: ; preds = %34, %23
%25 = load i32, i32* %4
%26 = icmp sge i32 %25, 10
br i1 %26, label %27, label %39
27: ; preds = %24
%28 = load i32, i32* %3
%29 = srem i32 %28, 10
%30 = load i32, i32* %4
%31 = srem i32 %30, 10
%32 = icmp ne i32 %29, %31
br i1 %32, label %33, label %34
33: ; preds = %27
br label %39
34: ; preds = %27
%35 = load i32, i32* %3
%36 = sdiv i32 %35, 10
store i32 %36, i32* %3
%37 = load i32, i32* %4
%38 = sdiv i32 %37, 10
store i32 %38, i32* %4
br label %24
39: ; preds = %33, %24
%40 = load i32, i32* %4
%41 = load i32, i32* %3
%42 = srem i32 %41, 10
%43 = icmp eq i32 %40, %42
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %48
46: ; preds = %39
%47 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
br label %49
49: ; preds = %48, %21
br label %50
50: ; preds = %49, %15
br label %6
51: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@str.5 = [8 x i8] c"encaixa\00"
@str.6 = [12 x i8] c"nao encaixa\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %42, label %11
11: ; preds = %0, %36
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp sgt i32 %13, %14
br i1 %15, label %36, label %16
16: ; preds = %11
%17 = icmp eq i32 %13, %14
br i1 %17, label %36, label %18
18: ; preds = %16
%19 = icmp sgt i32 %13, 9
br i1 %19, label %20, label %30
20: ; preds = %18, %28
%21 = phi i32 [ %26, %28 ], [ %13, %18 ]
%22 = phi i32 [ %24, %28 ], [ %14, %18 ]
%23 = srem i32 %22, 10
%24 = sdiv i32 %22, 10
%25 = urem i32 %21, 10
%26 = udiv i32 %21, 10
%27 = icmp eq i32 %23, %25
br i1 %27, label %28, label %30
28: ; preds = %20
store i32 %24, i32* %2
store i32 %26, i32* %3
%29 = icmp ugt i32 %21, 99
br i1 %29, label %20, label %30
30: ; preds = %28, %20, %18
%31 = phi i32 [ %14, %18 ], [ %22, %20 ], [ %24, %28 ]
%32 = phi i32 [ %13, %18 ], [ %21, %20 ], [ %26, %28 ]
%33 = srem i32 %31, 10
%34 = icmp eq i32 %32, %33
%35 = select i1 %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.6, i64 0, i64 0)
br label %36
36: ; preds = %30, %16, %11
%37 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.6, i64 0, i64 0), %11 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0), %16 ], [ %35, %30 ]
%38 = call i32 @puts(i8* dereferenceable(1) %37)
%39 = load i32, i32* %1
%40 = add nsw i32 %39, -1
store i32 %40, i32* %1
%41 = icmp eq i32 %39, 0
br i1 %41, label %42, label %11
42: ; preds = %36, %0
ret i32 0
}