#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 lcs(char *, char *, int, int);
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
int main() {
  char X[] = "AGGTAB";
  char Y[] = "GXTXAYB";
  int m = strlen(X);
  int n = strlen(Y);
  printf("Length of LCS is %dn", lcs(X, Y, m, n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xead(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x13(%rbp)
lea    -0xb(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
lea    -0x13(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
lea    -0xb(%rbp),%rdi
lea    -0x13(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1040 <lcs@plt>
mov    %eax,%esi
lea    0xe74(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x424154,0x3(%rsp)
movl   $0x54474741,(%rsp)
movabs $0x42594158545847,%rax
mov    %rax,0x8(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <lcs@plt>
lea    0xe81(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.X = [7 x i8] c"AGGTAB\00"
@__const.main.Y = [8 x i8] c"GXTXAYB\00"
@.str = [21 x i8] c"Length of LCS is %dn\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [8 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [7 x i8]* %2 to i8*
%7 = bitcast [8 x i8]* %3 to i8*
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %4
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %5
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @lcs(i8* %12, i8* %13, i32 %14, i32 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.X = [7 x i8] c"AGGTAB\00"
@.str = [21 x i8] c"Length of LCS is %dn\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca i64
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = bitcast i64* %2 to i8*
store i64 18675485652572231, i64* %2
%5 = call i32 @strlen(i8* %3)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @lcs(i8* %3, i8* %4, i32 %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}