Function at 0x100406180
Capabilities:
Encode data using xor

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x58
mov rbx, rcx
mov rdi, rdx
lea rdx, str.rwb_samethread
xor ecx, ecx
call sub.msys_gpg_error_0.dll_gpgrt_fopenmem
mov rsi, rax
test rax, rax
je 0x10040655b
xor r14d, r14d
lea r13, str._s_02X
lea r12, [0x10045d9c2]
lea rbp, [0x10045d9c0]
test rdi, rdi
jne 0x1004061db
jmp 0x100406448
mov r14, rax
test r14, r14
mov r8, rbp
movzx r9d, byte [rbx + r14]
mov rdx, r13
cmove r8, r12
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
lea rax, [r14 + 1]
cmp rdi, rax
jne 0x1004061d8
mov rdx, rsi
mov ecx, 0xa
call sub.msys_gpg_error_0.dll_gpgrt_fputc
movzx r8d, byte [rbx]
cmp r8b, 0x3b
je 0x100406478
cmp r8b, 0x3f
je 0x100406430
lea rdx, str.error:_invalid_TS_character_0x_02x_n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
test r14, r14
je 0x1004063f0
lea rdi, [r14 - 1]
movzx r15d, byte [rbx + 1]
cmp rdi, 1
jbe 0x100406562
lea rdx, [rbx + r14]
lea rax, [rbx + 2]
mov ebp, r15d
mov rcx, rdx
sub rcx, rax
and ecx, 1
je 0x100406278
movzx ebp, byte [rax]
lea rax, [rbx + 3]
xor ebp, r15d
cmp rdx, rax
je 0x100406288
nop dword [rax + rax]
xor bpl, byte [rax]
add rax, 2
xor bpl, byte [rax - 1]
cmp rdx, rax
jne 0x100406278
mov eax, r15d
mov ecx, r15d
mov r13d, r15d
mov r12d, r15d
and eax, 0x40
and ecx, 0xf
and r13d, 0x10
and r12d, 0x20
mov byte [rsp + 0x3d], al
mov eax, r15d
lea rdx, str._d_historical_characters_indicated_n
and eax, 0xf
mov byte [rsp + 0x3f], cl
mov rcx, rsi
mov r8d, eax
mov dword [rsp + 0x34], eax
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
xor eax, eax
test r13b, r13b
movsx edx, r15b
setne al
cmp r12b, 1
mov ecx, dword [rsp + 0x34]
sbb eax, 0xffffffff
cmp byte [rsp + 0x3d], 1
sbb eax, 0xffffffff
shr edx, 0x1f
add eax, edx
add eax, ecx
cdqe
cmp r14, rax
jb 0x100406460
test rdi, rdi
je 0x1004063f0
test r13b, r13b
jne 0x100406490
add rbx, 2
test r12b, r12b
je 0x10040635c
movzx r9d, byte [rbx]
lea rdx, str.__high_bit_not_cleared_
lea rax, [0x10045d9c2]
mov rcx, rsi
test r9b, r9b
mov r8d, r9d
cmovs rax, rdx
shr r8b, 5
and r9d, 0x1f
lea rdx, str.TB1:_II_d_PI1_d_s_n
and r8d, 3
mov qword [rsp + 0x20], rax
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
sub rdi, 1
je 0x1004063f0
add rbx, 1
cmp byte [rsp + 0x3d], 0
je 0x10040638a
movzx r8d, byte [rbx]
cmp r8b, 0xff
je 0x100406967
lea rdx, str.TC1:__extra_guard_time__N_d_n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
sub rdi, 1
je 0x1004063f0
add rbx, 1
test r15b, r15b
js 0x100406601
nop dword [rax + rax]
mov eax, dword [rsp + 0x34]
add eax, 1
cdqe
cmp rdi, rax
jb 0x10040657e
cmp byte [rsp + 0x3f], 0
jne 0x10040658d
movzx r8d, byte [rbx]
movzx r9d, bpl
cmp r8b, bpl
je 0x100406a22
lea rdx, str.TCK:__02X__bad__computed__02X__n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
sub rdi, 1
je 0x1004063f0
mov r8d, edi
lea rdx, str.error:__u_bytes_garbage_at_end_of_ATR_n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
nop dword [rax]
mov rdx, rsi
xor ecx, ecx
call sub.msys_gpg_error_0.dll_gpgrt_fputc
lea rdx, [rsp + 0x48]
xor r8d, r8d
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fclose_snatch
mov edx, eax
mov rax, qword [rsp + 0x48]
test edx, edx
jne 0x100406540
add rsp, 0x58
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov rdx, rsi
lea rcx, str.Inverse_convention_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x100406232
lea rdx, str.error:_empty_ATR_n
mov rcx, rax
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
jmp 0x1004063f0
mov rdx, rsi
lea rcx, str.error:_ATR_shorter_than_indicated_by_format_character_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x1004062f7
mov rdx, rsi
lea rcx, str.Direct_convention_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x100406232
mov rdx, rsi
lea rcx, str.TA1:_F
call sub.msys_gpg_error_0.dll_gpgrt_fputs
movzx eax, byte [rbx + 2]
lea rdx, [0x10045dda0]
shr al, 4
and eax, 0xf
mov r8d, dword [rdx + rax*4]
test r8d, r8d
je 0x10040698f
cmp r8d, 0xffffffff
je 0x10040656a
lea rdx, [0x10045dada]
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
mov rdx, rsi
lea rcx, [0x10045dadd]
call sub.msys_gpg_error_0.dll_gpgrt_fputs
movzx eax, byte [rbx + 2]
lea rdx, [0x10045dd60]
and eax, 0xf
mov r8d, dword [rdx + rax*4]
test r8d, r8d
je 0x10040697b
cmp r8d, 0xffffffff
je 0x1004069df
test r8d, r8d
js 0x1004069b7
lea rdx, [0x10045db00]
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
mov rdi, r14
sub rdi, 2
je 0x1004063f0
add rbx, 3
jmp 0x10040630d
call sub.msys_2.0.dll___errno
mov ecx, dword [rax]
call sub.msys_2.0.dll_strerror
lea rcx, str.oops:_es_fclose_snatch_failed:__s_n
mov rdx, rax
call sub.msys_gpg_error_0.dll_gpgrt_log_error
xor eax, eax
jmp 0x100406419
mov ebp, r15d
jmp 0x100406288
mov rdx, rsi
lea rcx, [0x10045dad6]
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x1004064d6
mov rdx, rsi
lea rcx, str.error:_ATR_shorter_than_required_for_historical_bytes_and_checksum_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
mov rdx, rsi
lea rcx, str.HCH:
lea r13, str.__02X
call sub.msys_gpg_error_0.dll_gpgrt_fputs
mov r12d, dword [rsp + 0x34]
add r12d, ebx
jmp 0x1004065b5
test rdi, rdi
je 0x1004065d1
movzx r8d, byte [rbx]
mov rdx, r13
mov rcx, rsi
add rbx, 1
sub rdi, 1
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
cmp r12d, ebx
jne 0x1004065b0
mov rdx, rsi
mov ecx, 0xa
call sub.msys_gpg_error_0.dll_gpgrt_fputc
test rdi, rdi
jne 0x1004063b5
mov rdx, rsi
lea rcx, str.error:_checksum_missing_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
mov r8d, 0xffffffff
jmp 0x1004063de
movzx r12d, byte [rbx]
lea rdx, str.TD1:_protocol_T_d_supported_n
mov rcx, rsi
mov r14d, r12d
mov r15d, r12d
mov r8d, r12d
mov r13d, r12d
and r15d, 0x20
and r8d, 0xf
and r14d, 0x10
and r13d, 0x40
mov byte [rsp + 0x3d], r15b
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
xor eax, eax
test r14b, r14b
movsx edx, r12b
setne al
cmp r15b, 1
mov ecx, dword [rsp + 0x34]
sbb eax, 0xffffffff
cmp r13b, 1
sbb eax, 0xffffffff
shr edx, 0x1f
add eax, edx
add eax, ecx
cdqe
cmp rdi, rax
jb 0x1004069cb
mov r15, rdi
sub r15, 1
je 0x1004063f0
test r14b, r14b
je 0x100406a39
movzx eax, byte [rbx + 1]
lea rcx, [0x10045d9db]
lea r9, [0x10045d9de]
lea r8, [0x10045d9c2]
mov edx, eax
and edx, 0xf
test al, 0x10
cmovne r9, rcx
mov dword [rsp + 0x20], edx
test al, al
mov rcx, rsi
lea rax, [0x10045d9e1]
lea rdx, str.TA2:__PTS___stoggle___splicit__T_02X_n
cmovs r8, rax
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
movzx r8d, byte [rbx + 1]
test r8b, 0x60
jne 0x1004069a3
sub rdi, 2
mov r15, rdi
je 0x1004063f0
add rbx, 2
cmp byte [rsp + 0x3d], 0
je 0x100406707
movzx r8d, byte [rbx]
lea rdx, str.TB2:_PI2_d_n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
sub r15, 1
je 0x1004063f0
add rbx, 1
test r13b, r13b
je 0x10040672d
movzx r8d, byte [rbx]
lea rdx, str.TC2:_PWI_d_n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
sub r15, 1
je 0x1004063f0
add rbx, 1
mov rdi, r15
test r12b, r12b
jns 0x100406398
movzx r8d, byte [rbx]
lea rdx, str.TD2:_protocol_T_d_supported_n
mov rcx, rsi
mov r12d, r8d
mov r10d, r8d
mov r11d, r8d
mov r13d, r8d
shr r12b, 4
shr r10b, 5
and r10d, 1
and r12d, 1
test r8b, 0x70
setne r9b
shr r11b, 7
and r8d, 0xf
mov dword [rsp + 0x38], r10d
movzx r14d, r11b
mov byte [rsp + 0x3e], r9b
shr r13b, 6
mov byte [rsp + 0x3d], r11b
and r13d, 1
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
mov r10d, dword [rsp + 0x38]
mov edi, dword [rsp + 0x34]
movzx r11d, byte [rsp + 0x3d]
movzx r9d, byte [rsp + 0x3e]
lea eax, [r12 + r10]
add eax, r13d
add eax, r14d
add eax, edi
cdqe
cmp r15, rax
jb 0x1004069f3
mov rdi, r15
sub rdi, 1
je 0x1004063f0
add rbx, 1
test r9b, r9b
jne 0x1004067de
test r11b, r11b
je 0x100406398
mov r15d, 3
mov byte [rsp + 0x3e], bpl
mov ebp, r15d
mov r15d, r14d
mov r14d, r10d
nop word [rax + rax]
test r12d, r12d
jne 0x100406820
test r14d, r14d
jne 0x100406849
test r13d, r13d
jne 0x100406883
test r15d, r15d
jne 0x1004068b0
movzx ebp, byte [rsp + 0x3e]
jmp 0x100406398
movzx r9d, byte [rbx]
mov r8d, ebp
lea rdx, str.TA_d:_IFSC_d_n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
sub rdi, 1
je 0x1004063f0
add rbx, 1
test r14d, r14d
je 0x100406802
movzx eax, byte [rbx]
mov r8d, ebp
lea rdx, str.TB_d:_BWI_d_CWI_d_n
mov rcx, rsi
mov r9d, eax
and eax, 0xf
mov dword [rsp + 0x20], eax
shr r9b, 4
and r9d, 0xf
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
sub rdi, 1
je 0x1004063f0
add rbx, 1
test r13d, r13d
je 0x100406807
movzx r9d, byte [rbx]
mov r8d, ebp
lea rdx, str.TC_d:_0x_02X_n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
sub rdi, 1
je 0x1004063f0
add rbx, 1
test r15d, r15d
je 0x100406810
movzx r9d, byte [rbx]
mov rcx, rsi
mov r8d, ebp
lea rdx, str.TD_d:_protocol_T_d_supported_n
mov r12d, r9d
mov r14d, r9d
mov r10d, r9d
mov r11d, r9d
shr r12b, 4
shr r14b, 5
and r12d, 1
and r14d, 1
test r9b, 0x70
setne byte [rsp + 0x3d]
shr r10b, 6
and r9d, 0xf
shr r11b, 7
mov r13d, r10d
movzx r15d, r11b
mov byte [rsp + 0x38], r11b
and r13d, 1
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
lea eax, [r12 + r14]
mov ecx, dword [rsp + 0x34]
movzx r11d, byte [rsp + 0x38]
add eax, r13d
add eax, r15d
add eax, ecx
cdqe
cmp rdi, rax
jb 0x100406950
sub rdi, 1
je 0x1004063f0
add rbx, 1
add ebp, 1
test r11b, r11b
jne 0x1004067f8
cmp byte [rsp + 0x3d], 0
jne 0x1004067f8
jmp 0x100406810
mov rdx, rsi
lea rcx, str.error:_ATR_shorter_than_indicated_by_format_character_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
movzx r11d, byte [rsp + 0x38]
jmp 0x100406924
mov rdx, rsi
lea rcx, str.TC1:_guard_time_shortened_to_1_etu_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x100406380
mov rdx, rsi
lea rcx, str._impossible_value__n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x100406522
mov rdx, rsi
lea rcx, str.internal_clock
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x1004064d6
lea rdx, str.note:_reserved_bits_are_set__TA20x_02X__n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
jmp 0x1004066ce
lea rdx, str.1__d_n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
jmp 0x100406522
mov rdx, rsi
lea rcx, str.error:_ATR_shorter_than_indicated_by_format_character_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x100406665
mov rdx, rsi
lea rcx, str.RFU_n
call sub.msys_gpg_error_0.dll_gpgrt_fputs
jmp 0x100406522
mov rdx, rsi
lea rcx, str.error:_ATR_shorter_than_indicated_by_format_character_n
mov byte [rsp + 0x3e], r11b
mov byte [rsp + 0x3d], r9b
call sub.msys_gpg_error_0.dll_gpgrt_fputs
mov r10d, dword [rsp + 0x38]
movzx r11d, byte [rsp + 0x3e]
movzx r9d, byte [rsp + 0x3d]
jmp 0x1004067bf
mov r8d, r9d
lea rdx, str.TCK:__02X__good__n
mov rcx, rsi
call sub.msys_gpg_error_0.dll_gpgrt_fprintf
jmp 0x1004063d5
add rbx, 1
jmp 0x1004066df