#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 EOF;
double *calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ puts(char *);
double *realloc(double *, int);
int scanf(char *, double *);
int main() {
  int size = 4;
  double *numbers = calloc(size, sizeof(double));
  if (numbers == NULL) {
    puts("Հնարավոր չէ հատկացնել պահանջվող հիշողությունը։");
    exit(1);
  }
  int count = 0;
  while (1) {
    int res = scanf("%lf", &numbers[count]);
    if (res == EOF)
      break;
    ++count;
    if (count == size) {
      size *= 2;
      numbers = realloc(numbers, size * sizeof(double));
      if (numbers == NULL) {
        puts("Հնարավոր չէ հատկացնել պահանջվող հիշողությունը։");
        exit(1);
      }
    }
  }
  while (--count >= 0)
    printf("%lf\n", numbers[count]);
  free(numbers);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b8 <main+0x48>
lea    0xe57(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe84(%rip),%rdi
call   1080 <scanf@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2e01(%rip),%rcx
cmp    (%rcx),%eax
jne    11f4 <main+0x84>
jmp    1254 <main+0xe4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    124f <main+0xdf>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1070 <realloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    124a <main+0xda>
lea    0xdc5(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    124f <main+0xdf>
jmp    11bf <main+0x4f>
jmp    1259 <main+0xe9>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jl     1289 <main+0x119>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdde(%rip),%rdi
call   1050 <printf@plt>
jmp    1259 <main+0xe9>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x4,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
test   %rax,%rax
je     1264 <main+0xf4>
mov    %rax,%r12
lea    0xebc(%rip),%rdi
mov    %rax,%rsi
call   1080 <scanf@plt>
mov    0x2e3c(%rip),%r15
xor    %ebp,%ebp
cmp    (%r15),%eax
jne    1204 <main+0x94>
test   %ebp,%ebp
jle    11eb <main+0x7b>
mov    %ebp,%ebx
add    $0x1,%rbx
lea    0xe99(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x2(%rbx),%eax
movsd  (%r12,%rax,8),%xmm0
mov    %r14,%rdi
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     11d0 <main+0x60>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x4,%ebx
xor    %ebp,%ebp
lea    0xe47(%rip),%r14
jmp    1242 <main+0xd2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%r13d
mov    %ebp,%ebx
mov    %ebx,%ebp
movslq %ebx,%rax
lea    (%r12,%rax,8),%rsi
mov    %r14,%rdi
call   1080 <scanf@plt>
mov    %r13d,%ebx
cmp    (%r15),%eax
je     11b3 <main+0x43>
add    $0x1,%ebp
cmp    %ebx,%ebp
jne    1220 <main+0xb0>
mov    %ebx,%esi
shl    $0x4,%esi
mov    %r12,%rdi
call   1070 <realloc@plt>
test   %rax,%rax
je     1264 <main+0xf4>
mov    %rax,%r12
lea    (%rbx,%rbx,1),%r13d
jmp    1225 <main+0xb5>
lea    0xd95(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [89 x i8] c"\D5\80\D5\B6\D5\A1\D6\80\D5\A1\D5\BE\D5\B8\D6\80 \D5\B9\D5\A7 \D5\B0\D5\A1\D5\BF\D5\AF\D5\A1\D6\81\D5\B6\D5\A5\D5\AC \D5\BA\D5\A1\D5\B0\D5\A1\D5\B6\D5\BB\D5\BE\D5\B8\D5\B2 \D5\B0\D5\AB\D5\B7\D5\B8\D5\B2\D5\B8\D6\82\D5\A9\D5\B5\D5\B8\D6\82\D5\B6\D5\A8\D6\89\00"
@.str.1 = [4 x i8] c"%lf\00"
@EOF = global i32 0
@.str.2 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %2
%6 = load i32, i32* %2
%7 = call double* @calloc(i32 %6, i32 8)
store double* %7, double** %3
%8 = load double*, double** %3
%9 = icmp eq double* %8, null
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = call i32 @puts(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %0
store i32 0, i32* %4
br label %14
14: ; preds = %13, %45
%15 = load double*, double** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %18)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %14
br label %46
24: ; preds = %14
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %45
30: ; preds = %24
%31 = load i32, i32* %2
%32 = mul nsw i32 %31, 2
store i32 %32, i32* %2
%33 = load double*, double** %3
%34 = load i32, i32* %2
%35 = sext i32 %34 to i64
%36 = mul i64 %35, 8
%37 = trunc i64 %36 to i32
%38 = call double* @realloc(double* %33, i32 %37)
store double* %38, double** %3
%39 = load double*, double** %3
%40 = icmp eq double* %39, null
br i1 %40, label %41, label %44
41: ; preds = %30
%42 = call i32 @puts(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %30
br label %45
45: ; preds = %44, %24
br label %14
46: ; preds = %23
br label %47
47: ; preds = %51, %46
%48 = load i32, i32* %4
%49 = add nsw i32 %48, -1
store i32 %49, i32* %4
%50 = icmp sge i32 %49, 0
br i1 %50, label %51, label %58
51: ; preds = %47
%52 = load double*, double** %3
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %56)
br label %47
58: ; preds = %47
%59 = load double*, double** %3
%60 = call i32 @free(double* %59)
ret i32 0
}

LLVM IR (-O2):
@.str = [89 x i8] c"\D5\80\D5\B6\D5\A1\D6\80\D5\A1\D5\BE\D5\B8\D6\80 \D5\B9\D5\A7 \D5\B0\D5\A1\D5\BF\D5\AF\D5\A1\D6\81\D5\B6\D5\A5\D5\AC \D5\BA\D5\A1\D5\B0\D5\A1\D5\B6\D5\BB\D5\BE\D5\B8\D5\B2 \D5\B0\D5\AB\D5\B7\D5\B8\D5\B2\D5\B8\D6\82\D5\A9\D5\B5\D5\B8\D6\82\D5\B6\D5\A8\D6\89\00"
@.str.1 = [4 x i8] c"%lf\00"
@EOF = global i32 0
@.str.2 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = tail call double* @calloc(i32 4, i32 8)
%2 = icmp eq double* %1, null
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %33, label %10
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3, %24
%11 = phi i32 [ %27, %24 ], [ 0, %3 ]
%12 = phi double* [ %26, %24 ], [ %1, %3 ]
%13 = phi i32 [ %25, %24 ], [ 4, %3 ]
%14 = add nsw i32 %11, 1
%15 = icmp eq i32 %14, %13
br i1 %15, label %16, label %24
16: ; preds = %10
%17 = shl nsw i32 %13, 1
%18 = shl i32 %13, 4
%19 = tail call double* @realloc(double* %12, i32 %18)
%20 = icmp eq double* %19, null
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %10, %16
%25 = phi i32 [ %17, %16 ], [ %13, %10 ]
%26 = phi double* [ %19, %16 ], [ %12, %10 ]
%27 = phi i32 [ %13, %16 ], [ %14, %10 ]
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %29)
%31 = load i32, i32* @EOF
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %10
33: ; preds = %24, %3
%34 = phi double* [ %1, %3 ], [ %26, %24 ]
%35 = phi i32 [ 0, %3 ], [ %27, %24 ]
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %47
37: ; preds = %33
%38 = zext i32 %35 to i64
br label %39
39: ; preds = %37, %39
%40 = phi i64 [ %38, %37 ], [ %41, %39 ]
%41 = add nsw i64 %40, -1
%42 = and i64 %41, 4294967295
%43 = getelementptr inbounds double, double* %34, i64 %42
%44 = load double, double* %43
%45 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %44)
%46 = icmp ugt i64 %40, 1
br i1 %46, label %39, label %47
47: ; preds = %39, %33
%48 = tail call i32 @free(double* %34)
ret i32 0
}