// File: /workspace/github_c_makefile_star2_O1/ddrown[P]pretend-ntp/ntp_msg.c
// Function: print_ntp
void print_ntp(const struct ntp_msg *m, const struct timespec *send, const struct timespec *recv) {
  struct timespec recv_time, trans_time;

  if(m->leap < sizeof(ntp_leap_str)/sizeof(char *)) {
    printf("leap = %s\n", ntp_leap_str[m->leap]);
  } else {
    printf("leap = %u\n", m->leap);
  }
  printf("version = %u\n", m->version);
  if(m->mode < sizeof(ntp_mode_str)/sizeof(char *)) {
    printf("mode = %s\n", ntp_mode_str[m->mode]);
  } else {
    printf("mode = %u\n", m->mode);
  }
  printf("stratum = %u\n", m->stratum);
  printf("poll = %u\n", m->poll);
  printf("precision = %d\n", m->precision);
  printf("delay = %u.%06u\n", ntohs(m->delay), ntp_frac_to_us(m->delay_fb));
  printf("dispersion = %u.%06u\n", ntohs(m->dispersion), ntp_frac_to_us(m->dispersion_fb));
  printf("ident = %u\n", ntohl(m->ident));
  printf("ref_time = %u.%09u\n", ntp_s_to_unixtime(m->ref_time), ntp_frac_to_ns(m->ref_time_fb));
  printf("org_time = %u.%09u\n", ntp_s_to_unixtime(m->org_time), ntp_frac_to_ns(m->org_time_fb));

  recv_time.tv_sec = ntp_s_to_unixtime(m->recv_time);
  recv_time.tv_nsec = ntp_frac_to_ns(m->recv_time_fb);
  printf("recv_time = ");
  print_t(&recv_time);
  if(send != NULL) {
    printf(" ");
    print_diff_ts(&recv_time, send);
  }
  printf("\n");

  trans_time.tv_sec = ntp_s_to_unixtime(m->trans_time);
  trans_time.tv_nsec = ntp_frac_to_ns(m->trans_time_fb);
  printf("trans_time = ");
  print_t(&trans_time);
  if(recv != NULL) {
    printf(" ");
    print_diff_ts(&trans_time, recv);
  }
  printf("\n");

  printf("proc time = ");
  print_diff_ts(&trans_time, &recv_time);
  printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movzbl (%rdi), %eax
shrl $0x6, %eax
leaq 0x298e(%rip), %rcx      # 0x40d0
movq (%rcx,%rax,8), %rsi
leaq 0xa6f(%rip), %rdi       # 0x21bc
xorl %eax, %eax
callq 0x1080
movl (%r14), %esi
shrl $0x3, %esi
andl $0x7, %esi
leaq 0xa63(%rip), %rdi       # 0x21c7
xorl %eax, %eax
callq 0x1080
movzbl (%r14), %eax
andl $0x7, %eax
leaq 0x2977(%rip), %rcx      # 0x40f0
movq (%rcx,%rax,8), %rsi
leaq 0xa51(%rip), %rdi       # 0x21d5
xorl %eax, %eax
callq 0x1080
movzbl 0x1(%r14), %esi
leaq 0xa49(%rip), %rdi       # 0x21e0
xorl %eax, %eax
callq 0x1080
movzbl 0x2(%r14), %esi
leaq 0xa44(%rip), %rdi       # 0x21ee
xorl %eax, %eax
callq 0x1080
movsbl 0x3(%r14), %esi
leaq 0xa3c(%rip), %rdi       # 0x21f9
xorl %eax, %eax
callq 0x1080
movzwl 0x4(%r14), %eax
movzwl 0x6(%r14), %ecx
rolw $0x8, %ax
rolw $0x8, %cx
movzwl %ax, %esi
movzwl %cx, %eax
imull $0xf4240, %eax, %edx    # imm = 0xF4240
shrl $0x10, %edx
leaq 0xa1d(%rip), %rdi       # 0x2209
xorl %eax, %eax
callq 0x1080
movzwl 0x8(%r14), %eax
movzwl 0xa(%r14), %ecx
rolw $0x8, %ax
rolw $0x8, %cx
movzwl %ax, %esi
movzwl %cx, %eax
imull $0xf4240, %eax, %edx    # imm = 0xF4240
shrl $0x10, %edx
leaq 0x9ff(%rip), %rdi       # 0x221a
xorl %eax, %eax
callq 0x1080
movl 0xc(%r14), %esi
bswapl %esi
leaq 0xa01(%rip), %rdi       # 0x2230
xorl %eax, %eax
callq 0x1080
movl 0x10(%r14), %eax
movl %eax, %esi
bswapl %esi
movl $0x7c558180, %ebp       # imm = 0x7C558180
addl %ebp, %esi
testl %eax, %eax
cmovel %eax, %esi
movl 0x14(%r14), %eax
bswapl %eax
imulq $0x3b9aca00, %rax, %rdx # imm = 0x3B9ACA00
shrq $0x20, %rdx
leaq 0x9da(%rip), %rdi       # 0x223c
xorl %eax, %eax
callq 0x1080
movl 0x18(%r14), %eax
movl %eax, %esi
bswapl %esi
addl %ebp, %esi
testl %eax, %eax
cmovel %eax, %esi
movl 0x1c(%r14), %eax
bswapl %eax
imulq $0x3b9aca00, %rax, %rdx # imm = 0x3B9ACA00
shrq $0x20, %rdx
leaq 0x9c0(%rip), %rdi       # 0x2250
xorl %eax, %eax
callq 0x1080
movl 0x20(%r14), %eax
movl %eax, %ecx
bswapl %ecx
addl %ebp, %ecx
testl %eax, %eax
cmovel %eax, %ecx
leaq 0x10(%rsp), %r12
movq %rcx, (%r12)
movl 0x24(%r14), %eax
bswapl %eax
imulq $0x3b9aca00, %rax, %rax # imm = 0x3B9ACA00
shrq $0x20, %rax
movq %rax, 0x8(%r12)
leaq 0x998(%rip), %rdi       # 0x2264
xorl %eax, %eax
callq 0x1080
movq %r12, %rdi
callq 0x1c64
testq %r15, %r15
je 0x18f7
movl $0x20, %edi
callq 0x1030
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x1ce2
movl $0xa, %edi
callq 0x1030
movl 0x28(%r14), %eax
movl %eax, %ecx
bswapl %ecx
addl $0x7c558180, %ecx       # imm = 0x7C558180
testl %eax, %eax
cmovel %eax, %ecx
movq %rsp, %r15
movq %rcx, (%r15)
movl 0x2c(%r14), %eax
bswapl %eax
imulq $0x3b9aca00, %rax, %rax # imm = 0x3B9ACA00
shrq $0x20, %rax
movq %rax, 0x8(%r15)
leaq 0x93b(%rip), %rdi       # 0x2271
xorl %eax, %eax
callq 0x1080
movq %r15, %rdi
callq 0x1c64
testq %rbx, %rbx
je 0x195f
movl $0x20, %edi
callq 0x1030
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x1ce2
movl $0xa, %edi
callq 0x1030
leaq 0x90f(%rip), %rdi       # 0x227f
xorl %eax, %eax
callq 0x1080
movq %rsp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1ce2
movl $0xa, %edi
callq 0x1030
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq