Function at 0x653450
Capabilities:
Write file on windows

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x58
xor ebp, ebp
movsxd r13, dword [rdx + 4]
mov byte [rsp + 0x35], 0
mov rsi, rcx
mov rdi, rdx
mov ebx, r8d
test r8b, 0x40
jne 0x653680
test bl, 0x80
jne 0x6535c9
test bl, 0x20
je 0x653580
mov eax, ebx
and eax, 0x10
cmp eax, 1
sbb r13d, r13d
and r13d, 0xfffffff8
add r13d, 9
lea rax, [rsp + 0x35]
mov rcx, qword [rdi + 8]
and ebx, 0x40f
mov r8d, r13d
mov qword [rsp + 0x28], 0
mov r9d, ebx
mov qword [rsp + 0x20], rax
mov edx, dword [rdi]
call sym.do_buf.constprop.0
test eax, eax
js 0x653560
cmp byte [rsp + 0x35], 0
lea r12d, [rbp + rax]
je 0x6536f0
add r12d, 2
test rsi, rsi
je 0x653566
mov r9, rsi
mov r8d, 1
mov edx, 1
lea rcx, [0x008feb4d]
call sym.fwrite
cmp rax, 1
jne 0x653560
mov rcx, qword [rdi + 8]
mov qword [rsp + 0x28], rsi
mov r9d, ebx
mov r8d, r13d
mov qword [rsp + 0x20], 0
mov edx, dword [rdi]
call sym.do_buf.constprop.0
test eax, eax
js 0x653560
cmp byte [rsp + 0x35], 0
je 0x653566
mov r9, rsi
mov r8d, 1
mov edx, 1
lea rcx, [0x008feb4d]
call sym.fwrite
cmp rax, 1
je 0x653566
nop dword [rax + rax]
mov r12d, 0xffffffff
mov eax, r12d
add rsp, 0x58
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
lea eax, [r13 - 1]
cmp eax, 0x1d
ja 0x6535c0
lea rax, [0x008feb70]
movsx r13d, byte [rax + r13]
mov eax, r13d
cmp r13b, 0xff
je 0x6535c0
test bl, 0x10
je 0x6534a3
or eax, 8
test r13d, r13d
mov r13d, 1
movsx eax, al
cmovne r13d, eax
jmp 0x6534a3
test bh, 1
je 0x653490
test rsi, rsi
je 0x653810
mov r9, rsi
mov r8d, 1
mov edx, 1
lea rcx, [0x008feb4b]
call sym.fwrite
cmp rax, 1
jne 0x653560
and bh, 2
jne 0x653700
movsxd rbx, dword [rdi]
mov r13, qword [rdi + 8]
lea r14, [0x008feb50]
lea rdi, [rsp + 0x40]
mov r12, rbx
add rbx, r13
cmp rbx, r13
jne 0x653635
jmp 0x65381c
add r13, 1
cmp rbx, r13
je 0x65381c
movzx eax, byte [r13]
mov r9, rsi
mov r8d, 2
mov rcx, rdi
mov edx, eax
and eax, 0xf
shr dl, 4
movzx eax, byte [r14 + rax]
and edx, 0xf
movzx edx, byte [r14 + rdx]
mov byte [rsp + 0x41], al
mov byte [rsp + 0x40], dl
mov edx, 1
call sym.fwrite
cmp rax, 2
jne 0x653560
jmp 0x653628
mov ecx, r13d
call sym.ASN1_tag2str
mov rcx, rax
mov r14, rax
call sym.strlen
mov rbp, rax
test rsi, rsi
je 0x6536e0
movsxd r8, eax
mov r9, rsi
mov edx, 1
mov rcx, r14
call sym.fwrite
mov r8, rax
mov eax, ebp
cmp r8, rax
jne 0x653560
mov r9, rsi
mov r8d, 1
mov edx, 1
lea rcx, [0x008feb49]
call sym.fwrite
cmp rax, 1
jne 0x653560
add ebp, 1
jmp 0x65347e
test rsi, rsi
jne 0x65350e
jmp 0x653566
mov eax, dword [rdi + 4]
lea r14, [rsp + 0x40]
xor edx, edx
mov qword [rsp + 0x48], rdi
mov rcx, r14
mov dword [rsp + 0x40], eax
call sym.i2d_ASN1_TYPE
mov r12d, eax
test eax, eax
jle 0x653560
movsxd rbx, eax
mov r8d, 0x11d
lea rdx, str.crypto_asn1_a_strex.c
mov rcx, rbx
call sym.CRYPTO_malloc
mov r13, rax
test rax, rax
je 0x653826
lea rdx, [rsp + 0x38]
mov rcx, r14
mov qword [rsp + 0x38], rax
call sym.i2d_ASN1_TYPE
test rsi, rsi
je 0x6537d9
add rbx, r13
mov r15, r13
lea rdi, [rsp + 0x36]
lea r14, [0x008feb50]
nop dword [rax + rax]
movzx eax, byte [r15]
mov r9, rsi
mov r8d, 2
mov rcx, rdi
mov edx, eax
and eax, 0xf
shr dl, 4
movzx eax, byte [r14 + rax]
and edx, 0xf
movzx edx, byte [r14 + rdx]
mov byte [rsp + 0x37], al
mov byte [rsp + 0x36], dl
mov edx, 1
call sym.fwrite
cmp rax, 2
je 0x6537d0
mov r8d, 0x124
lea rdx, str.crypto_asn1_a_strex.c
mov rcx, r13
call sym.CRYPTO_free
jmp 0x653560
add r15, 1
cmp rbx, r15
jne 0x653778
add r12d, r12d
mov r8d, 0x124
lea rdx, str.crypto_asn1_a_strex.c
mov rcx, r13
call sym.CRYPTO_free
test r12d, r12d
js 0x653560
add r12d, 1
add r12d, ebp
jmp 0x653566
and bh, 2
jne 0x653700
mov r12d, dword [rdi]
add r12d, r12d
jns 0x6537fa
jmp 0x653560
mov r8d, 0x41
mov edx, 0x7d
mov ecx, 0xd
mov dword [rsp + 0x20], 0x11e
lea r9, str.crypto_asn1_a_strex.c
call sym.ERR_put_error
jmp 0x653560