#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*/ buildSuffixArray(char *, int, int *);
scalar_t__ isValid(int, int, int, int);
int /*<<< orphan*/ kasai_lcp(char *, int *, int *, int);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
void findLCS(char *str1, char *str2, int len1, int len2) {
  int i, j;
  char text[1000];
  sprintf(text, "%s#%s", str1, str2);
  int n = len1 + len2 + 1;
  int *suffArr = malloc(sizeof(int) * n);
  for (i = 0; i < n; i++) {
    suffArr[i] = -1;
  }
  buildSuffixArray(text, n, suffArr);
  int lcp_len = n - 1;
  int lcp[lcp_len];
  kasai_lcp(text, lcp, suffArr, n);
  int max_i = 0;
  int max_lcp = 0;
  for (i = 0; i < n; i++) {
    if (i > 0) {
      if ((lcp[i - 1] > max_lcp) &&
          (isValid(i, suffArr[i], suffArr[i - 1], len1))) {
        max_lcp = lcp[i - 1];
        max_i = i;
      }
    }
  }
  if (max_lcp == 0) {
    printf("No common sequence.\n");
  } else {
    char lcs[max_lcp + 1];
    char prev[max_lcp + 1];
    char tmp[2];
    for (i = 0; i < n; i++) {
      if ((lcp[i - 1] == max_lcp) &&
          (isValid(i, suffArr[i], suffArr[i - 1], len1))) {
        sprintf(lcs, "%c", text[suffArr[i - 1]]);
        for (j = suffArr[i - 1] + 1; j < suffArr[i - 1] + max_lcp; j++) {
          sprintf(tmp, "%c", text[j]);
          strcat(lcs, tmp);
        }
        if (strcmp(prev, lcs) != 0) {
          printf("%s\n", lcs);
          sprintf(prev, "%s", lcs);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<findLCS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
movslq -0x414(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x420(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x414(%rbp),%eax
jge    1214 <findLCS+0x94>
mov    -0x420(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e5 <findLCS+0x65>
mov    -0x414(%rbp),%esi
mov    -0x420(%rbp),%rdx
lea    -0x410(%rbp),%rdi
call   1040 <buildSuffixArray@plt>
mov    -0x414(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x424(%rbp)
mov    -0x424(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x430(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x468(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x438(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x420(%rbp),%rdx
mov    -0x414(%rbp),%ecx
call   1070 <kasai_lcp@plt>
movl   $0x0,-0x43c(%rbp)
movl   $0x0,-0x440(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x414(%rbp),%eax
jge    134b <findLCS+0x1cb>
cmpl   $0x0,-0x1c(%rbp)
jle    1338 <findLCS+0x1b8>
mov    -0x468(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x440(%rbp),%eax
jle    1333 <findLCS+0x1b3>
mov    -0x1c(%rbp),%edi
mov    -0x420(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x420(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x14(%rbp),%ecx
call   10a0 <isValid@plt>
cmp    $0x0,%rax
je     1333 <findLCS+0x1b3>
mov    -0x468(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x440(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x43c(%rbp)
jmp    1338 <findLCS+0x1b8>
jmp    133d <findLCS+0x1bd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12a3 <findLCS+0x123>
cmpl   $0x0,-0x440(%rbp)
jne    136b <findLCS+0x1eb>
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1556 <findLCS+0x3d6>
mov    -0x440(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x448(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x478(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x450(%rbp)
mov    -0x440(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x470(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x458(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x414(%rbp),%eax
jge    154c <findLCS+0x3cc>
mov    -0x468(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x440(%rbp),%eax
jne    1539 <findLCS+0x3b9>
mov    -0x1c(%rbp),%edi
mov    -0x420(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x420(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x14(%rbp),%ecx
call   10a0 <isValid@plt>
cmp    $0x0,%rax
je     1539 <findLCS+0x3b9>
mov    -0x478(%rbp),%rdi
mov    -0x420(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movslq (%rax,%rcx,4),%rax
movsbl -0x410(%rbp,%rax,1),%edx
ff
lea    0xbbb(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    -0x420(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x420(%rbp),%rcx
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
add    -0x440(%rbp),%ecx
cmp    %ecx,%eax
jge    14e6 <findLCS+0x366>
lea    -0x45a(%rbp),%rdi
movslq -0x20(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%edx
ff
lea    0xb5d(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    -0x478(%rbp),%rdi
lea    -0x45a(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1480 <findLCS+0x300>
mov    -0x478(%rbp),%rsi
mov    -0x470(%rbp),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1534 <findLCS+0x3b4>
mov    -0x478(%rbp),%rsi
lea    0xb0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x470(%rbp),%rdi
mov    -0x478(%rbp),%rdx
lea    0xad6(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
jmp    1539 <findLCS+0x3b9>
jmp    153e <findLCS+0x3be>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13d2 <findLCS+0x252>
mov    -0x448(%rbp),%rax
mov    %rax,%rsp
mov    -0x430(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findLCS>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xe3a(%rip),%rsi
lea    -0x460(%rbp),%rdi
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %r14d,%r13d
add    %ebx,%r13d
mov    %rbx,-0x68(%rbp)
lea    (%r14,%rbx,1),%r15d
add    $0x1,%r15d
lea    0x4(,%r13,4),%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    %r15d,%ebx
test   %r13d,%r13d
js     1213 <findLCS+0x73>
lea    0x0(,%rbx,4),%rdx
mov    %r12,%rdi
mov    $0xff,%esi
call   1060 <memset@plt>
mov    %rbx,-0x38(%rbp)
lea    -0x460(%rbp),%r14
mov    %r14,%rdi
mov    %r15d,%esi
mov    %r12,%rdx
call   1050 <buildSuffixArray@plt>
mov    %rsp,%rbx
mov    %r13d,%eax
mov    %rsp,%rsi
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
mov    %r14,%rdi
mov    %rsi,-0x40(%rbp)
mov    %r12,%rdx
mov    %r15d,%ecx
call   1090 <kasai_lcp@plt>
test   %r13d,%r13d
js     13ee <findLCS+0x24e>
je     13ee <findLCS+0x24e>
mov    %r13,-0x48(%rbp)
mov    %rbx,-0x50(%rbp)
xor    %r14d,%r14d
mov    $0x1,%ebx
movabs $0x100000000,%r13
mov    -0x38(%rbp),%rax
jmp    129d <findLCS+0xfd>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0x1,%r13
cmp    %rbx,%rax
je     12d0 <findLCS+0x130>
mov    %r13d,%r15d
mov    -0x40(%rbp),%rcx
cmp    %r14d,(%rcx,%r15,4)
jle    1290 <findLCS+0xf0>
mov    (%r12,%rbx,4),%esi
mov    (%r12,%r15,4),%edx
mov    %ebx,%edi
mov    -0x68(%rbp),%rcx
call   10c0 <isValid@plt>
test   %rax,%rax
mov    -0x38(%rbp),%rax
je     1290 <findLCS+0xf0>
mov    -0x40(%rbp),%rcx
mov    (%rcx,%r15,4),%r14d
jmp    1290 <findLCS+0xf0>
test   %r14d,%r14d
mov    -0x50(%rbp),%rbx
mov    -0x48(%rbp),%rcx
je     13ee <findLCS+0x24e>
mov    %r12,-0x60(%rbp)
mov    %rsp,-0x70(%rbp)
lea    0x1(%r14),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rsp,%rdx
sub    %rax,%rdx
mov    %rdx,-0x58(%rbp)
mov    %rdx,%rsp
test   %ecx,%ecx
js     13fc <findLCS+0x25c>
xor    %r13d,%r13d
lea    -0x2a(%rbp),%r12
mov    %rbx,-0x78(%rbp)
jmp    132e <findLCS+0x18e>
add    $0x1,%r13
cmp    -0x38(%rbp),%r13
je     13fc <findLCS+0x25c>
mov    -0x40(%rbp),%rax
cmp    %r14d,-0x4(%rax,%r13,4)
jne    1320 <findLCS+0x180>
mov    -0x60(%rbp),%rax
mov    -0x4(%rax,%r13,4),%edx
mov    (%rax,%r13,4),%esi
mov    %r13d,%edi
mov    -0x68(%rbp),%rcx
call   10c0 <isValid@plt>
test   %rax,%rax
je     1320 <findLCS+0x180>
mov    -0x60(%rbp),%rdx
movslq -0x4(%rdx,%r13,4),%rcx
mov    -0x460(%rbp,%rcx,1),%al
mov    %al,(%rbx)
movb   $0x0,0x1(%rbx)
lea    0x1(%rcx),%eax
add    %r14d,%ecx
cmp    %ecx,%eax
jge    13c0 <findLCS+0x220>
movslq %eax,%r15
mov    %r13,-0x48(%rbp)
xchg   %ax,%ax
movzbl -0x460(%rbp,%r15,1),%eax
ff ff
mov    %al,-0x2a(%rbp)
movb   $0x0,-0x29(%rbp)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r12,%r13
mov    %rdx,%rbx
call   10a0 <strcat@plt>
mov    %rbx,%rdx
mov    -0x48(%rbp),%r13
mov    -0x78(%rbp),%rbx
add    $0x1,%r15
movslq -0x4(%rdx,%r13,4),%rax
movslq %r14d,%rcx
add    %rax,%rcx
cmp    %rcx,%r15
jl     1380 <findLCS+0x1e0>
mov    -0x58(%rbp),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1320 <findLCS+0x180>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    -0x58(%rbp),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
jmp    1320 <findLCS+0x180>
lea    0xc11(%rip),%rdi
call   1040 <puts@plt>
jmp    1404 <findLCS+0x264>
mov    -0x70(%rbp),%rsp
mov    -0x50(%rbp),%rbx
mov    %rbx,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%s#%s\00"
@str = [20 x i8] c"No common sequence.\00"
define void @findLCS(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca [1000 x i8]
%6 = alloca [2 x i8]
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%9 = add i32 %3, %2
%10 = add i32 %9, 1
%11 = shl i32 %10, 2
%12 = tail call i32* @malloc(i32 %11)
%13 = icmp slt i32 %9, 0
br i1 %13, label %18, label %14
14: ; preds = %4
%15 = bitcast i32* %12 to i8*
%16 = zext i32 %10 to i64
%17 = shl nuw nsw i64 %16, 2
br label %18
18: ; preds = %14, %4
%19 = call i32 @buildSuffixArray(i8* %7, i32 %10, i32* %12)
%20 = zext i32 %9 to i64
%21 = call i8* @llvm.stacksave()
%22 = alloca i32, i64 %20
%23 = call i32 @kasai_lcp(i8* %7, i32* %22, i32* %12, i32 %10)
br i1 %13, label %51, label %24
24: ; preds = %18
%25 = zext i32 %10 to i64
%26 = icmp eq i32 %9, 0
br i1 %26, label %51, label %27
27: ; preds = %24, %45
%28 = phi i64 [ %47, %45 ], [ 1, %24 ]
%29 = phi i32 [ %46, %45 ], [ 0, %24 ]
%30 = add nuw i64 %28, 4294967295
%31 = and i64 %30, 4294967295
%32 = getelementptr inbounds i32, i32* %22, i64 %31
%33 = load i32, i32* %32
%34 = icmp sgt i32 %33, %29
br i1 %34, label %35, label %45
35: ; preds = %27
%36 = getelementptr inbounds i32, i32* %12, i64 %28
%37 = load i32, i32* %36
%38 = getelementptr inbounds i32, i32* %12, i64 %31
%39 = load i32, i32* %38
%40 = trunc i64 %28 to i32
%41 = call i64 @isValid(i32 %40, i32 %37, i32 %39, i32 %2)
%42 = icmp eq i64 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %35
%44 = load i32, i32* %32
br label %45
45: ; preds = %43, %35, %27
%46 = phi i32 [ %44, %43 ], [ %29, %35 ], [ %29, %27 ]
%47 = add nuw nsw i64 %28, 1
%48 = icmp eq i64 %47, %25
br i1 %48, label %49, label %27
49: ; preds = %45
%50 = icmp eq i32 %46, 0
br i1 %50, label %51, label %53
51: ; preds = %24, %18, %49
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %108
53: ; preds = %49
%54 = add nsw i32 %46, 1
%55 = zext i32 %54 to i64
%56 = call i8* @llvm.stacksave()
%57 = alloca i8, i64 %55
%58 = alloca i8, i64 %55
%59 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
br i1 %13, label %107, label %60
60: ; preds = %53
%61 = getelementptr inbounds i8, i8* %57, i64 1
%62 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
%63 = zext i32 %10 to i64
br label %64
64: ; preds = %60, %104
%65 = phi i64 [ 0, %60 ], [ %105, %104 ]
%66 = add nsw i64 %65, -1
%67 = getelementptr inbounds i32, i32* %22, i64 %66
%68 = load i32, i32* %67
%69 = icmp eq i32 %68, %46
br i1 %69, label %70, label %104
70: ; preds = %64
%71 = getelementptr inbounds i32, i32* %12, i64 %65
%72 = load i32, i32* %71
%73 = getelementptr inbounds i32, i32* %12, i64 %66
%74 = load i32, i32* %73
%75 = trunc i64 %65 to i32
%76 = call i64 @isValid(i32 %75, i32 %72, i32 %74, i32 %2)
%77 = icmp eq i64 %76, 0
br i1 %77, label %104, label %78
78: ; preds = %70
%79 = load i32, i32* %73
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %80
%82 = load i8, i8* %81
store i8 %82, i8* %57
store i8 0, i8* %61
%83 = add i32 %79, 1
%84 = add nsw i32 %79, %46
%85 = icmp slt i32 %83, %84
br i1 %85, label %86, label %98
86: ; preds = %78
%87 = sext i32 %83 to i64
br label %88
88: ; preds = %86, %88
%89 = phi i64 [ %87, %86 ], [ %93, %88 ]
%90 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %89
%91 = load i8, i8* %90
store i8 %91, i8* %59
store i8 0, i8* %62
%92 = call i32 @strcat(i8* %57, i8* %59)
%93 = add nsw i64 %89, 1
%94 = load i32, i32* %73
%95 = add nsw i32 %94, %46
%96 = sext i32 %95 to i64
%97 = icmp slt i64 %93, %96
br i1 %97, label %88, label %98
98: ; preds = %88, %78
%99 = call i64 @strcmp(i8* %58, i8* %57)
%100 = icmp eq i64 %99, 0
br i1 %100, label %104, label %101
101: ; preds = %98
%102 = call i32 @puts(i8* %57)
%103 = call i8* @strcpy(i8* %58, i8* %57)
br label %104
104: ; preds = %64, %70, %101, %98
%105 = add nuw nsw i64 %65, 1
%106 = icmp eq i64 %105, %63
br i1 %106, label %107, label %64
107: ; preds = %104, %53
br label %108
108: ; preds = %107, %51
ret void
}