#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);
int put_matrix(int ma[][100], int m, int n) {
  int i, j;
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      if (j == 0)
        printf("%d", ma[i][j]);
      else
        printf(" %d", ma[i][j]);
    }
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<put_matrix>:
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    11dc <put_matrix+0xbc>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11c4 <put_matrix+0xa4>
cmpl   $0x0,-0x18(%rbp)
jne    118c <put_matrix+0x6c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
jmp    11b1 <put_matrix+0x91>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
jmp    11b6 <put_matrix+0x96>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <put_matrix+0x2c>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <put_matrix+0x19>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
test   %esi,%esi
jle    11c7 <put_matrix+0xa7>
mov    %edx,%r13d
mov    %esi,%eax
mov    %rax,0x10(%rsp)
mov    %edx,%ebp
xor    %r15d,%r15d
lea    0xeaf(%rip),%rbx
mov    0x8(%rsp),%r14
jmp    117c <put_matrix+0x5c>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
add    $0x190,%r14
cmp    0x10(%rsp),%r15
je     11c7 <put_matrix+0xa7>
test   %r13d,%r13d
jle    1160 <put_matrix+0x40>
imul   $0x190,%r15,%rax
mov    0x8(%rsp),%rcx
mov    (%rcx,%rax,1),%esi
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
cmp    $0x1,%r13d
je     1160 <put_matrix+0x40>
mov    $0x1,%r12d
nopl   0x0(%rax,%rax,1)
mov    (%r14,%r12,4),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
jne    11b0 <put_matrix+0x90>
jmp    1160 <put_matrix+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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