#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*/ free(char *);
int /*<<< orphan*/ printf(char *, ...);
char *strutil_lcs(char *, char *);
int main(void) {
  char *str1 = "Spanking";
  char *str2 = "Amputation";
  char *lcs = strutil_lcs(str1, str2);
  printf("Longest Common Subsequence between:\n");
  printf("\"%s\" x \"%s\" = \"%s\"\n", str1, str2, lcs);
  free(lcs);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strutil_lcs@plt>
mov    %rax,-0x20(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xeb4(%rip),%r15
lea    0xeb6(%rip),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strutil_lcs@plt>
mov    %rax,%rbx
lea    0xec0(%rip),%rdi
call   1050 <puts@plt>
lea    0xea0(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Spanking\00"
@.str.1 = [11 x i8] c"Amputation\00"
@.str.2 = [37 x i8] c"Longest Common Subsequence between:\0A\00"
@.str.3 = [20 x i8] c"\22%s\22 x \22%s\22 = \22%s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = call i8* @strutil_lcs(i8* %5, i8* %6)
store i8* %7, i8** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
%13 = load i8*, i8** %4
%14 = call i32 @free(i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Spanking\00"
@.str.1 = [11 x i8] c"Amputation\00"
@.str.3 = [20 x i8] c"\22%s\22 x \22%s\22 = \22%s\22\0A\00"
@str = [36 x i8] c"Longest Common Subsequence between:\00"
define i32 @main() {
%1 = tail call i8* @strutil_lcs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%4 = tail call i32 @free(i8* %1)
ret i32 0
}