#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__ malloc(int);
int /*<<< orphan*/ matching(char *, char *, int *, int, int);
int /*<<< orphan*/ preProcess(char *, int *, int);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main(void) {
  char pat[50];
  char text[100];
  int M, N;
  int *b;
  scanf("%[^\n]", text);
  scanf("%s", pat);
  M = strlen(pat);
  N = strlen(text);
  b = (int *)malloc(sizeof(int) * (M + 1));
  preProcess(pat, b, M);
  matching(text, pat, b, N, M);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xb0(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xb4(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xb8(%rbp)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xc0(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
mov    -0xb4(%rbp),%edx
call   1040 <preProcess@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0xc0(%rbp),%rdx
mov    -0xb8(%rbp),%ecx
mov    -0xb4(%rbp),%r8d
call   1050 <matching@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xb0,%rsp
lea    0xe9a(%rip),%rdi
lea    0x40(%rsp),%r14
mov    %r14,%rsi
call   1070 <scanf@plt>
lea    0xe8c(%rip),%rdi
mov    %rsp,%r15
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%r12d
lea    0x4(,%rbx,4),%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %r15,%rdi
mov    %rax,%rsi
mov    %ebx,%edx
call   1040 <preProcess@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    %r12d,%ecx
mov    %ebx,%r8d
call   1050 <matching@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%[^\0A]\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 0, i32* %1
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %4
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %5
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = mul i64 4, %17
%19 = trunc i64 %18 to i32
%20 = call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to i32*
store i32* %21, i32** %6
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%23 = load i32*, i32** %6
%24 = load i32, i32* %4
%25 = call i32 @preProcess(i8* %22, i32* %23, i32 %24)
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%28 = load i32*, i32** %6
%29 = load i32, i32* %5
%30 = load i32, i32* %4
%31 = call i32 @matching(i8* %26, i8* %27, i32* %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%[^\0A]\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @strlen(i8* %3)
%8 = call i32 @strlen(i8* %4)
%9 = shl i32 %7, 2
%10 = add i32 %9, 4
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i32*
%13 = call i32 @preProcess(i8* %3, i32* %12, i32 %7)
%14 = call i32 @matching(i8* %4, i8* %3, i32* %12, i32 %8, i32 %7)
ret i32 0
}