#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*/ printf(char *, ...);
void printSquare(const int *const latin, const int n) {
  int i, j;
  for (i = 0; i < n; i++) {
    printf("[");
    for (j = 0; j < n; j++) {
      if (j > 0) {
        printf(", ");
      }
      printf("%d", latin[i * n + j]);
    }
    printf("]\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printSquare>:
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    11b7 <printSquare+0xa7>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119b <printSquare+0x8b>
cmpl   $0x0,-0x14(%rbp)
jle    116b <printSquare+0x5b>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <printSquare+0x37>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printSquare+0x16>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSquare>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
mov    %esi,0x4(%rsp)
test   %esi,%esi
jle    11f3 <printSquare+0xc3>
mov    0x4(%rsp),%ebp
lea    0x0(,%rbp,4),%rax
mov    %rax,0x10(%rsp)
lea    0xe9c(%rip),%rbx
lea    0xe92(%rip),%r13
mov    0x8(%rsp),%r14
xor    %r15d,%r15d
jmp    119a <printSquare+0x6a>
nopl   0x0(%rax,%rax,1)
lea    0xe7f(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r15
add    0x10(%rsp),%r14
cmp    %rbp,%r15
je     11f3 <printSquare+0xc3>
mov    $0x5b,%edi
call   1030 <putchar@plt>
mov    %r15,%rax
imul   %rbp,%rax
mov    0x8(%rsp),%rcx
mov    (%rcx,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x1,0x4(%rsp)
je     1180 <printSquare+0x50>
mov    $0x1,%r12d
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14,%r12,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
jne    11d0 <printSquare+0xa0>
jmp    1180 <printSquare+0x50>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c", \00"
@.str.2 = [3 x i8] c"%d\00"
@str = [2 x i8] c"]\00"
define void @printSquare(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %28
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = zext i32 %1 to i64
%7 = icmp eq i32 %1, 1
br label %8
8: ; preds = %24, %4
%9 = phi i64 [ 0, %4 ], [ %26, %24 ]
%10 = tail call i32 @putchar(i32 91)
%11 = mul nsw i64 %9, %5
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br i1 %7, label %24, label %15
15: ; preds = %8, %15
%16 = phi i64 [ %22, %15 ], [ 1, %8 ]
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = add nuw nsw i64 %16, %11
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i64 %16, 1
%23 = icmp eq i64 %22, %6
br i1 %23, label %24, label %15
24: ; preds = %15, %8
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%26 = add nuw nsw i64 %9, 1
%27 = icmp eq i64 %26, %6
br i1 %27, label %28, label %8
28: ; preds = %24, %2
%29 = tail call i32 @putchar(i32 10)
ret void
}