// File: /workspace/github_cpp_makefile_star2_O2/FFY00[P]uicc/include/uicc.h
// Function: SIM::openFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool openFile(string filename) {
        string order(u8"\xa0\xa4\x00\x00\x02",5);
        // go to root directory (MF)
        string goToRoot (u8"\x3f\x00",2);
        string answerChangeDir(u8"\x9f\x17",2);

        if (!send_check(order+goToRoot, answerChangeDir))
            return false;

        string answer(u8"\x9f\x0f",2);
        string filenameBin=UICCFile(filename);

        for (size_t i=0; i<filenameBin.size()-2; i+=2)
            if (!send_check(order+filenameBin.substr(i,2), answerChangeDir))
                return false;

        if (! send_check(order+filenameBin.substr(filenameBin.size()-2), answer))
            return false;

        return readFileInfo();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r14
movq %rdi, -0x30(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movl $0xa4a0, (%rax)         # imm = 0xA4A0
movw $0x2, 0x4(%rax)
movq $0x5, -0x8(%rax)
leaq -0x180(%rbp), %rax
movq %rax, -0x10(%rax)
movw $0x3f, (%rax)
pushq $0x2
popq %rcx
movq %rcx, -0x8(%rax)
xorl %edx, %edx
movb %dl, 0x2(%rax)
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movw $0x179f, (%rax)         # imm = 0x179F
movq %rcx, -0x8(%rax)
movb %dl, 0x2(%rax)
leaq -0x170(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0xb708
leaq -0x150(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2330
leaq -0x170(%rbp), %rsi
leaq -0x150(%rbp), %rdx
movq -0x30(%rbp), %rdi
callq 0xb426
movl %eax, %ebx
leaq -0x150(%rbp), %rdi
callq 0x2120
leaq -0x170(%rbp), %rdi
callq 0x2120
testb %bl, %bl
je 0xafd2
leaq -0x120(%rbp), %rax
movq %rax, -0x10(%rax)
movw $0xf9f, (%rax)          # imm = 0xF9F
movq $0x2, -0x8(%rax)
movb $0x0, 0x2(%rax)
leaq -0x110(%rbp), %rdi
movq %r14, %rsi
callq 0x2330
leaq -0x70(%rbp), %rdi
leaq -0x110(%rbp), %rdx
movq -0x30(%rbp), %rsi
xorl %ecx, %ecx
callq 0xb740
leaq -0x110(%rbp), %rdi
callq 0x2120
xorl %r14d, %r14d
leaq -0x50(%rbp), %r15
leaq -0x1d0(%rbp), %rbx
leaq -0x1b0(%rbp), %r13
movq -0x68(%rbp), %rdx
addq $-0x2, %rdx
cmpq %rdx, %r14
jae 0xafd9
movq %r15, %rdi
leaq -0x70(%rbp), %rsi
movq %r14, %rdx
pushq $0x2
popq %rcx
callq 0x2260
movq %rbx, %rdi
leaq -0x90(%rbp), %rsi
movq %r15, %rdx
callq 0xc3f2
movq %r13, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2330
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0xb426
movl %eax, %r12d
movq %r13, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2120
movq %r15, %rdi
callq 0x2120
addq $0x2, %r14
testb %r12b, %r12b
jne 0xaf5a
jmp 0xb05e
xorl %ebx, %ebx
jmp 0xb075
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $-0x1
popq %rcx
callq 0x2260
leaq -0xf0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0xc3f2
leaq -0xd0(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x2330
leaq -0xf0(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
movq -0x30(%rbp), %rdi
callq 0xb426
movl %eax, %ebx
leaq -0xd0(%rbp), %rdi
callq 0x2120
leaq -0xf0(%rbp), %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
callq 0x2120
testb %bl, %bl
je 0xb05e
movq -0x30(%rbp), %rdi
callq 0xc420
movl %eax, %ebx
jmp 0xb060
xorl %ebx, %ebx
leaq -0x70(%rbp), %rdi
callq 0x2120
leaq -0x130(%rbp), %rdi
callq 0x2120
leaq -0xb0(%rbp), %rdi
callq 0x2120
leaq -0x190(%rbp), %rdi
callq 0x2120
leaq -0x90(%rbp), %rdi
callq 0x2120
movl %ebx, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb103
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x2120
jmp 0xb0c3
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
jmp 0xb128
jmp 0xb108
jmp 0xb103
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
jmp 0xb13a
movq %rax, %rbx
jmp 0xb13f
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x2120
jmp 0xb0f5
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
jmp 0xb146
movq %rax, %rbx
jmp 0xb14b
movq %rax, %rbx
jmp 0xb136
movq %rax, %rbx
jmp 0xb12d
movq %rax, %rbx
jmp 0xb121
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x2120
leaq -0x1d0(%rbp), %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
callq 0x2120
leaq -0x70(%rbp), %rdi
callq 0x2120
leaq -0x130(%rbp), %rdi
callq 0x2120
leaq -0xb0(%rbp), %rdi
callq 0x2120
leaq -0x190(%rbp), %rdi
callq 0x2120
leaq -0x90(%rbp), %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2400
nop