#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 border(int **);
int /*<<< orphan*/ print(int **);
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  srand((unsigned)time(NULL));
  int array[5][5], i, j;
  for (i = 0; i < 5; i++)
    for (j = 0; j < 5; j++)
      array[i][j] = rand() % 10;
  print(array);
  printf("Sum of border: %d", border(array));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    11ea <main+0x8a>
movl   $0x0,-0x78(%rbp)
cmpl   $0x5,-0x78(%rbp)
jge    11d7 <main+0x77>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    119a <main+0x3a>
jmp    11dc <main+0x7c>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1189 <main+0x29>
lea    -0x70(%rbp),%rdi
call   1050 <print@plt>
lea    -0x70(%rbp),%rdi
call   1030 <border@plt>
mov    %eax,%esi
lea    0xdfb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

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

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

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