#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 *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void main() {
  char mainString[50] = "namanchamanbomanamansanam";
  char pattern[50] = "aman";
  char mainStringcpy[50];
  char patterncpy[50];
  int TempArray[strlen(mainString)];
  int index = -1;
  strcpy(patterncpy, pattern);
  strcpy(mainStringcpy, mainString);
  strcat(pattern, "$");
  strcat(pattern, mainString);
  char combinedString[100] = "";
  strcat(combinedString, pattern);
  int patternLength = strlen(patterncpy);
  int combinedStringLength = strlen(combinedString);
  int Zarray[combinedStringLength];
  int n = strlen(combinedString);
  int zleft = 0, zright = 0, current;
  for (int i = 1; i < n; i++) {
    if (i > zright) {
      zleft = zright = i;
      while (zright < n &&
             combinedString[zright - zleft] == combinedString[zright]) {
        zright++;
      }
      Zarray[i] = zright - zleft;
      zright--;
    } else {
      current = i - zleft;
      if (Zarray[current] < zright - i + 1) {
        Zarray[i] = Zarray[current];
      } else {
        zleft = i;
        while (zright < n &&
               combinedString[zright - zleft] == combinedString[zright]) {
          zright++;
        }
        Zarray[i] = zright - zleft;
        zright--;
      }
    }
  }
  for (int i = 0; i < combinedStringLength; i++) {
    if (Zarray[i] == patternLength) {
      (index)++;
      TempArray[(index)] = i - patternLength;
    }
  }
  for (int i = 0; i <= index; i++) {
    printf("The pattern %s is found at index : %d\n", patterncpy, TempArray[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
movaps 0xece(%rip),%xmm0
movaps %xmm0,-0x20(%rbp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,-0x40(%rbp)
movw   $0x0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0x1e0(%rbp)
movaps %xmm0,-0x60(%rbp)
movaps %xmm0,-0x70(%rbp)
movaps %xmm0,-0x80(%rbp)
movw   $0x0,-0x50(%rbp)
movb   $0x61,-0x80(%rbp)
movb   $0x6d,-0x7f(%rbp)
movb   $0x61,-0x7e(%rbp)
movb   $0x6e,-0x7d(%rbp)
lea    -0x40(%rbp),%rdi
mov    %rdi,-0x1e8(%rbp)
call   1040 <strlen@plt>
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x108(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1f0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x110(%rbp)
movl   $0xffffffff,-0x114(%rbp)
ff ff ff
lea    -0x100(%rbp),%rdi
mov    %rdi,-0x1c8(%rbp)
lea    -0x80(%rbp),%rsi
mov    %rsi,-0x1d0(%rbp)
call   1030 <strcpy@plt>
mov    -0x1e8(%rbp),%rsi
lea    -0xc0(%rbp),%rdi
call   1030 <strcpy@plt>
mov    -0x1d0(%rbp),%rdi
lea    0xe0c(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x1e8(%rbp),%rsi
mov    -0x1d0(%rbp),%rdi
call   1060 <strcat@plt>
movaps -0x1e0(%rbp),%xmm0
mov    -0x1d0(%rbp),%rsi
movaps %xmm0,-0x130(%rbp)
movaps %xmm0,-0x140(%rbp)
movaps %xmm0,-0x150(%rbp)
movaps %xmm0,-0x160(%rbp)
movaps %xmm0,-0x170(%rbp)
movaps %xmm0,-0x180(%rbp)
movl   $0x0,-0x120(%rbp)
lea    -0x180(%rbp),%rdi
mov    %rdi,-0x1c0(%rbp)
call   1060 <strcat@plt>
mov    -0x1c8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c0(%rbp),%rdi
mov    %eax,-0x184(%rbp)
call   1040 <strlen@plt>
mov    %eax,-0x188(%rbp)
mov    -0x188(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1b8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x190(%rbp)
lea    -0x180(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x194(%rbp)
movl   $0x0,-0x198(%rbp)
movl   $0x0,-0x19c(%rbp)
movl   $0x1,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
cmp    -0x194(%rbp),%eax
jge    1509 <main+0x3c9>
mov    -0x1a4(%rbp),%eax
cmp    -0x19c(%rbp),%eax
jle    13e8 <main+0x2a8>
mov    -0x1a4(%rbp),%eax
mov    %eax,-0x19c(%rbp)
mov    %eax,-0x198(%rbp)
mov    -0x19c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x194(%rbp),%ecx
mov    %al,-0x1f1(%rbp)
jge    1390 <main+0x250>
mov    -0x19c(%rbp),%eax
sub    -0x198(%rbp),%eax
cltq
movsbl -0x180(%rbp,%rax,1),%eax
ff
movslq -0x19c(%rbp),%rcx
movsbl -0x180(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
sete   %al
mov    %al,-0x1f1(%rbp)
mov    -0x1f1(%rbp),%al
test   $0x1,%al
jne    13a3 <main+0x263>
jmp    13b7 <main+0x277>
mov    -0x19c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x19c(%rbp)
jmp    1346 <main+0x206>
mov    -0x1b8(%rbp),%rax
mov    -0x19c(%rbp),%edx
sub    -0x198(%rbp),%edx
movslq -0x1a4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x19c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x19c(%rbp)
jmp    14f0 <main+0x3b0>
mov    -0x1b8(%rbp),%rax
mov    -0x1a4(%rbp),%ecx
sub    -0x198(%rbp),%ecx
mov    %ecx,-0x1a0(%rbp)
movslq -0x1a0(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x19c(%rbp),%ecx
sub    -0x1a4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1442 <main+0x302>
mov    -0x1b8(%rbp),%rax
movslq -0x1a0(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x1a4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    14eb <main+0x3ab>
mov    -0x1a4(%rbp),%eax
mov    %eax,-0x198(%rbp)
mov    -0x19c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x194(%rbp),%ecx
mov    %al,-0x1f2(%rbp)
jge    1498 <main+0x358>
mov    -0x19c(%rbp),%eax
sub    -0x198(%rbp),%eax
cltq
movsbl -0x180(%rbp,%rax,1),%eax
ff
movslq -0x19c(%rbp),%rcx
movsbl -0x180(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
sete   %al
mov    %al,-0x1f2(%rbp)
mov    -0x1f2(%rbp),%al
test   $0x1,%al
jne    14ab <main+0x36b>
jmp    14bf <main+0x37f>
mov    -0x19c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x19c(%rbp)
jmp    144e <main+0x30e>
mov    -0x1b8(%rbp),%rax
mov    -0x19c(%rbp),%edx
sub    -0x198(%rbp),%edx
movslq -0x1a4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x19c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x19c(%rbp)
jmp    14f0 <main+0x3b0>
jmp    14f5 <main+0x3b5>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1310 <main+0x1d0>
movl   $0x0,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
cmp    -0x188(%rbp),%eax
jge    1587 <main+0x447>
mov    -0x1b8(%rbp),%rax
movslq -0x1a8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x184(%rbp),%eax
jne    156e <main+0x42e>
mov    -0x1f0(%rbp),%rax
mov    -0x114(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x114(%rbp)
mov    -0x1a8(%rbp),%edx
sub    -0x184(%rbp),%edx
movslq -0x114(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1573 <main+0x433>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    1513 <main+0x3d3>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x114(%rbp),%eax
jg     15db <main+0x49b>
mov    -0x1f0(%rbp),%rax
lea    -0x100(%rbp),%rsi
movslq -0x1ac(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xa72(%rip),%rdi
call   1050 <printf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    1591 <main+0x451>
mov    -0x108(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,-0x110(%rbp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,-0x120(%rbp)
movaps 0xe89(%rip),%xmm0
movaps %xmm0,-0x130(%rbp)
movw   $0x0,-0x100(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0x80(%rbp)
movaps %xmm0,-0x60(%rbp)
movaps %xmm0,-0x70(%rbp)
movw   $0x0,-0x50(%rbp)
movl   $0x6e616d61,-0x80(%rbp)
lea    -0x130(%rbp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rsp,-0x40(%rbp)
mov    %eax,%eax
mov    %rsp,%rcx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
lea    -0x170(%rbp),%r15
lea    -0x80(%rbp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
lea    -0x1b0(%rbp),%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe35(%rip),%rsi
mov    %r12,%rdi
call   1060 <strcat@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,-0xa0(%rbp)
movaps %xmm0,-0xb0(%rbp)
movaps %xmm0,-0xc0(%rbp)
movaps %xmm0,-0xd0(%rbp)
movaps %xmm0,-0xe0(%rbp)
movaps %xmm0,-0xf0(%rbp)
movl   $0x0,-0x90(%rbp)
lea    -0xf0(%rbp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r14d
mov    %rsp,%r12
lea    0xf(,%r14,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x2,%eax
jl     138a <main+0x24a>
mov    -0x2c(%rbp),%r9d
mov    %r9,%rax
neg    %rax
xor    %r13d,%r13d
mov    $0x1,%edi
xor    %r10d,%r10d
xor    %r11d,%r11d
jmp    12e7 <main+0x1a7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edi,%r10d
sub    %ecx,%r10d
mov    %r10d,%ecx
sub    %edi,%ecx
mov    %ecx,(%r12,%rdi,4)
add    $0xffffffff,%r10d
mov    %edi,%r11d
add    $0x1,%rdi
add    $0xffffffffffffffff,%r13
cmp    %r9,%rdi
je     138a <main+0x24a>
movslq %r10d,%r8
cmp    %r8,%rdi
jle    1320 <main+0x1e0>
lea    (%rax,%rdi,1),%rsi
lea    -0xf0(%rbp),%rbx
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl (%rbx),%edx
cmp    (%rbx,%rdi,1),%dl
jne    12c0 <main+0x180>
add    $0xffffffffffffffff,%rcx
add    $0x1,%rbx
cmp    %rcx,%rsi
jne    1300 <main+0x1c0>
mov    -0x2c(%rbp),%r10d
jmp    12c6 <main+0x186>
nopl   0x0(%rax,%rax,1)
movslq %r11d,%rdx
mov    %rdi,%rsi
sub    %rdx,%rsi
mov    (%r12,%rsi,4),%ebx
mov    %r10d,%edx
sub    %edi,%edx
cmp    %edx,%ebx
jle    1370 <main+0x230>
cmp    -0x2c(%rbp),%r10d
jge    1381 <main+0x241>
lea    (%r8,%rbp,1),%rbx
add    $0xffffffffffffff10,%rbx
add    %rax,%r8
xor    %edx,%edx
nopl   0x0(%rax)
movzbl -0x1(%rbx,%r13,1),%ecx
cmp    (%rbx),%cl
jne    1379 <main+0x239>
add    $0xffffffffffffffff,%rdx
add    $0x1,%rbx
cmp    %rdx,%r8
jne    1350 <main+0x210>
mov    -0x2c(%rbp),%r10d
jmp    137c <main+0x23c>
nopl   (%rax)
mov    %ebx,(%r12,%rdi,4)
jmp    12d6 <main+0x196>
sub    %edx,%r10d
mov    %r10d,%edx
sub    %edi,%edx
mov    %edx,(%r12,%rdi,4)
jmp    12cf <main+0x18f>
test   %r14d,%r14d
mov    -0x38(%rbp),%rdi
jle    140b <main+0x2cb>
mov    %r15d,%eax
neg    %eax
add    $0xffffffffffffffff,%r14
mov    $0xffffffff,%r13d
xor    %ecx,%ecx
cmp    %r15d,%edx
jne    13be <main+0x27e>
nopl   0x0(%rax)
lea    (%rax,%rcx,1),%edx
movslq %r13d,%rsi
add    $0x1,%r13d
mov    %edx,0x4(%rdi,%rsi,4)
cmp    %rcx,%r14
je     13d3 <main+0x293>
mov    0x4(%r12,%rcx,4),%edx
add    $0x1,%rcx
cmp    %r15d,%edx
je     13b0 <main+0x270>
jmp    13be <main+0x27e>
test   %r13d,%r13d
js     140b <main+0x2cb>
add    $0x1,%r13d
xor    %ebx,%ebx
lea    0xc4f(%rip),%r14
lea    -0x170(%rbp),%r15
nopl   0x0(%rax)
mov    (%rdi,%rbx,4),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <printf@plt>
mov    -0x38(%rbp),%rdi
add    $0x1,%rbx
cmp    %rbx,%r13
jne    13f0 <main+0x2b0>
mov    -0x40(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.mainString = [50 x i8] c"namanchamanbomanamansanam\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"$\00"
@.str.1 = [39 x i8] c"The pattern %s is found at index : %d\0A\00"
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca [100 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = bitcast [50 x i8]* %1 to i8*
%20 = bitcast [50 x i8]* %2 to i8*
%21 = bitcast i8* %20 to [50 x i8]*
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i32 0, i32 0
store i8 97, i8* %22
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i32 0, i32 1
store i8 109, i8* %23
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i32 0, i32 2
store i8 97, i8* %24
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i32 0, i32 3
store i8 110, i8* %25
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%27 = call i32 @strlen(i8* %26)
%28 = zext i32 %27 to i64
%29 = call i8* @llvm.stacksave()
store i8* %29, i8** %5
%30 = alloca i32, i64 %28
store i64 %28, i64* %6
store i32 -1, i32* %7
%31 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%32 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%33 = call i32 @strcpy(i8* %31, i8* %32)
%34 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%36 = call i32 @strcpy(i8* %34, i8* %35)
%37 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%38 = call i32 @strcat(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%40 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%41 = call i32 @strcat(i8* %39, i8* %40)
%42 = bitcast [100 x i8]* %8 to i8*
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%44 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%45 = call i32 @strcat(i8* %43, i8* %44)
%46 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%47 = call i32 @strlen(i8* %46)
store i32 %47, i32* %9
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%49 = call i32 @strlen(i8* %48)
store i32 %49, i32* %10
%50 = load i32, i32* %10
%51 = zext i32 %50 to i64
%52 = alloca i32, i64 %51
store i64 %51, i64* %11
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%54 = call i32 @strlen(i8* %53)
store i32 %54, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 1, i32* %16
br label %55
55: ; preds = %154, %0
%56 = load i32, i32* %16
%57 = load i32, i32* %12
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %157
59: ; preds = %55
%60 = load i32, i32* %16
%61 = load i32, i32* %14
%62 = icmp sgt i32 %60, %61
br i1 %62, label %63, label %97
63: ; preds = %59
%64 = load i32, i32* %16
store i32 %64, i32* %14
store i32 %64, i32* %13
br label %65
65: ; preds = %85, %63
%66 = load i32, i32* %14
%67 = load i32, i32* %12
%68 = icmp slt i32 %66, %67
br i1 %68, label %69, label %83
69: ; preds = %65
%70 = load i32, i32* %14
%71 = load i32, i32* %13
%72 = sub nsw i32 %70, %71
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = load i32, i32* %14
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %76, %81
br label %83
83: ; preds = %69, %65
%84 = phi i1 [ false, %65 ], [ %82, %69 ]
br i1 %84, label %85, label %88
85: ; preds = %83
%86 = load i32, i32* %14
%87 = add nsw i32 %86, 1
store i32 %87, i32* %14
br label %65
88: ; preds = %83
%89 = load i32, i32* %14
%90 = load i32, i32* %13
%91 = sub nsw i32 %89, %90
%92 = load i32, i32* %16
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i32, i32* %52, i64 %93
store i32 %91, i32* %94
%95 = load i32, i32* %14
%96 = add nsw i32 %95, -1
store i32 %96, i32* %14
br label %153
97: ; preds = %59
%98 = load i32, i32* %16
%99 = load i32, i32* %13
%100 = sub nsw i32 %98, %99
store i32 %100, i32* %15
%101 = load i32, i32* %15
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i32, i32* %52, i64 %102
%104 = load i32, i32* %103
%105 = load i32, i32* %14
%106 = load i32, i32* %16
%107 = sub nsw i32 %105, %106
%108 = add nsw i32 %107, 1
%109 = icmp slt i32 %104, %108
br i1 %109, label %110, label %118
110: ; preds = %97
%111 = load i32, i32* %15
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %52, i64 %112
%114 = load i32, i32* %113
%115 = load i32, i32* %16
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i32, i32* %52, i64 %116
store i32 %114, i32* %117
br label %152
118: ; preds = %97
%119 = load i32, i32* %16
store i32 %119, i32* %13
br label %120
120: ; preds = %140, %118
%121 = load i32, i32* %14
%122 = load i32, i32* %12
%123 = icmp slt i32 %121, %122
br i1 %123, label %124, label %138
124: ; preds = %120
%125 = load i32, i32* %14
%126 = load i32, i32* %13
%127 = sub nsw i32 %125, %126
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %128
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = load i32, i32* %14
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %133
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp eq i32 %131, %136
br label %138
138: ; preds = %124, %120
%139 = phi i1 [ false, %120 ], [ %137, %124 ]
br i1 %139, label %140, label %143
140: ; preds = %138
%141 = load i32, i32* %14
%142 = add nsw i32 %141, 1
store i32 %142, i32* %14
br label %120
143: ; preds = %138
%144 = load i32, i32* %14
%145 = load i32, i32* %13
%146 = sub nsw i32 %144, %145
%147 = load i32, i32* %16
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds i32, i32* %52, i64 %148
store i32 %146, i32* %149
%150 = load i32, i32* %14
%151 = add nsw i32 %150, -1
store i32 %151, i32* %14
br label %152
152: ; preds = %143, %110
br label %153
153: ; preds = %152, %88
br label %154
154: ; preds = %153
%155 = load i32, i32* %16
%156 = add nsw i32 %155, 1
store i32 %156, i32* %16
br label %55
157: ; preds = %55
store i32 0, i32* %17
br label %158
158: ; preds = %179, %157
%159 = load i32, i32* %17
%160 = load i32, i32* %10
%161 = icmp slt i32 %159, %160
br i1 %161, label %162, label %182
162: ; preds = %158
%163 = load i32, i32* %17
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i32, i32* %52, i64 %164
%166 = load i32, i32* %165
%167 = load i32, i32* %9
%168 = icmp eq i32 %166, %167
br i1 %168, label %169, label %178
169: ; preds = %162
%170 = load i32, i32* %7
%171 = add nsw i32 %170, 1
store i32 %171, i32* %7
%172 = load i32, i32* %17
%173 = load i32, i32* %9
%174 = sub nsw i32 %172, %173
%175 = load i32, i32* %7
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds i32, i32* %30, i64 %176
store i32 %174, i32* %177
br label %178
178: ; preds = %169, %162
br label %179
179: ; preds = %178
%180 = load i32, i32* %17
%181 = add nsw i32 %180, 1
store i32 %181, i32* %17
br label %158
182: ; preds = %158
store i32 0, i32* %18
br label %183
183: ; preds = %194, %182
%184 = load i32, i32* %18
%185 = load i32, i32* %7
%186 = icmp sle i32 %184, %185
br i1 %186, label %187, label %197
187: ; preds = %183
%188 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%189 = load i32, i32* %18
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i32, i32* %30, i64 %190
%192 = load i32, i32* %191
%193 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %188, i32 %192)
br label %194
194: ; preds = %187
%195 = load i32, i32* %18
%196 = add nsw i32 %195, 1
store i32 %196, i32* %18
br label %183
197: ; preds = %183
%198 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@__const.main.mainString = [50 x i8] c"namanchamanbomanamansanam\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"$\00"
@.str.1 = [39 x i8] c"The pattern %s is found at index : %d\0A\00"
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
store i8 97, i8* %7
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 1
store i8 109, i8* %8
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 2
store i8 97, i8* %9
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 3
store i8 110, i8* %10
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%13 = call i32 @strlen(i8* %6)
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
%16 = alloca i32, i64 %14
%17 = call i32 @strcpy(i8* %12, i8* %7)
%18 = call i32 @strcpy(i8* %11, i8* %6)
%19 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @strcat(i8* %7, i8* %6)
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%22 = call i32 @strcat(i8* %21, i8* %7)
%23 = call i32 @strlen(i8* %12)
%24 = call i32 @strlen(i8* %21)
%25 = zext i32 %24 to i64
%26 = alloca i32, i64 %25
%27 = call i32 @strlen(i8* %21)
%28 = icmp sgt i32 %27, 1
br i1 %28, label %29, label %32
29: ; preds = %0
%30 = zext i32 %27 to i64
%31 = zext i32 %27 to i64
br label %34
32: ; preds = %91, %0
%33 = icmp sgt i32 %24, 0
br i1 %33, label %101, label %119
34: ; preds = %29, %91
%35 = phi i64 [ 1, %29 ], [ %94, %91 ]
%36 = phi i32 [ 0, %29 ], [ %93, %91 ]
%37 = phi i32 [ 0, %29 ], [ %92, %91 ]
%38 = trunc i64 %35 to i32
%39 = sext i32 %36 to i64
%40 = icmp sgt i64 %35, %39
br i1 %40, label %41, label %59
41: ; preds = %34, %49
%42 = phi i64 [ %50, %49 ], [ %35, %34 ]
%43 = sub nuw nsw i64 %42, %35
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %42
%47 = load i8, i8* %46
%48 = icmp eq i8 %45, %47
br i1 %48, label %49, label %52
49: ; preds = %41
%50 = add nuw nsw i64 %42, 1
%51 = icmp eq i64 %50, %31
br i1 %51, label %54, label %41
52: ; preds = %41
%53 = trunc i64 %42 to i32
br label %54
54: ; preds = %49, %52
%55 = phi i32 [ %53, %52 ], [ %27, %49 ]
%56 = sub nsw i32 %55, %38
%57 = getelementptr inbounds i32, i32* %26, i64 %35
store i32 %56, i32* %57
%58 = add nsw i32 %55, -1
br label %91
59: ; preds = %34
%60 = sext i32 %37 to i64
%61 = sub nsw i64 %35, %60
%62 = getelementptr inbounds i32, i32* %26, i64 %61
%63 = load i32, i32* %62
%64 = sub nsw i32 %36, %38
%65 = icmp sgt i32 %63, %64
br i1 %65, label %66, label %68
66: ; preds = %59
%67 = icmp slt i32 %36, %27
br i1 %67, label %70, label %86
68: ; preds = %59
%69 = getelementptr inbounds i32, i32* %26, i64 %35
store i32 %63, i32* %69
br label %91
70: ; preds = %66, %78
%71 = phi i64 [ %79, %78 ], [ %39, %66 ]
%72 = sub nsw i64 %71, %35
%73 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %71
%76 = load i8, i8* %75
%77 = icmp eq i8 %74, %76
br i1 %77, label %78, label %81
78: ; preds = %70
%79 = add nsw i64 %71, 1
%80 = icmp eq i64 %79, %30
br i1 %80, label %83, label %70
81: ; preds = %70
%82 = trunc i64 %71 to i32
br label %83
83: ; preds = %78, %81
%84 = phi i32 [ %82, %81 ], [ %27, %78 ]
%85 = sub nsw i32 %84, %38
br label %86
86: ; preds = %83, %66
%87 = phi i32 [ %85, %83 ], [ %64, %66 ]
%88 = phi i32 [ %84, %83 ], [ %36, %66 ]
%89 = getelementptr inbounds i32, i32* %26, i64 %35
store i32 %87, i32* %89
%90 = add nsw i32 %88, -1
br label %91
91: ; preds = %54, %86, %68
%92 = phi i32 [ %38, %54 ], [ %37, %68 ], [ %38, %86 ]
%93 = phi i32 [ %58, %54 ], [ %36, %68 ], [ %90, %86 ]
%94 = add nuw nsw i64 %35, 1
%95 = icmp eq i64 %94, %31
br i1 %95, label %32, label %34
96: ; preds = %112
%97 = icmp slt i32 %113, 0
br i1 %97, label %119, label %98
98: ; preds = %96
%99 = add nuw i32 %113, 1
%100 = zext i32 %99 to i64
br label %120
101: ; preds = %32, %116
%102 = phi i32 [ %118, %116 ], [ undef, %32 ]
%103 = phi i64 [ %114, %116 ], [ 0, %32 ]
%104 = phi i32 [ %113, %116 ], [ -1, %32 ]
%105 = icmp eq i32 %102, %23
br i1 %105, label %106, label %112
106: ; preds = %101
%107 = add nsw i32 %104, 1
%108 = trunc i64 %103 to i32
%109 = sub nsw i32 %108, %23
%110 = sext i32 %107 to i64
%111 = getelementptr inbounds i32, i32* %16, i64 %110
store i32 %109, i32* %111
br label %112
112: ; preds = %101, %106
%113 = phi i32 [ %107, %106 ], [ %104, %101 ]
%114 = add nuw nsw i64 %103, 1
%115 = icmp eq i64 %114, %25
br i1 %115, label %96, label %116
116: ; preds = %112
%117 = getelementptr inbounds i32, i32* %26, i64 %114
%118 = load i32, i32* %117
br label %101
119: ; preds = %120, %32, %96
ret void
120: ; preds = %98, %120
%121 = phi i64 [ 0, %98 ], [ %125, %120 ]
%122 = getelementptr inbounds i32, i32* %16, i64 %121
%123 = load i32, i32* %122
%124 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %12, i32 %123)
%125 = add nuw nsw i64 %121, 1
%126 = icmp eq i64 %125, %100
br i1 %126, label %119, label %120
}