#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 caractere;
  int x, y;
  int altura = 0;
  int lado = 0;
  char rec;
  int saida = 0;
  while (saida == 0) {
    printf("tamanho do lado: ");
    scanf("%d", &lado);
    printf("tamanho da altura: ");
    scanf("%d", &altura);
    printf("caractere que deseja usar: ");
    scanf(" %c", &caractere);
    printf("Olá, meu nome é Gabriel e o rentangulo ficou assim:\n");
    for (x = 0; x < altura; x++) {
      for (y = 0; y < lado; y++) {
        if (x == 0 || x == altura - 1 || y == 0 || y == lado - 1) {
          printf(" %c ", caractere);
        } else {
          printf("   ");
        }
      }
      printf("\n");
    }
    printf("deseja continuar (S/n)?");
    scanf(" %c", &rec);
    if (rec == 'n') {
      saida = 1;
    }
  }
  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,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    12a5 <main+0x185>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    126c <main+0x14c>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1250 <main+0x130>
cmpl   $0x0,-0xc(%rbp)
je     1218 <main+0xf8>
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1218 <main+0xf8>
cmpl   $0x0,-0x10(%rbp)
je     1218 <main+0xf8>
mov    -0x10(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    122f <main+0x10f>
movsbl -0x5(%rbp),%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x11d>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0x122>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d6 <main+0xb6>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c3 <main+0xa3>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc4(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x6e,%eax
jne    12a0 <main+0x180>
movl   $0x1,-0x20(%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
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
lea    0xead(%rip),%rbx
lea    0xed9(%rip),%r14
lea    0xed6(%rip),%r13
lea    0xed4(%rip),%rbp
jmp    11a8 <main+0x68>
nopl   0x0(%rax)
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x6e,0xe(%rsp)
je     1296 <main+0x156>
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe64(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x10(%rsp)
jle    1180 <main+0x40>
xor    %r15d,%r15d
jmp    1239 <main+0xf9>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    0x10(%rsp),%r15d
jge    1180 <main+0x40>
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 0xf(%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 = [18 x i8] c"tamanho do lado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"tamanho da altura: \00"
@.str.3 = [28 x i8] c"caractere que deseja usar: \00"
@.str.4 = [4 x i8] c" %c\00"
@.str.5 = [55 x i8] c"Ol\C3\A1, meu nome \C3\A9 Gabriel e o rentangulo 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 = [24 x i8] c"deseja continuar (S/n)?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %8
br label %9
9: ; preds = %67, %0
%10 = load i32, i32* %8
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %68
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 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* %6)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 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 ([28 x i8], [28 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* %2)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %20
20: ; preds = %57, %12
%21 = load i32, i32* %3
%22 = load i32, i32* %5
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %60
24: ; preds = %20
store i32 0, i32* %4
br label %25
25: ; preds = %52, %24
%26 = load i32, i32* %4
%27 = load i32, i32* %6
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %55
29: ; preds = %25
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 0
br i1 %31, label %45, label %32
32: ; preds = %29
%33 = load i32, i32* %3
%34 = load i32, i32* %5
%35 = sub nsw i32 %34, 1
%36 = icmp eq i32 %33, %35
br i1 %36, label %45, label %37
37: ; preds = %32
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %37
%41 = load i32, i32* %4
%42 = load i32, i32* %6
%43 = sub nsw i32 %42, 1
%44 = icmp eq i32 %41, %43
br i1 %44, label %45, label %49
45: ; preds = %40, %37, %32, %29
%46 = load i8, i8* %2
%47 = sext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %47)
br label %51
49: ; preds = %40
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %51
51: ; preds = %49, %45
br label %52
52: ; preds = %51
%53 = load i32, i32* %4
%54 = add nsw i32 %53, 1
store i32 %54, i32* %4
br label %25
55: ; preds = %25
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %57
57: ; preds = %55
%58 = load i32, i32* %3
%59 = add nsw i32 %58, 1
store i32 %59, i32* %3
br label %20
60: ; preds = %20
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%62 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%63 = load i8, i8* %7
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 110
br i1 %65, label %66, label %67
66: ; preds = %60
store i32 1, i32* %8
br label %67
67: ; preds = %66, %60
br label %9
68: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"tamanho do lado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"tamanho da altura: \00"
@.str.3 = [28 x i8] c"caractere que deseja usar: \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.9 = [24 x i8] c"deseja continuar (S/n)?\00"
@str = [54 x i8] c"Ol\C3\A1, meu nome \C3\A9 Gabriel e o rentangulo ficou assim:\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %7
7: ; preds = %0, %50
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 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* %3)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, 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* %1)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%15 = load i32, i32* %2
%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* %3
%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* %2
%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* %1
%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* %3
%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* %2
%49 = icmp slt i32 %47, %48
br i1 %49, label %17, label %50
50: ; preds = %45, %7
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, 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* %4)
%53 = load i8, i8* %4
%54 = icmp eq i8 %53, 110
br i1 %54, label %55, label %7
55: ; preds = %50
ret i32 0
}