// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %rcx
movl $0x1, %esi
movl $0x4, %edx
movq %r15, %rdi
callq 0x2220
movq (%rbx), %r12
cmpq $0x4, %rax
jne 0x3bea
leaq 0x4c(%rsp), %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %r12, %rcx
callq 0x2220
cmpq $0x4, %rax
jne 0x3bef
movl 0x4c(%rsp), %r14d
cmpq $0x186a0, %r14          # imm = 0x186A0
jb 0x3d02
movl (%r15), %esi
leaq 0x90(%rsp), %r15
movq %r15, %rdi
callq 0x4017
leaq 0x1ced(%rip), %rcx      # 0x5891
movl $0x28, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3dae
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
jmp 0x3db5
movq %rax, %r14
jmp 0x3c05
movq %rax, %r14
movq (%rbx), %r12
movq %r12, %rdi
callq 0x22a0
testl %eax, %eax
je 0x3d3c
movq %r12, %rdi
callq 0x22a0
testl %eax, %eax
je 0x3c60
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl %eax, %esi
callq 0x4017
leaq 0x1cf5(%rip), %rcx      # 0x591c
movl $0x20, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3c8a
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x3c91
testq %r14, %r14
je 0x3d38
movq 0x18(%rbx), %rdx
addq $0x10, %rbx
leaq 0x1cc5(%rip), %rcx      # 0x593d
movl $0x34, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2240
jmp 0x3cec
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x28(%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 0x3cd1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3cec
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r13, %rdi
movq %r14, %rsi
callq 0x42bc
movq (%r13), %rdi
leal (,%r14,4), %r12d
movq (%rbx), %rcx
movl $0x1, %esi
movq %r12, %rdx
callq 0x2220
cmpq %r12, %rax
jne 0x3d6a
incl 0x8(%rbx)
movl $0x1, %eax
jmp 0x3cf1
xorl %eax, %eax
jmp 0x3cf1
movl (%r15), %esi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x4017
leaq 0x1af7(%rip), %rcx      # 0x584a
movl $0x46, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
jmp 0x3c39
movq %rax, %r14
movq (%rbx), %r12
movq %r12, %rdi
callq 0x22a0
testl %eax, %eax
jne 0x3c05
movl (%r15), %esi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x4017
leaq 0x1b36(%rip), %rcx      # 0x58cd
movl $0x4e, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
jmp 0x3c39
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x70(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x1ae2(%rip), %rsi      # 0x58ba
callq 0x22b0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3e05
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x3e0d
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x50(%rsp), %rdi
movl %r14d, %esi
callq 0x4017
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x58(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r12, %rcx
je 0x3e54
movq 0x18(%rsp), %rdi
movq 0x50(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x3e77
leaq 0x60(%rsp), %r9
movl $0xf, %edi
cmpq %r9, %rsi
je 0x3e72
movq 0x60(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x3e83
leaq 0x8(%rsp), %rdi
callq 0x2060
jmp 0x3e91
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
leaq 0x38(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x3eb5
movq %rsi, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x3ebb
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
addq $0x10, %rbx
leaq 0x28(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2200
movq (%r14), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3f06
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f21
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3f38
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x3f52
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3cec
movq 0xa0(%rsp), %rsi
jmp 0x3ce4
jmp 0x3ff1
jmp 0x3ff1
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f9b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3f9b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3fb7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3fb7
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x3fd6
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3fd6
movq %rax, %rbx
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x400f
movq 0xa0(%rsp), %rsi
jmp 0x4007
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x400f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2270