#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int matIout(FILE *fout, int x[], int n, int m) {
  int i, j;
  for (i = 0, fputc('\n', fout); i < n; i++, fputc('\n', fout))
    for (j = 0; j < m; j++)
      fprintf(fout, "  %4d", x[i * m + j]);
  return (0);
}


x86 assembly (clang, -O0):
<matIout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11bd <matIout+0x9d>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    119c <matIout+0x7c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe77(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115e <matIout+0x3e>
jmp    11a1 <matIout+0x81>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
jmp    114b <matIout+0x2b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matIout>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0x4(%rsp)
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    $0xa,%edi
mov    %rbp,%rsi
call   1030 <fputc@plt>
test   %r15d,%r15d
jle    11ca <matIout+0xaa>
movslq 0x4(%rsp),%rax
mov    %r15d,%ecx
mov    %rcx,0x8(%rsp)
mov    %eax,%r14d
shl    $0x2,%rax
mov    %rax,0x10(%rsp)
xor    %r13d,%r13d
lea    0xe90(%rip),%r15
jmp    119d <matIout+0x7d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r13
mov    $0xa,%edi
mov    %rbp,%rsi
call   1030 <fputc@plt>
add    0x10(%rsp),%rbx
cmp    0x8(%rsp),%r13
je     11ca <matIout+0xaa>
cmpl   $0x0,0x4(%rsp)
jle    1180 <matIout+0x60>
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%r12,4),%edx
mov    %rbp,%rdi
mov    %r15,%rsi
call   1040 <fprintf@plt>
add    $0x1,%r12
cmp    %r12,%r14
jne    11b0 <matIout+0x90>
jmp    1180 <matIout+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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