#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 dump_subst_mtx(long double *mtx, int a_size) {
  int i, j;
  int nr_rows = a_size + 1;
  int nr_cols = a_size;
  printf("substitution matrix dump:\n");
  printf("nr rows: %d\n", nr_rows);
  printf("nr columns: %d\n", nr_cols);
  for (i = 0; i < nr_rows; i++) {
    for (j = 0; j < nr_cols; j++) {
      printf("%Lf  ", *mtx);
      mtx++;
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_subst_mtx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11d3 <dump_subst_mtx+0xc3>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b7 <dump_subst_mtx+0xa7>
mov    -0x8(%rbp),%rax
fldt   (%rax)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <dump_subst_mtx+0x68>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1165 <dump_subst_mtx+0x55>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_subst_mtx>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0x1(%r14),%ebp
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    0xea7(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea4(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
js     11ca <dump_subst_mtx+0x9a>
lea    0xe9e(%rip),%r15
xor    %r12d,%r12d
jmp    11a7 <dump_subst_mtx+0x77>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
cmp    %r14d,%r12d
mov    %eax,%r12d
je     11ca <dump_subst_mtx+0x9a>
test   %r14d,%r14d
je     1190 <dump_subst_mtx+0x60>
mov    %r14d,%ebp
nop
fldt   (%rbx)
fstpt  (%rsp)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x10,%rbx
add    $0xffffffff,%ebp
jne    11b0 <dump_subst_mtx+0x80>
jmp    1190 <dump_subst_mtx+0x60>
mov    $0xa,%edi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"substitution matrix dump:\0A\00"
@.str.1 = [13 x i8] c"nr rows: %d\0A\00"
@.str.2 = [16 x i8] c"nr columns: %d\0A\00"
@.str.3 = [6 x i8] c"%Lf \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @dump_subst_mtx(x86_fp80* %0, i32 %1) {
%3 = alloca x86_fp80*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store x86_fp80* %0, x86_fp80** %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
store i32 %10, i32* %7
%11 = load i32, i32* %4
store i32 %11, i32* %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %8
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %15)
store i32 0, i32* %5
br label %17
17: ; preds = %37, %2
%18 = load i32, i32* %5
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %40
21: ; preds = %17
store i32 0, i32* %6
br label %22
22: ; preds = %32, %21
%23 = load i32, i32* %6
%24 = load i32, i32* %8
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %35
26: ; preds = %22
%27 = load x86_fp80*, x86_fp80** %3
%28 = load x86_fp80, x86_fp80* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), x86_fp80 %28)
%30 = load x86_fp80*, x86_fp80** %3
%31 = getelementptr inbounds x86_fp80, x86_fp80* %30, i32 1
store x86_fp80* %31, x86_fp80** %3
br label %32
32: ; preds = %26
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %22
35: ; preds = %22
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %17
40: ; preds = %17
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"nr rows: %d\0A\00"
@.str.2 = [16 x i8] c"nr columns: %d\0A\00"
@.str.3 = [6 x i8] c"%Lf \00"
@str = [26 x i8] c"substitution matrix dump:\00"
define void @dump_subst_mtx(x86_fp80* nocapture %0, i32 %1) {
%3 = add i32 %1, 1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%7 = icmp slt i32 %1, 0
br i1 %7, label %26, label %8
8: ; preds = %2
%9 = icmp eq i32 %1, 0
br label %10
10: ; preds = %8, %21
%11 = phi x86_fp80* [ %0, %8 ], [ %22, %21 ]
%12 = phi i32 [ 0, %8 ], [ %24, %21 ]
br i1 %9, label %21, label %13
13: ; preds = %10, %13
%14 = phi x86_fp80* [ %18, %13 ], [ %11, %10 ]
%15 = phi i32 [ %19, %13 ], [ 0, %10 ]
%16 = load x86_fp80, x86_fp80* %14
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), x86_fp80 %16)
%18 = getelementptr inbounds x86_fp80, x86_fp80* %14, i64 1
%19 = add nuw nsw i32 %15, 1
%20 = icmp eq i32 %19, %1
br i1 %20, label %21, label %13
21: ; preds = %13, %10
%22 = phi x86_fp80* [ %11, %10 ], [ %18, %13 ]
%23 = tail call i32 @putchar(i32 10)
%24 = add nuw i32 %12, 1
%25 = icmp eq i32 %12, %1
br i1 %25, label %26, label %10
26: ; preds = %21, %2
%27 = tail call i32 @putchar(i32 10)
ret void
}