#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 */
scalar_t__ EOF;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ find(int, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
scalar_t__ scanf(char *, ...);
int /*<<< orphan*/ strlen(char *);
int main() {
  int m;
  char s1[27];
  char s2[27];
  while (scanf("%d", &m) != EOF) {
    if (!m)
      break;
    scanf("%s%s", s1, s2);
    printf("%lu\n", find(m, s1, s2, strlen(s1)));
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%rax
je     11ea <main+0x9a>
cmpl   $0x0,-0x8(%rbp)
jne    1190 <main+0x40>
jmp    11ea <main+0x9a>
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x64(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    %eax,%ecx
call   1050 <find@plt>
mov    %eax,%esi
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
jmp    115f <main+0xf>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xe9b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%rax
je     120b <main+0xbb>
cmpl   $0x0,0xc(%rsp)
je     120b <main+0xbb>
lea    0x30(%rsp),%rbx
lea    0x10(%rsp),%r15
lea    0xe6b(%rip),%r12
lea    0xe5c(%rip),%r13
lea    0xc(%rsp),%rbp
nopl   0x0(%rax)
lea    0xe4c(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%r14d
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1050 <find@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x2de9(%rip),%rcx
cmp    (%rcx),%rax
je     120b <main+0xbb>
cmpl   $0x0,0xc(%rsp)
jne    11b0 <main+0x60>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [5 x i8] c"%s%s\00"
@.str.2 = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [27 x i8]
%4 = alloca [27 x i8]
store i32 0, i32* %1
br label %5
5: ; preds = %13, %0
%6 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %24
9: ; preds = %5
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9
br label %24
13: ; preds = %9
%14 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [27 x i8], [27 x i8]* %4, i64 0, i64 0
%16 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %14, i8* %15)
%17 = load i32, i32* %2
%18 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
%19 = getelementptr inbounds [27 x i8], [27 x i8]* %4, i64 0, i64 0
%20 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = call i32 @find(i32 %17, i8* %18, i8* %19, i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %5
24: ; preds = %12, %5
%25 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [5 x i8] c"%s%s\00"
@.str.2 = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [27 x i8]
%3 = alloca [27 x i8]
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
%7 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
%10 = load i32, i32* %1
%11 = icmp ne i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %13, label %25
13: ; preds = %0, %13
%14 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %6)
%15 = load i32, i32* %1
%16 = call i32 @strlen(i8* %5)
%17 = call i32 @find(i32 %15, i8* %5, i8* %6, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%20 = load i64, i64* @EOF
%21 = icmp ne i64 %19, %20
%22 = load i32, i32* %1
%23 = icmp ne i32 %22, 0
%24 = select i1 %21, i1 %23, i1 false
br i1 %24, label %13, label %25
25: ; preds = %13, %0
%26 = call i32 @exit(i32 0)
unreachable
}