// File: /workspace/github_c_makefile_star2_O0/0x0203[P]schack_poc/main.c
// Function: pretty_print_clear
static int pretty_print_clear(uint8_t *data, char *save, int data_len, int save_offset)
{
    int i, count = 0;
    char *special_out = NULL;

    for (i=0; i < data_len; i++)
    {
	if (data[i] == 0x01 && data[i+1] == 0x02)
	{
	    count += sprintf(&save[count+save_offset], "%s", "---Start Transmission---\nSTX\n");
	    i++;
	}
	else if (data[i] == 0x03 && data[i+1] == 0x04)
	{
	    count += sprintf(&save[count+save_offset], "%s", "\nETX\n---End Transmission--\n");
	    i++;
	}
	else if (data[i] == '\n')
	    count += sprintf(&save[count+save_offset], "%c", '\n');
	else if (data[i] < 0x20 || data[i] > 0x7e)
	    count += sprintf(&save[count+save_offset], "%s", "_.");
	else
	    count += sprintf(&save[count+save_offset], "%c", (char)data[i]);
    }

    return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x36e24
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0x36cf7
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x36cf7
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
addl -0x18(%rbp), %eax
cltq
addq %rax, %rdi
leaq 0xf8a4(%rip), %rsi      # 0x46579
leaq 0x1468a(%rip), %rdx     # 0x4b366
movb $0x0, %al
callq 0x32a0
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x36e14
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x3, %eax
jne 0x36d56
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x4, %eax
jne 0x36d56
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
addl -0x18(%rbp), %eax
cltq
addq %rax, %rdi
leaq 0xf845(%rip), %rsi      # 0x46579
leaq 0x14649(%rip), %rdx     # 0x4b384
movb $0x0, %al
callq 0x32a0
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x36e12
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x36d91
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
addl -0x18(%rbp), %eax
cltq
addq %rax, %rdi
leaq 0x14623(%rip), %rsi     # 0x4b3a0
movl $0xa, %edx
movb $0x0, %al
callq 0x32a0
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x36e10
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jl 0x36db3
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x7e, %eax
jle 0x36ddf
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
addl -0x18(%rbp), %eax
cltq
addq %rax, %rdi
leaq 0xf7b0(%rip), %rsi      # 0x46579
leaq 0x145d3(%rip), %rdx     # 0x4b3a3
movb $0x0, %al
callq 0x32a0
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x36e0e
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
addl -0x18(%rbp), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %edx
leaq 0x1459f(%rip), %rsi     # 0x4b3a0
movb $0x0, %al
callq 0x32a0
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x36e10
jmp 0x36e12
jmp 0x36e14
jmp 0x36e16
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x36c8c
movl -0x20(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)