#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 /*<<< 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) == 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
call   1030 <fn@plt>
cmp    $0x1,%eax
jne    1248 <main+0x118>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1243 <main+0x113>
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    1230 <main+0x100>
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
lea    0xddf(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1040 <printf@plt>
jmp    1235 <main+0x105>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e7 <main+0xb7>
jmp    1248 <main+0x118>
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    %r14,%rdi
mov    %r13,%rsi
call   1030 <fn@plt>
cmp    $0x1,%eax
jne    11fc <main+0xcc>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jle    11fc <main+0xcc>
xor    %ebx,%ebx
lea    0xe39(%rip),%r15
jmp    11dc <main+0xac>
nop
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    11fc <main+0xcc>
movzbl (%r14,%rbx,1),%ecx
movslq %eax,%rdx
add    %r13,%rdx
cmp    (%rbx,%rdx,1),%cl
jne    11d0 <main+0xa0>
movsbl %cl,%esi
mov    %r15,%rdi
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
jmp    11d0 <main+0xa0>
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 = call i32 @fn(i8* %12, i8* %17)
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %51
21: ; preds = %0
store i32 0, i32* %7
br label %22
22: ; preds = %47, %21
%23 = load i32, i32* %7
%24 = load i32, i32* %2
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %50
26: ; preds = %22
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %12, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = load i32, i32* %7
%33 = load i32, i32* %2
%34 = add nsw i32 %32, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %17, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %31, %38
br i1 %39, label %40, label %46
40: ; preds = %26
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %12, i64 %42
%44 = load i8, i8* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %44)
br label %46
46: ; preds = %40, %26
br label %47
47: ; preds = %46
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %22
50: ; preds = %22
br label %51
51: ; preds = %50, %0
store i32 0, i32* %1
%52 = load i8*, i8** %4
%53 = load i32, i32* %1
ret i32 %53
}

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 = call i32 @fn(i8* %9, i8* %14)
%17 = icmp eq i32 %16, 1
%18 = load i32, i32* %1
%19 = icmp sgt i32 %18, 0
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %21, label %40
21: ; preds = %0, %35
%22 = phi i32 [ %36, %35 ], [ %18, %0 ]
%23 = phi i64 [ %37, %35 ], [ 0, %0 ]
%24 = getelementptr inbounds i8, i8* %9, i64 %23
%25 = load i8, i8* %24
%26 = trunc i64 %23 to i32
%27 = add nsw i32 %22, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %14, i64 %28
%30 = load i8, i8* %29
%31 = icmp eq i8 %25, %30
br i1 %31, label %32, label %35
32: ; preds = %21
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %25)
%34 = load i32, i32* %1
br label %35
35: ; preds = %21, %32
%36 = phi i32 [ %22, %21 ], [ %34, %32 ]
%37 = add nuw nsw i64 %23, 1
%38 = sext i32 %36 to i64
%39 = icmp slt i64 %37, %38
br i1 %39, label %21, label %40
40: ; preds = %35, %0
ret i32 0
}