#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int pergunta_tam() {
  int tam;
  printf("Digite o tamanho para o lado do tabuleiro, entre 6 - 10:\n");
  do {
    scanf("%d", &tam);
    getchar();
    if (tam < 6 || tam > 10)
      printf("Tamanho invalido, digite novamente!\n");
  } while (tam < 6 || tam > 10);
  return tam;
}


x86 assembly (clang, -O0):
<pergunta_tam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
cmpl   $0x6,-0x4(%rbp)
jl     116f <pergunta_tam+0x3f>
cmpl   $0xa,-0x4(%rbp)
jle    117b <pergunta_tam+0x4b>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
jmp    1180 <pergunta_tam+0x50>
mov    $0x1,%al
cmpl   $0x6,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1199 <pergunta_tam+0x69>
cmpl   $0xa,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1144 <pergunta_tam+0x14>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pergunta_tam>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%r14
lea    0xc(%rsp),%rbx
lea    0xee4(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0xc(%rsp),%eax
lea    -0xb(%rax),%ecx
cmp    $0xfffffffa,%ecx
ja     1192 <pergunta_tam+0x62>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
lea    -0xb(%rax),%ecx
cmp    $0xfffffffb,%ecx
jb     1160 <pergunta_tam+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Digite o tamanho para o lado do tabuleiro, entre 6 - 10:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"Tamanho invalido, digite novamente!\0A\00"
define i32 @pergunta_tam() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %20, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 (...) @getchar()
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 6
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 10
br i1 %10, label %11, label %13
11: ; preds = %8, %3
%12 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
br label %14
14: ; preds = %13
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 6
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %1
%19 = icmp sgt i32 %18, 10
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ true, %14 ], [ %19, %17 ]
br i1 %21, label %3, label %22
22: ; preds = %20
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [57 x i8] c"Digite o tamanho para o lado do tabuleiro, entre 6 - 10:\00"
@str.3 = [36 x i8] c"Tamanho invalido, digite novamente!\00"
define i32 @pergunta_tam() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %10, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = call i32 (...) @getchar()
%7 = load i32, i32* %1
%8 = add i32 %7, -11
%9 = icmp ult i32 %8, -5
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = add i32 %12, -11
%14 = icmp ult i32 %13, -5
br i1 %14, label %4, label %15
15: ; preds = %4, %10
%16 = phi i32 [ %12, %10 ], [ %7, %4 ]
ret i32 %16
}