#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*/ putchar(char);
void quadrado(int N) {
  int i, j;
  char cell = '0';
  for (i = 0; i < N; ++i) {
    for (j = 1; j <= N; ++j) {
      putchar(cell + j % 10 + i % 10);
      putchar(' ');
      putchar(' ');
    }
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<quadrado>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x30,-0xd(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b1 <quadrado+0xa1>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1199 <quadrado+0x89>
movsbl -0xd(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <quadrado+0x29>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <quadrado+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quadrado>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11af <quadrado+0x9f>
mov    %edi,%r14d
xor    %r15d,%r15d
mov    $0xcccccccd,%r12d
nop
mov    %r15d,%eax
imul   %r12,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %r15d,%ebp
sub    %eax,%ebp
add    $0x31,%bpl
mov    $0x1,%ebx
mov    %r14d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
imul   %r12,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %ebp,%ecx
sub    %al,%cl
movsbl %cl,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
add    $0x1,%bpl
add    $0xffffffff,%r13d
jne    1160 <quadrado+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    %r14d,%r15d
jne    1130 <quadrado+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quadrado(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %2
store i8 48, i8* %5
store i32 0, i32* %3
br label %6
6: ; preds = %33, %1
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %36
10: ; preds = %6
store i32 1, i32* %4
br label %11
11: ; preds = %28, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = load i32, i32* %4
%19 = srem i32 %18, 10
%20 = add nsw i32 %17, %19
%21 = load i32, i32* %3
%22 = srem i32 %21, 10
%23 = add nsw i32 %20, %22
%24 = trunc i32 %23 to i8
%25 = call i32 @putchar(i8 signext %24)
%26 = call i32 @putchar(i8 signext 32)
%27 = call i32 @putchar(i8 signext 32)
br label %28
28: ; preds = %15
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %11
31: ; preds = %11
%32 = call i32 @putchar(i8 signext 10)
br label %33
33: ; preds = %31
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %6
36: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @quadrado(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %21
3: ; preds = %1, %17
%4 = phi i32 [ %19, %17 ], [ 0, %1 ]
%5 = urem i32 %4, 10
%6 = or i32 %5, 48
br label %7
7: ; preds = %3, %7
%8 = phi i32 [ 1, %3 ], [ %15, %7 ]
%9 = urem i32 %8, 10
%10 = add nuw nsw i32 %6, %9
%11 = trunc i32 %10 to i8
%12 = tail call i32 @putchar(i8 signext %11)
%13 = tail call i32 @putchar(i8 signext 32)
%14 = tail call i32 @putchar(i8 signext 32)
%15 = add nuw i32 %8, 1
%16 = icmp eq i32 %8, %0
br i1 %16, label %17, label %7
17: ; preds = %7
%18 = tail call i32 @putchar(i8 signext 10)
%19 = add nuw nsw i32 %4, 1
%20 = icmp eq i32 %19, %0
br i1 %20, label %21, label %3
21: ; preds = %17, %1
ret void
}