// File: /workspace/github_cpp_makefile_star2_O2/FFY00[P]uicc/include/uicc.h
// Function: SIM::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;

        uint16_t size=ntohs(curFile.size);

        if (ntohs(curFile.structure)==0) { // binary (flat)
            Assert(size <= 256, "Not developped: read binary files > 256 bytes (%hu)", size);
            string command(u8"\xa0\xb0\x00\x00",4);
            string good(u8"\x90\x00",2);
            char s=size&0xFF;
            command+=string(&s,1);
            write(command);
            string answ=read(size+good.size());

            if ( answ.size()==(size_t)size+2 &&
                    answ.substr(answ.size()-2) == good )
                content.push_back(answ.substr(0,answ.size()-2));

            return content;
        } else { // records
            for (int i=0; i < size/curFile.record_length; i++ ) {
                string command(u8"\xa0\xb2\x00\x02",4);
                string good(u8"\x90\x00",2);
                command+=string((char *)&curFile.record_length,1);
                write(command);
                string answ=read(size+good.size());

                if ( answ.size()==(size_t)curFile.record_length+good.size() &&
                        answ.substr(answ.size()-2) == good )
                    content.push_back(answ.substr(0,answ.size()-good.size()));
            }

            return content;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rsi, -0x30(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, -0x58(%rbp)
andq $0x0, 0x10(%rdi)
leaq -0x118(%rbp), %rdi
movq %rdx, %rsi
callq 0x2330
leaq -0x118(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0xae28
movl %eax, %ebx
leaq -0x118(%rbp), %rdi
callq 0x2120
testb %bl, %bl
je 0x895b
movq -0x30(%rbp), %rcx
movzwl 0xa(%rcx), %eax
rolw $0x8, %ax
movw %ax, -0x22(%rbp)
cmpb $0x0, 0x15(%rcx)
je 0x8805
movq -0x30(%rbp), %rax
leaq 0x16(%rax), %rcx
movq %rcx, -0x60(%rbp)
addq $0x17, %rax
movq %rax, -0xb8(%rbp)
movzwl -0x22(%rbp), %eax
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %r13
leaq -0x138(%rbp), %r14
leaq -0xd8(%rbp), %rbx
xorl %esi, %esi
movq -0x60(%rbp), %rax
movzbl (%rax), %ecx
movzwl -0x22(%rbp), %eax
xorl %edx, %edx
divw %cx
movzwl %ax, %eax
cmpl %eax, %esi
jae 0x895b
movl %esi, -0x84(%rbp)
movq %rbx, %r15
movq %r14, %rbx
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl $0x200b2a0, -0x98(%rbp) # imm = 0x200B2A0
movq $0x4, -0xa0(%rbp)
xorl %eax, %eax
movb %al, -0x94(%rbp)
leaq -0x70(%rbp), %rcx
movq %rcx, -0x80(%rbp)
movw $0x90, -0x70(%rbp)
movq $0x2, -0x78(%rbp)
movb %al, -0x6e(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq -0x60(%rbp), %rsi
movq -0xb8(%rbp), %rdx
callq 0xf120
movq %r13, %rdi
movq %r14, %rsi
callq 0x2470
movq %r14, %rdi
callq 0x2120
movq %rbx, %r14
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2330
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0xb178
movq %r15, %rbx
movq %r14, %rdi
callq 0x2120
movq -0x78(%rbp), %rdx
addq -0xb0(%rbp), %rdx
leaq -0x50(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xac6e
movq -0x48(%rbp), %rdx
movq -0x60(%rbp), %rax
movzbl (%rax), %eax
addq -0x78(%rbp), %rax
cmpq %rax, %rdx
jne 0x87de
addq $-0x2, %rdx
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
pushq $-0x1
popq %rcx
callq 0x2260
movq %rbx, %rdi
leaq -0x80(%rbp), %rsi
callq 0xb402
movl %eax, %r15d
movq %rbx, %rdi
callq 0x2120
testb %r15b, %r15b
je 0x87de
movq -0x48(%rbp), %rcx
subq -0x78(%rbp), %rcx
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x2260
movq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0xf1f8
movq %rbx, %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
callq 0x2120
leaq -0x80(%rbp), %rdi
callq 0x2120
movq %r13, %rdi
callq 0x2120
movl -0x84(%rbp), %esi
incl %esi
jmp 0x8697
cmpw $0x101, -0x22(%rbp)     # imm = 0x101
jae 0x896f
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
movl $0xb0a0, (%rax)         # imm = 0xB0A0
movq $0x4, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, 0x4(%rax)
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
movw $0x90, (%rax)
movq $0x2, -0x8(%rax)
movb %cl, 0x2(%rax)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movzwl -0x22(%rbp), %edx
movb %dl, (%rax)
movq $0x1, -0x8(%rax)
movb %cl, 0x1(%rax)
leaq -0xa8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2470
leaq -0x50(%rbp), %rdi
callq 0x2120
leaq -0xf8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2330
leaq -0xf8(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0xb178
leaq -0xf8(%rbp), %rdi
callq 0x2120
movzwl -0x22(%rbp), %ebx
movq -0x78(%rbp), %rdx
addq %rbx, %rdx
leaq -0x50(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xac6e
movq -0x48(%rbp), %rdx
addq $0x2, %rbx
cmpq %rbx, %rdx
jne 0x893d
addq $-0x2, %rdx
leaq -0xd8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
pushq $-0x1
popq %rcx
callq 0x2260
leaq -0xd8(%rbp), %rbx
leaq -0x80(%rbp), %rsi
movq %rbx, %rdi
callq 0xb402
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2120
testb %r14b, %r14b
je 0x893d
leaq -0x50(%rbp), %rsi
movq 0x8(%rsi), %rcx
addq $-0x2, %rcx
leaq -0xd8(%rbp), %rdi
xorl %edx, %edx
callq 0x2260
leaq -0xd8(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0xf1f8
leaq -0xd8(%rbp), %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
callq 0x2120
leaq -0x80(%rbp), %rdi
callq 0x2120
leaq -0xa8(%rbp), %rdi
callq 0x2120
movq -0x58(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzwl -0x22(%rbp), %r15d
movq 0x10655(%rip), %r14     # 0x18fd0
movq (%r14), %rbx
callq 0x2040
movl (%rax), %edi
callq 0x20c0
movl %r15d, (%rsp)
leaq 0xaca5(%rip), %rsi      # 0x1363a
leaq 0xad37(%rip), %rdx      # 0x136d3
leaq 0xaae9(%rip), %rcx      # 0x1348c
movq %rbx, %rdi
movl $0x254, %r8d            # imm = 0x254
movq %rax, %r9
xorl %eax, %eax
callq 0x2360
movq 0x105eb(%rip), %rax     # 0x18fa8
movq (%rax), %rdi
callq 0x22c0
movq (%r14), %rdi
callq 0x22c0
pushq $0x1
popq %rdi
callq 0x22e0
jmp 0x89fe
jmp 0x8a28
jmp 0x8a28
jmp 0x8a23
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
jmp 0x8a2f
jmp 0x8a23
jmp 0x8a28
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
jmp 0x8a44
movq %rax, %rbx
jmp 0x8a49
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x2120
jmp 0x8a2b
jmp 0x8a28
jmp 0x8a28
jmp 0x8a23
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
jmp 0x8a2f
jmp 0x8a23
movq %rax, %rbx
jmp 0x8a34
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2120
leaq -0x80(%rbp), %rdi
callq 0x2120
leaq -0xa8(%rbp), %rdi
callq 0x2120
movq -0x58(%rbp), %rdi
callq 0x8a5a
movq %rbx, %rdi
callq 0x2400