#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 print_data_int(int *dat, int N, int M) {
  int i, j;
  for (i = 0; i < N; i++) {
    for (j = 0; j < M - 1; j++) {
      printf("%d ", dat[i * M + j]);
    }
    printf("%d", dat[i * M + (M - 1)]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_data_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c0 <print_data_int+0xb0>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    117d <print_data_int+0x6d>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113c <print_data_int+0x2c>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <print_data_int+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_data_int>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdi,(%rsp)
test   %esi,%esi
jle    11ea <print_data_int+0xca>
mov    %edx,%ebx
movslq %edx,%rax
add    $0xffffffff,%ebx
movslq %ebx,%rcx
mov    %rcx,0x18(%rsp)
mov    %esi,%ecx
mov    %rcx,0x10(%rsp)
mov    %rax,0x20(%rsp)
lea    0x0(,%rax,4),%rax
mov    %rax,0x8(%rsp)
lea    0xe96(%rip),%r15
mov    (%rsp),%rbp
xor    %r14d,%r14d
jmp    11b5 <print_data_int+0x95>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    0x18(%rsp),%r12
mov    (%rsp),%rax
mov    (%rax,%r12,4),%esi
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    0x8(%rsp),%rbp
cmp    0x10(%rsp),%r14
je     11ea <print_data_int+0xca>
mov    %r14,%r12
mov    0x20(%rsp),%rax
imul   %rax,%r12
cmp    $0x2,%eax
jl     1180 <print_data_int+0x60>
xor    %r13d,%r13d
nopl   0x0(%rax)
mov    0x0(%rbp,%r13,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbx
jne    11d0 <print_data_int+0xb0>
jmp    1180 <print_data_int+0x60>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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