// File: /workspace/github_cpp_makefile_star2_O1/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 0x394a
movq %r14, %rdi
callq 0x20a0
cmpb $0xa, -0x1(%rax,%r14)
jne 0x3976
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 0x39c0
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 0x39c3
leaq 0x48(%rbx), %rdx
leaq 0x5944(%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 0x39f2
leaq 0x4c(%rbx), %rdx
leaq 0x5915(%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 0x3a21
leaq 0x50(%rbx), %rdx
leaq 0x58e6(%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 0x3a50
leaq 0x54(%rbx), %rdx
leaq 0x58b7(%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 0x3a7f
leaq 0x58(%rbx), %rdx
leaq 0x5888(%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 0x3aae
leaq 0x5c(%rbx), %rdx
leaq 0x5859(%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 0x3add
leaq 0x68(%rbx), %rdx
leaq 0x582d(%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 0x3b0c
leaq 0x70(%rbx), %rdx
leaq 0x57fe(%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 0x3b3b
addq $0x78, %rbx
leaq 0x57cf(%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