#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 i;
  int j;
  int alt;
  int larg;
  char cont;
  do {
    printf("\nVamos desenhar um retângulo? \n\n");
    do {
      printf("Digite um valor válido para altura: ");
      scanf("%d", &alt);
    } while (alt <= 1);
    do {
      printf("Digite um valor válido para largura: ");
      scanf("%d", &larg);
    } while (larg <= 1);
    printf("Olá meu nome é Alessandra e o retângulo ficou assim:\n\n");
    for (i = 1; i <= alt; i++) {
      for (j = 1; j <= larg; j++)
        if (j == 1 || i == 1 || j == larg || i == alt) {
          printf("* ");
        } else {
          printf("  ");
        }
      printf("\n");
    }
    printf("Deseja continuar (s/n)?\n");
    scanf(" %c", &cont);
  } while (cont == 's');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
jle    113b <main+0x1b>
jmp    1168 <main+0x48>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jle    1168 <main+0x48>
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1238 <main+0x118>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     121e <main+0xfe>
cmpl   $0x1,-0xc(%rbp)
je     11ee <main+0xce>
cmpl   $0x1,-0x8(%rbp)
je     11ee <main+0xce>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     11ee <main+0xce>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11ff <main+0xdf>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    120b <main+0xeb>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1210 <main+0xf0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b6 <main+0x96>
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a3 <main+0x83>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x73,%eax
je     112f <main+0xf>
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),%rbp
lea    0xeca(%rip),%r12
lea    0x14(%rsp),%rbx
lea    0xec1(%rip),%r13
lea    0xee1(%rip),%r14
jmp    11b8 <main+0x78>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xf2d(%rip),%rdi
call   1040 <puts@plt>
lea    0xec3(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x73,0xf(%rsp)
lea    0xe7b(%rip),%r12
lea    0xe77(%rip),%r13
jne    12c3 <main+0x183>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x2,0x14(%rsp)
jl     11d0 <main+0x90>
lea    0x10(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x2,0x10(%rsp)
jl     1200 <main+0xc0>
lea    0xe58(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x14(%rsp)
lea    0xe1f(%rip),%r15
jle    1180 <main+0x40>
mov    $0x1,%r12d
jmp    126d <main+0x12d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r12),%eax
cmp    0x14(%rsp),%r12d
mov    %eax,%r12d
jge    1180 <main+0x40>
cmpl   $0x0,0x10(%rsp)
jle    1250 <main+0x110>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    0x10(%rsp),%eax
cmp    $0x2,%eax
jl     1250 <main+0x110>
mov    $0x2,%r13d
jmp    12b4 <main+0x174>
nopl   (%rax)
cmp    %eax,%r13d
cmove  %r14,%rdi
cmp    $0x1,%r12d
cmove  %r14,%rdi
call   1050 <printf@plt>
mov    0x10(%rsp),%eax
lea    0x1(%r13),%ecx
cmp    %eax,%r13d
mov    %ecx,%r13d
jge    1250 <main+0x110>
mov    %r14,%rdi
cmp    0x14(%rsp),%r12d
je     1290 <main+0x150>
mov    %r15,%rdi
jmp    1290 <main+0x150>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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