LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/leobru[P]ACPUfont/averager.cc
// Function: Picture::best_offset(Picture const&, int&, int&) const
double best_offset(const Picture & other, int & voff, int & hoff) const {
	// Compute average distances for all offsets up to size/3
	double minmse = 10e38;
	for (int i = -height/3; i <= height/3; ++i) 
	for (int j = -width/3; j <= width/3; ++j) {
		double curmse = mse(other, i, j);
		if (curmse < minmse) {
			// fprintf(stderr, "MSE = %.3f voff=%d hoff=%d\n", curmse, i, j);
			minmse = curmse;
			voff = i;
			hoff = j;
		}
	}
	// fprintf(stderr, "Best offsets are %d %d\n", voff, hoff);
        return minmse;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movslq 0x24(%rdi), %rax
imulq $0x55555555, %rax, %r13 # imm = 0x55555555
shrq $0x20, %r13
subl %eax, %r13d
movl %r13d, %ecx
shrl $0x1f, %ecx
sarl %r13d
addl %ecx, %r13d
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
cmpl %ecx, %r13d
jle 0x2b20
movsd 0x2532(%rip), %xmm0     # 0x5048
movsd %xmm0, (%rsp)
jmp 0x2bda
movq %rsi, %r15
movq %rdi, %r12
movl 0x20(%rdi), %ecx
movsd 0x2517(%rip), %xmm0     # 0x5048
movsd %xmm0, (%rsp)
movslq %ecx, %rdx
imulq $0x55555555, %rdx, %rbp # imm = 0x55555555
shrq $0x20, %rbp
subl %edx, %ebp
movl %ebp, %esi
shrl $0x1f, %esi
sarl %ebp
addl %esi, %ebp
imulq $0x55555556, %rdx, %rdx # imm = 0x55555556
movq %rdx, %rsi
shrq $0x3f, %rsi
shrq $0x20, %rdx
addl %esi, %edx
cmpl %edx, %ebp
jg 0x2bb3
movq %r12, %rdi
movq %r15, %rsi
movl %r13d, %edx
movl %ebp, %ecx
callq 0x29a8
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2b8c
movl %r13d, (%r14)
movl %ebp, (%rbx)
movsd %xmm0, (%rsp)
leal 0x1(%rbp), %eax
movslq 0x20(%r12), %rcx
imulq $0x55555556, %rcx, %rdx # imm = 0x55555556
movq %rdx, %rsi
shrq $0x3f, %rsi
shrq $0x20, %rdx
addl %esi, %edx
cmpl %edx, %ebp
movl %eax, %ebp
jl 0x2b67
movl 0x24(%r12), %eax
leal 0x1(%r13), %edx
movslq %eax, %rsi
imulq $0x55555556, %rsi, %rsi # imm = 0x55555556
movq %rsi, %rdi
shrq $0x3f, %rdi
shrq $0x20, %rsi
addl %edi, %esi
cmpl %esi, %r13d
movl %edx, %r13d
jl 0x2b36
movsd (%rsp), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/leobru[P]ACPUfont/averager.cc
// Function: Picture::Picture(char const*)
Picture(const char * fname) : weight(1) {
        FILE * f = fopen(fname, "r");
        if (!f) {
            fprintf(stderr, "Cannot open %s\n", fname);
            exit(1);
        }
        int full;
        char p2[3];
        fscanf(f, "%2s", p2);
        if (strcmp("P5", p2)) {
            fprintf(stderr, "Want to see binary PGM (P5)\n");
            exit(1);
        }
        if (3 != fscanf(f, "%d %d %d", &width, &height, &full) || full != 255) {
            fprintf(stderr, "Could not parse PGM header\n");
            exit(1);
        }
        getc(f); // eat linefeed
        reserve(height*width);
        for (int i = 0; i < height; ++i)
            for (int j = 0; j < width; ++j) {
                int pixel = getc(f);
                if (pixel == EOF) {
                    fprintf(stderr, "File ended prematurely\n");
                    exit(1);
                }
                push_back(full-pixel);
                // Now array is in degrees of blackness
            }
        fclose (f);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x18(%rdi)
leaq 0x2481(%rip), %rsi      # 0x50ee
movq %r15, %rdi
callq 0x1110
testq %rax, %rax
je 0x2d90
movq %rax, %r14
leaq 0x2478(%rip), %rsi      # 0x5100
leaq 0x5(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x11c0
movzwl 0x5(%rsp), %eax
xorl $0x3550, %eax           # imm = 0x3550
movzbl 0x7(%rsp), %ecx
orw %ax, %cx
jne 0x2d98
leaq 0x20(%rbx), %r15
leaq 0x24(%rbx), %rcx
leaq 0x2466(%rip), %rsi      # 0x5124
leaq 0x8(%rsp), %r8
movq %r14, %rdi
movq %r15, %rdx
movq %rcx, 0x10(%rsp)
xorl %eax, %eax
callq 0x11c0
cmpl $0x3, %eax
jne 0x2d9d
cmpl $0xff, 0x8(%rsp)
jne 0x2d9d
movq %r14, %rdi
callq 0x1060
movslq 0x24(%rbx), %rax
movslq 0x20(%rbx), %rsi
imulq %rax, %rsi
movq %rbx, %rdi
callq 0x35a8
movq 0x10(%rsp), %rax
movl (%rax), %ecx
testl %ecx, %ecx
jle 0x2d74
movl 0x20(%rbx), %eax
xorl %ebp, %ebp
leaq 0xc(%rsp), %r13
testl %eax, %eax
jle 0x2d6e
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x1060
cmpl $-0x1, %eax
je 0x2d8b
movl 0x8(%rsp), %ecx
subl %eax, %ecx
movl %ecx, 0xc(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2d51
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x2d5c
movq %rbx, %rdi
movq %r13, %rdx
callq 0x3644
incl %r12d
movl (%r15), %eax
cmpl %eax, %r12d
jl 0x2d24
movq 0x10(%rsp), %rcx
movl (%rcx), %ecx
incl %ebp
cmpl %ecx, %ebp
jl 0x2d1d
movq %r14, %rdi
callq 0x10e0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1273
movq %r15, %rdi
callq 0x12bd
callq 0x124e
callq 0x1298
jmp 0x2da4
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x2dbb
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x1100
movq %r14, %rdi
callq 0x11b0
nop
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns-server.cc
// Function: resolved_cb(dns_cb_data*)
void resolved_cb(struct dns_cb_data *cbdata) {
    // Return whatever we found
    struct dns_response *dresp = (struct dns_response*)cbdata->context;

    unsigned numans = 0;
    for (const auto &e: cbdata->replies)
        if (e.resptype == RESPONSE_ANSWER)
            numans++;

    switch (cbdata->error) {
    case DNS_OK:
        dresp->pkt.answers = cbdata->replies;
        dresp->pkt.header.flags = 0x8180;
        dresp->pkt.header.nanswers = numans;
        break;
    case DNS_DOES_NOT_EXIST:
        dresp->pkt.header.flags = 0x8180;
        break;
    case DNS_TIMEOUT:
    case DNS_ERROR:
    case DNS_NET_ERROR:
        dresp->pkt.header.flags = 0x8182;
        break;
    };

    // Blocking send, automatic rate limiting?
    uint8_t tmp[2048];
    unsigned towrite = serialize_udp_packet(&dresp->pkt, tmp);
    sendto(listenfd, tmp, towrite, 0, (struct sockaddr*)&dresp->addrstorage, dresp->addrlen);

    delete dresp;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x800, %rsp            # imm = 0x800
movq %rdi, %rsi
movq 0x30(%rdi), %rax
movq 0x38(%rdi), %rcx
xorl %ebp, %ebp
cmpq %rcx, %rax
je 0x36c7
cmpl $0x1, 0x4(%rax)
adcw $0x0, %bp
addq $0x50, %rax
jmp 0x36b4
movq (%rsi), %rbx
movl 0x8(%rsi), %ecx
movl $0x2, %eax
leal -0x2(%rcx), %edx
cmpl $0x3, %edx
jae 0x36e0
movw $0x8182, %bp            # imm = 0x8182
jmp 0x3707
testl %ecx, %ecx
je 0x36ef
movw $0x8180, %bp            # imm = 0x8180
cmpl $0x1, %ecx
je 0x3707
jmp 0x370b
addq $0x30, %rsi
leaq 0x28(%rbx), %rdi
callq 0x3a68
movw $0x8180, 0x2(%rbx)      # imm = 0x8180
movl $0x6, %eax
movw %bp, (%rbx,%rax)
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9dbd
movl 0xcb41(%rip), %edi      # 0x10260
movl %eax, %edx
leaq 0x40(%rbx), %r8
movl 0xc0(%rbx), %r9d
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x3070
leaq 0x28(%rbx), %rdi
callq 0x3b80
leaq 0x10(%rbx), %rdi
callq 0x3bb0
movl $0xc8, %esi
movq %rbx, %rdi
callq 0x32b0
addq $0x800, %rsp            # imm = 0x800
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: parseAddr(char const*, sockaddr_storage*)
bool parseAddr(const char *ipaddr, struct sockaddr_storage *addrout) {
    unsigned ok = 0;
    union {
        struct sockaddr_storage addrst;
        struct sockaddr_in6 ipv6addr;
        struct sockaddr_in ipv4addr;
    } addrunion;
    if (strchr(ipaddr, '.') == NULL) {
        addrunion.ipv6addr.sin6_family = AF_INET6;
        addrunion.ipv6addr.sin6_port = htons(53);
        addrunion.ipv6addr.sin6_flowinfo = 0;
        addrunion.ipv6addr.sin6_scope_id = 0;
        ok |= inet_pton(AF_INET6, ipaddr, &addrunion.ipv6addr.sin6_addr);
    } else {
        addrunion.ipv4addr.sin_family = AF_INET;
        addrunion.ipv4addr.sin_port = htons(53);
        ok |= inet_pton(AF_INET, ipaddr, &addrunion.ipv4addr.sin_addr);
    }
    *addrout = addrunion.addrst;
    return (ok == 1);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl $0x2e, %esi
callq 0x3120
testq %rax, %rax
je 0x4342
leaq 0xc(%rsp), %rdx
movl $0x35000002, -0x4(%rdx) # imm = 0x35000002
movl $0x2, %edi
jmp 0x435b
leaq 0x10(%rsp), %rdx
movq $0x3500000a, -0x8(%rdx) # imm = 0x3500000A
movl $0x0, 0x10(%rdx)
movl $0xa, %edi
movq %r14, %rsi
callq 0x3440
leaq 0x8(%rsp), %rsi
movl $0x10, %ecx
movq %rbx, %rdi
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x1, %eax
sete %al
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::find_cached_query(dns_record_type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
cache_entry* DNSResolver::find_cached_query(enum dns_record_type qtype, std::string name) {
    time_t now = time(NULL);
    auto entry = std::make_pair(name, qtype);
    if (cached.find(entry) != cached.end()) {
        auto r = &(cached.at(entry));
        r->hits++;
        if (r->expire > now)
            return r;
    }
    return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %r14
xorl %edi, %edi
callq 0x3260
movq %rax, %rbx
leaq 0x40(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x3c72
movl %ebp, 0x20(%r15)
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x3c72
leaq 0xa0(%r14), %r15
movzwl 0x50(%rsp), %eax
leaq 0x8(%rsp), %rsi
movw %ax, 0x20(%rsi)
movq %r15, %rdi
callq 0x7bbc
movq %rax, %r12
addq $0xa8, %r14
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x4743
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
cmpq %r14, %r12
je 0x479c
leaq 0x8(%rsp), %rdi
movq %rbp, (%rdi)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
callq 0x3c72
movzwl 0x50(%rsp), %eax
leaq 0x8(%rsp), %rsi
movw %ax, 0x20(%rsi)
movq %r15, %rdi
callq 0x6f4a
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x4792
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
incl 0x20(%r14)
cmpq %rbx, 0x18(%r14)
jg 0x479f
xorl %r14d, %r14d
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x47b6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x47cc
jmp 0x47e8
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x47eb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x47eb
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x4802
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3400
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::cancel(void const*)
void DNSResolver::cancel(const void *context) {
    for (auto it: active) {
        if (it.second->ctx == context) {
            ongoing.erase(std::make_pair(it.second->name, it.second->qtype));
            delete it.second;
            active.erase(it.first);
            assert(active.size() == ongoing.size());
            return;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x48df
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movups 0x8(%rax), %xmm0
movaps %xmm0, (%rsp)
movq 0x8(%rsp), %rbp
cmpq %rsi, 0x30(%rbp)
je 0x484c
movq (%rax), %rax
testq %rax, %rax
jne 0x482c
jmp 0x48df
leaq 0x70(%rbx), %r15
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x3c72
movzwl 0xc(%rbp), %eax
movw %ax, 0x20(%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0x7c74
movq %r15, %rdi
movq %rax, %rsi
callq 0x7d48
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x48a8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x48ba
movq %r15, %rdi
callq 0x6fcc
movl $0x78, %esi
movq %r15, %rdi
callq 0x32b0
movq %rsp, %rsi
movq %r14, %rdi
callq 0x7dec
movq 0x50(%rbx), %rax
cmpq 0x98(%rbx), %rax
jne 0x48ee
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x67c3(%rip), %rdi      # 0xb0b8
leaq 0x67dc(%rip), %rsi      # 0xb0d8
leaq 0x67de(%rip), %rcx      # 0xb0e1
movl $0x124, %edx            # imm = 0x124
callq 0x31b0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x4927
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3400
nop
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::call_user_rec(Query*, dns_error)
void DNSResolver::call_user_rec(Query *q, enum dns_error err) {
    // If this query has dependencies don't report it
    for (auto de: q->deps)
        call_user_rec(de, err);

    call_user(this, q->name, q->qtype, NULL, q->callback, q->ctx, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq 0x58(%rsi), %r12
leaq 0x48(%rsi), %r13
cmpq %r13, %r12
je 0x4f9d
movq %rdi, %r15
movq 0x20(%r12), %rsi
movq %r15, %rdi
movl %ebx, %edx
callq 0x4f5c
movq %r12, %rdi
callq 0x3300
movq %rax, %r12
cmpq %r13, %rax
jne 0x4f7e
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
movq %rsp, %r15
movq %r15, %rdi
callq 0x3c72
movzwl 0xc(%r14), %esi
movq 0x30(%r14), %r8
movq 0x38(%r14), %rcx
movq %r15, %rdi
xorl %edx, %edx
movl %ebx, %r9d
callq 0x501c
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x4fed
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x5014
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3400
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: call_user(DNSResolver*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned short, cache_entry const*, void (*)(dns_cb_data*), void*, dns_error)
static void
call_user(DNSResolver *dns, std::string name, uint16_t qtype, 
          const struct cache_entry *entry, dns_callback_t cb, void *ctx, enum dns_error error)
{
    struct dns_cb_data cbd;
    cbd.context = ctx;
    cbd.query_type = (enum dns_record_type) qtype;
    cbd.error = error;
    cbd.name = name;

    if (entry)
        cbd.replies = entry->replies;

    if (cb)
        cb(&cbd);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %rax
leaq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
xorl %ecx, %ecx
movq %rcx, -0x8(%r12)
movb $0x0, (%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12)
movq %rcx, 0x20(%r12)
movq %r8, -0x20(%r12)
movl %esi, -0x14(%r12)
movl %r9d, -0x18(%r12)
movq %rax, %rsi
callq 0x3170
leaq 0x30(%rsp), %r15
testq %r14, %r14
je 0x5085
movq %r15, %rdi
movq %r14, %rsi
callq 0x3a68
testq %rbx, %rbx
je 0x508f
movq %rsp, %rdi
callq *%rbx
movq %r15, %rdi
callq 0x3b80
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x50ae
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x72be
movq %rbx, %rdi
callq 0x3400
nop
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::createQuery(unsigned int, void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, dns_record_type, void (*)(dns_cb_data*))
Query * DNSResolver::createQuery(unsigned niter, void *ctx, std::string name,
                    enum dns_record_type qtype, dns_callback_t callback) {

    std::transform(name.begin(), name.end(), name.begin(), ::tolower);

    time_t now = time(NULL);
    Query * query = new Query();
    query->ctx = ctx;
    query->qtype = (uint16_t) qtype;
    query->callback = callback;
    query->atimeout = now + this->atimeout;
    query->niter = niter + 1;
    query->name = name;

    return query;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movl %r8d, 0x4(%rsp)
movq %rcx, %rbx
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, 0x8(%rsp)
movq 0x8(%rcx), %r14
testq %r14, %r14
je 0x6744
movq (%rbx), %r15
xorl %r12d, %r12d
movsbl (%r15,%r12), %edi
callq 0x3390
movb %al, (%r15,%r12)
incq %r12
cmpq %r12, %r14
jne 0x672e
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x3260
movq %rax, %r14
movl $0x78, %edi
callq 0x32a0
movq %rax, %r15
leaq 0x10(%rax), %rdi
addq $0x20, %rax
movq %rax, 0x10(%r15)
movq %r12, 0x18(%r15)
movb $0x0, 0x20(%r15)
leaq 0x48(%r15), %rax
movl $0x0, 0x48(%r15)
movq %r12, 0x50(%r15)
movq %rax, 0x58(%r15)
movq %rax, 0x60(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%r15)
movq %r13, 0x30(%r15)
movl 0x4(%rsp), %eax
movw %ax, 0xc(%r15)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%r15)
movq 0x8(%rsp), %rax
movl 0xd0(%rax), %eax
addq %r14, %rax
movq %rax, (%r15)
incl %ebp
movl %ebp, 0x8(%r15)
movq %rbx, %rsi
callq 0x3170
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::getNewTid()
uint16_t DNSResolver::getNewTid() {
    while(1) {
        uint16_t n = ++tidseq;
        if (active.count(n) == 0)
            return n;
        std::cout << "Dup!" << std::endl;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movl 0x10(%rdi), %eax
incl %eax
movw %ax, 0x10(%rdi)
leaq 0xe(%rsp), %rsi
movw %ax, (%rsi)
movq %r14, %rdi
callq 0x7998
testq %rax, %rax
je 0x6ab4
movq 0x957d(%rip), %r15      # 0xffd0
leaq 0x4712(%rip), %r12      # 0xb16c
leaq 0xe(%rsp), %r13
movl $0x4, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x32f0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3270
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31c0
movl 0x10(%rbx), %eax
incl %eax
movw %ax, 0x10(%rbx)
movw %ax, 0xe(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x7998
testq %rax, %rax
jne 0x6a5f
movzwl 0xe(%rsp), %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::DNSResolver(std::__cxx11::list<sockaddr_storage, std::allocator<sockaddr_storage>>, unsigned int)
DNSResolver(std::list<struct sockaddr_storage> serverbundle, unsigned atimeout)
      : pkts_dns_servers(0), pkts_auth_servers(0), dns_servers(serverbundle), atimeout(atimeout) {
        this->sock4 = socket(PF_INET,  SOCK_DGRAM, 17);
        this->sock6 = socket(PF_INET6, SOCK_DGRAM, 17);
        /* Make it non blocking */
        nonblock(sock4);
        nonblock(sock6);
        /* Increase socket's receive buffer */
        int rcvbufsiz = 128 * 1024;
        (void) setsockopt(sock4, SOL_SOCKET, SO_RCVBUF,
            (char *) &rcvbufsiz, sizeof(rcvbufsiz));
        (void) setsockopt(sock6, SOL_SOCKET, SO_RCVBUF,
            (char *) &rcvbufsiz, sizeof(rcvbufsiz));
        tidseq = 0;
        active.rehash(MAX_CACHE_ENTRIES*2);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %r14
leaq 0x8f91(%rip), %rax      # 0xfd50
movq %rax, (%rdi)
xorl %r12d, %r12d
movq %r12, 0x14(%rdi)
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x6d58
leaq 0x38(%r14), %r15
leaq 0x68(%r14), %rax
movq %rax, 0x38(%r14)
movq $0x1, 0x40(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%r14)
movl $0x3f800000, 0x58(%r14) # imm = 0x3F800000
movups %xmm0, 0x60(%r14)
leaq 0x78(%r14), %rax
movl %r12d, 0x78(%r14)
movq %r12, 0x80(%r14)
movq %rax, 0x88(%r14)
movq %rax, 0x90(%r14)
movq %r12, 0x98(%r14)
leaq 0xa8(%r14), %rax
movl %r12d, 0xa8(%r14)
movq %r12, 0xb0(%r14)
movq %rax, 0xb8(%r14)
movq %rax, 0xc0(%r14)
movq %r12, 0xc8(%r14)
movl %ebp, 0xd0(%r14)
movl $0x2, %edi
movl $0x2, %esi
movl $0x11, %edx
callq 0x30d0
movl %eax, 0x8(%r14)
movl $0xa, %edi
movl $0x2, %esi
movl $0x11, %edx
callq 0x30d0
movl %eax, 0xc(%r14)
movl 0x8(%r14), %edi
callq 0x9f18
movl 0xc(%r14), %edi
callq 0x9f18
leaq 0x4(%rsp), %r12
movl $0x20000, (%r12)        # imm = 0x20000
movl 0x8(%r14), %edi
movl $0x1, %esi
movl $0x8, %edx
movq %r12, %rcx
movl $0x4, %r8d
callq 0x3410
movl 0xc(%r14), %edi
movl $0x1, %esi
movl $0x8, %edx
movq %r12, %rcx
movl $0x4, %r8d
callq 0x3410
movw $0x0, 0x10(%r14)
movl $0x20000, %esi          # imm = 0x20000
movq %r15, %rdi
callq 0x7458
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6eff
movq %rax, %r12
leaq 0x70(%r14), %r13
addq $0xa0, %r14
movq %r14, %rdi
callq 0x763c
movq %r13, %rdi
callq 0x76c0
movq %r15, %rdi
callq 0x7738
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x6f42
movq (%rdi), %r14
movl $0x90, %esi
callq 0x32b0
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x6f2d
movq %r12, %rdi
callq 0x3400
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: Query::~Query()
~Query() {
        // Remove the entry from the parent deps list
        assert(!deps_on || deps_on->deps.count(this));
        if (deps_on)
            deps_on->deps.erase(this);

        for (auto e: deps)
            delete e;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x70(%rdi), %r14
testq %r14, %r14
je 0x7043
movq 0x50(%r14), %rax
testq %rax, %rax
je 0x70b0
leaq 0x48(%r14), %rdx
movq %rdx, %rcx
xorl %esi, %esi
cmpq %rbx, 0x20(%rax)
setb %sil
cmovaeq %rax, %rcx
movq 0x10(%rax,%rsi,8), %rax
testq %rax, %rax
jne 0x6ff9
cmpq %rdx, %rcx
je 0x70b0
cmpq %rbx, 0x20(%rcx)
ja 0x70b0
addq $0x40, %r14
leaq 0x8(%rsp), %rsi
movq %rbx, (%rsi)
movq %r14, %rdi
callq 0x77a8
movq %r14, %rdi
movq %rax, %rsi
callq 0x782a
leaq 0x40(%rbx), %r14
movq 0x58(%rbx), %r15
leaq 0x48(%rbx), %r13
cmpq %r13, %r15
je 0x7082
movq 0x20(%r15), %r12
testq %r12, %r12
je 0x7065
movq %r12, %rdi
callq 0x6fcc
movl $0x78, %esi
movq %r12, %rdi
callq 0x32b0
movq %r15, %rdi
callq 0x3300
movq %rax, %r15
cmpq %r13, %rax
jne 0x7054
movq %r14, %rdi
callq 0x790c
movq 0x10(%rbx), %rdi
addq $0x20, %rbx
cmpq %rbx, %rdi
je 0x70a2
movq (%rbx), %rsi
incq %rsi
callq 0x32b0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x41a3(%rip), %rdi      # 0xb25a
leaq 0x401a(%rip), %rsi      # 0xb0d8
leaq 0x41bb(%rip), %rcx      # 0xb280
movl $0x3d, %edx
callq 0x31b0
movq %rax, %rdi
callq 0x3c0e
nop
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::~DNSResolver()
~DNSResolver() {
        if (sock4 != -1)
            (void) closesocket(sock4);
        if (sock6 != -1)
            (void) closesocket(sock6);

        for (auto it: active)
            delete it.second;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x89bc(%rip), %rax      # 0xfd50
movq %rax, (%rdi)
movl 0x8(%rdi), %edi
cmpl $-0x1, %edi
je 0x73a4
callq 0x3470
movl 0xc(%rbx), %edi
cmpl $-0x1, %edi
je 0x73b1
callq 0x3470
leaq 0x38(%rbx), %r14
movq 0x48(%rbx), %r12
testq %r12, %r12
je 0x73e3
movq 0x10(%r12), %r15
testq %r15, %r15
je 0x73d0
movq %r15, %rdi
callq 0x6fcc
movl $0x78, %esi
movq %r15, %rdi
callq 0x32b0
movq (%r12), %r12
jmp 0x73b9
leaq 0xa0(%rbx), %rdi
callq 0x763c
leaq 0x70(%rbx), %rdi
callq 0x76c0
movq %r14, %rdi
callq 0x7738
movq 0x20(%rbx), %rdi
addq $0x20, %rbx
cmpq %rbx, %rdi
je 0x7422
movq (%rdi), %r14
movl $0x90, %esi
callq 0x32b0
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x740d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x3c0e
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns_common.cc
// Function: fetch(unsigned char const*, unsigned char const*, int, char*, int)
unsigned fetch(const uint8_t *pkt, const uint8_t *s, int pktsiz, char *dst, int dstlen) {
    const uint8_t *e = pkt + pktsiz;
    unsigned skip = 0;
    bool labelj = false;
    int j, i = 0, n = 0;

    while (*s != 0 && s < e) {
        if (n > 0)
            dst[i++] = '.';

        if (i >= dstlen)
            break;

        if (((n = *s++) & 0xc0) == 0xc0) {
            s = pkt + (((n&3) << 8) | *s);    /* New offset */
            n = 0;
            if (!labelj)
                skip += 2;
            labelj = true;
        } else {
            if (!labelj)
                skip += std::min(n, dstlen - i) + 1;
            for (j = 0; j < n && i < dstlen; j++)
                dst[i++] = *s++;
        }
    }

    dst[i] = '\0';
    return skip + (labelj ? 0 : 1);
}

// Assembly:
movslq %edx, %rax
addq %rdi, %rax
cmpb $0x0, (%rsi)
setne %dl
cmpq %rsi, %rax
seta %r9b
andb %dl, %r9b
xorl %edx, %edx
cmpb $0x1, %r9b
jne 0x95d7
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movslq %r8d, %r11
xorl %r9d, %r9d
xorl %r10d, %r10d
xorl %ebx, %ebx
testl %ebx, %ebx
je 0x951e
movslq %edx, %rbx
incl %edx
movb $0x2e, (%rcx,%rbx)
movl %r8d, %r15d
subl %edx, %r15d
jle 0x95bc
leaq 0x1(%rsi), %r14
movzbl (%rsi), %ebx
movl %ebx, %ebp
notl %ebp
testb $-0x40, %bpl
jne 0x9560
andl $0x3, %ebx
shll $0x8, %ebx
movzbl (%r14), %esi
orl %ebx, %esi
addq %rdi, %rsi
leal 0x2(%r10), %ebp
testb $0x1, %r9b
cmovnel %r10d, %ebp
movb $0x1, %r9b
xorl %ebx, %ebx
movl %ebp, %r10d
jmp 0x95ae
testb $0x1, %r9b
jne 0x9573
cmpl %ebx, %r15d
cmovgel %ebx, %r15d
addl %r15d, %r10d
incl %r10d
testl %ebx, %ebx
je 0x95a9
movslq %edx, %r15
incq %r15
movl $0x1, %r14d
movb (%rsi,%r14), %bpl
movb %bpl, -0x1(%rcx,%r15)
movl %r14d, %ebp
incl %edx
incq %r14
cmpl %ebx, %ebp
jae 0x95a4
leaq 0x1(%r15), %r12
cmpq %r11, %r15
movq %r12, %r15
jl 0x9583
addq %r14, %rsi
jmp 0x95ae
xorl %ebx, %ebx
movq %r14, %rsi
cmpb $0x0, (%rsi)
je 0x95bc
cmpq %rax, %rsi
jb 0x9511
movslq %edx, %rdx
notb %r9b
andb $0x1, %r9b
movzbl %r9b, %eax
addl %r10d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x95dc
movl $0x1, %eax
movb $0x0, (%rcx,%rdx)
retq
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns_common.cc
// Function: serialize_answer(dns_record const*, unsigned char*)
unsigned serialize_answer(const struct dns_record *rec, uint8_t *out) {
    uint8_t * oout = out;

    bool namec = (rec->rtype == DNS_MX_RECORD || 
                  rec->rtype == DNS_NS_RECORD ||
                  rec->rtype == DNS_CNAME_RECORD);

    // Getting the size is a bit convoluted depending on type and the domain itself
    unsigned dlen = namec ? (rec->addr.size() ? rec->addr.size() + 2 : 1) : rec->addr.size();

    // Name goes first
    out += serializeName(rec->name, out);

    ((uint16_t*)out)[0] = htons(rec->rtype);
    ((uint16_t*)out)[1] = htons(0x0001);  // Assuming Internet yo!
    ((uint32_t*)out)[1] = htonl(rec->ttl);
    ((uint16_t*)out)[4] = htons(dlen);
    out += 10;

    if (namec) {
        out += serializeName(rec->addr, out);
    } else {
        memcpy(out, rec->addr.data(), rec->addr.size());
        out += rec->addr.size();
    }

    return out - oout;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %eax
cmpl $0xf, %eax
ja 0x9cc5
movl $0x8024, %ecx           # imm = 0x8024
btl %eax, %ecx
jae 0x9cc5
movq 0x30(%r14), %rax
leaq 0x2(%rax), %rcx
testq %rax, %rax
movl $0x1, %r13d
cmovneq %rcx, %r13
movb $0x1, %al
movl %eax, 0x4(%rsp)
jmp 0x9cd1
movq 0x30(%r14), %r13
movl $0x0, 0x4(%rsp)
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x3c72
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9bdd
movl %eax, %r15d
addq %rbx, %r15
movq (%r12), %rdi
cmpq %rbp, %rdi
je 0x9d19
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32b0
movzwl (%r14), %eax
rolw $0x8, %ax
movw %ax, (%r15)
movw $0x100, 0x2(%r15)       # imm = 0x100
movl 0x48(%r14), %eax
bswapl %eax
rolw $0x8, %r13w
movl %eax, 0x4(%r15)
movw %r13w, 0x8(%r15)
addq $0xa, %r15
cmpb $0x0, 0x4(%rsp)
je 0x9d91
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x28(%r14), %rsi
movq 0x30(%r14), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x3c72
movq %r14, %rdi
movq %r15, %rsi
callq 0x9bdd
movl %eax, %r12d
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x9da5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x9da5
movq 0x28(%r14), %rsi
movq 0x30(%r14), %rdx
movq %r15, %rdi
callq 0x3230
movq 0x30(%r14), %r12
addl %r12d, %r15d
subl %ebx, %r15d
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns_common.cc
// Function: serialize_udp_packet(dns_packet*, unsigned char*)
unsigned serialize_udp_packet(struct dns_packet *in, uint8_t *out) {
    uint8_t *oout = out;
    const uint8_t *e = out + DNS_PACKET_LEN;
    struct header *h = (struct header*)out;

    h->tid      = htons(in->header.tid);
    h->flags    = htons(in->header.flags);
    h->nqueries = htons(in->header.nqueries);
    h->nanswers = htons(in->header.nanswers);
    h->nauth    = htons(in->header.nauth);
    h->nother   = htons(in->header.nother);

    out = &h->data[0];

    for (const auto &q: in->questions) {
        unsigned s = serializeName(q.name, out);
        out += s;

        if (out + 4 >= e) return 0;

        ((uint16_t*)out)[0] = htons(q.qtype);
        ((uint16_t*)out)[1] = htons(q.qclass);
        out += 4;
    }

    for (unsigned i = 0; i < RESPONSE_LAST; i++) {
        for (const auto &r: in->answers) {
            if (r.resptype == i) {
                out += serialize_answer(&r, out);
            }
        }
    }

    return out - oout;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
movzwl (%rdi), %eax
rolw $0x8, %ax
movw %ax, (%rsi)
movzwl 0x2(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x2(%rsi)
movzwl 0x4(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x4(%rsi)
movzwl 0x6(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x6(%rsi)
movzwl 0x8(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x8(%rsi)
movzwl 0xa(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0xa(%rsi)
movq 0x10(%rdi), %r13
movq 0x18(%rdi), %rcx
movq %rsi, 0x8(%rsp)
leaq 0xc(%rsi), %r15
movq %rcx, 0x10(%rsp)
cmpq %rcx, %r13
je 0x9ec9
movl $0xc, %r12d
leaq 0x28(%rsp), %rbx
movq %rbx, 0x18(%rsp)
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0x3c72
movq %rbp, %rdi
movq %r15, %rsi
callq 0x9bdd
movl %eax, %ebp
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x9e7f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x32b0
movl %ebp, %eax
addq %rax, %r12
cmpq $0x7fb, %r12            # imm = 0x7FB
jg 0x9f03
movzwl (%r13), %eax
rolw $0x8, %ax
movq 0x8(%rsp), %rcx
leaq (%rcx,%r12), %r15
addq $0x4, %r15
movw %ax, -0x4(%r15)
movzwl 0x2(%r13), %eax
rolw $0x8, %ax
addq $0x4, %r12
movw %ax, -0x2(%r15)
addq $0x28, %r13
cmpq 0x10(%rsp), %r13
jne 0x9e39
xorl %ebx, %ebx
movq 0x28(%r14), %r12
movq 0x30(%r14), %r13
cmpq %r13, %r12
je 0x9ef5
cmpl %ebx, 0x4(%r12)
jne 0x9eef
movq %r12, %rdi
movq %r15, %rsi
callq 0x9c83
movl %eax, %eax
addq %rax, %r15
addq $0x50, %r12
jmp 0x9ed3
incl %ebx
cmpl $0x3, %ebx
jne 0x9ecb
subl 0x8(%rsp), %r15d
jmp 0x9f06
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/img2img/img2img.cpp
// Function: main
int main(int argc, char **argv)
{
  // Check arguments
  if (argc != 3) {
    RNFail("Usage: img2img inputfile outputfile\n");
    return 1;
  }

  // Read and write image file 
  R2Image image;
  if (!image.Read(argv[1])) return -1;
  if (!image.Write(argv[2])) return -1;
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
cmpl $0x3, %edi
jne 0x35db
movq %rsi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x361c
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x3640
testl %eax, %eax
je 0x35f0
movq 0x10(%rbx), %rsi
movq %rsp, %rdi
callq 0x57bc
xorl %ebx, %ebx
cmpl $0x1, %eax
sbbl %ebx, %ebx
jmp 0x35f5
leaq 0x33a22(%rip), %rdi     # 0x37004
xorl %eax, %eax
callq 0x6d3a
movl $0x1, %ebx
jmp 0x35fd
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rsp, %rdi
callq 0x3b98
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3b98
movq %rbx, %rdi
callq 0x3330
nop
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::Reader(std::istream&, unsigned long, unsigned long)
Reader::Reader(std::istream &istream, size_t buffer_capacity,
               size_t buffer_count)
    : m_buffer_count(buffer_count), m_buffer_capacity(buffer_capacity),
      m_istream(istream), m_buffers(buffer_count),
      m_buffer_index(buffer_count - 1), m_buffer_offset(buffer_capacity),
      m_buffer_size(buffer_capacity)
{
    for (size_t i = 0; i < m_buffer_count; ++i) {
        try {
            m_buffers[i] = std::shared_ptr<char[]>(new char[m_buffer_capacity]);
        } catch (const std::bad_alloc &e) {
            throw Error("cannot allocate buffer for input stream data");
        }
    }

    refill_next_buffer();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, %r15
movq %rdi, %r14
leaq 0x833e(%rip), %rax      # 0xbb38
movq %rax, (%rdi)
movq %rcx, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rsi, 0x18(%rdi)
leaq 0x20(%rdi), %rbx
movq %rsp, %rdx
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x4026
decq %r12
movq %r12, 0x38(%r14)
movq %r15, 0x40(%r14)
movq %r15, 0x48(%r14)
cmpq $0x0, 0x8(%r14)
je 0x3895
movl $0x8, %r12d
leaq 0x8(%rsp), %r15
xorl %r13d, %r13d
movq 0x10(%r14), %rdi
callq 0x3030
movq %rax, (%rsp)
movq %r15, %rdi
movq %rax, %rsi
callq 0x426a
movq (%rbx), %rax
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, (%rsp)
movq (%rax,%r12), %rdi
movups %xmm0, -0x8(%rax,%r12)
testq %rdi, %rdi
je 0x3879
callq 0x4130
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x3888
callq 0x4130
incq %r13
addq $0x10, %r12
cmpq 0x8(%r14), %r13
jb 0x383f
movq %r14, %rdi
callq 0x3976
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x395d
movq %rax, %r15
jmp 0x3965
movq %rax, %r15
cmpl $0x1, %edx
jne 0x395d
movq %r15, %rdi
callq 0x30f0
movl $0x10, %edi
callq 0x3130
movq %rax, %r14
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4732(%rip), %rsi      # 0x8020
leaq 0x4757(%rip), %rdx      # 0x804c
movq %rsp, %rdi
callq 0x41b8
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x32d0
leaq 0x82b6(%rip), %rax      # 0xbbc8
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0x8242(%rip), %rsi      # 0xbb60
movq 0x868b(%rip), %rdx      # 0xbfb0
movq %r14, %rdi
callq 0x3360
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x3946
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3240
testb %bpl, %bpl
jne 0x3950
jmp 0x3958
movq %rax, %r15
movq %r14, %rdi
callq 0x3190
callq 0x3350
movq %rbx, %rdi
callq 0x40a8
movq %r15, %rdi
callq 0x3370
movq %rax, %rdi
callq 0x409c
nop
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::refill_next_buffer()
void
Reader::refill_next_buffer()
{
    if (m_buffer_size == 0) {
        // Current buffer is the last one. Don't fill the next one.
        return;
    }

    // Current buffer must be completely read before filling the next one
    assert(m_buffer_offset == m_buffer_size);

    m_buffer_index = (m_buffer_index + 1) % m_buffer_count;
    auto buf = m_buffers[m_buffer_index];
    // Buffer for new data must not in use
    assert(buf.use_count() == 2);

    m_buffer_size = read_stream(buf, m_buffer_capacity);
    m_buffer_offset = 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x39d0
movq %rdi, %rbx
cmpq %rax, 0x40(%rdi)
jne 0x3a5e
movq 0x20(%rbx), %rcx
movq 0x38(%rbx), %rax
incq %rax
xorl %edx, %edx
divq 0x8(%rbx)
movq %rdx, 0x38(%rbx)
shlq $0x4, %rdx
movq 0x8(%rcx,%rdx), %r14
testq %r14, %r14
je 0x3a3f
movq (%rcx,%rdx), %rcx
movq 0x85fb(%rip), %rax      # 0xbfc0
cmpb $0x0, (%rax)
je 0x39d8
incl 0x8(%r14)
jmp 0x39dd
addq $0x18, %rsp
popq %rbx
popq %r14
retq
lock
incl 0x8(%r14)
movl 0x8(%r14), %edx
cmpl $0x2, %edx
jne 0x3a3f
movq %rcx, 0x8(%rsp)
movq %r14, 0x10(%rsp)
cmpb $0x0, (%rax)
je 0x39ff
movl $0x3, 0x8(%r14)
jmp 0x3a04
lock
incl 0x8(%r14)
movq 0x10(%rbx), %rdx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3c62
movq %rax, 0x48(%rbx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3a28
callq 0x4130
movq $0x0, 0x40(%rbx)
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x4130
leaq 0x46f9(%rip), %rdi      # 0x813f
leaq 0x4614(%rip), %rsi      # 0x8061
leaq 0x46b9(%rip), %rcx      # 0x810d
movl $0x84, %edx
callq 0x3160
leaq 0x4687(%rip), %rdi      # 0x80ec
leaq 0x45f5(%rip), %rsi      # 0x8061
leaq 0x469a(%rip), %rcx      # 0x810d
movl $0x7f, %edx
callq 0x3160
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3a8f
callq 0x4130
movq %r14, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x3370
nop
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::read(unsigned long, char*)
size_t
Reader::read(size_t data_size, char *dest_buf)
{
    size_t retry_count{0};
    size_t offset{0};
    size_t to_read{data_size};

    while ((to_read > 0) && (retry_count < 2)) {
        const DataPart dp{readMultipart(to_read)};
        if (dp.size == 0) {
            ++retry_count;
            continue;
        }

        retry_count = 0;
        memcpy(dest_buf + offset, dp.data.get(), dp.size);
        offset += dp.size;
        to_read -= dp.size;
    }

    assert(offset <= data_size);
    return offset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x3b43
movq %rdx, %r15
movq %rdi, %r12
xorl %ebx, %ebx
movq %rsi, 0x8(%rsp)
movq %rsi, %rbp
xorl %r13d, %r13d
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x3b58
movq 0x10(%rsp), %r14
testq %r14, %r14
je 0x3b00
leaq (%r15,%rbx), %rdi
movq 0x18(%rsp), %rsi
movq %r14, %rdx
callq 0x31c0
addq %r14, %rbx
subq %r14, %rbp
xorl %r13d, %r13d
jmp 0x3b03
incq %r13
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x3b12
callq 0x4130
testq %rbp, %rbp
je 0x3b1d
cmpq $0x2, %r13
jb 0x3aca
cmpq 0x8(%rsp), %rbx
jbe 0x3b45
leaq 0x4522(%rip), %rdi      # 0x804d
leaq 0x452f(%rip), %rsi      # 0x8061
leaq 0x453c(%rip), %rcx      # 0x8075
movl $0x4d, %edx
callq 0x3160
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::readMultipart(unsigned long)
DataPart
Reader::readMultipart(size_t data_size)
{
    const size_t size_left{m_buffer_size - m_buffer_offset};
    if (size_left == 0) {
        refill_next_buffer();
        if (m_buffer_size == 0) {
            return DataPart{.size = 0, .data = std::shared_ptr<char[]>()};
        }
    }
    // There is at least one byte in the buffer
    const DataPart dp{read_current_buffer(data_size)};
    assert(dp.size > 0);
    return dp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x48(%rsi), %rax
cmpq 0x40(%rsi), %rax
jne 0x3b7f
movq %r15, %rdi
callq 0x3976
cmpq $0x0, 0x48(%r15)
je 0x3b9c
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3bcc
cmpq $0x0, (%rbx)
je 0x3bac
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
jmp 0x3b93
leaq 0x44f6(%rip), %rdi      # 0x80a9
leaq 0x44a7(%rip), %rsi      # 0x8061
leaq 0x44f4(%rip), %rcx      # 0x80b5
movl $0x5d, %edx
callq 0x3160
nop
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::read_current_buffer(unsigned long)
DataPart
Reader::read_current_buffer(size_t data_size)
{
    DataPart dp;

    // Set data
    if (m_buffer_offset == 0) {
        dp.data = std::shared_ptr<char[]>{m_buffers[m_buffer_index]};
    } else {
        dp.data = std::shared_ptr<char[]>{
            m_buffers[m_buffer_index],
            static_cast<char *>(m_buffers[m_buffer_index].get()) +
                m_buffer_offset};
    }

    const size_t size_left{m_buffer_size - m_buffer_offset};
    dp.size = std::min(data_size, size_left);
    m_buffer_offset += dp.size;
    return dp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movq 0x40(%rsi), %rcx
movq 0x20(%rsi), %rax
movq 0x38(%rsi), %rsi
shlq $0x4, %rsi
leaq (%rax,%rsi), %rdx
movq (%rax,%rsi), %rax
testq %rcx, %rcx
je 0x3c01
addq %rcx, %rax
movq 0x8(%rdx), %rcx
testq %rcx, %rcx
je 0x3c19
movq 0x83af(%rip), %rdx      # 0xbfc0
cmpb $0x0, (%rdx)
je 0x3c46
incl 0x8(%rcx)
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
movq 0x40(%rbx), %rax
movq 0x48(%rbx), %rcx
subq %rax, %rcx
cmpq %r15, %rcx
cmovaeq %r15, %rcx
movq %rcx, (%r14)
addq %rax, %rcx
movq %rcx, 0x40(%rbx)
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
lock
incl 0x8(%rcx)
movq 0x10(%r14), %rdi
movq %rax, 0x8(%r14)
movq %rcx, 0x10(%r14)
testq %rdi, %rdi
je 0x3c21
callq 0x4130
jmp 0x3c21
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::read_stream(std::shared_ptr<char []>, unsigned long)
size_t
Reader::read_stream(std::shared_ptr<char[]> data, size_t data_size)
{
    m_istream.read(data.get(), data_size);

    if (!m_istream.good() && !m_istream.eof()) {
        throw Error("cannot read from stream");
    }

    return m_istream.gcount();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq (%rsi), %rsi
callq 0x32e0
movq 0x18(%rbx), %rax
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x20(%rax,%rcx), %ecx
testl %ecx, %ecx
sete %dl
andl $0x2, %ecx
shrl %ecx
orb %dl, %cl
je 0x3ca7
movq 0x8(%rax), %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3130
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4490(%rip), %rsi      # 0x8154
leaq 0x44a0(%rip), %rdx      # 0x816b
leaq 0x8(%rsp), %rdi
callq 0x41b8
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x32d0
leaq 0x7edc(%rip), %rax      # 0xbbc8
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x7e68(%rip), %rsi      # 0xbb60
movq 0x82b1(%rip), %rdx      # 0xbfb0
movq %rbx, %rdi
callq 0x3360
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3d21
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3240
testb %bpl, %bpl
jne 0x3d2b
jmp 0x3d33
movq %rax, %r14
movq %rbx, %rdi
callq 0x3190
movq %r14, %rdi
callq 0x3370
nop
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Writer::Writer(std::ostream&, unsigned long)
Writer::Writer(std::ostream &ostream, size_t buffer_capacity)
    : m_ostream(ostream), m_buffer_size(0), m_buffer_capacity(buffer_capacity)
{
    try {
        m_buffer = std::make_unique<char[]>(m_buffer_capacity);
    } catch (const std::bad_alloc &e) {
        throw Error("cannot allocate buffer for output stream data");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
leaq 0x7e36(%rip), %rax      # 0xbb88
movq %rax, (%rdi)
movq %rsi, 0x8(%rdi)
leaq 0x10(%rdi), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movq %rdx, 0x20(%rdi)
movq %rdx, %rdi
callq 0x3030
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x3150
movq %r14, (%r15)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0x3e3e
movq %r14, %rdi
callq 0x30f0
movl $0x10, %edi
callq 0x3130
movq %rax, %rbx
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x43aa(%rip), %rsi      # 0x816c
leaq 0x43d0(%rip), %rdx      # 0x8199
movq %rsp, %rdi
callq 0x41b8
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x32d0
leaq 0x7de2(%rip), %rax      # 0xbbc8
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x7d6e(%rip), %rsi      # 0xbb60
movq 0x81b7(%rip), %rdx      # 0xbfb0
movq %rbx, %rdi
callq 0x3360
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x3e1a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3240
testb %bpl, %bpl
jne 0x3e24
jmp 0x3e2c
movq %rax, %r14
movq %rbx, %rdi
callq 0x3190
callq 0x3350
movq (%r15), %rdi
testq %rdi, %rdi
je 0x3e3e
callq 0x32f0
movq $0x0, (%r15)
movq %r14, %rdi
callq 0x3370
movq %rax, %rdi
callq 0x409c
nop
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Writer::write(char const*, unsigned long)
void
Writer::write(const char *data, size_t data_size)
{
    size_t free{m_buffer_capacity - m_buffer_size};
    if (data_size <= free) {
        // There is free space in the buffer
        write_buffer(data, data_size);
    } else {
        // No free space
        flush_buffer();
        if (data_size <= m_buffer_capacity) {
            // Data fits into the buffer
            write_buffer(data, data_size);
        } else {
            // Doesn't fit
            write_stream(data, data_size);
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x20(%rdi), %rax
movq 0x10(%rdi), %rsi
movq 0x18(%rdi), %rdx
subq %rdx, %rax
cmpq %rbx, %rax
jae 0x3f19
movq %r14, %rdi
callq 0x3f5e
movq $0x0, 0x18(%r14)
cmpq %rbx, 0x20(%r14)
jae 0x3f21
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x3f5e
addq %rdx, %rsi
movq %rsi, %rdi
jmp 0x3f25
movq 0x10(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x31c0
addq %rbx, 0x18(%r14)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/./format_v2.h
// Function: FormatV2::Writer::writeDiffRecord(unsigned long, unsigned long, std::vector<FormatV2::RecordData, std::allocator<FormatV2::RecordData>>)
void writeDiffRecord(
        uint64_t offset, size_t size,
        std::vector<RecordData> data) // cppcheck-suppress passedByValue
    {
        writeOffset(offset);
        writeSize(size);
        for (auto it = data.begin(); it != data.end(); ++it) {
            writeData(*it);
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r14
bswapq %rsi
leaq 0x8(%rsp), %rax
movq %rsi, (%rax)
movl $0x8, %edx
movq %rax, %rsi
callq 0x3ece
bswapl %r15d
leaq 0x4(%rsp), %rsi
movl %r15d, (%rsi)
movl $0x4, %edx
movq %r14, %rdi
callq 0x3ece
movq (%rbx), %r12
cmpq 0x8(%rbx), %r12
je 0x53b6
movq 0x6c4e(%rip), %r13      # 0xbfc0
movq (%r12), %rdx
movq 0x8(%r12), %rsi
movq 0x10(%r12), %r15
testq %r15, %r15
je 0x5397
cmpb $0x0, (%r13)
je 0x5392
incl 0x8(%r15)
jmp 0x5397
lock
incl 0x8(%r15)
movq %r14, %rdi
callq 0x3ece
testq %r15, %r15
je 0x53ac
movq %r15, %rdi
callq 0x4130
addq $0x18, %r12
cmpq 0x8(%rbx), %r12
jne 0x5372
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
testq %r15, %r15
je 0x53d4
movq %r15, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x3370
// File: /workspace/github_cpp_makefile_star2_O3/jansucan[P]diff-dd/src/create.cpp
// Function: PagedStreamReader::getNextPage()
Page getNextPage()
    {
        const BufferedStream::DataPart dp{
            m_reader.readMultipart(m_page_size_bytes)};

        m_stream_pos_bytes += dp.size;

        return Page{dp.data, m_stream_pos_bytes - dp.size, m_stream_pos_bytes};
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rsi
movq (%r14), %rdx
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x3b58
movq (%r15), %rax
movq 0x58(%r14), %rcx
addq %rax, %rcx
movq %rcx, 0x58(%r14)
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movq %rsi, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
testq %rdx, %rdx
je 0x58be
movq 0x6719(%rip), %rsi      # 0xbfc0
cmpb $0x0, (%rsi)
je 0x58b1
incl 0x8(%rdx)
jmp 0x58be
lock
incl 0x8(%rdx)
movq 0x58(%r14), %rcx
movq 0x18(%rsp), %rax
movq %rcx, %rdx
subq %rax, %rdx
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5a8a
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x58e2
callq 0x4130
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x58f1
callq 0x4130
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq