#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_to(struct node *, double, double);
int scanf(char *, double *, double *);
struct node *get_input(void) {
  struct node *first = NULL;
  double x = 0;
  double y = 0;
  int input;
  do {
    input = 0;
    input = scanf("%lf%lf", &x, &y);
    first = add_to(first, x, y);
  } while (input == 2);
  return first;
}


x86 assembly (clang, -O0):
<get_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeb2(%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
call   1030 <add_to@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x2,-0x1c(%rbp)
je     1140 <get_input+0x20>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_input>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
xor    %ebx,%ebx
lea    0xeba(%rip),%r14
lea    0x8(%rsp),%r15
mov    %rsp,%r12
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <scanf@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
mov    %rbx,%rdi
call   1030 <add_to@plt>
mov    %rax,%rbx
cmp    $0x2,%ebp
je     1150 <get_input+0x30>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
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_input() {
%1 = alloca %struct.node*
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store %struct.node* null, %struct.node** %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
br label %5
5: ; preds = %11, %0
store i32 0, i32* %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double* %2, double* %3)
store i32 %6, i32* %4
%7 = load %struct.node*, %struct.node** %1
%8 = load double, double* %2
%9 = load double, double* %3
%10 = call %struct.node* @add_to(%struct.node* %7, double %8, double %9)
store %struct.node* %10, %struct.node** %1
br label %11
11: ; preds = %5
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %5, label %14
14: ; preds = %11
%15 = load %struct.node*, %struct.node** %1
ret %struct.node* %15
}

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