#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int linha, coluna, l, a, car, cont;
  cont = 115;
  do {
    printf(
        "Olá, meu nome é Gustavo e o meu retângulo ficou assim, mas antes.. ");
    printf("\nQual o caracter desejado? ");
    car = getchar();
    do {
      printf("\nQual a largura do retângulo? ");
      scanf("%d", &l);
    } while (l <= 0);
    do {
      printf("\nQual a altura do retângulo? ");
      scanf("%d", &a);
    } while (a <= 0);
    for (coluna = 1; coluna <= a; coluna++) {
      for (linha = 1; linha <= l; linha++)
        if (linha == 1 || linha == l || coluna == 1 || coluna == a)
          printf("%c", car);
        else
          printf(" ");
      printf("\n");
    }
    printf("Deseja continuar?(s = novo caracter/n = digite 2)?\n");
    scanf("%d", &cont);
  } while (cont == 115);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x73,-0x1c(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x18(%rbp)
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
jle    116c <main+0x3c>
jmp    1199 <main+0x69>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    1199 <main+0x69>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1266 <main+0x136>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     124a <main+0x11a>
cmpl   $0x1,-0x8(%rbp)
je     1213 <main+0xe3>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1213 <main+0xe3>
cmpl   $0x1,-0xc(%rbp)
je     1213 <main+0xe3>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1229 <main+0xf9>
mov    -0x18(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1237 <main+0x107>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123c <main+0x10c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11db <main+0xab>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c8 <main+0x98>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe08(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x73,-0x1c(%rbp)
je     1146 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x73,0x14(%rsp)
lea    0xef6(%rip),%rbp
lea    0xf0f(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xf06(%rip),%r12
lea    0xc(%rsp),%r13
jmp    11c0 <main+0x70>
nopw   0x0(%rax,%rax,1)
lea    0xf0e(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
lea    0x14(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x73,0x14(%rsp)
lea    0xed1(%rip),%r12
lea    0xc(%rsp),%r13
jne    12b2 <main+0x162>
lea    0xe39(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    11f0 <main+0xa0>
nopl   0x0(%rax)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1210 <main+0xc0>
mov    $0x1,%r12d
jmp    125d <main+0x10d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
cmp    0xc(%rsp),%r12d
mov    %eax,%r12d
jge    1190 <main+0x40>
cmpl   $0x0,0x10(%rsp)
jle    1240 <main+0xf0>
mov    %r15d,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%eax
cmp    $0x2,%eax
jl     1240 <main+0xf0>
mov    $0x1,%r13d
jmp    129d <main+0x14d>
nopl   (%rax)
cmp    $0x1,%r12d
cmove  %r15d,%edi
cmp    %eax,%r13d
cmove  %r15d,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%eax
cmp    %eax,%r13d
jge    1240 <main+0xf0>
add    $0x1,%r13d
mov    %r15d,%edi
cmp    0xc(%rsp),%r12d
je     1280 <main+0x130>
mov    $0x20,%edi
jmp    1280 <main+0x130>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [71 x i8] c"Ol\C3\A1, meu nome \C3\A9 Gustavo e o meu ret\C3\A2ngulo ficou assim, mas antes.. \00"
@.str.1 = [28 x i8] c"\0AQual o caracter desejado? \00"
@.str.2 = [32 x i8] c"\0AQual a largura do ret\C3\A2ngulo? \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [31 x i8] c"\0AQual a altura do ret\C3\A2ngulo? \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [52 x i8] c"Deseja continuar?(s = novo caracter/n = digite 2)?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 115, i32* %7
br label %8
8: ; preds = %66, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (...) @getchar()
store i32 %11, i32* %6
br label %12
12: ; preds = %15, %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
br label %15
15: ; preds = %12
%16 = load i32, i32* %4
%17 = icmp sle i32 %16, 0
br i1 %17, label %12, label %18
18: ; preds = %15
br label %19
19: ; preds = %22, %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
br label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp sle i32 %23, 0
br i1 %24, label %19, label %25
25: ; preds = %22
store i32 1, i32* %3
br label %26
26: ; preds = %60, %25
%27 = load i32, i32* %3
%28 = load i32, i32* %5
%29 = icmp sle i32 %27, %28
br i1 %29, label %30, label %63
30: ; preds = %26
store i32 1, i32* %2
br label %31
31: ; preds = %55, %30
%32 = load i32, i32* %2
%33 = load i32, i32* %4
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %58
35: ; preds = %31
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 1
br i1 %37, label %49, label %38
38: ; preds = %35
%39 = load i32, i32* %2
%40 = load i32, i32* %4
%41 = icmp eq i32 %39, %40
br i1 %41, label %49, label %42
42: ; preds = %38
%43 = load i32, i32* %3
%44 = icmp eq i32 %43, 1
br i1 %44, label %49, label %45
45: ; preds = %42
%46 = load i32, i32* %3
%47 = load i32, i32* %5
%48 = icmp eq i32 %46, %47
br i1 %48, label %49, label %52
49: ; preds = %45, %42, %38, %35
%50 = load i32, i32* %6
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %50)
br label %54
52: ; preds = %45
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %54
54: ; preds = %52, %49
br label %55
55: ; preds = %54
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %31
58: ; preds = %31
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %60
60: ; preds = %58
%61 = load i32, i32* %3
%62 = add nsw i32 %61, 1
store i32 %62, i32* %3
br label %26
63: ; preds = %26
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.8, i64 0, i64 0))
%65 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
br label %66
66: ; preds = %63
%67 = load i32, i32* %7
%68 = icmp eq i32 %67, 115
br i1 %68, label %8, label %69
69: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@.str = [71 x i8] c"Ol\C3\A1, meu nome \C3\A9 Gustavo e o meu ret\C3\A2ngulo ficou assim, mas antes.. \00"
@.str.1 = [28 x i8] c"\0AQual o caracter desejado? \00"
@.str.2 = [32 x i8] c"\0AQual a largura do ret\C3\A2ngulo? \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [31 x i8] c"\0AQual a altura do ret\C3\A2ngulo? \00"
@str = [51 x i8] c"Deseja continuar?(s = novo caracter/n = digite 2)?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
store i32 115, i32* %3
br label %7
7: ; preds = %48, %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @getchar()
br label %11
11: ; preds = %11, %7
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp slt i32 %14, 1
br i1 %15, label %11, label %16
16: ; preds = %11, %16
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 1
br i1 %20, label %16, label %21
21: ; preds = %16, %43
%22 = phi i32 [ %45, %43 ], [ 1, %16 ]
%23 = load i32, i32* %1
%24 = icmp slt i32 %23, 1
br i1 %24, label %43, label %25
25: ; preds = %21
%26 = icmp eq i32 %22, 1
%27 = call i32 @putchar(i32 %10)
%28 = load i32, i32* %1
%29 = icmp sgt i32 %28, 1
br i1 %29, label %30, label %43
30: ; preds = %25, %30
%31 = phi i32 [ %41, %30 ], [ %28, %25 ]
%32 = phi i32 [ %40, %30 ], [ 2, %25 ]
%33 = icmp eq i32 %32, %31
%34 = select i1 %33, i1 true, i1 %26
%35 = load i32, i32* %2
%36 = icmp eq i32 %22, %35
%37 = select i1 %34, i1 true, i1 %36
%38 = select i1 %37, i32 %10, i32 32
%39 = call i32 @putchar(i32 %38)
%40 = add nuw nsw i32 %32, 1
%41 = load i32, i32* %1
%42 = icmp slt i32 %32, %41
br i1 %42, label %30, label %43
43: ; preds = %30, %25, %21
%44 = call i32 @putchar(i32 10)
%45 = add nuw nsw i32 %22, 1
%46 = load i32, i32* %2
%47 = icmp slt i32 %22, %46
br i1 %47, label %21, label %48
48: ; preds = %43
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%51 = load i32, i32* %3
%52 = icmp eq i32 %51, 115
br i1 %52, label %7, label %53
53: ; preds = %48
ret i32 0
}