#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*/ getchar();
int lengthLongestCommonSubsequence(char *, int, char *, int);
int /*<<< orphan*/ printf(char *, char *, char *, int);
int main() {
  char str1[] = "ABCDEFG";
  char str2[] = "BCDGK";
  printf("Length of LCS between \"%s\" and \"%s\" = %d.\n", str1, str2,
         lengthLongestCommonSubsequence(str1, 7, str2, 6));
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xeb9(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xe(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xe(%rbp),%rdx
mov    $0x7,%esi
mov    $0x6,%ecx
call   1030 <lengthLongestCommonSubsequence@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    %eax,%ecx
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x47464544434241,%rax
mov    %rax,0x10(%rsp)
movw   $0x4b,0xc(%rsp)
movl   $0x47444342,0x8(%rsp)
47
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rbx
mov    %r14,%rdi
mov    $0x7,%esi
mov    %rbx,%rdx
mov    $0x6,%ecx
call   1030 <lengthLongestCommonSubsequence@plt>
lea    0xe8b(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str1 = [8 x i8] c"ABCDEFG\00"
@__const.main.str2 = [6 x i8] c"BCDGK\00"
@.str = [43 x i8] c"Length of LCS between \22%s\22 and \22%s\22 = %d.\0A\00"
define i32 @main() {
%1 = alloca [8 x i8]
%2 = alloca [6 x i8]
%3 = bitcast [8 x i8]* %1 to i8*
%4 = bitcast [6 x i8]* %2 to i8*
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%9 = call i32 @lengthLongestCommonSubsequence(i8* %7, i32 7, i8* %8, i32 6)
%10 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6, i32 %9)
%11 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.str2 = [6 x i8] c"BCDGK\00"
@.str = [43 x i8] c"Length of LCS between \22%s\22 and \22%s\22 = %d.\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [6 x i8]
%3 = bitcast i64* %1 to i8*
store i64 20061986658402881, i64* %1
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = call i32 @lengthLongestCommonSubsequence(i8* %3, i32 7, i8* %4, i32 6)
%6 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4, i32 %5)
%7 = call i32 (...) @getchar()
ret i32 0
}