// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/annotationsketch/line_breaker_captions.c
// Function: calculate_drawing_range
int calculate_drawing_range(GtLineBreakerCaptions *lbc, GtDrawingRange *rng,
                            GtBlock* block, GtError *err)
{
  double textwidth = 0.0;
  GtDrawingRange drange;
  gt_assert(block && lbc);
  drange = gt_coords_calc_generic_range(gt_block_get_range(block),
                                        gt_layout_get_range(lbc->layout));
  drange.start *= lbc->width-2*lbc->margins;
  drange.end *= lbc->width-2*lbc->margins;
  if (gt_block_get_caption(block))
  {
    textwidth = gt_text_width_calculator_get_text_width(
                                      gt_layout_get_twc(lbc->layout),
                                      gt_str_get(gt_block_get_caption(block)),
                                      err);
    if (gt_double_smaller_double(textwidth, 0))
      return -1;
    if (gt_double_smaller_double(gt_drawing_range_length(drange), textwidth))
      drange.end = drange.start + textwidth;
  }
  rng->start = drange.start;
  rng->end = drange.end;
  return 0;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq %rdx, 0x88(%rsp)
movq %rcx, 0x80(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x78(%rsp)
cmpq $0x0, 0x88(%rsp)
je 0x46dc6
cmpq $0x0, 0x98(%rsp)
jne 0x46dfe
movq 0x16d20b(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x11728f(%rip), %rsi    # 0x15e066
leaq 0x12207f(%rip), %rdx    # 0x168e5d
leaq 0x122085(%rip), %rcx    # 0x168e6a
leaq 0x122096(%rip), %r8     # 0x168e82
movl $0x2e, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x46e00
movq 0x88(%rsp), %rdi
callq 0xb0380
movq %rax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x46320
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %r8
leaq 0x48(%rsp), %rdi
callq 0xb6300
movq 0x58(%rsp), %rax
movq %rax, 0x70(%rsp)
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x60(%rsp)
movq 0x98(%rsp), %rax
movq 0x18(%rax), %xmm3
movaps 0x117608(%rip), %xmm2   # 0x15e480
punpckldq %xmm2, %xmm3    # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
movapd 0x11760c(%rip), %xmm1   # 0x15e490
subpd %xmm1, %xmm3
movaps %xmm3, %xmm0
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
addsd %xmm0, %xmm3
movsd 0x20(%rax), %xmm0
addsd %xmm0, %xmm0
subsd %xmm0, %xmm3
movsd 0x60(%rsp), %xmm0
mulsd %xmm3, %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x98(%rsp), %rax
movq 0x18(%rax), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x98(%rsp), %rax
movsd 0x20(%rax), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
mulsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movq 0x88(%rsp), %rdi
callq 0xb03f0
cmpq $0x0, %rax
je 0x46fb7
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x46390
movq %rax, 0x20(%rsp)
movq 0x88(%rsp), %rdi
callq 0xb03f0
movq %rax, %rdi
callq 0x19940
movq 0x20(%rsp), %rdi
movq %rax, %rsi
movq 0x80(%rsp), %rdx
callq 0x4c2a0
movsd %xmm0, 0x78(%rsp)
movsd 0x78(%rsp), %xmm0
xorps %xmm1, %xmm1
callq 0x8c360
testb $0x1, %al
jne 0x46f62
jmp 0x46f6f
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0x46fe7
leaq 0x60(%rsp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xb6ab0
movsd 0x78(%rsp), %xmm1
callq 0x8c360
testb $0x1, %al
jne 0x46fa3
jmp 0x46fb5
movsd 0x60(%rsp), %xmm0
addsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
jmp 0x46fb7
movsd 0x60(%rsp), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, (%rax)
movsd 0x68(%rsp), %xmm0
movq 0x90(%rsp), %rax
movsd %xmm0, 0x8(%rax)
movl $0x0, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)