#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 const *, ...);
void doubles_print_mat44(const double *a, const char *fmt) {
  for (int i = 0; i < 4 * 4; i++) {
    printf(fmt, a[i]);
    if ((i % 4) == 3)
      printf("\n");
  }
}


x86 assembly (clang, -O0):
<doubles_print_mat44>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    117e <doubles_print_mat44+0x6e>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x3,%edx
jne    116b <doubles_print_mat44+0x5b>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1170 <doubles_print_mat44+0x60>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <doubles_print_mat44+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubles_print_mat44>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    113a <doubles_print_mat44+0x1a>
nop
add    $0x1,%rbx
cmp    $0x10,%rbx
je     115e <doubles_print_mat44+0x3e>
movsd  (%r15,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %ebx,%eax
not    %eax
test   $0x3,%al
jne    1130 <doubles_print_mat44+0x10>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1130 <doubles_print_mat44+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @doubles_print_mat44(double* nocapture %0, i8* nocapture %1) {
br label %4
3: ; preds = %13
ret void
4: ; preds = %2, %13
%5 = phi i64 [ 0, %2 ], [ %14, %13 ]
%6 = getelementptr inbounds double, double* %0, i64 %5
%7 = load double, double* %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %1, double %7)
%9 = and i64 %5, 3
%10 = icmp eq i64 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = tail call i32 @putchar(i32 10)
br label %13
13: ; preds = %4, %11
%14 = add nuw nsw i64 %5, 1
%15 = icmp eq i64 %14, 16
br i1 %15, label %3, label %4
}