#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 *, int, int, float, float);
void cgemm_print_matrix(int M, int K, float *A) {
  int i, j;
  float *ap = A;
  for (i = 0; i < M; i++) {
    for (j = 0; j < K; j++) {
      printf("%d,%d:	%f\t%f\n", i, j, ap[0], ap[1]);
      ap += 2;
    }
  }
}


x86 assembly (clang, -O0):
<cgemm_print_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a0 <cgemm_print_matrix+0x90>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118d <cgemm_print_matrix+0x7d>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movss  0x4(%rax),%xmm1
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1144 <cgemm_print_matrix+0x34>
jmp    1192 <cgemm_print_matrix+0x82>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <cgemm_print_matrix+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgemm_print_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,0x4(%rsp)
test   %edi,%edi
jle    1185 <cgemm_print_matrix+0x75>
mov    %rdx,%rbx
mov    %edi,%r15d
mov    0x4(%rsp),%r14d
xor    %r13d,%r13d
lea    0xec8(%rip),%r12
jmp    1149 <cgemm_print_matrix+0x39>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13d
cmp    %r15d,%r13d
je     1185 <cgemm_print_matrix+0x75>
cmpl   $0x0,0x4(%rsp)
jle    1140 <cgemm_print_matrix+0x30>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%rbx),%xmm0
movss  0x4(%rbx),%xmm1
mov    %r12,%rdi
mov    %r13d,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
add    $0x8,%rbx
add    $0x1,%rbp
cmp    %ebp,%r14d
jne    1160 <cgemm_print_matrix+0x50>
jmp    1140 <cgemm_print_matrix+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"%d,%d:\09%f\09%f\0A\00"
define void @cgemm_print_matrix(i32 %0, i32 %1, float* nocapture %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %24
5: ; preds = %3
%6 = icmp sgt i32 %1, 0
br label %7
7: ; preds = %5, %20
%8 = phi float* [ %2, %5 ], [ %21, %20 ]
%9 = phi i32 [ 0, %5 ], [ %22, %20 ]
br i1 %6, label %10, label %20
10: ; preds = %7, %10
%11 = phi float* [ %17, %10 ], [ %8, %7 ]
%12 = phi i32 [ %18, %10 ], [ 0, %7 ]
%13 = load float, float* %11
%14 = getelementptr inbounds float, float* %11, i64 1
%15 = load float, float* %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %12, float %13, float %15)
%17 = getelementptr inbounds float, float* %11, i64 2
%18 = add nuw nsw i32 %12, 1
%19 = icmp eq i32 %18, %1
br i1 %19, label %20, label %10
20: ; preds = %10, %7
%21 = phi float* [ %8, %7 ], [ %17, %10 ]
%22 = add nuw nsw i32 %9, 1
%23 = icmp eq i32 %22, %0
br i1 %23, label %24, label %7
24: ; preds = %20, %3
ret void
}