#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*/ calcula(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void leitura(int *vetp) {
  for (int i = 0; i < 4; i++) {
    do {
      printf("Entre com um numero menor que 1000 e maior qu 0: ");
      scanf("%d", vetp + i);
    } while (*(vetp + i) < 0 || *(vetp + i) > 1000);
  }
  calcula(vetp);
}


x86 assembly (clang, -O0):
<leitura>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11c3 <leitura+0x93>
jmp    1152 <leitura+0x22>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xebe(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
mov    $0x1,%al
cmpl   $0x0,(%rcx,%rdx,4)
mov    %al,-0xd(%rbp)
jl     11a5 <leitura+0x75>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x3e8,(%rax,%rcx,4)
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1152 <leitura+0x22>
jmp    11b5 <leitura+0x85>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <leitura+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <calcula@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leitura>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xebe(%rip),%r15
lea    0xee9(%rip),%rbx
nopl   0x0(%rax)
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x3e8,(%r14)
ja     1150 <leitura+0x20>
lea    0x4(%r14),%rbx
lea    0xe89(%rip),%r15
lea    0xeb4(%rip),%r12
xchg   %ax,%ax
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0x3e8,(%rbx)
ja     1180 <leitura+0x50>
lea    0x8(%r14),%rbx
lea    0xe5a(%rip),%r15
lea    0xe85(%rip),%r12
nopl   (%rax)
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0x3e8,(%rbx)
ja     11b0 <leitura+0x80>
lea    0xc(%r14),%rbx
lea    0xe2a(%rip),%r15
lea    0xe55(%rip),%r12
nopl   (%rax)
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0x3e8,(%rbx)
ja     11e0 <leitura+0xb0>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <calcula@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Entre com um numero menor que 1000 e maior qu 0: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @leitura(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %32, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %35
7: ; preds = %4
br label %8
8: ; preds = %29, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%10 = load i32*, i32** %2
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
br label %15
15: ; preds = %8
%16 = load i32*, i32** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = icmp slt i32 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %15
%23 = load i32*, i32** %2
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = icmp sgt i32 %27, 1000
br label %29
29: ; preds = %22, %15
%30 = phi i1 [ true, %15 ], [ %28, %22 ]
br i1 %30, label %8, label %31
31: ; preds = %29
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %4
35: ; preds = %4
%36 = load i32*, i32** %2
%37 = call i32 @calcula(i32* %36)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"Entre com um numero menor que 1000 e maior qu 0: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @leitura(i32* %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %0)
%5 = load i32, i32* %0
%6 = icmp ugt i32 %5, 1000
br i1 %6, label %2, label %7
7: ; preds = %2
%8 = getelementptr inbounds i32, i32* %0, i64 1
br label %9
9: ; preds = %9, %7
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%12 = load i32, i32* %8
%13 = icmp ugt i32 %12, 1000
br i1 %13, label %9, label %14
14: ; preds = %9
%15 = getelementptr inbounds i32, i32* %0, i64 2
br label %16
16: ; preds = %16, %14
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%19 = load i32, i32* %15
%20 = icmp ugt i32 %19, 1000
br i1 %20, label %16, label %21
21: ; preds = %16
%22 = getelementptr inbounds i32, i32* %0, i64 3
br label %23
23: ; preds = %23, %21
%24 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%25 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%26 = load i32, i32* %22
%27 = icmp ugt i32 %26, 1000
br i1 %27, label %23, label %28
28: ; preds = %23
%29 = tail call i32 @calcula(i32* %0)
ret void
}