LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: jixinqi[P]lazurite/./src/lazurite_core/http_request.cpp
// Function: lazurite::http::request_parser::do_parse()
bool lazurite::http::request_parser::do_parse()
{
    if (_request.first_line_end_index() == 0)
    {
        if (!parser_first_line())
        {
            return false;
        }
    }
    if (_request.first_line_end_index() != 0 && _request.header_end_index() == 0)
    {
        if (!parser_header())
        {
            return false;
        }
    }
    if (_request.header_end_index() != 0 && _request.body_end_index() == 0)
    {
        if (!parser_body())
        {
            return false;
        }
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x18(%rbp)
callq 0x25cb0
cmpq $0x0, %rax
jne 0x25df4
movq -0x18(%rbp), %rdi
callq 0x25e70
testb $0x1, %al
jne 0x25df2
movb $0x0, -0x1(%rbp)
jmp 0x25e5e
jmp 0x25df4
movq -0x18(%rbp), %rdi
callq 0x25cb0
cmpq $0x0, %rax
je 0x25e27
movq -0x18(%rbp), %rdi
callq 0x25cd0
cmpq $0x0, %rax
jne 0x25e27
movq -0x18(%rbp), %rdi
callq 0x26280
testb $0x1, %al
jne 0x25e25
movb $0x0, -0x1(%rbp)
jmp 0x25e5e
jmp 0x25e27
movq -0x18(%rbp), %rdi
callq 0x25cd0
cmpq $0x0, %rax
je 0x25e5a
movq -0x18(%rbp), %rdi
callq 0x25cf0
cmpq $0x0, %rax
jne 0x25e5a
movq -0x18(%rbp), %rdi
callq 0x267b0
testb $0x1, %al
jne 0x25e58
movb $0x0, -0x1(%rbp)
jmp 0x25e5e
jmp 0x25e5a
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: jixinqi[P]lazurite/./src/lazurite_core/http_request.cpp
// Function: lazurite::http::request_parser::parser_body()
bool lazurite::http::request_parser::parser_body()
{
    if (_request.request_method() == "GET")
    {
        _request.body_end_index(_request.raw_msg().length());
        return true;
    }
    else
    {
        return false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0x78(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x25b40
movq -0x70(%rbp), %rdi
leaq 0x5aa1(%rip), %rsi      # 0x2c280
callq 0x26bb0
movb %al, -0x61(%rbp)
jmp 0x267e9
leaq -0x30(%rbp), %rdi
callq 0x67a8
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x267fb
jmp 0x26843
movq -0x78(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x25b10
leaq -0x60(%rbp), %rdi
callq 0x65d0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x25c90
leaq -0x60(%rbp), %rdi
callq 0x67a8
movb $0x1, -0x1(%rbp)
jmp 0x26847
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x67a8
jmp 0x26855
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x6680
nop
// File: jixinqi[P]lazurite/./src/lazurite_core/http_route.cpp
// Function: lazurite::http::route::run_handle(lazurite::http::request&, lazurite::http::response&)
void lazurite::http::route::run_handle(request &_request, response &_response)
{
    std::string path = _request.request_uri();
    auto it = route_table.find(path);
    if (it == route_table.end())
    {
        _response.status_code(404);
        _response.phrase("Not Found");
        _response.error_msg_body();
    }
    else
    {
        route_table[path](_request, _response);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x25b70
movq -0x98(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x28b00
movq %rax, -0x88(%rbp)
jmp 0x28892
movq -0x98(%rbp), %rdi
movq -0x88(%rbp), %rax
movq %rax, -0x40(%rbp)
callq 0x28b60
movq %rax, -0x58(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x28b30
testb $0x1, %al
jne 0x288c3
jmp 0x28974
movq -0x18(%rbp), %rdi
movl $0x194, %esi            # imm = 0x194
callq 0x24ed0
jmp 0x288d3
movq -0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x66b0
movq -0xa0(%rbp), %rdx
leaq 0x3a20(%rip), %rsi      # 0x2c31c
leaq -0x78(%rbp), %rdi
callq 0x6540
jmp 0x28907
movq -0xa8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x24ef0
jmp 0x28919
leaq -0x78(%rbp), %rdi
callq 0x67a8
leaq -0x79(%rbp), %rdi
callq 0x6420
movq -0x18(%rbp), %rdi
callq 0x24fd0
jmp 0x28936
jmp 0x289a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x289b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x28969
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x67a8
leaq -0x79(%rbp), %rdi
callq 0x6420
jmp 0x289b7
movq -0x98(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x28b90
movq %rax, -0xb0(%rbp)
jmp 0x2898d
movq -0xb0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x28c70
jmp 0x289a3
jmp 0x289a5
leaq -0x38(%rbp), %rdi
callq 0x67a8
addq $0xb0, %rsp
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x67a8
movq -0x48(%rbp), %rdi
callq 0x6680
nopl (%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumberCompareTo58(BigNumber*)
BigNumberCompare BigNumberCompareTo58(BigNumber * a)
{
	if(a->length > 1)
		return CB_COMPARE_MORE_THAN;
	if (a->data[0] > 58)
		return CB_COMPARE_MORE_THAN;
	else if (a->data[0] < 58)
		return CB_COMPARE_LESS_THAN;
	return CB_COMPARE_EQUAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, 0x100(%rax)
jbe 0x23ae
movl $0x1, -0x4(%rbp)
jmp 0x23e1
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3a, %eax
jle 0x23c3
movl $0x1, -0x4(%rbp)
jmp 0x23e1
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3a, %eax
jge 0x23d8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x23e1
jmp 0x23da
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumberCompareToBigInt(BigNumber*, BigNumber*)
BigNumberCompare BigNumberCompareToBigInt(BigNumber * a, BigNumber * b)
{
	if (a->length > b->length)
		return CB_COMPARE_MORE_THAN;
	else if (a->length < b->length)
		return CB_COMPARE_LESS_THAN;
	for (uint32_t x = a->length; x--;) 
	{
		if (a->data[x] < b->data[x])
			return CB_COMPARE_LESS_THAN;
		else if (a->data[x] > b->data[x])
			return CB_COMPARE_MORE_THAN;
	}
	return CB_COMPARE_EQUAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x100(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x100(%rcx), %eax
jbe 0x241e
movl $0x1, -0x4(%rbp)
jmp 0x24ad
movq -0x10(%rbp), %rax
movl 0x100(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x100(%rcx), %eax
jae 0x243d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x24ad
jmp 0x243f
movq -0x10(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x24a6
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x247f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x24ad
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jle 0x24a2
movl $0x1, -0x4(%rbp)
jmp 0x24ad
jmp 0x24a4
jmp 0x244c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumberEqualsDivisionBy58(BigNumber*, unsigned char*)
void BigNumberEqualsDivisionBy58(BigNumber * a, uint8_t * ans)
{
	if (a->length == 1 && ! a->data[0]) // "a" is zero
		return;
	// base-256 long division.
	uint16_t temp = 0;
	for (uint32_t x = a->length; x--;) 
	{
		temp <<= 8;
		temp |= a->data[x];
		ans[x] = (uint8_t)(temp / 58);
		temp -= ans[x] * 58;
	}
	if (! ans[a->length-1]) // If last byte is zero, adjust length.
		a->length--;
	memmove(a->data, ans, a->length); // Done calculation. Move ans to "a".
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x100(%rax)
jne 0x269b
movq -0x8(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x269b
jmp 0x2755
movw $0x0, -0x12(%rbp)
movq -0x8(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x18(%rbp)
cmpl $0x0, %eax
je 0x2710
movzwl -0x12(%rbp), %eax
shll $0x8, %eax
movw %ax, -0x12(%rbp)
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
movzbl (%rax,%rcx), %ecx
movzwl -0x12(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x12(%rbp)
movzwl -0x12(%rbp), %eax
movl $0x3a, %ecx
cltd
idivl %ecx
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
movzbl (%rax,%rcx), %eax
imull $0x3a, %eax, %ecx
movzwl -0x12(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x12(%rbp)
jmp 0x26ae
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x100(%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x273c
movq -0x8(%rbp), %rax
movl 0x100(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x100(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, %edx
callq 0x2250
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumberEqualsMultiplicationByUInt8(BigNumber*, unsigned char)
bool BigNumberEqualsMultiplicationByUInt8(BigNumber * a, uint8_t b)
{
	if (! b) 
	{
		// Mutliplication by zero. "a" becomes zero
		a->length = 1;
		a->data[0] = 0;
		return true;
	}
	if (a->length == 1 && ! a->data[0]) // "a" is zero
		return true;
	// Multiply b by each byte and then add to answer
	uint16_t carry = 0;
	uint8_t x = 0;
	for (; x < a->length; x++) 
	{
		carry = carry + a->data[x] * b; // Allow for overflow onto next byte.
		a->data[x] = (uint8_t)carry;
		carry >>= 8;
	}
	if (carry) 
	{ // If last byte is not zero, adjust length.
		a->length++;
		assert( a->length < MAX_BIG_NUMBER );
		a->data[x] = (uint8_t)carry;
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
cmpb $0x0, -0x11(%rbp)
jne 0x2796
movq -0x10(%rbp), %rax
movl $0x1, 0x100(%rax)
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x2872
movq -0x10(%rbp), %rax
cmpl $0x1, 0x100(%rax)
jne 0x27b5
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x27b5
movb $0x1, -0x1(%rbp)
jmp 0x2872
movw $0x0, -0x14(%rbp)
movb $0x0, -0x15(%rbp)
movzbl -0x15(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x100(%rcx), %eax
jae 0x2812
movzwl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl -0x15(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
movzbl -0x11(%rbp), %edx
imull %edx, %ecx
addl %ecx, %eax
movw %ax, -0x14(%rbp)
movw -0x14(%rbp), %ax
movb %al, %dl
movq -0x10(%rbp), %rax
movzbl -0x15(%rbp), %ecx
movb %dl, (%rax,%rcx)
movzwl -0x14(%rbp), %eax
sarl $0x8, %eax
movw %ax, -0x14(%rbp)
movb -0x15(%rbp), %al
addb $0x1, %al
movb %al, -0x15(%rbp)
jmp 0x27bf
cmpw $0x0, -0x14(%rbp)
je 0x286e
movq -0x10(%rbp), %rax
movl 0x100(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x100(%rax)
movq -0x10(%rbp), %rax
cmpl $0x100, 0x100(%rax)     # imm = 0x100
jae 0x283e
jmp 0x285d
leaq 0x2d7bf(%rip), %rdi     # 0x30004
leaq 0x2d7d3(%rip), %rsi     # 0x3001f
movl $0xe2, %edx
leaq 0x2d811(%rip), %rcx     # 0x30069
callq 0x20c0
movw -0x14(%rbp), %ax
movb %al, %dl
movq -0x10(%rbp), %rax
movzbl -0x15(%rbp), %ecx
movb %dl, (%rax,%rcx)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumberEqualsSubtractionByBigInt(BigNumber*, BigNumber*)
void BigNumberEqualsSubtractionByBigInt(BigNumber * a, BigNumber * b)
{
	uint8_t x;
	bool carry = 0;
	// This can be made much nicer when using signed arithmetic, 
	// carry and tmp could be merged to be 0 or -1 between rounds.
	for (x = 0; x < b->length; x++) {
		uint16_t tmp = carry + b->data[x];
		carry = a->data[x] < tmp;
		a->data[x] -= (uint8_t)tmp;
	}
	if (carry)
		a->data[x]--;
	BigNumberNormalise(a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x12(%rbp)
movb $0x0, -0x11(%rbp)
movzbl -0x11(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x100(%rcx), %eax
jae 0x28fe
movb -0x12(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movq -0x10(%rbp), %rcx
movzbl -0x11(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
addl %ecx, %eax
movw %ax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movzbl -0x11(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movzwl -0x14(%rbp), %ecx
cmpl %ecx, %eax
setl %al
andb $0x1, %al
movb %al, -0x12(%rbp)
movw -0x14(%rbp), %ax
movzbl %al, %esi
movq -0x8(%rbp), %rax
movzbl -0x11(%rbp), %ecx
movzbl (%rax,%rcx), %edx
subl %esi, %edx
movb %dl, (%rax,%rcx)
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0x2898
testb $0x1, -0x12(%rbp)
je 0x2915
movq -0x8(%rbp), %rax
movzbl -0x11(%rbp), %ecx
movb (%rax,%rcx), %dl
addb $-0x1, %dl
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rdi
callq 0x2930
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumberEqualsSubtractionByUInt8(BigNumber*, unsigned char)
void BigNumberEqualsSubtractionByUInt8(BigNumber * a, uint8_t b)
{
	uint8_t carry = b;
	uint8_t x = 0;
	for (; a->data[x] < carry; x++){
		a->data[x] = 255 - carry + a->data[x] + 1;
		carry = 1;
	}
	a->data[x] -= carry;
	BigNumberNormalise(a);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movb -0x9(%rbp), %al
movb %al, -0xa(%rbp)
movb $0x0, -0xb(%rbp)
movq -0x8(%rbp), %rax
movzbl -0xb(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movzbl -0xa(%rbp), %ecx
cmpl %ecx, %eax
jge 0x29f7
movzbl -0xa(%rbp), %ecx
movl $0xff, %eax
subl %ecx, %eax
movq -0x8(%rbp), %rcx
movzbl -0xb(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
addl %ecx, %eax
addl $0x1, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movzbl -0xb(%rbp), %ecx
movb %dl, (%rax,%rcx)
movb $0x1, -0xa(%rbp)
movb -0xb(%rbp), %al
addb $0x1, %al
movb %al, -0xb(%rbp)
jmp 0x29ac
movzbl -0xa(%rbp), %esi
movq -0x8(%rbp), %rax
movzbl -0xb(%rbp), %ecx
movzbl (%rax,%rcx), %edx
subl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rdi
callq 0x2930
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumberFromPowUInt8(BigNumber*, unsigned char, unsigned char)
bool BigNumberFromPowUInt8(BigNumber * bi, uint8_t a, uint8_t b)
{
	bi->length = 1;
	bi->data[0] = 1;
	for (uint8_t x = 0; x < b; x++) {
		if (! BigNumberEqualsMultiplicationByUInt8(bi, a))
			// ERROR
			return false;
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movb %sil, %cl
movq %rdi, -0x10(%rbp)
movb %cl, -0x11(%rbp)
movb %al, -0x12(%rbp)
movq -0x10(%rbp), %rax
movl $0x1, 0x100(%rax)
movq -0x10(%rbp), %rax
movb $0x1, (%rax)
movb $0x0, -0x13(%rbp)
movzbl -0x13(%rbp), %eax
movzbl -0x12(%rbp), %ecx
cmpl %ecx, %eax
jge 0x2a7f
movq -0x10(%rbp), %rdi
movzbl -0x11(%rbp), %esi
callq 0x2760
testb $0x1, %al
jne 0x2a73
movb $0x0, -0x1(%rbp)
jmp 0x2a83
jmp 0x2a75
movb -0x13(%rbp), %al
addb $0x1, %al
movb %al, -0x13(%rbp)
jmp 0x2a50
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nop
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumberModuloWith58(BigNumber*)
uint8_t BigNumberModuloWith58(BigNumber * a)
{
	// Use method presented here: http://stackoverflow.com/a/10441333/238411
	uint16_t result = 0; // Prevent overflow in calculations
	for(uint32_t x = a->length - 1;; x--){
		result *= (256 % 58);
		result %= 58;
		result += a->data[x] % 58;
		result %= 58;
		if (! x)
			break;
	}
	return (uint8_t)result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movw $0x0, -0xa(%rbp)
movq -0x8(%rbp), %rax
movl 0x100(%rax), %eax
subl $0x1, %eax
movl %eax, -0x10(%rbp)
movzwl -0xa(%rbp), %eax
imull $0x18, %eax, %eax
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
movl $0x3a, %ecx
cltd
idivl %ecx
movw %dx, %ax
movw %ax, -0xa(%rbp)
movq -0x8(%rbp), %rax
movl -0x10(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movl $0x3a, %ecx
cltd
idivl %ecx
movzwl -0xa(%rbp), %eax
addl %edx, %eax
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
movl $0x3a, %ecx
cltd
idivl %ecx
movw %dx, %ax
movw %ax, -0xa(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x2b04
jmp 0x2b11
jmp 0x2b06
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2aae
movw -0xa(%rbp), %ax
popq %rbp
retq
nopw (%rax,%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: encodeBase58(unsigned char const*, unsigned int, bool, char*, unsigned int)
bool encodeBase58(const uint8_t *bigNumber, // The block of memory corresponding to the 'big number'
					   uint32_t length,			 // The number of bytes in the 'big-number'; this will be 25 for a bitcoin address
					   bool isBigEndian,		 // True if the input number is in little-endian format (this will be true for a bitcoin address)
					   char *output,			 // The address to store the output string.
					   uint32_t maxStrLen)		 // the maximum length of the output string
{
	// Before passing the hash into the base58 encoder; we need to reverse the byte order.
	uint8_t hash[25];
	if ( isBigEndian )
	{
		uint32_t index = length-1;
		for (uint32_t i=0; i<25; i++)
		{
			hash[i] = bigNumber[index];
			index--;
		}
	}
	else
	{
		memcpy(hash,bigNumber,length);
	}
	// We now have the 25 byte public key address in binary; we just need to convert it to ASCII
	// This involves using large integer math to compute the base58 encoding (with check) 
	BigNumber bytes(hash,length);;
	return CBEncodeBase58(&bytes,output,maxStrLen);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
testb $0x1, -0xd(%rbp)
je 0x30a4
movl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
cmpl $0x19, -0x48(%rbp)
jae 0x30a2
movq -0x8(%rbp), %rax
movl -0x44(%rbp), %ecx
movb (%rax,%rcx), %cl
movl -0x48(%rbp), %eax
movb %cl, -0x40(%rbp,%rax)
movl -0x44(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3077
jmp 0x30b6
leaq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl -0xc(%rbp), %eax
movl %eax, %edx
callq 0x20f0
leaq -0x40(%rbp), %rsi
movl -0xc(%rbp), %edx
leaq -0x14c(%rbp), %rdi
callq 0x31e0
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
leaq -0x14c(%rbp), %rdi
callq 0x2de0
andb $0x1, %al
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw (%rax,%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: decodeBase58(char const*, unsigned char*, unsigned int, bool)
uint32_t decodeBase58(const char *string,		// The base58 encoded string
					   uint8_t *output,			// The output binary buffer
					   uint32_t maxOutputLength, // The maximum output length of the binary buffer.
					   bool isBigEndian) // If the output needs to be in little endian format
{
	uint32_t ret = 0;

	BigNumber bn(NULL,0);
	if ( CBDecodeBase58(&bn,string) && bn.length <= maxOutputLength )
	{
		ret = bn.length;
		if ( isBigEndian ) // if the caller wants the number returned in little endian format; then we byte reverse the output
		{
			uint32_t index = bn.length-1;
			for (uint32_t i=0; i<bn.length; i++)
			{
				output[i] = bn.data[index];
				index--;
			}
		}
		else
		{
			memcpy(output,bn.data,bn.length);
		}
	}

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
andb $0x1, %al
movb %al, -0x15(%rbp)
movl $0x0, -0x1c(%rbp)
leaq -0x120(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x31e0
movq -0x8(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x2b20
testb $0x1, %al
jne 0x313f
jmp 0x31cb
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
ja 0x31cb
movl -0x20(%rbp), %eax
movl %eax, -0x1c(%rbp)
testb $0x1, -0x15(%rbp)
je 0x31b4
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x124(%rbp)
movl $0x0, -0x128(%rbp)
movl -0x128(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0x31b2
movl -0x124(%rbp), %eax
movb -0x120(%rbp,%rax), %dl
movq -0x10(%rbp), %rax
movl -0x128(%rbp), %ecx
movb %dl, (%rax,%rcx)
movl -0x124(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x124(%rbp)
movl -0x128(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x128(%rbp)
jmp 0x316d
jmp 0x31c9
movq -0x10(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movl -0x20(%rbp), %eax
movl %eax, %edx
callq 0x20f0
jmp 0x31cb
movl -0x1c(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)
// File: jeffchan[P]blockchain-parser/Base58.cpp
// Function: BigNumber::BigNumber(unsigned char const*, unsigned int)
BigNumber(const uint8_t *sourceData,uint32_t len)
	{
		assert(len<MAX_BIG_NUMBER);
		memset(data,0,MAX_BIG_NUMBER);
		if ( sourceData )
		{
			memcpy(data,sourceData,len);
		}
		length = len;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpl $0x100, -0x14(%rbp)     # imm = 0x100
jae 0x3206
jmp 0x3225
leaq 0x2cee7(%rip), %rdi     # 0x300f4
leaq 0x2ce0b(%rip), %rsi     # 0x3001f
movl $0x2d, %edx
leaq 0x2dbd3(%rip), %rcx     # 0x30df3
callq 0x20c0
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x20b0
cmpq $0x0, -0x10(%rbp)
je 0x324e
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %eax
movl %eax, %edx
callq 0x20f0
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, 0x100(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: jeffchan[P]blockchain-parser/BitcoinAddress.cpp
// Function: RIPEMD160::MDfinish(unsigned int*, unsigned char const*, unsigned int, unsigned int)
void MDfinish(uint32_t *MDbuf,const uint8_t *strptr, uint32_t lswlen, uint32_t mswlen)
{
   unsigned int i;                                 /* counter       */
   uint32_t        X[16];                             /* message words */

   memset(X, 0, 16*sizeof(uint32_t));

   /* put bytes from strptr into X */
   for (i=0; i<(lswlen&63); i++) {
      /* uint8_t i goes into word X[i div 4] at pos.  8*(i mod 4)  */
      X[i>>2] ^= (uint32_t) *strptr++ << (8 * (i&3));
   }

   /* append the bit m_n == 1 */
   X[(lswlen>>2)&15] ^= (uint32_t)1 << (8*(lswlen&3) + 7);

   if ((lswlen & 63) > 55) {
      /* length goes to next block */
      compress(MDbuf, X);
      memset(X, 0, 16*sizeof(uint32_t));
   }

   /* append length in bits*/
   X[14] = lswlen << 3;
   X[15] = (lswlen >> 29) | (mswlen << 3);
   compress(MDbuf, X);

   return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x20b0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl -0x14(%rbp), %ecx
andl $0x3f, %ecx
cmpl %ecx, %eax
jae 0x6454
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movzbl (%rax), %eax
movl -0x1c(%rbp), %ecx
andl $0x3, %ecx
shll $0x3, %ecx
shll %cl, %eax
movl %eax, %ecx
movl -0x1c(%rbp), %eax
shrl $0x2, %eax
movl %eax, %eax
xorl -0x60(%rbp,%rax,4), %ecx
movl %ecx, -0x60(%rbp,%rax,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x640d
movl -0x14(%rbp), %ecx
andl $0x3, %ecx
shll $0x3, %ecx
addl $0x7, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movl -0x14(%rbp), %eax
shrl $0x2, %eax
andl $0xf, %eax
movl %eax, %eax
xorl -0x60(%rbp,%rax,4), %ecx
movl %ecx, -0x60(%rbp,%rax,4)
movl -0x14(%rbp), %eax
andl $0x3f, %eax
cmpl $0x37, %eax
jbe 0x64a4
movq -0x8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x32b0
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x20b0
movl -0x14(%rbp), %eax
shll $0x3, %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %eax
shrl $0x1d, %eax
movl -0x18(%rbp), %ecx
shll $0x3, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x32b0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/BitcoinAddress.cpp
// Function: SHA256::burnStack(int)
static void burnStack(int size)
	{
		char buf[128];

		memset(buf, 0, sizeof(buf));
		size -= sizeof(buf);
		if (size > 0)
			burnStack(size);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl %edi, -0x4(%rbp)
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x20b0
movslq -0x4(%rbp), %rax
subq $0x80, %rax
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jle 0xc7dc
movl -0x4(%rbp), %edi
callq 0xc7a0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/BitcoinAddress.cpp
// Function: SHA256::sha256_finalize(SHA256::sha256_ctx_t*, unsigned char*)
void sha256_finalize(sha256_ctx_t * sc, uint8_t hash[SHA256_HASH_SIZE])
	{
		uint32_t bytesToPad;
		uint64_t lengthPad;
		int i;

		bytesToPad = 120L - sc->bufferLength;
		if (bytesToPad > 64L)
		{
			bytesToPad -= 64L;
		}

		lengthPad = BYTESWAP64(sc->totalLength);

		sha256_update(sc, padding, bytesToPad);
		sha256_update(sc, &lengthPad, 8L);

		if (hash) 
		{
			for (i = 0; i < SHA256_HASH_WORDS; i++) 
			{
				*((uint32_t *) hash) = BYTESWAP(sc->hash[i]);
				hash += 4;
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, %ecx
movl $0x78, %eax
subq %rcx, %rax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpq $0x40, %rax
jle 0xc827
movl -0x14(%rbp), %eax
subq $0x40, %rax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0xc900
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq 0x23b2b(%rip), %rsi     # 0x30370
callq 0x6700
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
movl $0x8, %edx
callq 0x6700
cmpq $0x0, -0x10(%rbp)
je 0xc8f0
movl $0x0, -0x24(%rbp)
cmpl $0x8, -0x24(%rbp)
jge 0xc8ee
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl 0x8(%rax,%rcx,4), %eax
shrl $0x8, %eax
movq -0x8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movl 0x8(%rcx,%rdx,4), %ecx
shll $0x18, %ecx
orl %ecx, %eax
movl %eax, %eax
movabsq $0xff00ff00, %rcx       # imm = 0xFF00FF00
andq %rcx, %rax
movq -0x8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movl 0x8(%rcx,%rdx,4), %ecx
shll $0x8, %ecx
movq -0x8(%rbp), %rdx
movslq -0x24(%rbp), %rsi
movl 0x8(%rdx,%rsi,4), %edx
shrl $0x18, %edx
orl %edx, %ecx
movl %ecx, %ecx
andq $0xff00ff, %rcx         # imm = 0xFF00FF
orq %rcx, %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x10(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xc86e
jmp 0xc8f0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/BitcoinAddress.cpp
// Function: bitcoinPublicKeyToAddress(unsigned char const*, unsigned char*)
bool bitcoinPublicKeyToAddress(const uint8_t input[65], // The 65 bytes long ECDSA public key; first byte will always be 0x4 followed by two 32 byte components
							   uint8_t output[25])		// A bitcoin address (in binary( is always 25 bytes long.
{
	bool ret = false;

	if ( input[0] == 0x04)
	{
		uint8_t hash1[32]; // holds the intermediate SHA256 hash computations
		SHA256::computeSHA256(input,65,hash1);	// Compute the SHA256 hash of the input public ECSDA signature
		output[0] = 0;	// Store a network byte of 0 (i.e. 'main' network)
		RIPEMD160::computeRIPEMD160(hash1,32,&output[1]);	// Compute the RIPEMD160 (20 byte) hash of the SHA256 hash
		SHA256::computeSHA256(output,21,hash1);	// Compute the SHA256 hash of the RIPEMD16 hash + the one byte header (for a checksum)
		SHA256::computeSHA256(hash1,32,hash1); // now compute the SHA256 hash of the previously computed SHA256 hash (for a checksum)
		output[21] = hash1[0];	// Store the checksum in the last 4 bytes of the public key hash
		output[22] = hash1[1];
		output[23] = hash1[2];
		output[24] = hash1[3];
		ret = true;
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x4, %eax
jne 0xd8df
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x41, %esi
callq 0xc9a0
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x1, %rdx
movl $0x20, %esi
callq 0x64e0
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x15, %esi
callq 0xc9a0
leaq -0x40(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x20, %esi
callq 0xc9a0
movb -0x40(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x15(%rax)
movb -0x3f(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x16(%rax)
movb -0x3e(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x17(%rax)
movb -0x3d(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x18(%rax)
movb $0x1, -0x11(%rbp)
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: jeffchan[P]blockchain-parser/BitcoinAddress.cpp
// Function: bitcoinPublicKeyToAscii(unsigned char const*, char*, unsigned int)
bool bitcoinPublicKeyToAscii(const uint8_t input[65], // The 65 bytes long ECDSA public key; first byte will always be 0x4 followed by two 32 byte components
							 char *output,				// The output ascii representation.
							 uint32_t maxOutputLen) // convert a binary bitcoin address into ASCII
{
	bool ret = false;

	output[0] = 0;

	uint8_t hash2[25];

	if ( bitcoinPublicKeyToAddress(input,hash2))
	{
		ret = BASE58::encodeBase58(hash2,25,true,output,maxOutputLen);
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb $0x0, -0x15(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xd840
testb $0x1, %al
jne 0xd921
jmp 0xd941
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %r8d
movl $0x19, %esi
movl $0x1, %edx
callq 0xd6a0
andb $0x1, %al
movb %al, -0x15(%rbp)
movb -0x15(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: jeffchan[P]blockchain-parser/BitcoinAddress.cpp
// Function: bitcoinAsciiToAddress(char const*, unsigned char*)
bool bitcoinAsciiToAddress(const char *input,uint8_t output[25]) // convert an ASCII bitcoin address into binary.
{
	bool ret = false;
	uint32_t len = BASE58::decodeBase58(input,output,25,true);
	if ( len == 25 ) // the output must be *exactly* 25 bytes!
	{
		uint8_t checksum[32];
		SHA256::computeSHA256(output,21,checksum);
		SHA256::computeSHA256(checksum,32,checksum);
		if ( output[21] == checksum[0] ||
			 output[22] == checksum[1] ||
			 output[23] == checksum[2] ||
			 output[24] == checksum[3] )
		{
			ret = true; // the cheksum matches!
		}
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x19, %edx
movl $0x1, %ecx
callq 0xd750
movl %eax, -0x18(%rbp)
cmpl $0x19, -0x18(%rbp)
jne 0xd9ee
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x15, %esi
callq 0xc9a0
leaq -0x40(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x20, %esi
callq 0xc9a0
movq -0x10(%rbp), %rax
movzbl 0x15(%rax), %eax
movzbl -0x40(%rbp), %ecx
cmpl %ecx, %eax
je 0xd9e8
movq -0x10(%rbp), %rax
movzbl 0x16(%rax), %eax
movzbl -0x3f(%rbp), %ecx
cmpl %ecx, %eax
je 0xd9e8
movq -0x10(%rbp), %rax
movzbl 0x17(%rax), %eax
movzbl -0x3e(%rbp), %ecx
cmpl %ecx, %eax
je 0xd9e8
movq -0x10(%rbp), %rax
movzbl 0x18(%rax), %eax
movzbl -0x3d(%rbp), %ecx
cmpl %ecx, %eax
jne 0xd9ec
movb $0x1, -0x11(%rbp)
jmp 0xd9ee
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: jeffchan[P]blockchain-parser/BitcoinAddress.cpp
// Function: bitcoinRIPEMD160ToAddress(unsigned char const*, unsigned char*)
void bitcoinRIPEMD160ToAddress(const uint8_t ripeMD160[20],uint8_t output[25])
{
	uint8_t hash1[32]; // holds the intermediate SHA256 hash computations
	output[0] = 0;	// Store a network byte of 0 (i.e. 'main' network)
	memcpy(&output[1],ripeMD160,20); // copy the 20 byte of the public key address
	SHA256::computeSHA256(output,21,hash1);	// Compute the SHA256 hash of the RIPEMD16 hash + the one byte header (for a checksum)
	SHA256::computeSHA256(hash1,32,hash1); // now compute the SHA256 hash of the previously computed SHA256 hash (for a checksum)
	output[21] = hash1[0];	// Store the checksum in the last 4 bytes of the public key hash
	output[22] = hash1[1];
	output[23] = hash1[2];
	output[24] = hash1[3];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, 0x1(%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x9(%rax)
movl 0x10(%rcx), %ecx
movl %ecx, 0x11(%rax)
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rdx
movl $0x15, %esi
callq 0xc9a0
leaq -0x30(%rbp), %rdi
leaq -0x30(%rbp), %rdx
movl $0x20, %esi
callq 0xc9a0
movb -0x30(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x15(%rax)
movb -0x2f(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x16(%rax)
movb -0x2e(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x17(%rax)
movb -0x2d(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x18(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/BitcoinScript.cpp
// Function: BitcoinScriptImpl::Stack::getStackEntry(unsigned int, unsigned char&) const
inline const uint8_t *getStackEntry(uint32_t offset,uint8_t &size) const
		{
			assert( offset <= mStackIndex );
			offset = mStackIndex-offset;
			size = mStackSize[offset];
			return mStackElements[offset];
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x808(%rcx), %eax
ja 0xeab8
jmp 0xead7
leaq 0x21e91(%rip), %rdi     # 0x30950
leaq 0x21d32(%rip), %rsi     # 0x307f8
movl $0xb9, %edx
leaq 0x21e94(%rip), %rcx     # 0x30966
callq 0x20c0
movq -0x20(%rbp), %rax
movl 0x808(%rax), %ecx
subl -0xc(%rbp), %ecx
movl %ecx, -0xc(%rbp)
movl -0xc(%rbp), %ecx
movb 0xa10(%rax,%rcx), %dl
movq -0x18(%rbp), %rcx
movb %dl, (%rcx)
movl -0xc(%rbp), %ecx
movq 0x810(%rax,%rcx,8), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: jeffchan[P]blockchain-parser/BitcoinTransactions.cpp
// Function: BitcoinTransactionsImpl::hashString(unsigned char const*)
const char *hashString(const uint8_t *h)
	{
		static char temp[65];
		temp[64] = 0;
		for (uint32_t i=0; i<32; i++)
		{
			sprintf(&temp[i*2],"%02x", h[i] );
		}

		return temp;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, 0x2a2f9(%rip)     # 0x391c0
movl $0x0, -0x14(%rbp)
cmpl $0x20, -0x14(%rbp)
jae 0xef09
movl -0x14(%rbp), %eax
shll %eax
movl %eax, %eax
leaq 0x2a29e(%rip), %rdi     # 0x39180
addq %rax, %rdi
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %edx
leaq 0x21b7e(%rip), %rsi     # 0x30a75
movb $0x0, %al
callq 0x2060
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xeece
leaq 0x2a270(%rip), %rax     # 0x39180
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinPublicKeyToAddress(unsigned char const*, unsigned char*)
bool bitcoinPublicKeyToAddress(const uint8_t input[65], // The 65 bytes long ECDSA public key; first byte will always be 0x4 followed by two 32 byte components
							   uint8_t output[25])		// A bitcoin address (in binary( is always 25 bytes long.
{
	bool ret = false;

	if ( input[0] == 0x04)
	{
		uint8_t hash1[32]; // holds the intermediate SHA256 hash computations
		BLOCKCHAIN_SHA256::computeSHA256(input,65,hash1);	// Compute the SHA256 hash of the input public ECSDA signature
		output[0] = 0;	// Store a network byte of 0 (i.e. 'main' network)
		BLOCKCHAIN_RIPEMD160::computeRIPEMD160(hash1,32,&output[1]);	// Compute the RIPEMD160 (20 byte) hash of the SHA256 hash
		BLOCKCHAIN_SHA256::computeSHA256(output,21,hash1);	// Compute the SHA256 hash of the RIPEMD16 hash + the one byte header (for a checksum)
		BLOCKCHAIN_SHA256::computeSHA256(hash1,32,hash1); // now compute the SHA256 hash of the previously computed SHA256 hash (for a checksum)
		output[21] = hash1[0];	// Store the checksum in the last 4 bytes of the public key hash
		output[22] = hash1[1];
		output[23] = hash1[2];
		output[24] = hash1[3];
		ret = true;
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x4, %eax
jne 0x195ef
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x41, %esi
callq 0x186b0
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x1, %rdx
movl $0x20, %esi
callq 0x121f0
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x15, %esi
callq 0x186b0
leaq -0x40(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x20, %esi
callq 0x186b0
movb -0x40(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x15(%rax)
movb -0x3f(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x16(%rax)
movb -0x3e(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x17(%rax)
movb -0x3d(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x18(%rax)
movb $0x1, -0x11(%rbp)
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: BLOCKCHAIN_BITCOIN_ADDRESS::bitcoinAsciiToAddress(char const*, unsigned char*)
bool bitcoinAsciiToAddress(const char *input,uint8_t output[25]) // convert an ASCII bitcoin address into binary.
{
	bool ret = false;
	uint32_t len = BLOCKCHAIN_BASE58::decodeBase58(input,output,25,true);
	if ( len == 25 ) // the output must be *exactly* 25 bytes!
	{
		uint8_t checksum[32];
		BLOCKCHAIN_SHA256::computeSHA256(output,21,checksum);
		BLOCKCHAIN_SHA256::computeSHA256(checksum,32,checksum);
		if ( output[21] == checksum[0] ||
			 output[22] == checksum[1] ||
			 output[23] == checksum[2] ||
			 output[24] == checksum[3] )
		{
			ret = true; // the cheksum matches!
		}
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x19, %edx
movl $0x1, %ecx
callq 0x19460
movl %eax, -0x18(%rbp)
cmpl $0x19, -0x18(%rbp)
jne 0x196fe
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x15, %esi
callq 0x186b0
leaq -0x40(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x20, %esi
callq 0x186b0
movq -0x10(%rbp), %rax
movzbl 0x15(%rax), %eax
movzbl -0x40(%rbp), %ecx
cmpl %ecx, %eax
je 0x196f8
movq -0x10(%rbp), %rax
movzbl 0x16(%rax), %eax
movzbl -0x3f(%rbp), %ecx
cmpl %ecx, %eax
je 0x196f8
movq -0x10(%rbp), %rax
movzbl 0x17(%rax), %eax
movzbl -0x3e(%rbp), %ecx
cmpl %ecx, %eax
je 0x196f8
movq -0x10(%rbp), %rax
movzbl 0x18(%rax), %eax
movzbl -0x3d(%rbp), %ecx
cmpl %ecx, %eax
jne 0x196fc
movb $0x1, -0x11(%rbp)
jmp 0x196fe
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: getAgeString(AgeMarker)
const char * getAgeString(AgeMarker m)
{
	const char *ret = "UNKNOWN";
	switch ( m )
	{
		case AM_ONE_DAY: ret = "One Day"; break;
		case AM_ONE_WEEK: ret = "One Week"; break;
		case AM_ONE_MONTH: ret = "One Month"; break;
		case AM_THREE_MONTHS: ret = "1-3 Months"; break;
		case AM_SIX_MONTHS: ret = "3-6 Months"; break;
		case AM_ONE_YEAR: ret = "Six Months to One Year"; break;
		case AM_TWO_YEARS: ret = "One to Two Years"; break;
		case AM_THREE_YEARS: ret = "Two to Three Years"; break;
		case AM_FOUR_YEARS: ret = "Three to Four Years"; break;
		case AM_FIVE_YEARS: ret = "Four to Fix Years"; break;
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
leaq 0x17548(%rip), %rax     # 0x30d46
movq %rax, -0x10(%rbp)
movl -0x4(%rbp), %eax
movq %rax, -0x18(%rbp)
subq $0x9, %rax
ja 0x198a7
movq -0x18(%rbp), %rax
leaq 0x17262(%rip), %rcx     # 0x30a80
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x17520(%rip), %rax     # 0x30d4e
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x1751b(%rip), %rax     # 0x30d56
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x17517(%rip), %rax     # 0x30d5f
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x17514(%rip), %rax     # 0x30d69
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x17512(%rip), %rax     # 0x30d74
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x17510(%rip), %rax     # 0x30d7f
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x1751a(%rip), %rax     # 0x30d96
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x1751e(%rip), %rax     # 0x30da7
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x17524(%rip), %rax     # 0x30dba
movq %rax, -0x10(%rbp)
jmp 0x198a7
leaq 0x1752b(%rip), %rax     # 0x30dce
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: createBlockChain(char const*)
BlockChain *createBlockChain(const char *rootPath)
{
	BlockChainImpl *b = new BlockChainImpl(rootPath);
	if ( !b->isValid() )
	{
		delete b;
		b = NULL;
	}
	return static_cast<BlockChain *>(b);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl $0x58472a0, %edi        # imm = 0x58472A0
callq 0x2150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rsi
callq 0x19f10
jmp 0x19bab
movq -0x28(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1a0c0
testb $0x1, %al
jne 0x19c01
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x19bdb
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
movq $0x0, -0x10(%rbp)
jmp 0x19c01
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x58472a0, %esi        # imm = 0x58472A0
callq 0x2160
jmp 0x19c0b
movq -0x10(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x2260
nopw %cs:(%rax,%rax)
// File: jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: formatNumber(int)
static const char * formatNumber(int32_t number) // JWR  format this integer into a fancy comma delimited string
{
	char * dest = &gFormat[gIndex*MAXNUMERIC];
	gIndex++;
	if ( gIndex == MAXFNUM ) gIndex = 0;

	char scratch[512];

#ifdef _MSC_VER
	itoa(number,scratch,10);
#else
	snprintf(scratch, 10, "%d", number);
#endif

	char *source = scratch;
	char *str = dest;
	uint32_t len = (uint32_t)strlen(scratch);
	if ( scratch[0] == '-' )
	{
		*str++ = '-';
		source++;
		len--;
	}
	for (uint32_t i=0; i<len; i++)
	{
		int32_t place = (len-1)-i;
		*str++ = source[i];
		if ( place && (place%3) == 0 ) *str++ = ',';
	}
	*str = 0;

	return dest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movl %edi, -0x4(%rbp)
movl 0x1f79c(%rip), %eax     # 0x393d0
shll $0x5, %eax
movslq %eax, %rcx
leaq 0x1f58f(%rip), %rax     # 0x391d0
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movl 0x1f782(%rip), %eax     # 0x393d0
addl $0x1, %eax
movl %eax, 0x1f779(%rip)     # 0x393d0
cmpl $0x10, 0x1f772(%rip)    # 0x393d0
jne 0x19c6a
movl $0x0, 0x1f766(%rip)     # 0x393d0
leaq -0x210(%rbp), %rdi
movl -0x4(%rbp), %ecx
movl $0xa, %esi
leaq 0x172dd(%rip), %rdx     # 0x30f5d
movb $0x0, %al
callq 0x2240
leaq -0x210(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x220(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x2090
movl %eax, -0x224(%rbp)
movsbl -0x210(%rbp), %eax
cmpl $0x2d, %eax
jne 0x19cf7
movq -0x220(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x220(%rbp)
movb $0x2d, (%rax)
movq -0x218(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x218(%rbp)
movl -0x224(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x224(%rbp)
movl $0x0, -0x228(%rbp)
movl -0x228(%rbp), %eax
cmpl -0x224(%rbp), %eax
jae 0x19d99
movl -0x224(%rbp), %eax
subl $0x1, %eax
subl -0x228(%rbp), %eax
movl %eax, -0x22c(%rbp)
movq -0x218(%rbp), %rax
movl -0x228(%rbp), %ecx
movb (%rax,%rcx), %cl
movq -0x220(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x220(%rbp)
movb %cl, (%rax)
cmpl $0x0, -0x22c(%rbp)
je 0x19d83
movl -0x22c(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x19d83
movq -0x220(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x220(%rbp)
movb $0x2c, (%rax)
jmp 0x19d85
movl -0x228(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x228(%rbp)
jmp 0x19d01
movq -0x220(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
// File: jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: getTimeString(unsigned int)
static const char *getTimeString(uint32_t timeStamp)
{
	if ( timeStamp == 0 )
	{
		return "NEVER";
	}
	static char scratch[1024];
	time_t t(timeStamp);
	struct tm *gtm = gmtime(&t);
	strftime(scratch, 1024, "%m/%d/%Y %H:%M:%S", gtm);
	return scratch;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x19dce
leaq 0x1754c(%rip), %rax     # 0x31314
movq %rax, -0x8(%rbp)
jmp 0x19e09
movl -0xc(%rbp), %eax
movq %rax, -0x18(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x2100
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
leaq 0x1f5f3(%rip), %rdi     # 0x393e0
movl $0x400, %esi            # imm = 0x400
leaq 0x17521(%rip), %rdx     # 0x3131a
callq 0x20e0
leaq 0x1f5db(%rip), %rax     # 0x393e0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: jeffchan[P]blockchain-parser/BlockChain.cpp
// Function: QuickSortPointers::swap(char**, char**)
void QuickSortPointers::swap(char **a,char **b)
{
	char *tmp;

	if ( a != b )
	{
		tmp = *a;
		*a++ = *b;
		*b++ = tmp;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x19f04
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, -0x10(%rbp)
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, -0x18(%rbp)
movq %rcx, (%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)