#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*/ print(int const, int const, int **);
int /*<<< orphan*/ printSpiral(int const, int const, int **);
int /*<<< orphan*/ printf(char *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  const int N = 5;
  const int M = 5;
  int matrix[N][M];
  int i, j;
  for (i = 0; i < N; i++)
    for (j = 0; j < M; j++)
      matrix[i][j] = rand() % 100;
  print(N, M, matrix);
  printf("\n");
  printSpiral(N, M, matrix);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x5,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    1206 <main+0xa6>
movl   $0x0,-0x20(%rbp)
cmpl   $0x5,-0x20(%rbp)
jge    11f3 <main+0x93>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
movslq -0x1c(%rbp),%rax
imul   $0x5,%rax,%rcx
lea    -0x90(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11af <main+0x4f>
jmp    11f8 <main+0x98>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119e <main+0x3e>
lea    -0x90(%rbp),%rdx
mov    $0x5,%esi
mov    %esi,%edi
call   1040 <print@plt>
lea    0xde0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdx
mov    $0x5,%esi
mov    %esi,%edi
call   1070 <printSpiral@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x10,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rsp,%rbx,1)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rsp,%rbx,1)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rsp,%rbx,1)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rsp,%rbx,1)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rsp,%rbx,1)
add    $0x14,%rbx
cmp    $0x74,%rbx
jne    1180 <main+0x20>
mov    %rsp,%rbx
mov    $0x5,%edi
mov    $0x5,%esi
mov    %rbx,%rdx
call   1040 <print@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x5,%edi
mov    $0x5,%esi
mov    %rbx,%rdx
call   1070 <printSpiral@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = alloca [25 x i32]
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %22, %4 ]
%6 = mul nuw nsw i64 %5, 5
%7 = getelementptr inbounds [25 x i32], [25 x i32]* %3, i64 0, i64 %6
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 100
store i32 %9, i32* %7
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 100
%12 = getelementptr inbounds i32, i32* %7, i64 1
store i32 %11, i32* %12
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 100
%15 = getelementptr inbounds i32, i32* %7, i64 2
store i32 %14, i32* %15
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, 100
%18 = getelementptr inbounds i32, i32* %7, i64 3
store i32 %17, i32* %18
%19 = tail call i32 (...) @rand()
%20 = srem i32 %19, 100
%21 = getelementptr inbounds i32, i32* %7, i64 4
store i32 %20, i32* %21
%22 = add nuw nsw i64 %5, 1
%23 = icmp eq i64 %22, 5
br i1 %23, label %24, label %4
24: ; preds = %4
%25 = bitcast [25 x i32]* %3 to i32**
%26 = call i32 @print(i32 5, i32 5, i32** %25)
%27 = call i32 @putchar(i32 10)
%28 = call i32 @printSpiral(i32 5, i32 5, i32** %25)
ret i32 0
}