#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 = 0, j = 0;
  int lar, alt;
  int recomeco = 0;
  char caracter, fim;
  while (recomeco == 0) {
    printf("Introduza uma Largura Valida"
           "\n");
    scanf("%d", &lar);
    printf("Introduza uma Altura Valida"
           "\n");
    scanf("%d", &alt);
    printf("Escolha um caracter que vc deseja usar"
           "\n");
    scanf(" %c", &caracter);
    printf("Ola meu Nome é Matheus Vinnicius e o meu Retangulo ficou assim:\n");
    for (j; j < alt; j++) {
      for (i; i < lar; i++) {
        if (j == 0 || j == alt - 1 || i == 0 || i == lar - 1) {
          printf(" %c ", caracter);
        } else {
          printf("   ");
        }
      }
      i = 0;
      printf("\n");
    }
    printf("Deseja continuar se sim=(1) se não=(2) ?\n");
    scanf(" %c", &fim);
    if (fim == '2') {
      recomeco = 1;
    }
  }
  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    129e <main+0x17e>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1265 <main+0x145>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1242 <main+0x122>
cmpl   $0x0,-0xc(%rbp)
je     120a <main+0xea>
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     120a <main+0xea>
cmpl   $0x0,-0x8(%rbp)
je     120a <main+0xea>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1221 <main+0x101>
movsbl -0x19(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0x10f>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1234 <main+0x114>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c8 <main+0xa8>
movl   $0x0,-0x8(%rbp)
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bc <main+0x9c>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdec(%rip),%rdi
lea    -0x1a(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x1a(%rbp),%eax
cmp    $0x32,%eax
jne    1299 <main+0x179>
movl   $0x1,-0x18(%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
xor    %r15d,%r15d
jmp    1196 <main+0x56>
nop
lea    0xf3a(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x32,0xe(%rsp)
je     1276 <main+0x136>
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe75(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe76(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe82(%rip),%rdi
call   1040 <puts@plt>
jmp    120e <main+0xce>
cs nopw 0x0(%rax,%rax,1)
nop
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    1200 <main+0xc0>
xor    %r12d,%r12d
jmp    124c <main+0x10c>
cs nopw 0x0(%rax,%rax,1)
movsbl 0xf(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12d
mov    0x14(%rsp),%eax
cmp    %eax,%r12d
jge    1200 <main+0xc0>
test   %r15d,%r15d
je     1230 <main+0xf0>
mov    0x10(%rsp),%ecx
add    $0xffffffff,%ecx
cmp    %ecx,%r15d
je     1230 <main+0xf0>
test   %r12d,%r12d
je     1230 <main+0xf0>
add    $0xffffffff,%eax
cmp    %eax,%r12d
je     1230 <main+0xf0>
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    123f <main+0xff>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Introduza uma Largura Valida\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Introduza uma Altura Valida\0A\00"
@.str.3 = [40 x i8] c"Escolha um caracter que vc deseja usar\0A\00"
@.str.4 = [4 x i8] c" %c\00"
@.str.5 = [66 x i8] c"Ola meu Nome \C3\A9 Matheus Vinnicius e o meu 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 = [43 x i8] c"Deseja continuar se sim=(1) se n\C3\A3o=(2) ?\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 ([30 x i8], [30 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 ([29 x i8], [29 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 ([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* %7)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0))
%20 = load i32, i32* %3
br label %21
21: ; preds = %59, %12
%22 = load i32, i32* %3
%23 = load i32, i32* %5
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %62
25: ; preds = %21
%26 = load i32, i32* %2
br label %27
27: ; preds = %54, %25
%28 = load i32, i32* %2
%29 = load i32, i32* %4
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %57
31: ; preds = %27
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 0
br i1 %33, label %47, label %34
34: ; preds = %31
%35 = load i32, i32* %3
%36 = load i32, i32* %5
%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* %2
%41 = icmp eq i32 %40, 0
br i1 %41, label %47, label %42
42: ; preds = %39
%43 = load i32, i32* %2
%44 = load i32, i32* %4
%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* %7
%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* %2
%56 = add nsw i32 %55, 1
store i32 %56, i32* %2
br label %27
57: ; preds = %27
store i32 0, i32* %2
%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* %3
%61 = add nsw i32 %60, 1
store i32 %61, i32* %3
br label %21
62: ; preds = %21
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 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* %8)
%65 = load i8, i8* %8
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 50
br i1 %67, label %68, label %69
68: ; preds = %62
store i32 1, i32* %6
br label %69
69: ; preds = %68, %62
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 = [29 x i8] c"Introduza uma Largura Valida\00"
@str.10 = [28 x i8] c"Introduza uma Altura Valida\00"
@str.11 = [39 x i8] c"Escolha um caracter que vc deseja usar\00"
@str.12 = [65 x i8] c"Ola meu Nome \C3\A9 Matheus Vinnicius e o meu Retangulo ficou assim:\00"
@str.13 = [42 x i8] c"Deseja continuar se sim=(1) se n\C3\A3o=(2) ?\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, %51
%8 = phi i32 [ 0, %0 ], [ %52, %51 ]
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 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* %1)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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* %2)
%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* %3)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.12, i64 0, i64 0))
%16 = load i32, i32* %2
%17 = icmp slt i32 %8, %16
br i1 %17, label %18, label %51
18: ; preds = %7, %46
%19 = phi i32 [ %48, %46 ], [ %8, %7 ]
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %46
22: ; preds = %18
%23 = icmp eq i32 %19, 0
br label %24
24: ; preds = %22, %42
%25 = phi i32 [ %20, %22 ], [ %44, %42 ]
%26 = phi i32 [ 0, %22 ], [ %43, %42 ]
br i1 %23, label %36, label %27
27: ; preds = %24
%28 = load i32, i32* %2
%29 = add nsw i32 %28, -1
%30 = icmp eq i32 %19, %29
%31 = icmp eq i32 %26, 0
%32 = select i1 %30, i1 true, i1 %31
%33 = add nsw i32 %25, -1
%34 = icmp eq i32 %26, %33
%35 = select i1 %32, i1 true, i1 %34
br i1 %35, label %36, label %40
36: ; preds = %27, %24
%37 = load i8, i8* %3
%38 = sext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %38)
br label %42
40: ; preds = %27
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %42
42: ; preds = %36, %40
%43 = add nuw nsw i32 %26, 1
%44 = load i32, i32* %1
%45 = icmp slt i32 %43, %44
br i1 %45, label %24, label %46
46: ; preds = %42, %18
%47 = call i32 @putchar(i32 10)
%48 = add nsw i32 %19, 1
%49 = load i32, i32* %2
%50 = icmp slt i32 %48, %49
br i1 %50, label %18, label %51
51: ; preds = %46, %7
%52 = phi i32 [ %8, %7 ], [ %48, %46 ]
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.13, i64 0, i64 0))
%54 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%55 = load i8, i8* %4
%56 = icmp eq i8 %55, 50
br i1 %56, label %57, label %7
57: ; preds = %51
ret i32 0
}