#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 EditDistanceDP(char *, char *);
int EditDistanceRecursion(char *, char *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, int);
int /*<<< orphan*/ strlen(char *);
int main() {
  char X[] = "SUNDAY";
  char Y[] = "SATURDAY";
  printf("Minimum edits required to convert %s into %s is %d\n", X, Y,
         EditDistanceDP(X, Y));
  printf("Minimum edits required to convert %s into %s is %d by recursion\n", X,
         Y, EditDistanceRecursion(X, Y, strlen(X), strlen(Y)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xea5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe9d(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xe94(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xe92(%rip),%al
mov    %al,-0xc(%rbp)
lea    -0xb(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0xb(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <EditDistanceDP@plt>
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    %eax,%ecx
lea    0xe62(%rip),%rdi
call   1050 <printf@plt>
lea    -0xb(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xb(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0xb(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    %eax,%ecx
call   1030 <EditDistanceRecursion@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
lea    0xe39(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
movl   $0x594144,0xb(%rsp)
movl   $0x444e5553,0x8(%rsp)
44
movabs $0x5941445255544153,%rax
44 41 59
mov    %rax,0x10(%rsp)
movb   $0x0,0x18(%rsp)
lea    0x8(%rsp),%rbx
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <EditDistanceDP@plt>
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <EditDistanceRecursion@plt>
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.X = [7 x i8] c"SUNDAY\00"
@__const.main.Y = [9 x i8] c"SATURDAY\00"
@.str = [52 x i8] c"Minimum edits required to convert %s into %s is %d\0A\00"
@.str.1 = [65 x i8] c"Minimum edits required to convert %s into %s is %d by recursion\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [9 x i8]
store i32 0, i32* %1
%4 = bitcast [7 x i8]* %2 to i8*
%5 = bitcast [9 x i8]* %3 to i8*
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%10 = call i32 @EditDistanceDP(i8* %8, i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7, i32 %10)
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @EditDistanceRecursion(i8* %14, i8* %15, i32 %17, i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %13, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.X = [7 x i8] c"SUNDAY\00"
@__const.main.Y = [9 x i8] c"SATURDAY\00"
@.str = [52 x i8] c"Minimum edits required to convert %s into %s is %d\0A\00"
@.str.1 = [65 x i8] c"Minimum edits required to convert %s into %s is %d by recursion\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [9 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%5 = call i32 @EditDistanceDP(i8* %3, i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4, i32 %5)
%7 = call i32 @strlen(i8* %3)
%8 = call i32 @strlen(i8* %4)
%9 = call i32 @EditDistanceRecursion(i8* %3, i8* %4, i32 %7, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4, i32 %9)
ret i32 0
}