#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 fn(char *, char *, int);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int m, n;
  scanf("%d", &m);
  char str1[m];
  scanf("%s", str1);
  scanf("%d", &n);
  char str2[n];
  scanf("%s", str2);
  int i;
  if (fn(str1, str2, m) == 1) {
    for (i = 0; i < m; i++) {
      if (str1[i] == str2[i + m]) {
        printf("%c", str1[i]);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    %rdi,-0x50(%rbp)
xor    %eax,%eax
mov    %al,-0x41(%rbp)
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x41(%rbp),%al
mov    -0x8(%rbp),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rsi
sub    %rdx,%rsi
mov    %rsi,-0x40(%rbp)
mov    %rsi,%rsp
mov    %rcx,-0x20(%rbp)
lea    0xe7b(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x41(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x38(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x28(%rbp)
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x8(%rbp),%edx
call   1030 <fn@plt>
cmp    $0x1,%eax
jne    124b <main+0x11b>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1246 <main+0x116>
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
mov    -0x2c(%rbp),%edx
add    -0x8(%rbp),%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1233 <main+0x103>
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
lea    0xddc(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1040 <printf@plt>
jmp    1238 <main+0x108>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ea <main+0xba>
jmp    124b <main+0x11b>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebb(%rip),%rbx
lea    -0x2c(%rbp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0xe92(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    -0x30(%rbp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    -0x30(%rbp),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    -0x2c(%rbp),%edx
mov    %r14,%rdi
mov    %r13,%rsi
call   1030 <fn@plt>
cmp    $0x1,%eax
jne    120c <main+0xdc>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jle    120c <main+0xdc>
xor    %ebx,%ebx
lea    0xe36(%rip),%r15
jmp    11ec <main+0xbc>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    120c <main+0xdc>
movzbl (%r14,%rbx,1),%ecx
movslq %eax,%rdx
add    %r13,%rdx
cmp    (%rbx,%rdx,1),%cl
jne    11e0 <main+0xb0>
movsbl %cl,%esi
mov    %r15,%rdi
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
jmp    11e0 <main+0xb0>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%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"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %4
%12 = alloca i8, i64 %10
store i64 %10, i64* %5
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = zext i32 %15 to i64
%17 = alloca i8, i64 %16
store i64 %16, i64* %6
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32, i32* %2
%20 = call i32 @fn(i8* %12, i8* %17, i32 %19)
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %52
22: ; preds = %0
store i32 0, i32* %7
br label %23
23: ; preds = %48, %22
%24 = load i32, i32* %7
%25 = load i32, i32* %2
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %51
27: ; preds = %23
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %12, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = load i32, i32* %7
%34 = load i32, i32* %2
%35 = add nsw i32 %33, %34
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %17, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %32, %39
br i1 %40, label %41, label %47
41: ; preds = %27
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %12, i64 %43
%45 = load i8, i8* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %45)
br label %47
47: ; preds = %41, %27
br label %48
48: ; preds = %47
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %23
51: ; preds = %23
br label %52
52: ; preds = %51, %0
store i32 0, i32* %1
%53 = load i8*, i8** %4
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"%c\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 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = zext i32 %12 to i64
%14 = alloca i8, i64 %13
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %1
%17 = call i32 @fn(i8* %9, i8* %14, i32 %16)
%18 = icmp eq i32 %17, 1
%19 = load i32, i32* %1
%20 = icmp sgt i32 %19, 0
%21 = select i1 %18, i1 %20, i1 false
br i1 %21, label %22, label %41
22: ; preds = %0, %36
%23 = phi i32 [ %37, %36 ], [ %19, %0 ]
%24 = phi i64 [ %38, %36 ], [ 0, %0 ]
%25 = getelementptr inbounds i8, i8* %9, i64 %24
%26 = load i8, i8* %25
%27 = trunc i64 %24 to i32
%28 = add nsw i32 %23, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %14, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %26, %31
br i1 %32, label %33, label %36
33: ; preds = %22
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %26)
%35 = load i32, i32* %1
br label %36
36: ; preds = %22, %33
%37 = phi i32 [ %23, %22 ], [ %35, %33 ]
%38 = add nuw nsw i64 %24, 1
%39 = sext i32 %37 to i64
%40 = icmp slt i64 %38, %39
br i1 %40, label %22, label %41
41: ; preds = %36, %0
ret i32 0
}