#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 altura;
  int largura;
  char resposta;
  char pixel;
  int alt = 0;
  int larg = 0;
  int condicao = 0;
  while (condicao == 0) {
    printf("Informe a altura do retângulo.\n");
    scanf("%d", &altura);
    printf("Informe a largura do retângulo.\n");
    scanf("%d", &largura);
    printf("Qual símbolo do pixel deseja usar?\n");
    scanf(" %c", &pixel);
    printf("Olá, meu nome é Karolyne e o retangulo ficou assim:\n");
    for (alt; alt < altura; alt++) {
      for (larg; larg < largura; larg++) {
        if (alt == 0 || alt == altura - 1 || larg == 0 || larg == largura - 1) {
          printf(" %c ", pixel);
        } else {
          printf("   ");
        }
      }
      larg = 0;
      printf("\n");
    }
    printf("Deseja continuar (s/n)?\n");
    scanf(" %c", &resposta);
    if (resposta == 'n') {
      condicao = 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,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    12b3 <main+0x193>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0xe(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1265 <main+0x145>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1242 <main+0x122>
cmpl   $0x0,-0x14(%rbp)
je     120a <main+0xea>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     120a <main+0xea>
cmpl   $0x0,-0x18(%rbp)
je     120a <main+0xea>
mov    -0x18(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1221 <main+0x101>
movsbl -0xe(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0x10f>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1234 <main+0x114>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c8 <main+0xa8>
movl   $0x0,-0x18(%rbp)
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11bc <main+0x9c>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf1(%rip),%rdi
lea    -0xd(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x6e,%eax
jne    1299 <main+0x179>
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x14(%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    0xf34(%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    0xe68(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe6e(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe77(%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 = [33 x i8] c"Informe a altura do ret\C3\A2ngulo.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"Informe a largura do ret\C3\A2ngulo.\0A\00"
@.str.3 = [37 x i8] c"Qual s\C3\ADmbolo do pixel deseja usar?\0A\00"
@.str.4 = [4 x i8] c" %c\00"
@.str.5 = [55 x i8] c"Ol\C3\A1, meu nome \C3\A9 Karolyne 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 i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %7
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 ([33 x i8], [33 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* %2)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 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* %3)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 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* %5)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
%20 = load i32, i32* %6
br label %21
21: ; preds = %59, %12
%22 = load i32, i32* %6
%23 = load i32, i32* %2
%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* %3
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %57
31: ; preds = %27
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 0
br i1 %33, label %47, label %34
34: ; preds = %31
%35 = load i32, i32* %6
%36 = load i32, i32* %2
%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* %3
%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* %5
%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* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
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* %4)
%65 = load i8, i8* %4
%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* %2
store i32 0, i32* %3
store i32 0, i32* %6
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 = [32 x i8] c"Informe a altura do ret\C3\A2ngulo.\00"
@str.10 = [33 x i8] c"Informe a largura do ret\C3\A2ngulo.\00"
@str.11 = [36 x i8] c"Qual s\C3\ADmbolo do pixel deseja usar?\00"
@str.12 = [54 x i8] c"Ol\C3\A1, meu nome \C3\A9 Karolyne e o retangulo 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 ([32 x i8], [32 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 ([33 x i8], [33 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 ([36 x i8], [36 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 ([54 x i8], [54 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
}