#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() {
  char continuar, caracter;
  int altura, alt, largura, lar;
  int retangulo = 0;
  while (retangulo == 0) {
    printf("Digite a altura do retângulo.\n");
    scanf("%d", &altura);
    printf("Digite a largura do retângulo.\n");
    scanf("%d", &largura);
    printf("Digite o caracter que deseja utilizar:\n");
    scanf(" %c", &caracter);
    printf("Olá, meu nome é Leonardo Pacheco e o retangulo ficou assim:\n");
    for (alt; alt < altura; alt++) {
      for (lar; lar < largura; lar++) {
        if (alt == 0 || alt == altura - 1 || lar == 0 || lar == largura - 1) {
          printf(" %c ", caracter);
        } else {
          printf("   ");
        }
      }
      lar = 0;
      printf("\n");
    }
    printf("Deseja continuar (s/n)?\n");
    scanf(" %c", &continuar);
    if (continuar == 'n') {
      retangulo = 1;
    }
    altura = 0;
    largura = 0;
    alt = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    12a5 <main+0x185>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeab(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x6(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1257 <main+0x137>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1234 <main+0x114>
cmpl   $0x0,-0x10(%rbp)
je     11fc <main+0xdc>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     11fc <main+0xdc>
cmpl   $0x0,-0x18(%rbp)
je     11fc <main+0xdc>
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1213 <main+0xf3>
movsbl -0x6(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <main+0x101>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1226 <main+0x106>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ba <main+0x9a>
movl   $0x0,-0x18(%rbp)
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ae <main+0x8e>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe00(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
jne    128b <main+0x16b>
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    1136 <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
lea    0xeab(%rip),%rbx
lea    0xea7(%rip),%r14
lea    0xea4(%rip),%r13
lea    0xea2(%rip),%rbp
jmp    11a6 <main+0x66>
nopl   0x0(%rax)
lea    0xf3d(%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     1287 <main+0x147>
lea    0xe63(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe67(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe6c(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe78(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x10(%rsp)
jle    1170 <main+0x30>
xor    %r12d,%r12d
jmp    1233 <main+0xf3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl 0xe(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15d
mov    0x14(%rsp),%eax
cmp    %eax,%r15d
jge    126a <main+0x12a>
test   %r12d,%r12d
je     1220 <main+0xe0>
mov    0x10(%rsp),%ecx
add    $0xffffffff,%ecx
cmp    %ecx,%r12d
je     1220 <main+0xe0>
test   %r15d,%r15d
je     1220 <main+0xe0>
add    $0xffffffff,%eax
cmp    %eax,%r15d
je     1220 <main+0xe0>
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15d
jmp    1233 <main+0xf3>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12d
xor    %r15d,%r15d
cmp    0x10(%rsp),%r12d
jl     1233 <main+0xf3>
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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