#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 *message, int xmin, int xmax, int ymin, int ymax,
                  double **M) {
  int i, j;
  printf("--------------------\n%s\n--------------------\n", message);
  for (j = ymax; j >= ymin; j--) {
    for (i = xmin; i <= xmax; i++) {
      printf("%.3e ", M[i][j]);
    }
    printf("\n");
  }
  printf("--------------------\n");
}


x86 assembly (clang, -O0):
<print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     11b0 <print_matrix+0xa0>
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1194 <print_matrix+0x84>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeaf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1157 <print_matrix+0x47>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1145 <print_matrix+0x35>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %r8d,%r12d
mov    %ecx,%ebx
mov    %edx,0x4(%rsp)
mov    %esi,(%rsp)
mov    %rdi,%rsi
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%r12d
jge    117a <print_matrix+0x4a>
lea    0xecd(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>
movslq (%rsp),%rax
movslq %r12d,%rbp
movslq %ebx,%r12
lea    (%r15,%rax,8),%rbx
mov    0x4(%rsp),%ecx
mov    %ecx,%r14d
sub    %eax,%r14d
add    $0x1,%r14d
lea    0xe91(%rip),%r15
jmp    11b6 <print_matrix+0x86>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%rbp),%rax
cmp    %r12,%rbp
mov    %rax,%rbp
jle    1160 <print_matrix+0x30>
mov    (%rsp),%eax
cmp    0x4(%rsp),%eax
jg     11a0 <print_matrix+0x70>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx,%r13,8),%rax
movsd  (%rax,%rbp,8),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r13
cmp    %r13d,%r14d
jne    11d0 <print_matrix+0xa0>
jmp    11a0 <print_matrix+0x70>

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

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