// File: /workspace/github_cpp_makefile_star2_O2/FFY00[P]uicc/include/uicc.h
// Function: extractTLV(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
static inline string extractTLV(string in, string TLVname) {
    static const map<string,char> Tags= {
        {"Application Template", '\x61'},
        {"FCP Template", '\x62'},
        {"AID", '\x4f'},
        {"Card", '\x50' },
        {"File Size - Data", '\x80'},
        {"File Size - Total", '\x81'},
        {"File Descriptor", '\x82'},
        {"File Identifier", '\x83'},
        {"DF Name (AID)", '\x85'},
        {"Life Cycle Status", '\x8a'},
        {"Security attribute data", '\x8b'},
        {"SFI", '\x88'},
    };
    auto it=Tags.find(TLVname);

    if (it != Tags.end()) {
        char tag=it->second;
        size_t index=0;

        while (index < in.size()) {
            if (in[index]==tag)
                return in.substr(index+2, (unsigned)in[index+1]);

            index+=in[index+1]+2;
        }
    }

    return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %r15
movb 0x11402(%rip), %al      # 0x19480
testb %al, %al
je 0x810c
leaq 0x113c3(%rip), %rdi     # 0x19450
movq %r13, %rsi
callq 0xee98
leaq 0x113bc(%rip), %rcx     # 0x19458
cmpq %rcx, %rax
je 0x80c8
movb 0x40(%rax), %al
movq 0x8(%r12), %rcx
xorl %edx, %edx
cmpq %rcx, %rdx
jae 0x80c8
movq (%r12), %rsi
cmpb %al, (%rsi,%rdx)
je 0x80e0
movsbq 0x1(%rsi,%rdx), %rsi
addq %rsi, %rdx
addq $0x2, %rdx
jmp 0x80ab
leaq 0xb2c3(%rip), %rsi      # 0x13392
leaq -0x218(%rbp), %rdx
movq %r15, %rdi
callq 0x20f0
jmp 0x80f7
movsbq 0x1(%rsi,%rdx), %rax
addq $0x2, %rdx
movl %eax, %ecx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2260
movq %r15, %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1136d(%rip), %rdi     # 0x19480
callq 0x2430
testl %eax, %eax
je 0x8086
leaq -0x36(%rbp), %rdx
movb $0x61, (%rdx)
leaq 0xbaac(%rip), %rsi      # 0x13bda
leaq -0x218(%rbp), %rbx
movq %rbx, %rdi
callq 0xe8c2
leaq -0x1f0(%rbp), %r14
leaq -0x35(%rbp), %rdx
movb $0x62, (%rdx)
leaq 0xba5a(%rip), %rsi      # 0x13bac
movq %r14, %rdi
callq 0xe8ec
leaq -0x1c8(%rbp), %r14
leaq -0x34(%rbp), %rdx
movb $0x4f, (%rdx)
leaq 0xba80(%rip), %rsi      # 0x13bef
movq %r14, %rdi
callq 0xe916
leaq -0x1a0(%rbp), %r14
leaq -0x33(%rbp), %rdx
movb $0x50, (%rdx)
leaq 0xba67(%rip), %rsi      # 0x13bf3
movq %r14, %rdi
callq 0xe940
leaq -0x178(%rbp), %r14
leaq -0x32(%rbp), %rdx
movb $-0x80, (%rdx)
leaq 0xba20(%rip), %rsi      # 0x13bc9
movq %r14, %rdi
callq 0xe96a
leaq -0x150(%rbp), %r14
leaq -0x31(%rbp), %rdx
movb $-0x7f, (%rdx)
leaq 0xba32(%rip), %rsi      # 0x13bf8
movq %r14, %rdi
callq 0xe994
leaq -0x128(%rbp), %r14
leaq -0x30(%rbp), %rdx
movb $-0x7e, (%rdx)
leaq 0xb9d6(%rip), %rsi      # 0x13bb9
movq %r14, %rdi
callq 0xe9be
leaq -0x100(%rbp), %r14
leaq -0x2f(%rbp), %rdx
movb $-0x7d, (%rdx)
leaq 0xba0a(%rip), %rsi      # 0x13c0a
movq %r14, %rdi
callq 0xe9be
leaq -0xd8(%rbp), %r14
leaq -0x2e(%rbp), %rdx
movb $-0x7b, (%rdx)
leaq 0xb9fd(%rip), %rsi      # 0x13c1a
movq %r14, %rdi
callq 0xe9e8
leaq -0xb0(%rbp), %r14
leaq -0x2d(%rbp), %rdx
movb $-0x76, (%rdx)
leaq 0xb9ee(%rip), %rsi      # 0x13c28
movq %r14, %rdi
callq 0xe994
leaq -0x88(%rbp), %r14
leaq -0x2c(%rbp), %rdx
movb $-0x75, (%rdx)
leaq 0xb9e3(%rip), %rsi      # 0x13c3a
movq %r14, %rdi
callq 0xea12
leaq -0x60(%rbp), %r14
leaq -0x2b(%rbp), %rdx
movb $-0x78, (%rdx)
leaq 0xb9e1(%rip), %rsi      # 0x13c52
movq %r14, %rdi
callq 0xe916
leaq 0x111d0(%rip), %rdi     # 0x19450
leaq -0x218(%rbp), %rsi
pushq $0xc
popq %rdx
leaq -0x2a(%rbp), %rcx
leaq -0x29(%rbp), %r8
callq 0xea3c
movl $0x1b8, %ebx            # imm = 0x1B8
leaq (%rbx,%rbp), %rdi
addq $-0x218, %rdi           # imm = 0xFDE8
callq 0x2120
addq $-0x28, %rbx
cmpq $-0x28, %rbx
jne 0x829c
leaq 0x67c7(%rip), %rdi      # 0xea84
leaq 0x1118c(%rip), %rsi     # 0x19450
leaq 0x10f8d(%rip), %rdx     # 0x19258
callq 0x2200
leaq 0x111a9(%rip), %rdi     # 0x19480
callq 0x2180
jmp 0x8086
movq %rax, %r15
movl $0x1b8, %r12d           # imm = 0x1B8
leaq (%r12,%rbp), %rdi
addq $-0x218, %rdi           # imm = 0xFDE8
callq 0x2120
addq $-0x28, %r12
cmpq $-0x28, %r12
jne 0x82ea
movb $0x1, %al
jmp 0x8321
jmp 0x831c
jmp 0x831c
jmp 0x831c
jmp 0x831c
jmp 0x831c
jmp 0x831c
jmp 0x831c
jmp 0x831c
jmp 0x831c
jmp 0x831c
movq %rax, %r15
xorl %eax, %eax
cmpq %r14, %rbx
sete %cl
testb %al, %al
jne 0x8340
testb %cl, %cl
jne 0x8340
addq $-0x28, %r14
movq %r14, %rdi
callq 0x2120
cmpq %rbx, %r14
jne 0x832f
leaq 0x11139(%rip), %rdi     # 0x19480
callq 0x2170
movq %r15, %rdi
callq 0x2400
movq %rax, %r15
jmp 0x8340