#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 /*<<< orphan*/ putchar(char);
void printAnswer(int row, int col, int *arr) {
  printf("%d %d\n", row, col);
  for (int r = 0; r < row; ++r) {
    printf("%d", arr[r * col]);
    for (int c = 1; c < col; ++c) {
      printf(" %d", arr[r * col + c]);
    }
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<printAnswer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d3 <printAnswer+0xb3>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x8(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bb <printAnswer+0x9b>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117f <printAnswer+0x5f>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <printAnswer+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAnswer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,0x10(%rsp)
mov    %esi,%edx
mov    %edi,%ebx
lea    0xec2(%rip),%rdi
mov    %ebx,%esi
mov    %edx,0xc(%rsp)
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    11f9 <printAnswer+0xd9>
mov    0xc(%rsp),%eax
movslq %eax,%rcx
mov    %ebx,%edx
mov    %rdx,0x18(%rsp)
mov    %eax,%r14d
mov    %rcx,0x20(%rsp)
lea    0x0(,%rcx,4),%r15
lea    0xe8f(%rip),%rbx
mov    0x10(%rsp),%r12
xor    %r13d,%r13d
jmp    11a8 <printAnswer+0x88>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    %r15,%r12
cmp    0x18(%rsp),%r13
je     11f9 <printAnswer+0xd9>
mov    %r13,%rax
imul   0x20(%rsp),%rax
mov    0x10(%rsp),%rcx
mov    (%rcx,%rax,4),%esi
lea    0xe48(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x2,0xc(%rsp)
jl     1190 <printAnswer+0x70>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r12,%rbp,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11e0 <printAnswer+0xc0>
jmp    1190 <printAnswer+0x70>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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