#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 retangulo(int linhas, int colunas) {
  int i, j;
  for (i = 0; i < linhas; i++) {
    for (j = 0; j < colunas; j++) {
      if (j == 0 || j == colunas - 1)
        printf("|");
      else
        printf("+");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<retangulo>:
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    11a9 <retangulo+0x99>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118f <retangulo+0x7f>
cmpl   $0x0,-0x10(%rbp)
je     115f <retangulo+0x4f>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1170 <retangulo+0x60>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <retangulo+0x6c>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    1181 <retangulo+0x71>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1138 <retangulo+0x28>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <retangulo+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<retangulo>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    1173 <retangulo+0x63>
mov    %esi,%ebx
mov    %edi,%r14d
xor    %r15d,%r15d
mov    $0x7c,%r12d
jmp    1143 <retangulo+0x33>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    %r14d,%r15d
je     1173 <retangulo+0x63>
test   %ebx,%ebx
jle    1130 <retangulo+0x20>
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    (%rbx,%rbp,1),%eax
cmp    $0x1,%eax
mov    $0x2b,%edi
cmove  %r12d,%edi
sub    $0x1,%ebp
cmovb  %r12d,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
add    %ebp,%eax
jne    1150 <retangulo+0x40>
jmp    1130 <retangulo+0x20>
pop    %rbx
pop    %r12
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"\0A\00"
define void @retangulo(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 = %34, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %37
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %29, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %32
16: ; preds = %12
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %16
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %26
24: ; preds = %19, %16
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %28
26: ; preds = %19
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %12
32: ; preds = %12
%33 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %7
37: ; preds = %7
ret void
}

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