#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 EOF;
int /*<<< orphan*/ getch();
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sf(char *, char *, int);
main() {
  char *line, input[100000], search[100000];
  int i;
  int c;
  for (i = 0; i <= 100000 && (c = getchar()) != EOF; ++i) {
    input[i] = c;
  }
  printf("Enter Search String");
  for (i = 0; i <= 100000 && (c = getchar()) != EOF; ++i) {
    search[i] = c;
  }
  sf(search, input, 100000);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30d60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x30d54(%rbp)
xor    %eax,%eax
cmpl   $0x186a0,-0x30d54(%rbp)
mov    %al,-0x30d59(%rbp)
jg     1193 <main+0x53>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x30d58(%rbp)
mov    0x2e60(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x30d59(%rbp)
mov    -0x30d59(%rbp),%al
test   $0x1,%al
jne    11a6 <main+0x66>
jmp    11d0 <main+0x90>
mov    -0x30d58(%rbp),%eax
mov    %al,%cl
movslq -0x30d54(%rbp),%rax
mov    %cl,-0x186b0(%rbp,%rax,1)
mov    -0x30d54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30d54(%rbp)
jmp    115c <main+0x1c>
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x30d54(%rbp)
xor    %eax,%eax
cmpl   $0x186a0,-0x30d54(%rbp)
mov    %al,-0x30d5a(%rbp)
jg     121d <main+0xdd>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x30d58(%rbp)
mov    0x2dd6(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x30d5a(%rbp)
mov    -0x30d5a(%rbp),%al
test   $0x1,%al
jne    1230 <main+0xf0>
jmp    125a <main+0x11a>
mov    -0x30d58(%rbp),%eax
mov    %al,%cl
movslq -0x30d54(%rbp),%rax
mov    %cl,-0x30d50(%rbp,%rax,1)
mov    -0x30d54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30d54(%rbp)
jmp    11e6 <main+0xa6>
lea    -0x30d50(%rbp),%rdi
lea    -0x186b0(%rbp),%rsi
mov    $0x186a0,%edx
call   1030 <sf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x30d60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x30d48,%rsp
mov    0x2e97(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r14),%eax
je     1180 <main+0x40>
mov    %al,0x186a0(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x186a1,%rbx
jne    1160 <main+0x20>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
xor    %ebx,%ebx
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r14),%eax
je     11ac <main+0x6c>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x186a1,%rbx
jne    1190 <main+0x50>
mov    %rsp,%rdi
lea    0x186a0(%rsp),%rsi
mov    $0x186a0,%edx
call   1030 <sf@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x30d48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [20 x i8] c"Enter Search String\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [100000 x i8]
%4 = alloca [100000 x i8]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 100000
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = call i32 (...) @getchar()
store i32 %11, i32* %6
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br label %14
14: ; preds = %10, %7
%15 = phi i1 [ false, %7 ], [ %13, %10 ]
br i1 %15, label %16, label %25
16: ; preds = %14
%17 = load i32, i32* %6
%18 = trunc i32 %17 to i8
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 %20
store i8 %18, i8* %21
br label %22
22: ; preds = %16
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %7
25: ; preds = %14
%26 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %27
27: ; preds = %42, %25
%28 = load i32, i32* %5
%29 = icmp sle i32 %28, 100000
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = call i32 (...) @getchar()
store i32 %31, i32* %6
%32 = load i32, i32* @EOF
%33 = icmp ne i32 %31, %32
br label %34
34: ; preds = %30, %27
%35 = phi i1 [ false, %27 ], [ %33, %30 ]
br i1 %35, label %36, label %45
36: ; preds = %34
%37 = load i32, i32* %6
%38 = trunc i32 %37 to i8
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100000 x i8], [100000 x i8]* %4, i64 0, i64 %40
store i8 %38, i8* %41
br label %42
42: ; preds = %36
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %27
45: ; preds = %34
%46 = getelementptr inbounds [100000 x i8], [100000 x i8]* %4, i64 0, i64 0
%47 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%48 = call i32 @sf(i8* %46, i8* %47, i32 100000)
%49 = call i32 (...) @getch()
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [20 x i8] c"Enter Search String\00"
define i32 @main() {
%1 = alloca [100000 x i8]
%2 = alloca [100000 x i8]
%3 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %0, %10
%6 = phi i64 [ 0, %0 ], [ %13, %10 ]
%7 = tail call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = trunc i32 %7 to i8
%12 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 %6
store i8 %11, i8* %12
%13 = add nuw nsw i64 %6, 1
%14 = icmp eq i64 %13, 100001
br i1 %14, label %15, label %5
15: ; preds = %10, %5
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %22
%18 = phi i64 [ 0, %15 ], [ %25, %22 ]
%19 = tail call i32 (...) @getchar()
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %27, label %22
22: ; preds = %17
%23 = trunc i32 %19 to i8
%24 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 %18
store i8 %23, i8* %24
%25 = add nuw nsw i64 %18, 1
%26 = icmp eq i64 %25, 100001
br i1 %26, label %27, label %17
27: ; preds = %22, %17
%28 = call i32 @sf(i8* %4, i8* %3, i32 100000)
%29 = call i32 (...) @getch()
ret i32 0
}