// File: /workspace/github_cpp_makefile_star2_O3/adrianphoulady[P]weighted-tsetlin-machine-cpp/./weightm.h
// Function: weightm::literal_mask()
void literal_mask() {
        int n = features << 1, flips = binomial(p, n);
        bool const target = flips <= features;
        // if flips are more than half, do it the other way; make 0s in an all-1 sequence
        if (!target)
            flips = n - flips;
        std::fill(&lmask(0), &lmask(literals), target - 1);
        while (flips) {
            auto l = fastrandrange(n), w = l / word_bits, b = l % word_bits;
            if ((lmask(w) >> b & 1) == target)
                continue;
            lmask(w) ^= (word) 1 << b;
            --flips;
        }
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movabsq $0x5851f42d4c957f2d, %r14 # imm = 0x5851F42D4C957F2D
movl (%rdi), %ebp
addl %ebp, %ebp
movsd 0x8(%rdi), %xmm1
cvtsi2sd %ebp, %xmm0
movsd 0xd3e(%rip), %xmm2      # 0x50e0
subsd %xmm1, %xmm2
movsd %xmm0, 0x18(%rsp)
mulsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
mulsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rsp)
movq 0x3de9(%rip), %rcx      # 0x81b0
movq %rcx, %rax
imulq %r14, %rax
movq %rax, 0x3ddb(%rip)      # 0x81b0
movq %rcx, %rax
shrq $0x16, %rax
xorq %rcx, %rax
shrq $0x3d, %rcx
addb $0x16, %cl
shrq %cl, %rax
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0xcdd(%rip), %xmm0      # 0x50d8
callq 0x2170
mulsd 0xce0(%rip), %xmm0      # 0x50e8
mulsd 0x8(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x441e
sqrtsd %xmm0, %xmm0
jmp 0x4423
callq 0x2160
movsd %xmm0, 0x8(%rsp)
movq 0x3d80(%rip), %rcx      # 0x81b0
movq %rcx, %rax
imulq %r14, %rax
movq %rcx, %rdx
shrq $0x16, %rdx
xorq %rcx, %rdx
shrq $0x3d, %rcx
addb $0x16, %cl
shrq %cl, %rdx
movq %rax, 0x3d5e(%rip)      # 0x81b0
movl %edx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0xc74(%rip), %xmm0      # 0x50d8
mulsd 0xc84(%rip), %xmm0      # 0x50f0
callq 0x2080
mulsd 0x8(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
addsd 0xc4b(%rip), %xmm0      # 0x50d0
ucomisd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %ecx
cmovael %ebp, %ecx
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
cmovbl %ecx, %eax
movl (%rbx), %edx
movl %ebp, %esi
subl %eax, %esi
xorl %ecx, %ecx
cmpl %edx, %eax
cmovlel %eax, %esi
setg %r9b
movq 0x48(%rbx), %rdi
movslq 0x20(%rbx), %r8
testq %r8, %r8
je 0x45c8
movb %r9b, %cl
negl %ecx
movabsq $0x3fffffffffffffff, %r9 # imm = 0x3FFFFFFFFFFFFFFF
addq %r9, %r8
andq %r8, %r9
andl $0x3, %r8d
negq %r8
addq %r9, %r8
addq $0x4, %r8
movq %r9, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
xorl %r9d, %r9d
movdqa 0xba7(%rip), %xmm1      # 0x50a0
movdqa 0xb6f(%rip), %xmm2      # 0x5070
movdqa 0xb77(%rip), %xmm3      # 0x5080
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %r9, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %r10d
notl %r10d
testb $0x1, %r10b
je 0x455a
movl %ecx, (%rdi,%r9,4)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %r10d
testb $0x1, %r10b
je 0x456f
movl %ecx, 0x4(%rdi,%r9,4)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %r10d
testb $0x1, %r10b
je 0x45aa
movl %ecx, 0x8(%rdi,%r9,4)
pextrw $0x4, %xmm5, %r10d
testb $0x1, %r10b
je 0x45bb
movl %ecx, 0xc(%rdi,%r9,4)
addq $0x4, %r9
cmpq %r9, %r8
jne 0x4511
testl %esi, %esi
je 0x462e
movq 0x3bdd(%rip), %r8       # 0x81b0
movl %ebp, %r9d
cmpl %edx, %eax
setle %bl
movq %r8, %r10
shrq $0x16, %r10
xorq %r8, %r10
movq %r8, %rcx
shrq $0x3d, %rcx
addb $0x16, %cl
shrq %cl, %r10
movl %r10d, %ecx
imulq %r9, %rcx
movq %rcx, %r10
shrq $0x20, %r10
shrq $0x25, %rcx
andl $0x1f, %r10d
movl (%rdi,%rcx,4), %r11d
btl %r10d, %r11d
sbbb $0x0, %bl
je 0x461f
btcl %r10d, %r11d
movl %r11d, (%rdi,%rcx,4)
decl %esi
imulq %r14, %r8
testl %esi, %esi
jne 0x45d6
movq %r8, 0x3b82(%rip)       # 0x81b0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop