LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/solaldunckel[P]webserv/srcs/Utils/Utils.cpp
// Function: ft::inet_ntop[abi:cxx11](void const*)
std::string inet_ntop(const void *s) {
    const u_char *src = (const u_char*)s;
    std::ostringstream oss;

    oss << ft::to_string(src[0]) << '.' << ft::to_string(src[1]) << '.' <<
      ft::to_string(src[2]) << '.' << ft::to_string(src[3]);
    return oss.str();
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x88(%rsp), %rdi
callq 0x45b0
movzbl (%r14), %esi
leaq 0x68(%rsp), %rdi
callq 0x24ae4
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq 0x88(%rsp), %rdi
callq 0x44e0
leaq 0x48(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
movq %rax, %r15
movzbl 0x1(%r14), %esi
leaq 0x48(%rsp), %rdi
callq 0x24ae4
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %r15, %rdi
callq 0x44e0
leaq 0x28(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
movq %rax, %r15
movzbl 0x2(%r14), %esi
leaq 0x28(%rsp), %rdi
callq 0x24ae4
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r15, %rdi
callq 0x44e0
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x44e0
movq %rax, %r15
movzbl 0x3(%r14), %esi
leaq 0x8(%rsp), %rdi
callq 0x24ae4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0x44e0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x248e5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x24900
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2491b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x24936
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
leaq 0x90(%rsp), %rsi
movq %rbx, %rdi
callq 0x46b0
movq 0xd663(%rip), %rsi      # 0x31fb0
leaq 0x88(%rsp), %rdi
callq 0x4220
leaq 0xf8(%rsp), %rdi
callq 0x4130
movq %rbx, %rax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
jmp 0x2499f
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x249a7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x249a7
jmp 0x249a4
jmp 0x249c4
jmp 0x249e4
movq %rax, %rbx
jmp 0x24a02
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x249c7
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x249c7
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x249e7
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x249e7
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x24a02
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xd5a7(%rip), %rsi      # 0x31fb0
leaq 0x88(%rsp), %rdi
callq 0x4220
leaq 0xf8(%rsp), %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x4790
// File: /workspace/github_cpp_makefile_star2_O3/solaldunckel[P]webserv/srcs/Utils/Utils.cpp
// Function: ft::free_tab(char**)
void free_tab(char **tab) {
    int i = 0;

    while (tab[i]) {
      if (tab[i])
        free(tab[i]);
      tab[i] = NULL;
      i++;
    }
    free(tab);
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x24a5c
leaq 0x8(%rbx), %r14
callq 0x4550
movq $0x0, -0x8(%r14)
movq (%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x24a43
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4550
// File: /workspace/github_cpp_makefile_star2_O3/solaldunckel[P]webserv/srcs/Utils/Utils.cpp
// Function: ft::get_http_date[abi:cxx11]()
std::string get_http_date() {
    struct timeval tv;
    char buf[32];
    gettimeofday(&tv, NULL);

    struct tm	*tm;
    tm = gmtime(&tv.tv_sec);
    int ret = strftime(buf, 32, "%a, %d %b %Y %T GMT", tm);
    return std::string(buf, ret);
  }

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x28(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x46d0
movq %r14, %rdi
callq 0x43a0
leaq 0x147a(%rip), %rdx      # 0x25f0d
movq %rsp, %r14
movl $0x20, %esi
movq %r14, %rdi
movq %rax, %rcx
callq 0x4380
cltq
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
leaq (%rsp,%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x579e
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/phmap/./phmap.h
// Function: phmap::container_internal::raw_hash_set<phmap::container_internal::FlatHashMapPolicy<unsigned int, unsigned int>, Hash32, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>>::erase(phmap::container_internal::raw_hash_set<phmap::container_internal::FlatHashMapPolicy<unsigned int, unsigned int>, Hash32, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>>::iterator)
iterator& operator++() {
            ++ctrl_;
            ++slot_;
            skip_empty_or_deleted();
            return *this;
        }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x1(%rsi), %rax
leaq 0x8(%rdx), %rbx
cmpb $-0x2, 0x1(%rsi)
jg 0x174c
movdqu (%rax), %xmm0
pcmpeqd %xmm1, %xmm1
pcmpgtb %xmm0, %xmm1
pmovmskb %xmm1, %ecx
incl %ecx
bsfl %ecx, %ecx
leaq (%rax,%rcx), %r14
leaq (%rbx,%rcx,8), %rbx
cmpb $-0x1, (%rax,%rcx)
movq %r14, %rax
jl 0x1724
jmp 0x174f
movq %rax, %r14
callq 0x20d4
movq %r14, %rax
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/phmap/./phmap.h
// Function: std::pair<phmap::container_internal::raw_hash_set<phmap::container_internal::FlatHashMapPolicy<unsigned int, unsigned int>, Hash32, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>>::iterator, bool> phmap::container_internal::raw_hash_set<phmap::container_internal::FlatHashMapPolicy<unsigned int, unsigned int>, Hash32, phmap::EqualTo<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int>>>::emplace_decomposable<unsigned int, std::piecewise_construct_t const&, std::tuple<unsigned int&&>, std::tuple<unsigned int&&>>(unsigned int const&, unsigned long, std::piecewise_construct_t const&, std::tuple<unsigned int&&>&&, std::tuple<unsigned int&&>&&)
std::pair<iterator, bool> emplace_decomposable(const K& key, size_t hash, 
                                                   Args&&... args)
    {
        auto res = find_or_prepare_insert(key, hash);
        if (res.second) {
            emplace_at(res.first, std::forward<Args>(args)...);
        }
        return {iterator_at(res.first), res.second};
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r15
movq %r8, %r13
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x1888
movq %rax, %r12
movl %edx, %ebp
testb $0x1, %dl
je 0x185d
movq 0x40(%rsp), %r8
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x194a
movq (%r14), %rax
addq %r12, %rax
shlq $0x3, %r12
addq 0x8(%r14), %r12
movq %rax, (%rbx)
movq %r12, 0x8(%rbx)
movb %bpl, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/j-faria[P]kima/examples/activity_correlations/kima_setup.cpp
// Function: main
int main(int argc, char** argv)
{
    /* Four options to demonstrate the linear correlations with indicators */

    // Load the first file without any correlation (just reads time, RV, error)
    datafile = "simulated1.txt";
    load(datafile, "ms", 4);

    /* Load the first file with linear correlation with indicator "b", in the 4th column */
    // datafile = "simulated1.txt";
    // indicators = {"b"};
    // load(datafile, "ms", 4, indicators);

    /* Load the second file with linear correlation with indicator "b" only */
    // datafile = "simulated2.txt";
    // indicators = {"b"};
    // load(datafile, "ms", 4, indicators);

    /* Load the second file, with linear correlation with "b" and "c", skip 5th column */
    // datafile = "simulated2.txt";
    // indicators = {"b", "", "indc"};
    // load(datafile, "ms", 4, indicators);


    Sampler<RVmodel> sampler = setup<RVmodel>(argc, argv);
    sampler.run(50);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x6c0, %rsp            # imm = 0x6C0
movq %rsi, %rbx
movl %edi, %ebp
movq 0x30e01(%rip), %rdx     # 0x51548
leaq 0x30df2(%rip), %r14     # 0x51540
leaq 0x22198(%rip), %rcx     # 0x428ed
movl $0xe, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0x6600
leaq 0x8(%rsp), %rdx
movl $0x4, (%rdx)
leaq 0x1cd9a(%rip), %rsi     # 0x3d511
movq %r14, %rdi
callq 0x20977
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x20a7a
movq %r14, %rdi
movl $0x32, %esi
callq 0x20b4c
leaq 0x8(%rsp), %rdi
callq 0x20d2a
xorl %eax, %eax
addq $0x6c0, %rsp            # imm = 0x6C0
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20d2a
movq %rbx, %rdi
callq 0x6710
nop
// File: /workspace/github_cpp_makefile_star2_O3/brianwu02[P]ImageProcessing/unordered_dither.cpp
// Function: main
int main(int argc, char** argv) {
    int	n;
    double gamma;
    imageP	I1, I2, tmp_img;
    // read input image (I1) and reserve space for output (I2)
    I1 = IP_readImage(argv[1]);
    I2 = NEWIMAGE;
    tmp_img = NEWIMAGE;

    // read n and gamma from STDIN
    n = atoi(argv[2]);
    gamma = atof(argv[3]);

    // threshold image and save result in file
    unordered_dither(I1, n, gamma, I2, tmp_img);
    IP_saveImage(I2, argv[4]);

    // free up image structures/memory
    IP_freeImage(I1);
    IP_freeImage(I2);
    IP_freeImage(tmp_img);
    cout << "done" << endl;

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq 0x8(%rsi), %rdi
callq 0x2634
movq %rax, %rbx
movl $0x10, %edi
callq 0x2180
movq %rax, %r15
movl $0x10, %edi
callq 0x2180
movq %rax, %r12
movq 0x10(%r14), %rdi
callq 0x21c0
movl %eax, %ebp
movq 0x18(%r14), %rdi
callq 0x2150
cvtsd2ss %xmm0, %xmm0
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x2439
movq 0x20(%r14), %rsi
movq %r15, %rdi
callq 0x285a
movq %rbx, %rdi
callq 0x2a0b
movq %r15, %rdi
callq 0x2a0b
movq %r12, %rdi
callq 0x2a0b
movq 0x2be0(%rip), %rbx      # 0x4fd0
leaq 0xc29(%rip), %rsi       # 0x3020
movl $0x4, %edx
movq %rbx, %rdi
callq 0x2120
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/kaityo256[P]randomsampling/./cumulative_sum.hpp
// Function: cumulative_sum::cumulative_sum(std::vector<double, std::allocator<double>>&)
cumulative_sum(std::vector<double> &list) {
    double sum = 0.0;
    for (auto v : list) {
      c_sum.push_back(sum);
      sum += v;
    }
    ud.param(std::uniform_real_distribution<double>::param_type(0, sum));
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rdi)
movupd %xmm0, (%rdi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x20(%rdi)
movq $0x0, 0x8(%rsp)
movq (%rsi), %r15
movq 0x8(%rsi), %r12
cmpq %r12, %r15
je 0x3b7a
xorpd %xmm0, %xmm0
leaq 0x8(%rsp), %r14
movsd (%r15), %xmm1
movsd %xmm1, 0x10(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3b4e
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x3b59
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3bb6
movsd 0x10(%rsp), %xmm1
addsd 0x8(%rsp), %xmm1
movsd %xmm1, 0x8(%rsp)
addq $0x8, %r15
movapd %xmm1, %xmm0
cmpq %r12, %r15
jne 0x3b2b
jmp 0x3b7e
xorpd %xmm1, %xmm1
movq $0x0, 0x18(%rbx)
movsd %xmm1, 0x20(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3bae
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x10e0
movq %r14, %rdi
callq 0x1140
// File: /workspace/github_cpp_makefile_star2_O3/kaityo256[P]randomsampling/./binary_tree.hpp
// Function: binary_tree::binary_tree(std::vector<double, std::allocator<double>>&)
binary_tree(std::vector<double> &list) {
    int n = twopow(list.size());
    list_size = n;
    root_index = 2 * n - 2;
    tree.resize(2 * n - 1, 0.0);
    std::copy(list.begin(), list.end(), tree.begin());
    int s = 0;
    for (int j = 0; (1 << j) < n; j++) {
      for (int i = 0; i < (n >> (j + 1)); i++) {
        tree[s + (n >> j) + i] = tree[s + i * 2] + tree[s + i * 2 + 1];
      }
      s += n >> j;
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x8(%rsi), %r15
subq (%rsi), %r15
shrq $0x3, %r15
testl %r15d, %r15d
je 0x3e06
leal -0x1(%r15), %eax
testl %eax, %r15d
je 0x3e09
bsrl %r15d, %ecx
xorl $0x1f, %ecx
negb %cl
movl $0x1, %r15d
shll %cl, %r15d
jmp 0x3e09
xorl %r15d, %r15d
movslq %r15d, %rax
movq %rax, 0x20(%rbx)
leal -0x2(,%rax,2), %ecx
movl %ecx, 0x18(%rbx)
leal -0x1(,%rax,2), %eax
movslq %eax, %rsi
leaq 0x8(%rsp), %rdx
movq $0x0, (%rdx)
movq %rbx, %rdi
callq 0x2718
movq (%r14), %rsi
movq 0x8(%r14), %rdx
subq %rsi, %rdx
je 0x3e4c
movq (%rbx), %rdi
callq 0x1120
cmpl $0x2, %r15d
jl 0x3ec2
movq (%rbx), %rsi
leaq 0x8(%rsi), %rdi
xorl %eax, %eax
xorl %r9d, %r9d
leal 0x1(%rax), %edx
movl %r15d, %r10d
movl %edx, %ecx
shrl %cl, %r10d
movl %r15d, %r8d
movl %eax, %ecx
shrl %cl, %r8d
addl %r9d, %r8d
testl %r10d, %r10d
je 0x3ead
movl %r9d, %r11d
movl %r8d, %r9d
movl %r10d, %ecx
leaq (%rsi,%r9,8), %r9
leaq (%rdi,%r11,8), %r10
shlq $0x3, %rcx
xorl %r11d, %r11d
movsd -0x8(%r10,%r11,2), %xmm0
addsd (%r10,%r11,2), %xmm0
movsd %xmm0, (%r9,%r11)
addq $0x8, %r11
cmpq %r11, %rcx
jne 0x3e91
movl $0x2, %r10d
movl %eax, %ecx
shll %cl, %r10d
movl %edx, %eax
movl %r8d, %r9d
cmpl %r15d, %r10d
jl 0x3e5e
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3ee3
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x10e0
movq %r14, %rdi
callq 0x1140
nop
// File: /workspace/github_cpp_makefile_star2_O3/kaityo256[P]randomsampling/./binary_tree.hpp
// Function: binary_tree::select(std::mersenne_twister_engine<unsigned long, 32ul, 624ul, 397ul, 31ul, 2567483615ul, 11ul, 4294967295ul, 7ul, 2636928640ul, 15ul, 4022730752ul, 18ul, 1812433253ul>&)
int select(std::mt19937 &mt) {
    std::uniform_real_distribution<double> ud(0.0, 1.0);
    int index = root_index;
    int base = root_index;
    for (int i = 0; index >= list_size; i++) {
      double v = ud(mt) * tree[index];
      int local_index = index - base;
      base -= (2 << i);
      int left = base + local_index * 2;
      int right = left + 1;
      if (v < tree[left]) {
        index = left;
      } else {
        index = right;
      }
    }
    return index;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x18(%rdi), %ebx
movslq %ebx, %r12
cmpq %r12, 0x20(%rdi)
ja 0x3f5a
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
movl %ebx, %r13d
movq %r14, %rdi
callq 0x3c95
addsd 0x110a(%rip), %xmm0     # 0x5028
movq (%r15), %rax
mulsd (%rax,%r12,8), %xmm0
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movl %ebp, %ecx
shll %cl, %edx
subl %r13d, %ebx
addl %r13d, %edx
leal (%rdx,%rbx,2), %ecx
movslq %ecx, %rbx
movsd (%rax,%rbx,8), %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setbe %al
addl %eax, %ebx
incl %ebp
movslq %ebx, %r12
movl %edx, %r13d
cmpq %r12, 0x20(%r15)
jbe 0x3f0e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/kaityo256[P]randomsampling/./binary_tree.hpp
// Function: binary_tree::update(int, double)
void update(int index, double value) {
    tree[index] = value;
    int base = 0;
    for (int i = 0; index != root_index; i++) {
      int local_index = index - base;
      base += (list_size >> i);
      index = (index >> 1) << 1;
      int pindex = base + local_index / 2;
      tree[pindex] = tree[index] + tree[index + 1];
      index = pindex;
    }
  }

// Assembly:
movslq %esi, %rcx
movq (%rdi), %rax
movsd %xmm0, (%rax,%rcx,8)
movl 0x18(%rdi), %edx
cmpl %ecx, %edx
je 0x3fd8
movq 0x20(%rdi), %rdi
xorl %ecx, %ecx
xorl %r9d, %r9d
movl %esi, %r10d
subl %r9d, %r10d
movq %rdi, %r8
shrq %cl, %r8
addl %r9d, %r8d
movl %esi, %r9d
andl $-0x2, %r9d
movl %r10d, %r11d
shrl $0x1f, %r11d
addl %r10d, %r11d
sarl %r11d
addl %r8d, %r11d
movslq %r9d, %r9
movsd (%rax,%r9,8), %xmm0
orl $0x1, %esi
movslq %esi, %rsi
addsd (%rax,%rsi,8), %xmm0
movslq %r11d, %r10
movsd %xmm0, (%rax,%r10,8)
incq %rcx
movl %r11d, %esi
movl %r8d, %r9d
cmpl %edx, %r10d
jne 0x3f87
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lerp.cpp
// Function: ApplyInterpolation(interpolation_t const*, int, int const*, float (*) [3])
static void ApplyInterpolation (const interpolation_t *interp, int numstyles, const int *styles, vec3_t *outs
#ifdef ZHLT_XASH
								, vec3_t *outs_direction
#endif
								)
{
	int i;
	int j;

	for (j = 0; j < numstyles; j++)
	{
		VectorClear (outs[j]);
#ifdef ZHLT_XASH
		VectorClear (outs_direction[j]);
#endif
	}
	if (interp->totalweight <= 0)
	{
		return;
	}
	for (i = 0; i < (int)interp->points.size (); i++)
	{
		for (j = 0; j < numstyles; j++)
		{
#ifdef ZHLT_XASH
			const vec3_t *b_direction;
#endif
			const vec3_t *b = GetTotalLight (&g_patches[interp->points[i].patchnum], styles[j]
#ifdef ZHLT_XASH
											, b_direction
#endif
											);
			VectorMA (outs[j], interp->points[i].weight / interp->totalweight, *b, outs[j]);
#ifdef ZHLT_XASH
			VectorMA (outs_direction[j], interp->points[i].weight / interp->totalweight, *b_direction, outs_direction[j]);
#endif
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r13
testl %esi, %esi
jle 0xf503
movl %ebp, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4190
xorps %xmm0, %xmm0
ucomiss 0x4(%r13), %xmm0
jae 0xf615
movq 0x8(%r13), %rax
movq 0x10(%r13), %rcx
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x3, %rdx
testl %edx, %edx
jle 0xf615
movl %ebp, %edi
addq $0x8, %rbx
xorl %r9d, %r9d
leaq 0x53a84a5(%rip), %r14   # 0x53b79e0
movq %rbx, 0x8(%rsp)
movl %ebp, 0x4(%rsp)
movq %rdi, 0x10(%rsp)
testl %ebp, %ebp
jle 0xf5fc
movq %rbx, %rbp
xorl %ebx, %ebx
movq 0x8(%r13), %rax
movslq (%rax,%r9,8), %rax
imulq $0x138, %rax, %rdi      # imm = 0x138
addq (%r14), %rdi
movl (%r12,%rbx,4), %esi
movq %r9, %r15
callq 0x217b6
movq %r15, %r9
movq 0x10(%rsp), %rdi
movq 0x8(%r13), %rcx
movss 0x4(%rcx,%r15,8), %xmm0
divss 0x4(%r13), %xmm0
mulss (%rax), %xmm0
addss -0x8(%rbp), %xmm0
movss %xmm0, -0x8(%rbp)
movq 0x8(%r13), %rcx
movss 0x4(%rcx,%r15,8), %xmm0
divss 0x4(%r13), %xmm0
mulss 0x4(%rax), %xmm0
addss -0x4(%rbp), %xmm0
movss %xmm0, -0x4(%rbp)
movq 0x8(%r13), %rcx
movss 0x4(%rcx,%r15,8), %xmm0
divss 0x4(%r13), %xmm0
mulss 0x8(%rax), %xmm0
addss (%rbp), %xmm0
movss %xmm0, (%rbp)
incq %rbx
addq $0xc, %rbp
cmpq %rbx, %rdi
jne 0xf556
movq 0x8(%r13), %rax
movq 0x10(%r13), %rcx
movq 0x8(%rsp), %rbx
movl 0x4(%rsp), %ebp
incq %r9
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x3, %rdx
movslq %edx, %rdx
cmpq %rdx, %r9
jl 0xf549
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lerp.cpp
// Function: GetTriangulationPatches(int, int*, int const**)
void GetTriangulationPatches (int facenum, int *numpatches, const int **patches)
{
	const facetriangulation_t *facetrian;

	facetrian = g_facetriangulations[facenum];
	*numpatches = (int)facetrian->usedpatches.size ();
	*patches = facetrian->usedpatches.data ();
}

// Assembly:
movslq %edi, %rax
leaq 0x20b9558(%rip), %rcx   # 0x20cb910
movq (%rcx,%rax,8), %rax
movq 0x58(%rax), %rcx
subq 0x50(%rax), %rcx
shrq $0x2, %rcx
movl %ecx, (%rsi)
movq 0x50(%rax), %rax
movq %rax, (%rdx)
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lerp.cpp
// Function: FreeTriangulations()
void FreeTriangulations ()
{
	try
	{

	int i;
	int j;
	facetriangulation_t *facetrian;

	for (i = 0; i < g_numfaces; i++)
	{
		facetrian = g_facetriangulations[i];

		for (j = 0; j < (int)facetrian->localtriangulations.size (); j++)
		{
			FreeLocalTriangulation (facetrian->localtriangulations[j]);
		}

		delete facetrian;
		g_facetriangulations[i] = NULL;
	}

	}
	catch (std::bad_alloc)
	{
		hlassume (false, assume_NoMemory);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x1b9e010(%rip), %r15   # 0x1bb03f4
cmpl $0x0, (%r15)
jle 0x12512
xorl %r12d, %r12d
leaq 0x20b9518(%rip), %r13   # 0x20cb910
movq (%r13,%r12,8), %rbx
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rax
subq %rdi, %rax
shrq $0x3, %rax
testl %eax, %eax
jle 0x12496
xorl %ebp, %ebp
movq (%rdi,%rbp,8), %r14
testq %r14, %r14
je 0x12470
movq 0x88(%r14), %rdi
testq %rdi, %rdi
je 0x1243a
movq 0x98(%r14), %rsi
subq %rdi, %rsi
callq 0x42f0
movq 0x70(%r14), %rdi
testq %rdi, %rdi
je 0x12452
movq 0x80(%r14), %rsi
subq %rdi, %rsi
callq 0x42f0
movq 0x58(%r14), %rdi
testq %rdi, %rdi
je 0x12467
movq 0x68(%r14), %rsi
subq %rdi, %rsi
callq 0x42f0
leaq 0x18(%r14), %rdi
callq 0xc244
movl $0xa0, %esi
movq %r14, %rdi
callq 0x42f0
incq %rbp
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rax
subq %rdi, %rax
shrq $0x3, %rax
cltq
cmpq %rax, %rbp
jl 0x12416
movq 0x50(%rbx), %rax
testq %rax, %rax
je 0x124b2
movq 0x60(%rbx), %rsi
subq %rax, %rsi
movq %rax, %rdi
callq 0x42f0
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x124c3
movq 0x48(%rbx), %rsi
subq %rdi, %rsi
callq 0x42f0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x124d8
movq 0x30(%rbx), %rsi
subq %rdi, %rsi
callq 0x42f0
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x124ed
movq 0x18(%rbx), %rsi
subq %rdi, %rsi
callq 0x42f0
movl $0x68, %esi
movq %rbx, %rdi
callq 0x42f0
movq $0x0, (%r13,%r12,8)
incq %r12
movslq (%r15), %rax
cmpq %rax, %r12
jl 0x123f8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lerp.cpp
// Function: GetDirection(float const*, float const*, float*)
static vec_t GetDirection (const vec3_t spot, const vec3_t normal, vec3_t direction_out)
{
	vec_t dot;

	dot = DotProduct (spot, normal);
	VectorMA (spot, -dot, normal, direction_out);
	return VectorNormalize (direction_out);
}

// Assembly:
movss (%rsi), %xmm1
movss (%rdi), %xmm0
movss 0x4(%rdi), %xmm2
mulss 0x4(%rsi), %xmm2
movaps %xmm0, %xmm3
mulss %xmm1, %xmm3
addss %xmm2, %xmm3
movss 0x8(%rdi), %xmm4
mulss 0x8(%rsi), %xmm4
addss %xmm3, %xmm4
mulss %xmm4, %xmm1
subss %xmm1, %xmm0
movss %xmm0, (%rdx)
movss 0x4(%rdi), %xmm1
movss 0x4(%rsi), %xmm2
mulss %xmm4, %xmm2
subss %xmm2, %xmm1
movss %xmm1, 0x4(%rdx)
movss 0x8(%rdi), %xmm2
mulss 0x8(%rsi), %xmm4
subss %xmm4, %xmm2
movaps %xmm1, %xmm3
mulss %xmm1, %xmm3
movaps %xmm0, %xmm4
mulss %xmm0, %xmm4
addss %xmm3, %xmm4
movaps %xmm2, %xmm3
mulss %xmm2, %xmm3
addss %xmm4, %xmm3
cvtss2sd %xmm3, %xmm3
sqrtsd %xmm3, %xmm3
movsd 0x24b6e(%rip), %xmm4    # 0x37118
ucomisd %xmm3, %xmm4
jbe 0x125bb
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
xorps %xmm0, %xmm0
jmp 0x125ea
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtps2pd %xmm0, %xmm0
movapd %xmm3, %xmm1
unpcklpd %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0]
divpd %xmm1, %xmm0
cvtpd2ps %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
divsd %xmm3, %xmm0
xorps %xmm2, %xmm2
cvtsd2ss %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsd2ss %xmm3, %xmm0
movss %xmm2, 0x8(%rdx)
movlpd %xmm1, (%rdx)
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lerp.cpp
// Function: GetFrac(float const*, float const*, float const*, float const*)
static vec_t GetFrac (const vec3_t leftspot, const vec3_t rightspot, const vec3_t direction, const vec3_t normal)
{
	vec3_t v;
	vec_t dot1;
	vec_t dot2;
	vec_t frac;

	CrossProduct (direction, normal, v);
	dot1 = DotProduct (leftspot, v);
	dot2 = DotProduct (rightspot, v);
	
	// dot1 <= 0 < dot2
	if (dot1 >= -NORMAL_EPSILON)
	{
		if (g_drawlerp && dot1 > ON_EPSILON)
		{
			Developer (DEVELOPER_LEVEL_SPAM, "Debug: triangulation: internal error 1.\n");
		}
		frac = 0.0;
	}
	else if (dot2 <= NORMAL_EPSILON)
	{
		if (g_drawlerp && dot2 < -ON_EPSILON)
		{
			Developer (DEVELOPER_LEVEL_SPAM, "Debug: triangulation: internal error 2.\n");
		}
		frac = 1.0;
	}
	else
	{
		frac = dot1 / (dot1 - dot2);
		frac = qmax (0, qmin (frac, 1));
	}

	return frac;
}

// Assembly:
pushq %rax
movss (%rdx), %xmm0
movss 0x4(%rdx), %xmm3
movss 0x8(%rcx), %xmm4
movss 0x8(%rdx), %xmm1
movss (%rcx), %xmm5
movss 0x4(%rcx), %xmm6
movaps %xmm3, %xmm2
mulss %xmm4, %xmm2
mulss %xmm0, %xmm4
mulss %xmm6, %xmm0
mulss %xmm1, %xmm6
subss %xmm6, %xmm2
mulss %xmm5, %xmm1
subss %xmm4, %xmm1
mulss %xmm3, %xmm5
subss %xmm5, %xmm0
movss 0x4(%rdi), %xmm3
mulss %xmm1, %xmm3
movss (%rdi), %xmm4
mulss %xmm2, %xmm4
addss %xmm3, %xmm4
movss 0x8(%rdi), %xmm3
mulss %xmm0, %xmm3
addss %xmm4, %xmm3
xorps %xmm4, %xmm4
cvtss2sd %xmm3, %xmm4
ucomisd 0x27f12(%rip), %xmm4    # 0x3a600
jae 0x12737
mulss 0x4(%rsi), %xmm1
mulss (%rsi), %xmm2
addss %xmm1, %xmm2
mulss 0x8(%rsi), %xmm0
addss %xmm2, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x24a03(%rip), %xmm2    # 0x37118
ucomisd %xmm1, %xmm2
jae 0x12768
movaps %xmm3, %xmm1
subss %xmm0, %xmm1
divss %xmm1, %xmm3
minss 0x24976(%rip), %xmm3    # 0x370a4
xorps %xmm0, %xmm0
maxss %xmm3, %xmm0
jmp 0x127a5
ucomisd 0x27eb9(%rip), %xmm4    # 0x3a5f8
xorps %xmm0, %xmm0
jbe 0x127a5
leaq 0x54e72f6(%rip), %rax   # 0x54f9a41
cmpb $0x0, (%rax)
je 0x127a5
leaq 0x2803b(%rip), %rsi     # 0x3a792
movl $0x5, %edi
xorl %eax, %eax
callq 0xa446
xorps %xmm0, %xmm0
jmp 0x127a5
movsd 0x27e80(%rip), %xmm0    # 0x3a5f0
ucomisd %xmm1, %xmm0
movss 0x24928(%rip), %xmm0    # 0x370a4
jbe 0x127a5
leaq 0x54e72bc(%rip), %rax   # 0x54f9a41
cmpb $0x0, (%rax)
je 0x127a5
leaq 0x2802a(%rip), %rsi     # 0x3a7bb
movl $0x5, %edi
xorl %eax, %eax
callq 0xa446
movss 0x248ff(%rip), %xmm0    # 0x370a4
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: TestFaceIntersect(intersecttest_t*, int)
bool TestFaceIntersect (intersecttest_t *t, int facenum)
{
	dface_t *f2 = &g_dfaces[facenum];
	Winding *w = new Winding (*f2);
	int k;
	for (k = 0; k < w->m_NumPoints; k++)
	{
		VectorAdd (w->m_Points[k], g_face_offset[facenum], w->m_Points[k]);
	}
	for (k = 0; k < t->numclipplanes; k++)
	{
		if (!w->Clip (t->clipplanes[k], false
#ifdef ZHLT_WINDING_EPSILON
			, ON_EPSILON*4
#endif
			))
		{
			break;
		}
	}
	bool intersect = w->m_NumPoints > 0;
	delete w;
	return intersect;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movslq %esi, %r12
leaq (%r12,%r12,4), %r15
shlq $0x2, %r15
addq 0x317e7(%rip), %r15     # 0x46fe8
movl $0x20, %edi
callq 0x42e0
movq %rax, %rbx
movss 0x2521e(%rip), %xmm0    # 0x3aa34
movq %rax, %rdi
movq %r15, %rsi
callq 0xc54a
cmpl $0x0, 0x8(%rbx)
je 0x15888
leaq (%r12,%r12,2), %rax
shlq $0x2, %rax
addq 0x31742(%rip), %rax     # 0x46f78
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x10(%rbx), %rsi
movss (%rsi,%rcx), %xmm0
addss (%rax), %xmm0
movss %xmm0, (%rsi,%rcx)
movq 0x10(%rbx), %rsi
movss 0x4(%rsi,%rcx), %xmm0
addss 0x4(%rax), %xmm0
movss %xmm0, 0x4(%rsi,%rcx)
movq 0x10(%rbx), %rsi
movss 0x8(%rsi,%rcx), %xmm0
addss 0x8(%rax), %xmm0
movss %xmm0, 0x8(%rsi,%rcx)
incq %rdx
movl 0x8(%rbx), %r15d
addq $0xc, %rcx
cmpq %r15, %rdx
jb 0x1583a
jmp 0x1588b
xorl %r15d, %r15d
cmpl $0x0, (%r14)
jle 0x158c7
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x8(%r14), %rsi
addq %r15, %rsi
movq %rbx, %rdi
xorl %edx, %edx
movss 0x2518d(%rip), %xmm0    # 0x3aa38
callq 0xcf28
testb %al, %al
je 0x158c3
incq %r12
movslq (%r14), %rax
addq $0x14, %r15
cmpq %rax, %r12
jl 0x15897
movl 0x8(%rbx), %r15d
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
testl %r15d, %r15d
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movl $0x20, %esi
movq %rbx, %rdi
callq 0x42f0
movq %r14, %rdi
callq 0x4580
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: AddFaceForVertexNormal_printerror(int, int, dface_t*)
void AddFaceForVertexNormal_printerror (const int edgeabs, const int edgeend, dface_t *const f)
{
	if (DEVELOPER_LEVEL_WARNING <= g_developer)
	{
		int i, e;
		Log ("AddFaceForVertexNormal - bad face:\n");
		Log (" edgeabs=%d edgeend=%d\n", edgeabs, edgeend);
		for (i = 0; i < f->numedges; i++)
		{
			e = g_dsurfedges[f->firstedge + i];
			edgeshare_t *es = &g_edgeshare[abs(e)];
			int v0 = g_dedges[abs(e)].v[0], v1 = g_dedges[abs(e)].v[1];
			Log (" e=%d v0=%d(%f,%f,%f) v1=%d(%f,%f,%f) share0=%d share1=%d\n", e,
				v0, g_dvertexes[v0].point[0], g_dvertexes[v0].point[1], g_dvertexes[v0].point[2],
				v1, g_dvertexes[v1].point[0], g_dvertexes[v1].point[1], g_dvertexes[v1].point[2],
				(es->faces[0]==NULL? -1: es->faces[0]-g_dfaces), (es->faces[1]==NULL? -1: es->faces[1]-g_dfaces));
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x20a88d7(%rip), %rax   # 0x20be440
cmpl $0x2, (%rax)
jl 0x15c98
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r14d
leaq 0x251e3(%rip), %rdi     # 0x3ad64
xorl %eax, %eax
callq 0x9c46
leaq 0x251f9(%rip), %rdi     # 0x3ad88
movl %r14d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x9c46
cmpw $0x0, 0x8(%rbx)
jle 0x15c98
xorl %r15d, %r15d
leaq 0x2135d60(%rip), %r13   # 0x214b910
leaq 0x1d1a849(%rip), %rbp   # 0x1d30400
leaq 0x101a842(%rip), %r12   # 0x1030400
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movslq 0x4(%rbx), %rax
addq %r15, %rax
leaq 0x1e3484a(%rip), %rcx   # 0x1e4a420
movl (%rcx,%rax,4), %esi
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
imulq $0xb0, %rax, %rcx
movq (%rcx,%r13), %rdx
movq $-0x1, %r9
movq $-0x1, %r8
testq %rdx, %rdx
je 0x15c10
subq 0x313e3(%rip), %rdx     # 0x46fe8
sarq $0x2, %rdx
imulq %r14, %rdx
movq %rdx, %r8
addq %r13, %rcx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x15c2e
subq 0x313c5(%rip), %rcx     # 0x46fe8
sarq $0x2, %rcx
imulq %r14, %rcx
movq %rcx, %r9
movzwl (%rbp,%rax,4), %edx
leaq (%rdx,%rdx,2), %rcx
xorps %xmm0, %xmm0
cvtss2sd (%r12,%rcx,4), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x4(%r12,%rcx,4), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x8(%r12,%rcx,4), %xmm2
movzwl 0x2(%rbp,%rax,4), %ecx
leaq (%rcx,%rcx,2), %rax
xorps %xmm3, %xmm3
cvtss2sd (%r12,%rax,4), %xmm3
xorps %xmm4, %xmm4
cvtss2sd 0x4(%r12,%rax,4), %xmm4
xorps %xmm5, %xmm5
cvtss2sd 0x8(%r12,%rax,4), %xmm5
leaq 0x2511f(%rip), %rdi     # 0x3ada0
movb $0x6, %al
callq 0x9c46
movswl 0x8(%rbx), %eax
incq %r15
cmpl %eax, %r15d
jl 0x15bc8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: DeleteDirectLights()
void            DeleteDirectLights()
{
    int             l;
    directlight_t*  dl;

#ifdef HLRAD_VIS_FIX
	for (l = 0; l < 1 + g_dmodels[0].visleafs; l++)
#else
    for (l = 0; l < g_numleafs; l++)
#endif
    {
        dl = directlights[l];
        while (dl)
        {
            directlights[l] = dl->next;
            free(dl);
            dl = directlights[l];
        }
    }

    // AJM: todo: strip light entities out at this point
	// vluzacn: hlvis and hlrad must not modify entity data, because the following procedures are supposed to produce the same bsp file:
	//  1> hlcsg -> hlbsp -> hlvis -> hlrad  (a normal compile)
	//  2) hlcsg -> hlbsp -> hlvis -> hlrad -> hlcsg -onlyents
	//  3) hlcsg -> hlbsp -> hlvis -> hlrad -> hlcsg -onlyents -> hlrad
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x2f011(%rip), %rbx     # 0x48470
movl 0x34(%rbx), %eax
testl %eax, %eax
js 0x194a0
xorl %r15d, %r15d
leaq 0x4f184b0(%rip), %r14   # 0x4f31920
movq (%r14,%r15,8), %rdi
testq %rdi, %rdi
je 0x19491
movq (%rdi), %rax
movq %rax, (%r14,%r15,8)
callq 0x4370
movq (%r14,%r15,8), %rdi
testq %rdi, %rdi
jne 0x19479
movl 0x34(%rbx), %eax
leaq 0x1(%r15), %rcx
movslq %eax, %rdx
cmpq %rdx, %r15
movq %rcx, %r15
jl 0x19470
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: MLH_AddFace(mdllight_t*, int)
int MLH_AddFace (mdllight_t *ml, int facenum)
{
	dface_t *f = &g_dfaces[facenum];
	int i, j;
	for (i = 0; i < ml->facecount; i++)
	{
		if (ml->face[i].num == facenum)
		{
			return -1;
		}
	}
	if (ml->facecount >= MLH_MAXFACECOUNT)
	{
		return -1;
	}
	i = ml->facecount;
	ml->facecount++;
	ml->face[i].num = facenum;
	ml->face[i].samplecount = 0;
	for (j = 0; j < ALLSTYLES; j++)
	{
		ml->face[i].style[j].exist = false;
	}
	for (j = 0; j < MAXLIGHTMAPS && f->styles[j] != 255; j++)
	{
		ml->face[i].style[f->styles[j]].exist = true;
		ml->face[i].style[f->styles[j]].seq = j;
	}
	return i;
}

// Assembly:
movslq 0xa518(%rdi), %rcx
testq %rcx, %rcx
jle 0x2030f
imulq $0xa50, %rcx, %rdx      # imm = 0xA50
xorl %r8d, %r8d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %esi, 0x18(%rdi,%r8)
je 0x2037f
addq $0xa50, %r8             # imm = 0xA50
cmpq %r8, %rdx
jne 0x202f3
cmpl $0xf, %ecx
jg 0x2037f
movslq %esi, %rdx
leal 0x1(%rcx), %eax
movl %eax, 0xa518(%rdi)
imulq $0xa50, %rcx, %rax      # imm = 0xA50
addq %rdi, %rax
addq $0x18, %rax
movl %edx, (%rax)
movl $0x0, 0xa48(%rax)
xorl %esi, %esi
movb $0x0, 0x4(%rax,%rsi,8)
incq %rsi
cmpq $0x40, %rsi
jne 0x20337
leaq (%rdx,%rdx,4), %rdx
leaq 0x1b900b0(%rip), %rsi   # 0x1bb0400
leaq (%rsi,%rdx,4), %rdx
addq $0xc, %rdx
xorl %esi, %esi
movzbl (%rdx,%rsi), %edi
cmpq $0xff, %rdi
je 0x2037d
movb $0x1, 0x4(%rax,%rdi,8)
movzbl (%rdx,%rsi), %edi
movl %esi, 0x8(%rax,%rdi,8)
incq %rsi
cmpq $0x4, %rsi
jne 0x2035a
movl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: MLH_AddSample(mdllight_t*, int, int, int, int, int, float const*)
void MLH_AddSample (mdllight_t *ml, int facenum, int w, int h, int s, int t, const vec3_t pos)
{
	dface_t *f = &g_dfaces[facenum];
	int i, j;
	int r = MLH_AddFace (ml, facenum);
	if (r == -1)
	{
		return;
	}
	int size = w * h;
	int num = s + w * t;
	for (i = 0; i < ml->face[r].samplecount; i++)
	{
		if (ml->face[r].sample[i].num == num)
		{
			return;
		}
	}
	if (ml->face[r].samplecount >= MLH_MAXSAMPLECOUNT)
	{
		return;
	}
	i = ml->face[r].samplecount;
	ml->face[r].samplecount++;
	ml->face[r].sample[i].num = num;
	VectorCopy (pos, ml->face[r].sample[i].pos);
	for (j = 0; j < ALLSTYLES; j++)
	{
		if (ml->face[r].style[j].exist)
		{
			ml->face[r].sample[i].style[j] = &g_dlightdata[f->lightofs + (num + size * ml->face[r].style[j].seq) * 3];
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movl %r8d, %r13d
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %r14
callq 0x202d8
cmpl $-0x1, %eax
je 0x20493
imull %r15d, %ebx
addl %r13d, %ebx
cltq
imulq $0xa50, %rax, %rax      # imm = 0xA50
leaq (%r14,%rax), %rcx
addq $0x18, %rcx
movslq 0xa48(%rcx), %rdx
testq %rdx, %rdx
jle 0x203f9
imulq $0x210, %rdx, %rsi      # imm = 0x210
xorl %edi, %edi
cmpl %ebx, 0x208(%rcx,%rdi)
je 0x20493
addq $0x210, %rdi            # imm = 0x210
cmpq %rdi, %rsi
jne 0x203d7
cmpl $0x3, %edx
jg 0x20493
movq 0x40(%rsp), %rsi
movslq %r12d, %rdi
imull %r15d, %ebp
leal 0x1(%rdx), %r8d
movl %r8d, 0xa48(%rcx)
imulq $0x210, %rdx, %rdx      # imm = 0x210
addq %rdx, %rcx
addq $0x208, %rcx            # imm = 0x208
movl %ebx, (%rcx)
movss (%rsi), %xmm0
movss %xmm0, 0x4(%rcx)
movss 0x4(%rsi), %xmm0
movss %xmm0, 0x8(%rcx)
movss 0x8(%rsi), %xmm0
movss %xmm0, 0xc(%rcx)
leaq (%rdi,%rdi,4), %rdx
leaq 0x1b8ffb5(%rip), %rsi   # 0x1bb0400
leaq (%rsi,%rdx,4), %rdx
addq $0x10, %rdx
addq %r14, %rax
addq $0x20, %rax
xorl %esi, %esi
leaq 0x830025(%rip), %rdi    # 0x850488
cmpb $0x1, -0x4(%rax,%rsi,8)
jne 0x2048a
movslq (%rdx), %r8
movl (%rax,%rsi,8), %r9d
imull %ebp, %r9d
addl %ebx, %r9d
movslq %r9d, %r9
leaq (%r9,%r9,2), %r9
addq %r8, %r9
addq (%rdi), %r9
movq %r9, 0x10(%rcx,%rsi,8)
incq %rsi
cmpq $0x40, %rsi
jne 0x20463
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: MLH_mdllightCreate(mdllight_t*)
void MLH_mdllightCreate (mdllight_t *ml)
{
	// code from Quake
	float p[3];
	float end[3];
	ml->facecount = 0;
	VectorCopy (ml->origin, ml->floor);
	VectorCopy (ml->origin, p);
	VectorCopy (ml->origin, end);
	end[2] -= 2048;
	MLH_GetSamples_r (ml, 0, p, end);
}

// Assembly:
subq $0x28, %rsp
movl $0x0, 0xa518(%rdi)
movsd (%rdi), %xmm0
movsd %xmm0, 0xc(%rdi)
movss 0x8(%rdi), %xmm1
movss %xmm1, 0x14(%rdi)
leaq 0x18(%rsp), %rdx
movsd %xmm0, (%rdx)
movss %xmm1, 0x8(%rdx)
leaq 0x8(%rsp), %rcx
movsd %xmm0, (%rcx)
addss 0x1a242(%rip), %xmm1    # 0x3aa88
movss %xmm1, 0x8(%rcx)
xorl %esi, %esi
callq 0x20515
addq $0x28, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: MdlLightHack()
void MdlLightHack ()
{
	int ient;
	entity_t *ent1, *ent2;
	vec3_t origin1, origin2;
	const char *target;
#ifndef HLRAD_MDL_LIGHT_HACK_NEW
    double start, end;
#endif
	int used = 0, countent = 0, countsample = 0, r;
#ifndef HLRAD_MDL_LIGHT_HACK_NEW
    start = I_FloatTime();
#endif
	for (ient = 0; ient < g_numentities; ++ient)
	{
		ent1 = &g_entities[ient];
		target = ValueForKey (ent1, "zhlt_copylight");
		if (!strcmp (target, ""))
			continue;
		used = 1;
		ent2 = FindTargetEntity (target);
		if (ent2 == NULL)
		{
			Warning ("target entity '%s' not found", target);
			continue;
		}
		GetVectorForKey (ent1, "origin", origin1);
		GetVectorForKey (ent2, "origin", origin2);
		r = MLH_CopyLight (origin2, origin1);
		if (r < 0)
			Warning ("can not copy light from (%f,%f,%f)", origin2[0], origin2[1], origin2[2]);
		else
		{
			countent += 1;
			countsample += r;
		}
	}
#ifndef HLRAD_MDL_LIGHT_HACK_NEW
    end = I_FloatTime();
#endif
	if (used)
#ifdef HLRAD_MDL_LIGHT_HACK_NEW
		Log ("Adjust mdl light: modified %d samples for %d entities\n", countsample, countent);
#else
		Log("Mdl Light Hack: %d entities %d samples (%.2f seconds)\n", countent, countsample, end - start);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x201d99d(%rip), %rax   # 0x203e424
cmpl $0x0, (%rax)
jle 0x20b8b
leaq 0x201d999(%rip), %rbx   # 0x203e430
xorl %r15d, %r15d
movl $0x0, 0xc(%rsp)
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %rbx, %rdi
leaq 0x1a841(%rip), %rsi     # 0x3b2f2
callq 0x752d
cmpb $0x0, (%rax)
je 0x20b58
movq %rax, %r12
movq %rax, %rdi
callq 0x7ff7
testq %rax, %rax
je 0x20b16
movq %rax, %r13
movq %rbx, %rdi
leaq 0x1dad1(%rip), %r12     # 0x3e5ad
movq %r12, %rsi
leaq 0x1c(%rsp), %r14
movq %r14, %rdx
callq 0x8084
movq %r13, %rdi
movq %r12, %rsi
leaq 0x10(%rsp), %r12
movq %r12, %rdx
callq 0x8084
movq %r12, %rdi
movq %r14, %rsi
callq 0x20857
testl %eax, %eax
js 0x20b29
incl %ebp
addl %eax, 0xc(%rsp)
jmp 0x20b52
leaq 0x1a7e4(%rip), %rdi     # 0x3b301
movq %r12, %rsi
xorl %eax, %eax
callq 0xa2a6
jmp 0x20b52
xorps %xmm0, %xmm0
cvtss2sd 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x14(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x18(%rsp), %xmm2
leaq 0x1a7d3(%rip), %rdi     # 0x3b31e
movb $0x3, %al
callq 0xa2a6
movl $0x1, %r13d
incq %r15
leaq 0x201d8c2(%rip), %rax   # 0x203e424
movslq (%rax), %rax
addq $0x20, %rbx
cmpq %rax, %r15
jl 0x20aa7
testl %r13d, %r13d
je 0x20b8b
leaq 0x1a7c3(%rip), %rdi     # 0x3b341
movl 0xc(%rsp), %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x9c46
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: CreateFacelightDependencyList()
void CreateFacelightDependencyList ()
{
	int facenum;
	dface_t *f;
	facelight_t *fl;
	int i;
	int k;
	int surface;
	facelightlist_t *item;

	for (i = 0; i < MAX_MAP_FACES; i++)
	{
		g_dependentfacelights[i] = NULL;
	}

	// for each face
	for (facenum = 0; facenum < g_numfaces; facenum++)
	{
		f = &g_dfaces[facenum];
		fl = &facelight[facenum];
		if (g_texinfo[f->texinfo].flags & TEX_SPECIAL)
		{
			continue;
		}

		for (k = 0; k < MAXLIGHTMAPS && f->styles[k] != 255; k++)
		{
			for (i = 0; i < fl->numsamples; i++)
			{
				surface = fl->samples[k][i].surface; // that surface contains at least one sample from this face
				if (0 <= surface && surface < g_numfaces)
				{
					// insert this face into the dependency list of that surface
					for (item = g_dependentfacelights[surface]; item != NULL; item = item->next)
					{
						if (item->facenum == facenum)
							break;
					}
					if (item)
					{
						continue;
					}

					item = (facelightlist_t *)malloc (sizeof (facelightlist_t));
					hlassume (item != NULL, assume_NoMemory);
					item->facenum = facenum;
					item->next = g_dependentfacelights[surface];
					g_dependentfacelights[surface] = item;
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x51d0de4(%rip), %rbx   # 0x51f1990
movl $0x7fff8, %edx          # imm = 0x7FFF8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4190
leaq 0x1b8f832(%rip), %rax   # 0x1bb03f4
movl (%rax), %eax
testl %eax, %eax
jle 0x20cd6
movq %rbx, %rdi
xorl %r12d, %r12d
leaq 0x1b8f827(%rip), %rsi   # 0x1bb0400
leaq (%r12,%r12,4), %rcx
movswq 0xa(%rsi,%rcx,4), %rdx
leaq (%rdx,%rdx,4), %rdx
leaq 0x118f802(%rip), %r8    # 0x11b03f0
testb $0x1, 0x24(%r8,%rdx,8)
jne 0x20cc0
leaq (%rsi,%rcx,4), %rdx
movq %rdx, (%rsp)
leaq 0x4f50da7(%rip), %rdx   # 0x4f719b0
leaq (%rdx,%rcx,8), %rbp
xorl %r13d, %r13d
movq (%rsp), %rcx
cmpb $-0x1, 0xc(%rcx,%r13)
je 0x20cc0
movl (%rbp), %ecx
testl %ecx, %ecx
jle 0x20cb3
xorl %r15d, %r15d
movq 0x8(%rbp,%r13,8), %rdx
leaq (%r15,%r15,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %r15, %rsi
movslq 0x18(%rdx,%rsi), %rbx
testq %rbx, %rbx
js 0x20ca4
cmpl %eax, %ebx
jge 0x20ca4
movq (%rdi,%rbx,8), %rdx
testq %rdx, %rdx
je 0x20c62
movl (%rdx), %esi
cmpq %rsi, %r12
je 0x20ca4
movq 0x8(%rdx), %rdx
jmp 0x20c50
movl $0x10, %edi
callq 0x4400
movq %rax, %r14
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa6ed
leaq 0x51d0d07(%rip), %rdi   # 0x51f1990
movl %r12d, (%r14)
movq (%rdi,%rbx,8), %rax
movq %rax, 0x8(%r14)
movq %r14, (%rdi,%rbx,8)
leaq 0x1b8f755(%rip), %rax   # 0x1bb03f4
movl (%rax), %eax
movl (%rbp), %ecx
incq %r15
movslq %ecx, %rdx
cmpq %rdx, %r15
jl 0x20c2e
incq %r13
cmpq $0x4, %r13
jne 0x20c10
incq %r12
movslq %eax, %rcx
cmpq %rcx, %r12
leaq 0x1b8f730(%rip), %rsi   # 0x1bb0400
jl 0x20bd9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: FreeFacelightDependencyList()
void FreeFacelightDependencyList ()
{
	int i;
	facelightlist_t *item;

	for (i = 0; i < MAX_MAP_FACES; i++)
	{
		while (g_dependentfacelights[i])
		{
			item = g_dependentfacelights[i];
			g_dependentfacelights[i] = item->next;
			free (item);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
xorl %ebx, %ebx
leaq 0x51d0c9d(%rip), %r14   # 0x51f1990
movq (%r14,%rbx,8), %rdi
testq %rdi, %rdi
je 0x20d11
movq 0x8(%rdi), %r15
movq %r15, (%r14,%rbx,8)
callq 0x4370
movq %r15, %rdi
testq %r15, %r15
jne 0x20cfc
incq %rbx
cmpq $0xffff, %rbx           # imm = 0xFFFF
jne 0x20cf3
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/lightmap.cpp
// Function: ScaleDirectLights()
void ScaleDirectLights ()
{
	int facenum;
	dface_t *f;
	facelight_t *fl;
	int i;
	int k;
	sample_t *samp;

	for (facenum = 0; facenum < g_numfaces; facenum++)
	{
		f = &g_dfaces[facenum];

		if (g_texinfo[f->texinfo].flags & TEX_SPECIAL)
		{
			continue;
		}

		fl = &facelight[facenum];

		for (k = 0; k < MAXLIGHTMAPS && f->styles[k] != 255; k++)
		{
			for (i = 0; i < fl->numsamples; i++)
			{
				samp = &fl->samples[k][i];
				VectorScale (samp->light, g_direct_scale, samp->light);
	#ifdef ZHLT_XASH
				VectorScale (samp->light_direction, g_direct_scale, samp->light_direction);
	#endif
			}
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x1b8f6c5(%rip), %rax   # 0x1bb03f4
movl (%rax), %r9d
testl %r9d, %r9d
jle 0x20dfa
xorl %ecx, %ecx
leaq 0x1b8f6bc(%rip), %rdx   # 0x1bb0400
leaq 0x118f6a5(%rip), %rsi   # 0x11b03f0
leaq 0x4f50c5e(%rip), %rdi   # 0x4f719b0
leaq 0x27667(%rip), %r8      # 0x483c0
leaq (%rcx,%rcx,4), %r10
movswq 0xa(%rdx,%r10,4), %r11
leaq (%r11,%r11,4), %r11
testb $0x1, 0x24(%rsi,%r11,8)
jne 0x20deb
leaq (%rdx,%r10,4), %r9
leaq (%rdi,%r10,8), %r10
xorl %r11d, %r11d
cmpb $-0x1, 0xc(%r9,%r11)
je 0x20de8
movslq (%r10), %r15
testq %r15, %r15
jle 0x20ddf
movq 0x8(%r10,%r11,8), %rbx
leaq (%r15,%r15,8), %r14
leaq (%r14,%r14,2), %r14
addq %r15, %r14
xorl %r15d, %r15d
movss 0xc(%rbx,%r15), %xmm0
mulss (%r8), %xmm0
movss 0x10(%rbx,%r15), %xmm1
movss %xmm0, 0xc(%rbx,%r15)
mulss (%r8), %xmm1
movss %xmm1, 0x10(%rbx,%r15)
movss 0x14(%rbx,%r15), %xmm0
mulss (%r8), %xmm0
movss %xmm0, 0x14(%rbx,%r15)
addq $0x1c, %r15
cmpq %r15, %r14
jne 0x20d9d
incq %r11
cmpq $0x4, %r11
jne 0x20d7a
movl (%rax), %r9d
incq %rcx
movslq %r9d, %r10
cmpq %r10, %rcx
jl 0x20d59
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/loadtextures.cpp
// Function: AddWadFolder(char const*)
void AddWadFolder (const char *path)
{
	waddir_t *waddir;
	waddir = (waddir_t *)malloc (sizeof (waddir_t));
	hlassume (waddir != NULL, assume_NoMemory);
	{
		waddir_t **pos;
		for (pos = &g_waddirs; *pos; pos = &(*pos)->next)
			;
		waddir->next = *pos;
		*pos = waddir;
	}
	safe_snprintf (waddir->path, _MAX_PATH, "%s", path);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1008, %edi           # imm = 0x1008
callq 0x4400
movq %rax, %r14
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa6ed
leaq 0x525018a(%rip), %rcx   # 0x52719b0
movq %rcx, %rax
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0x21826
movq $0x0, (%r14)
movq %r14, (%rax)
addq $0x8, %r14
leaq 0x19df3(%rip), %rdx     # 0x3b639
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8817