#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 printData(int *pdata, int size) {
  int i, j;
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      if (*(pdata + (i * size) + j) == 32768) {
        printf("  MAX");
      } else {
        printf("%5d", *(pdata + (i * size) + j));
      }
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d7 <printData+0xc7>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bb <printData+0xab>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x8000,(%rax,%rcx,4)
jne    117e <printData+0x6e>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a8 <printData+0x98>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ad <printData+0x9d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <printData+0x29>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printData+0x16>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printData>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11ab <printData+0x8b>
mov    %rdi,%rbx
mov    %esi,%r12d
lea    0x0(,%r12,4),%rax
mov    %rax,(%rsp)
lea    0xeb8(%rip),%r14
lea    0xeb7(%rip),%r15
xor    %ebp,%ebp
jmp    1177 <printData+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    (%rsp),%rbx
cmp    %r12,%rbp
je     11ab <printData+0x8b>
xor    %r13d,%r13d
jmp    1193 <printData+0x73>
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13
cmp    %r13,%r12
je     1160 <printData+0x40>
mov    (%rbx,%r13,4),%esi
cmp    $0x8000,%esi
jne    1180 <printData+0x60>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    118a <printData+0x6a>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c" MAX\00"
@.str.1 = [4 x i8] c"%5d\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @printData(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %48, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %51
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %43, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %46
16: ; preds = %12
%17 = load i32*, i32** %3
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = mul nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %17, i64 %21
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 32768
br i1 %27, label %28, label %30
28: ; preds = %16
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %42
30: ; preds = %16
%31 = load i32*, i32** %3
%32 = load i32, i32* %5
%33 = load i32, i32* %4
%34 = mul nsw i32 %32, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %31, i64 %35
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %30, %28
br label %43
43: ; preds = %42
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %12
46: ; preds = %12
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %48
48: ; preds = %46
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %7
51: ; preds = %7
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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