#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 *name, float matrix[][2 * 250]) {
  long i, j;
  printf("%s\n", name);
  for (i = 0; i < (2 * 250); i++) {
    for (j = 0; j < (2 * 250); j++)
      printf("%f ", matrix[i][j]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x1f4,-0x18(%rbp)
jge    11b8 <print_matrix+0xa8>
movq   $0x0,-0x20(%rbp)
cmpq   $0x1f4,-0x20(%rbp)
jge    1199 <print_matrix+0x89>
mov    -0x10(%rbp),%rax
imul   $0x7d0,-0x18(%rbp),%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe83(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1150 <print_matrix+0x40>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113a <print_matrix+0x2a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_matrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
call   1040 <puts@plt>
xor    %r15d,%r15d
lea    0xeb6(%rip),%r14
nopw   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%r12,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x1f4,%rbx
jne    1160 <print_matrix+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
add    $0x7d0,%r12
cmp    $0x1f4,%r15
jne    1150 <print_matrix+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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