// File: FFY00[P]uicc/include/uicc.h
// Function: USIM::writeFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, bool, bool)
bool writeFile(string filename, vector<string> content, bool fillIt=false, bool records=false) {
        if (!openFile(filename))
            return false;

        int size=content[0].size();

        if (fileDesc.size() <= 2) { // binary (flat)
            Assert(size <= 256, "Not developped: write binary files > 256 bytes");
            string command(u8"\x00\xd6\x00\x00",4);
            string good(u8"\x90\x00",2);
            unsigned char x=(char) size;

            if (fillIt)
                command+=(unsigned char)fileSize;
            else
                command+=x;

            command+=content[0];

            if (fillIt)
                for (int j=content[0].size();
                        j< (unsigned char) fileSize ;
                        j++)
                    command+=u8"\xff";

            write(command);
            string answ=read(good.size());

            if (answ == good)
                return true;
            else
                return false;
        } else { // records
            for (size_t i=0; i < content.size(); i++ ) {
                string command(u8"\x00\xdc",2);
                string good(u8"\x90\x00",2);
                command+=(unsigned char) i+1;
                command+='\x04';
                command+=fileDesc.substr(3,1); //record lenght;
                command+=content[i];

                for (int j=content[i].size();
                        j< (unsigned char) fileDesc[3] ;
                        j++)
                    command+=u8"\xff";

                write(command);
                string answ=read(good.size());

                if ( answ != good )
                    return false;
            }
        }

        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdx, -0x1d0(%rbp)
movb %r8b, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
andb $0x1, %cl
movb %cl, -0x21(%rbp)
andb $0x1, %al
movb %al, -0x22(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1c8(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x3120
movq -0x1c8(%rbp), %rdi
movq -0x1c0(%rbp), %rsi
callq 0x1ab90
movb %al, -0x1b1(%rbp)
jmp 0x11c72
movb -0x1b1(%rbp), %al
xorb $-0x1, %al
movb %al, -0x1d1(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x31a0
movb -0x1d1(%rbp), %al
testb $0x1, %al
jne 0x11c95
jmp 0x11cb8
movb $0x0, -0x1(%rbp)
jmp 0x1231e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x31a0
jmp 0x1232c
movq -0x1d0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xf690
movq %rax, %rdi
callq 0x31f0
movq -0x1c8(%rbp), %rdi
movl %eax, -0x58(%rbp)
addq $0x28, %rdi
callq 0x31f0
cmpq $0x2, %rax
ja 0x11fcd
jmp 0x11cef
cmpl $0x100, -0x58(%rbp)     # imm = 0x100
jle 0x11d69
movq 0x1d2d1(%rip), %rax     # 0x2efd0
movq (%rax), %rax
movq %rax, -0x1e0(%rbp)
callq 0x3040
movl (%rax), %edi
callq 0x30d0
movq -0x1e0(%rbp), %rdi
movq %rax, %r9
leaq 0x1443d(%rip), %rsi     # 0x26163
leaq 0x144ca(%rip), %rdx     # 0x261f7
leaq 0x13b32(%rip), %rcx     # 0x25866
movl $0x34f, %r8d            # imm = 0x34F
movb $0x0, %al
callq 0x3410
movq 0x1d258(%rip), %rax     # 0x2efa0
movq (%rax), %rdi
callq 0x3350
movq 0x1d279(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3350
movl $0x1, %edi
callq 0x3370
jmp 0x11d6b
leaq -0x79(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x34d0
movq -0x1e8(%rbp), %rcx
leaq 0x1154c(%rip), %rsi     # 0x232d5
leaq -0x78(%rbp), %rdi
movl $0x4, %edx
callq 0x3330
jmp 0x11d99
leaq -0x79(%rbp), %rdi
callq 0x3300
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x34d0
movq -0x1f0(%rbp), %rcx
leaq 0x114a2(%rip), %rsi     # 0x23265
leaq -0xa0(%rbp), %rdi
movl $0x2, %edx
callq 0x3330
jmp 0x11dd6
leaq -0xa1(%rbp), %rdi
callq 0x3300
movl -0x58(%rbp), %eax
movb %al, -0xa2(%rbp)
testb $0x1, -0x21(%rbp)
je 0x11e51
movq -0x1c8(%rbp), %rax
movsbl 0x48(%rax), %esi
leaq -0x78(%rbp), %rdi
callq 0x31b0
jmp 0x11e07
jmp 0x11e65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x3300
jmp 0x1232c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa1(%rbp), %rdi
callq 0x3300
jmp 0x11fbf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11fb3
movsbl -0xa2(%rbp), %esi
leaq -0x78(%rbp), %rdi
callq 0x31b0
jmp 0x11e63
jmp 0x11e65
movq -0x1d0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xf690
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x33b0
jmp 0x11e83
testb $0x1, -0x21(%rbp)
je 0x11ee5
movq -0x1d0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xf690
movq %rax, %rdi
callq 0x31f0
movl %eax, -0xa8(%rbp)
movq -0x1c8(%rbp), %rcx
movl -0xa8(%rbp), %eax
movl 0x48(%rcx), %ecx
movzbl %cl, %ecx
cmpl %ecx, %eax
jge 0x11ee3
leaq 0x1433c(%rip), %rsi     # 0x26201
leaq -0x78(%rbp), %rdi
callq 0x3280
jmp 0x11ed0
jmp 0x11ed2
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x11ea7
jmp 0x11ee5
leaq -0xc8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3120
jmp 0x11ef7
movq -0x1c8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x14a30
jmp 0x11f0c
leaq -0xc8(%rbp), %rdi
callq 0x31a0
leaq -0xa0(%rbp), %rdi
callq 0x31f0
movq -0x1c8(%rbp), %rsi
movq %rax, %rdx
leaq -0xe8(%rbp), %rdi
callq 0x13fd0
jmp 0x11f3c
leaq -0xe8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x14ed0
testb $0x1, %al
jne 0x11f55
jmp 0x11f7f
movb $0x1, -0x1(%rbp)
movl $0x1, -0xec(%rbp)
jmp 0x11f8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x31a0
jmp 0x11fb3
movb $0x0, -0x1(%rbp)
movl $0x1, -0xec(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x31a0
leaq -0xa0(%rbp), %rdi
callq 0x31a0
leaq -0x78(%rbp), %rdi
callq 0x31a0
jmp 0x1231e
leaq -0xa0(%rbp), %rdi
callq 0x31a0
leaq -0x78(%rbp), %rdi
callq 0x31a0
jmp 0x1232c
movq $0x0, -0xf8(%rbp)
movq -0x1d0(%rbp), %rdi
movq -0xf8(%rbp), %rax
movq %rax, -0x1f8(%rbp)
callq 0x12e20
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
cmpq %rcx, %rax
jae 0x12318
leaq -0x119(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x34d0
movq -0x200(%rbp), %rcx
leaq 0x112b4(%rip), %rsi     # 0x232da
leaq -0x118(%rbp), %rdi
movl $0x2, %edx
callq 0x3330
jmp 0x12039
leaq -0x119(%rbp), %rdi
callq 0x3300
leaq -0x141(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x34d0
movq -0x208(%rbp), %rcx
leaq 0x111ff(%rip), %rsi     # 0x23265
leaq -0x140(%rbp), %rdi
movl $0x2, %edx
callq 0x3330
jmp 0x12079
leaq -0x141(%rbp), %rdi
callq 0x3300
movl -0xf8(%rbp), %eax
incl %eax
movsbl %al, %esi
leaq -0x118(%rbp), %rdi
callq 0x31b0
jmp 0x1209e
leaq -0x118(%rbp), %rdi
movl $0x4, %esi
callq 0x31b0
jmp 0x120b1
movq -0x1c8(%rbp), %rsi
addq $0x28, %rsi
leaq -0x168(%rbp), %rdi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x32c0
jmp 0x120d4
leaq -0x118(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x33b0
jmp 0x120e9
leaq -0x168(%rbp), %rdi
callq 0x31a0
movq -0x1d0(%rbp), %rdi
movq -0xf8(%rbp), %rsi
callq 0xf690
movq %rax, %rsi
leaq -0x118(%rbp), %rdi
callq 0x33b0
jmp 0x12119
movq -0x1d0(%rbp), %rdi
movq -0xf8(%rbp), %rsi
callq 0xf690
movq %rax, %rdi
callq 0x31f0
movl %eax, -0x16c(%rbp)
movq -0x1c8(%rbp), %rdi
movl -0x16c(%rbp), %eax
movl %eax, -0x214(%rbp)
addq $0x28, %rdi
movl $0x3, %esi
callq 0x3520
movq %rax, -0x210(%rbp)
jmp 0x12164
movl -0x214(%rbp), %eax
movq -0x210(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x1220c
leaq 0x1407e(%rip), %rsi     # 0x26201
leaq -0x118(%rbp), %rdi
callq 0x3280
jmp 0x12191
jmp 0x12193
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0x1213a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x119(%rbp), %rdi
callq 0x3300
jmp 0x1232c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x141(%rbp), %rdi
callq 0x3300
jmp 0x1230a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x122fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x31a0
jmp 0x122fe
leaq -0x190(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x3120
jmp 0x12221
movq -0x1c8(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x14a30
jmp 0x12236
leaq -0x190(%rbp), %rdi
callq 0x31a0
leaq -0x140(%rbp), %rdi
callq 0x31f0
movq -0x1c8(%rbp), %rsi
movq %rax, %rdx
leaq -0x1b0(%rbp), %rdi
callq 0x13fd0
jmp 0x12266
leaq -0x1b0(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x12e40
testb $0x1, %al
jne 0x1227f
jmp 0x122a9
movb $0x0, -0x1(%rbp)
movl $0x1, -0xec(%rbp)
jmp 0x122b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x31a0
jmp 0x122fe
movl $0x0, -0xec(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x31a0
leaq -0x140(%rbp), %rdi
callq 0x31a0
leaq -0x118(%rbp), %rdi
callq 0x31a0
movl -0xec(%rbp), %eax
testl %eax, %eax
je 0x122e5
jmp 0x122e3
jmp 0x1231e
jmp 0x122e7
movq -0xf8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xf8(%rbp)
jmp 0x11fd8
leaq -0x140(%rbp), %rdi
callq 0x31a0
leaq -0x118(%rbp), %rdi
callq 0x31a0
jmp 0x1232c
jmp 0x1231a
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x34b0
nopw %cs:(%rax,%rax)
nop