// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/pgrep.c
// Function: main_pgrep
int main_pgrep() {
    long i;

    if (opt_num_workers < 1) {
        log_error("Expected max concurrent workers (-T) > 0\n");
        exit(1);
    }

    pthread_create(&signal_thread, NULL, run_signal_thread, NULL);
    block_all_signals();

    init_work_threads();

    for (i = 0; i < opt_num_workers; i++) {
        pthread_create(&work_threads[i], NULL, run_work_thread, (void*)i);
    }

    if (opt_time_limit_ms > 0) {
        alarm(PHPSPY_MAX(1, opt_time_limit_ms / 1000));
    }

    pgrep_for_pids();

    for (i = 0; i < opt_num_workers; i++) {
        pthread_join(work_threads[i], NULL);
    }
    pthread_join(signal_thread, NULL);

    deinit_work_threads();

    log_error("main_pgrep finished gracefully\n");
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
leaq 0xecb8(%rip), %r15      # 0x25334
cmpl $0x0, (%r15)
jle 0x16990
leaq 0xfaf3(%rip), %rdi      # 0x26180
leaq 0x33f(%rip), %rdx       # 0x169d3
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x6480
leaq 0x20(%rsp), %rdi
callq 0x6350
testl %eax, %eax
jne 0x166b9
leaq 0x20(%rsp), %rsi
xorl %edi, %edi
xorl %edx, %edx
callq 0x6040
movslq (%r15), %r14
pushq $0x4
popq %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x62f0
movq %rax, %r12
movq %rax, 0xfac4(%rip)      # 0x26198
movq %r14, %rdi
movq %rbx, %rsi
callq 0x62f0
movq %rax, %rbx
movq %rax, 0xfb3f(%rip)      # 0x26228
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x62f0
movq %rax, 0xfa8d(%rip)      # 0x26188
testq %r12, %r12
je 0x169a0
testq %rbx, %rbx
je 0x169a0
testq %rax, %rax
je 0x169a0
leaq 0xfae3(%rip), %rdi      # 0x26200
xorl %r12d, %r12d
xorl %esi, %esi
callq 0x65e0
leaq 0xfaa2(%rip), %rdi      # 0x261d0
xorl %esi, %esi
callq 0x63a0
leaq 0xfa64(%rip), %rdi      # 0x261a0
xorl %esi, %esi
callq 0x63a0
leaq 0x3f7(%rip), %rbx       # 0x16b41
xorl %r14d, %r14d
movslq (%r15), %rax
cmpq %rax, %r14
jge 0x16775
movq 0xfa2c(%rip), %rdi      # 0x26188
addq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x6480
incq %r14
addq $0x8, %r12
jmp 0x1674d
leaq 0xf964(%rip), %rax      # 0x260e0
movq (%rax), %rcx
testq %rcx, %rcx
jle 0x1679f
movl $0x3e8, %esi            # imm = 0x3E8
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
cmpq %rsi, %rcx
pushq $0x1
popq %rdi
cmovael %eax, %edi
callq 0x6250
leaq 0xf8fa(%rip), %rax      # 0x260a0
movq (%rax), %rdx
leaq 0x778b(%rip), %rsi      # 0x1df3b
leaq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x6460
testl %eax, %eax
js 0x169b4
leaq 0xfa35(%rip), %rbx      # 0x26200
leaq 0x20(%rsp), %rbp
pushq $0x40
popq %r12
leaq 0xf939(%rip), %rax      # 0x26114
cmpl $0x0, (%rax)
jne 0x168ed
pushq $0x70
popq %rdi
callq 0x16bfb
testl %eax, %eax
jne 0x168ed
movq 0x8(%rsp), %rdi
leaq 0x7058(%rip), %rsi      # 0x1d858
callq 0x6510
testq %rax, %rax
je 0x168b9
movq %rax, %r14
xorl %r13d, %r13d
movl 0xf976(%rip), %eax      # 0x26190
cmpl (%r15), %eax
jge 0x1689e
movq %rbp, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x62c0
testq %rax, %rax
je 0x1689e
movzbl 0x20(%rsp), %eax
testl %eax, %eax
je 0x16814
cmpl $0xa, %eax
je 0x16814
movq %rbp, %rdi
callq 0x6580
movl (%r15), %esi
movq 0xf9d6(%rip), %rdi      # 0x26228
movslq 0xf937(%rip), %rcx      # 0x26190
movq 0xf938(%rip), %rdx      # 0x26198
testl %esi, %esi
movl $0x0, %r8d
cmovlel %r8d, %esi
xorl %r8d, %r8d
cmpq %r8, %rsi
je 0x1688a
cmpl %eax, (%rdi,%r8,4)
je 0x16814
cmpq %rcx, %r8
jge 0x16885
cmpl %eax, (%rdx,%r8,4)
je 0x16814
incq %r8
jmp 0x1686f
leal 0x1(%rcx), %esi
movl %esi, 0xf8fd(%rip)      # 0x26190
movl %eax, (%rdx,%rcx,4)
incl %r13d
jmp 0x16814
movq %r14, %rdi
callq 0x61c0
testl %r13d, %r13d
je 0x168b9
leaq 0xf8ee(%rip), %rdi      # 0x261a0
callq 0x60a0
jmp 0x168e0
xorl %edi, %edi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x6110
addq $0x2, 0x10(%rsp)
leaq 0xf8fb(%rip), %rdi      # 0x261d0
movq %rbx, %rsi
movq %r14, %rdx
callq 0x64a0
movq %rbx, %rdi
callq 0x63d0
jmp 0x167d4
movq 0x8(%rsp), %rdi
callq 0x6050
xorl %ebx, %ebx
movslq (%r15), %rax
cmpq %rax, %rbx
jge 0x16918
movq 0xf880(%rip), %rax      # 0x26188
movq (%rax,%rbx,8), %rdi
xorl %esi, %esi
callq 0x65b0
incq %rbx
jmp 0x168f9
movq 0xf861(%rip), %rdi      # 0x26180
xorl %esi, %esi
callq 0x65b0
movq 0xf86b(%rip), %rdi      # 0x26198
callq 0x6050
movq 0xf8ef(%rip), %rdi      # 0x26228
callq 0x6050
movq 0xf843(%rip), %rdi      # 0x26188
callq 0x6050
leaq 0xf8af(%rip), %rdi      # 0x26200
callq 0x61b0
leaq 0xf873(%rip), %rdi      # 0x261d0
callq 0x64e0
leaq 0xf837(%rip), %rdi      # 0x261a0
callq 0x64e0
leaq 0x75a6(%rip), %rdi      # 0x1df1b
xorl %eax, %eax
callq 0xa442
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x755a(%rip), %rdi      # 0x1def1
xorl %eax, %eax
callq 0xa442
jmp 0x169cb
callq 0x6060
movl $0xc, (%rax)
leaq 0x7592(%rip), %rdi      # 0x1df44
jmp 0x169c6
callq 0x6060
movl $0xc, (%rax)
leaq 0x7ace(%rip), %rdi      # 0x1e494
callq 0x6530
pushq $0x1
popq %rdi
callq 0x6590