#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, long);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
long strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, long);
int main() {
  FILE *f = fopen("INP.TXT", "r");
  char x[100001], y[100001];
  long i, m, n, r = -1;
  fscanf(f, "%s %s", x, y);
  fclose(f);
  m = strlen(x);
  n = strlen(y) - m;
  for (i = 0; i < n; i++)
    if (!strncmp(x, y + i, m)) {
      r = i + 1;
      break;
    }
  f = fopen("OUT.TXT", "w");
  fprintf(f, "%ld\n", r);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30d90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
movq   $0xffffffffffffffff,-0x30d90(%rbp)
ff ff ff ff
mov    -0x10(%rbp),%rdi
lea    -0x186c0(%rbp),%rdx
lea    -0x30d70(%rbp),%rcx
lea    0xe5d(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x186c0(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x30d80(%rbp)
lea    -0x30d70(%rbp),%rdi
call   1050 <strlen@plt>
sub    -0x30d80(%rbp),%rax
mov    %rax,-0x30d88(%rbp)
movq   $0x0,-0x30d78(%rbp)
mov    -0x30d78(%rbp),%rax
cmp    -0x30d88(%rbp),%rax
jge    1264 <main+0x104>
lea    -0x186c0(%rbp),%rdi
lea    -0x30d70(%rbp),%rsi
add    -0x30d78(%rbp),%rsi
mov    -0x30d80(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1248 <main+0xe8>
mov    -0x30d78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30d90(%rbp)
jmp    1264 <main+0x104>
jmp    124d <main+0xed>
mov    -0x30d78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30d78(%rbp)
jmp    11f3 <main+0x93>
lea    0xda5(%rip),%rdi
lea    0xda6(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x30d90(%rbp),%rdx
lea    0xd8d(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x30d90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30d60,%rsp
lea    0xe89(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe7d(%rip),%rsi
lea    0x186b0(%rsp),%r14
mov    %rsp,%r12
mov    %rax,%rdi
mov    %r14,%rdx
mov    %r12,%rcx
call   1060 <fscanf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %rax,%r13
sub    %r15,%r13
mov    $0xffffffffffffffff,%r14
test   %r13,%r13
jle    1201 <main+0xa1>
xor    %ebx,%ebx
lea    0x186b0(%rsp),%r12
nopl   (%rax)
lea    (%rsp,%rbx,1),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
call   1030 <strncmp@plt>
add    $0x1,%rbx
test   %eax,%eax
je     11fe <main+0x9e>
cmp    %rbx,%r13
jne    11e0 <main+0x80>
jmp    1201 <main+0xa1>
mov    %rbx,%r14
lea    0xe08(%rip),%rdi
lea    0xe09(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xdfc(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x30d60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%s %s\00"
@.str.3 = [8 x i8] c"OUT.TXT\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [100001 x i8]
%4 = alloca [100001 x i8]
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %1
%9 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %2
store i64 -1, i64* %8
%10 = load i32*, i32** %2
%11 = getelementptr inbounds [100001 x i8], [100001 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [100001 x i8], [100001 x i8]* %4, i64 0, i64 0
%13 = call i32 @fscanf(i32* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %11, i8* %12)
%14 = load i32*, i32** %2
%15 = call i32 @fclose(i32* %14)
%16 = getelementptr inbounds [100001 x i8], [100001 x i8]* %3, i64 0, i64 0
%17 = call i64 @strlen(i8* %16)
store i64 %17, i64* %6
%18 = getelementptr inbounds [100001 x i8], [100001 x i8]* %4, i64 0, i64 0
%19 = call i64 @strlen(i8* %18)
%20 = load i64, i64* %6
%21 = sub nsw i64 %19, %20
store i64 %21, i64* %7
store i64 0, i64* %5
br label %22
22: ; preds = %38, %0
%23 = load i64, i64* %5
%24 = load i64, i64* %7
%25 = icmp slt i64 %23, %24
br i1 %25, label %26, label %41
26: ; preds = %22
%27 = getelementptr inbounds [100001 x i8], [100001 x i8]* %3, i64 0, i64 0
%28 = getelementptr inbounds [100001 x i8], [100001 x i8]* %4, i64 0, i64 0
%29 = load i64, i64* %5
%30 = getelementptr inbounds i8, i8* %28, i64 %29
%31 = load i64, i64* %6
%32 = call i32 @strncmp(i8* %27, i8* %30, i64 %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %26
%35 = load i64, i64* %5
%36 = add nsw i64 %35, 1
store i64 %36, i64* %8
br label %41
37: ; preds = %26
br label %38
38: ; preds = %37
%39 = load i64, i64* %5
%40 = add nsw i64 %39, 1
store i64 %40, i64* %5
br label %22
41: ; preds = %34, %22
%42 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %42, i32** %2
%43 = load i32*, i32** %2
%44 = load i64, i64* %8
%45 = call i32 @fprintf(i32* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 %44)
%46 = load i32*, i32** %2
%47 = call i32 @fclose(i32* %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%s %s\00"
@.str.3 = [8 x i8] c"OUT.TXT\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca [100001 x i8]
%2 = alloca [100001 x i8]
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [100001 x i8], [100001 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 0
%6 = call i32 @fscanf(i32* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %4, i8* %5)
%7 = call i32 @fclose(i32* %3)
%8 = call i64 @strlen(i8* %4)
%9 = call i64 @strlen(i8* %5)
%10 = sub i64 %9, %8
%11 = icmp sgt i64 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %0, %18
%13 = phi i64 [ %17, %18 ], [ 0, %0 ]
%14 = getelementptr inbounds [100001 x i8], [100001 x i8]* %2, i64 0, i64 %13
%15 = call i32 @strncmp(i8* %4, i8* %14, i64 %8)
%16 = icmp eq i32 %15, 0
%17 = add nuw nsw i64 %13, 1
br i1 %16, label %20, label %18
18: ; preds = %12
%19 = icmp eq i64 %17, %10
br i1 %19, label %20, label %12
20: ; preds = %18, %12, %0
%21 = phi i64 [ -1, %0 ], [ -1, %18 ], [ %17, %12 ]
%22 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 %21)
%24 = call i32 @fclose(i32* %22)
ret i32 0
}