Function at 0x140008170
Capabilities:
Write file on windows

Disassembly:
push r15
push r14
push r13
push r12
push rsi
push rdi
push rbp
push rbx
sub rsp, 0x498
mov rsi, rcx
mov eax, dword [rcx + 0x78]
movabs r13, 0x7ffffffffffffff8
test al, 0x10
je 0x140008834
mov rax, qword [rsi + 0x48]
mov rbx, qword [rsi + 0x70]
cmp rbx, rax
jae 0x1400081af
mov qword [rsi + 0x70], rax
mov rbx, rax
mov rdi, qword [rsi + 0x40]
sub rbx, rdi
js 0x140008813
cmp rbx, r13
jae 0x140008816
cmp rbx, 0x17
jae 0x1400081e0
lea r14, [rsp + 0x90]
mov byte [r14 + 0x17], bl
test rbx, rbx
jne 0x140008224
xor ebx, ebx
jmp 0x140008232
mov rax, rbx
and rax, r13
add rax, 8
mov r15, rbx
or r15, 7
cmp r15, 0x17
cmove r15, rax
inc r15
mov rcx, r15
call fcn.1400b4d4c
mov r14, rax
mov qword [rsp + 0x90], rax
bts r15, 0x3f
mov qword [rsp + 0xa0], r15
mov qword [rsp + 0x98], rbx
mov rcx, r14
mov rdx, rdi
mov r8, rbx
call fcn.1400eabe0
lea rdi, [rsi + 0x10]
mov byte [r14 + rbx], 0
movzx r12d, byte [rsp + 0xa7]
test r12b, r12b
jns 0x140008251
mov r12, qword [rsp + 0x98]
jns 0x140008260
mov rcx, qword [rsp + 0x90]
call fcn.1400b4d44
mov rax, qword [rdi]
movsxd rax, dword [rax + 4]
mov rbx, qword [rdi + rax + 0x30]
lea r15, [0x140155fd8]
cmp rbx, r15
jne 0x140008819
mov rax, qword [0x140156cd0]
cmp rax, 0xffffffffffffffff
jne 0x1400088ac
movsxd rax, dword [0x140156cd8]
lea rdx, [rax - 1]
mov rcx, qword [rbx + 0x10]
mov r8, qword [rbx + 0x18]
sub r8, rcx
sar r8, 3
cmp r8, rdx
jbe 0x140008810
mov rcx, qword [rcx + rax*8 - 8]
test rcx, rcx
je 0x140008810
mov rax, qword [rcx]
mov rax, qword [rax + 0x38]
mov dl, 0xa
call qword [0x14013a9a8]
mov ebp, eax
cmp rbx, r15
jne 0x140008885
mov rcx, rdi
mov edx, ebp
call fcn.140035620
mov rcx, rdi
call fcn.14001e270
movabs rax, 0xaaaaaaaaaaaaaaaa
mov qword [rsp + 0x40], rax
movaps xmm0, xmmword [0x1401213c0]
movaps xmmword [rsp + 0x30], xmm0
mov eax, dword [rsi + 0x78]
test al, 0x10
je 0x14000885e
mov rax, qword [rsi + 0x48]
mov rdi, qword [rsi + 0x70]
cmp rdi, rax
jae 0x140008324
mov qword [rsi + 0x70], rax
mov rdi, rax
mov rbx, qword [rsi + 0x40]
sub rdi, rbx
js 0x140008822
cmp rdi, r13
jae 0x140008825
cmp rdi, 0x17
jae 0x140008352
lea r14, [rsp + 0x30]
mov byte [r14 + 0x17], dil
test rdi, rdi
jne 0x14000838d
xor edi, edi
jmp 0x14000839b
mov rax, rdi
and rax, r13
add rax, 8
mov r15, rdi
or r15, 7
cmp r15, 0x17
cmove r15, rax
inc r15
mov rcx, r15
call fcn.1400b4d4c
mov r14, rax
mov qword [rsp + 0x30], rax
bts r15, 0x3f
mov qword [rsp + 0x40], r15
mov qword [rsp + 0x38], rdi
mov rcx, r14
mov rdx, rbx
mov r8, rdi
call fcn.1400eabe0
mov byte [r14 + rdi], 0
mov rbp, qword [rsi + 0x118]
movzx ecx, byte [rsp + 0x47]
mov rax, rcx
test cl, cl
jns 0x1400083b8
mov rax, qword [rsp + 0x38]
mov rdi, rax
sub rdi, rbp
jb 0x140008828
test cl, cl
js 0x1400083cf
lea rbx, [rsp + 0x30]
jmp 0x1400083d4
mov rbx, qword [rsp + 0x30]
cmp rdi, r13
jae 0x14000882b
cmp rdi, 0x17
jae 0x1400083f3
lea r14, [rsp + 0x60]
mov byte [r14 + 0x17], dil
cmp rax, rbp
jne 0x14000842b
jmp 0x14000843c
and r13, rdi
add r13, 8
mov r15, rdi
or r15, 7
cmp r15, 0x17
cmove r15, r13
inc r15
mov rcx, r15
call fcn.1400b4d4c
mov r14, rax
mov qword [rsp + 0x60], rax
bts r15, 0x3f
mov qword [rsp + 0x70], r15
mov qword [rsp + 0x68], rdi
add rbx, rbp
mov rcx, r14
mov rdx, rbx
mov r8, rdi
call fcn.1400eabe0
mov byte [r14 + rdi], 0
mov eax, dword [rsi + 0x128]
mov rcx, qword [rsi + 0x120]
mov dword [rsp + 0x5c], eax
mov qword [rsp + 0x50], rcx
mov qword [rsp + 0x78], 0x56
mov al, byte [0x1401576a6]
test al, al
jne 0x14000873b
cmp byte [rsp + 0x77], 0
jns 0x14000847f
mov rcx, qword [rsp + 0x60]
call fcn.1400b4d44
mov eax, dword [rsi + 8]
cmp eax, 3
jne 0x140008542
cmp byte [0x1401577ec], 0
jne 0x140008547
mov byte [0x1401577ec], 1
mov eax, dword [0x1401577f8]
mov ecx, dword [0x140153d98]
mov rdx, qword gs:[0x58]
mov rcx, qword [rdx + rcx*8]
cmp eax, dword [rcx + 4]
jg 0x140008781
lea rdi, [rsp + 0x90]
mov rcx, rsi
mov rdx, rdi
call fcn.140108190
mov rdx, qword [0x1401577f0]
test rdx, rdx
je 0x140008521
mov rcx, qword [0x140157a70]
test rcx, rcx
je 0x140008521
mov al, byte [rsp + 0xa7]
movzx eax, al
test al, al
cmovs rdi, qword [rsp + 0x90]
mov r9, qword [rsp + 0x98]
cmovns r9, rax
lea r8, [rsp + 0x60]
mov qword [r8], rdi
mov qword [r8 + 8], r9
call fcn.140023300
cmp byte [rsp + 0xa7], 0
jns 0x140008538
mov rcx, qword [rsp + 0x90]
call fcn.1400b4d44
mov byte [0x1401577ec], 0
mov eax, dword [rsi + 8]
cmp eax, 2
jl 0x140008585
lea rdi, [rsp + 0x30]
movzx ebx, byte [rdi + 0x17]
test bl, bl
cmovs rbx, qword [rdi + 8]
cmovs rdi, qword [rdi]
test rbx, rbx
je 0x140008585
xor r14d, r14d
mov r8d, ebx
sub r8d, r14d
lea rdx, [rdi + r14]
mov ecx, 2
call fcn.1400cfb08
test eax, eax
js 0x140008585
mov eax, eax
add r14, rax
cmp r14, rbx
jb 0x140008563
call fcn.140107e70
test al, al
je 0x1400085c9
lea r9, [rsp + 0x90]
mov dword [r9], 0xaaaaaaaa
lea rdx, [rsp + 0x30]
movzx r8d, byte [rdx + 0x17]
test r8b, r8b
cmovs r8d, dword [rdx + 8]
cmovs rdx, qword [rdx]
mov rcx, qword [0x1401577c0]
mov qword [rsp + 0x20], 0
call qword [sym.imp.KERNEL32.dll_WriteFile]
cmp dword [rsi + 8], 3
jne 0x140008715
lea rcx, [rsp + 0x90]
mov r8d, 0x400
mov dl, 0xaa
call fcn.1400eb280
cmp byte [rsp + 0x47], 0
js 0x1400085f6
lea rax, [rsp + 0x30]
jmp 0x1400085fb
mov rax, qword [rsp + 0x30]
xor ecx, ecx
mov dl, byte [rax + rcx]
mov byte [rsp + rcx + 0x90], dl
test dl, dl
je 0x14000861f
inc rcx
cmp rcx, 0x400
jne 0x1400085fd
mov byte [rsp + 0x48f], 0
lea rcx, [rsp + 0x90]
call fcn.140073210
call fcn.140108120
mov rax, qword [0x1401577d8]
cmp rax, qword [0x1401577e0]
je 0x14000882e
call fcn.140108120
mov rax, qword [0x1401577e0]
test rax, rax
mov rcx, qword [0x1401577d0]
cmove rax, rcx
lea rdx, [rax - 1]
cmp rcx, rdx
jb 0x140008831
mov rcx, qword [0x1401577c8]
mov rdi, qword [rcx + rax*8 - 8]
mov qword [rsp + 0x50], rdi
test rdi, rdi
je 0x140008715
mov eax, 1
lock xadd dword [rdi], eax
test eax, eax
jle 0x140008934
cmp eax, 0x7fffffff
je 0x140008937
cmp byte [rsp + 0x47], 0
js 0x1400086b0
lea rbx, [rsp + 0x30]
jmp 0x1400086b5
mov rbx, qword [rsp + 0x30]
lea rcx, [rbx + r12]
lea r14, [rsp + 0x60]
mov qword [r14], rcx
call fcn.1400d3140
mov qword [r14 + 8], rax
mov rax, qword [rsi + 0x118]
sub r12, rax
add rbx, rax
lea r9, [rsp + 0x80]
mov qword [r9], rbx
mov qword [r9 + 8], r12
mov r8d, dword [rsi + 0x128]
mov rdx, qword [rsi + 0x120]
mov qword [rsp + 0x20], r14
lea rcx, [rsp + 0x50]
call fcn.140108260
lock dec dword [rdi]
jne 0x140008715
mov rax, qword [rdi + 0x10]
mov rcx, rdi
call qword [0x14013a9a8]
cmp byte [rsp + 0x47], 0
jns 0x140008726
mov rcx, qword [rsp + 0x30]
call fcn.1400b4d44
nop
add rsp, 0x498
pop rbx
pop rbp
pop rdi
pop rsi
pop r12
pop r13
pop r14
pop r15
ret
movzx ecx, al
lea rax, [rsp + 0x50]
lea r9, [rsp + 0x90]
mov qword [r9], rax
lea rax, [rsp + 0x5c]
mov qword [r9 + 8], rax
lea rax, [rsp + 0x60]
mov qword [r9 + 0x10], rax
lea rax, str.LogMessage
lea r8, [rsp + 0x80]
mov qword [r8], rax
lea rdx, [rsp + 0x78]
call fcn.140108460
jmp 0x14000846e
lea rcx, [0x1401577f8]
call fcn.1400b4df4
cmp dword [0x1401577f8], 0xffffffff
jne 0x1400084c4
cmp qword [0x140157a70], 0
je 0x14000893a
mov ecx, 0x430
call fcn.1400b4d4c
mov rdi, rax
lea rax, str.LOG_FATAL
mov qword [rdi], rax
mov dword [rdi + 8], 0x400
lea rcx, [rdi + 0x30]
mov qword [rdi + 0x10], 0
mov qword [rdi + 0x18], rax
mov qword [rdi + 0x20], rcx
mov dword [rdi + 0x28], 0
mov word [rdi + 0x2c], 1
lea rcx, [rdi + 0x2e]
mov r8d, 0x402
xor edx, edx
call fcn.1400eb280
mov qword [0x1401577f0], rdi
lea rcx, [0x1401577f8]
call fcn.1400b4d88
jmp 0x1400084c4
int3
int3
int3
lock inc dword [rbx + 8]
jmp 0x14000827c
int3
int3
int3
int3
int3
int3
test al, 8
jne 0x14000884a
lea r14, [rsp + 0x90]
mov byte [r14 + 0x17], 0
jmp 0x1400081dc
mov rdi, qword [rsi + 0x28]
mov rbx, qword [rsi + 0x38]
sub rbx, rdi
jns 0x1400081bc
int3
test al, 8
jne 0x140008871
lea r14, [rsp + 0x30]
mov byte [r14 + 0x17], 0
jmp 0x14000834e
mov rbx, qword [rsi + 0x28]
mov rdi, qword [rsi + 0x38]
sub rdi, rbx
jns 0x140008331
int3
mov eax, 0xffffffff
lock xadd dword [rbx + 8], eax
test eax, eax
jne 0x1400082d8
mov rax, qword [rbx]
mov rax, qword [rax + 8]
mov rcx, rbx
call qword [0x14013a9a8]
jmp 0x1400082d8
lea rcx, [0x1401556c8]
call qword [sym.imp.KERNEL32.dll_AcquireSRWLockExclusive]
mov rax, qword [0x140156cd0]
cmp rax, 1
je 0x140008953
mov rax, qword [0x140156cd0]
test rax, rax
jne 0x140008941
mov qword [0x140156cd0], 1
lea r14, [0x1401556c8]
mov rbp, qword [sym.imp.KERNEL32.dll_ReleaseSRWLockExclusive]
mov rcx, r14
call rbp
mov eax, 1
lock xadd dword [0x14015612c], eax
inc eax
mov dword [0x140156cd8], eax
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_AcquireSRWLockExclusive]
mov qword [0x140156cd0], 0xffffffffffffffff
mov rcx, r14
call rbp
lea rcx, [0x1401556d0]
call qword [sym.imp.KERNEL32.dll_WakeAllConditionVariable]
jmp 0x14000828d
int3
int3
xor edi, edi
jmp 0x1400087f8
lea rcx, [0x1401556c8]
call qword [sym.imp.KERNEL32.dll_ReleaseSRWLockExclusive]
jmp 0x14000828d
lea rbp, [0x1401556c8]
mov r14, qword [sym.imp.KERNEL32.dll_SleepConditionVariableSRW]
lea rcx, [0x1401556d0]
mov rdx, rbp
mov r8d, 0xffffffff
xor r9d, r9d
call r14
mov rax, qword [0x140156cd0]
cmp rax, 1
jne 0x1400088ca
jmp 0x140008961