#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 printArray(int m, int n, int *a) {
  int i = 0, j = 0;
  printf("\nThe result you put is below.\n");
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      if (a[m * i + j] == 0) {
        printf("   ");
      } else {
        printf("%3d", a[m * i + j]);
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e3 <printArray+0xd3>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c7 <printArray+0xb7>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1192 <printArray+0x82>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <printArray+0xa4>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b9 <printArray+0xa9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1158 <printArray+0x48>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <printArray+0x35>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %esi,0x4(%rsp)
mov    %edi,%ebp
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    11e7 <printArray+0xb7>
mov    %ebp,%eax
mov    0x4(%rsp),%ebp
mov    %rax,0x10(%rsp)
lea    0x0(,%rax,4),%rax
mov    %rax,0x8(%rsp)
lea    0xe86(%rip),%r15
lea    0xe83(%rip),%r13
xor    %r12d,%r12d
jmp    11aa <printArray+0x7a>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
add    0x8(%rsp),%rbx
cmp    0x10(%rsp),%r12
je     11e7 <printArray+0xb7>
cmpl   $0x0,0x4(%rsp)
jle    1190 <printArray+0x60>
xor    %r14d,%r14d
jmp    11d3 <printArray+0xa3>
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
je     1190 <printArray+0x60>
mov    (%rbx,%r14,4),%esi
test   %esi,%esi
jne    11c0 <printArray+0x90>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ca <printArray+0x9a>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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