// File: /workspace/github_c_makefile_star2_O1/cyb70289[P]tt/tests/integer.c
// Function: main
int main(void)
{
	srand(time(NULL));

#if 0
	char *s = NULL;
	struct tt_int *ti = tt_int_alloc();
	struct tt_int *ti1 = tt_int_alloc();
	struct tt_int *ti2 = tt_int_alloc();
	tt_int_from_string(ti1, "-1111111111111111111111111111111111111111111");
	tt_int_from_string(ti2, "99999999999999999999999999999");
	tt_int_sub(ti1, ti1, ti2);
	tt_int_to_string(ti1, &s, 10);
	printf("%s\n", s);
	free(s);
	s = NULL;

	tt_int_from_string(ti1, "0x1000000000000000000000000000000000000000");
	tt_int_from_string(ti2, "0x20000000000000000000000000000000000");
	tt_int_mul(ti, ti1, ti2);
	assert(_tt_int_sanity(ti) == 0);
	tt_int_to_string(ti, &s, 16);
	printf("%s\n", s);
	free(s);
	s = NULL;

	tt_int_from_string(ti1, "1111111111111111111111111111111111111111111");
	tt_int_from_string(ti2, "1111111111111111111111111111");
	tt_int_div(ti, ti1, ti1, ti2);
	assert(_tt_int_sanity(ti) == 0);
	assert(_tt_int_sanity(ti1) == 0);
	tt_int_to_string(ti, &s, 10);
	printf("%s\n", s);
	free(s);
	s = NULL;
	tt_int_to_string(ti1, &s, 10);
	printf("%s\n", s);
	free(s);
	s = NULL;

	tt_int_free(ti);
	tt_int_free(ti1);
	tt_int_free(ti2);

	return 0;
#endif

#if 0
	int old_level = tt_log_set_level(TT_LOG_INFO);
	tt_info("Calculating...");
	struct tt_int *ti = tt_int_alloc();
	tt_int_factorial(ti, 1000000);
	char *s = NULL;
	tt_info("Converting...");
	tt_int_to_string(ti, &s, 10);
	printf("%s\n", s);
	free(s);
	tt_int_free(ti);
	tt_log_set_level(old_level);
	return 0;
#endif

#if 0
	#define MSB1	3000000
	#define MSB2	300
	#define LOOPS	1

	tt_log_set_level(TT_LOG_WARN);

	struct tt_int *ti1 = rand_int(MSB1);
	struct tt_int *ti2 = rand_int(MSB2);
	struct tt_int *ti3 = tt_int_alloc();

	for (int i = 0; i < LOOPS; i++)
		tt_int_mul(ti3, ti1, ti2);

	return 0;
#endif

#if 0
	tt_log_set_level(TT_LOG_WARN);
	for (int i = 1; i <= 4096; i *= 2)
		gen_exp10(i*9);
	return 0;
#endif

	tt_log_set_level(TT_LOG_WARN);

	const int count = 10000;
	verify_conv(count);
	verify_add_sub(count);
	verify_mul_div(count);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %edi, %edi
callq 0x2170
movl %eax, %edi
callq 0x2120
movl $0x1, %edi
callq 0xa0f5
leaq 0x93aa(%rip), %rdi      # 0xc29c
callq 0x2070
callq 0x5bfc
movq %rax, %rbx
leaq 0x8(%rsp), %rax
movq $0x0, (%rax)
movl $0x10, %ebp
leaq 0x19c69(%rip), %r14     # 0x1cb80
movq -0x10(%rbp,%r14), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x60c4
testl %eax, %eax
jne 0x34ec
movq %rbx, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x34ec
movl -0x8(%rbp,%r14), %edx
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x64a0
testl %eax, %eax
jne 0x35e4
movq 0x8(%rsp), %r12
movq (%rbp,%r14), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2140
testl %eax, %eax
jne 0x3053
movq %r12, %rdi
callq 0x2030
movq $0x0, 0x8(%rsp)
addq $0x18, %rbp
cmpq $0xa0, %rbp
jne 0x2f17
movl $0xffffd8ef, %r14d      # imm = 0xFFFFD8EF
leaq 0x8(%rsp), %r15
incl %r14d
je 0x3049
leaq 0x24(%rsp), %rdi
callq 0x3641
movq %rax, %rbp
movq %rbx, %rdi
movq %rax, %rsi
callq 0x60c4
testl %eax, %eax
jne 0x3603
movq %rbx, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x3603
movl 0x24(%rsp), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x64a0
testl %eax, %eax
jne 0x3622
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2140
movl %eax, %r12d
testl %eax, %eax
je 0x3025
xorl %edi, %edi
leaq 0x9118(%rip), %rsi      # 0xc127
leaq 0x912b(%rip), %rdx      # 0xc141
movq %rbp, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x9f66
jmp 0x3040
movq %rbp, %rdi
callq 0x2030
movq 0x8(%rsp), %rdi
callq 0x2030
movq $0x0, 0x8(%rsp)
testl %r12d, %r12d
je 0x2f9f
movq %rbx, %rdi
callq 0x5c5c
jmp 0x3073
leaq 0x90cd(%rip), %rsi      # 0xc127
leaq 0x90d2(%rip), %rdx      # 0xc133
xorl %edi, %edi
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x9f66
leaq 0x922d(%rip), %rdi      # 0xc2a7
callq 0x2070
callq 0x5bfc
movq %rax, %rbx
callq 0x5bfc
movq %rax, %r14
callq 0x5bfc
movq %rax, (%rsp)
callq 0x5bfc
movq %rax, %r13
movl $0x1, %r12d
xorl %ebp, %ebp
callq 0x5bfc
movq %rax, 0x10(%rsp)
movl %r12d, %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x25, %rax
imull $0x64, %eax, %eax
movl $0x1, %ecx
subl %eax, %ecx
cmpl %ebp, %ecx
movl %ebp, 0x20(%rsp)
jne 0x312b
movq %rbx, %rdi
callq 0x5c5c
movq %r14, %rdi
callq 0x5c5c
movq (%rsp), %rdi
callq 0x5c5c
movq %r13, %rdi
callq 0x5c5c
movq 0x10(%rsp), %rdi
callq 0x5c5c
callq 0x5bfc
movq %rax, %rbx
callq 0x5bfc
movq %rax, %r14
callq 0x5bfc
movq %rax, %r13
callq 0x5bfc
movq %rax, 0x18(%rsp)
callq 0x5bfc
movq %rax, 0x10(%rsp)
jmp 0x3134
movq %r13, 0x18(%rsp)
movq (%rsp), %r13
movq %r13, (%rsp)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3641
movq %rax, %rbp
movq %rbx, %rdi
movq %rax, %rsi
callq 0x60c4
movq %rbp, %rdi
callq 0x2030
movq %r15, %rdi
callq 0x3641
movq %rax, %rbp
movq %r14, %rdi
movq %rax, %rsi
callq 0x60c4
movq %rbp, %rdi
callq 0x2030
movq %r13, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x8182
testl %eax, %eax
jne 0x35a6
movq (%rsp), %rdi
callq 0x5db5
testl %eax, %eax
jne 0x35a6
movl %r12d, %ebp
movq 0x18(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x8182
testl %eax, %eax
jne 0x3587
movq %r13, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x3587
movq 0x10(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x8182
testl %eax, %eax
jne 0x3568
movq %r12, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x3568
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x8324
testl %eax, %eax
jne 0x3549
movl %ebp, %r12d
movq %rbx, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x3549
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x8324
testl %eax, %eax
movl 0x20(%rsp), %ebp
jne 0x352a
movq %r14, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x352a
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x8182
testl %eax, %eax
jne 0x35c5
movq %rbx, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x35c5
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x8771
testl %eax, %eax
jne 0x32a8
movq %r14, %rdi
movq %r13, %rsi
callq 0x8771
testl %eax, %eax
jne 0x32a8
incl %r12d
decl %ebp
cmpl $0xffffd8f0, %ebp       # imm = 0xFFFFD8F0
jne 0x30b2
jmp 0x32bf
leaq 0x8f6b(%rip), %rsi      # 0xc21a
leaq 0x8f73(%rip), %rdx      # 0xc229
xorl %edi, %edi
xorl %eax, %eax
callq 0x9f66
movq %rbx, %rdi
callq 0x5c5c
movq %r14, %rdi
callq 0x5c5c
movq (%rsp), %rdi
callq 0x5c5c
movq %r13, %rdi
callq 0x5c5c
movq 0x10(%rsp), %rdi
callq 0x5c5c
leaq 0x8fc3(%rip), %rdi      # 0xc2b4
callq 0x2070
callq 0x5bfc
movq %rax, %rbx
callq 0x5bfc
movq %rax, %r14
callq 0x5bfc
movq %rax, %r13
movl $0x1, %r15d
xorl %r12d, %r12d
callq 0x5bfc
movq %rax, %rbp
movl %r15d, 0x10(%rsp)
movl %r15d, %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x24, %rax
imull $0x32, %eax, %eax
movl $0x1, %ecx
subl %eax, %ecx
movl %r12d, 0x18(%rsp)
cmpl %r12d, %ecx
jne 0x3389
movq %rbx, %rdi
callq 0x5c5c
movq %r14, %rdi
callq 0x5c5c
movq %r13, %rdi
callq 0x5c5c
movq %rbp, %rdi
callq 0x5c5c
callq 0x5bfc
movq %rax, %rbx
callq 0x5bfc
movq %rax, %r14
callq 0x5bfc
movq %rax, (%rsp)
callq 0x5bfc
movq %rax, %r12
jmp 0x3390
movq %r13, (%rsp)
movq %rbp, %r12
movq %r14, %rbp
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3641
movq %rax, %r13
movq %rbx, %rdi
movq %rax, %rsi
callq 0x60c4
movq %r13, %rdi
callq 0x2030
movq %r15, %rdi
callq 0x3641
movq %rax, %r13
movq %r14, %rdi
movq %rax, %rsi
callq 0x60c4
movq %r13, %rdi
callq 0x2030
movl 0x8(%rbx), %eax
cmpl 0x8(%r14), %eax
cmovlq %rbx, %r14
cmovlq %rbp, %rbx
movq (%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x843c
testl %eax, %eax
jne 0x34cd
movq %r12, %rbp
movq %r13, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x34cd
movq %rbp, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x34cd
movq %r14, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x832e
testl %eax, %eax
movl 0x10(%rsp), %r15d
movl 0x18(%rsp), %r12d
jne 0x350b
movq %r14, %rdi
callq 0x5db5
testl %eax, %eax
jne 0x350b
movq %r14, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x8182
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8771
testl %eax, %eax
jne 0x3485
incl %r15d
decl %r12d
cmpl $0xffffd8f0, %r12d      # imm = 0xFFFFD8F0
jne 0x331f
jmp 0x349c
leaq 0x8dfc(%rip), %rsi      # 0xc288
leaq 0x8d96(%rip), %rdx      # 0xc229
xorl %edi, %edi
xorl %eax, %eax
callq 0x9f66
movq %rbx, %rdi
callq 0x5c5c
movq %r14, %rdi
callq 0x5c5c
movq %r13, %rdi
callq 0x5c5c
movq %rbp, %rdi
callq 0x5c5c
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8d5e(%rip), %rdi      # 0xc232
leaq 0x8c1d(%rip), %rsi      # 0xc0f8
leaq 0x8d8d(%rip), %rcx      # 0xc26f
movl $0xe3, %edx
callq 0x20f0
leaq 0x8be1(%rip), %rdi      # 0xc0d4
leaq 0x8bfe(%rip), %rsi      # 0xc0f8
leaq 0x8c07(%rip), %rcx      # 0xc108
movl $0x4a, %edx
callq 0x20f0
leaq 0x8ce5(%rip), %rdi      # 0xc1f7
leaq 0x8bdf(%rip), %rsi      # 0xc0f8
leaq 0x8d4f(%rip), %rcx      # 0xc26f
movl $0xe7, %edx
callq 0x20f0
leaq 0x8cc6(%rip), %rdi      # 0xc1f7
leaq 0x8bc0(%rip), %rsi      # 0xc0f8
leaq 0x8c35(%rip), %rcx      # 0xc174
movl $0xa1, %edx
callq 0x20f0
leaq 0x8c84(%rip), %rdi      # 0xc1d4
leaq 0x8ba1(%rip), %rsi      # 0xc0f8
leaq 0x8c16(%rip), %rcx      # 0xc174
movl $0x9d, %edx
callq 0x20f0
leaq 0x8c42(%rip), %rdi      # 0xc1b1
leaq 0x8b82(%rip), %rsi      # 0xc0f8
leaq 0x8bf7(%rip), %rcx      # 0xc174
movl $0x99, %edx
callq 0x20f0
leaq 0x8bff(%rip), %rdi      # 0xc18d
leaq 0x8b63(%rip), %rsi      # 0xc0f8
leaq 0x8bd8(%rip), %rcx      # 0xc174
movl $0x95, %edx
callq 0x20f0
leaq 0x8ba3(%rip), %rdi      # 0xc150
leaq 0x8b44(%rip), %rsi      # 0xc0f8
leaq 0x8bb9(%rip), %rcx      # 0xc174
movl $0x93, %edx
callq 0x20f0
leaq 0x8c08(%rip), %rdi      # 0xc1d4
leaq 0x8b25(%rip), %rsi      # 0xc0f8
leaq 0x8b9a(%rip), %rcx      # 0xc174
movl $0xa5, %edx
callq 0x20f0
leaq 0x8b33(%rip), %rdi      # 0xc11e
leaq 0x8b06(%rip), %rsi      # 0xc0f8
leaq 0x8b0f(%rip), %rcx      # 0xc108
movl $0x4d, %edx
callq 0x20f0
leaq 0x8aca(%rip), %rdi      # 0xc0d4
leaq 0x8ae7(%rip), %rsi      # 0xc0f8
leaq 0x8af0(%rip), %rcx      # 0xc108
movl $0x5c, %edx
callq 0x20f0
leaq 0x8af5(%rip), %rdi      # 0xc11e
leaq 0x8ac8(%rip), %rsi      # 0xc0f8
leaq 0x8ad1(%rip), %rcx      # 0xc108
movl $0x5e, %edx
callq 0x20f0