Function at 0x509d30
Capabilities:
Get thread local storage value
Set thread local storage value

Disassembly:
push r12
sub rsp, 0x20
mov eax, dword [rcx]
lea edx, [rax - 2]
and edx, 0xfffffffd
mov r12, rcx
je 0x506120
cmp eax, 1
jne 0x506111
mov rcx, qword [rcx + 8]
call 0x5060f0
mov rcx, r12
add rsp, 0x20
pop r12
jmp fcn.004c9260
mov rcx, qword [rcx + 8]
call 0x5060f0
mov rcx, qword [r12 + 0x10]
call 0x5060f0
mov rcx, r12
add rsp, 0x20
pop r12
jmp fcn.004c9260
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x58
mov rbp, qword [sym.imp.libssp_0.dll___stack_chk_guard]
mov rsi, qword [rcx + 0x10]
mov rax, qword [rbp]
mov qword [rsp + 0x48], rax
xor eax, eax
mov rbx, rcx
test rsi, rsi
je 0x50a098
nop word [rax + rax]
cmp dword [rsi + 0x14], 1
jne 0x50a0d0
mov r9d, dword [rsi + 0x28]
cmp r9d, 2
ja 0x50a0b8
mov rcx, rsi
mov rdx, rbx
call fcn.00506b60
mov rsi, qword [rsi]
test rsi, rsi
jne 0x509d68
mov qword [rsp + 0x30], 0
mov rdi, qword [rbx + 0x10]
mov qword [rsp + 0x38], 0
mov qword [rsp + 0x40], 0
test rdi, rdi
je 0x509e31
lea r13, [rsp + 0x28]
jmp 0x509dea
mov edx, 0x18
mov ecx, 1
call fcn.004997f0
mov rdi, qword [rdi]
mov dword [rax], 4
mov qword [rax + 8], r12
mov qword [rax + 0x10], r15
mov qword [rsp + r14*8 + 0x30], rax
test rdi, rdi
je 0x509e2c
mov rcx, r13
mov qword [rsp + 0x28], rdi
call fcn.005061f0
mov r12, rax
test rax, rax
je 0x50a0a0
mov rax, qword [rdi]
cmp rax, qword [rsp + 0x28]
jne 0x50a0a0
mov r14d, dword [rdi + 0x28]
mov r15, qword [rsp + r14*8 + 0x30]
test r15, r15
jne 0x509dc0
mov rdi, rax
mov qword [rsp + r14*8 + 0x30], r12
test rdi, rdi
jne 0x509dea
mov rdi, qword [rsp + 0x30]
lea r12, [rsp + 0x30]
lea r13, [rsp + 0x48]
test rdi, rdi
je 0x509e65
test rsi, rsi
je 0x509e7c
mov edx, 0x18
mov ecx, 1
call fcn.004997f0
mov dword [rax], 4
mov qword [rax + 8], rdi
mov qword [rax + 0x10], rsi
mov rsi, rax
add r12, 8
cmp r13, r12
je 0x509ea0
mov rdi, qword [r12]
test rdi, rdi
je 0x509e65
test rsi, rsi
jne 0x509e45
mov edx, 0x18
mov ecx, 1
call fcn.004997f0
mov dword [rax], 3
mov rsi, rax
jmp 0x509e45
test rsi, rsi
setne dil
mov rcx, qword [rbx]
mov qword [rsp + 0x28], rcx
test rcx, rcx
jne 0x509edc
jmp 0x509ef0
mov dword [rbx + 0xb0], 1
mov rax, qword [rsp + 0x28]
mov rcx, qword [rax]
mov qword [rsp + 0x28], rcx
test rcx, rcx
je 0x509ef0
cmp dword [rcx + 0x14], 2
ja 0x509ec0
mov rdx, rbx
call fcn.00506b60
jmp 0x509eca
mov r9d, dword [rbx + 0xa0]
test r9d, r9d
jne 0x509f05
test dil, dil
je 0x50a040
mov dword [rbx + 0xb0], 1
mov rax, qword [rbx]
mov qword [rsp + 0x28], rax
test rax, rax
je 0x509f38
lea rcx, [rsp + 0x28]
call fcn.00506160
mov qword [rbx + 0x20], rax
mov rax, qword [rsp + 0x28]
test rax, rax
jne 0x50a0e8
test rsi, rsi
je 0x509fba
mov rdi, qword [rbx + 0x20]
test rdi, rdi
je 0x509fac
mov edx, dword [rbx + 0xa0]
test edx, edx
je 0x509fe8
mov edx, dword [rsi]
mov r12, qword [sym.imp.msvcrt.dll__assert]
mov r15, rsi
lea r14, str.grep.c
lea r13, str.x__node__GREP_NODE_OR
cmp edx, 4
je 0x509f87
nop dword [rax + rax]
mov r8d, 0x3e1
mov rdx, r14
mov rcx, r13
call r12
mov rax, qword [r15 + 0x10]
test rax, rax
je 0x509fac
mov edx, dword [rax]
cmp edx, 3
je 0x50a068
mov r15, rax
cmp edx, 4
jne 0x509f78
mov rax, qword [r15 + 0x10]
test rax, rax
jne 0x509f90
mov qword [rbx + 0x20], rsi
mov dword [rbx + 0xa0], 1
mov eax, dword [rbx + 0xa4]
test eax, eax
jne 0x50a01d
mov rax, qword [rsp + 0x48]
xor rax, qword [rbp]
jne 0x50a0f8
add rsp, 0x58
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov edx, 0x18
mov ecx, 1
call fcn.004997f0
mov dword [rax], 4
mov qword [rax + 8], rdi
mov qword [rax + 0x10], rsi
mov qword [rbx + 0x20], rax
mov eax, dword [rbx + 0xa4]
mov dword [rbx + 0xa0], 1
test eax, eax
je 0x509fc4
mov eax, dword [rbx + 0xa0]
mov r12, qword [rbx + 0x20]
test eax, eax
jne 0x50a078
mov rcx, r12
xor edx, edx
call fcn.00506790
xor ecx, ecx
call fcn.004ac610
jmp 0x509fc4
mov r8d, dword [rbx + 0xb0]
test r8d, r8d
jne 0x509f0f
mov ecx, dword [rbx + 0xa4]
test ecx, ecx
jne 0x509f0f
jmp 0x509fc4
mov qword [r15 + 0x10], rdi
mov qword [rbx + 0x20], rsi
jmp 0x509fb0
mov ecx, 2
call qword [fcn.005707a0]
lea rdx, str._all_match__n
mov rcx, rax
call sub.libintl_8.dll_libintl_fprintf
jmp 0x50a02b
xor edi, edi
jmp 0x509ea7
lea r8, str.malformed_header_expr
mov edx, 0x3c8
lea rcx, str.grep.c
call fcn.00494ad0
lea r8, str.unknown_header_field__d
mov edx, 0x3bb
lea rcx, str.grep.c
call fcn.00494ad0
lea r8, str.a_non_header_pattern_in_grep_header_list.
mov edx, 0x3b8
lea rcx, str.grep.c
call fcn.00494ad0
mov rdx, qword [rax + 0x18]
lea rcx, str.incomplete_pattern_expression:__s
call fcn.00494770
call sub.libssp_0.dll___stack_chk_fail
nop
nop
push r12
push rsi
push rbx
sub rsp, 0x20
mov rbx, qword [rcx]
mov rsi, rcx
test rbx, rbx
jne 0x50a12f
jmp 0x50a190
mov rcx, qword [r12 + 0x18]
call fcn.004c9260
mov rcx, r12
call fcn.004c9260
test rbx, rbx
je 0x50a190
mov r12, rbx
mov rbx, qword [rbx]
cmp dword [r12 + 0x14], 2
ja 0x50a122
cmp qword [r12 + 0x68], 0
jne 0x50a118
cmp qword [r12 + 0x88], 0
je 0x50a1c0
mov rcx, qword [r12 + 0x98]
call qword [sym.imp.libpcre2_8_0.dll_pcre2_compile_context_free_8]
mov rcx, qword [r12 + 0x88]
call qword [sym.imp.libpcre2_8_0.dll_pcre2_code_free_8]
mov rcx, qword [r12 + 0x90]
call qword [sym.imp.libpcre2_8_0.dll_pcre2_match_data_free_8]
mov rcx, qword [r12 + 0xa0]
call fcn.004c9260
jmp 0x50a118
mov eax, dword [rsi + 0xb0]
test eax, eax
jne 0x50a1a8
add rsp, 0x20
pop rbx
pop rsi
pop r12
ret
mov rcx, qword [rsi + 0x20]
add rsp, 0x20
pop rbx
pop rsi
pop r12
jmp 0x5060f0
lea rcx, [r12 + 0x30]
call fcn.004c3c30
jmp 0x50a118