// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %ecx, %ebx
movq %rdx, -0x40(%rbp)
movq %rdi, %r12
leaq -0xf0(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq -0x100(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x1372a
movq %r12, -0x38(%rbp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x11440
movl %eax, %r15d
movq -0x100(%rbp), %rdi
cmpq %r14, %rdi
je 0xc8eb
callq 0x2220
testb %r15b, %r15b
je 0xca50
movq -0x38(%rbp), %rax
cmpq $0x3, 0x30(%rax)
jae 0xca5c
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
cmpl $0x101, %eax            # imm = 0x101
jge 0xccb0
leaq -0x50(%rbp), %r12
movq %r12, -0x10(%r12)
movl $0xd600, (%r12)         # imm = 0xD600
movq $0x4, -0x8(%r12)
xorl %ecx, %ecx
movb %cl, 0x4(%r12)
leaq -0x70(%rbp), %r13
movq %r13, -0x10(%r13)
movw $0x90, (%r13)
movq $0x2, -0x8(%r13)
movb %cl, 0x2(%r13)
testb %bl, %bl
je 0xc960
movq -0x38(%rbp), %rax
movl 0x48(%rax), %eax
movsbl %al, %esi
leaq -0x60(%rbp), %rdi
callq 0x2200
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x60(%rbp), %rdi
callq 0x20d0
testb %bl, %bl
je 0xc9c5
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %r15d
movq -0x38(%rbp), %rax
movzbl 0x48(%rax), %eax
cmpl %r15d, %eax
jle 0xc9c5
leaq 0xc36e(%rip), %rbx      # 0x18d14
leaq -0x60(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2450
incl %r15d
movq -0x38(%rbp), %rax
movzbl 0x48(%rax), %eax
cmpl %eax, %r15d
jl 0xc9aa
leaq -0xd0(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x1372a
leaq -0xe0(%rbp), %rsi
movq -0x38(%rbp), %rdi
callq 0xe6b2
movq -0xe0(%rbp), %rdi
cmpq %r14, %rdi
je 0xca08
callq 0x2220
movq -0x78(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xde7c
movq -0x98(%rbp), %rdx
cmpq -0x78(%rbp), %rdx
jne 0xcc5a
testq %rdx, %rdx
je 0xcc63
movq -0x80(%rbp), %rsi
movq -0xa0(%rbp), %rdi
callq 0x2260
testl %eax, %eax
sete %al
jmp 0xcc65
movl $0x0, -0x2c(%rbp)
jmp 0xcc99
movq -0x40(%rbp), %rcx
movq 0x8(%rcx), %rax
cmpq (%rcx), %rax
sete %al
movl %eax, -0x2c(%rbp)
je 0xcc99
movq -0x38(%rbp), %rax
leaq 0x28(%rax), %r12
leaq -0x60(%rbp), %r13
leaq 0xc28e(%rip), %rbx      # 0x18d14
xorl %r14d, %r14d
leaq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movw $0xdc00, -0x50(%rbp)    # imm = 0xDC00
movl $0x2, %edx
movq %rdx, -0x58(%rbp)
xorl %ecx, %ecx
movb %cl, -0x4e(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movw $0x90, -0x70(%rbp)
movq %rdx, -0x78(%rbp)
movb %cl, -0x6e(%rbp)
leal 0x1(%r14), %eax
movsbl %al, %esi
movq %r13, %rdi
callq 0x2200
movq %r13, %rdi
movl $0x4, %esi
callq 0x2200
movl $0x3, %edx
movl $0x1, %ecx
leaq -0xa0(%rbp), %rdi
movq %r12, %rsi
callq 0x2270
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq %r13, %rdi
callq 0x20d0
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0xcb1d
callq 0x2220
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %r14, %r15
shlq $0x5, %r15
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
movq %r13, %rdi
callq 0x20d0
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax,%r15), %r15d
movq (%r12), %rax
movzbl 0x3(%rax), %eax
cmpl %eax, %r15d
jge 0xcb65
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2450
incl %r15d
jmp 0xcb48
leaq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rdi
callq 0x1372a
movq -0x38(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xe6b2
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0xcbb2
callq 0x2220
movq -0x78(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xde7c
movq -0x98(%rbp), %rdx
movb $0x1, %r15b
cmpq -0x78(%rbp), %rdx
jne 0xcbf6
testq %rdx, %rdx
je 0xcbf3
movq -0x80(%rbp), %rsi
movq -0xa0(%rbp), %rdi
callq 0x2260
testl %eax, %eax
setne %r15b
jmp 0xcbf6
xorl %r15d, %r15d
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0xcc0e
callq 0x2220
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xcc20
callq 0x2220
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xcc32
callq 0x2220
testb %r15b, %r15b
jne 0xcc99
movq -0x40(%rbp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
incq %r14
sarq $0x5, %rax
cmpq %rax, %r14
setae %al
movl %eax, -0x2c(%rbp)
jb 0xca89
jmp 0xcc99
movl $0x0, -0x2c(%rbp)
jmp 0xcc68
movb $0x1, %al
movl %eax, -0x2c(%rbp)
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcc7d
callq 0x2220
movq -0x80(%rbp), %rdi
cmpq %r13, %rdi
je 0xcc8b
callq 0x2220
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0xcc99
callq 0x2220
movl -0x2c(%rbp), %eax
andb $0x1, %al
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x37ea
jmp 0xcce0
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
cmpq %r14, %rdi
je 0xcce3
callq 0x2220
jmp 0xcce3
jmp 0xcce0
movq %rax, %rbx
movq -0x100(%rbp), %rdi
cmpq %r14, %rdi
jne 0xcd54
jmp 0xcd59
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r13, %rdi
je 0xccf1
callq 0x2220
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
jne 0xcd54
jmp 0xcd59
jmp 0xcd32
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
jmp 0xcd22
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0xcd35
callq 0x2220
jmp 0xcd35
jmp 0xcd32
jmp 0xcd32
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xcd47
callq 0x2220
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0xcd59
callq 0x2220
movq %rbx, %rdi
callq 0x2400
nop