#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 scanf(char *, ...);
void readVec(int *x, int size) {
  int i;
  for (i = 0; i < size; i++) {
    printf("\nPlease enter number %d:", i + 1);
    for (; scanf("%d", &x[i]) != 1; scanf("%*s"))
      printf("\nError: Please enter member %d:", i + 1);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<readVec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b6 <readVec+0x96>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     11a3 <readVec+0x83>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    1156 <readVec+0x36>
jmp    11a8 <readVec+0x88>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <readVec+0x16>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readVec>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %esi,%esi
jle    11ba <readVec+0x8a>
mov    %esi,%r15d
lea    0xecc(%rip),%rbx
lea    0xec8(%rip),%r12
lea    0xee1(%rip),%r13
xor    %ebp,%ebp
jmp    1165 <readVec+0x35>
nop
cmp    %r15,%rbp
je     11ba <readVec+0x8a>
mov    %rbp,%r14
add    $0x1,%rbp
lea    0xe8d(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
lea    (%rax,%r14,4),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1160 <readVec+0x30>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
jmp    1190 <readVec+0x60>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0APlease enter number %d:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"\0AError: Please enter member %d:\00"
@.str.3 = [4 x i8] c"%*s\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @readVec(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %28, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %31
10: ; preds = %6
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %25, %10
%15 = load i32*, i32** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = icmp ne i32 %19, 1
br i1 %20, label %21, label %27
21: ; preds = %14
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %14
27: ; preds = %14
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %6
31: ; preds = %6
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0APlease enter number %d:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"\0AError: Please enter member %d:\00"
@.str.3 = [4 x i8] c"%*s\00"
define void @readVec(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %16, %8
%7 = icmp eq i64 %10, %5
br i1 %7, label %21, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %10, %6 ]
%10 = add nuw nsw i64 %9, 1
%11 = trunc i64 %10 to i32
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds i32, i32* %0, i64 %9
%14 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = icmp eq i32 %14, 1
br i1 %15, label %6, label %16
16: ; preds = %8, %16
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%18 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%20 = icmp eq i32 %19, 1
br i1 %20, label %6, label %16
21: ; preds = %6, %2
%22 = tail call i32 @putchar(i32 10)
ret void
}