// File: 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 %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq 0x18(%rax), %rdi
callq 0x3040
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x5723
leaq -0x60(%rbp), %rdi
callq 0x30c0
subq $0x1, %rax
movsbl -0x60(%rbp,%rax), %eax
cmpl $0xa, %eax
jne 0x576e
leaq -0x60(%rbp), %rdi
callq 0x30c0
subq $0x1, %rax
movb $0x0, -0x60(%rbp,%rax)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x3410
movq -0xa8(%rbp), %rdx
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3fa0
jmp 0x5797
movq -0xa0(%rbp), %rdi
addq $0x28, %rdi
leaq -0x80(%rbp), %rsi
callq 0x32f0
leaq -0x80(%rbp), %rdi
callq 0x3120
leaq -0x81(%rbp), %rdi
callq 0x3270
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x57c0
jmp 0x57e4
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x48, %rdx
leaq 0xab3f(%rip), %rsi      # 0x10339
movb $0x0, %al
callq 0x31e0
jmp 0x5803
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x5803
jmp 0x5827
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x4c, %rdx
leaq 0xaafc(%rip), %rsi      # 0x10339
movb $0x0, %al
callq 0x31e0
jmp 0x5846
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x5846
jmp 0x586a
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x50, %rdx
leaq 0xaab9(%rip), %rsi      # 0x10339
movb $0x0, %al
callq 0x31e0
jmp 0x5889
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x5889
jmp 0x58ad
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x54, %rdx
leaq 0xaa76(%rip), %rsi      # 0x10339
movb $0x0, %al
callq 0x31e0
jmp 0x58cc
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x58cc
jmp 0x58f0
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x58, %rdx
leaq 0xaa33(%rip), %rsi      # 0x10339
movb $0x0, %al
callq 0x31e0
jmp 0x590f
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x590f
jmp 0x5933
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x5c, %rdx
leaq 0xa9f0(%rip), %rsi      # 0x10339
movb $0x0, %al
callq 0x31e0
jmp 0x5952
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x5952
jmp 0x5976
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x68, %rdx
leaq 0xa9b0(%rip), %rsi      # 0x1033c
movb $0x0, %al
callq 0x31e0
jmp 0x5995
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x5995
jmp 0x59b9
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x70, %rdx
leaq 0xa96d(%rip), %rsi      # 0x1033c
movb $0x0, %al
callq 0x31e0
jmp 0x59d8
movq -0xa0(%rbp), %rax
leaq -0x60(%rbp), %rdi
movq 0x18(%rax), %rdx
movl $0x50, %esi
callq 0x33b0
movsbl -0x60(%rbp), %eax
cmpl $0x23, %eax
je 0x59d8
jmp 0x59fc
movq -0xa0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
addq $0x78, %rdx
leaq 0xa92a(%rip), %rsi      # 0x1033c
movb $0x0, %al
callq 0x31e0
xorl %eax, %eax
addq $0xb0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x81(%rbp), %rdi
callq 0x3270
movq -0x90(%rbp), %rdi
callq 0x3400
nop