#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 */
typedef int /*<<< orphan*/ fillp;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int ncx_putn_double_double(void **, size_t, double *);
int NC_fill_double(void **xpp, size_t nelems) {
  double fillp[16 * sizeof(double) / 8];
  assert(nelems <= sizeof(fillp) / sizeof(fillp[0]));
  {
    double *vp = fillp;
    const double *const end = vp + nelems;
    while (vp < end) {
      *vp++ = (9.9692099683868690e+36);
    }
  }
  return ncx_putn_double_double(xpp, nelems, fillp);
}


x86 assembly (clang, -O0):
<NC_fill_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x10,-0x10(%rbp)
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x98(%rbp),%rax
cmp    -0xa0(%rbp),%rax
jae    11a6 <NC_fill_double+0x86>
mov    -0x98(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x98(%rbp)
movsd  0xe63(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    116c <NC_fill_double+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1040 <ncx_putn_double_double@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NC_fill_double>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x11,%rsi
setb   %dil
call   1030 <assert@plt>
test   %rbx,%rbx
jle    127c <NC_fill_double+0x15c>
lea    (%rsp,%rbx,8),%rax
lea    0x8(%rsp),%rsi
cmp    %rsi,%rax
cmova  %rax,%rsi
mov    %rsp,%rdx
mov    %rdx,%rcx
not    %rcx
add    %rsi,%rcx
cmp    $0x18,%rcx
jb     125b <NC_fill_double+0x13b>
shr    $0x3,%rcx
add    $0x1,%rcx
mov    %rcx,%r8
and    $0xfffffffffffffffc,%r8
lea    -0x4(%r8),%rdx
mov    %rdx,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%esi
and    $0x7,%esi
cmp    $0x1c,%rdx
jae    119e <NC_fill_double+0x7e>
xor    %edx,%edx
jmp    1221 <NC_fill_double+0x101>
and    $0xfffffffffffffff8,%rdi
xor    %edx,%edx
movaps 0xe55(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movaps %xmm0,(%rsp,%rdx,8)
movaps %xmm0,0x10(%rsp,%rdx,8)
movaps %xmm0,0x20(%rsp,%rdx,8)
movaps %xmm0,0x30(%rsp,%rdx,8)
movaps %xmm0,0x40(%rsp,%rdx,8)
movaps %xmm0,0x50(%rsp,%rdx,8)
movaps %xmm0,0x60(%rsp,%rdx,8)
movaps %xmm0,0x70(%rsp,%rdx,8)
movaps %xmm0,0x80(%rsp,%rdx,8)
movaps %xmm0,0x90(%rsp,%rdx,8)
movaps %xmm0,0xa0(%rsp,%rdx,8)
movaps %xmm0,0xb0(%rsp,%rdx,8)
movaps %xmm0,0xc0(%rsp,%rdx,8)
movaps %xmm0,0xd0(%rsp,%rdx,8)
movaps %xmm0,0xe0(%rsp,%rdx,8)
movaps %xmm0,0xf0(%rsp,%rdx,8)
add    $0x20,%rdx
add    $0xfffffffffffffff8,%rdi
jne    11b0 <NC_fill_double+0x90>
test   %rsi,%rsi
je     1252 <NC_fill_double+0x132>
lea    (%rsp,%rdx,8),%rdx
add    $0x10,%rdx
shl    $0x5,%rsi
xor    %edi,%edi
movaps 0xdc5(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movaps %xmm0,-0x10(%rdx,%rdi,1)
movaps %xmm0,(%rdx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rsi
jne    1240 <NC_fill_double+0x120>
cmp    %r8,%rcx
je     127c <NC_fill_double+0x15c>
lea    (%rsp,%r8,8),%rdx
movabs $0x479e000000000000,%rcx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rcx,(%rdx)
add    $0x8,%rdx
cmp    %rax,%rdx
jb     1270 <NC_fill_double+0x150>
mov    %rsp,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <ncx_putn_double_double@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @NC_fill_double(i8** %0, i64 %1) {
%3 = alloca i8**
%4 = alloca i64
%5 = alloca [16 x double]
%6 = alloca double*
%7 = alloca double*
store i8** %0, i8*** %3
store i64 %1, i64* %4
%8 = load i64, i64* %4
%9 = icmp ule i64 %8, 16
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = getelementptr inbounds [16 x double], [16 x double]* %5, i64 0, i64 0
store double* %12, double** %6
%13 = load double*, double** %6
%14 = load i64, i64* %4
%15 = getelementptr inbounds double, double* %13, i64 %14
store double* %15, double** %7
br label %16
16: ; preds = %20, %2
%17 = load double*, double** %6
%18 = load double*, double** %7
%19 = icmp ult double* %17, %18
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load double*, double** %6
%22 = getelementptr inbounds double, double* %21, i32 1
store double* %22, double** %6
store double 0x479E000000000000, double* %21
br label %16
23: ; preds = %16
%24 = load i8**, i8*** %3
%25 = load i64, i64* %4
%26 = getelementptr inbounds [16 x double], [16 x double]* %5, i64 0, i64 0
%27 = call i32 @ncx_putn_double_double(i8** %24, i64 %25, double* %26)
ret i32 %27
}

LLVM IR (-O2):
define i32 @NC_fill_double(i8** %0, i64 %1) {
%3 = alloca [16 x double]
%4 = ptrtoint [16 x double]* %3 to i64
%5 = bitcast [16 x double]* %3 to i8*
%6 = icmp ult i64 %1, 17
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 0
%10 = getelementptr inbounds [16 x double], [16 x double]* %3, i64 0, i64 %1
%11 = icmp sgt i64 %1, 0
br i1 %11, label %12, label %98
12: ; preds = %2
%13 = shl i64 %1, 3
%14 = add i64 %13, %4
%15 = or i64 %4, 8
%16 = call i64 @llvm.umax.i64(i64 %14, i64 %15)
%17 = xor i64 %4, -1
%18 = add i64 %16, %17
%19 = lshr i64 %18, 3
%20 = add nuw nsw i64 %19, 1
%21 = icmp ult i64 %18, 24
br i1 %21, label %92, label %22
22: ; preds = %12
%23 = and i64 %20, 4611686018427387900
%24 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %23
%25 = add nsw i64 %23, -4
%26 = lshr exact i64 %25, 2
%27 = add nuw nsw i64 %26, 1
%28 = and i64 %27, 7
%29 = icmp ult i64 %25, 28
br i1 %29, label %77, label %30
30: ; preds = %22
%31 = and i64 %27, 9223372036854775800
br label %32
32: ; preds = %32, %30
%33 = phi i64 [ 0, %30 ], [ %74, %32 ]
%34 = phi i64 [ 0, %30 ], [ %75, %32 ]
%35 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %33
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %36
%37 = getelementptr double, double* %35, i64 2
%38 = bitcast double* %37 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %38
%39 = or i64 %33, 4
%40 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %39
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %41
%42 = getelementptr double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %43
%44 = or i64 %33, 8
%45 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %44
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %46
%47 = getelementptr double, double* %45, i64 2
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %48
%49 = or i64 %33, 12
%50 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %49
%51 = bitcast double* %50 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %51
%52 = getelementptr double, double* %50, i64 2
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %53
%54 = or i64 %33, 16
%55 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %54
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %56
%57 = getelementptr double, double* %55, i64 2
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %58
%59 = or i64 %33, 20
%60 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %59
%61 = bitcast double* %60 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %61
%62 = getelementptr double, double* %60, i64 2
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %63
%64 = or i64 %33, 24
%65 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %64
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %66
%67 = getelementptr double, double* %65, i64 2
%68 = bitcast double* %67 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %68
%69 = or i64 %33, 28
%70 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %69
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %71
%72 = getelementptr double, double* %70, i64 2
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %73
%74 = add nuw i64 %33, 32
%75 = add i64 %34, 8
%76 = icmp eq i64 %75, %31
br i1 %76, label %77, label %32
77: ; preds = %32, %22
%78 = phi i64 [ 0, %22 ], [ %74, %32 ]
%79 = icmp eq i64 %28, 0
br i1 %79, label %90, label %80
80: ; preds = %77, %80
%81 = phi i64 [ %87, %80 ], [ %78, %77 ]
%82 = phi i64 [ %88, %80 ], [ 0, %77 ]
%83 = getelementptr [16 x double], [16 x double]* %3, i64 0, i64 %81
%84 = bitcast double* %83 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %84
%85 = getelementptr double, double* %83, i64 2
%86 = bitcast double* %85 to <2 x double>*
store <2 x double> <double 0x479E000000000000, double 0x479E000000000000>, <2 x double>* %86
%87 = add nuw i64 %81, 4
%88 = add i64 %82, 1
%89 = icmp eq i64 %88, %28
br i1 %89, label %90, label %80
90: ; preds = %80, %77
%91 = icmp eq i64 %20, %23
br i1 %91, label %98, label %92
92: ; preds = %12, %90
%93 = phi double* [ %9, %12 ], [ %24, %90 ]
br label %94
94: ; preds = %92, %94
%95 = phi double* [ %96, %94 ], [ %93, %92 ]
%96 = getelementptr inbounds double, double* %95, i64 1
store double 0x479E000000000000, double* %95
%97 = icmp ult double* %96, %10
br i1 %97, label %94, label %98
98: ; preds = %94, %90, %2
%99 = call i32 @ncx_putn_double_double(i8** %0, i64 %1, double* %9)
ret i32 %99
}