#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*/ ReadMDM(char *);
int calcscore(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ toupper(char);
main(int argc, char **argv) {
  int score;
  if (argc == 3) {
    ReadMDM("amdata:mdm78.mat");
    score = calcscore(toupper(argv[1][0]), toupper(argv[2][0]));
    printf("Match %c %c scores %d\n", argv[1][0], argv[2][0], score);
  } else {
    printf("Usage: checkmat <seq> <seq>\n");
  }
}


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)
cmpl   $0x3,-0x8(%rbp)
jne    11c8 <main+0x88>
lea    0xe99(%rip),%rdi
call   1060 <ReadMDM@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
call   1050 <calcscore@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%edx
mov    -0x14(%rbp),%ecx
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d6 <main+0x96>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    11aa <main+0x5a>
mov    %rsi,%rbx
lea    0xe9e(%rip),%rdi
call   1070 <ReadMDM@plt>
mov    0x8(%rbx),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <calcscore@plt>
mov    0x8(%rbx),%rcx
mov    0x10(%rbx),%rdx
movsbl (%rcx),%esi
movsbl (%rdx),%edx
lea    0xe72(%rip),%rdi
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11b6 <main+0x66>
lea    0xe77(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"amdata:mdm78.mat\00"
@.str.1 = [23 x i8] c"Match %c %c scores %d\0A\00"
@.str.2 = [29 x i8] c"Usage: checkmat <seq> <seq>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %38
9: ; preds = %2
%10 = call i32 @ReadMDM(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = call i32 @toupper(i8 signext %15)
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = call i32 @toupper(i8 signext %21)
%23 = call i32 @calcscore(i32 %16, i32 %22)
store i32 %23, i32* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 0
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = load i32, i32* %6
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %35, i32 %36)
br label %40
38: ; preds = %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %38, %9
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [17 x i8] c"amdata:mdm78.mat\00"
@.str.1 = [23 x i8] c"Match %c %c scores %d\0A\00"
@str = [28 x i8] c"Usage: checkmat <seq> <seq>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %22
4: ; preds = %2
%5 = tail call i32 @ReadMDM(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = tail call i32 @toupper(i8 signext %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = tail call i32 @toupper(i8 signext %12)
%14 = tail call i32 @calcscore(i32 %9, i32 %13)
%15 = load i8*, i8** %6
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8*, i8** %10
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %20, i32 %14)
br label %24
22: ; preds = %2
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %22, %4
ret i32 0
}