#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 **);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  srand((unsigned)time(NULL));
  int array[5][5] = {}, i, rand1, rand2;
  for (i = 1; i <= 25; i++) {
    while (1) {
      rand1 = rand() % 5;
      rand2 = rand() % 5;
      if (array[rand1][rand2] == 0) {
        array[rand1][rand2] = i;
        break;
      }
    }
  }
  print(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   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1030 <memset@plt>
movl   $0x1,-0x74(%rbp)
cmpl   $0x19,-0x74(%rbp)
jg     120f <main+0xbf>
jmp    1198 <main+0x48>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x78(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x7c(%rbp)
movslq -0x78(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x7c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11f7 <main+0xa7>
mov    -0x74(%rbp),%edx
movslq -0x78(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x7c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    11fc <main+0xac>
jmp    1198 <main+0x48>
jmp    1201 <main+0xb1>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1189 <main+0x39>
lea    -0x70(%rbp),%rdi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
movslq %ebx,%rcx
cltq
lea    (%rcx,%rcx,4),%rcx
lea    (%rsp,%rcx,4),%rcx
cmpl   $0x0,(%rcx,%rax,4)
jne    1190 <main+0x50>
lea    (%rcx,%rax,4),%rax
mov    %ebp,(%rax)
add    $0x1,%ebp
cmp    $0x1a,%ebp
jne    1190 <main+0x50>
mov    %rsp,%rdi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
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, %18
%7 = phi i32 [ 1, %0 ], [ %19, %18 ]
br label %8
8: ; preds = %6, %8
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 5
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 5
%13 = sext i32 %10 to i64
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 %13, i64 %14
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %8
18: ; preds = %8
store i32 %7, i32* %15
%19 = add nuw nsw i32 %7, 1
%20 = icmp eq i32 %19, 26
br i1 %20, label %21, label %6
21: ; preds = %18
%22 = bitcast [5 x [5 x i32]]* %1 to i32**
%23 = call i32 @print(i32** %22)
ret i32 0
}