#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(double *C) {
  int i, j;
  printf("\n%p\n", C);
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      printf("%5.2lf ", C[i * 4 + j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    119d <print_matrix+0x8d>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1181 <print_matrix+0x71>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe99(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <print_matrix+0x36>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <print_matrix+0x25>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_matrix>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rbx),%xmm0
lea    0xec2(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x20(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x28(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x30(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x38(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x40(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x48(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x50(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x58(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x60(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x68(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x70(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x78(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"\0A%p\0A\00"
@.str.1 = [8 x i8] c"%5.2lf \00"
define void @print_matrix(double* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double* %0)
%3 = load double, double* %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %3)
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = getelementptr inbounds double, double* %0, i64 2
%9 = load double, double* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %9)
%11 = getelementptr inbounds double, double* %0, i64 3
%12 = load double, double* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = tail call i32 @putchar(i32 10)
%15 = getelementptr inbounds double, double* %0, i64 4
%16 = load double, double* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %16)
%18 = getelementptr inbounds double, double* %0, i64 5
%19 = load double, double* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %19)
%21 = getelementptr inbounds double, double* %0, i64 6
%22 = load double, double* %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %22)
%24 = getelementptr inbounds double, double* %0, i64 7
%25 = load double, double* %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %25)
%27 = tail call i32 @putchar(i32 10)
%28 = getelementptr inbounds double, double* %0, i64 8
%29 = load double, double* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %29)
%31 = getelementptr inbounds double, double* %0, i64 9
%32 = load double, double* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %32)
%34 = getelementptr inbounds double, double* %0, i64 10
%35 = load double, double* %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %35)
%37 = getelementptr inbounds double, double* %0, i64 11
%38 = load double, double* %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %38)
%40 = tail call i32 @putchar(i32 10)
%41 = getelementptr inbounds double, double* %0, i64 12
%42 = load double, double* %41
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %42)
%44 = getelementptr inbounds double, double* %0, i64 13
%45 = load double, double* %44
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %45)
%47 = getelementptr inbounds double, double* %0, i64 14
%48 = load double, double* %47
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %48)
%50 = getelementptr inbounds double, double* %0, i64 15
%51 = load double, double* %50
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %51)
%53 = tail call i32 @putchar(i32 10)
ret void
}