#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 *);
int Leitura_Dimensao_Array(void) {
  int dim, continua;
  do {
    continua = 0;
    printf("Insira o numero de componentes do array (>= 1 && <= 500000): ");
    scanf("%d", &dim);
    if ((dim <= 0) || (dim > 100000))
      continua = 1;
  } while (continua);
  return (dim);
}


x86 assembly (clang, -O0):
<Leitura_Dimensao_Array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jle    1162 <Leitura_Dimensao_Array+0x42>
cmpl   $0x186a0,-0x4(%rbp)
jle    1169 <Leitura_Dimensao_Array+0x49>
movl   $0x1,-0x8(%rbp)
jmp    116e <Leitura_Dimensao_Array+0x4e>
cmpl   $0x0,-0x8(%rbp)
jne    1128 <Leitura_Dimensao_Array+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Leitura_Dimensao_Array>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%r14
lea    0xf07(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x186a1(%rax),%ecx
cmp    $0xfffe7960,%ecx
jb     1140 <Leitura_Dimensao_Array+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [62 x i8] c"Insira o numero de componentes do array (>= 1 && <= 500000): \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @Leitura_Dimensao_Array() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %13, %0
store i32 0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sle i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 100000
br i1 %10, label %11, label %12
11: ; preds = %8, %3
store i32 1, i32* %2
br label %12
12: ; preds = %11, %8
br label %13
13: ; preds = %12
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 0
br i1 %15, label %3, label %16
16: ; preds = %13
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [62 x i8] c"Insira o numero de componentes do array (>= 1 && <= 500000): \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @Leitura_Dimensao_Array() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add i32 %6, -100001
%8 = icmp ult i32 %7, -100000
br i1 %8, label %3, label %9
9: ; preds = %3
ret i32 %6
}