// File: /workspace/github_cpp_makefile_star2_O2/aisthesis[P]realnumber/src/find_pi.cpp
// Function: main
int main(int argc, const char * argv[])
{
	//karatsuba::say_hello();

	string str = "1.0";
	RealNumber x(str);
	cout << "x is " << x.to_decimal_string() << endl;
	str = "300000000.0";
	RealNumber y(str);
	cout << "y is " << y.to_decimal_string() << endl;

	try {
		RealNumber("10000000000.0");
	} 
	catch (invalid_argument& ia) {
		cout << ia.what() << endl;
	}
	catch (exception& e) {
		cout << "this exception is expected" << endl;
	}
	RealNumber z = x / y;
	cout << "z is " << z.to_decimal_string() << endl;
	cout << "x.difference(y) is " << x.difference(y).to_decimal_string() << endl;
	
	RealNumber num("2.0");
	RealNumber guess("1.4");
	int iterations = 10;
	
	RealNumber sqrt_two = ConvergentSeries::babylonian_sqrt(num, guess, iterations);
	
	cout << "Square root of 2 is " << sqrt_two.to_decimal_string() << endl;
	cout << "or: " << ConvergentSeries::babylonian_sqrt(RealNumber("2.0"), RealNumber("1.4"), 
																											iterations).to_decimal_string() << endl;
	
	RealNumber pi = ConvergentSeries::gauss_legendre_pi(6, 10, sqrt_two);
	cout << "Pi is\n" << pi.to_decimal_string() << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xe0, %rsp
leaq 0x2c43(%rip), %rsi      # 0x5004
leaq -0xc8(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x2a28
leaq -0x48(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2b4a
movq 0x5be0(%rip), %rdi      # 0x7fc8
leaq 0x2c19(%rip), %rsi      # 0x5008
callq 0x2130
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2d0c
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq 0x2be6(%rip), %rsi      # 0x500e
leaq -0xc8(%rbp), %rdi
callq 0x2200
leaq -0x40(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2b4a
movq 0x5b7d(%rip), %rdi      # 0x7fc8
leaq 0x2bc8(%rip), %rsi      # 0x501a
callq 0x2130
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2d0c
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq 0x2b95(%rip), %rsi      # 0x5020
leaq -0x30(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x2a28
leaq -0xa8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2b4a
leaq -0xa8(%rbp), %rdi
callq 0x2cf8
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq -0x80(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x31a2
movq 0x5af0(%rip), %rdi      # 0x7fc8
leaq 0x2b6a(%rip), %rsi      # 0x5049
callq 0x2130
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x2d0c
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x2080
movq 0x5ab0(%rip), %rdi      # 0x7fc8
leaq 0x2b30(%rip), %rsi      # 0x504f
callq 0x2130
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x3026
leaq -0x30(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2d0c
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq -0xa0(%rbp), %rdi
callq 0x2cf8
leaq 0x2ae8(%rip), %rsi      # 0x5063
leaq -0x30(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x2a28
leaq -0x78(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2b4a
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq 0x2abf(%rip), %rsi      # 0x5067
leaq -0x30(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0x2a28
leaq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2b4a
leaq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x2080
movq $0xa, (%rbx)
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0x30(%rbp), %rcx
callq 0x3224
movq 0x59d4(%rip), %rdi      # 0x7fc8
leaq 0x2a70(%rip), %rsi      # 0x506b
callq 0x2130
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2d0c
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x2080
movq 0x5994(%rip), %rdi      # 0x7fc8
leaq 0x2a45(%rip), %rsi      # 0x5080
callq 0x2130
movq %rax, %rbx
leaq 0x2a19(%rip), %rsi      # 0x5063
leaq -0xa0(%rbp), %rdi
leaq -0x32(%rbp), %rdx
callq 0x2a28
leaq -0x60(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2b4a
leaq 0x29f6(%rip), %rsi      # 0x5067
leaq -0xe8(%rbp), %rdi
leaq -0x31(%rbp), %rdx
callq 0x2a28
leaq -0x58(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2b4a
leaq -0xf0(%rbp), %rcx
movq $0xa, (%rcx)
leaq -0x68(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x3224
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2d0c
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x2080
leaq -0x68(%rbp), %rdi
callq 0x2cf8
leaq -0x58(%rbp), %rdi
callq 0x2cf8
leaq -0xe8(%rbp), %r14
movq %r14, %rdi
callq 0x2080
leaq -0x60(%rbp), %rdi
callq 0x2cf8
leaq -0xa0(%rbp), %rdi
callq 0x2080
movq $0x6, (%rbx)
movq $0xa, (%r14)
leaq -0xa0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
leaq -0x50(%rbp), %rcx
callq 0x3351
movq 0x5885(%rip), %rdi      # 0x7fc8
leaq 0x293b(%rip), %rsi      # 0x5085
callq 0x2130
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2d0c
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x2120
movq %rax, %rdi
callq 0x2090
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq -0xa0(%rbp), %rdi
callq 0x2cf8
leaq -0x50(%rbp), %rdi
callq 0x2cf8
leaq -0x70(%rbp), %rdi
callq 0x2cf8
leaq -0x78(%rbp), %rdi
callq 0x2cf8
leaq -0x80(%rbp), %rdi
callq 0x2cf8
leaq -0x40(%rbp), %rdi
callq 0x2cf8
leaq -0x48(%rbp), %rdi
callq 0x2cf8
leaq -0xc8(%rbp), %rdi
callq 0x2080
xorl %eax, %eax
addq $0xe0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x27dd
movq %rax, %rbx
jmp 0x293a
jmp 0x2992
movq %rax, %rbx
jmp 0x2954
movq %rax, %rbx
jmp 0x295d
movq %rax, %rbx
jmp 0x2966
movq %rax, %rbx
jmp 0x2972
movq %rax, %rbx
jmp 0x297b
jmp 0x2992
jmp 0x2992
movq %rax, %rbx
jmp 0x299e
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
jmp 0x29a7
movq %rax, %rbx
jmp 0x29a7
jmp 0x29f4
jmp 0x2a02
movq %rax, %rbx
jmp 0x29eb
jmp 0x2a02
jmp 0x2a02
movq %rdx, %r14
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
jmp 0x2875
jmp 0x290c
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x2, %r14d
jne 0x28ad
movq %rbx, %rdi
callq 0x2060
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0x5735(%rip), %rdi      # 0x7fc8
movq %rax, %rsi
callq 0x2130
movq %rax, %rdi
callq 0x2090
callq 0x21a0
jmp 0x24c0
cmpl $0x1, %r14d
jne 0x29b9
movq %rbx, %rdi
callq 0x2060
movq 0x5702(%rip), %rdi      # 0x7fc8
leaq 0x2761(%rip), %rsi      # 0x502e
callq 0x2130
movq %rax, %rdi
callq 0x2090
callq 0x21a0
jmp 0x24c0
jmp 0x290c
jmp 0x290c
movq %rax, %rbx
callq 0x21a0
jmp 0x29b9
movq %rax, %rbx
callq 0x21a0
jmp 0x29b9
movq %rax, %rdi
callq 0x2a63
jmp 0x290c
movq %rax, %rbx
jmp 0x29b9
jmp 0x2a23
jmp 0x2a23
movq %rax, %rbx
jmp 0x29cb
movq %rax, %rbx
jmp 0x29d7
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq -0xa0(%rbp), %rdi
callq 0x2cf8
jmp 0x2995
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq -0x68(%rbp), %rdi
callq 0x2cf8
leaq -0x58(%rbp), %rdi
callq 0x2cf8
leaq -0xe8(%rbp), %rdi
callq 0x2080
leaq -0x60(%rbp), %rdi
callq 0x2cf8
leaq -0xa0(%rbp), %rdi
jmp 0x298b
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
jmp 0x2995
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2cf8
leaq -0x70(%rbp), %rdi
callq 0x2cf8
leaq -0x78(%rbp), %rdi
callq 0x2cf8
leaq -0x80(%rbp), %rdi
callq 0x2cf8
leaq -0x40(%rbp), %rdi
callq 0x2cf8
leaq -0x48(%rbp), %rdi
callq 0x2cf8
leaq -0xc8(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x21d0
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
leaq -0xa0(%rbp), %rdi
jmp 0x29ab
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
jmp 0x29b0
movq %rax, %rbx
jmp 0x29b0
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
jmp 0x29b9
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2080
jmp 0x29c2
movq %rax, %rbx
jmp 0x29c2