#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 abs(int /*<<< orphan*/);
int /*<<< orphan*/ rand();
void start_location(int num[4][4]) {
  int i;
  int j;
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      num[i][j] = 0;
    }
  }
  num[abs(rand()) % 4][abs(rand()) % 4] = (abs(rand()) % 2 + 1) * 2;
  num[abs(rand()) % 4][abs(rand()) % 4] = (abs(rand()) % 2 + 1) * 2;
}


x86 assembly (clang, -O0):
<start_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1189 <start_location+0x69>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1176 <start_location+0x56>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <start_location+0x24>
jmp    117b <start_location+0x5b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <start_location+0x13>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
call   1030 <abs@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
shl    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
call   1030 <abs@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x40(%rbp),%rax
movslq %edx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
call   1030 <abs@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x38(%rbp),%rax
mov    %edx,%ecx
mov    -0x2c(%rbp),%edx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
call   1030 <abs@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
call   1030 <abs@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%rax
movslq %edx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
call   1030 <abs@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,%ecx
mov    -0x14(%rbp),%edx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_location>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0x30(%rdi)
movups %xmm0,0x20(%rdi)
movups %xmm0,0x10(%rdi)
movups %xmm0,(%rdi)
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x1,%eax
lea    (%rax,%rax,1),%r14d
add    $0x2,%r14d
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebp
neg    %ebp
cmovs  %eax,%ebp
and    $0x3,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
and    $0x3,%ecx
shl    $0x4,%rbp
add    %rbx,%rbp
mov    %r14d,0x0(%rbp,%rcx,4)
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x1,%eax
lea    (%rax,%rax,1),%r14d
add    $0x2,%r14d
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebp
neg    %ebp
cmovs  %eax,%ebp
and    $0x3,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
and    $0x3,%ecx
shl    $0x4,%rbp
add    %rbx,%rbp
mov    %r14d,0x0(%rbp,%rcx,4)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @start_location([4 x i32]* nocapture writeonly %0) {
%2 = bitcast [4 x i32]* %0 to i8*
%3 = tail call i32 (...) @rand()
%4 = shl i32 %3, 1
%5 = and i32 %4, 2
%6 = add nuw nsw i32 %5, 2
%7 = tail call i32 (...) @rand()
%8 = tail call i32 @llvm.abs.i32(i32 %7, i1 true)
%9 = and i32 %8, 3
%10 = zext i32 %9 to i64
%11 = tail call i32 (...) @rand()
%12 = tail call i32 @llvm.abs.i32(i32 %11, i1 true)
%13 = and i32 %12, 3
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %10, i64 %14
store i32 %6, i32* %15
%16 = tail call i32 (...) @rand()
%17 = shl i32 %16, 1
%18 = and i32 %17, 2
%19 = add nuw nsw i32 %18, 2
%20 = tail call i32 (...) @rand()
%21 = tail call i32 @llvm.abs.i32(i32 %20, i1 true)
%22 = and i32 %21, 3
%23 = zext i32 %22 to i64
%24 = tail call i32 (...) @rand()
%25 = tail call i32 @llvm.abs.i32(i32 %24, i1 true)
%26 = and i32 %25, 3
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %23, i64 %27
store i32 %19, i32* %28
ret void
}