#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, j, a, l;
  char cont;
  do {
    printf("\nVamos desenhar um retângulo \n\n");
    do {
      printf("\nTamanho da altura: ");
      scanf("%d", &a);
    } while (a <= 1);
    do {
      printf("\nTamanho da largura: ");
      scanf("%d", &l);
    } while (l <= 1);
    printf("\n\nOlá meu nome é Loham Viana e o retângulo ficou assim:\n\n");
    for (i = 1; i <= a; i++) {
      for (j = 1; j <= l; j++)
        if (j == 1 || i == 1 || j == l || i == a) {
          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    0xedf(%rip),%rdi
call   1030 <printf@plt>
lea    0xee8(%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    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jle    1168 <main+0x48>
lea    0xeb8(%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    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    120b <main+0xeb>
lea    0xe47(%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    0xdfa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a3 <main+0x83>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5c(%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    0xeb9(%rip),%r13
lea    0x14(%rsp),%rbx
lea    0xeb0(%rip),%r14
lea    0x10(%rsp),%r12
jmp    11a1 <main+0x61>
nop
lea    0xf17(%rip),%rdi
call   1040 <puts@plt>
lea    0xeab(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x73,0xf(%rsp)
lea    0xe7d(%rip),%r14
jne    128a <main+0x14a>
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
nopl   (%rax)
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x2,0x14(%rsp)
jl     11b0 <main+0x70>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x2,0x10(%rsp)
jl     11d0 <main+0x90>
lea    0xe5f(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x14(%rsp)
jle    1170 <main+0x30>
mov    $0x1,%r14d
jmp    122c <main+0xec>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r14),%eax
cmp    0x14(%rsp),%r14d
mov    %eax,%r14d
jge    1170 <main+0x30>
cmpl   $0x0,0x10(%rsp)
jle    1210 <main+0xd0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%eax
cmp    $0x2,%eax
jl     1210 <main+0xd0>
mov    $0x2,%r15d
jmp    1272 <main+0x132>
xchg   %ax,%ax
cmp    %eax,%r15d
cmove  %ecx,%edi
cmp    $0x1,%r14d
cmove  %ecx,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%eax
lea    0x1(%r15),%ecx
cmp    %eax,%r15d
mov    %ecx,%r15d
jge    1210 <main+0xd0>
mov    $0x2a,%ecx
mov    $0x2a,%edi
cmp    0x14(%rsp),%r14d
je     1250 <main+0x110>
mov    $0x20,%edi
jmp    1250 <main+0x110>
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"\0AVamos desenhar um ret\C3\A2ngulo \0A\0A\00"
@.str.1 = [21 x i8] c"\0ATamanho da altura: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"\0ATamanho da largura: \00"
@.str.4 = [61 x i8] c"\0A\0AOl\C3\A1 meu nome \C3\A9 Loham Viana e o ret\C3\A2ngulo ficou assim:\0A\0A\00"
@.str.5 = [2 x i8] c"*\00"
@.str.6 = [2 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 ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %12, %7
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 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 ([22 x i8], [22 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 ([61 x i8], [61 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 ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %51
49: ; preds = %43
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 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 = [21 x i8] c"\0ATamanho da altura: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"\0ATamanho da largura: \00"
@.str.9 = [4 x i8] c" %c\00"
@str = [32 x i8] c"\0AVamos desenhar um ret\C3\A2ngulo \0A\00"
@str.10 = [60 x i8] c"\0A\0AOl\C3\A1 meu nome \C3\A9 Loham Viana 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 ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %8, %6
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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 ([22 x i8], [22 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 ([60 x i8], [60 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 @putchar(i32 42)
%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, i32 42, i32 32
%41 = call i32 @putchar(i32 %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
}