// File: /workspace/github_c_makefile_star2_O3/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 0xdb9e(%rip), %xmm2 # 0x13140
cvtsi2sdq 0xdb9d(%rip), %xmm0 # 0x13148
movq %rdi, %rbx
movsd 0x5c32(%rip), %xmm1     # 0xb1e8
divsd %xmm1, %xmm0
addsd %xmm2, %xmm0
cvtsi2sdq 0xdb89(%rip), %xmm3 # 0x13150
xorps %xmm2, %xmm2
cvtsi2sdq 0xdb85(%rip), %xmm2 # 0x13158
subsd %xmm3, %xmm0
divsd %xmm1, %xmm2
subsd %xmm2, %xmm0
testl %esi, %esi
je 0x5697
cmpl $0x1, %esi
je 0x561e
cmpl $0x2, %esi
jne 0x5856
leaq 0xcafc(%rip), %rax      # 0x120f8
movq (%rax), %rcx
leaq 0x7671(%rip), %rdi      # 0xcc77
movl $0x14, %esi
movl $0x1, %edx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x32c0
leaq 0xcad3(%rip), %r15      # 0x120f8
movq (%r15), %rdi
leaq 0x765d(%rip), %r14      # 0xcc8c
movq %r14, %rsi
movb $0x1, %al
callq 0x31c0
xorps %xmm1, %xmm1
cvtsi2sdq (%rbx), %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rbx), %xmm0
movq (%r15), %rdi
divsd 0x626b(%rip), %xmm0     # 0xb8c0
addsd %xmm1, %xmm0
movq %r14, %rsi
movb $0x1, %al
callq 0x31c0
movq (%r15), %rdi
xorps %xmm1, %xmm1
cvtsi2sdq 0x10(%rbx), %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x18(%rbx), %xmm0
divsd 0x6240(%rip), %xmm0     # 0xb8c0
addsd %xmm1, %xmm0
movq %r14, %rsi
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x31c0
leaq 0xca5a(%rip), %r14      # 0x120f8
movq (%r14), %rdi
leaq 0x75eb(%rip), %rsi      # 0xcc93
movb $0x1, %al
movsd %xmm0, 0x8(%rsp)
callq 0x31c0
xorps %xmm0, %xmm0
cvtsi2sdq (%rbx), %xmm0
xorps %xmm2, %xmm2
cvtsi2sdq 0x8(%rbx), %xmm2
movq (%r14), %rdi
movsd 0x61ef(%rip), %xmm3     # 0xb8c0
divsd %xmm3, %xmm2
addsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sdq 0x10(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x18(%rbx), %xmm1
addsd %xmm2, %xmm0
divsd %xmm3, %xmm1
addsd %xmm0, %xmm1
divsd 0x8(%rsp), %xmm1
leaq 0xca08(%rip), %rax      # 0x1210c
xorps %xmm2, %xmm2
cvtsi2sdl (%rax), %xmm2
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
leaq 0xda46(%rip), %rax      # 0x13160
movq (%rax), %rax
movl 0x10(%rax), %edx
leaq 0x7588(%rip), %rsi      # 0xccaf
movb $0x2, %al
callq 0x31c0
movq (%r14), %rdi
xorps %xmm1, %xmm1
cvtsi2sdq (%rbx), %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rbx), %xmm0
divsd 0x6176(%rip), %xmm0     # 0xb8c0
addsd %xmm1, %xmm0
leaq 0x7592(%rip), %rsi      # 0xcce7
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
xorps %xmm1, %xmm1
cvtsi2sdq 0x10(%rbx), %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x18(%rbx), %xmm0
divsd 0x6147(%rip), %xmm0     # 0xb8c0
addsd %xmm1, %xmm0
leaq 0x757f(%rip), %rsi      # 0xcd03
movb $0x1, %al
callq 0x31c0
movq 0x80(%rbx), %rdx
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
movq 0x88(%rbx), %rax
addq %rdx, %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movq (%r14), %rdi
divsd %xmm1, %xmm0
mulsd 0x610d(%rip), %xmm0     # 0xb8c8
leaq 0x755d(%rip), %rsi      # 0xcd1f
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq 0x88(%rbx), %rdx
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
movq 0x80(%rbx), %rax
addq %rdx, %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
mulsd 0x60cf(%rip), %xmm0     # 0xb8c8
leaq 0x7545(%rip), %rsi      # 0xcd45
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq 0x58(%rbx), %rdx
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
divsd 0x8(%rsp), %xmm0
leaq 0x7548(%rip), %rsi      # 0xcd6b
movb $0x1, %al
callq 0x31c0
movq 0x60(%rbx), %rdx
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
movq (%r14), %rdi
divsd 0x8(%rsp), %xmm0
leaq 0x754d(%rip), %rsi      # 0xcd93
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x31c0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq