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

        unsigned char size=( unsigned char)content[0].size();
        uint16_t fileSize=ntohs(curFile.size);

        if (curFile.structure==0 && records==false) { // binary (flat)
            Assert(size <= 256, "Not developped: write binary files > 256 bytes");
            string command(u8"\xa0\xd6\x00\x00",4);
            string good(u8"\x90\x00",2);

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

            command+=content[0];

            if (fillIt)
                for (int j=size; j < 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"\xa0\xdc",2);
                string good(u8"\x90\x00",2);
                command+=(unsigned char) i+1;
                command+='\x04';
                command+=curFile.record_length; //record lenght;
                command+=content[i];

                for (int j=content[i].size(); j< curFile.record_length ; 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 %r8d, %r12d
movl %ecx, %r15d
movq %rdx, -0x38(%rbp)
movq %rdi, %rbx
leaq -0xe8(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq -0xf8(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x1394e
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe3c4
movl %eax, %r14d
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0xc01d
callq 0x2220
testb %r14b, %r14b
je 0xc1fa
cmpb $0x0, 0x15(%rbx)
movq -0x38(%rbp), %rdx
movq (%rdx), %rax
sete %cl
xorb $0x1, %r12b
testb %r12b, %cl
jne 0xc201
cmpq %rax, 0x8(%rdx)
je 0xc32d
leaq -0x58(%rbp), %r15
leaq 0xccbe(%rip), %r12      # 0x18d14
xorl %r13d, %r13d
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movw $0xdca0, -0x48(%rbp)    # imm = 0xDCA0
movl $0x2, %edx
movq %rdx, -0x50(%rbp)
xorl %ecx, %ecx
movb %cl, -0x46(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movw $0x90, -0x68(%rbp)
movq %rdx, -0x70(%rbp)
movb %cl, -0x66(%rbp)
leal 0x1(%r13), %eax
movsbl %al, %esi
movq %r15, %rdi
callq 0x2200
movq %r15, %rdi
movl $0x4, %esi
callq 0x2200
movsbl 0x16(%rbx), %esi
movq %r15, %rdi
callq 0x2200
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %r13, %r14
shlq $0x5, %r14
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
movq %r15, %rdi
callq 0x20d0
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax,%r14), %r14d
movzbl 0x16(%rbx), %eax
cmpl %eax, %r14d
jge 0xc0f6
movq %r15, %rdi
movq %r12, %rsi
callq 0x2450
incl %r14d
jmp 0xc0dd
leaq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %rdi
callq 0x1394e
movq %rbx, %rdi
leaq -0xb8(%rbp), %rsi
callq 0xe93c
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0xc142
callq 0x2220
movq -0x70(%rbp), %rdx
leaq -0x98(%rbp), %rdi
movq %rbx, %rsi
callq 0xe17e
movq -0x90(%rbp), %rdx
cmpq -0x70(%rbp), %rdx
jne 0xc184
movq -0x98(%rbp), %r14
testq %rdx, %rdx
je 0xc192
movq -0x78(%rbp), %rsi
movq %r14, %rdi
callq 0x2260
testl %eax, %eax
setne %al
movl %eax, -0x2c(%rbp)
jmp 0xc199
movb $0x1, %al
movl %eax, -0x2c(%rbp)
movq -0x98(%rbp), %r14
jmp 0xc199
movl $0x0, -0x2c(%rbp)
leaq -0x88(%rbp), %rax
cmpq %rax, %r14
je 0xc1ad
movq %r14, %rdi
callq 0x2220
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xc1bf
callq 0x2220
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
movq -0x38(%rbp), %r14
je 0xc1d5
callq 0x2220
movl -0x2c(%rbp), %eax
testb %al, %al
jne 0xc1f3
incq %r13
movq 0x8(%r14), %rcx
subq (%r14), %rcx
sarq $0x5, %rcx
cmpq %rcx, %r13
jb 0xc059
xorb $0x1, %al
jmp 0xc36b
xorl %eax, %eax
jmp 0xc36b
movzwl 0xa(%rbx), %r14d
rolw $0x8, %r14w
movl 0x8(%rax), %r12d
leaq -0x48(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movl $0xd6a0, (%rcx)         # imm = 0xD6A0
movq $0x4, -0x8(%rcx)
xorl %eax, %eax
movb %al, 0x4(%rcx)
leaq -0x68(%rbp), %r13
movq %r13, -0x10(%r13)
movw $0x90, (%r13)
movq $0x2, -0x8(%r13)
movb %al, 0x2(%r13)
testb %r15b, %r15b
movl %r14d, %eax
cmovel %r12d, %eax
movsbl %al, %esi
leaq -0x58(%rbp), %rdi
callq 0x2200
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x58(%rbp), %rdi
callq 0x20d0
testb %r15b, %r15b
je 0xc29f
movzbl %r12b, %eax
movzwl %r14w, %r12d
subl %eax, %r12d
jbe 0xc29f
leaq 0xca89(%rip), %r14      # 0x18d14
leaq -0x58(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2450
decl %r12d
jne 0xc28f
leaq -0xc8(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x1394e
leaq -0xd8(%rbp), %rsi
movq %rbx, %rdi
callq 0xe93c
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0xc2e1
callq 0x2220
movq -0x70(%rbp), %rdx
leaq -0x98(%rbp), %rdi
movq %rbx, %rsi
callq 0xe17e
movq -0x90(%rbp), %rdx
cmpq -0x70(%rbp), %rdx
jne 0xc321
movq -0x98(%rbp), %rbx
testq %rdx, %rdx
je 0xc331
movq -0x78(%rbp), %rsi
movq %rbx, %rdi
callq 0x2260
testl %eax, %eax
sete %r14b
jmp 0xc334
movq -0x98(%rbp), %rbx
xorl %r14d, %r14d
jmp 0xc334
movb $0x1, %al
jmp 0xc36b
movb $0x1, %r14b
leaq -0x88(%rbp), %rax
cmpq %rax, %rbx
je 0xc348
movq %rbx, %rdi
callq 0x2220
movq -0x78(%rbp), %rdi
cmpq %r13, %rdi
je 0xc356
callq 0x2220
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xc368
callq 0x2220
movl %r14d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc3a8
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0xc3ab
callq 0x2220
jmp 0xc3ab
jmp 0xc3a8
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
jne 0xc3f9
jmp 0xc3fe
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r13, %rdi
jne 0xc3e7
jmp 0xc3ec
jmp 0xc3d7
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0xc3da
callq 0x2220
jmp 0xc3da
jmp 0xc3d7
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xc3ec
callq 0x2220
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xc3fe
callq 0x2220
movq %rbx, %rdi
callq 0x2400