// File: /workspace/github_cpp_makefile_star2_O3/cpottamus[P]btree_lab/disksystem.cc
// Function: DiskSystem::ReadConfig()
ERROR_T DiskSystem::ReadConfig()
{
  char buf[80];

#define GETNEXTVAL do { fgets(buf,80,configfilefd); } while (buf[0]=='#')  
#define PARSEUNSIGNED(x) do { sscanf(buf,"%u",x); } while (0)
#define PARSEDOUBLE(x) do { sscanf(buf,"%lf",x); } while (0)

  rewind(configfilefd);
  GETNEXTVAL;
  if (buf[strlen(buf)-1]=='\n') { 
    buf[strlen(buf)-1]=0;
  }
  diskfilestem = string(buf);
  GETNEXTVAL;
  PARSEUNSIGNED(&offset);
  GETNEXTVAL;
  PARSEUNSIGNED(&numblocks);
  GETNEXTVAL;
  PARSEUNSIGNED(&blocksize);
  GETNEXTVAL;
  PARSEUNSIGNED(&numheads);
  GETNEXTVAL;
  PARSEUNSIGNED(&blockspertrack);
  GETNEXTVAL;
  PARSEUNSIGNED(&numtracks);
  GETNEXTVAL;
  PARSEDOUBLE(&averageseeklatency);
  GETNEXTVAL;
  PARSEDOUBLE(&trackseeklatency);
  GETNEXTVAL;
  PARSEDOUBLE(&rotationallatency);

  return ERROR_NOERROR;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x2050
movq %rsp, %r14
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x392e
movq %r14, %rdi
callq 0x20a0
cmpb $0xa, -0x1(%rax,%r14)
jne 0x395a
movb $0x0, -0x1(%rsp,%rax)
leaq 0x68(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rsp, %r14
movq %r14, %rdi
callq 0x20a0
leaq (%rsp,%rax), %rdx
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2bc2
leaq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x2270
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x39a4
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x21e0
movq %rsp, %r14
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x39a7
leaq 0x48(%rbx), %rdx
leaq 0x5960(%rip), %rsi      # 0x9329
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21b0
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x39d6
leaq 0x4c(%rbx), %rdx
leaq 0x5931(%rip), %rsi      # 0x9329
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21b0
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x3a05
leaq 0x50(%rbx), %rdx
leaq 0x5902(%rip), %rsi      # 0x9329
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21b0
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x3a34
leaq 0x54(%rbx), %rdx
leaq 0x58d3(%rip), %rsi      # 0x9329
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21b0
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x3a63
leaq 0x58(%rbx), %rdx
leaq 0x58a4(%rip), %rsi      # 0x9329
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21b0
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x3a92
leaq 0x5c(%rbx), %rdx
leaq 0x5875(%rip), %rsi      # 0x9329
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21b0
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x3ac1
leaq 0x68(%rbx), %rdx
leaq 0x5849(%rip), %rsi      # 0x932c
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21b0
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x3af0
leaq 0x70(%rbx), %rdx
leaq 0x581a(%rip), %rsi      # 0x932c
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21b0
movq 0x18(%rbx), %rdx
movq %r14, %rdi
movl $0x50, %esi
callq 0x2300
cmpb $0x23, (%rsp)
je 0x3b1f
addq $0x78, %rbx
leaq 0x57eb(%rip), %rsi      # 0x932c
movq %rsp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x21b0
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq