#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 */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *add_node(struct node *, double, double, int /*<<< orphan*/);
int scanf(char *, double *, double *);
struct node *get_data(struct node *to_list) {
  double x = 0;
  double y = 0;
  int input;
  int i = 1;
  do {
    input = scanf("%lf%lf", &x, &y);
    to_list = add_node(to_list, x, y, i++);
  } while (input == 2);
  return to_list;
}


x86 assembly (clang, -O0):
<get_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
lea    0xeb6(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
call   1030 <add_node@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x2,-0x1c(%rbp)
je     1143 <get_data+0x23>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r13
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    $0x1,%ebx
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe99(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <scanf@plt>
mov    %eax,%ebp
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
lea    0x1(%rbx),%r14d
mov    %r13,%rdi
mov    %ebx,%esi
call   1030 <add_node@plt>
mov    %rax,%r13
mov    %r14d,%ebx
cmp    $0x2,%ebp
je     1160 <get_data+0x40>
mov    %r13,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [7 x i8] c"%lf%lf\00"
define %struct.node* @get_data(%struct.node* %0) {
%2 = alloca %struct.node*
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store %struct.node* %0, %struct.node** %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
store i32 1, i32* %6
br label %7
7: ; preds = %15, %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double* %3, double* %4)
store i32 %8, i32* %5
%9 = load %struct.node*, %struct.node** %2
%10 = load double, double* %3
%11 = load double, double* %4
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
store i32 %13, i32* %6
%14 = call %struct.node* @add_node(%struct.node* %9, double %10, double %11, i32 %12)
store %struct.node* %14, %struct.node** %2
br label %15
15: ; preds = %7
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 2
br i1 %17, label %7, label %18
18: ; preds = %15
%19 = load %struct.node*, %struct.node** %2
ret %struct.node* %19
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [7 x i8] c"%lf%lf\00"
define %struct.node* @get_data(%struct.node* %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%5 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
br label %6
6: ; preds = %6, %1
%7 = phi %struct.node* [ %0, %1 ], [ %13, %6 ]
%8 = phi i32 [ 1, %1 ], [ %12, %6 ]
%9 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double* %2, double* %3)
%10 = load double, double* %2
%11 = load double, double* %3
%12 = add nuw nsw i32 %8, 1
%13 = call %struct.node* @add_node(%struct.node* %7, double %10, double %11, i32 %8)
%14 = icmp eq i32 %9, 2
br i1 %14, label %6, label %15
15: ; preds = %6
ret %struct.node* %13
}