#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 *, char, int, int, int);
void print(char c, int *m) {
  int i;
  int j;
  for (i = 0; i < 500; i++)
    for (j = 0; j < 500; j++)
      printf("%c[%d,%d]=%d\n", c, i, j, m[i * 500 + j]);
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1f4,-0x14(%rbp)
jge    1198 <print+0x88>
movl   $0x0,-0x18(%rbp)
cmpl   $0x1f4,-0x18(%rbp)
jge    1185 <print+0x75>
mov    -0x1(%rbp),%al
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rsi
imul   $0x1f4,-0x14(%rbp),%edi
add    -0x18(%rbp),%edi
movslq %edi,%rdi
mov    (%rsi,%rdi,4),%r8d
lea    0xe91(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113d <print+0x2d>
jmp    118a <print+0x7a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <print+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
xor    %ebx,%ebx
movsbl %dil,%r12d
lea    0xed8(%rip),%r15
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbp,4),%r8d
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    $0x1f4,%rbp
jne    1140 <print+0x30>
add    $0x1,%rbx
add    $0x7d0,%r14
cmp    $0x1f4,%rbx
jne    1130 <print+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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