#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 *, ...);
main() {
  int Cases, TotCases, Num1, Num2, Mod1, Mod2, bolean;
  scanf("%d", &TotCases);
  for (Cases = 0; Cases < TotCases; Cases++) {
    bolean = 0;
    scanf("%d%d", &Num1, &Num2);
    while (Num2 != 0) {
      Mod1 = Num1 % 10;
      Mod2 = Num2 % 10;
      Num1 = Num1 / 10;
      Num2 = Num2 / 10;
      if (Mod1 != Mod2) {
        printf("nao encaixa\n");
        bolean = 1;
        break;
      }
    }
    if (bolean != 1)
      printf("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    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1205 <main+0xe5>
movl   $0x0,-0x20(%rbp)
lea    0xe9e(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11dc <main+0xbc>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     11d7 <main+0xb7>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x20(%rbp)
jmp    11dc <main+0xbc>
jmp    1171 <main+0x51>
cmpl   $0x1,-0x20(%rbp)
je     11f2 <main+0xd2>
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
jmp    11f7 <main+0xd7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <main+0x28>
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>
cmpl   $0x0,0x14(%rsp)
jle    11f8 <main+0xd8>
lea    0xead(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%rbx
lea    0xea5(%rip),%r12
lea    0xe9a(%rip),%r13
xor    %ebp,%ebp
jmp    1181 <main+0x61>
nop
mov    %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0x14(%rsp),%ebp
jge    11f8 <main+0xd8>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x10(%rsp),%ecx
nopl   0x0(%rax)
test   %eax,%eax
je     1170 <main+0x50>
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edx
mov    %ecx,0x10(%rsp)
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
add    %edi,%esi
lea    (%rsi,%rsi,1),%edi
lea    (%rdi,%rdi,4),%edi
sub    %edi,%eax
mov    %esi,0xc(%rsp)
cmp    %eax,%edx
mov    %esi,%eax
je     11a0 <main+0x80>
mov    %r13,%rdi
jmp    1173 <main+0x53>
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 = [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
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
br label %10
10: ; preds = %40, %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %43
14: ; preds = %10
store i32 0, i32* %8
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
br label %16
16: ; preds = %33, %14
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %34
19: ; preds = %16
%20 = load i32, i32* %4
%21 = srem i32 %20, 10
store i32 %21, i32* %6
%22 = load i32, i32* %5
%23 = srem i32 %22, 10
store i32 %23, i32* %7
%24 = load i32, i32* %4
%25 = sdiv i32 %24, 10
store i32 %25, i32* %4
%26 = load i32, i32* %5
%27 = sdiv i32 %26, 10
store i32 %27, i32* %5
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = icmp ne i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %19
%32 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %8
br label %34
33: ; preds = %19
br label %16
34: ; preds = %31, %16
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 1
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
br label %40
40: ; preds = %39
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %10
43: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@str = [8 x i8] c"encaixa\00"
@str.4 = [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 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %31
10: ; preds = %0, %25
%11 = phi i32 [ %28, %25 ], [ 0, %0 ]
%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
br label %15
15: ; preds = %19, %10
%16 = phi i32 [ %22, %19 ], [ %14, %10 ]
%17 = phi i32 [ %23, %19 ], [ %13, %10 ]
%18 = icmp eq i32 %17, 0
br i1 %18, label %25, label %19
19: ; preds = %15
%20 = srem i32 %16, 10
%21 = srem i32 %17, 10
%22 = sdiv i32 %16, 10
store i32 %22, i32* %2
%23 = sdiv i32 %17, 10
store i32 %23, i32* %3
%24 = icmp eq i32 %20, %21
br i1 %24, label %15, label %25
25: ; preds = %15, %19
%26 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0), %19 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0), %15 ]
%27 = call i32 @puts(i8* dereferenceable(1) %26)
%28 = add nuw nsw i32 %11, 1
%29 = load i32, i32* %1
%30 = icmp slt i32 %28, %29
br i1 %30, label %10, label %31
31: ; preds = %25, %0
ret i32 0
}