// File: /workspace/github_c_makefile_star2_O2/mvermeulen[P]wspy/topdown.c
// Function: print_usage
void print_usage(struct rusage *rusage,enum output_format oformat){
  double elapsed;
  
  elapsed = finish_time.tv_sec + finish_time.tv_nsec / 1000000000.0 -
    start_time.tv_sec - start_time.tv_nsec / 1000000000.0;
  switch(oformat){
  case PRINT_CSV_HEADER:
    fprintf(outfile,"elapsed,utime,stime,");
    break;
  case PRINT_CSV:
    fprintf(outfile,"%4.3f,",elapsed);
    fprintf(outfile,"%4.3f,",(double) rusage->ru_utime.tv_sec + rusage->ru_utime.tv_usec / 1000000.0);
    fprintf(outfile,"%4.3f,",(double) rusage->ru_stime.tv_sec + rusage->ru_stime.tv_usec / 1000000.0);    
    break;
  case PRINT_NORMAL:
    fprintf(outfile,"elapsed              %4.3f\n",elapsed);
    fprintf(outfile,"on_cpu               %4.3f          # %4.2f / %d cores\n",
	    (rusage->ru_utime.tv_sec+rusage->ru_utime.tv_usec/1000000.0+
	     rusage->ru_stime.tv_sec+rusage->ru_stime.tv_usec/1000000.0)/
	    elapsed / num_procs,
	    (rusage->ru_utime.tv_sec+rusage->ru_utime.tv_usec/1000000.0+
	     rusage->ru_stime.tv_sec+rusage->ru_stime.tv_usec/1000000.0)/
	    elapsed,
	    cpu_info->num_cores_available
	    );
    fprintf(outfile,"utime                %4.3f\n",
	    (double) rusage->ru_utime.tv_sec +
	    rusage->ru_utime.tv_usec / 1000000.0);
    fprintf(outfile,"stime                %4.3f\n",
	    (double) rusage->ru_stime.tv_sec +
	    rusage->ru_stime.tv_usec / 1000000.0);
    fprintf(outfile,"nvcsw                %-15lu# %4.2f%%\n",
	    rusage->ru_nvcsw,(double) rusage->ru_nvcsw / (rusage->ru_nvcsw + rusage->ru_nivcsw) * 100.0);
    fprintf(outfile,"nivcsw               %-15lu# %4.2f%%\n",
	    rusage->ru_nivcsw,(double) rusage->ru_nivcsw / (rusage->ru_nvcsw + rusage->ru_nivcsw) * 100.0);
    fprintf(outfile,"inblock              %-15lu# %4.2f/sec\n",
	    rusage->ru_inblock,rusage->ru_inblock/elapsed);
    fprintf(outfile,"onblock              %-15lu# %4.2f/sec\n",
	    rusage->ru_oublock,rusage->ru_oublock/elapsed);
    break;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
cvtsi2sdq 0xcc5f(%rip), %xmm2 # 0x12150
cvtsi2sdq 0xcc5e(%rip), %xmm0 # 0x12158
movq %rdi, %rbx
movsd 0x4ce3(%rip), %xmm1     # 0xa1e8
divsd %xmm1, %xmm0
addsd %xmm2, %xmm0
cvtsi2sdq 0xcc4a(%rip), %xmm3 # 0x12160
cvtsi2sdq 0xcc49(%rip), %xmm2 # 0x12168
subsd %xmm3, %xmm0
divsd %xmm1, %xmm2
subsd %xmm2, %xmm0
testl %esi, %esi
je 0x55d3
cmpl $0x1, %esi
je 0x5566
cmpl $0x2, %esi
jne 0x5765
leaq 0xbbc0(%rip), %rax      # 0x11108
movq (%rax), %rcx
leaq 0x6725(%rip), %rdi      # 0xbc77
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x32d0
leaq 0xbb9b(%rip), %r15      # 0x11108
movq (%r15), %rdi
leaq 0x6715(%rip), %r14      # 0xbc8c
movq %r14, %rsi
movb $0x1, %al
callq 0x31c0
cvtsi2sdq (%rbx), %xmm1
cvtsi2sdq 0x8(%rbx), %xmm0
movq (%r15), %rdi
divsd 0x5329(%rip), %xmm0     # 0xa8c0
addsd %xmm1, %xmm0
movq %r14, %rsi
movb $0x1, %al
callq 0x31c0
movq (%r15), %rdi
cvtsi2sdq 0x10(%rbx), %xmm1
cvtsi2sdq 0x18(%rbx), %xmm0
divsd 0x5304(%rip), %xmm0     # 0xa8c0
addsd %xmm1, %xmm0
movq %r14, %rsi
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x31c0
leaq 0xbb2e(%rip), %r14      # 0x11108
movq (%r14), %rdi
leaq 0x66af(%rip), %rsi      # 0xbc93
movb $0x1, %al
movsd %xmm0, 0x8(%rsp)
callq 0x31c0
cvtsi2sdq (%rbx), %xmm0
cvtsi2sdq 0x8(%rbx), %xmm2
movq (%r14), %rdi
movsd 0x52b9(%rip), %xmm3     # 0xa8c0
divsd %xmm3, %xmm2
addsd %xmm0, %xmm2
cvtsi2sdq 0x10(%rbx), %xmm0
cvtsi2sdq 0x18(%rbx), %xmm1
addsd %xmm2, %xmm0
divsd %xmm3, %xmm1
addsd %xmm0, %xmm1
divsd 0x8(%rsp), %xmm1
leaq 0xbae8(%rip), %rax      # 0x1111c
cvtsi2sdl (%rax), %xmm2
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
leaq 0xcb29(%rip), %rax      # 0x12170
movq (%rax), %rax
movl 0x10(%rax), %edx
leaq 0x665b(%rip), %rsi      # 0xbcaf
movb $0x2, %al
callq 0x31c0
movq (%r14), %rdi
cvtsi2sdq (%rbx), %xmm1
cvtsi2sdq 0x8(%rbx), %xmm0
divsd 0x524f(%rip), %xmm0     # 0xa8c0
addsd %xmm1, %xmm0
leaq 0x666b(%rip), %rsi      # 0xbce7
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
cvtsi2sdq 0x10(%rbx), %xmm1
cvtsi2sdq 0x18(%rbx), %xmm0
divsd 0x5226(%rip), %xmm0     # 0xa8c0
addsd %xmm1, %xmm0
leaq 0x665e(%rip), %rsi      # 0xbd03
movb $0x1, %al
callq 0x31c0
movq 0x80(%rbx), %rdx
cvtsi2sd %rdx, %xmm0
movq 0x88(%rbx), %rax
addq %rdx, %rax
cvtsi2sd %rax, %xmm1
movq (%r14), %rdi
divsd %xmm1, %xmm0
mulsd 0x51f2(%rip), %xmm0     # 0xa8c8
leaq 0x6642(%rip), %rsi      # 0xbd1f
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq 0x88(%rbx), %rdx
cvtsi2sd %rdx, %xmm0
movq 0x80(%rbx), %rax
addq %rdx, %rax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
mulsd 0x51ba(%rip), %xmm0     # 0xa8c8
leaq 0x6630(%rip), %rsi      # 0xbd45
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq 0x58(%rbx), %rdx
cvtsi2sd %rdx, %xmm0
divsd 0x8(%rsp), %xmm0
leaq 0x6636(%rip), %rsi      # 0xbd6b
movb $0x1, %al
callq 0x31c0
movq 0x60(%rbx), %rdx
cvtsi2sd %rdx, %xmm0
movq (%r14), %rdi
divsd 0x8(%rsp), %xmm0
leaq 0x663e(%rip), %rsi      # 0xbd93
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x31c0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq