#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 */
size_t randmax(int);
void createEntreeSortie(int rowsh, int colsh, int **arrayh, int rowsv,
                        int colsv, int **arrayv) {
  int r;
  r = randmax(2);
  if (r == 0) {
    arrayh[0][randmax(colsh)] = 0;
  } else {
    arrayh[rowsh - 1][randmax(colsh)] = 0;
  }
  r = randmax(2);
  if (r == 0) {
    arrayv[randmax(rowsv)][0] = 0;
  } else {
    arrayv[randmax(rowsv)][colsv - 1] = 0;
  }
}


x86 assembly (clang, -O0):
<createEntreeSortie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x2,%edi
call   1030 <randmax@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    116a <createEntreeSortie+0x5a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <randmax@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax,%rcx,4)
jmp    1195 <createEntreeSortie+0x85>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <randmax@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
movl   $0x0,(%rax,%rcx,4)
mov    $0x2,%edi
call   1030 <randmax@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11d2 <createEntreeSortie+0xc2>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <randmax@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
mov    (%rax,%rcx,8),%rax
movl   $0x0,(%rax)
jmp    11fd <createEntreeSortie+0xed>
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <randmax@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createEntreeSortie>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%ebx
mov    %ecx,%r15d
mov    %rdx,%r13
mov    %esi,%r12d
mov    %edi,%ebp
mov    $0x2,%edi
call   1030 <randmax@plt>
add    $0xffffffff,%ebp
test   %eax,%eax
cmove  %eax,%ebp
movslq %ebp,%rax
mov    0x0(%r13,%rax,8),%rbp
mov    %r12d,%edi
call   1030 <randmax@plt>
movl   $0x0,0x0(%rbp,%rax,4)
mov    $0x2,%edi
call   1030 <randmax@plt>
mov    %rax,%rbp
mov    %r15d,%edi
call   1030 <randmax@plt>
add    $0xffffffff,%ebx
test   %ebp,%ebp
mov    (%r14,%rax,8),%rax
cmove  %ebp,%ebx
movslq %ebx,%rcx
movl   $0x0,(%rax,%rcx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @createEntreeSortie(i32 %0, i32 %1, i32** %2, i32 %3, i32 %4, i32** %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32**
%13 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32** %2, i32*** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32** %5, i32*** %12
%14 = call i64 @randmax(i32 2)
%15 = trunc i64 %14 to i32
store i32 %15, i32* %13
%16 = load i32, i32* %13
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %6
%19 = load i32**, i32*** %9
%20 = getelementptr inbounds i32*, i32** %19, i64 0
%21 = load i32*, i32** %20
%22 = load i32, i32* %8
%23 = call i64 @randmax(i32 %22)
%24 = getelementptr inbounds i32, i32* %21, i64 %23
store i32 0, i32* %24
br label %35
25: ; preds = %6
%26 = load i32**, i32*** %9
%27 = load i32, i32* %7
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32*, i32** %26, i64 %29
%31 = load i32*, i32** %30
%32 = load i32, i32* %8
%33 = call i64 @randmax(i32 %32)
%34 = getelementptr inbounds i32, i32* %31, i64 %33
store i32 0, i32* %34
br label %35
35: ; preds = %25, %18
%36 = call i64 @randmax(i32 2)
%37 = trunc i64 %36 to i32
store i32 %37, i32* %13
%38 = load i32, i32* %13
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %35
%41 = load i32**, i32*** %12
%42 = load i32, i32* %10
%43 = call i64 @randmax(i32 %42)
%44 = getelementptr inbounds i32*, i32** %41, i64 %43
%45 = load i32*, i32** %44
%46 = getelementptr inbounds i32, i32* %45, i64 0
store i32 0, i32* %46
br label %57
47: ; preds = %35
%48 = load i32**, i32*** %12
%49 = load i32, i32* %10
%50 = call i64 @randmax(i32 %49)
%51 = getelementptr inbounds i32*, i32** %48, i64 %50
%52 = load i32*, i32** %51
%53 = load i32, i32* %11
%54 = sub nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %52, i64 %55
store i32 0, i32* %56
br label %57
57: ; preds = %47, %40
ret void
}

LLVM IR (-O2):
define void @createEntreeSortie(i32 %0, i32 %1, i32** nocapture %2, i32 %3, i32 %4, i32** nocapture %5) {
%7 = tail call i64 @randmax(i32 2)
%8 = trunc i64 %7 to i32
%9 = icmp eq i32 %8, 0
%10 = add nsw i32 %0, -1
%11 = select i1 %9, i32 0, i32 %10
%12 = sext i32 %11 to i64
%13 = getelementptr i32*, i32** %2, i64 %12
%14 = load i32*, i32** %13
%15 = tail call i64 @randmax(i32 %1)
%16 = getelementptr inbounds i32, i32* %14, i64 %15
store i32 0, i32* %16
%17 = tail call i64 @randmax(i32 2)
%18 = trunc i64 %17 to i32
%19 = icmp eq i32 %18, 0
%20 = tail call i64 @randmax(i32 %3)
%21 = getelementptr inbounds i32*, i32** %5, i64 %20
%22 = load i32*, i32** %21
%23 = add nsw i32 %4, -1
%24 = select i1 %19, i32 0, i32 %23
%25 = sext i32 %24 to i64
%26 = getelementptr i32, i32* %22, i64 %25
store i32 0, i32* %26
ret void
}