// File: /workspace/github_cpp_makefile_star2_O3/FFY00[P]uicc/include/uicc.h
// Function: UICC::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int write(string buf) {
        if (debug)
            dump_hex("Sending", buf);

        size_t size=buf.size();
        Assert( size >= 5, "");

        for (int i=0; i<5; i++ ) {
            ::write(fd, &buf[i], 1);
            // UICC have only one wire for Tx and Rx,
            // so over a RS232 we always receive back what we send
            char c;
            Assert(::read(fd, &c, 1)==1,
                   "All data sent must echo back" );
        }

        // Read UICC acknowledge the order
        if (buf[0] == (int8_t)'\xa0'|| buf[0] == (int8_t)'\x00' ) {
            char c;
            int ret=::read(fd, &c, 1);
            Assert( ret ==1 && c == buf[1],
                    "UICC answer is %02hhx instead of %02hhx",c, buf[1]);
        } else
            printf("WARNING: Non standard packet sent\n");

        for (size_t i=5; i<size; i++ ) {
            ::write(fd, &buf[i], 1);
            char c;
            Assert(::read(fd, &c, 1)==1,
                   "All data sent must echo back" );
        }

        return size;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, (%rdi)
jne 0xe9ff
leaq -0x48(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0xa005(%rip), %rsi      # 0x18970
leaq 0xa005(%rip), %rdx      # 0x18977
leaq -0x58(%rbp), %rdi
callq 0x139ec
leaq -0x68(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x1394e
movq -0x58(%rbp), %rsi
leaq 0xa437(%rip), %rdi      # 0x18dd8
xorl %eax, %eax
callq 0x2060
cmpq $0x0, -0x70(%rbp)
je 0xe9d5
leaq 0x95c4(%rip), %r15      # 0x17f7a
xorl %r12d, %r12d
movq -0x78(%rbp), %rax
movsbl (%rax,%r12), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2060
incq %r12
cmpq -0x70(%rbp), %r12
jb 0xe9b9
movl $0xa, %edi
callq 0x2340
movq -0x78(%rbp), %rdi
cmpq %r13, %rdi
je 0xe9ed
callq 0x2220
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xe9ff
callq 0x2220
movq 0x8(%rbx), %r15
cmpq $0x5, %r15
jb 0xeb10
xorl %r13d, %r13d
leaq -0x29(%rbp), %r12
movl 0x4(%r14), %edi
movq (%rbx), %rsi
addq %r13, %rsi
movl $0x1, %edx
callq 0x20f0
movl 0x4(%r14), %edi
movl $0x1, %edx
movq %r12, %rsi
callq 0x2370
cmpq $0x1, %rax
jne 0xeb06
incq %r13
cmpq $0x5, %r13
jne 0xea14
movq (%rbx), %rax
movzbl (%rax), %eax
testl %eax, %eax
je 0xea5d
cmpl $0xa0, %eax
jne 0xea8e
movl 0x4(%r14), %edi
leaq -0x29(%rbp), %r12
movl $0x1, %edx
movq %r12, %rsi
callq 0x2370
movb (%r12), %cl
cmpl $0x1, %eax
jne 0xea83
movq (%rbx), %rax
cmpb 0x1(%rax), %cl
je 0xea9a
movzbl %cl, %edi
movq %rbx, %rsi
callq 0x3c0b
leaq 0xa56f(%rip), %rdi      # 0x19004
callq 0x23c0
movq %r15, -0x38(%rbp)
cmpq $0x5, %r15
je 0xeaf3
movq -0x38(%rbp), %rax
cmpq $0x7, %rax
movl $0x6, %r13d
cmovaeq %rax, %r13
movl $0x5, %r15d
leaq -0x29(%rbp), %r12
movl 0x4(%r14), %edi
movq (%rbx), %rsi
addq %r15, %rsi
movl $0x1, %edx
callq 0x20f0
movl 0x4(%r14), %edi
movl $0x1, %edx
movq %r12, %rsi
callq 0x2370
cmpq $0x1, %rax
jne 0xeb0b
incq %r15
cmpq %r15, %r13
jne 0xeac0
movq -0x38(%rbp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3ba7
callq 0x3c8d
callq 0x3b43
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xeb2a
callq 0x2220
movq %rbx, %rdi
callq 0x2400