// File: UBOdin[P]jitd-cpp/src/driver.cpp
// Function: buffer_cmd(std::istream&)
RecordBuffer buffer_cmd(istream &toks)
{
  string fill;
  toks >> fill;

  if(string("random") == fill) {
    int len, max;
    toks >> len >> max;
    return build_buffer(len,max);        

  } else if(string("explicit") == fill) {
    return load_buffer(toks);
  
  } else if(string("file") == fill) {
    ifstream f;
    string filename;
    toks >> filename;
    f.open(filename);
    return load_buffer(f);        
    
  } else {
    cerr << "Invalid Fill Mode: " << fill << endl;
    exit(-1);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x350, %rsp            # imm = 0x350
movq %rdi, -0x300(%rbp)
movq %rdi, %rax
movq %rax, -0x2f8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x4350
movq -0x2f0(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x4320
jmp 0x1e5b6
leaq -0x61(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0x4430
movq -0x308(%rbp), %rdx
leaq 0x1aba(%rip), %rsi      # 0x2008e
leaq -0x60(%rbp), %rdi
callq 0x4340
jmp 0x1e5df
leaq -0x60(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x7690
movb %al, -0x309(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4180
leaq -0x61(%rbp), %rdi
callq 0x42d0
movb -0x309(%rbp), %al
testb $0x1, %al
jne 0x1e610
jmp 0x1e683
movq -0x10(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4170
movq %rax, -0x318(%rbp)
jmp 0x1e626
movq -0x318(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
callq 0x4170
jmp 0x1e638
movq -0x300(%rbp), %rdi
movl -0x68(%rbp), %esi
movl -0x6c(%rbp), %edx
callq 0x5710
jmp 0x1e64c
movl $0x1, -0x70(%rbp)
jmp 0x1e8b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1e8c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x42d0
jmp 0x1e8c9
leaq -0x91(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x4430
movq -0x320(%rbp), %rdx
leaq 0x19f1(%rip), %rsi      # 0x20095
leaq -0x90(%rbp), %rdi
callq 0x4340
jmp 0x1e6b2
leaq -0x90(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x7690
movb %al, -0x321(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4180
leaq -0x91(%rbp), %rdi
callq 0x42d0
movb -0x321(%rbp), %al
testb $0x1, %al
jne 0x1e6ec
jmp 0x1e727
movq -0x300(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5850
jmp 0x1e6fe
movl $0x1, -0x70(%rbp)
jmp 0x1e8b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x91(%rbp), %rdi
callq 0x42d0
jmp 0x1e8c9
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x4430
movq -0x330(%rbp), %rdx
leaq 0x28b4(%rip), %rsi      # 0x20ffc
leaq -0xb8(%rbp), %rdi
callq 0x4340
jmp 0x1e756
leaq -0xb8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x7690
movb %al, -0x331(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x4180
leaq -0xb9(%rbp), %rdi
callq 0x42d0
movb -0x331(%rbp), %al
testb $0x1, %al
jne 0x1e793
jmp 0x1e85c
leaq -0x2c8(%rbp), %rdi
callq 0x42e0
jmp 0x1e7a1
leaq -0x2e8(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x4350
movq -0x340(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x4320
jmp 0x1e7c6
leaq -0x2c8(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
movl $0x8, %edx
callq 0x4220
jmp 0x1e7e0
movq -0x300(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x5850
jmp 0x1e7f5
movl $0x1, -0x70(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x4180
leaq -0x2c8(%rbp), %rdi
callq 0x4060
jmp 0x1e8b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xb9(%rbp), %rdi
callq 0x42d0
jmp 0x1e8c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x4180
leaq -0x2c8(%rbp), %rdi
callq 0x4060
jmp 0x1e8c9
movq 0x1178d(%rip), %rdi     # 0x2fff0
leaq 0x2797(%rip), %rsi      # 0x21001
callq 0x4280
movq %rax, -0x348(%rbp)
jmp 0x1e878
movq -0x348(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4240
movq %rax, -0x350(%rbp)
jmp 0x1e891
movq -0x350(%rbp), %rdi
movq 0x11701(%rip), %rsi     # 0x2ffa0
callq 0x42c0
jmp 0x1e8a6
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4300
leaq -0x30(%rbp), %rdi
callq 0x4180
movq -0x2f8(%rbp), %rax
addq $0x350, %rsp            # imm = 0x350
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x4180
movq -0x38(%rbp), %rdi
callq 0x4420
nopl (%rax,%rax)