#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 makeEqual(char *, int, char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n1, n2;
  scanf("%d", &n1);
  char *s, *r, *copy;
  s = (char *)malloc(n1 * sizeof(char));
  r = (char *)malloc(n2 * sizeof(char));
  copy = (char *)malloc(n2 * sizeof(char));
  scanf("%s", s);
  scanf("%d", &n2);
  scanf("%s", r);
  int i;
  for (i = 0; i < n2; i++) {
    *(copy + i) = *(r + i);
  }
  int n, m;
  n = n1 - makeEqual(s, n1, r, n2);
  m = n2 - makeEqual(copy, n2, s, n1);
  printf("%d", n + m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe4d(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1207 <main+0xc7>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11d7 <main+0x97>
mov    -0x8(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0xc(%rbp),%ecx
call   1040 <makeEqual@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%ecx
call   1040 <makeEqual@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%esi
add    -0x34(%rbp),%esi
lea    0xda6(%rip),%rdi
call   1030 <printf@plt>
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
push   %rax
lea    0xeae(%rip),%r12
lea    0x4(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <malloc@plt>
mov    %rax,%r14
call   1050 <malloc@plt>
mov    %rax,%rbx
call   1050 <malloc@plt>
mov    %rax,%r15
lea    0xe7f(%rip),%r13
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rsp,%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    (%rsp),%ecx
test   %ecx,%ecx
jle    11d5 <main+0x95>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx,%rax,1),%ecx
mov    %cl,(%r15,%rax,1)
add    $0x1,%rax
movslq (%rsp),%rcx
cmp    %rcx,%rax
jl     11c0 <main+0x80>
mov    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1040 <makeEqual@plt>
mov    %eax,%r12d
mov    (%rsp),%ebx
mov    0x4(%rsp),%ecx
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1040 <makeEqual@plt>
add    %ebx,%ebp
add    %r12d,%eax
sub    %eax,%ebp
lea    0xdf5(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%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 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 1
%14 = trunc i64 %13 to i32
%15 = call i64 @malloc(i32 %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %4
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = mul i64 %18, 1
%20 = trunc i64 %19 to i32
%21 = call i64 @malloc(i32 %20)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %5
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = mul i64 %24, 1
%26 = trunc i64 %25 to i32
%27 = call i64 @malloc(i32 %26)
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %6
%29 = load i8*, i8** %4
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%32 = load i8*, i8** %5
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %32)
store i32 0, i32* %7
br label %34
34: ; preds = %48, %0
%35 = load i32, i32* %7
%36 = load i32, i32* %3
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %51
38: ; preds = %34
%39 = load i8*, i8** %5
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
%43 = load i8, i8* %42
%44 = load i8*, i8** %6
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
store i8 %43, i8* %47
br label %48
48: ; preds = %38
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %34
51: ; preds = %34
%52 = load i32, i32* %2
%53 = load i8*, i8** %4
%54 = load i32, i32* %2
%55 = load i8*, i8** %5
%56 = load i32, i32* %3
%57 = call i32 @makeEqual(i8* %53, i32 %54, i8* %55, i32 %56)
%58 = sub nsw i32 %52, %57
store i32 %58, i32* %8
%59 = load i32, i32* %3
%60 = load i8*, i8** %6
%61 = load i32, i32* %3
%62 = load i8*, i8** %4
%63 = load i32, i32* %2
%64 = call i32 @makeEqual(i8* %60, i32 %61, i8* %62, i32 %63)
%65 = sub nsw i32 %59, %64
store i32 %65, i32* %9
%66 = load i32, i32* %8
%67 = load i32, i32* %9
%68 = add nsw i32 %66, %67
%69 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %68)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 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 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
%9 = call i64 @malloc(i32 undef)
%10 = inttoptr i64 %9 to i8*
%11 = call i64 @malloc(i32 undef)
%12 = inttoptr i64 %11 to i8*
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %0, %18
%19 = phi i64 [ %23, %18 ], [ 0, %0 ]
%20 = getelementptr inbounds i8, i8* %10, i64 %19
%21 = load i8, i8* %20
%22 = getelementptr inbounds i8, i8* %12, i64 %19
store i8 %21, i8* %22
%23 = add nuw nsw i64 %19, 1
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = icmp slt i64 %23, %25
br i1 %26, label %18, label %27
27: ; preds = %18, %0
%28 = phi i32 [ %16, %0 ], [ %24, %18 ]
%29 = load i32, i32* %1
%30 = call i32 @makeEqual(i8* %8, i32 %29, i8* %10, i32 %28)
%31 = load i32, i32* %2
%32 = load i32, i32* %1
%33 = call i32 @makeEqual(i8* %12, i32 %31, i8* %8, i32 %32)
%34 = add i32 %29, %31
%35 = add i32 %30, %33
%36 = sub i32 %34, %35
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %36)
ret i32 0
}