#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 prntB(int *matrix, int nx, int ny) {
  int i;
  for (i = 1; i <= nx * ny; i++) {
    int b_i = (i - 1) / nx, b_j = (i - 1) % nx;
    printf("%d\t", matrix[i - 1]);
    if (i % nx == 0)
      printf("\n");
  }
}


x86 assembly (clang, -O0):
<prntB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jg     11a4 <prntB+0x94>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1191 <prntB+0x81>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1196 <prntB+0x86>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <prntB+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prntB>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebx
imul   %esi,%ebx
test   %ebx,%ebx
jle    117e <prntB+0x5e>
mov    %esi,%r15d
mov    %rdi,%r14
add    $0x1,%ebx
mov    $0x1,%ebp
lea    0xeba(%rip),%r12
jmp    1159 <prntB+0x39>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     117e <prntB+0x5e>
mov    -0x4(%r14,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
cltd
idiv   %r15d
test   %edx,%edx
jne    1150 <prntB+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <prntB+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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