// File: /workspace/github_c_makefile_star2_O3/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 0xddc8(%rip), %r12      # 0x25334
cmpl $0x0, (%r12)
jle 0x178fa
leaq 0xec02(%rip), %rdi      # 0x26180
leaq 0x397(%rip), %rdx       # 0x1791c
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x6480
leaq 0x20(%rsp), %rdi
callq 0x6350
testl %eax, %eax
jne 0x175aa
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, 0xebd3(%rip)      # 0x26198
movl $0x4, %esi
movq %r14, %rdi
callq 0x62f0
movq %rax, %rbx
movq %rax, 0xec4c(%rip)      # 0x26228
movl $0x8, %esi
movq %r14, %rdi
callq 0x62f0
movq %rax, 0xeb98(%rip)      # 0x26188
testq %r15, %r15
je 0x17912
testq %rbx, %rbx
je 0x17912
testq %rax, %rax
je 0x17912
leaq 0xebee(%rip), %rdi      # 0x26200
xorl %esi, %esi
callq 0x65e0
leaq 0xebb0(%rip), %rdi      # 0x261d0
xorl %esi, %esi
callq 0x63a0
leaq 0xeb72(%rip), %rdi      # 0x261a0
xorl %esi, %esi
callq 0x63a0
cmpl $0x0, (%r12)
jle 0x17670
xorl %r15d, %r15d
leaq 0x46e(%rip), %rbx       # 0x17ab4
xorl %r14d, %r14d
movq 0xeb38(%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 0x17649
leaq 0xea69(%rip), %rax      # 0x260e0
movq (%rax), %rcx
testq %rcx, %rcx
jle 0x176ab
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 0xe9ee(%rip), %rax      # 0x260a0
movq (%rax), %rdx
leaq 0x787f(%rip), %rsi      # 0x1ef3b
leaq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x6460
testl %eax, %eax
js 0x17917
leaq 0xea3d(%rip), %r14      # 0x26114
cmpl $0x0, (%r14)
je 0x1778a
movq 0x8(%rsp), %rdi
callq 0x6050
cmpl $0x0, (%r12)
jle 0x17712
xorl %ebx, %ebx
movq 0xea8d(%rip), %rax      # 0x26188
movq (%rax,%rbx,8), %rdi
xorl %esi, %esi
callq 0x65b0
incq %rbx
movslq (%r12), %rax
cmpq %rax, %rbx
jl 0x176f4
movq 0xea67(%rip), %rdi      # 0x26180
xorl %esi, %esi
callq 0x65b0
movq 0xea71(%rip), %rdi      # 0x26198
callq 0x6050
movq 0xeaf5(%rip), %rdi      # 0x26228
callq 0x6050
movq 0xea49(%rip), %rdi      # 0x26188
callq 0x6050
leaq 0xeab5(%rip), %rdi      # 0x26200
callq 0x61b0
leaq 0xea79(%rip), %rdi      # 0x261d0
callq 0x64e0
leaq 0xea3d(%rip), %rdi      # 0x261a0
callq 0x64e0
leaq 0x77ac(%rip), %rdi      # 0x1ef1b
xorl %eax, %eax
callq 0xab99
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x70c7(%rip), %rbx      # 0x1e858
leaq 0x10(%rsp), %r15
leaq 0x20(%rsp), %r13
movl $0x70, %edi
callq 0x17b77
testl %eax, %eax
jne 0x176e1
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x6510
testq %rax, %rax
je 0x178a8
movq %rax, %rbp
movl 0xe9c4(%rip), %eax      # 0x26190
cmpl (%r12), %eax
jge 0x17875
movq %rbx, %r15
xorl %ebx, %ebx
movq %r13, %rdi
movl $0x40, %esi
movq %rbp, %rdx
callq 0x62c0
testq %rax, %rax
je 0x1787f
movzbl 0x20(%rsp), %eax
cmpl $0xa, %eax
je 0x17802
testl %eax, %eax
jne 0x17810
movl 0xe988(%rip), %eax      # 0x26190
cmpl (%r12), %eax
jl 0x177db
jmp 0x1787f
movq %r13, %rdi
callq 0x6580
movslq (%r12), %rsi
movslq 0xe96d(%rip), %rcx      # 0x26190
testq %rsi, %rsi
jle 0x1786c
movq 0xe9f9(%rip), %rdi      # 0x26228
movq 0xe962(%rip), %rdx      # 0x26198
xorl %r8d, %r8d
cmpl %eax, (%rdi,%r8,4)
je 0x17802
cmpq %rcx, %r8
jge 0x1784a
cmpl %eax, (%rdx,%r8,4)
je 0x17802
incq %r8
cmpq %r8, %rsi
jne 0x17839
leal 0x1(%rcx), %esi
movl %esi, 0xe935(%rip)      # 0x26190
movl %eax, (%rdx,%rcx,4)
incl %ebx
cmpl (%r12), %esi
jl 0x177db
jmp 0x178e8
movq 0xe925(%rip), %rdx      # 0x26198
jmp 0x17852
movq %rbp, %rdi
callq 0x61c0
jmp 0x178a8
movq %rbp, %rdi
callq 0x61c0
testl %ebx, %ebx
movq %r15, %rbx
leaq 0x10(%rsp), %r15
je 0x178a8
leaq 0xe906(%rip), %rdi      # 0x261a0
callq 0x60a0
leaq 0xe95a(%rip), %rbp      # 0x26200
jmp 0x178d1
xorl %edi, %edi
movq %r15, %rsi
callq 0x6110
addq $0x2, 0x10(%rsp)
leaq 0xe911(%rip), %rdi      # 0x261d0
leaq 0xe93a(%rip), %rbp      # 0x26200
movq %rbp, %rsi
movq %r15, %rdx
callq 0x64a0
movq %rbp, %rdi
callq 0x63d0
cmpl $0x0, (%r14)
je 0x1779b
jmp 0x176e1
movq %rbp, %rdi
callq 0x61c0
movq %r15, %rbx
leaq 0x10(%rsp), %r15
jmp 0x17893
leaq 0x75f0(%rip), %rdi      # 0x1eef1
xorl %eax, %eax
callq 0xab99
movl $0x1, %edi
callq 0x6590
callq 0x6709
callq 0x6729