#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 /*<<< orphan*/ scanf(char *, int *);
void InitializeSquare(int square[1000][1000], int size) {
  int i;
  for (i = 0; i < size; ++i) {
    int j;
    for (j = 0; j < size; ++j) {
      scanf("%d", &square[i][j]);
    }
  }
}


x86 assembly (clang, -O0):
<InitializeSquare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118f <InitializeSquare+0x7f>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117c <InitializeSquare+0x6c>
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
imul   $0xfa0,%rax,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe97(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <InitializeSquare+0x29>
jmp    1181 <InitializeSquare+0x71>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <InitializeSquare+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitializeSquare>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1165 <InitializeSquare+0x55>
mov    %rdi,%r14
mov    %esi,%r12d
xor    %r13d,%r13d
lea    0xed1(%rip),%r15
nop
mov    %r12,%rbp
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%rbp
jne    1140 <InitializeSquare+0x30>
add    $0x1,%r13
add    $0xfa0,%r14
cmp    %r12,%r13
jne    1130 <InitializeSquare+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @InitializeSquare([1000 x i32]* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %14, %4
%7 = phi i64 [ 0, %4 ], [ %15, %14 ]
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %12, %8 ]
%10 = getelementptr inbounds [1000 x i32], [1000 x i32]* %0, i64 %7, i64 %9
%11 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %8
14: ; preds = %8
%15 = add nuw nsw i64 %7, 1
%16 = icmp eq i64 %15, %5
br i1 %16, label %17, label %6
17: ; preds = %14, %2
ret void
}