#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_post_prob_matrix(int nr_rows, int nr_cols, long double *mtx) {
  int i, j;
  printf("posterior probability matrix dump:\n");
  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_post_prob_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a5 <dump_post_prob_matrix+0x95>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1189 <dump_post_prob_matrix+0x79>
mov    -0x10(%rbp),%rax
fldt   (%rax)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <dump_post_prob_matrix+0x3a>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <dump_post_prob_matrix+0x27>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_post_prob_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %edi,%r14d
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
test   %r14d,%r14d
jle    11aa <dump_post_prob_matrix+0x7a>
lea    0xea1(%rip),%r13
xor    %r12d,%r12d
jmp    1183 <dump_post_prob_matrix+0x53>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    %r14d,%r12d
je     11aa <dump_post_prob_matrix+0x7a>
test   %r15d,%r15d
jle    1170 <dump_post_prob_matrix+0x40>
mov    %r15d,%ebp
nopl   0x0(%rax,%rax,1)
fldt   (%rbx)
fstpt  (%rsp)
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x10,%rbx
add    $0xffffffff,%ebp
jne    1190 <dump_post_prob_matrix+0x60>
jmp    1170 <dump_post_prob_matrix+0x40>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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