// File: FFY00[P]uicc/include/uicc.h
// Function: SIM::readFileInfo()
bool readFileInfo() {
        string order(u8"\xa0\xc0\x00\x00\x0f",5);
        string good(u8"\x90\x00",2);
        write(order);
        string values=read();
        memcpy(&curFile,values.c_str(),
               min(values.size(),sizeof(curFile)) );

        if (debug) {
            static map<char, string> FileType= {{'\x01',"Master dir"}, {'\x02',"Sub dir"},{'\x04',"Element File"},};
            string fName=UICCFile(string((char *)&curFile.id,2),true);
            printf("File: %s, type: %s ",
                   fName.c_str(),
                   FileType[curFile.type].c_str());

            if ( curFile.type == 4 ) {
                static map<char, string> FileAccess= {{'\x00',"Always"},{'\x01',"Pin1"},{'\x02',"Pin2"},{'\x03',"RFU"},{'\x04',"ADM"},{'\x0e',"ADM"},{'\x0F',"Never"}, {'\x0a',"GR"}};
                static map<char, string> FileType= {{'\x00',"Transparent"},{'\x01',"Linear Fixed"},{'\x03',"Cyclic"}};
                printf("Type: %s, Access: read=%x (%s), update=%x (%s), size %hu\n",
                       FileType[curFile.structure].c_str(),
                       curFile.access[0]>>4,
                       FileAccess[curFile.access[0]>>4].c_str(),
                       curFile.access[0]&0xf,
                       FileAccess[curFile.access[0]&0xf].c_str(),
                       ntohs(curFile.size)
                      );
            } else
                printf("\n");
        }

        return values.substr(values.size()-2) == good;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x540, %rsp            # imm = 0x540
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x3c8(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x34d0
movq -0x3c0(%rbp), %rcx
leaq 0xc209(%rip), %rsi      # 0x23281
leaq -0x28(%rbp), %rdi
movl $0x5, %edx
callq 0x3330
jmp 0x17088
leaq -0x29(%rbp), %rdi
callq 0x3300
leaq -0x61(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x34d0
movq -0x3d0(%rbp), %rcx
leaq 0xc1b6(%rip), %rsi      # 0x23265
leaq -0x60(%rbp), %rdi
movl $0x2, %edx
callq 0x3330
jmp 0x170bf
leaq -0x61(%rbp), %rdi
callq 0x3300
leaq -0x88(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3120
jmp 0x170da
movq -0x3c8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x14a30
jmp 0x170ef
leaq -0x88(%rbp), %rdi
callq 0x31a0
movq -0x3c8(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
callq 0x13fd0
jmp 0x17115
movq -0x3c8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x3f0(%rbp)
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x3110
movq -0x3e8(%rbp), %rdi
movq %rax, -0x3e0(%rbp)
callq 0x31f0
movq %rax, -0xb0(%rbp)
movq $0xf, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x18ac0
movq %rax, -0x3d8(%rbp)
jmp 0x1717b
movq -0x3e0(%rbp), %rsi
movq -0x3f0(%rbp), %rdi
movq -0x3d8(%rbp), %rax
movq (%rax), %rdx
callq 0x3230
movq -0x3c8(%rbp), %rax
testb $0x1, (%rax)
je 0x17c4b
cmpb $0x0, 0x18391(%rip)     # 0x2f540
jne 0x1731a
leaq 0x18384(%rip), %rdi     # 0x2f540
callq 0x34e0
cmpl $0x0, %eax
je 0x1731a
leaq -0x140(%rbp), %rdi
movq %rdi, -0x148(%rbp)
movb $0x1, -0x149(%rbp)
leaq 0xeb40(%rip), %rdx      # 0x25d26
leaq -0x149(%rbp), %rsi
callq 0x18b00
jmp 0x171f4
leaq -0x118(%rbp), %rdi
movq %rdi, -0x148(%rbp)
movb $0x2, -0x14a(%rbp)
leaq 0xeb21(%rip), %rdx      # 0x25d31
leaq -0x14a(%rbp), %rsi
callq 0x18b80
jmp 0x1721e
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x148(%rbp)
movb $0x4, -0x14b(%rbp)
leaq 0xeaff(%rip), %rdx      # 0x25d39
leaq -0x14b(%rbp), %rsi
callq 0x18c00
jmp 0x17248
leaq -0x140(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq $0x3, -0xc0(%rbp)
leaq -0x14d(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x18ca0
movq -0x3f8(%rbp), %r8
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq 0x18280(%rip), %rdi     # 0x2f510
leaq -0x14c(%rbp), %rcx
callq 0x18cc0
jmp 0x1729e
leaq -0x14d(%rbp), %rdi
callq 0x18d90
leaq -0x140(%rbp), %rax
movq %rax, -0x408(%rbp)
addq $0x78, %rax
movq %rax, -0x400(%rbp)
movq -0x400(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x410(%rbp)
callq 0x18c80
movq -0x408(%rbp), %rcx
movq -0x410(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x400(%rbp)
jne 0x172c3
leaq 0x1ab5(%rip), %rdi      # 0x18db0
leaq 0x1820e(%rip), %rsi     # 0x2f510
leaq 0x17f9f(%rip), %rdx     # 0x2f2a8
callq 0x3250
leaq 0x1822b(%rip), %rdi     # 0x2f540
callq 0x31d0
movq -0x3c8(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x420(%rbp)
leaq -0x191(%rbp), %rdi
movq %rdi, -0x418(%rbp)
callq 0x34d0
movq -0x420(%rbp), %rsi
movq -0x418(%rbp), %rcx
leaq -0x190(%rbp), %rdi
movl $0x2, %edx
callq 0x3330
jmp 0x17360
movq -0x3c8(%rbp), %rsi
leaq -0x170(%rbp), %rdi
leaq -0x190(%rbp), %rdx
movl $0x1, %ecx
callq 0x15570
jmp 0x17381
leaq -0x190(%rbp), %rdi
callq 0x31a0
leaq -0x191(%rbp), %rdi
callq 0x3300
leaq -0x170(%rbp), %rdi
callq 0x3110
movq %rax, %rcx
movq -0x3c8(%rbp), %rax
movq %rcx, -0x430(%rbp)
movb 0xe(%rax), %al
movb %al, -0x192(%rbp)
leaq 0x1814a(%rip), %rdi     # 0x2f510
leaq -0x192(%rbp), %rsi
callq 0x18dd0
movq %rax, -0x428(%rbp)
jmp 0x173db
movq -0x428(%rbp), %rdi
callq 0x3110
movq -0x430(%rbp), %rsi
movq %rax, %rdx
leaq 0xe94e(%rip), %rdi      # 0x25d46
xorl %eax, %eax
callq 0x3050
jmp 0x17401
movq -0x3c8(%rbp), %rax
movzbl 0xe(%rax), %eax
cmpl $0x4, %eax
jne 0x17c1a
cmpb $0x0, 0x1815c(%rip)     # 0x2f578
jne 0x1765b
leaq 0x1814f(%rip), %rdi     # 0x2f578
callq 0x34e0
cmpl $0x0, %eax
je 0x1765b
leaq -0x2e8(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movb $0x0, -0x2f1(%rbp)
leaq 0xe907(%rip), %rdx      # 0x25d5a
leaq -0x2f1(%rbp), %rsi
callq 0x18eb0
jmp 0x17461
leaq -0x2c0(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movb $0x1, -0x2f2(%rbp)
leaq 0xe8e4(%rip), %rdx      # 0x25d61
leaq -0x2f2(%rbp), %rsi
callq 0x18f30
jmp 0x1748b
leaq -0x298(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movb $0x2, -0x2f3(%rbp)
leaq 0xe8bf(%rip), %rdx      # 0x25d66
leaq -0x2f3(%rbp), %rsi
callq 0x18f30
jmp 0x174b5
leaq -0x270(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movb $0x3, -0x2f4(%rbp)
leaq 0xe89a(%rip), %rdx      # 0x25d6b
leaq -0x2f4(%rbp), %rsi
callq 0x18fb0
jmp 0x174df
leaq -0x248(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movb $0x4, -0x2f5(%rbp)
leaq 0xe874(%rip), %rdx      # 0x25d6f
leaq -0x2f5(%rbp), %rsi
callq 0x18fb0
jmp 0x17509
leaq -0x220(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movb $0xe, -0x2f6(%rbp)
leaq 0xe84a(%rip), %rdx      # 0x25d6f
leaq -0x2f6(%rbp), %rsi
callq 0x18fb0
jmp 0x17533
leaq -0x1f8(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movb $0xf, -0x2f7(%rbp)
leaq 0xe824(%rip), %rdx      # 0x25d73
leaq -0x2f7(%rbp), %rsi
callq 0x19030
jmp 0x1755d
leaq -0x1d0(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
movb $0xa, -0x2f8(%rbp)
leaq 0xe800(%rip), %rdx      # 0x25d79
leaq -0x2f8(%rbp), %rsi
callq 0x190b0
jmp 0x17587
leaq -0x2e8(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq $0x8, -0x1a0(%rbp)
leaq -0x2fa(%rbp), %rdi
movq %rdi, -0x438(%rbp)
callq 0x18ca0
movq -0x438(%rbp), %r8
movq -0x1a8(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
leaq 0x17f79(%rip), %rdi     # 0x2f548
leaq -0x2f9(%rbp), %rcx
callq 0x18cc0
jmp 0x175dd
leaq -0x2fa(%rbp), %rdi
callq 0x18d90
leaq -0x2e8(%rbp), %rax
movq %rax, -0x448(%rbp)
addq $0x140, %rax            # imm = 0x140
movq %rax, -0x440(%rbp)
movq -0x440(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x450(%rbp)
callq 0x18c80
movq -0x448(%rbp), %rcx
movq -0x450(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x440(%rbp)
jne 0x17604
leaq 0x1774(%rip), %rdi      # 0x18db0
leaq 0x17f05(%rip), %rsi     # 0x2f548
leaq 0x17c5e(%rip), %rdx     # 0x2f2a8
callq 0x3250
leaq 0x17f22(%rip), %rdi     # 0x2f578
callq 0x31d0
cmpb $0x0, 0x17f4e(%rip)     # 0x2f5b0
jne 0x177cd
leaq 0x17f41(%rip), %rdi     # 0x2f5b0
callq 0x34e0
cmpl $0x0, %eax
je 0x177cd
leaq -0x388(%rbp), %rdi
movq %rdi, -0x390(%rbp)
movb $0x0, -0x391(%rbp)
leaq 0xe6e3(%rip), %rdx      # 0x25d7c
leaq -0x391(%rbp), %rsi
callq 0x19130
jmp 0x176a7
leaq -0x360(%rbp), %rdi
movq %rdi, -0x390(%rbp)
movb $0x1, -0x392(%rbp)
leaq 0xe6c5(%rip), %rdx      # 0x25d88
leaq -0x392(%rbp), %rsi
callq 0x18c00
jmp 0x176d1
leaq -0x338(%rbp), %rdi
movq %rdi, -0x390(%rbp)
movb $0x3, -0x393(%rbp)
leaq 0xe6a8(%rip), %rdx      # 0x25d95
leaq -0x393(%rbp), %rsi
callq 0x18eb0
jmp 0x176fb
leaq -0x388(%rbp), %rax
movq %rax, -0x310(%rbp)
movq $0x3, -0x308(%rbp)
leaq -0x395(%rbp), %rdi
movq %rdi, -0x458(%rbp)
callq 0x18ca0
movq -0x458(%rbp), %r8
movq -0x310(%rbp), %rsi
movq -0x308(%rbp), %rdx
leaq 0x17e3d(%rip), %rdi     # 0x2f580
leaq -0x394(%rbp), %rcx
callq 0x18cc0
jmp 0x17751
leaq -0x395(%rbp), %rdi
callq 0x18d90
leaq -0x388(%rbp), %rax
movq %rax, -0x468(%rbp)
addq $0x78, %rax
movq %rax, -0x460(%rbp)
movq -0x460(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x470(%rbp)
callq 0x18c80
movq -0x468(%rbp), %rcx
movq -0x470(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x460(%rbp)
jne 0x17776
leaq 0x1602(%rip), %rdi      # 0x18db0
leaq 0x17dcb(%rip), %rsi     # 0x2f580
leaq 0x17aec(%rip), %rdx     # 0x2f2a8
callq 0x3250
leaq 0x17de8(%rip), %rdi     # 0x2f5b0
callq 0x31d0
movq -0x3c8(%rbp), %rax
movb 0x15(%rax), %al
movb %al, -0x396(%rbp)
leaq 0x17d9c(%rip), %rdi     # 0x2f580
leaq -0x396(%rbp), %rsi
callq 0x18dd0
movq %rax, -0x478(%rbp)
jmp 0x177f9
movq -0x478(%rbp), %rdi
callq 0x3110
movq %rax, %rcx
movq -0x3c8(%rbp), %rax
movq %rcx, -0x490(%rbp)
movzbl 0x10(%rax), %eax
shrl $0x4, %eax
movl %eax, -0x484(%rbp)
movb %al, -0x397(%rbp)
leaq 0x17d18(%rip), %rdi     # 0x2f548
leaq -0x397(%rbp), %rsi
callq 0x18dd0
movq %rax, -0x480(%rbp)
jmp 0x17845
movq -0x480(%rbp), %rdi
callq 0x3110
movq %rax, %rcx
movq -0x3c8(%rbp), %rax
movq %rcx, -0x4a8(%rbp)
movzbl 0x10(%rax), %eax
andl $0xf, %eax
movl %eax, -0x49c(%rbp)
movb %al, -0x398(%rbp)
leaq 0x17ccc(%rip), %rdi     # 0x2f548
leaq -0x398(%rbp), %rsi
callq 0x18dd0
movq %rax, -0x498(%rbp)
jmp 0x17891
movq -0x498(%rbp), %rdi
callq 0x3110
movq %rax, %rcx
movq -0x3c8(%rbp), %rax
movq %rcx, -0x4b0(%rbp)
movzwl 0xa(%rax), %edi
callq 0x34f0
movq -0x490(%rbp), %rsi
movl -0x484(%rbp), %edx
movq -0x4a8(%rbp), %rcx
movl -0x49c(%rbp), %r8d
movq -0x4b0(%rbp), %r9
movzwl %ax, %edi
movq %rsp, %rax
movl %edi, (%rax)
leaq 0xe4b4(%rip), %rdi      # 0x25d9c
xorl %eax, %eax
callq 0x3050
jmp 0x178f1
jmp 0x17c2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x3300
jmp 0x17cf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x3300
jmp 0x17ce7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x17cde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x31a0
jmp 0x17cde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x17cd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movq -0x148(%rbp), %rax
leaq -0x140(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x4b8(%rbp)
je 0x179c0
movq -0x4b8(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x4c0(%rbp)
callq 0x18c80
movq -0x4c0(%rbp), %rax
leaq -0x140(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x4b8(%rbp)
jne 0x1798f
jmp 0x17a26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x14d(%rbp), %rdi
callq 0x18d90
leaq -0x140(%rbp), %rax
movq %rax, -0x4d0(%rbp)
addq $0x78, %rax
movq %rax, -0x4c8(%rbp)
movq -0x4c8(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x4d8(%rbp)
callq 0x18c80
movq -0x4d0(%rbp), %rcx
movq -0x4d8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4c8(%rbp)
jne 0x179f3
jmp 0x17a26
leaq 0x17b13(%rip), %rdi     # 0x2f540
callq 0x31c0
jmp 0x17cd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x17a5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x31a0
leaq -0x191(%rbp), %rdi
callq 0x3300
jmp 0x17cd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x17c3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movq -0x2f0(%rbp), %rax
leaq -0x2e8(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x4e0(%rbp)
je 0x17ad6
movq -0x4e0(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x18c80
movq -0x4e8(%rbp), %rax
leaq -0x2e8(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x4e0(%rbp)
jne 0x17aa5
jmp 0x17b3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2fa(%rbp), %rdi
callq 0x18d90
leaq -0x2e8(%rbp), %rax
movq %rax, -0x4f8(%rbp)
addq $0x140, %rax            # imm = 0x140
movq %rax, -0x4f0(%rbp)
movq -0x4f0(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x500(%rbp)
callq 0x18c80
movq -0x4f8(%rbp), %rcx
movq -0x500(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x4f0(%rbp)
jne 0x17b0b
jmp 0x17b3e
leaq 0x17a33(%rip), %rdi     # 0x2f578
callq 0x31c0
jmp 0x17c3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movq -0x390(%rbp), %rax
leaq -0x388(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x508(%rbp)
je 0x17ba6
movq -0x508(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x510(%rbp)
callq 0x18c80
movq -0x510(%rbp), %rax
leaq -0x388(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x508(%rbp)
jne 0x17b75
jmp 0x17c0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x395(%rbp), %rdi
callq 0x18d90
leaq -0x388(%rbp), %rax
movq %rax, -0x520(%rbp)
addq $0x78, %rax
movq %rax, -0x518(%rbp)
movq -0x518(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x528(%rbp)
callq 0x18c80
movq -0x520(%rbp), %rcx
movq -0x528(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x518(%rbp)
jne 0x17bd9
jmp 0x17c0c
leaq 0x1799d(%rip), %rdi     # 0x2f5b0
callq 0x31c0
jmp 0x17c3a
leaq 0xdabb(%rip), %rdi      # 0x256dc
xorl %eax, %eax
callq 0x3050
jmp 0x17c2a
jmp 0x17c2c
leaq -0x170(%rbp), %rdi
callq 0x31a0
jmp 0x17c4b
leaq -0x170(%rbp), %rdi
callq 0x31a0
jmp 0x17cd2
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x530(%rbp)
callq 0x31f0
movq -0x530(%rbp), %rsi
movq %rax, %rdx
addq $-0x2, %rdx
leaq -0x3b8(%rbp), %rdi
movq $-0x1, %rcx
callq 0x32c0
jmp 0x17c81
leaq -0x3b8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x14ed0
movb %al, -0x531(%rbp)
leaq -0x3b8(%rbp), %rdi
callq 0x31a0
leaq -0xa8(%rbp), %rdi
callq 0x31a0
leaq -0x60(%rbp), %rdi
callq 0x31a0
leaq -0x28(%rbp), %rdi
callq 0x31a0
movb -0x531(%rbp), %al
andb $0x1, %al
addq $0x540, %rsp            # imm = 0x540
popq %rbp
retq
leaq -0xa8(%rbp), %rdi
callq 0x31a0
leaq -0x60(%rbp), %rdi
callq 0x31a0
leaq -0x28(%rbp), %rdi
callq 0x31a0
movq -0x38(%rbp), %rdi
callq 0x34b0
nopl (%rax)