// File: /workspace/github_c_makefile_star2_O0/mruby-zest[P]osc-bridge/test/common.h
// Function: hexdump
void hexdump(const char *data, const char *mask, size_t len)
{
    const char *bold_gray = "\x1b[30;1m";
    const char *reset      = "\x1b[0m";
    int offset = 0;
    while(1)
    {
        //print line
        printf("#%07x: ", offset);

        int char_covered = 0;

        //print hex groups (8)
        for(int i=0; i<8; ++i) {

            //print doublet
            for(int j=0; j<2; ++j) {
                int loffset = offset + 2*i + j;
                if(loffset >= (int)len)
                    goto escape;

                //print hex
                {
                    //start highlight
                    if(mask && mask[loffset]){printf("%s", bold_gray);}

                    //print chars
                    printf("%02x", 0xff&data[loffset]);

                    //end highlight
                    if(mask && mask[loffset]){printf("%s", reset);}
                    char_covered += 2;
                }
            }
            printf(" ");
            char_covered += 1;
        }
escape:

        //print filler if needed
        for(int i=char_covered; i<41; ++i)
            printf(" ");

        //print ascii (16)
        for(int i=0; i<16; ++i) {
            if(isprint(data[offset+i]))
                printf("%c", data[offset+i]);
            else
                printf(".");
        }
        printf("\n");
        offset += 16;
        if(offset >= (int)len)
            return;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x1d6e(%rip), %rax      # 0xcfd9
movq %rax, -0x20(%rbp)
leaq 0x1d6b(%rip), %rax      # 0xcfe1
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %esi
leaq 0x1d5b(%rip), %rdi      # 0xcfe6
movb $0x0, %al
callq 0x20e0
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpl $0x8, -0x34(%rbp)
jge 0xb38b
movl $0x0, -0x38(%rbp)
cmpl $0x2, -0x38(%rbp)
jge 0xb366
movl -0x2c(%rbp), %eax
movl -0x34(%rbp), %ecx
shll %ecx
addl %ecx, %eax
addl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl %ecx, %eax
jl 0xb2db
jmp 0xb38d
cmpq $0x0, -0x10(%rbp)
je 0xb305
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0xb305
movq -0x20(%rbp), %rsi
leaq 0xe5b(%rip), %rdi       # 0xc159
movb $0x0, %al
callq 0x20e0
movq -0x8(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %esi
andl $0xff, %esi
leaq 0x1cd0(%rip), %rdi      # 0xcfee
movb $0x0, %al
callq 0x20e0
cmpq $0x0, -0x10(%rbp)
je 0xb34f
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0xb34f
movq -0x28(%rbp), %rsi
leaq 0xe11(%rip), %rdi       # 0xc159
movb $0x0, %al
callq 0x20e0
movl -0x30(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x30(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xb2b1
leaq 0x1c7f(%rip), %rdi      # 0xcfec
movb $0x0, %al
callq 0x20e0
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xb2a0
jmp 0xb38d
movl -0x30(%rbp), %eax
movl %eax, -0x40(%rbp)
cmpl $0x29, -0x40(%rbp)
jge 0xb3b2
leaq 0x1c4c(%rip), %rdi      # 0xcfec
movb $0x0, %al
callq 0x20e0
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xb393
movl $0x0, -0x44(%rbp)
cmpl $0x10, -0x44(%rbp)
jge 0xb425
callq 0x22d0
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movl -0x2c(%rbp), %edx
addl -0x44(%rbp), %edx
movslq %edx, %rdx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0xb40a
movq -0x8(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %esi
leaq 0x1bf2(%rip), %rdi      # 0xcff3
movb $0x0, %al
callq 0x20e0
jmp 0xb418
leaq 0x1be5(%rip), %rdi      # 0xcff6
movb $0x0, %al
callq 0x20e0
jmp 0xb41a
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xb3b9
leaq 0x10c5(%rip), %rdi      # 0xc4f1
movb $0x0, %al
callq 0x20e0
movl -0x2c(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl %ecx, %eax
jl 0xb44d
addq $0x50, %rsp
popq %rbp
retq
jmp 0xb281
nopw %cs:(%rax,%rax)