// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/core/mathsupport.c
// Function: gt_mathsupport_unit_test
int gt_mathsupport_unit_test(GtError *err)
{
  int had_err = 0;
  GtUword i;
  double less_than_epsilon = 0.0000000000000001;
  gt_error_check(err);

  gt_ensure(!gt_double_equals_one(1.1));
  gt_ensure(gt_double_equals_one(1));
  gt_ensure(gt_double_equals_one(1+less_than_epsilon));
  gt_ensure(!gt_double_equals_one(-1-less_than_epsilon));

  gt_ensure(!gt_double_equals_double(1.0, 2.0));
  gt_ensure(!gt_double_equals_double(-1.0, 1.0));
  gt_ensure(!gt_double_equals_double(1.0, -1.0));
  gt_ensure(!gt_double_equals_double(-1.0, 1+less_than_epsilon));
  gt_ensure(!gt_double_equals_double(1.0, 1.1));
  gt_ensure(gt_double_equals_double(1.0, 1+less_than_epsilon));
  gt_ensure(gt_double_equals_double(1.0, 1.0));
  gt_ensure(gt_double_equals_double(0.0, 0.0));
  gt_ensure(gt_double_equals_double(-1.0, -1.0));
  gt_ensure(gt_double_equals_double(-1.0+less_than_epsilon, -1.0));
  gt_ensure(gt_double_equals_double(-1.0, -1.0+less_than_epsilon));
  gt_ensure(gt_double_equals_double(1.0+less_than_epsilon, 1.0));
  gt_ensure(gt_double_equals_double(1.0, 1.0+less_than_epsilon));

  gt_ensure(gt_double_compare(1.0, 1.0) == 0);
  gt_ensure(gt_double_compare(1.0, 1.1) < 0);
  gt_ensure(gt_double_compare(1.1, 1.0) > 0);
  gt_ensure(gt_double_compare(1.1, -1.0) > 0);
  gt_ensure(gt_double_compare(-1.1, -1.0) < 0);
  gt_ensure(gt_double_compare(1+less_than_epsilon, 1.0) == 0);
  gt_ensure(gt_double_compare(1+less_than_epsilon, -1.0) > 0);
  gt_ensure(gt_double_compare(-1+less_than_epsilon, -1.0) == 0);
  gt_ensure(gt_double_compare(-1+less_than_epsilon, 1.0) < 0);

  gt_ensure(gt_double_smaller_double(1.0, 1.1));
  gt_ensure(gt_double_smaller_double(-1.0, 1.1));
  gt_ensure(gt_double_smaller_double(-1.1, -1.0));
  gt_ensure(!gt_double_smaller_double(-1.0, -1.1));
  gt_ensure(!gt_double_smaller_double(1.0-less_than_epsilon, 1.0));

  gt_ensure(0L == gt_round_to_long(0.5));
  gt_ensure(1L == gt_round_to_long(0.51));
  gt_ensure(-1L == gt_round_to_long(-0.51));
  gt_ensure(0L == gt_round_to_long(-0.5));
  gt_ensure(-2L == gt_round_to_long(-1.5));
  gt_ensure(-2L == gt_round_to_long(-2.5));
  gt_ensure(-3L == gt_round_to_long(-2.51));

  for (i = 0; !had_err && i < GT_MAXLOG2VALUE; ++i) {
    gt_ensure(i+1 == gt_determinebitspervalue(1UL << i));
    gt_ensure((GtWord) i == gt_round_to_long(
               gt_log_base((double) (1UL << i), (double) 2.0)));
  }
  return had_err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
je 0x7a906
movq %rbx, %rdi
callq 0x34fea
testb %al, %al
jne 0x7aa5e
xorl %r12d, %r12d
xorl %r14d, %r14d
movl $0x1, %r15d
movl %r14d, %ecx
shlq %cl, %r15
movq %r15, %rdi
callq 0x7a629
movl %eax, %eax
incq %r14
cmpq %rax, %r14
jne 0x7a9fa
xorps %xmm0, %xmm0
cvtsi2sd %r15, %xmm0
callq 0xb4d0
divsd 0x77005(%rip), %xmm0    # 0xf1948
movsd %xmm0, (%rsp)
callq 0xb0e0
movsd (%rsp), %xmm4
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
subsd %xmm4, %xmm2
xorl %eax, %eax
xorl %ecx, %ecx
movsd 0x6fce6(%rip), %xmm3    # 0xea650
ucomisd %xmm3, %xmm2
movapd %xmm3, %xmm2
subsd %xmm4, %xmm1
setae %al
seta %cl
movsd 0x76fa4(%rip), %xmm3    # 0xf1928
ucomisd %xmm1, %xmm3
movapd %xmm0, %xmm1
addsd 0x7077c(%rip), %xmm1    # 0xeb110
cmoval %ecx, %eax
testb %al, %al
jne 0x7a99f
movapd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
subsd %xmm4, %xmm0
andpd 0x72788(%rip), %xmm0    # 0xed140
movl %eax, %ecx
andl $0x1, %ecx
negq %rcx
movq %rax, %rdx
sarq $0x3e, %rdx
orq $0x1, %rdx
ucomisd %xmm2, %xmm0
cmovneq %r12, %rdx
cmovpq %r12, %rdx
andq %rcx, %rdx
subq %rdx, %rax
decq %r14
cmpq %rax, %r14
jne 0x7aa21
leaq 0x1(%r14), %rax
cmpq $0x3e, %r14
movq %rax, %r14
jb 0x7a90c
xorl %eax, %eax
jmp 0x7aa52
leaq 0x68758(%rip), %rsi     # 0xe3159
leaq 0x770cb(%rip), %rdx     # 0xf1ad3
leaq 0x770ab(%rip), %rcx     # 0xf1aba
leaq 0x76f46(%rip), %r8      # 0xf195c
movq %rbx, %rdi
movl $0x143, %r9d            # imm = 0x143
jmp 0x7aa46
leaq 0x68731(%rip), %rsi     # 0xe3159
leaq 0x770ce(%rip), %rdx     # 0xf1afd
leaq 0x77084(%rip), %rcx     # 0xf1aba
leaq 0x76f1f(%rip), %r8      # 0xf195c
movq %rbx, %rdi
movl $0x145, %r9d            # imm = 0x145
xorl %eax, %eax
callq 0x34f1f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x1cd09
nop