// File: /workspace/github_c_makefile_star2_O3/chriso[P]columnix/lib/reader.c
// Function: cx_row_group_reader_get
struct cx_row_group *cx_row_group_reader_get(
    const struct cx_row_group_reader *reader, size_t index)
{
    const struct cx_row_group_header *row_group_header =
        &reader->row_groups.headers[index];
    size_t headers_size =
        reader->columns.count * sizeof(struct cx_column_header);
    size_t headers_offset = row_group_header->offset + row_group_header->size;
    if (headers_offset + headers_size > reader->file_size)
        return NULL;
    const struct cx_column_header *columns_headers =
        cx_row_group_reader_at(reader, headers_offset);
    struct cx_row_group *row_group = cx_row_group_new();
    if (!row_group)
        return NULL;
    for (size_t i = 0; i < reader->columns.count; i++) {
        const struct cx_column_descriptor *descriptor =
            &reader->columns.descriptors[i];
        const struct cx_column_header *header = &columns_headers[i * 2];
        if (header->offset + header->size > reader->file_size)
            goto error;
        const struct cx_column_header *null_header =
            &columns_headers[i * 2 + 1];
        if (null_header->offset + null_header->size > reader->file_size)
            goto error;

        struct cx_lazy_column column = {
            .type = descriptor->type,
            .encoding = header->encoding,
            .compression = header->compression,
            .index = &header->index,
            .ptr = cx_row_group_reader_at(reader, header->offset),
            .size = header->size,
            .decompressed_size = header->decompressed_size};

        struct cx_lazy_column nulls = {
            .type = CX_COLUMN_BIT,
            .encoding = null_header->encoding,
            .compression = null_header->compression,
            .index = &null_header->index,
            .ptr = cx_row_group_reader_at(reader, null_header->offset),
            .size = null_header->size,
            .decompressed_size = null_header->decompressed_size};

        if (!cx_row_group_add_lazy_column(row_group, &column, &nulls))
            goto error;
    }
    return row_group;
error:
    cx_row_group_free(row_group);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq 0x38(%rdi), %rax
imulq $0x38, 0x30(%rdi), %rcx
shlq $0x4, %rsi
movq (%rax,%rsi), %r13
addq 0x8(%rax,%rsi), %r13
addq %r13, %rcx
cmpq 0x10(%rdi), %rcx
ja 0x9623
movq %rdi, %r14
addq 0x8(%rdi), %r13
callq 0x5790
testq %rax, %rax
je 0x9623
movq %rax, %rbx
cmpq $0x0, 0x30(%r14)
je 0x9625
addq $0x58, %r13
movl $0x4, %ebp
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
movq 0x10(%r14), %rdi
movq -0x58(%r13), %rsi
movq -0x50(%r13), %rdx
leaq (%rdx,%rsi), %rax
cmpq %rdi, %rax
ja 0x961b
movq -0x20(%r13), %rcx
movq -0x18(%r13), %rax
leaq (%rax,%rcx), %r8
cmpq %rdi, %r8
ja 0x961b
movq 0x28(%r14), %rdi
movl (%rdi,%rbp), %edi
movl %edi, 0x38(%rsp)
movq -0x40(%r13), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x3c(%rsp)
leaq -0x38(%r13), %rdi
movq %rdi, 0x48(%rsp)
movq 0x8(%r14), %rdi
addq %rdi, %rsi
movq %rsi, 0x50(%rsp)
movq %rdx, 0x58(%rsp)
movq -0x48(%r13), %rdx
movq %rdx, 0x60(%rsp)
movl $0x0, 0x8(%rsp)
movq -0x8(%r13), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0xc(%rsp)
movq %r13, 0x18(%rsp)
addq %rdi, %rcx
movq %rcx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq -0x10(%r13), %rax
movq %rax, 0x30(%rsp)
movq %rbx, %rdi
leaq 0x38(%rsp), %rsi
movq %r12, %rdx
callq 0x52a0
testb %al, %al
je 0x961b
incq %r15
addq $0x70, %r13
addq $0x18, %rbp
cmpq 0x30(%r14), %r15
jb 0x954f
jmp 0x9625
movq %rbx, %rdi
callq 0x5860
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop