// File: /workspace/github_c_makefile_star2_O3/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 0xa165
leaq 0x942a(%rip), %rdi      # 0xc29c
callq 0x2070
callq 0x5c1c
movq %rax, %rbx
leaq 0x8(%rsp), %rax
movq $0x0, (%rax)
movl $0x10, %ebp
leaq 0x19ce9(%rip), %r14     # 0x1cb80
movq -0x10(%rbp,%r14), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x60c8
testl %eax, %eax
jne 0x3456
movq %rbx, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x3456
movl -0x8(%rbp,%r14), %edx
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x6433
testl %eax, %eax
jne 0x354e
movq 0x8(%rsp), %r12
movq (%rbp,%r14), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2140
testl %eax, %eax
jne 0x2f9d
movq %r12, %rdi
callq 0x2030
movq $0x0, 0x8(%rsp)
addq $0x18, %rbp
cmpq $0xa0, %rbp
jne 0x2e97
movl $0xffffd8f0, %ebp       # imm = 0xFFFFD8F0
leaq 0x24(%rsp), %r14
leaq 0x8(%rsp), %r15
movq %r14, %rdi
callq 0x35ab
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
callq 0x60c8
testl %eax, %eax
jne 0x356d
movq %rbx, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x356d
movl 0x24(%rsp), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6433
testl %eax, %eax
jne 0x358c
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x2140
testl %eax, %eax
jne 0x2fbf
movq %r12, %rdi
callq 0x2030
movq 0x8(%rsp), %rdi
callq 0x2030
movq $0x0, 0x8(%rsp)
incl %ebp
jne 0x2f23
jmp 0x2fdc
leaq 0x9183(%rip), %rsi      # 0xc127
leaq 0x9188(%rip), %rdx      # 0xc133
xorl %edi, %edi
movq %r15, %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x9fd6
jmp 0x2fe4
leaq 0x9161(%rip), %rsi      # 0xc127
leaq 0x9174(%rip), %rdx      # 0xc141
xorl %edi, %edi
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x9fd6
movq %rbx, %rdi
callq 0x5c7c
leaq 0x92bc(%rip), %rdi      # 0xc2a7
callq 0x2070
callq 0x5c1c
movq %rax, %rbx
callq 0x5c1c
movq %rax, %r14
callq 0x5c1c
movq %rax, (%rsp)
callq 0x5c1c
movq %rax, %r13
xorl %ebp, %ebp
movw $0x1, %r15w
callq 0x5c1c
movq %rax, 0x10(%rsp)
movzwl %r15w, %eax
shrl $0x2, %eax
imull $0x147b, %eax, %eax     # imm = 0x147B
shrl $0x11, %eax
imull $-0x64, %eax, %eax
incl %eax
cmpw %bp, %ax
movl %ebp, 0x20(%rsp)
jne 0x3099
movq %rbx, %rdi
callq 0x5c7c
movq %r14, %rdi
callq 0x5c7c
movq (%rsp), %rdi
callq 0x5c7c
movq %r13, %rdi
callq 0x5c7c
movq 0x10(%rsp), %rdi
callq 0x5c7c
callq 0x5c1c
movq %rax, %rbx
callq 0x5c1c
movq %rax, %r14
callq 0x5c1c
movq %rax, %r13
callq 0x5c1c
movq %rax, 0x18(%rsp)
callq 0x5c1c
movq %rax, 0x10(%rsp)
jmp 0x30a2
movq %r13, 0x18(%rsp)
movq (%rsp), %r13
movq %r13, (%rsp)
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x35ab
movq %rax, %rbp
movq %rbx, %rdi
movq %rax, %rsi
callq 0x60c8
movq %rbp, %rdi
callq 0x2030
movq %r12, %rdi
callq 0x35ab
movq %rax, %rbp
movq %r14, %rdi
movq %rax, %rsi
callq 0x60c8
movq %rbp, %rdi
callq 0x2030
movq %r13, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x8126
testl %eax, %eax
jne 0x3510
movq (%rsp), %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x3510
movl %r15d, %ebp
movq 0x18(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x8126
testl %eax, %eax
jne 0x34f1
movq %r13, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x34f1
movq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x8126
testl %eax, %eax
jne 0x34d2
movq %r15, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x34d2
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x82cc
testl %eax, %eax
jne 0x34b3
movl %ebp, %r15d
movq %rbx, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x34b3
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x82cc
testl %eax, %eax
movl 0x20(%rsp), %ebp
jne 0x3494
movq %r14, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x3494
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x8126
testl %eax, %eax
jne 0x352f
movq %rbx, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x352f
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x875e
testl %eax, %eax
jne 0x3216
movq %r14, %rdi
movq %r13, %rsi
callq 0x875e
testl %eax, %eax
jne 0x3216
decl %ebp
incl %r15d
cmpl $0xffffd8f0, %ebp       # imm = 0xFFFFD8F0
jne 0x3022
jmp 0x322d
leaq 0x8ffd(%rip), %rsi      # 0xc21a
leaq 0x9005(%rip), %rdx      # 0xc229
xorl %edi, %edi
xorl %eax, %eax
callq 0x9fd6
movq %rbx, %rdi
callq 0x5c7c
movq %r14, %rdi
callq 0x5c7c
movq (%rsp), %rdi
callq 0x5c7c
movq %r13, %rdi
callq 0x5c7c
movq 0x10(%rsp), %rdi
callq 0x5c7c
leaq 0x9055(%rip), %rdi      # 0xc2b4
callq 0x2070
callq 0x5c1c
movq %rax, %rbx
callq 0x5c1c
movq %rax, %r14
callq 0x5c1c
movq %rax, %r13
xorl %r15d, %r15d
movw $0x1, %r12w
callq 0x5c1c
movq %rax, %rbp
movl %r12d, 0x18(%rsp)
movzwl %r12w, %eax
shrl %eax
imull $0x147b, %eax, %eax     # imm = 0x147B
shrl $0x11, %eax
imull $-0x32, %eax, %eax
incl %eax
movl %r15d, 0x10(%rsp)
cmpw %r15w, %ax
jne 0x32f3
movq %rbx, %rdi
callq 0x5c7c
movq %r14, %rdi
callq 0x5c7c
movq %r13, %rdi
callq 0x5c7c
movq %rbp, %rdi
callq 0x5c7c
callq 0x5c1c
movq %rax, %rbx
callq 0x5c1c
movq %rax, %r14
callq 0x5c1c
movq %rax, (%rsp)
callq 0x5c1c
movq %rax, %r15
jmp 0x32fa
movq %r13, (%rsp)
movq %rbp, %r15
movq %r14, %rbp
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x35ab
movq %rax, %r13
movq %rbx, %rdi
movq %rax, %rsi
callq 0x60c8
movq %r13, %rdi
callq 0x2030
movq %r12, %rdi
callq 0x35ab
movq %rax, %r13
movq %r14, %rdi
movq %rax, %rsi
callq 0x60c8
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 %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x83e4
testl %eax, %eax
jne 0x3437
movq %r15, %rbp
movq %r13, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x3437
movq %rbp, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x3437
movq %r14, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x82d6
testl %eax, %eax
movl 0x10(%rsp), %r15d
movl 0x18(%rsp), %r12d
jne 0x3475
movq %r14, %rdi
callq 0x5dd2
testl %eax, %eax
jne 0x3475
movq %r14, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x8126
movq %rbx, %rdi
movq %r14, %rsi
callq 0x875e
testl %eax, %eax
jne 0x33ef
decl %r15d
incl %r12d
cmpl $0xffffd8f0, %r15d      # imm = 0xFFFFD8F0
jne 0x328c
jmp 0x3406
leaq 0x8e92(%rip), %rsi      # 0xc288
leaq 0x8e2c(%rip), %rdx      # 0xc229
xorl %edi, %edi
xorl %eax, %eax
callq 0x9fd6
movq %rbx, %rdi
callq 0x5c7c
movq %r14, %rdi
callq 0x5c7c
movq %r13, %rdi
callq 0x5c7c
movq %rbp, %rdi
callq 0x5c7c
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8df4(%rip), %rdi      # 0xc232
leaq 0x8cb3(%rip), %rsi      # 0xc0f8
leaq 0x8e23(%rip), %rcx      # 0xc26f
movl $0xe3, %edx
callq 0x20f0
leaq 0x8c77(%rip), %rdi      # 0xc0d4
leaq 0x8c94(%rip), %rsi      # 0xc0f8
leaq 0x8c9d(%rip), %rcx      # 0xc108
movl $0x4a, %edx
callq 0x20f0
leaq 0x8d7b(%rip), %rdi      # 0xc1f7
leaq 0x8c75(%rip), %rsi      # 0xc0f8
leaq 0x8de5(%rip), %rcx      # 0xc26f
movl $0xe7, %edx
callq 0x20f0
leaq 0x8d5c(%rip), %rdi      # 0xc1f7
leaq 0x8c56(%rip), %rsi      # 0xc0f8
leaq 0x8ccb(%rip), %rcx      # 0xc174
movl $0xa1, %edx
callq 0x20f0
leaq 0x8d1a(%rip), %rdi      # 0xc1d4
leaq 0x8c37(%rip), %rsi      # 0xc0f8
leaq 0x8cac(%rip), %rcx      # 0xc174
movl $0x9d, %edx
callq 0x20f0
leaq 0x8cd8(%rip), %rdi      # 0xc1b1
leaq 0x8c18(%rip), %rsi      # 0xc0f8
leaq 0x8c8d(%rip), %rcx      # 0xc174
movl $0x99, %edx
callq 0x20f0
leaq 0x8c95(%rip), %rdi      # 0xc18d
leaq 0x8bf9(%rip), %rsi      # 0xc0f8
leaq 0x8c6e(%rip), %rcx      # 0xc174
movl $0x95, %edx
callq 0x20f0
leaq 0x8c39(%rip), %rdi      # 0xc150
leaq 0x8bda(%rip), %rsi      # 0xc0f8
leaq 0x8c4f(%rip), %rcx      # 0xc174
movl $0x93, %edx
callq 0x20f0
leaq 0x8c9e(%rip), %rdi      # 0xc1d4
leaq 0x8bbb(%rip), %rsi      # 0xc0f8
leaq 0x8c30(%rip), %rcx      # 0xc174
movl $0xa5, %edx
callq 0x20f0
leaq 0x8bc9(%rip), %rdi      # 0xc11e
leaq 0x8b9c(%rip), %rsi      # 0xc0f8
leaq 0x8ba5(%rip), %rcx      # 0xc108
movl $0x4d, %edx
callq 0x20f0
leaq 0x8b60(%rip), %rdi      # 0xc0d4
leaq 0x8b7d(%rip), %rsi      # 0xc0f8
leaq 0x8b86(%rip), %rcx      # 0xc108
movl $0x5c, %edx
callq 0x20f0
leaq 0x8b8b(%rip), %rdi      # 0xc11e
leaq 0x8b5e(%rip), %rsi      # 0xc0f8
leaq 0x8b67(%rip), %rcx      # 0xc108
movl $0x5e, %edx
callq 0x20f0