#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 editDistance(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    char a[10001];
    char b[10001];
    scanf("%s", a);
    scanf("%s", b);
    printf("%d\n", editDistance(a, b));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%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     11b8 <main+0x88>
lea    -0x2720(%rbp),%rsi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x4e40(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x2720(%rbp),%rdi
lea    -0x4e40(%rbp),%rsi
call   1050 <editDistance@plt>
mov    %eax,%esi
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x4e40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x4e48,%rsp
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     11b6 <main+0x86>
lea    0xea4(%rip),%r14
lea    0x2730(%rsp),%r15
lea    0x10(%rsp),%rbx
lea    0xe93(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <editDistance@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
subl   $0x1,0xc(%rsp)
jae    1180 <main+0x50>
xor    %eax,%eax
add    $0x4e48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10001 x i8]
%4 = alloca [10001 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %10, %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 %19
10: ; preds = %6
%11 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [10001 x i8], [10001 x i8]* %4, i64 0, i64 0
%17 = call i32 @editDistance(i8* %15, i8* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10001 x i8]
%3 = alloca [10001 x i8]
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %20, label %9
9: ; preds = %0
%10 = getelementptr inbounds [10001 x i8], [10001 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
br label %12
12: ; preds = %9, %12
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%15 = call i32 @editDistance(i8* %10, i8* %11)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %1
%18 = add nsw i32 %17, -1
store i32 %18, i32* %1
%19 = icmp eq i32 %17, 0
br i1 %19, label %20, label %12
20: ; preds = %12, %0
ret i32 0
}