// File: /workspace/github_c_makefile_star2_O3/dnbaker[P]fastiota/fastiota.c
// Function: fastiota64
FASTIOTA_EXPORT uint64_t *fastiota64(uint64_t *start, size_t nelem, uint64_t sv) {
    {
        const size_t leftover = VECSIZE / sizeof(uint64_t) - (uint64_t)start % (VECSIZE / sizeof(uint64_t));
        if(leftover && leftover != VECSIZE / sizeof(uint64_t)) {
            nelem -= leftover;
            switch(leftover) {
                case 7: CASEN case 6: CASEN case 5: CASEN case 4: CASEN case 3: CASEN case 2: CASEN case 1: CASEN
                default: ;
            }
        }
    }
#undef CASEN
    uint64_t *const end = start + nelem, *const origstart = start;
#if __AVX512F__
    __m512i m = init_start64(_mm512_set_epi64, sv);
    const __m512i inc = _mm512_set1_epi64((signed_size_t)(sizeof(m) / sizeof(uint64_t)));
    UNROLL4
    while(end - start >= (signed_size_t)(sizeof(m) / sizeof(uint64_t))) {
        _mm512_store_si512((void *)start, m);
        m = _mm512_add_epi64(m, inc);
        start += (signed_size_t)(sizeof(m) / sizeof(uint64_t));
    }
    sv += (start - origstart);
#elif __AVX2__
    __m256i m = init_start64(_mm256_set_epi64x, sv);
    const __m256i inc = _mm256_set1_epi64x((signed_size_t)(sizeof(m) / sizeof(uint64_t)));
    UNROLL4
    while(end - start >= (signed_size_t)(sizeof(m) / sizeof(uint64_t))) {
        _mm256_store_si256((__m256i *)start, m);
        m = _mm256_add_epi64(m, inc);
        start += (signed_size_t)(sizeof(m) / sizeof(uint64_t));
    }
    sv += (start - origstart);
#elif __SSE2__
    __m128i m = init_start64(_mm_set_epi64x, sv);
    const __m128i inc = _mm_set1_epi64x((signed_size_t)(sizeof(m) / sizeof(uint64_t)));
    UNROLL4
    while(end - start >= (signed_size_t)(sizeof(m) / sizeof(uint64_t))) {
        _mm_store_si128((__m128i *)start, m);
        m = _mm_add_epi64(m, inc);
        start += (signed_size_t)(sizeof(m) / sizeof(uint64_t));
    }
    sv += (start - origstart);
#endif
    while(start < end) *start++ = sv++;
    return origstart;
}

// Assembly:
movq %rdi, %rax
andq $0x7, %rdi
je 0x1936
movq %rax, %rcx
orq $-0x8, %rcx
decq %rdi
leaq 0x1a5c(%rip), %r8       # 0x3340
movslq (%r8,%rdi,4), %rdi
addq %r8, %rdi
jmpq *%rdi
movq %rdx, (%rax)
addq $0x8, %rax
incq %rdx
movq %rdx, (%rax)
addq $0x8, %rax
incq %rdx
movq %rdx, (%rax)
addq $0x8, %rax
incq %rdx
movq %rdx, (%rax)
addq $0x8, %rax
incq %rdx
movq %rdx, (%rax)
addq $0x8, %rax
incq %rdx
movq %rdx, (%rax)
addq $0x8, %rax
incq %rdx
addq %rcx, %rsi
movq %rdx, (%rax)
addq $0x8, %rax
incq %rdx
leaq (%rax,%rsi,8), %rcx
movq %rax, %rdi
movq %rax, %r8
cmpq $0x8, %rsi
jl 0x1a88
leaq 0x7(%rdx), %rdi
vpbroadcastq %rdx, %ymm0
vpaddq 0x1be4(%rip), %xmm0, %xmm1 # 0x3540
vpaddq 0x179c(%rip), %ymm0, %ymm2 # 0x3100
vpmovsxbq 0x1c52(%rip), %zmm3 # 0x35c0
vpermi2q %zmm0, %zmm2, %zmm3
vpmovsxbq 0x1c4a(%rip), %zmm0 # 0x35c8
vpermi2q %zmm1, %zmm3, %zmm0
movb $-0x80, %r8b
kmovd %r8d, %k1
vpbroadcastq %rdi, %zmm0 {%k1}
leaq (,%rsi,8), %rdi
movl $0x3f, %r8d
subq %rdi, %r8
cmpq $-0x38, %r8
movq $-0x39, %rdi
cmovgeq %r8, %rdi
leaq (%rdi,%rsi,8), %rsi
movl %esi, %r8d
shrl $0x6, %r8d
incl %r8d
andl $0x3, %r8d
je 0x19f5
shll $0x6, %r8d
vpbroadcastq 0x1bc4(%rip), %zmm1 # 0x3598
movq %r8, %r9
movq %rax, %rdi
vmovdqa64 %zmm0, (%rdi)
vpaddq %zmm1, %zmm0, %zmm0
addq $0x40, %rdi
addq $-0x40, %r9
jne 0x19da
addq %rax, %r8
jmp 0x19f8
movq %rax, %rdi
cmpq $0xc0, %rsi
jb 0x1a88
movq %rdi, %r8
negq %r8
vpbroadcastq 0x1b83(%rip), %zmm1 # 0x3598
vpbroadcastq 0x1b81(%rip), %zmm2 # 0x35a0
vpbroadcastq 0x1b7f(%rip), %zmm3 # 0x35a8
vpbroadcastq 0x1b7d(%rip), %zmm4 # 0x35b0
vmovdqa64 %zmm0, (%rdi)
vpaddq %zmm1, %zmm0, %zmm5
vmovdqa64 %zmm5, 0x40(%rdi)
vpaddq %zmm2, %zmm0, %zmm5
vmovdqa64 %zmm5, 0x80(%rdi)
vpaddq %zmm3, %zmm0, %zmm5
vmovdqa64 %zmm5, 0xc0(%rdi)
vpaddq %zmm4, %zmm0, %zmm0
addq $0x100, %rdi            # imm = 0x100
leaq (%rcx,%r8), %rsi
addq $-0x100, %rsi
addq $-0x100, %r8
cmpq $0x38, %rsi
jg 0x1a33
negq %r8
cmpq %rcx, %rdi
jae 0x1b09
leaq 0x8(%rdi), %rsi
cmpq %rsi, %rcx
cmovaq %rcx, %rsi
movq %rdi, %rcx
notq %rcx
addq %rsi, %rcx
vpbroadcastq %rcx, %ymm1
shrq $0x3, %rcx
subq %rax, %r8
sarq $0x3, %r8
addq %rdx, %r8
addq $0x4, %rcx
andq $-0x4, %rcx
vpbroadcastq %r8, %ymm0
vpaddq 0x1655(%rip), %ymm0, %ymm0 # 0x3120
vpsrlq $0x3, %ymm1, %ymm1
xorl %edx, %edx
vpmovsxbq 0x1aa9(%rip), %ymm2 # 0x3584
vpbroadcastq 0x1ad4(%rip), %ymm3 # 0x35b8
vpbroadcastq %rdx, %ymm4
vpor %ymm2, %ymm4, %ymm4
vpcmpleuq %ymm1, %ymm4, %k1
vmovdqu64 %ymm0, (%rdi,%rdx,8) {%k1}
addq $0x4, %rdx
vpaddq %ymm3, %ymm0, %ymm0
cmpq %rdx, %rcx
jne 0x1ae4
vzeroupper
retq