#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 imprime_cuadrado(int ancho, int alto) {
  int x, y;
  for (x = 0; x < ancho; x++) {
    for (y = 0; y < alto; y++) {
      if (x == 0 || x == ancho - 1) {
        if (y == 0 || y == alto - 1) {
          printf("+");
        } else {
          printf("-");
        }
      } else {
        if (y == 0 || y == alto - 1) {
          printf("|");
        } else {
          printf(" ");
        }
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<imprime_cuadrado>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1206 <imprime_cuadrado+0xf6>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ec <imprime_cuadrado+0xdc>
cmpl   $0x0,-0xc(%rbp)
je     115f <imprime_cuadrado+0x4f>
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    119c <imprime_cuadrado+0x8c>
cmpl   $0x0,-0x10(%rbp)
je     117a <imprime_cuadrado+0x6a>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    118b <imprime_cuadrado+0x7b>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
jmp    1197 <imprime_cuadrado+0x87>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    11d9 <imprime_cuadrado+0xc9>
cmpl   $0x0,-0x10(%rbp)
je     11b7 <imprime_cuadrado+0xa7>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11c8 <imprime_cuadrado+0xb8>
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
jmp    11d4 <imprime_cuadrado+0xc4>
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
jmp    11d9 <imprime_cuadrado+0xc9>
jmp    11de <imprime_cuadrado+0xce>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1138 <imprime_cuadrado+0x28>
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <imprime_cuadrado+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprime_cuadrado>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11af <imprime_cuadrado+0x9f>
mov    %esi,%ebx
mov    %edi,%r14d
lea    -0x1(%r14),%eax
mov    %eax,0x4(%rsp)
xor    %r12d,%r12d
mov    $0x7c,%ebp
jmp    1153 <imprime_cuadrado+0x43>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
cmp    %r14d,%r12d
je     11af <imprime_cuadrado+0x9f>
test   %ebx,%ebx
jle    1140 <imprime_cuadrado+0x30>
test   %r12d,%r12d
sete   %al
cmp    0x4(%rsp),%r12d
sete   %r13b
or     %al,%r13b
xor    %r15d,%r15d
nopl   0x0(%rax)
lea    (%rbx,%r15,1),%eax
sub    $0x1,%r15d
setb   %cl
cmp    $0x1,%eax
sete   %al
or     %cl,%al
mov    %eax,%ecx
xor    $0x1,%cl
movzbl %cl,%ecx
test   %al,%al
mov    $0x20,%edi
cmovne %ebp,%edi
lea    (%rcx,%rcx,1),%eax
add    $0x2b,%eax
test   %r13b,%r13b
cmovne %eax,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
add    %r15d,%eax
jne    1170 <imprime_cuadrado+0x60>
jmp    1140 <imprime_cuadrado+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"+\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @imprime_cuadrado(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 = %56, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %59
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %51, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %54
16: ; preds = %12
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = load i32, i32* %3
%22 = sub nsw i32 %21, 1
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %37
24: ; preds = %19, %16
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 0
br i1 %26, label %32, label %27
27: ; preds = %24
%28 = load i32, i32* %6
%29 = load i32, i32* %4
%30 = sub nsw i32 %29, 1
%31 = icmp eq i32 %28, %30
br i1 %31, label %32, label %34
32: ; preds = %27, %24
%33 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %36
34: ; preds = %27
%35 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %50
37: ; preds = %19
%38 = load i32, i32* %6
%39 = icmp eq i32 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %37
%41 = load i32, i32* %6
%42 = load i32, i32* %4
%43 = sub nsw i32 %42, 1
%44 = icmp eq i32 %41, %43
br i1 %44, label %45, label %47
45: ; preds = %40, %37
%46 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %49
47: ; preds = %40
%48 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %49
49: ; preds = %47, %45
br label %50
50: ; preds = %49, %36
br label %51
51: ; preds = %50
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
br label %12
54: ; preds = %12
%55 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %5
%58 = add nsw i32 %57, 1
store i32 %58, i32* %5
br label %7
59: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @imprime_cuadrado(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %29
4: ; preds = %2
%5 = icmp sgt i32 %1, 0
%6 = add nsw i32 %0, -1
%7 = add nsw i32 %1, -1
br label %8
8: ; preds = %4, %25
%9 = phi i32 [ 0, %4 ], [ %27, %25 ]
br i1 %5, label %10, label %25
10: ; preds = %8
%11 = icmp eq i32 %9, 0
%12 = icmp eq i32 %9, %6
%13 = select i1 %11, i1 true, i1 %12
br label %14
14: ; preds = %10, %14
%15 = phi i32 [ 0, %10 ], [ %23, %14 ]
%16 = icmp eq i32 %15, 0
%17 = icmp eq i32 %15, %7
%18 = select i1 %16, i1 true, i1 %17
%19 = select i1 %18, i32 43, i32 45
%20 = select i1 %18, i32 124, i32 32
%21 = select i1 %13, i32 %19, i32 %20
%22 = tail call i32 @putchar(i32 %21)
%23 = add nuw nsw i32 %15, 1
%24 = icmp eq i32 %23, %1
br i1 %24, label %25, label %14
25: ; preds = %14, %8
%26 = tail call i32 @putchar(i32 10)
%27 = add nuw nsw i32 %9, 1
%28 = icmp eq i32 %27, %0
br i1 %28, label %29, label %8
29: ; preds = %25, %2
ret void
}