#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 */
scalar_t__ scanf(char *, size_t *);
int nl_xvector_scan(size_t *a, size_t n) {
  size_t j;
  for (j = 0; j < n; j++) {
    if (scanf("%lf", &a[j]) == 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<nl_xvector_scan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    117d <nl_xvector_scan+0x6d>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xeb4(%rip),%rdi
call   1030 <scanf@plt>
cmp    $0x0,%rax
jne    1167 <nl_xvector_scan+0x57>
movl   $0x0,-0x4(%rbp)
jmp    1184 <nl_xvector_scan+0x74>
jmp    116c <nl_xvector_scan+0x5c>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1128 <nl_xvector_scan+0x18>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nl_xvector_scan>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
test   %rsi,%rsi
je     114f <nl_xvector_scan+0x3f>
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xed1(%rip),%r15
nop
mov    %r15,%rdi
mov    %rbp,%rsi
call   1030 <scanf@plt>
test   %rax,%rax
je     114c <nl_xvector_scan+0x3c>
add    $0x8,%rbp
add    $0xffffffffffffffff,%rbx
jne    1130 <nl_xvector_scan+0x20>
jmp    114f <nl_xvector_scan+0x3f>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define i32 @nl_xvector_scan(i64* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %4
store i64 %1, i64* %5
store i64 0, i64* %6
br label %7
7: ; preds = %19, %2
%8 = load i64, i64* %6
%9 = load i64, i64* %5
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i64*, i64** %4
%13 = load i64, i64* %6
%14 = getelementptr inbounds i64, i64* %12, i64 %13
%15 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 0, i32* %3
br label %23
18: ; preds = %11
br label %19
19: ; preds = %18
%20 = load i64, i64* %6
%21 = add i64 %20, 1
store i64 %21, i64* %6
br label %7
22: ; preds = %7
store i32 1, i32* %3
br label %23
23: ; preds = %22, %17
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define i32 @nl_xvector_scan(i64* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %6
4: ; preds = %6
%5 = icmp eq i64 %11, %1
br i1 %5, label %12, label %6
6: ; preds = %2, %4
%7 = phi i64 [ %11, %4 ], [ 0, %2 ]
%8 = getelementptr inbounds i64, i64* %0, i64 %7
%9 = tail call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %8)
%10 = icmp eq i64 %9, 0
%11 = add nuw i64 %7, 1
br i1 %10, label %12, label %4
12: ; preds = %6, %4, %2
%13 = phi i32 [ 1, %2 ], [ 1, %4 ], [ 0, %6 ]
ret i32 %13
}