#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*/ assert(int);
int levenshtein_dist(char *, char *);
int main(int argc, char *argv[]) {
  assert(levenshtein_dist("", "") == 0);
  assert(levenshtein_dist("same", "same") == 0);
  assert(levenshtein_dist("", "the") == 3);
  assert(levenshtein_dist("the", "") == 3);
  assert(levenshtein_dist("vim", "vm") == 1);
  assert(levenshtein_dist("vm", "vim") == 1);
  assert(levenshtein_dist("a", "as") == 1);
  assert(levenshtein_dist("as", "a") == 1);
  assert(levenshtein_dist("mathematical", "methodical") == 5);
  assert(levenshtein_dist("methodical", "mathematical") == 5);
  assert(levenshtein_dist("string", "sting") +
             levenshtein_dist("sting", "ring") >=
         levenshtein_dist("string", "ring"));
  assert(levenshtein_dist("typographical", "tyopgraphical") == 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed4(%rip),%rsi
mov    %rsi,%rdi
call   1030 <levenshtein_dist@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xea4(%rip),%rsi
mov    %rsi,%rdi
call   1030 <levenshtein_dist@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe96(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe67(%rip),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe48(%rip),%rdi
lea    0xe45(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe29(%rip),%rdi
lea    0xe1e(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe09(%rip),%rdi
lea    0xe04(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xde8(%rip),%rdi
lea    0xddf(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdc8(%rip),%rdi
lea    0xdce(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdb2(%rip),%rdi
lea    0xd9e(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd9a(%rip),%rdi
lea    0xd9a(%rip),%rsi
call   1030 <levenshtein_dist@plt>
mov    %eax,-0x18(%rbp)
lea    0xd8b(%rip),%rdi
lea    0xd7f(%rip),%rsi
call   1030 <levenshtein_dist@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
lea    0xd67(%rip),%rdi
lea    0xd62(%rip),%rsi
call   1030 <levenshtein_dist@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd4d(%rip),%rdi
lea    0xd54(%rip),%rsi
call   1030 <levenshtein_dist@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xee3(%rip),%r14
mov    %r14,%rdi
mov    %r14,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xeb3(%rip),%rdi
mov    %rdi,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe9c(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe67(%rip),%r14
lea    0xe64(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe2e(%rip),%r14
lea    0xe29(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xdf3(%rip),%r14
lea    0xdf9(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xdcb(%rip),%r14
lea    0xdcb(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <levenshtein_dist@plt>
mov    %eax,%ebp
lea    0xdb2(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <levenshtein_dist@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    %eax,%ebx
setge  %dil
call   1040 <assert@plt>
lea    0xd8f(%rip),%rdi
lea    0xd96(%rip),%rsi
call   1030 <levenshtein_dist@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"same\00"
@.str.2 = [4 x i8] c"the\00"
@.str.3 = [4 x i8] c"vim\00"
@.str.4 = [3 x i8] c"vm\00"
@.str.5 = [2 x i8] c"a\00"
@.str.6 = [3 x i8] c"as\00"
@.str.7 = [13 x i8] c"mathematical\00"
@.str.8 = [11 x i8] c"methodical\00"
@.str.9 = [7 x i8] c"string\00"
@.str.10 = [6 x i8] c"sting\00"
@.str.11 = [5 x i8] c"ring\00"
@.str.12 = [14 x i8] c"typographical\00"
@.str.13 = [14 x i8] c"tyopgraphical\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 3
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i32 %18, 3
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i32 %22, 1
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32 %26, 1
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%31 = icmp eq i32 %30, 1
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp eq i32 %34, 1
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%39 = icmp eq i32 %38, 5
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%43 = icmp eq i32 %42, 5
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%47 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%48 = add nsw i32 %46, %47
%49 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%50 = icmp sge i32 %48, %49
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = call i32 @levenshtein_dist(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
%54 = icmp eq i32 %53, 2
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"same\00"
@.str.2 = [4 x i8] c"the\00"
@.str.3 = [4 x i8] c"vim\00"
@.str.4 = [3 x i8] c"vm\00"
@.str.5 = [2 x i8] c"a\00"
@.str.6 = [3 x i8] c"as\00"
@.str.7 = [13 x i8] c"mathematical\00"
@.str.8 = [11 x i8] c"methodical\00"
@.str.9 = [7 x i8] c"string\00"
@.str.10 = [6 x i8] c"sting\00"
@.str.11 = [5 x i8] c"ring\00"
@.str.12 = [14 x i8] c"typographical\00"
@.str.13 = [14 x i8] c"tyopgraphical\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32 %11, 3
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, 3
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp eq i32 %19, 1
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%28 = icmp eq i32 %27, 1
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i32 %31, 1
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%36 = icmp eq i32 %35, 5
%37 = zext i1 %36 to i32
%38 = tail call i32 @assert(i32 %37)
%39 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp eq i32 %39, 5
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
%43 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%44 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%45 = add nsw i32 %44, %43
%46 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%47 = icmp sge i32 %45, %46
%48 = zext i1 %47 to i32
%49 = tail call i32 @assert(i32 %48)
%50 = tail call i32 @levenshtein_dist(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
%51 = icmp eq i32 %50, 2
%52 = zext i1 %51 to i32
%53 = tail call i32 @assert(i32 %52)
ret i32 0
}