LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/stringop.c
// Function: vl_enumeration_get
VL_EXPORT VlEnumerator *
vl_enumeration_get (VlEnumerator const *enumeration, char const *name)
{
  assert(enumeration) ;
  while (enumeration->name) {
    if (strcmp(name, enumeration->name) == 0) return (VlEnumerator*)enumeration ;
    enumeration ++ ;
  }
  return NULL ;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x2a5f2
movq %r14, %rdi
callq 0x9540
testl %eax, %eax
je 0x2a5f4
addq $0x10, %rbx
jmp 0x2a5d8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/stringop.c
// Function: vl_enumeration_get_casei
VL_EXPORT VlEnumerator *
vl_enumeration_get_casei (VlEnumerator const *enumeration, char const *name)
{
  assert(enumeration) ;
  while (enumeration->name) {
    if (vl_string_casei_cmp(name, enumeration->name) == 0) return (VlEnumerator*)enumeration ;
    enumeration ++ ;
  }
  return NULL ;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x2a623
movq %r14, %rdi
callq 0x9aa0
testl %eax, %eax
je 0x2a625
addq $0x10, %rbx
jmp 0x2a609
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/stringop.c
// Function: vl_enumeration_get_by_value
VL_EXPORT VlEnumerator *
vl_enumeration_get_by_value (VlEnumerator const *enumeration, vl_index value)
{
  assert(enumeration) ;
  while (enumeration->name) {
    if (enumeration->value == value) return (VlEnumerator*)enumeration ;
    enumeration ++ ;
  }
  return NULL ;
}

// Assembly:
movq %rdi, %rax
cmpq $0x0, (%rax)
je 0x2a645
cmpq %rsi, 0x8(%rax)
je 0x2a647
addq $0x10, %rax
jmp 0x2a633
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svm.c
// Function: vl_svm_new
VlSvm *
vl_svm_new (VlSvmSolverType type,
            double const * data,
            vl_size dimension,
            vl_size numData,
            double const * labels,
            double lambda)
{
  VlSvmDataset * dataset = vl_svmdataset_new(VL_TYPE_DOUBLE, (void*)data, dimension, numData) ;
  VlSvm * self = vl_svm_new_with_dataset (type, dataset, labels, lambda) ;
  self->ownDataset = dataset ;
  return self ;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movsd %xmm0, 0x8(%rsp)
movq %r8, %rbx
movl %edi, %ebp
pushq $0x2
popq %rdi
callq 0x9310
movq %rax, %r14
movl %ebp, %edi
movq %rax, %rsi
movq %rbx, %rdx
movsd 0x8(%rsp), %xmm0
callq 0x9380
movq %r14, 0x50(%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svm.c
// Function: vl_svm_new_with_dataset
VlSvm *
vl_svm_new_with_dataset (VlSvmSolverType solver,
                         VlSvmDataset * dataset,
                         double const * labels,
                         double lambda)
{
  VlSvm * self = vl_svm_new_with_abstract_data (solver,
                                             dataset,
                                             vl_svmdataset_get_dimension(dataset),
                                             vl_svmdataset_get_num_data(dataset),
                                             labels,
                                             lambda) ;
  vl_svm_set_data_functions (self,
                             vl_svmdataset_get_inner_product_function(dataset),
                             vl_svmdataset_get_accumulate_function(dataset)) ;
  return self ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movq %rsi, %rdi
callq 0x9220
movq %rax, %r15
movq %r14, %rdi
callq 0x9680
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
movq %rax, %rcx
movq %rbx, %r8
movsd (%rsp), %xmm0
callq 0x9ad0
movq %rax, %rbx
movq %r14, %rdi
callq 0x93f0
movq %rax, %r15
movq %r14, %rdi
callq 0x91f0
movq %r15, 0x90(%rbx)
movq %rax, 0x98(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svm.c
// Function: vl_svm_delete
void
vl_svm_delete (VlSvm * self)
{
  if (self->model) {
    vl_free (self->model) ;
    self->model = 0 ;
  }
  if (self->alpha) {
    vl_free (self->alpha) ;
    self->alpha = 0 ;
  }
  if (self->ownDataset) {
    vl_svmdataset_delete(self->ownDataset) ;
    self->ownDataset = 0 ;
  }
  vl_free (self) ;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x2a9c6
callq 0x95b0
andq $0x0, 0x10(%rbx)
movq 0x120(%rbx), %rdi
testq %rdi, %rdi
je 0x2a9df
callq 0x95b0
andq $0x0, 0x120(%rbx)
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x2a9f2
callq 0x90a0
andq $0x0, 0x50(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x95b0
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svm.c
// Function: vl_svm_l1_dca_update
double
vl_svm_l1_dca_update (double alpha, double inner, double norm2, double label) {
  if (vl_abs_d(alpha) <= 1) {
    double palpha = (label - inner) / norm2 + alpha ;
    return VL_MAX(-1.0, VL_MIN(1.0, palpha)) - alpha ;
  } else {
    return VL_INFINITY_D ;
  }
}

// Assembly:
movapd 0x2494(%rip), %xmm5     # 0x2d0e0
andpd %xmm0, %xmm5
movsd 0x25e0(%rip), %xmm4     # 0x2d238
ucomisd %xmm5, %xmm4
jae 0x2ac68
movsd 0x2f5a(%rip), %xmm1     # 0x2dbc0
jmp 0x2ac88
subsd %xmm1, %xmm3
divsd %xmm2, %xmm3
addsd %xmm0, %xmm3
minsd %xmm3, %xmm4
movsd 0x2548(%rip), %xmm1     # 0x2d1c8
maxsd %xmm4, %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svm.c
// Function: vl_svm_logistic_loss
double
vl_svm_logistic_loss (double inner,double label)
{
  double z = label * inner ;
  if (z >= 0) {
    return log(1.0 + exp(-z)) ;
  } else {
    return -z + log(exp(z) + 1.0) ;
  }
}

// Assembly:
subq $0x18, %rsp
mulsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x2ad10
movapd %xmm0, (%rsp)
callq 0x9ae0
addsd 0x2537(%rip), %xmm0     # 0x2d238
callq 0x9450
subsd (%rsp), %xmm0
addq $0x18, %rsp
retq
xorpd 0x2388(%rip), %xmm0     # 0x2d0a0
callq 0x9ae0
addsd 0x2513(%rip), %xmm0     # 0x2d238
addq $0x18, %rsp
jmp 0x9450
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svm.c
// Function: vl_svm_logistic_conjugate_loss
double
vl_svm_logistic_conjugate_loss (double u, double label) {
  double z = label * u ;
  if (-1 <= z && z <= 0) {
    return xlogx(-z) + xlogx(1+z) ;
  } else {
    return VL_INFINITY_D ;
  }
}

// Assembly:
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
ucomisd 0x2446(%rip), %xmm2     # 0x2d1c8
movsd 0x2e36(%rip), %xmm0     # 0x2dbc0
jb 0x2add4
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
jb 0x2add4
subq $0x28, %rsp
movapd 0x22fe(%rip), %xmm0     # 0x2d0a0
xorpd %xmm2, %xmm0
movapd %xmm2, 0x10(%rsp)
callq 0x2af8b
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
addsd 0x2473(%rip), %xmm0     # 0x2d238
callq 0x2af8b
addsd 0x8(%rsp), %xmm0
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svm.c
// Function: vl_svm_evaluate
void _vl_svm_evaluate (VlSvm *self)
{
  double startTime = vl_get_cpu_time () ;

  _vl_svm_update_statistics (self) ;

  self->statistics.elapsedTime = vl_get_cpu_time() - startTime ;
  self->statistics.iteration = 0 ;
  self->statistics.epoch = 0 ;
  self->statistics.status = VlSvmStatusConverged ;

  if (self->diagnosticFn) {
    self->diagnosticFn(self, self->diagnosticFnData) ;
  }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x9370
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2afba
callq 0x9370
subsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x108(%rbx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0xc0(%rbx)
movl $0x2, 0xb8(%rbx)
movq 0x58(%rbx), %rax
testq %rax, %rax
je 0x2b1f7
movq 0x60(%rbx), %rsi
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
jmpq *%rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svmdataset.c
// Function: vl_svmdataset_inner_product_f
double
VL_XCAT(_vl_svmdataset_inner_product_,SFX) (VlSvmDataset const *self,
                                            vl_uindex element,
                                            double const *model)
{
  double product = 0 ;
  T* data = ((T*)self->data) + self->dimension * element ;
  T* end = data + self->dimension ;
  while (data != end) {
    product += (*data++) * (*model++) ;
  }
  return product ;
}

// Assembly:
movq 0x18(%rdi), %rax
imulq %rax, %rsi
shlq $0x2, %rsi
addq 0x8(%rdi), %rsi
shlq $0x2, %rax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x2b8ff
cvtss2sd (%rsi,%rcx), %xmm1
mulsd (%rdx,%rcx,2), %xmm1
addsd %xmm1, %xmm0
addq $0x4, %rcx
jmp 0x2b8e6
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svmdataset.c
// Function: vl_svmdataset_accumulate_f
void
VL_XCAT(vl_svmdataset_accumulate_,SFX)(VlSvmDataset const *self,
                                       vl_uindex element,
                                       double *model,
                                       const double multiplier)
{
  T* data = ((T*)self->data) + self->dimension * element ;
  T* end = data + self->dimension ;
  while (data != end) {
    *model += (*data++) * multiplier ;
    model++ ;
  }
}

// Assembly:
movq 0x18(%rdi), %rax
imulq %rax, %rsi
shlq $0x2, %rsi
addq 0x8(%rdi), %rsi
shlq $0x2, %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x2b934
cvtss2sd (%rsi,%rcx), %xmm1
mulsd %xmm0, %xmm1
addsd (%rdx,%rcx,2), %xmm1
movsd %xmm1, (%rdx,%rcx,2)
addq $0x4, %rcx
jmp 0x2b916
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svmdataset.c
// Function: vl_svmdataset_inner_product_hom_f
double
VL_XCAT(_vl_svmdataset_inner_product_hom_,SFX) (VlSvmDataset const *self,
                                                vl_uindex element,
                                                double const *model)
{
  double product = 0 ;
  T* data = ((T*)self->data) + self->dimension * element ;
  T* end = data + self->dimension ;
  T* bufEnd = ((T*)self->homBuffer)+ self->homDimension ;
  while (data != end) {
    /* TODO: zeros in data could be optimized by skipping over them */
    T* buf = self->homBuffer ;
    VL_XCAT(vl_homogeneouskernelmap_evaluate_,SFX)(self->hom,
                                                   self->homBuffer,
                                                   1,
                                                   (*data++)) ;
    while (buf != bufEnd) {
      product += (*buf++) * (*model++) ;
    }
  }
  return product ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x18(%rdi), %rax
movq 0x30(%rdi), %rbp
imulq %rax, %r14
shlq $0x2, %r14
addq 0x8(%rdi), %r14
leaq (%r14,%rax,4), %r12
shlq $0x2, %rbp
addq 0x28(%rdi), %rbp
xorpd %xmm1, %xmm1
cmpq %r12, %r14
je 0x2b9b7
movq 0x20(%r15), %rdi
movq 0x28(%r15), %r13
cvtss2sd (%r14), %xmm0
movq %r13, %rsi
pushq $0x1
popq %rdx
movsd %xmm1, (%rsp)
callq 0x96d0
movsd (%rsp), %xmm1
cmpq %rbp, %r13
je 0x2b9b1
cvtss2sd (%r13), %xmm0
addq $0x4, %r13
mulsd (%rbx), %xmm0
addq $0x8, %rbx
addsd %xmm0, %xmm1
jmp 0x2b994
addq $0x4, %r14
jmp 0x2b96d
movapd %xmm1, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svmdataset.c
// Function: vl_svmdataset_accumulate_hom_f
void
VL_XCAT(vl_svmdataset_accumulate_hom_,SFX)(VlSvmDataset const *self,
                                           vl_uindex element,
                                           double *model,
                                           const double multiplier)
{
  T* data = ((T*)self->data) + self->dimension * element ;
  T* end = data + self->dimension ;
  T* bufEnd = ((T*)self->homBuffer)+ self->homDimension ;
  while (data != end) {
    /* TODO: zeros in data could be optimized by skipping over them */
    T* buf = self->homBuffer ;
    VL_XCAT(vl_homogeneouskernelmap_evaluate_,SFX)(self->hom,
                                                   self->homBuffer,
                                                   1,
                                                   (*data++)) ;
    while (buf != bufEnd) {
      *model += (*buf++) * multiplier ;
      model++ ;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x18(%rdi), %rax
movq 0x30(%rdi), %rbp
imulq %rax, %r14
shlq $0x2, %r14
addq 0x8(%rdi), %r14
leaq (%r14,%rax,4), %r12
shlq $0x2, %rbp
addq 0x28(%rdi), %rbp
movsd %xmm0, (%rsp)
cmpq %r12, %r14
je 0x2ba4c
movq 0x20(%r15), %rdi
movq 0x28(%r15), %r13
cvtss2sd (%r14), %xmm0
movq %r13, %rsi
pushq $0x1
popq %rdx
callq 0x96d0
movsd (%rsp), %xmm1
cmpq %rbp, %r13
je 0x2ba46
cvtss2sd (%r13), %xmm0
addq $0x4, %r13
mulsd %xmm1, %xmm0
addsd (%rbx), %xmm0
movsd %xmm0, (%rbx)
addq $0x8, %rbx
jmp 0x2ba25
addq $0x4, %r14
jmp 0x2ba03
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svmdataset.c
// Function: vl_svmdataset_new
VlSvmDataset*
vl_svmdataset_new (vl_type dataType, void *data, vl_size dimension, vl_size numData)
{
  VlSvmDataset * self ;
  assert(dataType == VL_TYPE_DOUBLE || dataType == VL_TYPE_FLOAT) ;
  assert(data) ;

  self = vl_calloc(1, sizeof(VlSvmDataset)) ;
  if (self == NULL) return NULL ;

  self->dataType = dataType ;
  self->data = data ;
  self->dimension = dimension ;
  self->numData = numData ;
  self->hom = NULL ;
  self->homBuffer = NULL ;
  return self ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
pushq $0x1
popq %rdi
pushq $0x38
popq %rsi
callq 0x9960
testq %rax, %rax
je 0x2bc21
movl %ebp, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svmdataset.c
// Function: vl_svmdataset_delete
void vl_svmdataset_delete (VlSvmDataset *self)
{
  if (self->homBuffer) {
    vl_free(self->homBuffer) ;
    self->homBuffer = 0 ;
  }
  vl_free (self) ;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x2bc43
callq 0x95b0
andq $0x0, 0x28(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x95b0
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/vl/svmdataset.c
// Function: vl_svmdataset_set_homogeneous_kernel_map
void
vl_svmdataset_set_homogeneous_kernel_map (VlSvmDataset * self,
                                          VlHomogeneousKernelMap * hom)
{
  assert(self) ;
  self->hom = hom ;
  self->homDimension = 0 ;
  if (self->homBuffer) {
    vl_free (self->homBuffer) ;
    self->homBuffer = 0 ;
  }
  if (self->hom) {
    self->homDimension = vl_homogeneouskernelmap_get_dimension(self->hom) ;
    self->homBuffer = vl_calloc(self->homDimension, vl_get_type_size(self->dataType)) ;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq %rsi, 0x20(%rdi)
andq $0x0, 0x30(%rdi)
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x2bc9b
callq 0x95b0
andq $0x0, 0x28(%rbx)
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
je 0x2bcce
movq %rsi, %rdi
callq 0x9a20
movq %rax, 0x30(%rbx)
movl (%rbx), %ecx
decl %ecx
cmpl $0xa, %ecx
jae 0x2bcd0
movl %ecx, %ecx
leaq 0x273a(%rip), %rdx      # 0x2e3f8
movq (%rdx,%rcx,8), %rsi
movq %rax, %rdi
callq 0x9960
movq %rax, 0x28(%rbx)
popq %rbx
retq
callq 0x90b0
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/tests/number.c
// Function: test_prime
void test_prime(const char *s)
{
	struct tt_int *ti = tt_int_alloc();
	tt_int_from_string(ti, s);

	if (tt_int_isprime(ti))
		printf("Prime: ");
	else
		printf("Composite: ");
	printf("%s\n", s);

	tt_int_free(ti);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3e50
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42b0
movq %r14, %rdi
callq 0x7d0d
leaq 0x8d1f(%rip), %rcx      # 0xa004
leaq 0x8d20(%rip), %rdi      # 0xa00c
testb %al, %al
cmovneq %rcx, %rdi
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x1060
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3eaa
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/tests/number.c
// Function: nth_prime
void nth_prime(uint n)
{
	printf("%d-th prime: ", n);

	if (n == 1) {
		printf("2\n");
		return;
	}

	struct tt_int *ti = tt_int_alloc();
	struct tt_int *two = tt_int_alloc();
	tt_int_from_uint(ti, 1);
	tt_int_from_uint(two, 2);

	while (--n) {
		tt_int_add(ti, ti, two);
		while (!tt_int_isprime(ti))
			tt_int_add(ti, ti, two);
	}

	char *s = NULL;
	tt_int_to_string(ti, &s, 10);
	printf("%s\n", s);

	free(s);
	tt_int_free(ti);
	tt_int_free(two);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebp
leaq 0x8cf8(%rip), %rdi      # 0xa018
movl %ebp, %esi
xorl %eax, %eax
callq 0x10c0
cmpl $0x1, %ebp
jne 0x1344
leaq 0x8d76(%rip), %rdi      # 0xa0ab
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1060
callq 0x3e50
movq %rax, %rbx
callq 0x3e50
movq %rax, %r14
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x4c9c
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x4c9c
decl %ebp
je 0x138a
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x606f
movq %rbx, %rdi
callq 0x7d0d
testb %al, %al
je 0x136e
jmp 0x136a
movq %rsp, %r15
andq $0x0, (%r15)
pushq $0xa
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4603
movq (%r15), %rdi
callq 0x1060
movq (%r15), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x3eaa
movq %r14, %rdi
callq 0x3eaa
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/tests/number.c
// Function: test_mersenne
void test_mersenne(void)
{
	/* Mersenne number: 2^N - 1 */
	#define N	521
	const int n = N + 1;
	int sz = (n + _tt_word_bits - 1) / _tt_word_bits;
	_tt_word m[sz+1];
	m[sz] = 0;
	for (int i = 0; i < sz-1; i++)
		m[i] = ~_tt_word_top_bit;
	m[sz-1] = (1 << (n - _tt_word_bits*(sz-1) - 1)) - 1;
	if (m[sz-1] == 0)
		sz--;
	struct tt_int ti = _TT_INT_DECL(sz, m);

	if (tt_int_isprime(&ti))
		printf("Prime: ");
	else
		printf("Composite: ");
	printf("2^%d - 1\n", N);
}

// Assembly:
subq $0x78, %rsp
andq $0x0, 0x68(%rsp)
xorl %eax, %eax
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
cmpq $0x8, %rax
je 0x13f0
movq %rcx, 0x20(%rsp,%rax,8)
incq %rax
jmp 0x13e0
leaq 0x20(%rsp), %rax
movq $0x1ffff, 0x40(%rax)    # imm = 0x1FFFF
movabsq $0x900000000, %rcx      # imm = 0x900000000
leaq 0x8(%rsp), %rdi
movq %rcx, (%rdi)
movl $0x9, 0x8(%rdi)
movq %rax, 0x10(%rdi)
callq 0x7d0d
leaq 0x8bde(%rip), %rcx      # 0xa004
leaq 0x8bdf(%rip), %rdi      # 0xa00c
testb %al, %al
cmovneq %rcx, %rdi
xorl %eax, %eax
callq 0x10c0
leaq 0x8be5(%rip), %rdi      # 0xa026
movl $0x209, %esi            # imm = 0x209
xorl %eax, %eax
callq 0x10c0
addq $0x78, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/tests/number.c
// Function: prime_distribute
void prime_distribute(void)
{
	printf("Testing prime distribution...\n");

	#define NN	8

	_tt_word r[NN];
	struct tt_int ti = _TT_INT_DECL(NN, r);

	/* In theory, there're about 100 primes in pcnt100 tries  */
	uint pcnt100 = (uint)(log(2.0) * _tt_word_bits * NN * 100.0);
	uint pcnt = 0;

	for (int i = 0; i < pcnt100; i++) {
		/* Generate random integer with 1 ~ N words */
		for (int j = 0; j < NN; j++) {
			r[j] = _tt_rand() & ~BIT(31);
#ifdef _TT_LP64_
			r[j] <<= 32;
			r[j] |= _tt_rand();
#endif
		}
		ti.msb = _tt_int_get_msb(r, NN);

		if (tt_int_isprime(&ti))
			pcnt++;
	}

	printf("%d primes found\n", pcnt);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x8c46(%rip), %rdi      # 0xa0ad
callq 0x1060
movabsq $0x800000000, %rax      # imm = 0x800000000
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movl $0x8, 0x8(%r14)
leaq 0x20(%rsp), %r15
movq %r15, 0x10(%r14)
xorl %ebx, %ebx
pushq $0x8
popq %rbp
xorl %r12d, %r12d
cmpl $0x8876, %r12d          # imm = 0x8876
je 0x14ed
xorl %r13d, %r13d
cmpq $0x8, %r13
je 0x14cd
callq 0x832a
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shlq $0x20, %rax
movq %rax, 0x20(%rsp,%r13,8)
callq 0x832a
movl %eax, %eax
orq %rax, 0x20(%rsp,%r13,8)
incq %r13
jmp 0x14a3
movq %r15, %rdi
movl %ebp, %esi
callq 0x4df9
movl %eax, 0x10(%rsp)
movq %r14, %rdi
callq 0x7d0d
movzbl %al, %eax
addl %eax, %ebx
incl %r12d
jmp 0x1497
leaq 0x8b3c(%rip), %rdi      # 0xa030
movl %ebx, %esi
xorl %eax, %eax
callq 0x10c0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/tests/number.c
// Function: rand_int
struct tt_int *rand_int(int msb)
{
	struct tt_int *ti = tt_int_alloc();
	if (_tt_int_realloc(ti, msb))
		return NULL;

	ti->msb = msb;
#ifdef _TT_LP64_
	for (int i = 0; i < msb-1; i++) {
		ti->buf[i] = _tt_rand() & ~(1<<31);
		ti->buf[i] <<= 32;
		ti->buf[i] |= _tt_rand();
	}
	do {
		ti->buf[msb-1] = _tt_rand() & ~(1<<31);
	} while (ti->buf[msb-1] == 0);
	ti->buf[msb-1] <<= 32;
	ti->buf[msb-1] |= _tt_rand();
#else
	for (int i = 0; i < msb-1; i++)
		ti->buf[i] = _tt_rand() & ~(1<<31);
	do {
		ti->buf[msb-1] = _tt_rand() & ~(1<<31);
	} while (ti->buf[msb-1] == 0);
#endif

	return ti;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebp
callq 0x3e50
movq %rax, %rbx
movq %rax, %rdi
movl %ebp, %esi
callq 0x3ec0
xorl %r14d, %r14d
testl %eax, %eax
je 0x1532
xorl %ebx, %ebx
jmp 0x15a0
movl %ebp, 0x8(%rbx)
decl %ebp
testl %ebp, %ebp
movl $0x0, %r15d
cmovgl %ebp, %r15d
cmpq %r14, %r15
je 0x1572
callq 0x832a
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x10(%rbx), %rcx
shlq $0x20, %rax
movq %rax, (%rcx,%r14,8)
callq 0x832a
movl %eax, %eax
movq 0x10(%rbx), %rcx
orq %rax, (%rcx,%r14,8)
incq %r14
jmp 0x1543
movslq %ebp, %r14
callq 0x832a
movq 0x10(%rbx), %rcx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, (%rcx,%r14,8)
je 0x1575
shlq $0x20, %rax
movq %rax, (%rcx,%r14,8)
callq 0x832a
movl %eax, %eax
movq 0x10(%rbx), %rcx
orq %rax, (%rcx,%r14,8)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/tests/number.c
// Function: test_gcd
void test_gcd(void)
{
#if 1
	printf("Testing GCD...\n");

	struct tt_int *u = tt_int_alloc();
	struct tt_int *v = tt_int_alloc();
	struct tt_int *g = tt_int_alloc();

#define GCD_MAX_MSB	100
#define GCD_COUNT	1000
	for (int i = 0; i < GCD_COUNT; i++) {
		struct tt_int *a = rand_int(_tt_rand() % GCD_MAX_MSB + 1);
		struct tt_int *b = rand_int(_tt_rand() % GCD_MAX_MSB + 1);

		tt_int_extgcd(g, u, v, a, b);

		tt_int_mul(u, a, u);
		tt_int_mul(v, b, v);
		tt_int_add(u, u, v);

		if (tt_int_cmp(g, u)) {
			tt_error("GCD test failed!");
			_tt_int_print(a);
			_tt_int_print(b);
			break;
		}

		tt_int_free(a);
		tt_int_free(b);
	}

	tt_int_free(u);
	tt_int_free(v);
	tt_int_free(g);

	printf("Done\n");
#else
	const char *a = "9903824712476097189547457927456428897123434496";
	const char *b = "7417779112426492492240709295800320";

	struct tt_int *tia = tt_int_alloc();
	struct tt_int *tib = tt_int_alloc();
	struct tt_int *tig = tt_int_alloc();
	struct tt_int *tiu = tt_int_alloc();
	struct tt_int *tiv = tt_int_alloc();

	tt_int_from_string(tia, a);
	tt_int_from_string(tib, b);

	tt_int_extgcd(tig, tiu, tiv, tia, tib);

	char *g = NULL, *u = NULL, *v = NULL;
	tt_int_to_string(tig, &g, 10);
	tt_int_to_string(tiu, &u, 10);
	tt_int_to_string(tiv, &v, 10);
	printf("%s = ", g);
	printf("%s * %s %s %s * %s\n", u, a, tiv->sign?"\b":"+", v, b);

	free(g);
	free(u);
	free(v);
	tt_int_free(tia);
	tt_int_free(tib);
	tt_int_free(tig);
	tt_int_free(tiu);
	tt_int_free(tiv);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x8b0b(%rip), %rdi      # 0xa0cb
callq 0x1060
callq 0x3e50
movq %rax, %rbx
callq 0x3e50
movq %rax, %r14
movl $0x3e8, %ebp            # imm = 0x3E8
callq 0x3e50
movq %rax, %r15
subl $0x1, %ebp
jb 0x16a2
callq 0x832a
xorl %edx, %edx
pushq $0x64
popq %r13
divl %r13d
leal 0x1(%rdx), %edi
callq 0x150c
movq %rax, %r12
callq 0x832a
xorl %edx, %edx
divl %r13d
leal 0x1(%rdx), %edi
callq 0x150c
movq %rax, %r13
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x6c8c
movq %rbx, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x6207
movq %r14, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x6207
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x606f
movq %r15, %rdi
movq %rbx, %rsi
callq 0x668b
testl %eax, %eax
jne 0x167b
movq %r12, %rdi
callq 0x3eaa
movq %r13, %rdi
callq 0x3eaa
jmp 0x15e2
leaq 0x89bf(%rip), %rsi      # 0xa041
leaq 0x89c1(%rip), %rdx      # 0xa04a
xorl %edi, %edi
xorl %eax, %eax
callq 0x7de8
movq %r12, %rdi
callq 0x405b
movq %r13, %rdi
callq 0x405b
movq %rbx, %rdi
callq 0x3eaa
movq %r14, %rdi
callq 0x3eaa
movq %r15, %rdi
callq 0x3eaa
leaq 0x8a19(%rip), %rdi      # 0xa0da
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1060
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/tests/number.c
// Function: gen_prime
int gen_prime(int bits, _tt_word **pp)
{
	int msb = (bits+_tt_word_bits-1)/_tt_word_bits;
	tt_assert(msb >= 2);

	bits %= _tt_word_bits;
	*pp = malloc(msb*_tt_word_sz);
	_tt_word *p = *pp;

	while (1) {
		for (int i = 0; i < msb; i++) {
			p[i] = _tt_rand() & ~BIT(31);
#ifdef _TT_LP64_
			p[i] <<= 32;
			p[i] |= _tt_rand();
#endif
		}
		/* Set highest two bits and lowest bit */
		p[0] |= 0x1;
		if (bits == 0) {
			p[msb-1] |= (_tt_word_top_bit >> 1) |
				(_tt_word_top_bit >> 2);
		} else if (bits == 1) {
			p[msb-1] = 1;
			p[msb-2] |= _tt_word_top_bit >> 1;
		} else {
			p[msb-1] |= 0x3ULL << (bits-2);
			p[msb-1] &= (1ULL << bits) - 1;
		}

		if (_tt_int_isprime_buf(p, msb))
			break;
	}

	return msb;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leal 0x3e(%rdi), %eax
pushq $0x3f
popq %rcx
cltd
idivl %ecx
cmpl $0x3f, %edi
jle 0x19d1
movq %rsi, %r12
movl %eax, %ebx
xorl %r13d, %r13d
movl %edi, %eax
xorl %edx, %edx
divl %ecx
movl %edx, %r14d
leal (,%rbx,8), %edi
callq 0x1140
movq %rax, %r15
leal -0x2(%r14), %ecx
pushq $0x3
popq %rax
shlq %cl, %rax
movq %rax, (%rsp)
movq %r15, (%r12)
movl %ebx, %r12d
pushq $-0x1
popq %rbp
movl %r14d, %ecx
shlq %cl, %rbp
notq %rbp
cmpq %r12, %r13
jne 0x1971
orb $0x1, (%r15)
testl %r14d, %r14d
je 0x1993
cmpl $0x1, %r14d
jne 0x199b
movq $0x1, -0x8(%r15,%r12,8)
orb $0x40, -0x9(%r15,%r12,8)
jmp 0x19ac
callq 0x832a
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shlq $0x20, %rax
movq %rax, (%r15,%r13,8)
callq 0x832a
movl %eax, %eax
orq %rax, (%r15,%r13,8)
incq %r13
jmp 0x194c
orb $0x60, -0x1(%r15,%r12,8)
jmp 0x19ac
movq -0x8(%r15,%r12,8), %rax
orq (%rsp), %rax
andq %rbp, %rax
movq %rax, -0x8(%r15,%r12,8)
movq %r15, %rdi
movl %ebx, %esi
callq 0x7464
movl $0x0, %r13d
testb %al, %al
je 0x194c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x86a0(%rip), %rsi      # 0xa078
leaq 0x86a3(%rip), %rdx      # 0xa082
leaq 0x86b6(%rip), %rcx      # 0xa09c
xorl %edi, %edi
movl $0x12d, %r8d            # imm = 0x12D
xorl %eax, %eax
callq 0x7de8
callq 0x1050
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/decimal.c
// Function: tt_dec_alloc
struct tt_dec *tt_dec_alloc(uint prec)
{
	if (prec == 0) {
		prec = CONFIG_DEC_DIGITS;
	} else if (prec < 20) {
		prec = 20;	/* int64:20, double:17 */
	} else if (prec > CONFIG_DEC_DIGITS_MAX) {
		tt_error("Unsupported precision!");
		return NULL;
	}

	/* Check digit buffer size */
	int prec_full = prec;
        prec_full += TT_DEC_PREC_RND;	/* Rounding guard */
	prec_full += TT_DEC_PREC_CRY;	/* Carry digit */
	prec_full += TT_DEC_PREC_ALN;	/* Align-9 shifting */

	/* 9 digits -> 4 bytes */
	int digsz = prec_full;
	digsz += 8;
	digsz /= 9;

	/* Create decimal */
	struct tt_dec *dec = calloc(1, sizeof(struct tt_dec));
	dec->_dig32 = calloc(digsz, 4);
	if (dec->_dig32 == NULL) {
		tt_error("Out of memory");
		free(dec);
		return NULL;
	}
	*(int*)&dec->_prec = prec;
	*(int*)&dec->_prec_full = prec_full;
	*(uint*)&dec->_digsz = digsz * 4;
	dec->_msb = 1;
	tt_debug("Decimal created: %u bytes", dec->_digsz);

	return dec;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testl %edi, %edi
je 0x1a2d
movl %edi, %r14d
cmpl $0x14, %edi
jae 0x1abc
pushq $0x14
jmp 0x1a2f
pushq $0x3c
popq %r14
leal 0x1a(%r14), %eax
pushq $0x9
popq %rcx
xorl %edx, %edx
divl %ecx
movl %eax, %r15d
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0x1100
movq %rax, %rbx
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0x1100
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x1a99
movl %r14d, 0x8(%rbx)
addl $0x12, %r14d
movl %r14d, 0xc(%rbx)
shll $0x2, %r15d
movl %r15d, 0x10(%rbx)
movl $0x1, 0x14(%rbx)
leaq 0x14c9d(%rip), %rsi     # 0x16720
leaq 0x14cc8(%rip), %rdx     # 0x16752
pushq $0x3
popq %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x7de8
jmp 0x1ae2
leaq 0x14c80(%rip), %rsi     # 0x16720
leaq 0x14c9d(%rip), %rdx     # 0x16744
xorl %edi, %edi
xorl %eax, %eax
callq 0x7de8
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
jmp 0x1ae2
cmpl $0x5f5e101, %r14d       # imm = 0x5F5E101
jb 0x1a31
leaq 0x14c50(%rip), %rsi     # 0x16720
leaq 0x14c56(%rip), %rdx     # 0x1672d
xorl %ebx, %ebx
xorl %edi, %edi
xorl %eax, %eax
callq 0x7de8
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/decimal.c
// Function: tt_dec_sanity
int _tt_dec_sanity(const struct tt_dec *dec)
{
	if (dec->_msb <= 0 || dec->_msb > dec->_prec)
		return TT_APN_ESANITY;

	int i, last_dig_idx = (dec->_msb + 8) / 9 - 1;

	/* Check carry guard bits */
	for (i = 0; i <= last_dig_idx; i++)
		if ((dec->_dig32[i] & (BIT(30) | BIT(31))))
			return TT_APN_ESANITY;

	/* Check remaining uints */
	for (; i < dec->_digsz / 4; i++)
		if (dec->_dig32[i])
			return TT_APN_ESANITY;

	/* Check last valid uint */
	int last_dig_cnt = (dec->_msb - 1) % 9 + 1;
        uchar d[9];
	_tt_dec_to_d9(dec->_dig32[last_dig_idx], d);
	for (i = 8; i > last_dig_cnt - 1; i--)
		if (d[i])
			return TT_APN_ESANITY;
	if (d[i] == 0 && i != 0)	/* Don't blame on "0" */
		return TT_APN_ESANITY;

	/* Check zero */
	if (_tt_dec_is_zero(dec) && dec->_exp > 0)
		return TT_APN_ESANITY;

	return 0;
}

// Assembly:
movl 0x14(%rdi), %esi
movl $0xffffff31, %ecx       # imm = 0xFFFFFF31
testl %esi, %esi
jle 0x1bfc
cmpl 0x8(%rdi), %esi
jg 0x1bfc
leal 0x8(%rsi), %eax
xorl %r9d, %r9d
movl $0x9, %r8d
xorl %edx, %edx
divl %r8d
cmpq %r9, %rax
je 0x1b63
movq 0x18(%rdi), %rdx
cmpl $0x40000000, (%rdx,%r9,4) # imm = 0x40000000
leaq 0x1(%r9), %r9
jb 0x1b47
jmp 0x1bfc
movl 0x10(%rdi), %edx
shrl $0x2, %edx
movq %rax, %r9
cmpq %rdx, %r9
jae 0x1b82
movq 0x18(%rdi), %r10
cmpl $0x0, (%r10,%r9,4)
leaq 0x1(%r9), %r9
je 0x1b6c
jmp 0x1bfc
leal -0x1(%rsi), %ecx
movq 0x18(%rdi), %r9
movl -0x4(%r9,%rax,4), %eax
xorl %r10d, %r10d
movl $0xa, %r11d
cmpq $0x9, %r10
je 0x1bac
xorl %edx, %edx
divl %r11d
movb %dl, -0x9(%rsp,%r10)
incq %r10
jmp 0x1b97
movl %ecx, %eax
cltd
idivl %r8d
movslq %edx, %rcx
movabsq $0x8, %rax
cmpq %rcx, %rax
jle 0x1bd0
cmpb $0x0, -0x9(%rsp,%rax)
jne 0x1bf7
decq %rax
jmp 0x1bbf
movl $0xffffff31, %ecx       # imm = 0xFFFFFF31
testq %rax, %rax
je 0x1be1
cmpb $0x0, -0x9(%rsp,%rax)
je 0x1bfc
cmpl $0x1, %esi
jne 0x1bf3
cmpl $0x0, (%r9)
jne 0x1bf3
cmpw $0x0, 0x2(%rdi)
je 0x1bff
xorl %ecx, %ecx
jmp 0x1bfc
movl $0xffffff31, %ecx       # imm = 0xFFFFFF31
movl %ecx, %eax
retq
cmpl $0x0, 0x4(%rdi)
jg 0x1bfc
jmp 0x1bf3
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/decimal.c
// Function: tt_dec_get_dig
uint _tt_dec_get_dig(const uint *dig, int pos)
{
	uint dig32 = dig[pos / 9];
	pos %= 9;

	while (pos--)
		dig32 /= 10;

	return dig32 % 10;
}

// Assembly:
movl %esi, %eax
pushq $0x9
popq %rcx
cltd
idivl %ecx
movl %edx, %ecx
cltq
movl (%rdi,%rax,4), %eax
pushq $0xa
popq %rsi
xorl %edx, %edx
divl %esi
subl $0x1, %ecx
jae 0x1c19
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/decimal.c
// Function: tt_dec_uint_to_dec
int _tt_dec_uint_to_dec(uint *dig32, uint64_t num)
{
	int msb = 1;
	if (num)
		msb = 0;	/* Compensate "0" */

	while (num) {
		/* Get 9 decimals */
		uint dec9 = num % 1000000000;
		num /= 1000000000;

		*dig32++ = dec9;

		/* Increment significand */
		if (num)
			msb += 9;
		else
			do {
				msb++;
				dec9 /= 10;
			} while (dec9);
	}

	return msb;
}

// Assembly:
xorl %ecx, %ecx
testq %rsi, %rsi
sete %cl
movl $0x3b9aca00, %r10d      # imm = 0x3B9ACA00
pushq $0xa
popq %r11
testq %rsi, %rsi
je 0x1c77
movq %rsi, %rax
xorl %edx, %edx
divq %r10
movq %rax, %r8
movq %rdx, %r9
movl %r9d, (%rdi)
addq $0x4, %rdi
cmpq $0x3b9ac9ff, %rsi       # imm = 0x3B9AC9FF
ja 0x1c6f
incl %ecx
movl %r9d, %eax
xorl %edx, %edx
divl %r11d
cmpl $0xa, %r9d
movl %eax, %r9d
jae 0x1c5a
jmp 0x1c72
addl $0x9, %ecx
movq %r8, %rsi
jmp 0x1c37
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/decimal.c
// Function: tt_dec_uint128_to_dec
int _tt_dec_uint128_to_dec(uint *dig32, __uint128_t num)
{
	int msb = 1;
	if (num)
		msb = 0;	/* Compensate "0" */

	while (num) {
		/* Get 9 decimals */
		uint dec9 = num % 1000000000;
		num /= 1000000000;

		*dig32++ = dec9;

		/* Increment significand */
		if (num)
			msb += 9;
		else
			do {
				msb++;
				dec9 /= 10;
			} while (dec9);
	}

	return msb;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorl %ebp, %ebp
movq %rsi, %rax
orq %rdx, %rax
sete %bpl
movl $0x3b9ac9ff, %r12d      # imm = 0x3B9AC9FF
pushq $0xa
popq %r13
movq %r15, %rax
orq %r14, %rax
je 0x1cff
movl $0x3b9aca00, %edx       # imm = 0x3B9ACA00
movq %r15, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x9910
movq %rax, %rsi
movq %rdx, %rcx
imull $0x3b9aca00, %esi, %eax # imm = 0x3B9ACA00
movl %r15d, %edi
subl %eax, %edi
movl %edi, (%rbx)
addq $0x4, %rbx
cmpq %r15, %r12
movl $0x0, %eax
sbbq %r14, %rax
jb 0x1cf4
incl %ebp
movl %edi, %eax
xorl %edx, %edx
divl %r13d
cmpl $0xa, %edi
movl %eax, %edi
jae 0x1ce2
jmp 0x1cf7
addl $0x9, %ebp
movq %rsi, %r15
movq %rcx, %r14
jmp 0x1ca4
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/mach.c
// Function: tt_dec_from_uint
int tt_dec_from_uint(struct tt_dec *dec, uint64_t num)
{
	tt_assert(dec->_prec >= 20);

	_tt_dec_zero(dec);
	dec->_msb = _tt_dec_uint_to_dec(dec->_dig32, num);

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x13, 0x8(%rdi)
jle 0x1d3e
movq %rsi, %r14
movq %rdi, %rbx
callq 0x1b01
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x1c25
movl %eax, 0x14(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x14a27(%rip), %rsi     # 0x1676c
leaq 0x8336(%rip), %rdx      # 0xa082
leaq 0x14a2a(%rip), %rcx     # 0x1677d
pushq $0x3b
popq %r8
xorl %edi, %edi
xorl %eax, %eax
callq 0x7de8
callq 0x1050
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/basic.c
// Function: add_digs
static int add_digs(uint *dig, const int msb, const uint *dig2, const int msb2)
{
	int i;
	char carry = 0;

	/* Add dig2 to dig */
	const int uints2 = (msb2 + 8) / 9;
	for (i = 0; i < uints2; i++)
		dig[i] = add_dig(dig[i], dig2[i], &carry);

	/* Process remaining high digits in dig */
	const int uints = (msb + 8) / 9;
	for (; i < uints; i++) {
		if (carry == 0) {
			i = uints;
			break;
		}
		dig[i] = add_dig(dig[i], 0, &carry);
	}

	/* Check new MSB */
	if (carry) {
		/* Carry at uint boundary */
		dig[i] = 1;
		return _tt_max(msb, msb2) + 1;
	} else {
		/* Get new msb, i => valid uints */
		tt_assert_fa(i > 0);
		uint u = dig[i-1];
		int msbr = (i - 1) * 9;
		do {
			msbr++;
			u /= 10;
		} while (u);

		const int msbs = _tt_max(msb, msb2);
		tt_assert_fa(msbr == msbs || msbr == (msbs+1));
		return msbr;
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %r9
leal 0x8(%rcx), %eax
pushq $0x9
popq %r11
cltd
idivl %r11d
movl %eax, %r8d
xorl %eax, %eax
testl %r8d, %r8d
cmovlel %eax, %r8d
xorl %r10d, %r10d
cmpq %rax, %r8
je 0x3304
movl (%r9,%rax,4), %edx
movzbl %r10b, %ebx
addl (%rdi,%rax,4), %ebx
leal (%rbx,%rdx), %ebp
cmpl $0x3b9aca00, %ebp       # imm = 0x3B9ACA00
setae %r10b
leal -0x3b9aca00(%rdx,%rbx), %edx
cmovbl %ebp, %edx
movl %edx, (%rdi,%rax,4)
incq %rax
jmp 0x32d5
leal 0x8(%rsi), %eax
cltd
idivl %r11d
movslq %eax, %rdx
cmpq %rdx, %r8
jge 0x3343
testb %r10b, %r10b
je 0x335e
movl (%rdi,%r8,4), %r9d
movzbl %r10b, %r11d
leal (%r9,%r11), %ebx
cmpl $0x3b9aca00, %ebx       # imm = 0x3B9ACA00
setae %r10b
leal -0x3b9aca00(%r9,%r11), %r9d
cmovbl %ebx, %r9d
movl %r9d, (%rdi,%r8,4)
incq %r8
jmp 0x330e
testb %r10b, %r10b
je 0x335b
movl $0x1, (%rdi,%r8,4)
cmpl %ecx, %esi
cmovgl %esi, %ecx
incl %ecx
movl %ecx, %eax
jmp 0x339f
movl %r8d, %eax
testl %eax, %eax
jle 0x33a6
leal -0x1(%rax), %edx
movl (%rdi,%rdx,4), %edi
imull $-0x9, %eax, %r8d
pushq $0xa
popq %r9
movl %edi, %eax
xorl %edx, %edx
divl %r9d
decl %r8d
cmpl $0x9, %edi
movl %eax, %edi
ja 0x3370
cmpl %ecx, %esi
cmovgl %esi, %ecx
pushq $-0x9
popq %rdx
pushq $-0xa
popq %rsi
subl %ecx, %esi
movl %edx, %eax
subl %r8d, %eax
cmpl %r8d, %esi
je 0x339f
subl %ecx, %edx
cmpl %r8d, %edx
jne 0x33bf
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x134f9(%rip), %rsi     # 0x168a6
leaq 0x6cce(%rip), %rdx      # 0xa082
leaq 0x13499(%rip), %rcx     # 0x16854
pushq $0x5c
jmp 0x33d6
leaq 0x134e0(%rip), %rsi     # 0x168a6
leaq 0x6cb5(%rip), %rdx      # 0xa082
leaq 0x13480(%rip), %rcx     # 0x16854
pushq $0x65
popq %r8
xorl %edi, %edi
xorl %eax, %eax
callq 0x7de8
callq 0x1050
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/basic.c
// Function: cmp_digs
static int cmp_digs(const uint *dig1, const int msb1,
		const uint *dig2, const int msb2)
{
	if (msb1 <= 0 && msb2 <= 0)
		return 0;
	if (msb1 < msb2)
		return -1;
	if (msb1 > msb2)
		return 1;

	/* Compare digits: msb1 = msb2 > 0 */
	const int uints = (msb1 + 8) / 9;
	for (int i = uints - 1; i >= 0; i--) {
		if (dig1[i] > dig2[i])
			return 1;
		else if (dig1[i] < dig2[i])
			return -1;
	}
	return 0;
}

// Assembly:
movq %rdx, %r8
testl %esi, %esi
setle %al
testl %ecx, %ecx
setle %dl
xorl %r9d, %r9d
testb %dl, %al
jne 0x3b33
pushq $-0x1
popq %r10
cmpl %ecx, %esi
jge 0x3b2b
movl %r10d, %r9d
jmp 0x3b33
pushq $0x1
popq %rcx
jle 0x3b37
movl %ecx, %r9d
movl %r9d, %eax
retq
addl $0x8, %esi
pushq $0x9
popq %r11
movl %esi, %eax
cltd
idivl %r11d
testl %eax, %eax
jle 0x3b33
movl -0x4(%rdi,%rax,4), %edx
movl -0x4(%r8,%rax,4), %esi
cmpl %esi, %edx
ja 0x3b30
decq %rax
cmpl %esi, %edx
jae 0x3b44
jmp 0x3b26
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/basic.c
// Function: sub_digs
static int sub_digs(uint *dig, const uint *dig1, const int msb1,
		const uint *dig2, const int msb2)
{
	tt_assert_fa(msb1 >= msb2);

	int i;
	char carry = 0;

	/* dig1 - dig2 */
	const int uints2 = (msb2 + 8) / 9;
	for (i = 0; i < uints2; i++)
		dig[i] = sub_dig(dig1[i], dig2[i], &carry);

	/* Process remaining high digits in dig1 */
	const int uints1 = (msb1 + 8) / 9;
	for (; i < uints1; i++)
		dig[i] = sub_dig(dig1[i], 0, &carry);
	tt_assert_fa(carry == 0);

	/* Check new MSB */
	int msbr = get_msb(dig, uints1);
	tt_assert_fa((msbr <= msb1 || msb1 <= 0) && msbr >= 1);

	return msbr;
}

// Assembly:
pushq %rbx
cmpl %r8d, %edx
jl 0x3c3f
movl %edx, %r9d
addl $0x8, %r8d
pushq $0x9
popq %r11
movl %r8d, %eax
cltd
idivl %r11d
movl %eax, %r8d
xorl %eax, %eax
testl %r8d, %r8d
cmovlel %eax, %r8d
xorl %r10d, %r10d
cmpq %rax, %r8
je 0x3bb5
negb %r10b
movsbl %r10b, %edx
addl (%rsi,%rax,4), %edx
subl (%rcx,%rax,4), %edx
leal 0x3b9aca00(%rdx), %ebx
movl %edx, %r10d
shrl $0x1f, %r10d
testl %edx, %edx
cmovnsl %edx, %ebx
movl %ebx, (%rdi,%rax,4)
incq %rax
jmp 0x3b89
leal 0x8(%r9), %eax
cltd
idivl %r11d
movslq %eax, %rcx
cmpq %rcx, %r8
jge 0x3bf2
movl (%rsi,%r8,4), %edx
movzbl %r10b, %r11d
movl %edx, %ebx
subl %r11d, %ebx
negl %r11d
movl %ebx, %r10d
shrl $0x1f, %r10d
testl %ebx, %ebx
leal 0x3b9aca00(%rdx,%r11), %edx
cmovnsl %ebx, %edx
movl %edx, (%rdi,%r8,4)
incq %r8
jmp 0x3bc0
testb %r10b, %r10b
jne 0x3c5e
movl %eax, %r8d
pushq $0x1
popq %rsi
pushq $0xa
popq %r10
testl %r8d, %r8d
jle 0x3c31
decq %r8
movl %r8d, %eax
movl (%rdi,%rax,4), %r11d
testl %r11d, %r11d
je 0x3c2c
leal (%r8,%r8,8), %esi
movl %r11d, %ecx
incl %esi
movl %ecx, %eax
xorl %edx, %edx
divl %r10d
cmpl $0x9, %ecx
movl %eax, %ecx
ja 0x3c1c
testl %r11d, %r11d
je 0x3c01
testl %r9d, %r9d
jle 0x3c3b
cmpl %r9d, %esi
jg 0x3c7d
movl %esi, %eax
popq %rbx
retq
leaq 0x12c69(%rip), %rsi     # 0x168af
leaq 0x6435(%rip), %rdx      # 0xa082
leaq 0x12c00(%rip), %rcx     # 0x16854
xorl %edi, %edi
movl $0x87, %r8d
jmp 0x3c9a
leaq 0x12c4a(%rip), %rsi     # 0x168af
leaq 0x6416(%rip), %rdx      # 0xa082
leaq 0x12be1(%rip), %rcx     # 0x16854
xorl %edi, %edi
movl $0x95, %r8d
jmp 0x3c9a
leaq 0x12c2b(%rip), %rsi     # 0x168af
leaq 0x63f7(%rip), %rdx      # 0xa082
leaq 0x12bc2(%rip), %rcx     # 0x16854
xorl %edi, %edi
movl $0x99, %r8d
xorl %eax, %eax
callq 0x7de8
callq 0x1050
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/basic.c
// Function: tt_dec_cmp_abs
int tt_dec_cmp_abs(const struct tt_dec *src1, const struct tt_dec *src2)
{
	int msb1 = src1->_msb, msb2 = src2->_msb;

	int ret = (msb1 + src1->_exp) - (msb2 + src2->_exp);
	if (ret)
		return ret;

	uint *dig1 = src1->_dig32, *dig2 = src2->_dig32;
	const int uints = (_tt_max(msb1, msb2) + 8) / 9 * 4;

	/* Align exponent */
	int adj = src1->_exp - src2->_exp;
	if (adj < 0) {
		dig2 = calloc(uints, 4);
		msb2 = shift_digs(dig2, 0, src2->_dig32, msb2, -adj);
	} else if (adj > 0) {
		dig1 = calloc(uints, 4);
		msb1 = shift_digs(dig1, 0, src1->_dig32, msb1, adj);
	}
	tt_assert_fa(msb1 == msb2);

	ret = cmp_digs(dig1, msb1, dig2, msb2);

	if (dig1 != src1->_dig32)
		free(dig1);
	if (dig2 != src2->_dig32)
		free(dig2);

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x4(%rdi), %r15d
movl 0x14(%rdi), %r13d
movl 0x4(%rsi), %ecx
movl 0x14(%rsi), %r12d
leal (%r15,%r13), %ebp
leal (%r12,%rcx), %eax
subl %eax, %ebp
jne 0x3d9c
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsi), %rbp
cmpl %r12d, %r13d
movl %r12d, %eax
cmovgl %r13d, %eax
addl $0x8, %eax
pushq $0x9
popq %rsi
cltd
idivl %esi
shll $0x2, %eax
subl %ecx, %r15d
js 0x3d35
movq %rbp, 0x8(%rsp)
je 0x3d5e
movslq %eax, %rdi
pushq $0x4
popq %rsi
callq 0x1100
movq %rax, %rbp
movq %rax, %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rdx
movl %r13d, %ecx
movl %r15d, %r8d
callq 0x3024
movl %eax, %r13d
movq %rbp, 0x10(%rsp)
jmp 0x3d5e
movslq %eax, %rdi
pushq $0x4
popq %rsi
callq 0x1100
movq %rax, 0x8(%rsp)
negl %r15d
movq %rax, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movl %r12d, %ecx
movl %r15d, %r8d
callq 0x3024
movl %eax, %r12d
movq 0x8(%rsp), %r15
cmpl %r12d, %r13d
jne 0x3dad
movq 0x10(%rsp), %r13
movq %r13, %rdi
movl %r12d, %esi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x3b0a
movl %eax, %ebp
cmpq 0x18(%r14), %r13
je 0x3d8e
movq %r13, %rdi
callq 0x1030
cmpq 0x18(%rbx), %r15
je 0x3d9c
movq %r15, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12ac3(%rip), %rsi     # 0x16877
leaq 0x62c7(%rip), %rdx      # 0xa082
leaq 0x12a92(%rip), %rcx     # 0x16854
xorl %edi, %edi
movl $0x38e, %r8d            # imm = 0x38E
xorl %eax, %eax
callq 0x7de8
callq 0x1050
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/decimal/basic.c
// Function: tt_dec_cmp
int tt_dec_cmp(const struct tt_dec *src1, const struct tt_dec *src2)
{
	int ret;

	if (src1->_sign != src2->_sign) {
		if (_tt_dec_is_zero(src1) && _tt_dec_is_zero(src2))
			return 0;
		ret = src2->_sign - src1->_sign;
	} else {
		ret = tt_dec_cmp_abs(src1, src2);
		if (src1->_sign)
			ret = -ret;
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movswl (%rdi), %ebp
movswl (%rsi), %r15d
cmpw %r15w, %bp
jne 0x3e09
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3ca6
movl %eax, %ecx
negl %eax
cmpw $0x0, (%r14)
cmovel %ecx, %eax
jmp 0x3e2b
movq %r14, %rdi
callq 0x3009
testb %al, %al
je 0x3e25
movq %rbx, %rdi
callq 0x3009
movl %eax, %ecx
xorl %eax, %eax
testb %cl, %cl
jne 0x3e2b
subl %ebp, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/integer/integer.c
// Function: tt_int_alloc
struct tt_int *tt_int_alloc(void)
{
	struct tt_int *ti = malloc(sizeof(struct tt_int));
	ti->sign = 0;
	ti->_max = TT_INT_DEF;
	ti->msb = 1;
	ti->buf = calloc(ti->_max, sizeof(_tt_word));
	if (ti->buf == NULL) {
		tt_error("Out of memory");
		free(ti);
		return NULL;
	}
	return ti;
}

// Assembly:
pushq %rbx
pushq $0x18
popq %rdi
callq 0x1140
movq %rax, %rbx
movabsq $0x2200000000, %rax     # imm = 0x2200000000
movq %rax, (%rbx)
movl $0x1, 0x8(%rbx)
pushq $0x22
popq %rdi
pushq $0x8
popq %rsi
callq 0x1100
movq %rax, 0x10(%rbx)
testq %rax, %rax
jne 0x3ea5
leaq 0x12a2d(%rip), %rsi     # 0x168b8
leaq 0x128b2(%rip), %rdx     # 0x16744
xorl %edi, %edi
xorl %eax, %eax
callq 0x7de8
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/integer/integer.c
// Function: tt_int_realloc
int _tt_int_realloc(struct tt_int *ti, int msb)
{
	if (msb <= ti->_max)
		return 0;

	/* Double the buffer */
	if (msb < ti->_max * 2)
		msb = ti->_max * 2;
	_tt_word *buf = realloc(ti->buf, msb * _tt_word_sz);
	if (!buf) {
		tt_error("Out of memory");
		return TT_ENOMEM;
	}
	memset(buf + ti->_max, 0, (msb - ti->_max) * _tt_word_sz);
	ti->buf = buf;
	ti->_max = msb;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x4(%rdi), %r15d
xorl %ebp, %ebp
cmpl %esi, %r15d
jge 0x3f3a
movq %rdi, %rbx
addl %r15d, %r15d
cmpl %esi, %r15d
cmovlel %esi, %r15d
movq 0x10(%rdi), %rdi
leal (,%r15,8), %eax
movslq %eax, %rsi
callq 0x1150
testq %rax, %rax
je 0x3f20
movq %rax, %r14
movslq 0x4(%rbx), %rax
leaq (%r14,%rax,8), %rdi
movslq %r15d, %rdx
subq %rax, %rdx
shlq $0x3, %rdx
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x10e0
movq %r14, 0x10(%rbx)
movl %r15d, 0x4(%rbx)
jmp 0x3f3a
leaq 0x1299e(%rip), %rsi     # 0x168c5
leaq 0x12816(%rip), %rdx     # 0x16744
xorl %edi, %edi
xorl %eax, %eax
callq 0x7de8
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/integer/integer.c
// Function: tt_int_copy
int _tt_int_copy(struct tt_int *dst, const struct tt_int *src)
{
	_tt_int_zero(dst);

	int ret = _tt_int_realloc(dst, src->msb);
	if (ret)
		return ret;

	dst->sign = src->sign;
	dst->msb = src->msb;
	memcpy(dst->buf, src->buf, src->msb * _tt_word_sz);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
andl $0x0, (%rdi)
movl $0x1, 0x8(%rdi)
movq 0x10(%rdi), %rdi
movslq 0x4(%r15), %rdx
shlq $0x3, %rdx
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x10e0
movl 0x8(%r14), %esi
movq %r15, %rdi
callq 0x3ec0
testl %eax, %eax
je 0x3f86
pushq $-0x1
popq %rbx
jmp 0x3fa5
movl (%r14), %eax
movl %eax, (%r15)
movslq 0x8(%r14), %rdx
movl %edx, 0x8(%r15)
movq 0x10(%r15), %rdi
movq 0x10(%r14), %rsi
shlq $0x3, %rdx
callq 0x1120
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/cyb70289[P]tt/src/apn/integer/integer.c
// Function: tt_int_word_ctz
int _tt_int_word_ctz(_tt_word w)
{
	for (int i = 0; i < _tt_word_bits; i++) {
		if (w & 0x1)
			return i;
		w >>= 1;
	}

	tt_assert(1);
	return _tt_word_bits;
}

// Assembly:
xorl %eax, %eax
cmpl $0x3f, %eax
je 0x3ff5
movl %edi, %ecx
andl $0x1, %ecx
jne 0x3ff5
shrq %rdi
incl %eax
jmp 0x3fe2
retq