#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();
void initGamePlane(int plane[50][50], int size) {
  int i = 0, j = 0, nb = 0;
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      nb = rand() % (100) + 1;
      if (nb > 66) {
        plane[i][j] = 1;
      } else {
        plane[i][j] = 0;
      }
    }
  }
}


x86 assembly (clang, -O0):
<initGamePlane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11de <initGamePlane+0xce>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cb <initGamePlane+0xbb>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
cmpl   $0x42,-0x18(%rbp)
jle    119b <initGamePlane+0x8b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    11b8 <initGamePlane+0xa8>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    11bd <initGamePlane+0xad>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <initGamePlane+0x3e>
jmp    11d0 <initGamePlane+0xc0>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <initGamePlane+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initGamePlane>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1187 <initGamePlane+0x77>
mov    %rdi,%r12
mov    %esi,%r14d
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <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
xor    %ecx,%ecx
cmp    $0x42,%eax
setge  %cl
mov    %ecx,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <initGamePlane+0x30>
add    $0x1,%r15
add    $0xc8,%r12
cmp    %r14,%r15
jne    1130 <initGamePlane+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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