// File: /workspace/github_c_makefile_star2_O1/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 0xd67c(%rip), %r12      # 0x25334
cmpl $0x0, (%r12)
jle 0x18047
leaq 0xe4b6(%rip), %rdi      # 0x26180
leaq 0x398(%rip), %rdx       # 0x18069
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x6480
leaq 0x20(%rsp), %rdi
callq 0x6350
testl %eax, %eax
jne 0x17cf6
leaq 0x20(%rsp), %rsi
xorl %edi, %edi
xorl %edx, %edx
callq 0x6040
movslq (%r12), %r14
movl $0x4, %esi
movq %r14, %rdi
callq 0x62f0
movq %rax, %r15
movq %rax, 0xe487(%rip)      # 0x26198
movl $0x4, %esi
movq %r14, %rdi
callq 0x62f0
movq %rax, %rbx
movq %rax, 0xe500(%rip)      # 0x26228
movl $0x8, %esi
movq %r14, %rdi
callq 0x62f0
movq %rax, 0xe44c(%rip)      # 0x26188
testq %r15, %r15
je 0x1805f
testq %rbx, %rbx
je 0x1805f
testq %rax, %rax
je 0x1805f
leaq 0xe4a2(%rip), %rdi      # 0x26200
xorl %esi, %esi
callq 0x65e0
leaq 0xe464(%rip), %rdi      # 0x261d0
xorl %esi, %esi
callq 0x63a0
leaq 0xe426(%rip), %rdi      # 0x261a0
xorl %esi, %esi
callq 0x63a0
cmpl $0x0, (%r12)
jle 0x17dbc
xorl %r15d, %r15d
leaq 0x466(%rip), %rbx       # 0x181f8
xorl %r14d, %r14d
movq 0xe3ec(%rip), %rdi      # 0x26188
addq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x6480
incq %r14
movslq (%r12), %rax
addq $0x8, %r15
cmpq %rax, %r14
jl 0x17d95
leaq 0xe31d(%rip), %rax      # 0x260e0
movq (%rax), %rcx
testq %rcx, %rcx
jle 0x17df7
movq %rcx, %rax
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
mulq %rdx
shrq $0x4, %rdx
cmpq $0x3e8, %rcx            # imm = 0x3E8
movl $0x1, %edi
cmovael %edx, %edi
callq 0x6250
leaq 0xe2a2(%rip), %rax      # 0x260a0
movq (%rax), %rdx
leaq 0x7133(%rip), %rsi      # 0x1ef3b
leaq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x6460
testl %eax, %eax
js 0x18064
leaq 0xe2f1(%rip), %r14      # 0x26114
cmpl $0x0, (%r14)
jne 0x17f9e
leaq 0x6a24(%rip), %rbx      # 0x1e858
leaq 0x10(%rsp), %r15
leaq 0x20(%rsp), %r13
movl $0x70, %edi
callq 0x182bb
testl %eax, %eax
jne 0x17f9e
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x6510
testq %rax, %rax
je 0x17f63
movq %rax, %rbp
movl 0xe321(%rip), %eax      # 0x26190
cmpl (%r12), %eax
jge 0x17f30
movq %rbx, %r15
xorl %ebx, %ebx
movq %r13, %rdi
movl $0x40, %esi
movq %rbp, %rdx
callq 0x62c0
testq %rax, %rax
je 0x17f3a
movzbl 0x20(%rsp), %eax
cmpl $0xa, %eax
je 0x17ea5
testl %eax, %eax
jne 0x17eb6
movl 0xe2e5(%rip), %eax      # 0x26190
cmpl (%r12), %eax
jl 0x17e7e
jmp 0x17f3a
movq %r13, %rdi
callq 0x6580
movslq (%r12), %rcx
testq %rcx, %rcx
jle 0x17ef8
movq 0xe35a(%rip), %rdx      # 0x26228
movslq 0xe2bb(%rip), %rsi      # 0x26190
movq 0xe2bc(%rip), %rdi      # 0x26198
xorl %r8d, %r8d
cmpl %eax, (%rdx,%r8,4)
je 0x17ea5
cmpq %rsi, %r8
jge 0x17ef0
cmpl %eax, (%rdi,%r8,4)
je 0x17ea5
incq %r8
cmpq %r8, %rcx
jne 0x17edf
movq 0xe299(%rip), %rcx      # 0x26198
movslq 0xe28a(%rip), %rdx      # 0x26190
leal 0x1(%rdx), %esi
movl %esi, 0xe281(%rip)      # 0x26190
movl %eax, (%rcx,%rdx,4)
incl %ebx
cmpl (%r12), %esi
jl 0x17e7e
movq %rbp, %rdi
callq 0x61c0
movq %r15, %rbx
leaq 0x10(%rsp), %r15
jmp 0x17f4e
movq %rbp, %rdi
callq 0x61c0
jmp 0x17f63
movq %rbp, %rdi
callq 0x61c0
testl %ebx, %ebx
movq %r15, %rbx
leaq 0x10(%rsp), %r15
je 0x17f63
leaq 0xe24b(%rip), %rdi      # 0x261a0
callq 0x60a0
leaq 0xe29f(%rip), %rbp      # 0x26200
jmp 0x17f8c
xorl %edi, %edi
movq %r15, %rsi
callq 0x6110
addq $0x2, 0x10(%rsp)
leaq 0xe256(%rip), %rdi      # 0x261d0
leaq 0xe27f(%rip), %rbp      # 0x26200
movq %rbp, %rsi
movq %r15, %rdx
callq 0x64a0
movq %rbp, %rdi
callq 0x63d0
cmpl $0x0, (%r14)
je 0x17e3e
movq 0x8(%rsp), %rdi
callq 0x6050
cmpl $0x0, (%r12)
jle 0x17fcf
xorl %ebx, %ebx
movq 0xe1d0(%rip), %rax      # 0x26188
movq (%rax,%rbx,8), %rdi
xorl %esi, %esi
callq 0x65b0
incq %rbx
movslq (%r12), %rax
cmpq %rax, %rbx
jl 0x17fb1
movq 0xe1aa(%rip), %rdi      # 0x26180
xorl %esi, %esi
callq 0x65b0
movq 0xe1b4(%rip), %rdi      # 0x26198
callq 0x6050
movq 0xe238(%rip), %rdi      # 0x26228
callq 0x6050
movq 0xe18c(%rip), %rdi      # 0x26188
callq 0x6050
leaq 0xe1f8(%rip), %rdi      # 0x26200
callq 0x61b0
leaq 0xe1bc(%rip), %rdi      # 0x261d0
callq 0x64e0
leaq 0xe180(%rip), %rdi      # 0x261a0
callq 0x64e0
leaq 0x6eef(%rip), %rdi      # 0x1ef1b
xorl %eax, %eax
callq 0xadcf
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6ea3(%rip), %rdi      # 0x1eef1
xorl %eax, %eax
callq 0xadcf
movl $0x1, %edi
callq 0x6590
callq 0x6709
callq 0x6729