LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::init_from_base(char const*, unsigned char)
void uint256_t::init_from_base(const char * s, uint8_t base) {
    *this = 0;

    uint256_t power(1);
    uint8_t digit;
    int pos = strlen(s) - 1;
    while(pos >= 0) {
        digit = 0;
        if('0' <= s[pos] && s[pos] <= '9') {
            digit = s[pos] - '0';
        } else if('a' <= s[pos] && s[pos] <= 'z') {
            digit = s[pos] - 'a' + 10;
        }
        *this += digit * power;
        pos--;
        power *= base;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x7(%rsp), %rax
movb %dl, (%rax)
leaq 0x3ac1(%rip), %rax      # 0x7008
movups (%rax), %xmm0
movups %xmm0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
leaq 0x28(%rsp), %r15
movq $0x1, (%r15)
andq $0x0, 0x8(%r15)
movq %rsi, %r12
movups (%rax), %xmm0
movups %xmm0, 0x10(%r15)
movq %rsi, %rdi
callq 0x2090
movl %eax, %r14d
decq %r14
leaq 0x8(%rsp), %r13
leaq 0x6(%rsp), %rbp
testl %r14d, %r14d
js 0x35e5
movb $0x0, 0x6(%rsp)
movl %r14d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb (%r12,%rax), %al
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x35ac
movb %cl, 0x6(%rsp)
jmp 0x35ba
leal -0x61(%rax), %ecx
cmpb $0x19, %cl
ja 0x35ba
addb $-0x57, %al
movb %al, 0x6(%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x5e22
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3614
movq %r15, %rdi
leaq 0x7(%rsp), %rsi
callq 0x5bec
decq %r14
jmp 0x3588
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::operator<<(uint256_t const&) const
uint256_t uint256_t::operator<<(const uint256_t & rhs) const{
    const uint128_t shift = rhs.LOWER;
    if (((bool) rhs.UPPER) || (shift >= uint128_256)){
        return uint256_0;
    }
    else if (shift == uint128_128){
        return uint256_t(LOWER, uint128_0);
    }
    else if (shift == uint128_0){
        return *this;
    }
    else if (shift < uint128_128){
        return uint256_t((UPPER << shift) + (LOWER >> (uint128_128 - shift)), LOWER << shift);
    }
    else if ((uint128_256 > shift) && (shift > uint128_128)){
        return uint256_t(LOWER << (shift - uint128_128), uint128_0);
    }
    else{
        return uint256_0;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movups (%rdx), %xmm0
movaps %xmm0, (%rsp)
leaq 0x10(%rdx), %rdi
callq 0x259e
testb %al, %al
jne 0x39c2
leaq 0x87ea(%rip), %rsi      # 0xc1a0
movq %rsp, %rdi
callq 0x27b4
testb %al, %al
je 0x39e8
movups 0x87f7(%rip), %xmm0     # 0xc1c0
movups %xmm0, 0x10(%rbx)
movups 0x87dc(%rip), %xmm0     # 0xc1b0
movups %xmm0, (%rbx)
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x87a1(%rip), %rsi      # 0xc190
movq %rsp, %rdi
callq 0x2750
testb %al, %al
je 0x3a12
leaq 0x3606(%rip), %rax      # 0x7008
movups (%rax), %xmm0
movups %xmm0, (%rbx)
movups (%r14), %xmm0
movups %xmm0, 0x10(%rbx)
jmp 0x39d7
leaq 0x35ef(%rip), %r15      # 0x7008
movq %rsp, %rdi
movq %r15, %rsi
callq 0x2750
testb %al, %al
je 0x3a37
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rbx)
jmp 0x39d4
leaq 0x8752(%rip), %rsi      # 0xc190
movq %rsp, %rdi
callq 0x2798
testb %al, %al
je 0x3ac3
leaq 0x10(%r14), %rdi
movq %rsp, %r15
movq %r15, %rsi
callq 0x2628
leaq 0x10(%rsp), %r12
movq %rax, (%r12)
movq %rdx, 0x8(%r12)
leaq 0x8722(%rip), %rdi      # 0xc190
movq %r15, %rsi
callq 0x280e
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r14, %rdi
callq 0x269e
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r12, %rdi
callq 0x27ec
movq %rax, %r12
movq %rdx, %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x2628
movq %rax, (%rbx)
movq %rdx, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movq %r13, 0x18(%rbx)
jmp 0x39d7
leaq 0x86d6(%rip), %rdi      # 0xc1a0
movq %rsp, %rsi
callq 0x277c
testb %al, %al
je 0x39c2
leaq 0x86af(%rip), %rsi      # 0xc190
movq %rsp, %rdi
callq 0x277c
testb %al, %al
je 0x39c2
leaq 0x8698(%rip), %rsi      # 0xc190
movq %rsp, %rdi
callq 0x280e
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r14, %rdi
callq 0x2628
movups (%r15), %xmm0
movups %xmm0, (%rbx)
movq %rax, 0x10(%rbx)
movq %rdx, 0x18(%rbx)
jmp 0x39d7
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::operator>>(uint256_t const&) const
uint256_t uint256_t::operator>>(const uint256_t & rhs) const{
    const uint128_t shift = rhs.LOWER;
    if (((bool) rhs.UPPER) | (shift >= uint128_256)){
        return uint256_0;
    }
    else if (shift == uint128_128){
        return uint256_t(UPPER);
    }
    else if (shift == uint128_0){
        return *this;
    }
    else if (shift < uint128_128){
        return uint256_t(UPPER >> shift, (UPPER << (uint128_128 - shift)) + (LOWER >> shift));
    }
    else if ((uint128_256 > shift) && (shift > uint128_128)){
        return uint256_t(UPPER >> (shift - uint128_128));
    }
    else{
        return uint256_0;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movups (%rdx), %xmm0
movq %rsp, %r15
movaps %xmm0, (%r15)
leaq 0x10(%rdx), %rdi
callq 0x259e
movl %eax, %ebp
leaq 0x85b4(%rip), %rsi      # 0xc1a0
movq %r15, %rdi
callq 0x27b4
testb %bpl, %bpl
jne 0x3d43
testb %al, %al
jne 0x3d43
leaq 0x8584(%rip), %rsi      # 0xc190
movq %rsp, %rdi
callq 0x2750
testb %al, %al
je 0x3c33
movups 0x10(%r14), %xmm0
movups %xmm0, (%rbx)
leaq 0x33e1(%rip), %rax      # 0x7008
movups (%rax), %xmm0
movups %xmm0, 0x10(%rbx)
jmp 0x3d58
leaq 0x33ce(%rip), %r15      # 0x7008
movq %rsp, %rdi
movq %r15, %rsi
callq 0x2750
testb %al, %al
je 0x3c5b
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rbx)
jmp 0x3d55
leaq 0x852e(%rip), %rsi      # 0xc190
movq %rsp, %rdi
callq 0x2798
testb %al, %al
je 0x3ce6
leaq 0x10(%r14), %r13
movq %rsp, %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x269e
movq %rax, %r15
movq %rdx, %r12
leaq 0x8503(%rip), %rdi      # 0xc190
movq %rbp, %rsi
callq 0x280e
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r13, %rdi
callq 0x2628
leaq 0x18(%rsp), %r13
movq %rax, (%r13)
movq %rdx, 0x8(%r13)
movq %r14, %rdi
movq %rbp, %rsi
callq 0x269e
leaq 0x28(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r13, %rdi
callq 0x27ec
movq %rax, (%rbx)
movq %rdx, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movq %r12, 0x18(%rbx)
jmp 0x3d58
leaq 0x84b3(%rip), %rdi      # 0xc1a0
movq %rsp, %rsi
callq 0x277c
testb %al, %al
je 0x3d43
leaq 0x8490(%rip), %rsi      # 0xc190
movq %rsp, %rdi
callq 0x277c
testb %al, %al
je 0x3d43
addq $0x10, %r14
leaq 0x8479(%rip), %rsi      # 0xc190
movq %rsp, %rdi
callq 0x280e
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r14, %rdi
callq 0x269e
movq %rax, (%rbx)
movq %rdx, 0x8(%rbx)
movups (%r15), %xmm0
jmp 0x3c2a
movups 0x8476(%rip), %xmm0     # 0xc1c0
movups %xmm0, 0x10(%rbx)
movups 0x845b(%rip), %xmm0     # 0xc1b0
movups %xmm0, (%rbx)
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::operator>(uint256_t const&) const
bool uint256_t::operator>(const uint256_t & rhs) const{
    if (UPPER == rhs.UPPER){
        return (LOWER > rhs.LOWER);
    }
    if (UPPER > rhs.UPPER){
        return true;
    }
    return false;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rdi), %r15
leaq 0x10(%rsi), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2750
testb %al, %al
je 0x3f5d
movq %r14, %rdi
movq %rbx, %rsi
jmp 0x3f63
movq %r15, %rdi
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x277c
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::bits() const
uint16_t uint256_t::bits() const{
    uint16_t out = 0;
    if (UPPER){
        out = 128;
        uint128_t up = UPPER;
        while (up){
            up >>= uint128_1;
            out++;
        }
    }
    else{
        uint128_t low = LOWER;
        while (low){
            low >>= uint128_1;
            out++;
        }
    }
    return out;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
movq %r14, %rdi
callq 0x259e
testb %al, %al
je 0x4a57
movups (%r14), %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movw $0x80, %bx
leaq 0x25dc(%rip), %r15      # 0x7018
movq %r14, %rdi
callq 0x259e
testb %al, %al
je 0x4a85
movq %r14, %rdi
movq %r15, %rsi
callq 0x2700
incl %ebx
jmp 0x4a3c
movups (%rbx), %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
xorl %ebx, %ebx
leaq 0x25ae(%rip), %r15      # 0x7018
movq %r14, %rdi
callq 0x259e
testb %al, %al
je 0x4a85
movq %r14, %rdi
movq %r15, %rsi
callq 0x2700
incl %ebx
jmp 0x4a6a
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::export_bits() const
std::vector<uint8_t> uint256_t::export_bits() const {
    std::vector<uint8_t> ret;
    ret.reserve(32);
    UPPER.export_bits(ret);
    LOWER.export_bits(ret);
    return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
pushq $0x20
popq %rsi
callq 0x5c94
leaq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0x2a10
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a10
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5e54
movq %r14, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::export_bits_truncate() const
std::vector<uint8_t> uint256_t::export_bits_truncate() const {
    std::vector<uint8_t> ret = export_bits();

	//prune the zeroes
	int i = 0;
	while (ret[i] == 0 && i < 64) i++;
	ret.erase(ret.begin(), ret.begin() + i);

	return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4ce4
movq (%rbx), %rsi
xorl %eax, %eax
leaq 0x1(%rax), %rcx
cmpq $0x3f, %rax
ja 0x4d5a
cmpb $0x0, (%rsi,%rax)
movq %rcx, %rax
je 0x4d47
leaq (%rsi,%rcx), %rdx
decq %rdx
movq %rbx, %rdi
callq 0x5d1e
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x5e54
movq %r14, %rdi
callq 0x2270
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::str[abi:cxx11](unsigned char, unsigned int const&) const
std::string uint256_t::str(uint8_t base, const unsigned int & len) const{
    if ((base < 2) || (base > 36)){
        throw std::invalid_argument("Base must be in the range 2-36");
    }
    std::string out = "";
    if (!(*this)){
        out = "0";
    }
    else{
        std::pair <uint256_t, uint256_t> qr(*this, uint256_0);
        do{
            qr = divmod(qr.first, base);
            out = "0123456789abcdefghijklmnopqrstuvwxyz"[(uint8_t) qr.second] + out;
        } while (qr.first);
    }
    if (out.size() < len){
        out = std::string(len - out.size(), '0') + out;
    }
    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %edx, %r12d
leal -0x25(%r12), %eax
cmpb $-0x24, %al
jbe 0x4f33
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x23c5(%rip), %rsi      # 0x717e
leaq 0x70(%rsp), %rdx
callq 0x31ac
movq %r15, %rdi
callq 0x3dd0
testb %al, %al
je 0x4de3
leaq 0x2270(%rip), %rsi      # 0x7046
movq %rbx, %rdi
callq 0x22a0
jmp 0x4ecb
movq %r14, 0x8(%rsp)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
leaq 0x90(%rsp), %r15
movaps %xmm1, -0x10(%r15)
movaps %xmm0, -0x20(%r15)
movups 0x73a6(%rip), %xmm0     # 0xc1b0
movaps %xmm0, (%r15)
movups 0x73ab(%rip), %xmm0     # 0xc1c0
movaps %xmm0, 0x10(%r15)
movzbl %r12b, %r14d
leaq 0x30(%rsp), %rbp
leaq 0x10(%rsp), %r12
leaq 0x70(%rsp), %r13
movq %r14, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
leaq 0x21c9(%rip), %rax      # 0x7008
movups (%rax), %xmm0
leaq 0x60(%rsp), %rax
movups %xmm0, (%rax)
movq %r12, %rdi
movq %r13, %rdx
leaq 0x50(%rsp), %rcx
callq 0x47e0
movups 0x10(%rsp), %xmm0
movups 0x20(%rsp), %xmm1
movaps %xmm1, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movq %r15, %rdi
callq 0x25aa
movzbl %al, %eax
leaq 0x224a(%rip), %rcx      # 0x70de
movsbl (%rax,%rcx), %esi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x31e7
movq %rbx, %rdi
movq %r12, %rsi
callq 0x21a0
movq %r12, %rdi
callq 0x20a0
movq %r13, %rdi
callq 0x36a0
testb %al, %al
jne 0x4e2d
movq 0x8(%rsp), %r14
movl (%r14), %esi
subq 0x8(%rbx), %rsi
jbe 0x4f1e
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x10(%rsp), %rdi
pushq $0x30
popq %rdx
callq 0x2190
leaq 0x70(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x3244
leaq 0x70(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21a0
movq %r14, %rdi
callq 0x20a0
leaq 0x10(%rsp), %rdi
callq 0x20a0
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0x217a(%rip), %rsi      # 0x70bf
movq %rax, %rdi
callq 0x2290
movq 0x707c(%rip), %rsi      # 0xbfd0
movq 0x7065(%rip), %rdx      # 0xbfc0
movq %rbx, %rdi
callq 0x2260
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x20a0
jmp 0x4f8a
jmp 0x4f87
movq %rax, %r14
movq %rbx, %rdi
callq 0x2100
jmp 0x4f92
jmp 0x4f87
jmp 0x4f87
jmp 0x4f87
movq %rax, %r14
movq %rbx, %rdi
callq 0x20a0
movq %r14, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: operator<<(std::ostream&, uint256_t const&)
std::ostream & operator<<(std::ostream & stream, const uint256_t & rhs){
    if (stream.flags() & stream.oct){
        stream << rhs.str(8);
    }
    else if (stream.flags() & stream.dec){
        stream << rhs.str(10);
    }
    else if (stream.flags() & stream.hex){
        stream << rhs.str(16);
    }
    return stream;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl 0x18(%rdi,%rax), %eax
testb $0x40, %al
jne 0x57d4
testb $0x2, %al
jne 0x57f9
testb $0x8, %al
je 0x5826
leaq 0x4(%rsp), %rcx
andl $0x0, (%rcx)
leaq 0x8(%rsp), %r14
pushq $0x10
popq %rdx
movq %r14, %rdi
callq 0x4d88
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2140
jmp 0x581c
leaq 0x4(%rsp), %rcx
andl $0x0, (%rcx)
leaq 0x8(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x4d88
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2140
jmp 0x581c
leaq 0x4(%rsp), %rcx
andl $0x0, (%rcx)
leaq 0x8(%rsp), %r14
pushq $0xa
popq %rdx
movq %r14, %rdi
callq 0x4d88
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2140
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
jmp 0x5835
jmp 0x5835
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: operator>>(std::istream&, uint256_t&)
std::istream &operator>>(std::istream &stream, uint256_t &rhs)
{
    std::string hexstring;
    stream >> hexstring;
    uint256_t temp = hexstring;
    rhs = std::move(temp);
    return stream;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x8(%rsp), %rsi
callq 0x21b0
movq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x346c
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
jmp 0x58ab
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::powmod(uint256_t, uint256_t const&) const
uint256_t uint256_t::powmod(uint256_t power, const uint256_t &modulo) const
{
    uint256_t a = *this;
    uint256_t result = 1;

    while (power)
    {
        if (power & 1)
        {
            // assert(uint256_max / a > result);
            result = result.mulmod(a, modulo);
            // result = result * a % modulo;
        }

        // assert(uint256_max / a > a);
        a = a.mulmod(a, modulo);
        // a = a * a % modulo;
        power >>= 1;
    }

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rdi, %r14
leaq 0xb0(%rsp), %r15
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
leaq 0x30(%rsp), %r12
movaps %xmm1, 0x10(%r12)
movaps %xmm0, (%r12)
movq $0x1, (%rdi)
andq $0x0, 0x8(%rdi)
leaq 0x1702(%rip), %rax      # 0x7008
movups (%rax), %xmm0
movups %xmm0, 0x10(%rdi)
leaq 0x58(%rsp), %r13
leaq 0x2c(%rsp), %rbp
movq %r15, %rdi
callq 0x36a0
testb %al, %al
je 0x59ca
movl $0x1, 0x2c(%rsp)
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x5d60
movq %r13, %rdi
callq 0x36a0
testb %al, %al
je 0x597d
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x59dc
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x59dc
movups 0x58(%rsp), %xmm0
movups 0x68(%rsp), %xmm1
movaps %xmm1, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movl $0x1, 0x58(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x5da4
jmp 0x5917
movq %r14, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::mulmod(uint256_t, uint256_t const&) const
uint256_t uint256_t::mulmod(uint256_t another, const uint256_t &modulo) const
{
    uint256_t result = 0;
    uint256_t a = *this;

    if (a > another)
    {
        uint256_t temp = a;
        a = another;
        another = temp;
    }

    while (a)
    {
        if (a & 1)
        {
            result = result.addmod(another, modulo);
        }

        another = another.addmod(another, modulo);
        a >>= 1;
    }

    // while (another)
    // {
    //     if (another % 2)
    //     {
    //         if (modulo - result < a)
    //         {
    //             // assert(result - (uint256_max - a) == result + a);
    //             result -= modulo - a;
    //         }
    //         else
    //         {
    //             // assert(modulo - result >= a);
    //             result += a;
    //         }
    //     }

    //     if (modulo - a < a)
    //     {
    //         a -= modulo - a;
    //     }
    //     else
    //     {
    //         // assert(uint256_max - a >= a);
    //         a *= 2;
    //     }
        
    //     another /= 2;
    // }

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x90(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
leaq 0x1603(%rip), %rax      # 0x7008
movups (%rax), %xmm0
movups %xmm0, 0x10(%rdi)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
leaq 0x30(%rsp), %rdi
movaps %xmm1, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq %r15, %rsi
callq 0x3f30
testb %al, %al
je 0x5a5b
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movups (%r15), %xmm2
movups 0x10(%r15), %xmm3
movaps %xmm3, 0x40(%rsp)
movaps %xmm2, 0x30(%rsp)
movups %xmm0, (%r15)
movups %xmm1, 0x10(%r15)
leaq 0x30(%rsp), %r12
leaq 0x10(%rsp), %r13
leaq 0xc(%rsp), %rbp
movq %r12, %rdi
callq 0x36a0
testb %al, %al
je 0x5afc
movl $0x1, 0xc(%rsp)
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x5d60
movq %r13, %rdi
callq 0x36a0
testb %al, %al
je 0x5ac0
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x5b0e
movups 0x10(%rsp), %xmm0
movups 0x20(%rsp), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
movq %r13, %rdi
movq %r15, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x5b0e
movups 0x10(%rsp), %xmm0
movups 0x20(%rsp), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movl $0x1, 0x10(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x5da4
jmp 0x5a6a
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::addmod(uint256_t&, uint256_t const&) const
uint256_t uint256_t::addmod(uint256_t &another, const uint256_t &modulo) const
{
    uint256_t result;

    if (modulo - *this > another)
    {
        result = *this + another;
    }
    else
    {
        result = another - (modulo - *this);
    }

    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %r13
movq %r13, %rdi
movq %rcx, %rsi
movq %r15, %rdx
callq 0x4194
movq %r13, %rdi
movq %r14, %rsi
callq 0x3f30
testb %al, %al
je 0x5b57
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x40a0
jmp 0x5b76
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4194
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x4194
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::from_bytes(unsigned char const*)
void uint256_t::from_bytes(const uint8_t *const bytes)
{
    uint64_t buffer64[4] = { 0 };
    for (uint8_t i = 0; i < 4; i++)
    {
        uint64_t value = 0;
        for (int8_t j = (i * 8) + 7; j >= (i * 8); j--)
        {
            value <<= 8;
            value |= (uint64_t)bytes[j];
        }

        buffer64[i] = value;
    }

    uint128_t upper(buffer64[3], buffer64[2]), lower(buffer64[1], buffer64[0]);
    UPPER = upper;
    LOWER = lower;
}

// Assembly:
xorps %xmm0, %xmm0
movaps %xmm0, -0x18(%rsp)
movaps %xmm0, -0x28(%rsp)
movabsq $0x7, %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x5bd9
leaq (,%rcx,8), %rdx
movq %rax, %r9
xorl %r8d, %r8d
cmpq %rdx, %r9
jl 0x5bcb
shlq $0x8, %r8
movzbl (%rsi,%r9), %r10d
orq %r10, %r8
decq %r9
jmp 0x5bb5
movq %r8, -0x28(%rsp,%rcx,8)
incq %rcx
addq $0x8, %rax
jmp 0x5ba1
movaps -0x18(%rsp), %xmm0
movups %xmm0, 0x10(%rdi)
movaps -0x28(%rsp), %xmm0
movups %xmm0, (%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/src/main.cpp
// Function: main
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        throw std::invalid_argument("Error!\nInvalid amount of the options!");
        return FAILURE;
    }
    else
    {
        if (!strcmp(argv[1], "split"))
        {
            mode_split();
        }
        else if (!strcmp(argv[1], "recover"))
        {
            mode_recover();
        }
        else
        {
            throw std::invalid_argument("Error!\nUnknown option!");
            return FAILURE;
        }
    }

    return SUCCESS;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jne 0x5f05
movq 0x8(%rsi), %rbx
leaq 0x1269(%rip), %rsi      # 0x7139
movq %rbx, %rdi
callq 0x21e0
testl %eax, %eax
je 0x5ef6
leaq 0x125c(%rip), %rsi      # 0x713f
movq %rbx, %rdi
callq 0x21e0
testl %eax, %eax
jne 0x5f21
callq 0x5f68
jmp 0x5efb
callq 0x6a82
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0x11fc(%rip), %rsi      # 0x7113
movq %rax, %rdi
callq 0x2290
jmp 0x5f3b
pushq $0x10
popq %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0x1214(%rip), %rsi      # 0x7147
movq %rax, %rdi
callq 0x2290
movq 0x608e(%rip), %rsi      # 0xbfd0
movq 0x6077(%rip), %rdx      # 0xbfc0
movq %rbx, %rdi
callq 0x2260
jmp 0x5f53
movq %rax, %r14
movq %rbx, %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2270
nop
// File: /workspace/github_cpp_makefile_star2_O2/sokolcom[P]tp-blockchain-task06/src/split.cpp
// Function: mode_split()
int16_t mode_split()
{
    uint256_t private_key;
    uint16_t n, t;

    std::cout << "Secret: ";
    std::cin >> private_key;
    std::cout << "N, T: ";
    std::cin >> n >> t;

    if (((n > 2) && (n < 100)) && ((t >= 2) && (t <= n)))
    {
        split_key(private_key, n, t);
    }
    else
    {
        throw std::invalid_argument("Error!\nInvalid N, T parameters were entered!");
        return FAILURE;
    }

    return SUCCESS;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq 0x5528(%rip), %rbx      # 0xbfb8
leaq 0x789(%rip), %rsi       # 0x7220
movq %rbx, %rdi
callq 0x2150
movq 0x5532(%rip), %r14      # 0xbfd8
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x584a
leaq 0x76f(%rip), %rsi       # 0x7229
movq %rbx, %rdi
callq 0x2150
leaq 0x26(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2210
leaq 0x24(%rsp), %rsi
movq %rax, %rdi
callq 0x2210
movzwl (%rbx), %eax
leal -0x64(%rax), %ecx
cmpw $-0x61, %cx
jb 0x6b23
movzwl 0x24(%rsp), %ecx
cmpw $0x2, %cx
jb 0x6b23
cmpw %ax, %cx
ja 0x6b23
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movzwl %ax, %edi
movzwl %cx, %esi
callq 0x6700
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x20b0
movq %rax, %rbx
leaq 0x6fb(%rip), %rsi       # 0x7230
movq %rax, %rdi
callq 0x2290
movq 0x548c(%rip), %rsi      # 0xbfd0
movq 0x5475(%rip), %rdx      # 0xbfc0
movq %rbx, %rdi
callq 0x2260
movq %rax, %r14
movq %rbx, %rdi
callq 0x2100
movq %r14, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICEMain.cpp
// Function: calc_CDICE(DICE*, DICE*)
void calc_CDICE(DICE *dice1, DICE *dice2)
{
	
  // Run the model over the dice object
  processModel(dice1);
  
  // Make temporary variables to hold the changes in utility
  double dutil_e;
  double dutil_c;
  int i;
  int t;
  int tsub;
  
  // Loop over the available time steps
  for(t=1; t<dice1->config.nPeriods; t++) {
    
    // Reset the temp dice object
    processModel(dice2);
    
    // Increment the consumption at this time step
    dice2->econ.c[t-1] += 1.0;
    
    // Do the post processing of this run
    postProcess(dice2);
    
    // Store the utility from this run
    dutil_c = dice2->econ.utility - dice1->econ.utility;
    
    // Reset the consumption
    dice2->econ.c[t-1] = dice1->econ.c[t-1];        
    
    // Increment the emissions at this time step
    dice2->econ.e[t-1] += 1.0;
    
    // Run the model on the temporary dice object
    for(tsub=t; tsub<dice1->config.nPeriods; tsub++) {
      calcCarb(dice2, tsub);
      if(dice2->ctrl.use_doeclim) {
				doeclim_dice_ts(dice2, tsub);
      }
      else {
				calcClim(dice2, tsub);
      }
      calcEcon(dice2, tsub);
    }
    
    // Do the post processing of this run
    postProcess(dice2);
    
    // Store the utility from this run
    dutil_e = dice2->econ.utility - dice1->econ.utility;
    
    // Calculate the SCC from these differences in utility
    dice1->econ.scc[t-1] = -1000.0 * (dutil_e / dutil_c);
  }
  
  // Delete the temporary DICE object
  //free_CDICE(dice2);
	
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x5875
pushq $0x1
popq %r15
movslq (%r14), %rax
cmpq %rax, %r15
jge 0x2673
movq %rbx, %rdi
callq 0x5875
movq 0x308(%rbx), %rax
movsd -0x8(%rax,%r15,8), %xmm0
movsd 0x5a89(%rip), %xmm1     # 0x8008
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rax,%r15,8)
movq %rbx, %rdi
callq 0x559d
movsd 0x380(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x380(%r14), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x308(%r14), %rax
movsd -0x8(%rax,%r15,8), %xmm0
movq 0x308(%rbx), %rax
movsd %xmm0, -0x8(%rax,%r15,8)
movq 0x3b8(%rbx), %rax
movsd -0x8(%rax,%r15,8), %xmm0
addsd 0x5a27(%rip), %xmm0     # 0x8008
movsd %xmm0, -0x8(%rax,%r15,8)
movl %r15d, %ebp
cmpl (%r14), %ebp
jge 0x2624
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4ee0
cmpl $0x0, 0x58(%rbx)
je 0x260c
movq %rbx, %rdi
movl %ebp, %esi
callq 0x70ea
jmp 0x2616
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5027
movq %rbx, %rdi
movl %ebp, %esi
callq 0x50f6
incl %ebp
jmp 0x25eb
movsd 0x8(%rsp), %xmm0
subsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x559d
movsd 0x380(%rbx), %xmm0
subsd 0x380(%r14), %xmm0
divsd 0x8(%rsp), %xmm0
mulsd 0x59b3(%rip), %xmm0     # 0x8010
movq 0x2b0(%r14), %rax
movsd %xmm0, -0x8(%rax,%r15,8)
incq %r15
jmp 0x2555
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICEMain.cpp
// Function: readFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int)
vector< vector<double> > readFile(string filename, int idx1, int idx2)
{
	ifstream inFile;
	inFile.open(filename.c_str());
	
	vector< vector <double> > params;
	vector<double> param_hold;
	string line;
	double p;
	int i=0;
	int j=0;
	
	while(getline(inFile, line))
	{
		param_hold.clear();
		stringstream inFile(line);
		if (i>=idx1)
		{
			if (i<idx2)
			{
				while(inFile >> p)
				{
					param_hold.push_back(p);
				}
				params.push_back(param_hold);
			}
		}
		i++;
	}
	
	return params;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movl %ecx, 0xc(%rsp)
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x21d0
movq (%rbx), %rsi
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x20f0
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movq %r12, (%rsp)
andq $0x0, 0x10(%r12)
leaq 0x10(%rsp), %r15
andq $0x0, 0x10(%r15)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movaps %xmm0, (%r15)
movb $0x0, (%rax)
xorl %ebp, %ebp
leaq 0x38(%rsp), %r13
leaq 0x260(%rsp), %rbx
leaq 0x30(%rsp), %r12
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0x2060
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2788
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x2728
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
pushq $0x18
popq %rdx
callq 0x22d0
cmpl %r14d, %ebp
setl %al
cmpl 0xc(%rsp), %ebp
setge %cl
orb %al, %cl
jne 0x2779
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2100
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x276d
movq %r15, %rdi
movq %r12, %rsi
callq 0x2e70
jmp 0x2747
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x2e92
incl %ebp
movq %rbx, %rdi
callq 0x2120
jmp 0x26fc
leaq 0x38(%rsp), %rdi
callq 0x20c0
leaq 0x10(%rsp), %rdi
callq 0x30e8
leaq 0x58(%rsp), %rdi
callq 0x2070
movq (%rsp), %rax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x27f7
jmp 0x27ca
jmp 0x27c5
movq %rax, %rbx
jmp 0x27da
movq %rax, %rbx
leaq 0x260(%rsp), %rdi
callq 0x2120
leaq 0x38(%rsp), %rdi
callq 0x20c0
leaq 0x10(%rsp), %rdi
callq 0x30e8
movq (%rsp), %rdi
callq 0x2ebe
leaq 0x58(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2340
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICEInit.cpp
// Function: allocateCarb(DICE*)
void allocateCarb(DICE *dice)
{

  dice->carb.forcoth = new double[dice->config.nPeriods];	// Exogenous forcing for other GHG
  dice->carb.forc = new double[dice->config.nPeriods];		// Increase in radiative forcing [Wm-2 from 1900]
  dice->carb.mat = new double[dice->config.nPeriods];		// Carbon concentration increase in atmosphere [GtC from 1750]
  dice->carb.mu = new double[dice->config.nPeriods];		// Carbon concentration increase in shallow oceans [GtC from 1750]
  dice->carb.ml = new double[dice->config.nPeriods];		// Carbon concentration increase in lower oceans [GtC from 1750]
  
  dice->carb.atfrac = new double[dice->config.nPeriods];
  dice->carb.atfrac2010 = new double[dice->config.nPeriods];
  dice->carb.ppm = new double[dice->config.nPeriods];


  return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq (%rdi), %rax
leaq (,%rax,8), %rcx
testq %rax, %rax
pushq $-0x1
popq %r14
cmovnsq %rcx, %r14
movq %r14, %rdi
callq 0x2030
movq %rax, 0x468(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x470(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x478(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x480(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x488(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x490(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x498(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x4a0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICEInit.cpp
// Function: allocateClim(DICE*)
void allocateClim(DICE *dice)
{
  
  if(dice->ctrl.use_doeclim==1) {
    // DOEclim model variables
    dice->clim.forc = new double[dice->config.ns];
    dice->clim.IB = new double[4];
    dice->clim.A = new double[4];
    dice->clim.Ker = new double[dice->config.ns];
    
    dice->clim.temp = new double[dice->config.ns];
    dice->clim.temp_landair = new double[dice->config.ns];
    dice->clim.temp_sst = new double[dice->config.ns];
    dice->clim.heat_mixed = new double[dice->config.ns];
    dice->clim.heat_interior = new double[dice->config.ns];
    dice->clim.heatflux_mixed = new double[dice->config.ns];
    dice->clim.heatflux_interior = new double[dice->config.ns];
    
    dice->clim.cs_cal = new double [dice->config.n_calpoints];
    dice->clim.kv_cal = new double [dice->config.n_calpoints];
    dice->clim.alpha_cal = new double [dice->config.n_calpoints];
    
		//doeclim_DICE_init(dice);

  }

  else {
    // DICE Climate model variables
    dice->clim.tatm = new double[dice->config.nPeriods];		// Increase temperature of atmosphere [dC from 1900]
    dice->clim.tocean = new double[dice->config.nPeriods];	// Increase temperature of lower oceans [dC from 1900]
    
  }

  return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x1, 0x58(%rdi)
jne 0x374d
movslq 0x28(%rbx), %rax
leaq (,%rax,8), %r14
testq %rax, %rax
pushq $-0x1
popq %r12
cmovsq %r12, %r14
movq %r14, %rdi
callq 0x2030
movq %rax, 0xb0(%rbx)
pushq $0x20
popq %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x100(%rbx)
movq %r15, %rdi
callq 0x2030
movq %rax, 0x108(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x120(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x140(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x148(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x150(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x158(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x160(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x168(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x170(%rbx)
movslq 0x30(%rbx), %rax
leaq (,%rax,8), %r14
testq %rax, %rax
cmovsq %r12, %r14
movq %r14, %rdi
callq 0x2030
movq %rax, 0x178(%rbx)
movl $0x188, %r15d           # imm = 0x188
movl $0x180, %r12d           # imm = 0x180
jmp 0x376f
movslq (%rbx), %rax
leaq (,%rax,8), %rcx
testq %rax, %rax
pushq $-0x1
popq %r14
cmovnsq %rcx, %r14
movl $0x130, %r15d           # imm = 0x130
movl $0x128, %r12d           # imm = 0x128
movq %r14, %rdi
callq 0x2030
movq %rax, (%rbx,%r12)
movq %r14, %rdi
callq 0x2030
movq %rax, (%rbx,%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICEInit.cpp
// Function: allocateLims(DICE*)
void allocateLims(DICE *dice)
{
  dice->lims.k_lo = 1.0;
  dice->lims.mat_lo = 10.0;
  dice->lims.mu_lo = 100.0;
  dice->lims.ml_lo = 1000.0;
  dice->lims.c_lo = 2.0;
  dice->lims.tocean_up = 20.0;
  dice->lims.tocean_lo = -1.0;
  dice->lims.tatm_lo = 0.0;
  dice->lims.tatm_up = 40.0;
  dice->lims.cpc_lo = 0.01;
  dice->lims.y_lo = 0.0;
  dice->lims.ygross_lo = 0.0;
  dice->lims.i_lo = 0.0;
  dice->lims.miu_up = new double[dice->config.nPeriods];	// Upper limit of control policy for each time period

}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movaps 0x4628(%rip), %xmm0     # 0x8080
movups %xmm0, 0x4b0(%rdi)
movaps 0x462a(%rip), %xmm0     # 0x8090
movups %xmm0, 0x4c0(%rdi)
movaps 0x462c(%rip), %xmm0     # 0x80a0
movups %xmm0, 0x4d0(%rdi)
movsd 0x464d(%rip), %xmm0     # 0x80d0
movups %xmm0, 0x4e0(%rdi)
movaps 0x461f(%rip), %xmm0     # 0x80b0
movups %xmm0, 0x4f0(%rdi)
andq $0x0, 0x510(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x500(%rdi)
movslq (%rdi), %rax
leaq (,%rax,8), %rcx
testq %rax, %rax
pushq $-0x1
popq %rdi
cmovnsq %rcx, %rdi
callq 0x2030
movq %rax, 0x528(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICEInit.cpp
// Function: allocateDICE(DICE*)
void allocateDICE(DICE *dice)
{
	allocateCtrl(dice);
	allocateConfig(dice);
	allocateCarb(dice);
	allocateEcon(dice);
	allocateDvars(dice);
	allocateLims(dice);
	allocateClim(dice);
	
	if(dice->ctrl.use_doeclim == 1) {	
  	doeclim_load_calibration(dice, dice->config.n_calpoints);
  }

	return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x1, 0x58(%rdi)
callq 0x355c
movq %rbx, %rdi
callq 0x35ab
movq %rbx, %rdi
callq 0x3793
movq %rbx, %rdi
callq 0x3a10
movq %rbx, %rdi
callq 0x3a4d
movq %rbx, %rdi
callq 0x3648
cmpl $0x1, 0x58(%rbx)
jne 0x426f
movl 0x30(%rbx), %esi
movq %rbx, %rdi
popq %rbx
jmp 0x73cf
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICE.cpp
// Function: calcCarb1(DICE*)
void calcCarb1(DICE *dice)
{

  Carb *carb = &dice->carb;
  Lims *lims = &dice->lims;
  
  // Carbon pools
  carb->mat[0] = carb->mat0;
  if(carb->mat[0] < lims->mat_lo) {
    carb->mat[0] = lims->mat_lo;
  }
  
  carb->mu[0] = carb->mu0;
  if(carb->mu[0] < lims->mu_lo) {
    carb->mu[0] = lims->mu_lo;
  }

  carb->ml[0] = carb->ml0;
  if(carb->ml[0] < lims->ml_lo) {
    carb->ml[0] = lims->ml_lo;
  }

  // Radiative forcing
  carb->forc[0] = carb->fco22x*(log(carb->mat[0]/588.000)/log(2.0))+carb->forcoth[0];
  
  return;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movsd 0x3e0(%rdi), %xmm1
movq 0x478(%rdi), %rax
movsd %xmm1, (%rax)
movsd 0x4b8(%rdi), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4a72
movsd %xmm0, (%rax)
movsd 0x3e8(%rbx), %xmm1
movq 0x480(%rbx), %rcx
movsd %xmm1, (%rcx)
movsd 0x4c0(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4a97
movsd %xmm0, (%rcx)
movsd 0x3f0(%rbx), %xmm1
movq 0x488(%rbx), %rcx
movsd %xmm1, (%rcx)
movsd 0x4c8(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4abc
movsd %xmm0, (%rcx)
movsd 0x448(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd (%rax), %xmm0
divsd 0x3622(%rip), %xmm0     # 0x80f8
callq 0x2160
divsd 0x361d(%rip), %xmm0     # 0x8100
mulsd 0x8(%rsp), %xmm0
movq 0x468(%rbx), %rax
movq 0x470(%rbx), %rcx
addsd (%rax), %xmm0
movsd %xmm0, (%rcx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICE.cpp
// Function: calcClim1(DICE*)
void calcClim1(DICE *dice)
{
  Clim *clim = &dice->clim;
  Lims *lims = &dice->lims;

  // Atmospheric temperature
  clim->tatm[0] = clim->tatm0;
  if(clim->tatm[0] < lims->tatm_lo) {
    clim->tatm[0] = lims->tatm_lo;
  }
  if(clim->tatm[0] > lims->tatm_up) {
    clim->tatm[0] = lims->tatm_up;
  }
  
  // Oceanic temperature
  clim->tocean[0] = clim->tocean0;
  if(clim->tocean[0] < lims->tocean_lo) {
    clim->tocean[0] = lims->tocean_lo;
  }
  if(clim->tocean[0] > lims->tocean_up) {
    clim->tocean[0] = lims->tocean_up;
  }
  
  return;
}

// Assembly:
movsd 0x70(%rdi), %xmm0
movq 0x128(%rdi), %rax
movsd %xmm0, (%rax)
movsd 0x4e8(%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4b2b
movsd %xmm1, (%rax)
movapd %xmm1, %xmm0
movsd 0x4f0(%rdi), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4b3d
movsd %xmm1, (%rax)
movsd 0x68(%rdi), %xmm0
movq 0x130(%rdi), %rax
movsd %xmm0, (%rax)
movsd 0x4e0(%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4b63
movsd %xmm1, (%rax)
movapd %xmm1, %xmm0
movsd 0x4d8(%rdi), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4b75
movsd %xmm1, (%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICE.cpp
// Function: calcCarb(DICE*, int)
void calcCarb(DICE *dice, int t)
{

  Econ *econ = &dice->econ;
  Carb *carb = &dice->carb;
  Lims *lims = &dice->lims;
  
  // Carbon pools (carbon cycle box model)
  carb->mat[t] = (econ->e[t-1]*(5.0/3.666))+carb->b11*carb->mat[t-1]+carb->b21*carb->mu[t-1];
  if(carb->mat[t] < lims->mat_lo) {
    carb->mat[t] = lims->mat_lo;
  }

  carb->mu[t] = carb->b12*carb->mat[t-1]+carb->b22*carb->mu[t-1]+carb->b32*carb->ml[t-1];
  if(carb->mu[t] < lims->mu_lo) {
    carb->mu[t] = lims->mu_lo;
  }
  carb->ml[t] = carb->b33*carb->ml[t-1]+carb->b23*carb->mu[t-1];
  if(carb->ml[t] < lims->ml_lo) {
    carb->ml[t] = lims->ml_lo;
  }
  
  // Radiatice forcing
  carb->forc[t] = carb->fco22x*(log(carb->mat[t]/588.000)/log(2.0))+carb->forcoth[t];
  
  return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x3b8(%rdi), %rax
movslq %esi, %r14
leaq -0x1(%r14), %rcx
movsd -0x8(%rax,%r14,8), %xmm1
movq 0x478(%rdi), %rax
movsd -0x8(%rax,%r14,8), %xmm0
movsd 0x420(%rdi), %xmm2
mulsd %xmm0, %xmm2
mulsd 0x31ca(%rip), %xmm1     # 0x80e8
addsd %xmm2, %xmm1
movsd 0x428(%rdi), %xmm2
movq 0x480(%rdi), %rdx
mulsd -0x8(%rdx,%r14,8), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rax,%r14,8)
movsd 0x4b8(%rdi), %xmm1
ucomisd %xmm2, %xmm1
jbe 0x4f56
movsd %xmm1, (%rax,%r14,8)
movsd (%rdx,%rcx,8), %xmm1
movsd 0x430(%rbx), %xmm2
mulsd %xmm1, %xmm2
mulsd 0x410(%rbx), %xmm0
addsd %xmm2, %xmm0
movsd 0x438(%rbx), %xmm2
movq 0x488(%rbx), %rsi
mulsd (%rsi,%rcx,8), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, (%rdx,%r14,8)
movsd 0x4c0(%rbx), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x4fa5
movsd %xmm0, (%rdx,%r14,8)
mulsd 0x418(%rbx), %xmm1
movsd 0x440(%rbx), %xmm2
mulsd (%rsi,%rcx,8), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rsi,%r14,8)
movsd 0x4c8(%rbx), %xmm0
ucomisd %xmm2, %xmm0
jbe 0x4fd8
movsd %xmm0, (%rsi,%r14,8)
movsd 0x448(%rbx), %xmm0
movsd %xmm0, (%rsp)
movsd (%rax,%r14,8), %xmm0
divsd 0x3105(%rip), %xmm0     # 0x80f8
callq 0x2160
divsd 0x3100(%rip), %xmm0     # 0x8100
mulsd (%rsp), %xmm0
movq 0x468(%rbx), %rax
movq 0x470(%rbx), %rcx
addsd (%rax,%r14,8), %xmm0
movsd %xmm0, (%rcx,%r14,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICE.cpp
// Function: calcClim(DICE*, int)
void calcClim(DICE *dice, int t)
{

  Config *config = &dice->config;
  Econ *econ = &dice->econ;
  Carb *carb = &dice->carb;
  Clim *clim = &dice->clim;
  Dvars *dvars = &dice->dvars;
  Ctrl *ctrl = &dice->ctrl;
  Lims *lims = &dice->lims;

  clim->tatm[t] = clim->tatm[t-1]+clim->c1*((carb->forc[t]-((carb->fco22x/clim->t2xco2)*clim->tatm[t-1]))-(clim->c3*(clim->tatm[t-1]-clim->tocean[t-1])));
  if(clim->tatm[t] < lims->tatm_lo) {
    clim->tatm[t] = lims->tatm_lo;
  }
  if(clim->tatm[t] > lims->tatm_up) {
    clim->tatm[t] = lims->tatm_up;
  }

  clim->tocean[t] = clim->tocean[t-1]+clim->c4*(clim->tatm[t-1]-clim->tocean[t-1]);
  if(clim->tocean[t] < lims->tocean_lo) {
    clim->tocean[t] = lims->tocean_lo;
  }
  if(clim->tocean[t] > lims->tocean_up) {
    clim->tocean[t] = lims->tocean_up;
  }

  return;
}

// Assembly:
movq 0x128(%rdi), %rdx
movq 0x130(%rdi), %rax
movslq %esi, %rcx
movsd -0x8(%rdx,%rcx,8), %xmm0
movq 0x470(%rdi), %rsi
movsd 0x448(%rdi), %xmm2
divsd 0x60(%rdi), %xmm2
movsd (%rsi,%rcx,8), %xmm1
mulsd %xmm0, %xmm2
subsd %xmm2, %xmm1
movapd %xmm0, %xmm2
subsd -0x8(%rax,%rcx,8), %xmm2
mulsd 0x80(%rdi), %xmm2
subsd %xmm2, %xmm1
mulsd 0x78(%rdi), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%rcx,8)
movsd 0x4e8(%rdi), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x509a
movsd %xmm2, (%rdx,%rcx,8)
movapd %xmm2, %xmm1
leaq -0x1(%rcx), %rsi
movsd 0x4f0(%rdi), %xmm2
ucomisd %xmm2, %xmm1
jbe 0x50b1
movsd %xmm2, (%rdx,%rcx,8)
movsd (%rax,%rsi,8), %xmm1
subsd %xmm1, %xmm0
mulsd 0x88(%rdi), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd 0x4e0(%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x50e2
movsd %xmm1, (%rax,%rcx,8)
movapd %xmm1, %xmm0
movsd 0x4d8(%rdi), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x50f5
movsd %xmm1, (%rax,%rcx,8)
retq
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICE.cpp
// Function: processModel(DICE*)
void processModel(DICE *dice)
{
	
  // Calculate exogenous time series
  calcExog(dice);
  
   // Calculate the first time step of carbon model
  calcCarb1(dice);

  // Calculate the first time step of climate model
  if(dice->ctrl.use_doeclim == 1) {
    doeclim_hindcast(dice);
  }
  else {
    calcClim1(dice);
  }
  
  // Calculate the first time step of economic model
  calcEcon1(dice);
  
  // Calculate the rest of the time series
  for (int tIndex=1; tIndex<dice->config.nPeriods; tIndex++)
    {
      calcCarb(dice, tIndex);

      if(dice->ctrl.use_doeclim == 1) {
				doeclim_dice_ts(dice, tIndex);
    	}
      else {
				calcClim(dice, tIndex);
      }

      calcEcon(dice, tIndex);
    }
  
  // Do the post-processing
  postProcess(dice);
  
  return;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4650
movq %rbx, %rdi
callq 0x4a45
cmpl $0x1, 0x58(%rbx)
jne 0x5898
movq %rbx, %rdi
callq 0x6fc7
jmp 0x58a0
movq %rbx, %rdi
callq 0x4b05
movq %rbx, %rdi
callq 0x4b76
pushq $0x1
popq %rbp
cmpl (%rbx), %ebp
jge 0x58e3
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4ee0
cmpl $0x1, 0x58(%rbx)
jne 0x58cb
movq %rbx, %rdi
movl %ebp, %esi
callq 0x70ea
jmp 0x58d5
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5027
movq %rbx, %rdi
movl %ebp, %esi
callq 0x50f6
incl %ebp
jmp 0x58ab
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x559d
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICE_doeclim.cpp
// Function: count_lines(char const*, int*)
void count_lines(const char *filename, int *numlines)
{
	int ch;	
	*numlines = 0;
	FILE * fp = fopen(filename, "r");
	
	do {
		ch = fgetc(fp);
		if(ch == '\n') { *numlines = *numlines + 1; }
	} while (ch != EOF);

//	if(ch != '\n' && *numlines != 0) 
//    *numlines = *numlines + 1;

	fclose(fp);
	
	return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
andl $0x0, (%rsi)
leaq 0x298b(%rip), %rsi      # 0x8290
callq 0x21f0
movq %rax, %r14
movq %r14, %rdi
callq 0x22b0
cmpl $0xa, %eax
je 0x5921
cmpl $-0x1, %eax
jne 0x590d
jmp 0x5925
incl (%rbx)
jmp 0x590d
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x21a0
// File: /workspace/github_cpp_makefile_star2_O2/JRLamontagne[P]cdice_sa/CDICE_doeclim.cpp
// Function: invert_1d_2x2_matrix(double*, double*)
void invert_1d_2x2_matrix(double * x, double * y)
{
  double temp_d = (x[0]*x[3] - x[1]*x[2]);
  if(temp_d == 0) {
    fprintf(stderr, "Matrix inversion divide by zero. Aborting...\n");
    exit(EXIT_FAILURE);
  }
  double temp = 1/temp_d;
  y[0] = temp * x[3];
  y[1] = temp * -1 * x[1];
  y[2] = temp * -1 * x[2];
  y[3] = temp * x[0];

  return;
}

// Assembly:
movsd 0x10(%rdi), %xmm2
movsd 0x18(%rdi), %xmm0
mulsd 0x8(%rdi), %xmm2
movsd (%rdi), %xmm1
mulsd %xmm0, %xmm1
subsd %xmm2, %xmm1
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jne 0x595b
jnp 0x599d
movsd 0x26a5(%rip), %xmm2     # 0x8008
divsd %xmm1, %xmm2
mulsd %xmm2, %xmm0
movsd %xmm0, (%rsi)
movapd 0x27c9(%rip), %xmm0     # 0x8140
xorpd %xmm2, %xmm0
movsd 0x8(%rdi), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsi)
mulsd 0x10(%rdi), %xmm0
movsd %xmm0, 0x10(%rsi)
mulsd (%rdi), %xmm2
movsd %xmm2, 0x18(%rsi)
retq
pushq %rax
movq 0x5633(%rip), %rax      # 0xafd8
movq (%rax), %rcx
leaq 0x28e3(%rip), %rdi      # 0x8292
pushq $0x2d
popq %rsi
pushq $0x1
popq %rdx
callq 0x2390
pushq $0x1
popq %rdi
callq 0x2200