#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_matrix(char *title, double A[], int m, int n) {
  int i, j;
  printf("%s\n", title);
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++)
      printf("%6.3f ", A[i * n + j]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<Print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ac <Print_matrix+0x9c>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1190 <Print_matrix+0x80>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1152 <Print_matrix+0x42>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <Print_matrix+0x2f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0xc(%rsp)
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <puts@plt>
test   %ebp,%ebp
jle    11bb <Print_matrix+0x8b>
movslq 0xc(%rsp),%r15
mov    %ebp,%eax
mov    %rax,0x10(%rsp)
mov    %r15d,%ebp
shl    $0x3,%r15
xor    %r14d,%r14d
lea    0xe93(%rip),%r13
jmp    1188 <Print_matrix+0x58>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    %r15,%rbx
cmp    0x10(%rsp),%r14
je     11bb <Print_matrix+0x8b>
cmpl   $0x0,0xc(%rsp)
jle    1170 <Print_matrix+0x40>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rbx,%r12,8),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
jne    11a0 <Print_matrix+0x70>
jmp    1170 <Print_matrix+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%6.3f \00"
define void @Print_matrix(i8* nocapture %0, double* nocapture %1, i32 %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) %0)
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %28
7: ; preds = %4
%8 = icmp sgt i32 %3, 0
%9 = sext i32 %3 to i64
%10 = zext i32 %2 to i64
%11 = zext i32 %3 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* %1, i64 %18
%20 = load double, double* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, 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 @putchar(i32 10)
%26 = add nuw nsw i64 %13, 1
%27 = icmp eq i64 %26, %10
br i1 %27, label %28, label %12
28: ; preds = %24, %4
ret void
}