#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 show_dmat(char name[], char digit[], int nrow, int ncol, double **dmat) {
  printf("%s:\n", name);
  for (int i = 0; i < nrow; ++i) {
    for (int j = 0; j < ncol; ++j)
      printf(digit, dmat[i][j]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<show_dmat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ac <show_dmat+0x9c>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1190 <show_dmat+0x80>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1156 <show_dmat+0x46>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1143 <show_dmat+0x33>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_dmat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r12
mov    %ecx,0x4(%rsp)
mov    %edx,%r15d
mov    %rsi,%r13
mov    %rdi,%rsi
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15d,%r15d
jle    119f <show_dmat+0x7f>
mov    %r15d,%r15d
mov    0x4(%rsp),%ebx
xor    %ebp,%ebp
jmp    1173 <show_dmat+0x53>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %r15,%rbp
je     119f <show_dmat+0x7f>
cmpl   $0x0,0x4(%rsp)
jle    1160 <show_dmat+0x40>
xor    %r14d,%r14d
nopl   (%rax)
mov    (%r12,%rbp,8),%rax
movsd  (%rax,%r14,8),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1180 <show_dmat+0x60>
jmp    1160 <show_dmat+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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