#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 *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int a = 0, l = 0;
  int alt, lar;
  int recomeco = 0;
  char fim, caracter;
  while (recomeco == 0) {
    printf("Informe a altura\n");
    scanf("%d", &alt);
    printf("Informe a largura\n");
    scanf("%d", &lar);
    printf("Escolha um caracter de sua preferência?\n");
    scanf(" %c", &caracter);
    printf("Olá, meu nome é Matheus Avila e o seu retângulo ficou assim:\n");
    for (a; a < alt; a++) {
      for (l; l < lar; l++) {
        if (a == 0 || a == alt - 1 || l == 0 || l == lar - 1) {
          printf(" %c ", caracter);
        } else {
          printf("   ");
        }
      }
      l = 0;
      printf("\n");
    }
    printf("Deseja continuar (s/n)?\n");
    scanf(" %c", &fim);
    if (fim == 'n') {
      recomeco = 1;
    }
    alt = 0;
    lar = 0;
    a = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    12b3 <main+0x193>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x1a(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1265 <main+0x145>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1242 <main+0x122>
cmpl   $0x0,-0x8(%rbp)
je     120a <main+0xea>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     120a <main+0xea>
cmpl   $0x0,-0xc(%rbp)
je     120a <main+0xea>
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1221 <main+0x101>
movsbl -0x1a(%rbp),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0x10f>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1234 <main+0x114>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c8 <main+0xa8>
movl   $0x0,-0xc(%rbp)
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bc <main+0x9c>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd8(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x6e,%eax
jne    1299 <main+0x179>
movl   $0x1,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
jmp    1144 <main+0x24>
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
lea    0xeab(%rip),%rbx
lea    0xea7(%rip),%r14
lea    0xea4(%rip),%r13
lea    0xea2(%rip),%rbp
jmp    11a6 <main+0x66>
nopl   0x0(%rax)
lea    0xf25(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x6e,0xf(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
je     1296 <main+0x156>
lea    0xe63(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe50(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x10(%rsp)
jle    1170 <main+0x30>
xor    %r15d,%r15d
jmp    1239 <main+0xf9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    0x10(%rsp),%r15d
jge    1170 <main+0x30>
mov    0x14(%rsp),%eax
test   %eax,%eax
jle    1220 <main+0xe0>
xor    %r12d,%r12d
jmp    126c <main+0x12c>
cs nopw 0x0(%rax,%rax,1)
movsbl 0xe(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12d
mov    0x14(%rsp),%eax
cmp    %eax,%r12d
jge    1220 <main+0xe0>
test   %r15d,%r15d
je     1250 <main+0x110>
mov    0x10(%rsp),%ecx
add    $0xffffffff,%ecx
cmp    %ecx,%r15d
je     1250 <main+0x110>
test   %r12d,%r12d
je     1250 <main+0x110>
add    $0xffffffff,%eax
cmp    %eax,%r12d
je     1250 <main+0x110>
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    125f <main+0x11f>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Informe a altura\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Informe a largura\0A\00"
@.str.3 = [42 x i8] c"Escolha um caracter de sua prefer\C3\AAncia?\0A\00"
@.str.4 = [4 x i8] c" %c\00"
@.str.5 = [65 x i8] c"Ol\C3\A1, meu nome \C3\A9 Matheus Avila e o seu ret\C3\A2ngulo ficou assim:\0A\00"
@.str.6 = [5 x i8] c" %c \00"
@.str.7 = [4 x i8] c" \00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [25 x i8] c"Deseja continuar (s/n)?\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 i8
%8 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %6
br label %9
9: ; preds = %69, %0
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %70
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0))
%20 = load i32, i32* %2
br label %21
21: ; preds = %59, %12
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %62
25: ; preds = %21
%26 = load i32, i32* %3
br label %27
27: ; preds = %54, %25
%28 = load i32, i32* %3
%29 = load i32, i32* %5
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %57
31: ; preds = %27
%32 = load i32, i32* %2
%33 = icmp eq i32 %32, 0
br i1 %33, label %47, label %34
34: ; preds = %31
%35 = load i32, i32* %2
%36 = load i32, i32* %4
%37 = sub nsw i32 %36, 1
%38 = icmp eq i32 %35, %37
br i1 %38, label %47, label %39
39: ; preds = %34
%40 = load i32, i32* %3
%41 = icmp eq i32 %40, 0
br i1 %41, label %47, label %42
42: ; preds = %39
%43 = load i32, i32* %3
%44 = load i32, i32* %5
%45 = sub nsw i32 %44, 1
%46 = icmp eq i32 %43, %45
br i1 %46, label %47, label %51
47: ; preds = %42, %39, %34, %31
%48 = load i8, i8* %8
%49 = sext i8 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %49)
br label %53
51: ; preds = %42
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %53
53: ; preds = %51, %47
br label %54
54: ; preds = %53
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %27
57: ; preds = %27
store i32 0, i32* %3
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %59
59: ; preds = %57
%60 = load i32, i32* %2
%61 = add nsw i32 %60, 1
store i32 %61, i32* %2
br label %21
62: ; preds = %21
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%64 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%65 = load i8, i8* %7
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 110
br i1 %67, label %68, label %69
68: ; preds = %62
store i32 1, i32* %6
br label %69
69: ; preds = %68, %62
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %2
br label %9
70: ; preds = %9
ret i32 0
}

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