// File: cmirnov[P]triangular-arbitrage/exchange.cpp
// Function: Exchange::Exchange(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
Exchange::Exchange(std::string url, std::vector<std::string> currency) {
	converter = new Converter(currency);

	matrix.resize(currency.size());
	for (int i = 0; i < currency.size(); ++i) {
		for (int j = 0; j < currency.size(); ++j) {
			if (i != j) {
				matrix[i].push_back(new Orderbook(converter->nameToInt(currency[i]), converter->nameToInt(currency[j]), url));
				matrix[i].back()->update();
			} else {
				matrix[i].push_back(NULL);
			}
		}
	}

	sellFee.resize(currency.size());
	buyFee.resize(currency.size());
	for (int i = 0; i < currency.size(); ++i) {
		sellFee[i] = 1.5;
		buyFee[i] = 2.5;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rsi, -0x108(%rbp)
movq %rdx, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
addq $0x8, %rdi
movq %rdi, -0xf8(%rbp)
callq 0x3050
movq -0xe8(%rbp), %rdi
addq $0x20, %rdi
movq %rdi, -0xf0(%rbp)
callq 0x3050
movq -0xe8(%rbp), %rdi
addq $0x38, %rdi
movq %rdi, -0xe0(%rbp)
callq 0x3070
movl $0x18, %edi
callq 0x2170
movq %rax, -0xd8(%rbp)
jmp 0x24e1
movq -0x100(%rbp), %rsi
movb $0x1, -0x41(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3090
jmp 0x24f7
movq -0xd8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x9860
jmp 0x2509
movq -0xe8(%rbp), %rax
movq -0xd8(%rbp), %rcx
movb $0x0, -0x41(%rbp)
movq %rcx, (%rax)
leaq -0x40(%rbp), %rdi
callq 0x3180
movq -0xe8(%rbp), %rax
movq -0x100(%rbp), %rdi
addq $0x38, %rax
movq %rax, -0x110(%rbp)
callq 0x3270
movq -0x110(%rbp), %rdi
movq %rax, %rsi
callq 0x31e0
jmp 0x2556
movl $0x0, -0x48(%rbp)
movq -0x100(%rbp), %rdi
movslq -0x48(%rbp), %rax
movq %rax, -0x118(%rbp)
callq 0x3270
movq %rax, %rcx
movq -0x118(%rbp), %rax
cmpq %rcx, %rax
jae 0x284f
movl $0x0, -0x4c(%rbp)
movq -0x100(%rbp), %rdi
movslq -0x4c(%rbp), %rax
movq %rax, -0x120(%rbp)
callq 0x3270
movq %rax, %rcx
movq -0x120(%rbp), %rax
cmpq %rcx, %rax
jae 0x283f
movl -0x48(%rbp), %eax
cmpl -0x4c(%rbp), %eax
je 0x27fd
movq -0xe8(%rbp), %rdi
addq $0x38, %rdi
movslq -0x48(%rbp), %rsi
callq 0x3290
movq %rax, -0x130(%rbp)
movl $0x40, %edi
callq 0x2170
movq %rax, -0x128(%rbp)
jmp 0x25f2
movq -0x100(%rbp), %rdi
movq -0xe8(%rbp), %rax
movb $0x1, -0xb9(%rbp)
movq (%rax), %rax
movq %rax, -0x138(%rbp)
movslq -0x48(%rbp), %rsi
callq 0x32e0
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x2080
jmp 0x2628
movq -0x138(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x99c0
movl %eax, -0x13c(%rbp)
jmp 0x2640
movq -0x100(%rbp), %rdi
movq -0xe8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x148(%rbp)
movslq -0x4c(%rbp), %rsi
callq 0x32e0
movq %rax, %rsi
leaq -0x98(%rbp), %rdi
callq 0x2080
jmp 0x2672
movq -0x148(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x99c0
movl %eax, -0x14c(%rbp)
jmp 0x268d
movq -0x108(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x2080
jmp 0x26a2
movl -0x14c(%rbp), %edx
movl -0x13c(%rbp), %esi
movq -0x128(%rbp), %rdi
leaq -0xb8(%rbp), %rcx
callq 0xa3c0
jmp 0x26c3
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rax
movb $0x0, -0xb9(%rbp)
movq %rax, -0x58(%rbp)
leaq -0x58(%rbp), %rsi
callq 0x32b0
jmp 0x26e7
leaq -0xb8(%rbp), %rdi
callq 0x20e0
leaq -0x98(%rbp), %rdi
callq 0x20e0
leaq -0x78(%rbp), %rdi
callq 0x20e0
movq -0xe8(%rbp), %rdi
addq $0x38, %rdi
movslq -0x48(%rbp), %rsi
callq 0x3290
movq %rax, %rdi
callq 0x3300
movq (%rax), %rdi
callq 0xa450
jmp 0x272e
jmp 0x282f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2938
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x2767
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3180
testb $0x1, -0x41(%rbp)
jne 0x276f
jmp 0x2780
movq -0xd8(%rbp), %rdi
movl $0x18, %esi
callq 0x2180
jmp 0x2938
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x27dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x27d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x27c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x20e0
leaq -0x98(%rbp), %rdi
callq 0x20e0
leaq -0x78(%rbp), %rdi
callq 0x20e0
testb $0x1, -0xb9(%rbp)
jne 0x27e7
jmp 0x27f8
movq -0x128(%rbp), %rdi
movl $0x40, %esi
callq 0x2180
jmp 0x2938
movq -0xe8(%rbp), %rdi
addq $0x38, %rdi
movslq -0x48(%rbp), %rsi
callq 0x3290
movq %rax, %rdi
movq $0x0, -0xc8(%rbp)
leaq -0xc8(%rbp), %rsi
callq 0x32b0
jmp 0x282d
jmp 0x282f
jmp 0x2831
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x258e
jmp 0x2841
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x255d
movq -0x100(%rbp), %rdi
movq -0xe8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x158(%rbp)
callq 0x3270
movq -0x158(%rbp), %rdi
movq %rax, %rsi
callq 0x3340
jmp 0x287e
movq -0x100(%rbp), %rdi
movq -0xe8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x160(%rbp)
callq 0x3270
movq -0x160(%rbp), %rdi
movq %rax, %rsi
callq 0x3340
jmp 0x28ad
movl $0x0, -0xcc(%rbp)
movq -0x100(%rbp), %rdi
movslq -0xcc(%rbp), %rax
movq %rax, -0x168(%rbp)
callq 0x3270
movq %rax, %rcx
movq -0x168(%rbp), %rax
cmpq %rcx, %rax
jae 0x292f
movq -0xe8(%rbp), %rdi
addq $0x8, %rdi
movslq -0xcc(%rbp), %rsi
callq 0x33d0
movq -0xe8(%rbp), %rdi
flds 0xb700(%rip)            # 0xe004
fstpt (%rax)
addq $0x20, %rdi
movslq -0xcc(%rbp), %rsi
callq 0x33d0
flds 0xb6ec(%rip)            # 0xe008
fstpt (%rax)
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x28b7
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0xe0(%rbp), %rdi
callq 0x33f0
movq -0xf0(%rbp), %rdi
callq 0x3450
movq -0xf8(%rbp), %rdi
callq 0x3450
movq -0x20(%rbp), %rdi
callq 0x2250
nopw %cs:(%rax,%rax)