// File: /workspace/github_cpp_makefile_star2_O1/UCBASiCS[P]SPRIGHT/src/config.cpp
// Function: Config::setSubsamplingMatrices()
void Config::setSubsamplingMatrices()
{
    subsamplingMatrices.clear();
    int samplingPattern;
    int r;
    for (int stage = 0; stage < getBinsNb(); stage++) {
        samplingPattern = getSamplingPattern(stage);

        bool** subsamplingMatrix = (bool**) malloc(getBinNumIndices(stage) * sizeof(bool*));

        for (int iter=0; iter<getBinNumIndices(stage); iter++)
        {
            subsamplingMatrix[iter] = (bool*) malloc(getSignalBitLength() * sizeof(bool));
        }
        for (int r = 0; r < getBinNumIndices(stage); r++)
            for (int c = 0; c < getSignalBitLength(); c++)
                subsamplingMatrix[r][c] = 0;

        r = 0;
        for (int c = 0; c < getSignalBitLength() & r < getBinNumIndices(stage); c++) {
            if ((samplingPattern & (1 << (getSignalBitLength() - c - 1))) != 0) {

                subsamplingMatrix[r++][c] = 1;
            }
        }
        subsamplingMatrices.push_back(subsamplingMatrix);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0xb8(%rdi), %rax
cmpq %rax, 0xc0(%rdi)
je 0x6b4e
movq %rax, 0xc0(%rbx)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0x6d43
leaq 0xb8(%rbx), %rcx
movq %rcx, 0x20(%rsp)
xorl %r13d, %r13d
movl $0x33333333, %r15d      # imm = 0x33333333
movq %rbx, 0x18(%rsp)
movl (%rax,%r13,4), %ecx
movl %ecx, 0x14(%rsp)
movl (%rax,%r13,4), %eax
movl %eax, %ecx
shrl %ecx
movl $0x55555555, %ebp       # imm = 0x55555555
andl %ebp, %ecx
subl %ecx, %eax
movl %eax, %ecx
andl %r15d, %ecx
shrl $0x2, %eax
andl %r15d, %eax
addl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
addl %eax, %ecx
movl $0xf0f0f0f, %r14d       # imm = 0xF0F0F0F
andl %r14d, %ecx
imull $0x1010101, %ecx, %edi  # imm = 0x1010101
shrl $0x15, %edi
andl $0x3f8, %edi            # imm = 0x3F8
callq 0x3320
movq %rax, 0x8(%rsp)
movq 0x28(%rbx), %rax
movl (%rax,%r13,4), %ecx
movl %ecx, %eax
shrl %eax
andl %ebp, %eax
subl %eax, %ecx
movl %ecx, %eax
andl %r15d, %eax
shrl $0x2, %ecx
andl %r15d, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x4, %eax
addl %ecx, %eax
andl %r14d, %eax
je 0x6c54
movslq 0xb0(%rbx), %r12
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x3320
movq 0x8(%rsp), %rcx
movq %rax, (%rcx,%rbp,8)
incq %rbp
movq 0x28(%rbx), %rax
movl (%rax,%r13,4), %eax
movl %eax, %ecx
shrl %ecx
andl $0x55555555, %ecx       # imm = 0x55555555
subl %ecx, %eax
movl %eax, %ecx
andl %r15d, %ecx
shrl $0x2, %eax
andl %r15d, %eax
addl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
addl %eax, %ecx
andl $0xf0f0f0f, %ecx        # imm = 0xF0F0F0F
imull $0x1010101, %ecx, %r14d # imm = 0x1010101
shrl $0x18, %r14d
cmpq %r14, %rbp
jb 0x6c00
jmp 0x6c5f
imull $0x1010101, %eax, %r14d # imm = 0x1010101
shrl $0x18, %r14d
testl %r14d, %r14d
je 0x6c96
movq 0x18(%rsp), %rax
movl 0xb0(%rax), %r12d
movq 0x8(%rsp), %rbp
movl %r14d, %r15d
xorl %ebx, %ebx
testl %r12d, %r12d
jle 0x6c8e
movq (%rbp,%rbx,8), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x3130
incq %rbx
cmpq %rbx, %r15
jne 0x6c7a
movq 0x18(%rsp), %rbx
movslq 0xb0(%rbx), %rax
testq %rax, %rax
setle %cl
testl %r14d, %r14d
sete %dl
orb %cl, %dl
movl 0x14(%rsp), %r9d
jne 0x6cee
movq 0x8(%rsp), %rcx
leal -0x1(%rax), %edx
xorl %esi, %esi
movl $0x1, %edi
btl %edx, %r9d
jae 0x6cdb
movslq %esi, %r8
incl %esi
movq (%rcx,%r8,8), %r8
movb $0x1, -0x1(%r8,%rdi)
cmpl %r14d, %esi
jge 0x6cee
decl %edx
leaq 0x1(%rdi), %r8
cmpq %rax, %rdi
movq %r8, %rdi
jb 0x6cc6
movq 0xc0(%rbx), %rsi
cmpq 0xc8(%rbx), %rsi
je 0x6d10
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0xc0(%rbx)
jmp 0x6d1f
movq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x8572
movl $0x33333333, %r15d      # imm = 0x33333333
incq %r13
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r13
jl 0x6b7f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq