#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ scanf(char *, short *, short *, short *, short *);
short *init_board() {
  short *board = (short *)calloc(16, sizeof(short));
  int i;
  for (i = 3; i >= 0; i--) {
    scanf("%hi %hi %hi %hi", board + (i << 2), board + (1 + (i << 2)),
          board + (2 + (i << 2)), board + (3 + (i << 2)));
  }
  return board;
}


x86 assembly (clang, -O0):
<init_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10,%edi
mov    $0x2,%esi
call   1030 <calloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11bb <init_board+0x9b>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
cltq
shl    $0x1,%rax
add    %rax,%rsi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
add    $0x1,%eax
cltq
shl    $0x1,%rax
add    %rax,%rdx
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
add    $0x2,%eax
cltq
shl    $0x1,%rax
add    %rax,%rcx
mov    -0x8(%rbp),%r8
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
add    $0x3,%eax
cltq
shl    $0x1,%rax
add    %rax,%r8
lea    0xe58(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <init_board+0x22>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_board>:
push   %r14
push   %rbx
push   %rax
mov    $0x10,%edi
mov    $0x2,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
lea    0x18(%rax),%rsi
lea    0x1a(%rax),%rdx
lea    0x1c(%rax),%rcx
lea    0x1e(%rax),%r8
lea    0xeb3(%rip),%r14
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x10(%rbx),%rsi
lea    0x12(%rbx),%rdx
lea    0x14(%rbx),%rcx
lea    0x16(%rbx),%r8
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x8(%rbx),%rsi
lea    0xa(%rbx),%rdx
lea    0xc(%rbx),%rcx
lea    0xe(%rbx),%r8
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x2(%rbx),%rdx
lea    0x4(%rbx),%rcx
lea    0x6(%rbx),%r8
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%hi %hi %hi %hi\00"
define i16* @init_board() {
%1 = alloca i16*
%2 = alloca i32
%3 = call i64 @calloc(i32 16, i32 2)
%4 = inttoptr i64 %3 to i16*
store i16* %4, i16** %1
store i32 3, i32* %2
br label %5
5: ; preds = %33, %0
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %36
8: ; preds = %5
%9 = load i16*, i16** %1
%10 = load i32, i32* %2
%11 = shl i32 %10, 2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i16, i16* %9, i64 %12
%14 = load i16*, i16** %1
%15 = load i32, i32* %2
%16 = shl i32 %15, 2
%17 = add nsw i32 1, %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i16, i16* %14, i64 %18
%20 = load i16*, i16** %1
%21 = load i32, i32* %2
%22 = shl i32 %21, 2
%23 = add nsw i32 2, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i16, i16* %20, i64 %24
%26 = load i16*, i16** %1
%27 = load i32, i32* %2
%28 = shl i32 %27, 2
%29 = add nsw i32 3, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i16, i16* %26, i64 %30
%32 = call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i16* %13, i16* %19, i16* %25, i16* %31)
br label %33
33: ; preds = %8
%34 = load i32, i32* %2
%35 = add nsw i32 %34, -1
store i32 %35, i32* %2
br label %5
36: ; preds = %5
%37 = load i16*, i16** %1
ret i16* %37
}

LLVM IR (-O2):
@.str = [16 x i8] c"%hi %hi %hi %hi\00"
define i16* @init_board() {
%1 = tail call i64 @calloc(i32 16, i32 2)
%2 = inttoptr i64 %1 to i16*
%3 = getelementptr inbounds i16, i16* %2, i64 12
%4 = getelementptr inbounds i16, i16* %2, i64 13
%5 = getelementptr inbounds i16, i16* %2, i64 14
%6 = getelementptr inbounds i16, i16* %2, i64 15
%7 = tail call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i16* %3, i16* %4, i16* %5, i16* %6)
%8 = getelementptr inbounds i16, i16* %2, i64 8
%9 = getelementptr inbounds i16, i16* %2, i64 9
%10 = getelementptr inbounds i16, i16* %2, i64 10
%11 = getelementptr inbounds i16, i16* %2, i64 11
%12 = tail call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i16* %8, i16* %9, i16* %10, i16* %11)
%13 = getelementptr inbounds i16, i16* %2, i64 4
%14 = getelementptr inbounds i16, i16* %2, i64 5
%15 = getelementptr inbounds i16, i16* %2, i64 6
%16 = getelementptr inbounds i16, i16* %2, i64 7
%17 = tail call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i16* %13, i16* %14, i16* %15, i16* %16)
%18 = getelementptr inbounds i16, i16* %2, i64 1
%19 = getelementptr inbounds i16, i16* %2, i64 2
%20 = getelementptr inbounds i16, i16* %2, i64 3
%21 = tail call i32 @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i16* %2, i16* %18, i16* %19, i16* %20)
ret i16* %2
}