#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void d_print_tran_to_file_mat(FILE *file, int row, int col, double *A,
                              int lda) {
  int i, j;
  for (j = 0; j < col; j++) {
    for (i = 0; i < row; i++) {
      fprintf(file, "%9.5f ", A[i + lda * j]);
    }
    fprintf(file, "\n");
  }
  fprintf(file, "\n");
}


x86 assembly (clang, -O0):
<d_print_tran_to_file_mat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11a8 <d_print_tran_to_file_mat+0x98>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1188 <d_print_tran_to_file_mat+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe8d(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1144 <d_print_tran_to_file_mat+0x34>
mov    -0x8(%rbp),%rdi
lea    0xe74(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1131 <d_print_tran_to_file_mat+0x21>
mov    -0x8(%rbp),%rdi
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_print_tran_to_file_mat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,0x4(%rsp)
mov    %rdi,%r14
test   %edx,%edx
jle    11ae <d_print_tran_to_file_mat+0x8e>
mov    %rcx,%rbx
movslq %r8d,%rax
mov    %edx,%ecx
mov    %rcx,0x8(%rsp)
mov    0x4(%rsp),%r15d
shl    $0x3,%rax
mov    %rax,0x10(%rsp)
xor    %r13d,%r13d
lea    0xea2(%rip),%rbp
jmp    117d <d_print_tran_to_file_mat+0x5d>
mov    $0xa,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
add    $0x1,%r13
add    0x10(%rsp),%rbx
cmp    0x8(%rsp),%r13
je     11ae <d_print_tran_to_file_mat+0x8e>
cmpl   $0x0,0x4(%rsp)
jle    1160 <d_print_tran_to_file_mat+0x40>
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%r12,8),%xmm0
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x1,%r12
cmp    %r12,%r15
jne    1190 <d_print_tran_to_file_mat+0x70>
jmp    1160 <d_print_tran_to_file_mat+0x40>
mov    $0xa,%edi
mov    %r14,%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%9.5f \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @d_print_tran_to_file_mat(i32* %0, i32 %1, i32 %2, double* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double* %3, double** %9
store i32 %4, i32* %10
store i32 0, i32* %12
br label %13
13: ; preds = %40, %5
%14 = load i32, i32* %12
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %43
17: ; preds = %13
store i32 0, i32* %11
br label %18
18: ; preds = %34, %17
%19 = load i32, i32* %11
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %37
22: ; preds = %18
%23 = load i32*, i32** %6
%24 = load double*, double** %9
%25 = load i32, i32* %11
%26 = load i32, i32* %10
%27 = load i32, i32* %12
%28 = mul nsw i32 %26, %27
%29 = add nsw i32 %25, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %24, i64 %30
%32 = load double, double* %31
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %32)
br label %34
34: ; preds = %22
%35 = load i32, i32* %11
%36 = add nsw i32 %35, 1
store i32 %36, i32* %11
br label %18
37: ; preds = %18
%38 = load i32*, i32** %6
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %37
%41 = load i32, i32* %12
%42 = add nsw i32 %41, 1
store i32 %42, i32* %12
br label %13
43: ; preds = %13
%44 = load i32*, i32** %6
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%9.5f \00"
define void @d_print_tran_to_file_mat(i32* nocapture %0, i32 %1, i32 %2, double* nocapture %3, i32 %4) {
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %28
7: ; preds = %5
%8 = icmp sgt i32 %1, 0
%9 = sext i32 %4 to i64
%10 = zext i32 %2 to i64
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %7, %24
%13 = phi i64 [ 0, %7 ], [ %26, %24 ]
br i1 %8, label %14, label %24
14: ; preds = %12
%15 = mul nsw i64 %13, %9
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 0, %14 ], [ %22, %16 ]
%18 = add nsw i64 %17, %15
%19 = getelementptr inbounds double, double* %3, i64 %18
%20 = load double, double* %19
%21 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %20)
%22 = add nuw nsw i64 %17, 1
%23 = icmp eq i64 %22, %11
br i1 %23, label %24, label %16
24: ; preds = %16, %12
%25 = tail call i32 @fputc(i32 10, i32* %0)
%26 = add nuw nsw i64 %13, 1
%27 = icmp eq i64 %26, %10
br i1 %27, label %28, label %12
28: ; preds = %24, %5
%29 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}