// File: /workspace/github_cpp_makefile_star2_O1/roberto-bayardo[P]google-extremal-sets/data-source-iterator.cc
// Function: google_extremal_sets::DataSourceIterator::Next(unsigned int*, std::vector<unsigned int, std::allocator<unsigned int>>*)
int DataSourceIterator::Next(uint32_t* vector_id, std::vector<uint32_t>* vec) {
  size_t bytes_read;
  uint32_t vector_size;

  while ((bytes_read = fread(vector_id, 1, 4, data_)) == 4) {
    bytes_read = fread(&vector_size, 1, 4, data_);
    if (bytes_read != 4) {
      if (ferror(data_))
        break;
      error_ = "Dataset format error. Partial vector length encountered "
          "for vector id " + ToString(*vector_id);
      return -1;
    }
    if (vector_size > kMaxVectorSize) {
      error_ = "Dataset format error. Size of vector id " +
          ToString(*vector_id) +
          " exceeds maximum: " +
          ToString(vector_size);
      return -1;
    }
    vec->resize(vector_size);
    bytes_read = fread(&((*vec)[0]), 1, 4 * vector_size, data_);
    if (bytes_read != 4 * vector_size) {
      if (ferror(data_))
        break;
      error_ = "Dataset format error. Dataset truncated while reading "
          "features from vector id " +
          ToString(*vector_id);
      return -1;
    }
    lines_processed_++;
    return 1;
  }
  if (ferror(data_)) {
    error_ = "Dataset read error, ferror code=" + ToString(ferror(data_));
    return -1;
  }
  if (bytes_read != 0) {
    error_ = "Dataset format error. Partial vector id encountered.";
    return -1;
  }
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %rcx
movl $0x1, %esi
movl $0x4, %edx
movq %r15, %rdi
callq 0x2220
cmpq $0x4, %rax
jne 0x3bdf
movq (%rbx), %rcx
leaq 0x44(%rsp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x2220
cmpq $0x4, %rax
jne 0x3be4
movl 0x44(%rsp), %r14d
cmpq $0x186a0, %r14          # imm = 0x186A0
jb 0x3cfb
movl (%r15), %esi
leaq 0x88(%rsp), %r15
movq %r15, %rdi
callq 0x3ffe
leaq 0x1cf2(%rip), %rcx      # 0x5891
movl $0x28, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3da0
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x3da7
movq %rax, %r14
jmp 0x3bf7
movq %rax, %r14
movq (%rbx), %rdi
callq 0x22a0
testl %eax, %eax
je 0x3d35
movq (%rbx), %r15
movq %r15, %rdi
callq 0x22a0
testl %eax, %eax
je 0x3c5b
movq %r15, %rdi
callq 0x22a0
movq %rsp, %r14
movq %r14, %rdi
movl %eax, %esi
callq 0x3ffe
leaq 0x1cfa(%rip), %rcx      # 0x591c
movl $0x20, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3c85
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3c8c
testq %r14, %r14
je 0x3d31
movq 0x18(%rbx), %rdx
addq $0x10, %rbx
leaq 0x1cca(%rip), %rcx      # 0x593d
movl $0x34, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2240
jmp 0x3ce7
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
addq $0x10, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2200
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x3ccc
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ce7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
movq %r14, %rsi
callq 0x42b0
movq (%r12), %rdi
leal (,%r14,4), %r12d
movq (%rbx), %rcx
movl $0x1, %esi
movq %r12, %rdx
callq 0x2220
cmpq %r12, %rax
jne 0x3d61
incl 0x8(%rbx)
movl $0x1, %eax
jmp 0x3cec
xorl %eax, %eax
jmp 0x3cec
movl (%r15), %esi
movq %rsp, %r14
movq %r14, %rdi
callq 0x3ffe
leaq 0x1b00(%rip), %rcx      # 0x584a
movl $0x46, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
jmp 0x3c34
movq %rax, %r14
movq (%rbx), %rdi
callq 0x22a0
testl %eax, %eax
jne 0x3bf7
movl (%r15), %esi
movq %rsp, %r14
movq %r14, %rdi
callq 0x3ffe
leaq 0x1b44(%rip), %rcx      # 0x58cd
movl $0x4e, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
jmp 0x3c34
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x1af0(%rip), %rsi      # 0x58ba
callq 0x22b0
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3df6
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3dfe
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x48(%rsp), %rdi
movl %r14d, %esi
callq 0x3ffe
movq (%rsp), %rcx
movq 0x8(%rsp), %r8
movq 0x50(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r12, %rcx
je 0x3e44
movq 0x10(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x3e63
leaq 0x58(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x3e5e
movq 0x58(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x3e72
movq 0x48(%rsp), %rsi
movq %rsp, %rdi
callq 0x2060
jmp 0x3e80
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
leaq 0x30(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x3ea4
movq %rsi, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x3eaa
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
addq $0x10, %rbx
leaq 0x20(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2200
movq (%r14), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3ef5
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f10
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21c0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x3f26
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x3f3d
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ce7
movq 0x98(%rsp), %rsi
jmp 0x3cdf
jmp 0x3fd8
jmp 0x3fd8
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f86
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3f86
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x3fa1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3fa1
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x3fbd
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3fbd
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ff6
movq 0x98(%rsp), %rsi
jmp 0x3fee
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ff6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2270