#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 *findSubstring(char *, char **, int, int *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char *s = "barfoothefoobarman";
  char *words[2] = {"foo", "bar"};
  char *s2 = "barfoofoobarthefoobarman";
  char *words2[3] = {"bar", "foo", "the"};
  char *s3 = "wordgoodgoodgoodbestword";
  char *words3[4] = {"word", "good", "best", "good"};
  char *s4 = "abaababbaba";
  char *words4[4] = {"ab", "ba", "ab", "ba"};
  char *s5 = "cbbabcbac";
  char *words5[2] = {"ab", "cb"};
  int *res = NULL;
  int size = 0;
  res = findSubstring(s, words, 2, &size);
  printf("[");
  for (int i = 0; i < size; i++) {
    printf("%d ", res[i]);
  }
  printf("]\n");
  free(res);
  res = findSubstring(s2, words2, 3, &size);
  printf("[");
  for (int i = 0; i < size; i++) {
    printf("%d ", res[i]);
  }
  printf("]\n");
  free(res);
  res = findSubstring(s3, words3, 4, &size);
  printf("[");
  for (int i = 0; i < size; i++) {
    printf("%d ", res[i]);
  }
  printf("]\n");
  free(res);
  res = findSubstring(s4, words4, 4, &size);
  printf("[");
  for (int i = 0; i < size; i++) {
    printf("%d ", res[i]);
  }
  printf("]\n");
  free(res);
  res = findSubstring(s5, words5, 2, &size);
  printf("[");
  for (int i = 0; i < size; i++) {
    printf("%d ", res[i]);
  }
  printf("]\n");
  free(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2c4c(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c49(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c3b(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c38(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2c35(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xea2(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0x2c2f(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x2c2c(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0x2c29(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0x2c26(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xe8e(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0x2c18(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0x2c12(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0x2c0c(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0x2c06(%rip),%rax
mov    %rax,-0x88(%rbp)
lea    0xe5a(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    0x2bf2(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0x2bec(%rip),%rax
mov    %rax,-0xb8(%rbp)
movq   $0x0,-0xc8(%rbp)
movl   $0x0,-0xcc(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x2,%edx
lea    -0xcc(%rbp),%rcx
call   1040 <findSubstring@plt>
mov    %rax,-0xc8(%rbp)
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
cmp    -0xcc(%rbp),%eax
jge    12c5 <main+0x195>
mov    -0xc8(%rbp),%rax
movslq -0xd0(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    1280 <main+0x150>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x3,%edx
lea    -0xcc(%rbp),%rcx
call   1040 <findSubstring@plt>
mov    %rax,-0xc8(%rbp)
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
cmp    -0xcc(%rbp),%eax
jge    135c <main+0x22c>
mov    -0xc8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1317 <main+0x1e7>
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x4,%edx
lea    -0xcc(%rbp),%rcx
call   1040 <findSubstring@plt>
mov    %rax,-0xc8(%rbp)
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
cmp    -0xcc(%rbp),%eax
jge    13f3 <main+0x2c3>
mov    -0xc8(%rbp),%rax
movslq -0xd8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    13ae <main+0x27e>
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x4,%edx
lea    -0xcc(%rbp),%rcx
call   1040 <findSubstring@plt>
mov    %rax,-0xc8(%rbp)
lea    0xc40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xdc(%rbp)
mov    -0xdc(%rbp),%eax
cmp    -0xcc(%rbp),%eax
jge    148d <main+0x35d>
mov    -0xc8(%rbp),%rax
movslq -0xdc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xc07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    1448 <main+0x318>
lea    0xbe9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa8(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    $0x2,%edx
lea    -0xcc(%rbp),%rcx
call   1040 <findSubstring@plt>
mov    %rax,-0xc8(%rbp)
lea    0xba3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xe0(%rbp)
mov    -0xe0(%rbp),%eax
cmp    -0xcc(%rbp),%eax
jge    152a <main+0x3fa>
mov    -0xc8(%rbp),%rax
movslq -0xe0(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xb6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe0(%rbp)
jmp    14e5 <main+0x3b5>
lea    0xb4c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
movaps 0x2c3d(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    0x2c51(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0x2c35(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2c59(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0x2c3a(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0x2c5e(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0x2c42(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2c56(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xe32(%rip),%rdi
lea    0x40(%rsp),%rsi
lea    0xc(%rsp),%rcx
mov    $0x2,%edx
call   1060 <findSubstring@plt>
mov    %rax,%r15
mov    $0x5b,%edi
call   1040 <putchar@plt>
cmpl   $0x0,0xc(%rsp)
jle    121c <main+0xcc>
lea    0xe7a(%rip),%r14
xor    %ebx,%ebx
nop
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1200 <main+0xb0>
lea    0xe58(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xde4(%rip),%rdi
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rcx
mov    $0x3,%edx
call   1060 <findSubstring@plt>
mov    %rax,%r15
mov    $0x5b,%edi
call   1040 <putchar@plt>
cmpl   $0x0,0xc(%rsp)
jle    128c <main+0x13c>
lea    0xe11(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1270 <main+0x120>
lea    0xde8(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xd91(%rip),%rdi
lea    0x70(%rsp),%rsi
lea    0xc(%rsp),%rcx
mov    $0x4,%edx
call   1060 <findSubstring@plt>
mov    %rax,%r15
mov    $0x5b,%edi
call   1040 <putchar@plt>
cmpl   $0x0,0xc(%rsp)
jle    12fc <main+0x1ac>
lea    0xda1(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     12e0 <main+0x190>
lea    0xd78(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xd44(%rip),%rdi
lea    0x50(%rsp),%rsi
lea    0xc(%rsp),%rcx
mov    $0x4,%edx
call   1060 <findSubstring@plt>
mov    %rax,%r15
mov    $0x5b,%edi
call   1040 <putchar@plt>
cmpl   $0x0,0xc(%rsp)
jle    136c <main+0x21c>
lea    0xd31(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1350 <main+0x200>
lea    0xd08(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xce3(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rcx
mov    $0x2,%edx
call   1060 <findSubstring@plt>
mov    %rax,%r15
mov    $0x5b,%edi
call   1040 <putchar@plt>
cmpl   $0x0,0xc(%rsp)
jle    13dc <main+0x28c>
lea    0xcc1(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     13c0 <main+0x270>
lea    0xc98(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"barfoothefoobarman\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [4 x i8] c"bar\00"
@__const.main.words = [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [25 x i8] c"barfoofoobarthefoobarman\00"
@.str.4 = [4 x i8] c"the\00"
@__const.main.words2 = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [25 x i8] c"wordgoodgoodgoodbestword\00"
@.str.6 = [5 x i8] c"word\00"
@.str.7 = [5 x i8] c"good\00"
@.str.8 = [5 x i8] c"best\00"
@__const.main.words3 = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0)]
@.str.9 = [12 x i8] c"abaababbaba\00"
@.str.10 = [3 x i8] c"ab\00"
@.str.11 = [3 x i8] c"ba\00"
@__const.main.words4 = [4 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [10 x i8] c"cbbabcbac\00"
@.str.13 = [3 x i8] c"cb\00"
@__const.main.words5 = [2 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0)]
@.str.14 = [2 x i8] c"[\00"
@.str.15 = [4 x i8] c"%d \00"
@.str.16 = [3 x i8] c"]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [2 x i8*]
%4 = alloca i8*
%5 = alloca [3 x i8*]
%6 = alloca i8*
%7 = alloca [4 x i8*]
%8 = alloca i8*
%9 = alloca [4 x i8*]
%10 = alloca i8*
%11 = alloca [2 x i8*]
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %2
%19 = bitcast [2 x i8*]* %3 to i8*
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8** %4
%20 = bitcast [3 x i8*]* %5 to i8*
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8** %6
%21 = bitcast [4 x i8*]* %7 to i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8** %8
%22 = bitcast [4 x i8*]* %9 to i8*
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8** %10
%23 = bitcast [2 x i8*]* %11 to i8*
store i32* null, i32** %12
store i32 0, i32* %13
%24 = load i8*, i8** %2
%25 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%26 = call i32* @findSubstring(i8* %24, i8** %25, i32 2, i32* %13)
store i32* %26, i32** %12
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %14
br label %28
28: ; preds = %39, %0
%29 = load i32, i32* %14
%30 = load i32, i32* %13
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %42
32: ; preds = %28
%33 = load i32*, i32** %12
%34 = load i32, i32* %14
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %32
%40 = load i32, i32* %14
%41 = add nsw i32 %40, 1
store i32 %41, i32* %14
br label %28
42: ; preds = %28
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
%44 = load i32*, i32** %12
%45 = call i32 @free(i32* %44)
%46 = load i8*, i8** %4
%47 = getelementptr inbounds [3 x i8*], [3 x i8*]* %5, i64 0, i64 0
%48 = call i32* @findSubstring(i8* %46, i8** %47, i32 3, i32* %13)
store i32* %48, i32** %12
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %15
br label %50
50: ; preds = %61, %42
%51 = load i32, i32* %15
%52 = load i32, i32* %13
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %64
54: ; preds = %50
%55 = load i32*, i32** %12
%56 = load i32, i32* %15
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i32, i32* %55, i64 %57
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %54
%62 = load i32, i32* %15
%63 = add nsw i32 %62, 1
store i32 %63, i32* %15
br label %50
64: ; preds = %50
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
%66 = load i32*, i32** %12
%67 = call i32 @free(i32* %66)
%68 = load i8*, i8** %6
%69 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
%70 = call i32* @findSubstring(i8* %68, i8** %69, i32 4, i32* %13)
store i32* %70, i32** %12
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %16
br label %72
72: ; preds = %83, %64
%73 = load i32, i32* %16
%74 = load i32, i32* %13
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %86
76: ; preds = %72
%77 = load i32*, i32** %12
%78 = load i32, i32* %16
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %77, i64 %79
%81 = load i32, i32* %80
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %81)
br label %83
83: ; preds = %76
%84 = load i32, i32* %16
%85 = add nsw i32 %84, 1
store i32 %85, i32* %16
br label %72
86: ; preds = %72
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
%88 = load i32*, i32** %12
%89 = call i32 @free(i32* %88)
%90 = load i8*, i8** %8
%91 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 0
%92 = call i32* @findSubstring(i8* %90, i8** %91, i32 4, i32* %13)
store i32* %92, i32** %12
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %17
br label %94
94: ; preds = %105, %86
%95 = load i32, i32* %17
%96 = load i32, i32* %13
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %108
98: ; preds = %94
%99 = load i32*, i32** %12
%100 = load i32, i32* %17
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i32, i32* %99, i64 %101
%103 = load i32, i32* %102
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %103)
br label %105
105: ; preds = %98
%106 = load i32, i32* %17
%107 = add nsw i32 %106, 1
store i32 %107, i32* %17
br label %94
108: ; preds = %94
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
%110 = load i32*, i32** %12
%111 = call i32 @free(i32* %110)
%112 = load i8*, i8** %10
%113 = getelementptr inbounds [2 x i8*], [2 x i8*]* %11, i64 0, i64 0
%114 = call i32* @findSubstring(i8* %112, i8** %113, i32 2, i32* %13)
store i32* %114, i32** %12
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %18
br label %116
116: ; preds = %127, %108
%117 = load i32, i32* %18
%118 = load i32, i32* %13
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %130
120: ; preds = %116
%121 = load i32*, i32** %12
%122 = load i32, i32* %18
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i32, i32* %121, i64 %123
%125 = load i32, i32* %124
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %125)
br label %127
127: ; preds = %120
%128 = load i32, i32* %18
%129 = add nsw i32 %128, 1
store i32 %129, i32* %18
br label %116
130: ; preds = %116
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
%132 = load i32*, i32** %12
%133 = call i32 @free(i32* %132)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"barfoothefoobarman\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [4 x i8] c"bar\00"
@__const.main.words = [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [25 x i8] c"barfoofoobarthefoobarman\00"
@.str.4 = [4 x i8] c"the\00"
@__const.main.words2 = [3 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [25 x i8] c"wordgoodgoodgoodbestword\00"
@.str.6 = [5 x i8] c"word\00"
@.str.7 = [5 x i8] c"good\00"
@.str.8 = [5 x i8] c"best\00"
@__const.main.words3 = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0)]
@.str.9 = [12 x i8] c"abaababbaba\00"
@.str.10 = [3 x i8] c"ab\00"
@.str.11 = [3 x i8] c"ba\00"
@__const.main.words4 = [4 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [10 x i8] c"cbbabcbac\00"
@.str.13 = [3 x i8] c"cb\00"
@__const.main.words5 = [2 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0)]
@.str.15 = [4 x i8] c"%d \00"
@str.20 = [2 x i8] c"]\00"
define i32 @main() {
%1 = alloca [2 x i8*]
%2 = alloca [3 x i8*]
%3 = alloca [4 x i8*]
%4 = alloca [4 x i8*]
%5 = alloca [2 x i8*]
%6 = alloca i32
%7 = bitcast [2 x i8*]* %1 to i8*
%8 = bitcast [3 x i8*]* %2 to i8*
%9 = bitcast [4 x i8*]* %3 to i8*
%10 = bitcast [4 x i8*]* %4 to i8*
%11 = bitcast [2 x i8*]* %5 to i8*
%12 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%13 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%14 = call i32* @findSubstring(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %13, i32 2, i32* %6)
%15 = call i32 @putchar(i32 91)
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 0
br i1 %17, label %26, label %18
18: ; preds = %26, %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.20, i64 0, i64 0))
%20 = call i32 @free(i32* %14)
%21 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
%22 = call i32* @findSubstring(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8** %21, i32 3, i32* %6)
%23 = call i32 @putchar(i32 91)
%24 = load i32, i32* %6
%25 = icmp sgt i32 %24, 0
br i1 %25, label %43, label %35
26: ; preds = %0, %26
%27 = phi i64 [ %31, %26 ], [ 0, %0 ]
%28 = getelementptr inbounds i32, i32* %14, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %29)
%31 = add nuw nsw i64 %27, 1
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = icmp slt i64 %31, %33
br i1 %34, label %26, label %18
35: ; preds = %43, %18
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.20, i64 0, i64 0))
%37 = call i32 @free(i32* %22)
%38 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%39 = call i32* @findSubstring(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8** %38, i32 4, i32* %6)
%40 = call i32 @putchar(i32 91)
%41 = load i32, i32* %6
%42 = icmp sgt i32 %41, 0
br i1 %42, label %60, label %52
43: ; preds = %18, %43
%44 = phi i64 [ %48, %43 ], [ 0, %18 ]
%45 = getelementptr inbounds i32, i32* %22, i64 %44
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %46)
%48 = add nuw nsw i64 %44, 1
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = icmp slt i64 %48, %50
br i1 %51, label %43, label %35
52: ; preds = %60, %35
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.20, i64 0, i64 0))
%54 = call i32 @free(i32* %39)
%55 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 0
%56 = call i32* @findSubstring(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8** %55, i32 4, i32* %6)
%57 = call i32 @putchar(i32 91)
%58 = load i32, i32* %6
%59 = icmp sgt i32 %58, 0
br i1 %59, label %77, label %69
60: ; preds = %35, %60
%61 = phi i64 [ %65, %60 ], [ 0, %35 ]
%62 = getelementptr inbounds i32, i32* %39, i64 %61
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %63)
%65 = add nuw nsw i64 %61, 1
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = icmp slt i64 %65, %67
br i1 %68, label %60, label %52
69: ; preds = %77, %52
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.20, i64 0, i64 0))
%71 = call i32 @free(i32* %56)
%72 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 0
%73 = call i32* @findSubstring(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8** %72, i32 2, i32* %6)
%74 = call i32 @putchar(i32 91)
%75 = load i32, i32* %6
%76 = icmp sgt i32 %75, 0
br i1 %76, label %89, label %86
77: ; preds = %52, %77
%78 = phi i64 [ %82, %77 ], [ 0, %52 ]
%79 = getelementptr inbounds i32, i32* %56, i64 %78
%80 = load i32, i32* %79
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %80)
%82 = add nuw nsw i64 %78, 1
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = icmp slt i64 %82, %84
br i1 %85, label %77, label %69
86: ; preds = %89, %69
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.20, i64 0, i64 0))
%88 = call i32 @free(i32* %73)
ret i32 0
89: ; preds = %69, %89
%90 = phi i64 [ %94, %89 ], [ 0, %69 ]
%91 = getelementptr inbounds i32, i32* %73, i64 %90
%92 = load i32, i32* %91
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 %92)
%94 = add nuw nsw i64 %90, 1
%95 = load i32, i32* %6
%96 = sext i32 %95 to i64
%97 = icmp slt i64 %94, %96
br i1 %97, label %89, label %86
}