#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*/ printf(char *, ...);
void print_tables(int sequence_length, int *score_table, int *traceback_table) {
  printf("\n----Score Table----\n");
  int i, j;
  for (i = 0; i < sequence_length; i++) {
    for (j = 0; j < sequence_length; j++) {
      printf("%d\t", score_table[i * sequence_length + j]);
    }
    printf("\n");
  }
  printf("\n----End of Score Table----\n");
  printf("\n----Traceback Table----\n");
  for (i = 0; i < sequence_length; i++) {
    for (j = 0; j < sequence_length; j++) {
      printf("%d\t", traceback_table[i * sequence_length + j]);
    }
    printf("\n");
  }
  printf("\n----End of Traceback Table----\n");
}


x86 assembly (clang, -O0):
<print_tables>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a3 <print_tables+0x93>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1187 <print_tables+0x77>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114b <print_tables+0x3b>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1138 <print_tables+0x28>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1231 <print_tables+0x121>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1215 <print_tables+0x105>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d9 <print_tables+0xc9>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c6 <print_tables+0xb6>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tables>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %edi,%ebx
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
jle    123f <print_tables+0x10f>
mov    %ebx,0xc(%rsp)
mov    %ebx,%ebx
lea    0x0(,%rbx,4),%rax
mov    %rax,0x10(%rsp)
lea    0xe8c(%rip),%r12
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp,%r13,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbx
jne    1190 <print_tables+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    0x10(%rsp),%rbp
cmp    %rbx,%r14
jne    1180 <print_tables+0x50>
lea    0xe52(%rip),%rdi
call   1040 <puts@plt>
lea    0xe62(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    1257 <print_tables+0x127>
lea    0x0(,%rbx,4),%r14
lea    0xe12(%rip),%r13
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbp,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1210 <print_tables+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
add    %r14,%r15
cmp    %rbx,%r12
jne    1200 <print_tables+0xd0>
jmp    1257 <print_tables+0x127>
lea    0xdd3(%rip),%rdi
call   1040 <puts@plt>
lea    0xde3(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf0(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"\0A----Score Table----\0A\00"
@.str.1 = [4 x i8] c"%d\09\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [29 x i8] c"\0A----End of Score Table----\0A\00"
@.str.4 = [26 x i8] c"\0A----Traceback Table----\0A\00"
@.str.5 = [33 x i8] c"\0A----End of Traceback Table----\0A\00"
define void @print_tables(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %10
10: ; preds = %35, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %38
14: ; preds = %10
store i32 0, i32* %8
br label %15
15: ; preds = %30, %14
%16 = load i32, i32* %8
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = load i32*, i32** %5
%21 = load i32, i32* %7
%22 = load i32, i32* %4
%23 = mul nsw i32 %21, %22
%24 = load i32, i32* %8
%25 = add nsw i32 %23, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %20, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %19
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %15
33: ; preds = %15
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %10
38: ; preds = %10
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %7
br label %41
41: ; preds = %66, %38
%42 = load i32, i32* %7
%43 = load i32, i32* %4
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %69
45: ; preds = %41
store i32 0, i32* %8
br label %46
46: ; preds = %61, %45
%47 = load i32, i32* %8
%48 = load i32, i32* %4
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %64
50: ; preds = %46
%51 = load i32*, i32** %6
%52 = load i32, i32* %7
%53 = load i32, i32* %4
%54 = mul nsw i32 %52, %53
%55 = load i32, i32* %8
%56 = add nsw i32 %54, %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i32, i32* %51, i64 %57
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %50
%62 = load i32, i32* %8
%63 = add nsw i32 %62, 1
store i32 %63, i32* %8
br label %46
64: ; preds = %46
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %66
66: ; preds = %64
%67 = load i32, i32* %7
%68 = add nsw i32 %67, 1
store i32 %68, i32* %7
br label %41
69: ; preds = %41
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\09\00"
@str = [21 x i8] c"\0A----Score Table----\00"
@str.6 = [28 x i8] c"\0A----End of Score Table----\00"
@str.7 = [25 x i8] c"\0A----Traceback Table----\00"
@str.8 = [32 x i8] c"\0A----End of Traceback Table----\00"
define void @print_tables(i32 %0, i32* nocapture %1, i32* nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %45
6: ; preds = %3
%7 = zext i32 %0 to i64
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %20, %6
%10 = phi i64 [ 0, %6 ], [ %22, %20 ]
%11 = mul nsw i64 %10, %7
br label %12
12: ; preds = %9, %12
%13 = phi i64 [ 0, %9 ], [ %18, %12 ]
%14 = add nuw nsw i64 %13, %11
%15 = getelementptr inbounds i32, i32* %1, i64 %14
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i64 %13, 1
%19 = icmp eq i64 %18, %8
br i1 %19, label %20, label %12
20: ; preds = %12
%21 = tail call i32 @putchar(i32 10)
%22 = add nuw nsw i64 %10, 1
%23 = icmp eq i64 %22, %8
br i1 %23, label %24, label %9
24: ; preds = %20
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
br i1 %5, label %27, label %48
27: ; preds = %24
%28 = zext i32 %0 to i64
%29 = zext i32 %0 to i64
br label %30
30: ; preds = %41, %27
%31 = phi i64 [ 0, %27 ], [ %43, %41 ]
%32 = mul nsw i64 %31, %28
br label %33
33: ; preds = %30, %33
%34 = phi i64 [ 0, %30 ], [ %39, %33 ]
%35 = add nuw nsw i64 %34, %32
%36 = getelementptr inbounds i32, i32* %2, i64 %35
%37 = load i32, i32* %36
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = add nuw nsw i64 %34, 1
%40 = icmp eq i64 %39, %29
br i1 %40, label %41, label %33
41: ; preds = %33
%42 = tail call i32 @putchar(i32 10)
%43 = add nuw nsw i64 %31, 1
%44 = icmp eq i64 %43, %29
br i1 %44, label %48, label %30
45: ; preds = %3
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
br label %48
48: ; preds = %41, %45, %24
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
ret void
}