#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void fill_randomly(int size, int table[5][5]) {
  srand(time(NULL));
  int temp_w, temp_h;
  for (temp_w = 0; temp_w < size; temp_w++) {
    for (temp_h = 0; temp_h < size; temp_h++) {
      table[temp_w][temp_h] = (rand() % 100) % 2;
    }
  }
}


x86 assembly (clang, -O0):
<fill_randomly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c5 <fill_randomly+0x95>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b2 <fill_randomly+0x82>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1169 <fill_randomly+0x39>
jmp    11b7 <fill_randomly+0x87>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <fill_randomly+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_randomly>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
jle    11bb <fill_randomly+0x8b>
mov    %ebp,%ebp
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
shr    $0x7,%cl
add    %al,%cl
and    $0xfe,%cl
sub    %cl,%al
movsbl %al,%eax
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <fill_randomly+0x40>
add    $0x1,%r14
add    $0x14,%r15
cmp    %rbp,%r14
jne    1160 <fill_randomly+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fill_randomly(i32 %0, [5 x i32]* nocapture writeonly %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %23
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %20, %6
%9 = phi i64 [ 0, %6 ], [ %21, %20 ]
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %18, %10 ]
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, 100
%14 = trunc i32 %13 to i8
%15 = srem i8 %14, 2
%16 = sext i8 %15 to i32
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 %9, i64 %11
store i32 %16, i32* %17
%18 = add nuw nsw i64 %11, 1
%19 = icmp eq i64 %18, %7
br i1 %19, label %20, label %10
20: ; preds = %10
%21 = add nuw nsw i64 %9, 1
%22 = icmp eq i64 %21, %7
br i1 %22, label %23, label %8
23: ; preds = %20, %2
ret void
}