#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 floats_print_mat44(const float *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):
<floats_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    1182 <floats_print_mat44+0x72>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x3,%edx
jne    116f <floats_print_mat44+0x5f>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1174 <floats_print_mat44+0x64>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <floats_print_mat44+0x17>
add    $0x20,%rsp
pop    %rbp
ret

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

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

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