#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 backtrack(int *, int, int, char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fillmatrix(int *, int, int, char *, char *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *, int, char *);
int strlen(char *);
int score(char *commandstring, char *possibility) {
  int xsize = strlen(commandstring) + 1;
  int ysize = strlen(possibility) + 1;
  int *dpmatrix = (int *)calloc(xsize * ysize, sizeof(int));
  fillmatrix(dpmatrix, xsize, ysize, commandstring, possibility);
  int btresults = backtrack(dpmatrix, xsize, ysize, commandstring);
  if (0)
    printf("%4d %s\n", btresults, possibility);
  if (dpmatrix) {
    free(dpmatrix);
  }
  return btresults;
}


x86 assembly (clang, -O0):
<score>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
imul   -0x18(%rbp),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
call   1070 <fillmatrix@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x8(%rbp),%rcx
call   1060 <backtrack@plt>
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11d4 <score+0x84>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<score>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%r12d
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
imul   %r12d,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r14,%rcx
mov    %r15,%r8
call   1070 <fillmatrix@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r14,%rcx
call   1060 <backtrack@plt>
mov    %eax,%ebp
test   %rbx,%rbx
je     11b7 <score+0x67>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @score(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
store i32 %11, i32* %5
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
%14 = add nsw i32 %13, 1
store i32 %14, i32* %6
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = mul nsw i32 %15, %16
%18 = call i64 @calloc(i32 %17, i32 4)
%19 = inttoptr i64 %18 to i32*
store i32* %19, i32** %7
%20 = load i32*, i32** %7
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = load i8*, i8** %3
%24 = load i8*, i8** %4
%25 = call i32 @fillmatrix(i32* %20, i32 %21, i32 %22, i8* %23, i8* %24)
%26 = load i32*, i32** %7
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = load i8*, i8** %3
%30 = call i32 @backtrack(i32* %26, i32 %27, i32 %28, i8* %29)
store i32 %30, i32* %8
%31 = load i32*, i32** %7
%32 = icmp ne i32* %31, null
br i1 %32, label %33, label %36
33: ; preds = %2
%34 = load i32*, i32** %7
%35 = call i32 @free(i32* %34)
br label %36
36: ; preds = %33, %2
%37 = load i32, i32* %8
ret i32 %37
}

LLVM IR (-O2):
define i32 @score(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = add nsw i32 %3, 1
%5 = tail call i32 @strlen(i8* %1)
%6 = add nsw i32 %5, 1
%7 = mul nsw i32 %6, %4
%8 = tail call i64 @calloc(i32 %7, i32 4)
%9 = inttoptr i64 %8 to i32*
%10 = tail call i32 @fillmatrix(i32* %9, i32 %4, i32 %6, i8* %0, i8* %1)
%11 = tail call i32 @backtrack(i32* %9, i32 %4, i32 %6, i8* %0)
%12 = icmp eq i64 %8, 0
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = tail call i32 @free(i32* %9)
br label %15
15: ; preds = %13, %2
ret i32 %11
}