// File: /workspace/github_c_makefile_star2_O0/DrYerzinia[P]C_DigiMode/src/packet/packet_main.c
// Function: print_detailed_packet
void print_detailed_packet(APRSPacket *packet, unsigned short calculated_checksum, unsigned short checksum){

	int i;

	printf("Packet Received\n");

	if(calculated_checksum != checksum)
		printf("Checksum Error!\nCaluclated checksum is: %04X\n", calculated_checksum);

	printf("Size: %d\n", packet->data.len);
	printf("Destination Address: %s\n", packet->destination_address);
	printf("Source Address: %s\n", packet->source_address);
	for(i = 0; i < packet->repeaters; i++)
		printf("Repeater-%d: %s\n", i+1, packet->repeater_addresses[i]);

	printf("\nData: \n");

	i = 0;
	while(i < packet->data.len){
		int j;
		for(j = 0; j < 20; j++){
			if(i < packet->data.len){
				if(isprint(packet->data.data[i])) putchar(packet->data.data[i]);
				else printf(".");
			} else putchar(' ');
			i++;
		}
		i -= 20;
		printf("  |  ");
		for(j = 0; j < 20; j++){
			if(i < packet->data.len){
				unsigned char val = packet->data.data[i];
				printf(" %02X", (int)val);
				i++;
			}
		}
		putchar('\n');
	}

	printf("\nChecksum: %04X\n", checksum);
	fflush(stdout);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %dx, %ax
movw %si, %cx
movq %rdi, -0x8(%rbp)
movw %cx, -0xa(%rbp)
movw %ax, -0xc(%rbp)
leaq 0x1a20(%rip), %rdi      # 0x4081
movb $0x0, %al
callq 0x1090
movzwl -0xa(%rbp), %eax
movzwl -0xc(%rbp), %ecx
cmpl %ecx, %eax
je 0x2686
movzwl -0xa(%rbp), %esi
leaq 0x1a13(%rip), %rdi      # 0x4092
movb $0x0, %al
callq 0x1090
movq -0x8(%rbp), %rax
movzwl (%rax), %esi
leaq 0x1a2c(%rip), %rdi      # 0x40c0
movb $0x0, %al
callq 0x1090
movq -0x8(%rbp), %rsi
addq $0x10, %rsi
leaq 0x1a20(%rip), %rdi      # 0x40ca
movb $0x0, %al
callq 0x1090
movq -0x8(%rbp), %rsi
addq $0x18, %rsi
leaq 0x1a23(%rip), %rdi      # 0x40e3
movb $0x0, %al
callq 0x1090
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movzbl 0x20(%rcx), %ecx
cmpl %ecx, %eax
jge 0x270c
movl -0x10(%rbp), %esi
addl $0x1, %esi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x19fd(%rip), %rdi      # 0x40f7
movb $0x0, %al
callq 0x1090
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x26ce
leaq 0x19f5(%rip), %rdi      # 0x4108
movb $0x0, %al
callq 0x1090
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x283a
movl $0x0, -0x14(%rbp)
cmpl $0x14, -0x14(%rbp)
jge 0x27bf
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x279e
callq 0x1160
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x10(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x278e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x10(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x1040
jmp 0x279c
leaq 0x197c(%rip), %rdi      # 0x4111
movb $0x0, %al
callq 0x1090
jmp 0x27a8
movl $0x20, %edi
callq 0x1040
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x273a
movl -0x10(%rbp), %eax
subl $0x14, %eax
movl %eax, -0x10(%rbp)
leaq 0x1944(%rip), %rdi      # 0x4113
movb $0x0, %al
callq 0x1090
movl $0x0, -0x14(%rbp)
cmpl $0x14, -0x14(%rbp)
jge 0x282b
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x281e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x10(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x15(%rbp)
movzbl -0x15(%rbp), %esi
leaq 0x190b(%rip), %rdi      # 0x4119
movb $0x0, %al
callq 0x1090
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2820
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x27dd
movl $0xa, %edi
callq 0x1040
jmp 0x2721
movzwl -0xc(%rbp), %esi
leaq 0x18da(%rip), %rdi      # 0x411f
movb $0x0, %al
callq 0x1090
movq 0x377d(%rip), %rax      # 0x5fd0
movq (%rax), %rdi
callq 0x1100
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)