// File: trapexit[P]bbf/src/bbf_fsthrash.cpp
// Function: l::fsthrash(Options const&)
AppError
  fsthrash(const Options &opts_)
  {
    FSThrashState state(opts_.device);
    int rv;
    pthread_t thread_id;
    std::vector<pthread_t> threads;

    state.verbose = !opts_.quiet;
    l::spawn_thread(l::create_thread,&state,&threads);
    l::spawn_thread(l::open_thread,&state,&threads);
    l::spawn_thread(l::mkdir_thread,&state,&threads);
    l::spawn_thread(l::write_thread,&state,&threads);
    l::spawn_thread(l::read_thread,&state,&threads);
    l::spawn_thread(l::unlink_thread,&state,&threads);
    l::spawn_thread(l::rmdir_thread,&state,&threads);
    l::spawn_thread(l::close_thread,&state,&threads);
    l::spawn_thread(l::readdir_thread,&state,&threads);
    l::spawn_thread(l::stat_thread,&state,&threads);
    l::spawn_thread(l::chmod_thread,&state,&threads);
    l::spawn_thread(l::chown_thread,&state,&threads);
    l::spawn_thread(l::link_thread,&state,&threads);
    l::spawn_thread(l::symlink_thread,&state,&threads);

    printf("CTRL-C to exit...\n");
    pause();
    printf("Cleaning up...\n");

    l::disable_signals();
    state.is_finished = true;
    for(size_t i = 0; i < threads.size(); i++)
      pthread_join(threads[i],NULL);

    return AppError::success();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x158(%rbp)
movq %rdi, %rax
movq %rax, -0x150(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0xf530
leaq -0x120(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x7250
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
testl %eax, %eax
sete -0xf7(%rbp)
leaq 0x319(%rip), %rdi       # 0xe2f0
callq 0xe260
jmp 0xdfde
leaq 0x42b(%rip), %rdi       # 0xe410
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xdffa
leaq 0x51f(%rip), %rdi       # 0xe520
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe016
leaq 0x603(%rip), %rdi       # 0xe620
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe032
leaq 0x707(%rip), %rdi       # 0xe740
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe04e
leaq 0x89b(%rip), %rdi       # 0xe8f0
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe06a
leaq 0xa0f(%rip), %rdi       # 0xea80
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe086
leaq 0xb83(%rip), %rdi       # 0xec10
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe0a2
leaq 0xc17(%rip), %rdi       # 0xecc0
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe0be
leaq 0xcbb(%rip), %rdi       # 0xed80
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe0da
leaq 0xdcf(%rip), %rdi       # 0xeeb0
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe0f6
leaq 0xeb3(%rip), %rdi       # 0xefb0
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe112
leaq 0xfb7(%rip), %rdi       # 0xf0d0
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe12e
leaq 0x113b(%rip), %rdi      # 0xf270
leaq -0xf8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0xe260
jmp 0xe14a
leaq 0x150c9(%rip), %rdi     # 0x2321a
xorl %eax, %eax
callq 0x4080
jmp 0xe15a
callq 0x40b0
jmp 0xe161
leaq 0x15196(%rip), %rdi     # 0x232fe
xorl %eax, %eax
callq 0x4080
jmp 0xe171
callq 0xf410
jmp 0xe178
movb $0x1, -0xf8(%rbp)
movq $0x0, -0x138(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x58d0
movq %rax, %rcx
movq -0x160(%rbp), %rax
cmpq %rcx, %rax
jae 0xe216
movq -0x138(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0xb5f0
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x44b0
jmp 0xe1d4
jmp 0xe1d6
movq -0x138(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x138(%rbp)
jmp 0xe18a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x7360
leaq -0xf8(%rbp), %rdi
callq 0xf5f0
jmp 0xe24c
movq -0x158(%rbp), %rdi
callq 0x17420
jmp 0xe224
leaq -0x120(%rbp), %rdi
callq 0x7360
leaq -0xf8(%rbp), %rdi
callq 0xf5f0
movq -0x150(%rbp), %rax
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
movq -0x128(%rbp), %rdi
callq 0x4890
nopl (%rax,%rax)