#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 /*<<< orphan*/ printf(char *, ...);
int scanf(char *, char *, char *);
char *strstr(char *, char *);
int main() {
  char a[1024 + 1], b[1024 + 1];
  char *result;
  if (scanf("%"
            "1024"
            "s%"
            "1024"
            "s",
            a, b) == 2) {
    result = strstr(a, b);
    if (result)
      printf("%ld\n", result - a + 1);
    else
      printf("NOT FOUND!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rsi
lea    -0x820(%rbp),%rdx
lea    0xea9(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    11c8 <main+0x98>
lea    -0x410(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x828(%rbp)
cmpq   $0x0,-0x828(%rbp)
je     11b5 <main+0x85>
mov    -0x828(%rbp),%rsi
lea    -0x410(%rbp),%rax
sub    %rax,%rsi
add    $0x1,%rsi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c3 <main+0x93>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c8 <main+0x98>
xor    %eax,%eax
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x820,%rsp
lea    0xeb1(%rip),%rdi
lea    0x410(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    11a2 <main+0x62>
lea    0x410(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
je     1196 <main+0x56>
sub    %rbx,%rax
add    $0x1,%rax
lea    0xe83(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a2 <main+0x62>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x820,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%1024s%1024s\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
@.str.2 = [12 x i8] c"NOT FOUND!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1025 x i8]
%3 = alloca [1025 x i8]
%4 = alloca i8*
store i32 0, i32* %1
%5 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %26
9: ; preds = %0
%10 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
%12 = call i8* @strstr(i8* %10, i8* %11)
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %23
15: ; preds = %9
%16 = load i8*, i8** %4
%17 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
%21 = add nsw i64 %20, 1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %21)
br label %25
23: ; preds = %9
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %15
br label %26
26: ; preds = %25, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%1024s%1024s\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
@str = [11 x i8] c"NOT FOUND!\00"
define i32 @main() {
%1 = alloca [1025 x i8]
%2 = alloca [1025 x i8]
%3 = getelementptr inbounds [1025 x i8], [1025 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %18
7: ; preds = %0
%8 = call i8* @strstr(i8* %3, i8* %4)
%9 = icmp eq i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = ptrtoint i8* %8 to i64
%12 = ptrtoint [1025 x i8]* %1 to i64
%13 = sub i64 1, %12
%14 = add i64 %13, %11
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %14)
br label %18
16: ; preds = %7
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %10, %16, %0
ret i32 0
}