// File: FFY00[P]uicc/include/uicc.h
// Function: USIM::readFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<string> readFile(string filename) {
        vector<string> content;

        if (!openFile(filename))
            return content;

        if (fileDesc.size() <= 2 ) { // this is a plain file
            long size=fileSize;
            string fullanswr="";
            Assert( size < 32767, "Not developped");
            long alreadyRead=0;

            while (size > 0 ) {
                string command(u8"\x00\xb0",2);
                string good(u8"\x90\x00",2);
                unsigned char s;

                if (size > 255)
                    s=255;
                else
                    s=size;

                unsigned char P1=alreadyRead>>8;
                unsigned char P2=alreadyRead&0xFF;
                command+=string((char *)&P1,1);
                command+=string((char *)&P2,1);
                command+=string((char *)&s,1);
                write(command);
                string answ=read(s+2);

                if ( answ.size()==(size_t)s+good.size() &&
                        answ.substr(answ.size()-good.size()) == good )
                    fullanswr+=answ.substr(0,answ.size()-good.size());

                size-=s;
                alreadyRead+=s;
            }

            content.push_back(fullanswr);
            return content;
        } else {
            // This is a records set file
            // records
            // string len must be 5 bytes
            // file type is byte 0
            // byte 1 is useless: always 0x21
            // bytes 3 and 4: record length
            // (byte 3 should be 00 according to ETSI 102 221)
            // byte 5: number of records
            for (int i=0; i < (unsigned char)fileDesc[4] ; i++ ) {
                string command(u8"\x00\xb2\x01\x04",4);
                string good(u8"\x90\x00",2);
                command+=fileDesc.substr(3,1);
                write(command);
                string answ=read( (unsigned char)fileDesc[3]+2);

                if ( answ.size()== ((unsigned char)fileDesc[3]+good.size()) &&
                        answ.substr(answ.size()-good.size()) == good )
                    content.push_back(answ.substr(0,answ.size()-good.size()));
            }

            return content;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3f0, %rsp            # imm = 0x3F0
movq %rdx, -0x2e0(%rbp)
movq %rdi, -0x2f8(%rbp)
movq %rdi, %rax
movq %rax, -0x2f0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movb $0x0, -0x19(%rbp)
callq 0xec50
movq -0x2e0(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x3120
jmp 0xf905
movq -0x2e8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1ab90
movb %al, -0x2f9(%rbp)
jmp 0xf91d
movb -0x2f9(%rbp), %al
xorb $-0x1, %al
movb %al, -0x2fa(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x31a0
movb -0x2fa(%rbp), %al
testb $0x1, %al
jne 0xf940
jmp 0xf97b
movb $0x1, -0x19(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0x1042a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1044c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x31a0
jmp 0x1044c
movq -0x2e8(%rbp), %rdi
addq $0x28, %rdi
callq 0x31f0
cmpq $0x2, %rax
ja 0x1000f
movq -0x2e8(%rbp), %rax
movslq 0x48(%rax), %rax
movq %rax, -0x58(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0x34d0
movq -0x308(%rbp), %rdx
leaq 0x162a2(%rip), %rsi     # 0x25c64
leaq -0x78(%rbp), %rdi
callq 0x33e0
jmp 0xf9cd
leaq -0x79(%rbp), %rdi
callq 0x3300
cmpq $0x7fff, -0x58(%rbp)    # imm = 0x7FFF
jl 0xfa84
movq 0x1f5e5(%rip), %rax     # 0x2efd0
movq (%rax), %rax
movq %rax, -0x310(%rbp)
callq 0x3040
movl (%rax), %edi
callq 0x30d0
movq -0x310(%rbp), %rdi
movq %rax, %r9
leaq 0x1657c(%rip), %rsi     # 0x25f8e
leaq 0x16094(%rip), %rdx     # 0x25aad
leaq 0x15e46(%rip), %rcx     # 0x25866
xorl %eax, %eax
movl $0x310, %r8d            # imm = 0x310
callq 0x3410
movq 0x1f56c(%rip), %rax     # 0x2efa0
movq (%rax), %rdi
callq 0x3350
jmp 0xfa3e
movq 0x1f58b(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3350
jmp 0xfa4f
movl $0x1, %edi
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x3300
jmp 0x1044c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x10001
jmp 0xfa86
jmp 0xfa88
movq $0x0, -0x88(%rbp)
cmpq $0x0, -0x58(%rbp)
jle 0xffd6
leaq -0xa9(%rbp), %rdi
movq %rdi, -0x318(%rbp)
callq 0x34d0
movq -0x318(%rbp), %rcx
leaq 0x137c9(%rip), %rsi     # 0x23288
leaq -0xa8(%rbp), %rdi
movl $0x2, %edx
callq 0x3330
jmp 0xfad2
leaq -0xa9(%rbp), %rdi
callq 0x3300
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x34d0
movq -0x320(%rbp), %rcx
leaq 0x13766(%rip), %rsi     # 0x23265
leaq -0xd0(%rbp), %rdi
movl $0x2, %edx
callq 0x3330
jmp 0xfb12
leaq -0xd1(%rbp), %rdi
callq 0x3300
cmpq $0xff, -0x58(%rbp)
jle 0xfb6b
movb $-0x1, -0xd2(%rbp)
jmp 0xfb75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa9(%rbp), %rdi
callq 0x3300
jmp 0x10001
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xd1(%rbp), %rdi
callq 0x3300
jmp 0xffc8
movq -0x58(%rbp), %rax
movb %al, -0xd2(%rbp)
movb -0x87(%rbp), %al
movb %al, -0xd3(%rbp)
movb -0x88(%rbp), %al
movb %al, -0xd4(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x34d0
movq -0x328(%rbp), %rcx
leaq -0xf8(%rbp), %rdi
leaq -0xd3(%rbp), %rsi
movl $0x1, %edx
callq 0x3330
jmp 0xfbc1
leaq -0xa8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x33b0
jmp 0xfbd6
leaq -0xf8(%rbp), %rdi
callq 0x31a0
leaq -0xf9(%rbp), %rdi
callq 0x3300
leaq -0x121(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x34d0
movq -0x330(%rbp), %rcx
leaq -0x120(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
movl $0x1, %edx
callq 0x3330
jmp 0xfc22
leaq -0xa8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x33b0
jmp 0xfc37
leaq -0x120(%rbp), %rdi
callq 0x31a0
leaq -0x121(%rbp), %rdi
callq 0x3300
leaq -0x149(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x34d0
movq -0x338(%rbp), %rcx
leaq -0x148(%rbp), %rdi
leaq -0xd2(%rbp), %rsi
movl $0x1, %edx
callq 0x3330
jmp 0xfc83
leaq -0xa8(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x33b0
jmp 0xfc98
leaq -0x148(%rbp), %rdi
callq 0x31a0
leaq -0x149(%rbp), %rdi
callq 0x3300
leaq -0x170(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x3120
jmp 0xfcc5
movq -0x2e8(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x14a30
jmp 0xfcda
leaq -0x170(%rbp), %rdi
callq 0x31a0
movq -0x2e8(%rbp), %rsi
movzbl -0xd2(%rbp), %eax
addl $0x2, %eax
movl %eax, %edx
leaq -0x190(%rbp), %rdi
callq 0x13fd0
jmp 0xfd07
leaq -0x190(%rbp), %rdi
callq 0x31f0
movq %rax, -0x348(%rbp)
movzbl -0xd2(%rbp), %eax
movq %rax, -0x350(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x31f0
movq -0x350(%rbp), %rdx
movq -0x348(%rbp), %rcx
addq %rax, %rdx
movb $0x0, -0x1b1(%rbp)
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x339(%rbp)
jne 0xfdc5
leaq -0x190(%rbp), %rdi
movq %rdi, -0x358(%rbp)
callq 0x31f0
movq %rax, -0x360(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x31f0
movq -0x360(%rbp), %rdx
movq -0x358(%rbp), %rsi
subq %rax, %rdx
leaq -0x1b0(%rbp), %rdi
movq $-0x1, %rcx
callq 0x32c0
jmp 0xfda5
movb $0x1, -0x1b1(%rbp)
leaq -0x1b0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x14ed0
movb %al, -0x339(%rbp)
movb -0x339(%rbp), %al
movb %al, -0x361(%rbp)
testb $0x1, -0x1b1(%rbp)
jne 0xfddc
jmp 0xfde8
leaq -0x1b0(%rbp), %rdi
callq 0x31a0
movb -0x361(%rbp), %al
testb $0x1, %al
jne 0xfdf7
jmp 0xff5e
leaq -0x190(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x31f0
movq %rax, -0x378(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x31f0
movq -0x378(%rbp), %rcx
movq -0x370(%rbp), %rsi
subq %rax, %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x1d8(%rbp), %rdi
callq 0x32c0
jmp 0xfe40
leaq -0x78(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x33b0
jmp 0xfe52
leaq -0x1d8(%rbp), %rdi
callq 0x31a0
jmp 0xff5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xfe89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x31a0
leaq -0xf9(%rbp), %rdi
callq 0x3300
jmp 0xffbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xfec0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x31a0
leaq -0x121(%rbp), %rdi
callq 0x3300
jmp 0xffbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xfef7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x31a0
leaq -0x149(%rbp), %rdi
callq 0x3300
jmp 0xffbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xffbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x31a0
jmp 0xffbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xffb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x31a0
jmp 0xffb0
movzbl -0xd2(%rbp), %eax
movl %eax, %ecx
movq -0x58(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x58(%rbp)
movzbl -0xd2(%rbp), %eax
addq -0x88(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x31a0
leaq -0xd0(%rbp), %rdi
callq 0x31a0
leaq -0xa8(%rbp), %rdi
callq 0x31a0
jmp 0xfa93
leaq -0x190(%rbp), %rdi
callq 0x31a0
leaq -0xd0(%rbp), %rdi
callq 0x31a0
leaq -0xa8(%rbp), %rdi
callq 0x31a0
jmp 0x10001
movq -0x2f8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x11720
jmp 0xffe8
movb $0x1, -0x19(%rbp)
movl $0x1, -0x50(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x31a0
jmp 0x1042a
leaq -0x78(%rbp), %rdi
callq 0x31a0
jmp 0x1044c
movl $0x0, -0x1dc(%rbp)
movq -0x2e8(%rbp), %rdi
movl -0x1dc(%rbp), %eax
movl %eax, -0x384(%rbp)
addq $0x28, %rdi
movl $0x4, %esi
callq 0x3520
movq %rax, -0x380(%rbp)
jmp 0x10043
movl -0x384(%rbp), %eax
movq -0x380(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x1041f
leaq -0x201(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x34d0
movq -0x390(%rbp), %rcx
leaq 0x1320f(%rip), %rsi     # 0x2328b
leaq -0x200(%rbp), %rdi
movl $0x4, %edx
callq 0x3330
jmp 0x1008f
leaq -0x201(%rbp), %rdi
callq 0x3300
leaq -0x229(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x34d0
movq -0x398(%rbp), %rcx
leaq 0x131a9(%rip), %rsi     # 0x23265
leaq -0x228(%rbp), %rdi
movl $0x2, %edx
callq 0x3330
jmp 0x100cf
leaq -0x229(%rbp), %rdi
callq 0x3300
movq -0x2e8(%rbp), %rsi
addq $0x28, %rsi
leaq -0x250(%rbp), %rdi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x32c0
jmp 0x100fe
leaq -0x200(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x33b0
jmp 0x10113
leaq -0x250(%rbp), %rdi
callq 0x31a0
leaq -0x270(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x3120
jmp 0x10134
movq -0x2e8(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x14a30
jmp 0x10149
leaq -0x270(%rbp), %rdi
callq 0x31a0
movq -0x2e8(%rbp), %rdi
addq $0x28, %rdi
movl $0x3, %esi
callq 0x3520
movq %rax, -0x3a0(%rbp)
jmp 0x10173
movq -0x2e8(%rbp), %rsi
movq -0x3a0(%rbp), %rax
movzbl (%rax), %eax
addl $0x2, %eax
movl %eax, %edx
leaq -0x290(%rbp), %rdi
callq 0x13fd0
jmp 0x10197
leaq -0x290(%rbp), %rdi
callq 0x31f0
movq -0x2e8(%rbp), %rdi
movq %rax, -0x3b0(%rbp)
addq $0x28, %rdi
movb $0x0, -0x2b1(%rbp)
movl $0x3, %esi
callq 0x3520
movq %rax, -0x3a8(%rbp)
jmp 0x101cf
movq -0x3a8(%rbp), %rax
movzbl (%rax), %eax
movq %rax, -0x3c0(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x31f0
movq -0x3c0(%rbp), %rdx
movq -0x3b0(%rbp), %rcx
addq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x3b1(%rbp)
jne 0x10276
leaq -0x290(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0x31f0
movq %rax, -0x3d0(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x31f0
movq -0x3d0(%rbp), %rdx
movq -0x3c8(%rbp), %rsi
subq %rax, %rdx
leaq -0x2b0(%rbp), %rdi
movq $-0x1, %rcx
callq 0x32c0
jmp 0x10256
movb $0x1, -0x2b1(%rbp)
leaq -0x2b0(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x14ed0
movb %al, -0x3b1(%rbp)
movb -0x3b1(%rbp), %al
movb %al, -0x3d1(%rbp)
testb $0x1, -0x2b1(%rbp)
jne 0x1028d
jmp 0x10299
leaq -0x2b0(%rbp), %rdi
callq 0x31a0
movb -0x3d1(%rbp), %al
testb $0x1, %al
jne 0x102a8
jmp 0x103c1
leaq -0x290(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x31f0
movq %rax, -0x3e8(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x31f0
movq -0x3e8(%rbp), %rcx
movq -0x3e0(%rbp), %rsi
subq %rax, %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x2d8(%rbp), %rdi
callq 0x32c0
jmp 0x102f1
movq -0x2f8(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x11160
jmp 0x10306
leaq -0x2d8(%rbp), %rdi
callq 0x31a0
jmp 0x103c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x201(%rbp), %rdi
callq 0x3300
jmp 0x1044c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x229(%rbp), %rdi
callq 0x3300
jmp 0x10411
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x10405
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x31a0
jmp 0x10405
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x31a0
jmp 0x10405
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x103f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x31a0
jmp 0x103f9
leaq -0x290(%rbp), %rdi
callq 0x31a0
leaq -0x228(%rbp), %rdi
callq 0x31a0
leaq -0x200(%rbp), %rdi
callq 0x31a0
movl -0x1dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1dc(%rbp)
jmp 0x10019
leaq -0x290(%rbp), %rdi
callq 0x31a0
leaq -0x228(%rbp), %rdi
callq 0x31a0
leaq -0x200(%rbp), %rdi
callq 0x31a0
jmp 0x1044c
movb $0x1, -0x19(%rbp)
movl $0x1, -0x50(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x1043c
movq -0x2f8(%rbp), %rdi
callq 0xf6b0
movq -0x2f0(%rbp), %rax
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbp
retq
movq -0x2f8(%rbp), %rdi
callq 0xf6b0
movq -0x48(%rbp), %rdi
callq 0x34b0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)