#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 *, double *);
void Get_data(double input[], int n, int flag) {
  int iterator;
  if (flag == 0) {
    printf("Please enter the vector for x now. \n");
  } else {
    printf("Please enter the vector for y now. \n");
  }
  for (iterator = 0; iterator < n; iterator++) {
    scanf("%lf", &input[iterator]);
  }
}


x86 assembly (clang, -O0):
<Get_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    114d <Get_data+0x2d>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    1159 <Get_data+0x39>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1195 <Get_data+0x75>
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xec8(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <Get_data+0x40>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_data>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
test   %edx,%edx
lea    0xef6(%rip),%rax
lea    0xecb(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1165 <Get_data+0x45>
mov    %ebp,%ebp
lea    0xeb1(%rip),%r14
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x8,%rbx
add    $0xffffffffffffffff,%rbp
jne    1150 <Get_data+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Please enter the vector for x now. \0A\00"
@.str.1 = [37 x i8] c"Please enter the vector for y now. \0A\00"
@.str.2 = [4 x i8] c"%lf\00"
define void @Get_data(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %14
12: ; preds = %3
%13 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
store i32 0, i32* %7
br label %15
15: ; preds = %25, %14
%16 = load i32, i32* %7
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load double*, double** %4
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %23)
br label %25
25: ; preds = %19
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %15
28: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%lf\00"
@str = [36 x i8] c"Please enter the vector for y now. \00"
@str.3 = [36 x i8] c"Please enter the vector for x now. \00"
define void @Get_data(double* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %16
8: ; preds = %3
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %14, %10 ]
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %12)
%14 = add nuw nsw i64 %11, 1
%15 = icmp eq i64 %14, %9
br i1 %15, label %16, label %10
16: ; preds = %10, %3
ret void
}