LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/BoundingBox.cpp
// Function: RayTracer::BoundingBox::merge(RayTracer::BoundingBox const&)
void BoundingBox::merge(const BoundingBox& other) {
    // For each of the three dimensions, find the smallest and put that in
    //   this->p1. The larger is put in this->p2.
    for (int i = 0; i < 3; i++) {
        double a1 = this->p1.get(i);
        double a2 = this->p2.get(i);
        double b1 = other.p1.get(i);
        double b2 = other.p2.get(i);

        // Order the A-box values
        double min = a1;
        double max = a2;
        if (min > max) {
            min = max;
            max = a1;
        }

        // Add the B-box values
        if (b1 < min) {
            min = b1;
        } else if (b1 > max) {
            max = b1;
        }
        if (b2 < min) {
            min = b2;
        } else if (b2 > max) {
            max = b2;
        }

        // Set the values and return
        this->p1[i] = min;
        this->p2[i] = max;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %r15
leaq 0x20(%rsi), %r12
xorl %ebp, %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x72ce8
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movl %ebp, %esi
callq 0x72ce8
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x72ce8
movsd %xmm0, 0x18(%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0x72ce8
movsd 0x8(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movsd 0x10(%rsp), %xmm4
movapd %xmm4, %xmm1
minsd %xmm3, %xmm1
maxsd %xmm4, %xmm3
ucomisd %xmm2, %xmm1
jbe 0x812f4
movapd %xmm2, %xmm1
jmp 0x812fa
ucomisd %xmm3, %xmm2
ja 0x812fe
movapd %xmm3, %xmm2
ucomisd %xmm0, %xmm1
jbe 0x8130c
movsd %xmm0, 0x10(%rsp)
jmp 0x81320
ucomisd %xmm2, %xmm0
movsd %xmm1, 0x10(%rsp)
jbe 0x81320
movsd %xmm0, 0x8(%rsp)
jmp 0x81326
movsd %xmm2, 0x8(%rsp)
movq %r14, %rdi
movl %ebp, %esi
callq 0x72b98
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movq %r15, %rdi
movl %ebp, %esi
callq 0x72b98
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
incl %ebp
cmpl $0x3, %ebp
jne 0x81290
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/BoundingBox.cpp
// Function: RayTracer::BoundingBox::size() const
double BoundingBox::size() const {
    double dx = fabsf64(this->p1.x - this->p2.x);
    double dy = fabsf64(this->p1.y - this->p2.y);
    double dz = fabsf64(this->p1.z - this->p2.z);
    return dx * dy * dz;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movsd 0x8(%rdi), %xmm0
subsd 0x28(%rdi), %xmm0
callq 0x3a7c0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rbx), %xmm0
subsd 0x30(%rbx), %xmm0
callq 0x3a7c0
movsd %xmm0, (%rsp)
movsd 0x18(%rbx), %xmm0
subsd 0x38(%rbx), %xmm0
callq 0x3a7c0
movsd (%rsp), %xmm1
mulsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: print_vec(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<RayTracer::RenderObject*, std::allocator<RayTracer::RenderObject*>> const&)
void print_vec(string name, const vector<RenderObject*>& vec) {
    cout << name << " {";
    for (size_t i = 0; i < vec.size(); i++) {
        if (i > 0) { cout << ", "; }
        cout << vec.at(i);
    }
    cout << "}" << endl;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
movq 0x23bb2(%rip), %rbx     # 0xa4f88
movq %rbx, %rdi
callq 0x3a4f0
leaq 0xa6f9(%rip), %rsi      # 0x8bade
movl $0x2, %edx
movq %rax, %rdi
callq 0x3a4f0
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x81453
xorl %r15d, %r15d
movq 0x23b83(%rip), %r12     # 0xa4f88
leaq 0x7e94(%rip), %r13      # 0x892a0
testq %r15, %r15
je 0x81421
movl $0x2, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x3a4f0
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r15, %rdx
jbe 0x81497
movq (%rax,%r15,8), %rsi
movq %r12, %rdi
callq 0x3a360
incq %r15
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x3, %rax
cmpq %rax, %r15
jb 0x8140c
leaq 0xa687(%rip), %rsi      # 0x8bae1
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3a4f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3a430
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3a050
movq %rax, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3a300
leaq 0x9faf(%rip), %rdi      # 0x8b44d
movq %r15, %rsi
xorl %eax, %eax
callq 0x3a660
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTreeBranch::hit(RayTracer::Ray const&, double, double, RayTracer::HitRecord&) const
bool ObjectTreeBranch::hit(const Ray& ray, double t_min, double t_max, HitRecord& record) const {
    HitRecord record_r;
    bool hit_left = this->left->quick_hit(ray, t_min, t_max) && this->left->hit(ray, t_min, t_max, record);
    bool hit_right = this->right->quick_hit(ray, t_min, t_max) && this->right->hit(ray, t_min, t_max, record_r);
    // Note the record if it was a hit
    if (hit_left && hit_right) {
        // Set record to the smallest one
        if (record_r.t < record.t) {
            record = record_r;
        }
    } else if (hit_right) {
        // Don't forget to update record
        record = record_r;
    }
    
    // Return if we actually hit
    return hit_left || hit_right;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, (%rsp)
movq %rsi, %r12
movq %rdi, %r13
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x729d4
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x729d4
movq 0x50(%r13), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq *0x10(%rax)
testb %al, %al
je 0x82197
movq 0x50(%r13), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movq %rbx, %rdx
callq *0x18(%rax)
movl %eax, %ebp
jmp 0x82199
xorl %ebp, %ebp
movq 0x58(%r13), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq *0x10(%rax)
testb %al, %al
je 0x821d7
movq 0x58(%r13), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rdx
movq %r12, %rsi
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq *0x18(%rax)
movl %eax, %r12d
jmp 0x821da
xorl %r12d, %r12d
movl %ebp, %eax
andb %r12b, %al
cmpb $0x1, %al
jne 0x821f1
movsd (%rbx), %xmm0
ucomisd 0x10(%rsp), %xmm0
ja 0x821f6
jmp 0x8222a
testb %r12b, %r12b
je 0x8222a
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rbx)
movups 0x10(%rsp), %xmm0
movups %xmm0, (%rbx)
leaq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0x72a08
leaq 0x38(%rbx), %rdi
movq %r14, %rsi
callq 0x72a08
movupd 0x68(%rsp), %xmm0
movupd %xmm0, 0x58(%rbx)
orb %r12b, %bpl
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTreeBranch::operator=(RayTracer::ObjectTreeBranch)
ObjectTreeBranch& ObjectTreeBranch::operator=(ObjectTreeBranch other) {
    // Copy the stuff by swapping
    if (this != &other) {
        // Copy by swapping
        swap(*this, other);
    }
    return *this;
}

// Assembly:
movq %rdi, %rax
cmpq %rsi, %rdi
je 0x82266
movq 0x50(%rax), %rcx
movq 0x50(%rsi), %rdx
movq %rdx, 0x50(%rax)
movq %rcx, 0x50(%rsi)
movq 0x58(%rax), %rcx
movq 0x58(%rsi), %rdx
movq %rdx, 0x58(%rax)
movq %rcx, 0x58(%rsi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTreeLeaf::operator=(RayTracer::ObjectTreeLeaf)
ObjectTreeLeaf& ObjectTreeLeaf::operator=(ObjectTreeLeaf other) {
    // Copy the stuff by swapping
    if (this != &other) {
        // Copy by swapping
        swap(*this, other);
    }
    return *this;
}

// Assembly:
movq %rdi, %rax
cmpq %rsi, %rdi
je 0x824a2
movq 0x50(%rax), %rcx
movq 0x50(%rsi), %rdx
movq %rdx, 0x50(%rax)
movq %rcx, 0x50(%rsi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTreeLeaf::operator=(RayTracer::ObjectTreeLeaf&&)
ObjectTreeLeaf& ObjectTreeLeaf::operator=(ObjectTreeLeaf&& other) {
    // Copy the stuff directly
    if (this != &other) {
        this->obj = other.obj;
        other.obj = nullptr;
    }
    return *this;
}

// Assembly:
movq %rdi, %rax
cmpq %rsi, %rdi
je 0x824cc
movq 0x50(%rsi), %rcx
movq %rcx, 0x50(%rax)
movq $0x0, 0x50(%rsi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTree::~ObjectTree()
ObjectTree::~ObjectTree() {
    if (this->root != nullptr) { delete this->root; }

    // ALso delete all objects
    for (size_t i = 0; i < this->objects.size(); i++) {
        delete this->objects.at(i);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x825be
movq (%rdi), %rax
callq *0x8(%rax)
movq (%rbx), %rdi
cmpq %rdi, 0x8(%rbx)
je 0x825ef
xorl %r14d, %r14d
movq (%rdi,%r14,8), %rdi
testq %rdi, %rdi
je 0x825d9
movq (%rdi), %rax
callq *0x10(%rax)
incq %r14
movq (%rbx), %rdi
movq 0x8(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
cmpq %rax, %r14
jb 0x825ca
testq %rdi, %rdi
je 0x82607
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3a470
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTree::add(RayTracer::RenderObject*)
bool ObjectTree::add(RenderObject* obj) {
    // Crash if the object has no hitbox
    if (!obj->has_hitbox) {
        return false;
    }

    this->objects.push_back(obj);   

    // Be sure to mark the tree as non-optimised anymore
    this->is_optimised = false;

    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movb 0x78(%rsi), %bl
cmpb $0x1, %bl
jne 0x8264a
movq %rdi, %r14
movq 0x8(%rdi), %rax
cmpq 0x10(%rdi), %rax
je 0x82637
movq %rsi, (%rax)
addq $0x8, 0x8(%r14)
jmp 0x82645
movq %rsp, %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x831f4
movb $0x0, 0x20(%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTree::remove(RayTracer::RenderObject*)
bool ObjectTree::remove(RenderObject* obj) {
    // Check if a node with this pointer is present
    for (size_t i = 0; i < this->objects.size(); i++) {
        if (this->objects.at(i) == obj) {
            // Remove it and then quit
            this->objects.erase(this->objects.begin() + i);

            this->is_optimised = false;
            
            return true;
        }
    }
    return false;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
movq %rdx, %rcx
subq %rax, %rcx
setne %bpl
je 0x826d2
movq %rdi, %rbx
sarq $0x3, %rcx
cmpq $0x1, %rcx
movq %rcx, %r8
adcq $0x0, %r8
cmpq %rsi, (%rax)
je 0x826a5
movl $0x1, %r9d
cmpq %r9, %r8
je 0x826cb
leaq 0x1(%r9), %rdi
cmpq %rsi, (%rax,%r9,8)
movq %rdi, %r9
jne 0x82687
decq %rdi
cmpq %rcx, %rdi
setb %bpl
jmp 0x826a7
xorl %edi, %edi
leaq (%rax,%rdi,8), %rsi
addq $0x8, %rsi
cmpq %rdx, %rsi
je 0x826c0
leaq (%rax,%rdi,8), %rdi
subq %rsi, %rdx
callq 0x3a700
addq $-0x8, 0x8(%rbx)
movb $0x0, 0x20(%rbx)
jmp 0x826d2
cmpq %rcx, %r9
setb %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTree::optimize()
void ObjectTree::optimize() {
    this->is_optimised = true;

    // Start by removing any existing trees
    if (this->root != nullptr) {
        delete this->root;
    }
    
    // Make sure there are things to optimize
    if (this->size() == 0) { return; }

    // Create the root node
    if (this->size() == 1) {
        // If there is only one element, make a leaf
        this->root = (ObjectTreeNode*) new ObjectTreeLeaf(this->objects.at(0));
    } else {
        // Else, make a branch which splits itself
        this->root = (ObjectTreeNode*) new ObjectTreeBranch(this->objects);
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movb $0x1, 0x20(%rdi)
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x826f9
movq (%rdi), %rax
callq *0x8(%rax)
movq (%rbx), %r14
movq 0x8(%rbx), %rax
subq %r14, %rax
sarq $0x3, %rax
je 0x827e3
cmpq $0x1, %rax
jne 0x827a1
movl $0x58, %edi
callq 0x3a460
movq (%r14), %rcx
movups 0x40(%rcx), %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0x50(%rcx), %rdx
movq %rdx, 0x50(%rsp)
movups 0x60(%rcx), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x70(%rcx), %rdx
movq %rdx, 0x30(%rsp)
leaq 0x22599(%rip), %rdx     # 0xa4ce8
movq %rdx, (%rax)
movb $0x1, 0x8(%rax)
leaq 0x21923(%rip), %rdx     # 0xa4080
addq $0x10, %rdx
movq %rdx, 0x10(%rax)
movaps 0x40(%rsp), %xmm0
movups %xmm0, 0x18(%rax)
movq 0x50(%rsp), %rsi
movq %rsi, 0x28(%rax)
movq %rdx, 0x30(%rax)
movaps 0x20(%rsp), %xmm0
movups %xmm0, 0x38(%rax)
movq 0x30(%rsp), %rdx
movq %rdx, 0x48(%rax)
leaq 0x224dc(%rip), %rdx     # 0xa4c70
movq %rdx, (%rax)
movq %rcx, 0x50(%rax)
movq %rax, 0x18(%rbx)
jmp 0x827e3
movl $0x60, %edi
callq 0x3a460
movq %rax, %r14
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x787dc
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x81c34
movq %r14, 0x18(%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x827e3
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x3a470
addq $0x58, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x8280a
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x3a470
jmp 0x8280a
movq %rax, %rbx
movl $0x60, %esi
movq %r14, %rdi
callq 0x3a470
movq %rbx, %rdi
callq 0x3a780
nop
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTree::hit(RayTracer::Ray const&, double, double, RayTracer::HitRecord&) const
bool ObjectTree::hit(const Ray& ray, double t_min, double t_max, HitRecord& record) const {
    // Do different things depending if we're optimised or not
    if (this->is_optimised) {
        // Quit if there is nothing
        if (this->root == nullptr) { return false; }

        // Simply use the tree structure
        return this->root->quick_hit(ray, t_min, t_max) && this->root->hit(ray, t_min, t_max, record);
    }

    cerr << "WARNING: ObjectTree @ " << this << " is not optimised." << endl;

    // Otherwise, do it loop-wise
    double t_best = t_max;
    bool hit = false;
    for (size_t i = 0; i < this->objects.size(); i++) {
        // Fetch the correct item from the list
        RenderObject* obj = this->objects.at(i);
        if (obj->quick_hit(ray, t_min, t_best) && obj->hit(ray, t_min, t_best, record)) {
            t_best = record.t;
            hit = true;
        }
    }

    // Return if we hit or not
    return hit;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpb $0x1, 0x20(%rdi)
jne 0x828a0
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x82999
movq (%rdi), %rax
movq %r14, %rsi
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
callq *0x10(%rax)
testb %al, %al
je 0x82999
movq 0x18(%r15), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
movq %r14, %rsi
movsd 0x10(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movsd %xmm0, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movq 0x2272d(%rip), %r12     # 0xa4fe0
leaq 0x9234(%rip), %rsi      # 0x8baee
movl $0x16, %edx
movq %r12, %rdi
callq 0x3a4f0
movq %r12, %rdi
movq %r15, %rsi
callq 0x3a360
movq %rax, %r12
leaq 0x9229(%rip), %rsi      # 0x8bb05
movl $0x12, %edx
movq %rax, %rdi
callq 0x3a4f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3a430
movsbl %al, %esi
movq %r12, %rdi
callq 0x3a050
movq %rax, %rdi
callq 0x3a300
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
je 0x82999
xorl %ebp, %ebp
xorl %r12d, %r12d
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
movq (%rax,%rbp,8), %r13
movq (%r13), %rax
movq %r13, %rdi
movq %r14, %rsi
movsd %xmm1, 0x8(%rsp)
callq *0x20(%rax)
testb %al, %al
je 0x82975
movq (%r13), %rax
movq %r13, %rdi
movq %r14, %rsi
movsd 0x10(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movq %rbx, %rdx
callq *0x30(%rax)
testb %al, %al
movsd 0x8(%rsp), %xmm1
je 0x8297b
movsd (%rbx), %xmm1
movb $0x1, %r12b
jmp 0x8297b
movsd 0x8(%rsp), %xmm1
incq %rbp
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbp
movsd 0x10(%rsp), %xmm0
jb 0x8292b
jmp 0x8299c
xorl %r12d, %r12d
andb $0x1, %r12b
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTree::operator=(RayTracer::ObjectTree)
ObjectTree& ObjectTree::operator=(ObjectTree other) {
    if (this != &other) {
        // Copy by swapping
        swap(*this, other);
    }
    return *this;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x829c3
movq %rbx, %rdi
callq 0x829c8
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/Lut99[P]RayTracer/src/lib/ObjectTree.cpp
// Function: RayTracer::ObjectTree::operator=(RayTracer::ObjectTree&&)
ObjectTree& ObjectTree::operator=(ObjectTree&& other) {
    if (this != &other) {
        // Copy by swapping
        swap(*this, other);
    }
    return *this;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x82a23
movq %rbx, %rdi
callq 0x829c8
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: choose_window(_XDisplay*)
Window choose_window(Display * display){
    Window root = RootWindow(display, DefaultScreen(display));
    Window root_out;
    int root_x, root_y;
    int win_x, win_y;
    unsigned int mask;
    Window child = 0;
    Cursor cursor;

    cursor = XCreateFontCursor(display, XC_crosshair);

    XGrabPointer(display, root, False, ButtonPressMask | ButtonReleaseMask, GrabModeSync, GrabModeAsync, root, cursor, CurrentTime);

    // std::cout << "Grabbing window" << std::endl;
    while (1){
        XAllowEvents(display, SyncPointer, CurrentTime);
        XEvent event;
        XWindowEvent(display, root, ButtonPressMask | ButtonReleaseMask, &event);
        if (event.type == ButtonPress){
            child = event.xbutton.subwindow;
            break;
        }
    }

    // XQueryPointer(display, root, &root_out, &child, &root_x, &root_y, &win_x, &win_y, &mask);
    // std::cout << "Grabbed window " << child << std::endl;
    XUngrabPointer(display, CurrentTime);
    std::cout << "Grabbed window " << child << std::endl;
    if (child == root){
        return 0;
    }

    return child;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rdi, %r15
movq 0xe8(%rdi), %rax
movslq 0xe0(%rdi), %rcx
shlq $0x7, %rcx
movq 0x10(%rax,%rcx), %rbx
movl $0x22, %esi
callq 0x3190
subq $0x8, %rsp
xorl %r14d, %r14d
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0xc, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
pushq $0x0
pushq %rax
pushq %rbx
callq 0x3110
addq $0x20, %rsp
leaq -0xe0(%rbp), %r12
movq %r15, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x3150
movl $0xc, %edx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rcx
callq 0x3080
cmpl $0x4, -0xe0(%rbp)
jne 0x37b5
movq -0xb0(%rbp), %r14
jne 0x3783
xorl %r12d, %r12d
movq %r15, %rdi
xorl %esi, %esi
callq 0x3290
movq 0x4805(%rip), %r15      # 0x7fd0
leaq 0x28c6(%rip), %rsi      # 0x6098
movl $0xf, %edx
movq %r15, %rdi
callq 0x3350
movq %r15, %rdi
movq %r14, %rsi
callq 0x31c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32c0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
cmpq %rbx, %r14
cmoveq %r12, %r14
movq %r14, %rax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: find_xborder_window(_XDisplay*)
Window find_xborder_window(Display * display){
    Window chosen = choose_window(display);
    if (chosen == 0){
        std::cout << "Error: Window could not be selected, or root window chosen" << std::endl;
        return 0;
    }
    Atom xborder = XInternAtom(display, "xborder", false);
    Window xborder_window = find_window_by_atom(display, chosen, xborder);
    if (xborder_window == 0){
        std::cout << "Error: Selected window is not an xborder: " << chosen << std::endl;
        return 0;
    }
    return xborder_window;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x371c
testq %rax, %rax
je 0x3865
movq %rax, %r14
leaq 0x2aa6(%rip), %rsi      # 0x62f2
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3200
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x38ae
movq 0x4764(%rip), %rbx      # 0x7fd0
leaq 0x2835(%rip), %rsi      # 0x60a8
movl $0x3a, %edx
movq %rbx, %rdi
callq 0x3350
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: find_window_by_atom(_XDisplay*, unsigned long, unsigned long)
static Window find_window_by_atom(Display *dpy, Window win, Atom atom){
    Atom type = None;
    int format;
    unsigned long nitems, after;
    unsigned char *data = NULL;
    Window inf;

    // std::cout << "Find window with atom " << XGetAtomName(dpy, atom) << std::endl;
    XGetWindowProperty(dpy, win, atom, 0, 0, False, AnyPropertyType,
            &type, &format, &nitems, &after, &data);
    if (data)
        XFree(data);
    if (type)
        return win;
    inf = TryChildren(dpy, win, atom);
    if (!inf)
        inf = win;
    return inf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
xorl %eax, %eax
leaq -0x30(%rbp), %r10
movq %rax, (%r10)
leaq -0x40(%rbp), %r12
movq %rax, (%r12)
leaq -0x48(%rbp), %r11
leaq -0x50(%rbp), %r13
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r12
pushq %r11
pushq %r13
leaq -0x34(%rbp), %r11
pushq %r11
pushq %r10
pushq %rax
callq 0x30c0
addq $0x30, %rsp
movq (%r12), %rdi
testq %rdi, %rdi
je 0x390f
callq 0x33a0
cmpq $0x0, -0x30(%rbp)
jne 0x392b
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x50ab
testq %rax, %rax
cmovneq %rax, %rbx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: find_terminal(_XDisplay*)
Window find_terminal(Display * display){
    Window child = choose_window(display);
    if (child == 0){
        return 0;
    }
    return _XmuClientWindow(display, child);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
callq 0x371c
testq %rax, %rax
je 0x397f
movq %rax, %rbx
leaq 0x2847(%rip), %rsi      # 0x61a2
movq %r14, %rdi
movl $0x1, %edx
callq 0x3200
testq %rax, %rax
je 0x3981
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x38ae
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: get_window_dimensions(_XDisplay*, unsigned long, int*, int*)
void get_window_dimensions(Display * display, Window window, int * width, int * height){
    XWindowAttributes attributes;
    XGetWindowAttributes(display, window, &attributes);
    *width = attributes.width;
    *height = attributes.height;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rcx, %rbx
movq %rdx, %r14
leaq -0xa0(%rbp), %r15
movq %r15, %rdx
callq 0x3560
movl 0x8(%r15), %eax
movl %eax, (%r14)
movl 0xc(%r15), %eax
movl %eax, (%rbx)
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: create_color(_XDisplay*, int, int, int)
XColor create_color(Display * display, int red, int green, int blue){
    XColor color;
    color.red = red;
    color.green = green;
    color.blue = blue;
    int screen = DefaultScreen(display);
    Colormap screen_colormap = DefaultColormap(display, screen);
    XAllocColor(display, screen_colormap, &color);
    return color;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq -0x18(%rbp), %rbx
movw %si, 0x8(%rbx)
movw %dx, 0xa(%rbx)
movw %cx, 0xc(%rbx)
movslq 0xe0(%rdi), %rax
movq 0xe8(%rdi), %rcx
shlq $0x7, %rax
movq 0x50(%rcx,%rax), %rsi
movq %rbx, %rdx
callq 0x3230
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: hsv2rgb(hsv)
rgb hsv2rgb(hsv HSV){
    rgb RGB;
    double H = HSV.h, S = HSV.s, V = HSV.v,
           P, Q, T,
           fract;

    (H == 360.)?(H = 0.):(H /= 60.);
    fract = H - floor(H);

    P = V*(1. - S);
    Q = V*(1. - S*fract);
    T = V*(1. - S*(1. - fract));

    if      (0. <= H && H < 1.)
        RGB = (rgb){.r = V, .g = T, .b = P};
    else if (1. <= H && H < 2.)
        RGB = (rgb){.r = Q, .g = V, .b = P};
    else if (2. <= H && H < 3.)
        RGB = (rgb){.r = P, .g = V, .b = T};
    else if (3. <= H && H < 4.)
        RGB = (rgb){.r = P, .g = Q, .b = V};
    else if (4. <= H && H < 5.)
        RGB = (rgb){.r = T, .g = P, .b = V};
    else if (5. <= H && H < 6.)
        RGB = (rgb){.r = V, .g = P, .b = Q};
    else
        RGB = (rgb){.r = 0., .g = 0., .b = 0.};

    return RGB;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movsd 0x10(%rbp), %xmm0
movsd 0x18(%rbp), %xmm1
movsd %xmm1, -0x18(%rbp)
movapd %xmm0, %xmm1
divsd 0x2569(%rip), %xmm1     # 0x6010
movsd 0x20(%rbp), %xmm2
movsd %xmm2, -0x10(%rbp)
cmpeqsd 0x255e(%rip), %xmm0     # 0x6018
andnpd %xmm1, %xmm0
movapd %xmm0, -0x30(%rbp)
callq 0x3530
movsd -0x18(%rbp), %xmm6
movsd -0x10(%rbp), %xmm5
movapd -0x30(%rbp), %xmm7
movapd %xmm7, %xmm3
subsd %xmm0, %xmm3
movsd 0x2539(%rip), %xmm1     # 0x6020
movapd %xmm1, %xmm0
subsd %xmm6, %xmm0
mulsd %xmm5, %xmm0
movapd %xmm1, %xmm4
subsd %xmm3, %xmm4
mulsd %xmm6, %xmm4
movapd %xmm1, %xmm2
subsd %xmm4, %xmm2
mulsd %xmm5, %xmm2
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm7
movapd %xmm7, %xmm4
jb 0x3b2a
ucomisd %xmm4, %xmm1
jbe 0x3b2a
movsd %xmm5, (%rbx)
movsd %xmm2, 0x8(%rbx)
jmp 0x3b57
mulsd %xmm3, %xmm6
subsd %xmm6, %xmm1
mulsd %xmm5, %xmm1
ucomisd 0x24e2(%rip), %xmm4     # 0x6020
jb 0x3b66
movsd 0x24e0(%rip), %xmm3     # 0x6028
ucomisd %xmm4, %xmm3
jbe 0x3b66
movsd %xmm1, (%rbx)
movsd %xmm5, 0x8(%rbx)
movsd %xmm0, 0x10(%rbx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
ucomisd 0x24ba(%rip), %xmm4     # 0x6028
jb 0x3b8e
movsd 0x24b8(%rip), %xmm3     # 0x6030
ucomisd %xmm4, %xmm3
jbe 0x3b8e
movsd %xmm0, (%rbx)
movsd %xmm5, 0x8(%rbx)
movsd %xmm2, 0x10(%rbx)
jmp 0x3b5c
ucomisd 0x249a(%rip), %xmm4     # 0x6030
jb 0x3bb1
movsd 0x2498(%rip), %xmm3     # 0x6038
ucomisd %xmm4, %xmm3
jbe 0x3bb1
movsd %xmm0, (%rbx)
movsd %xmm1, 0x8(%rbx)
jmp 0x3bd2
ucomisd 0x247f(%rip), %xmm4     # 0x6038
jb 0x3bd9
movsd 0x247d(%rip), %xmm3     # 0x6040
ucomisd %xmm4, %xmm3
jbe 0x3bd9
movsd %xmm2, (%rbx)
movsd %xmm0, 0x8(%rbx)
movsd %xmm5, 0x10(%rbx)
jmp 0x3b5c
ucomisd 0x245f(%rip), %xmm4     # 0x6040
jb 0x3c04
movsd 0x245d(%rip), %xmm2     # 0x6048
ucomisd %xmm4, %xmm2
jbe 0x3c04
movsd %xmm5, (%rbx)
movsd %xmm0, 0x8(%rbx)
movsd %xmm1, 0x10(%rbx)
jmp 0x3b5c
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
jmp 0x3b5c
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: get_rgb(int, float, float)
rgb get_rgb(int h, float s, float v){
    hsv hsv;
    hsv.h = h;
    hsv.s = s;
    hsv.v = v;
    return hsv2rgb(hsv);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
cvtsi2sd %esi, %xmm2
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
movsd %xmm2, -0x20(%rbp)
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x20(%rbp), %xmm0
movups %xmm0, (%rsp)
callq 0x3a80
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: get_rgb(int, int)
rgb get_rgb(int x, int y){
    if (x < 0 || x > palette_x || y < 0 || y > palette_y){
        rgb out;
        out.r = 0;
        out.g = 0;
        out.b = 0;
        return out;
    }
    hsv hsv;
    hsv.h = (int) interpolate(x, 0, palette_x, 0, 360);
    hsv.s = 1.0;
    hsv.v = 1.2 - interpolate(y, 0, palette_y, 0.2, 1.0);
    return hsv2rgb(hsv);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
cmpl $0x15, %esi
setb %al
cmpl $0x7, %edx
setb %cl
testb %cl, %al
jne 0x3cad
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
jmp 0x3d2f
cvtsi2ss %esi, %xmm0
mulss 0x239f(%rip), %xmm0     # 0x6058
divss 0x239b(%rip), %xmm0     # 0x605c
xorps %xmm1, %xmm1
addss %xmm0, %xmm1
cvttps2dq %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
cvtdq2pd %xmm0, %xmm0
mulss 0x2381(%rip), %xmm1     # 0x6060
divss 0x237d(%rip), %xmm1     # 0x6064
addss 0x2379(%rip), %xmm1     # 0x6068
cvtss2sd %xmm1, %xmm1
movsd 0x2355(%rip), %xmm2     # 0x6050
subsd %xmm1, %xmm2
movlps %xmm0, -0x20(%rbp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x18(%rbp)
movsd %xmm2, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x20(%rbp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x3a80
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: draw_palette(_XDisplay*, unsigned long, int)
void draw_palette(Display * display, Window window, int start_y){
    
    GC local = XCreateGC(display, window, 0, NULL);
    
    int x = 0;
    int y = start_y;
    int size = palette_size_block;

    for (int cy = 0; cy <= palette_y; cy++){
        for (int cx = 0; cx <= palette_x; cx++){
            rgb rgb = get_rgb(cx, cy);
            XColor color = create_color(display, rgb);
            XGCValues values;
            values.foreground = color.pixel;
            XChangeGC(display, local, GCForeground, &values);
            XFillRectangle(display, window, local, x, y, size, size);

            x += size;
        }
        x = 0;
        y += size;
    } 

    XFreeGC(display, local);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edx, %r14d
movq %rdi, %r12
movq %rsi, -0x48(%rbp)
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3160
xorl %ecx, %ecx
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %r13
movl %r14d, -0x2c(%rbp)
xorl %r15d, %r15d
xorl %r14d, %r14d
movq %rcx, -0x40(%rbp)
leaq -0x60(%rbp), %rdi
movl %r14d, %esi
movq -0x40(%rbp), %rdx
callq 0x3c7e
movsd -0x60(%rbp), %xmm0
movsd 0x2225(%rip), %xmm1     # 0x6008
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movsd -0x58(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movsd -0x50(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %edx
movw %ax, -0xd8(%rbp)
movw %cx, -0xd6(%rbp)
movw %dx, -0xd4(%rbp)
movslq 0xe0(%r12), %rax
movq 0xe8(%r12), %rcx
shlq $0x7, %rax
movq 0x50(%rcx,%rax), %rsi
movq %r12, %rdi
leaq -0xe0(%rbp), %rbx
movq %rbx, %rdx
callq 0x3230
movq -0xe0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movl $0x4, %edx
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rcx
callq 0x31e0
movl $0xf, (%rsp)
movq %r12, %rdi
movq -0x48(%rbp), %rsi
movq %r13, %rdx
movl %r15d, %ecx
movl -0x2c(%rbp), %r8d
movl $0xf, %r9d
callq 0x3170
movq -0x40(%rbp), %rcx
addl $0xf, %r15d
incl %r14d
cmpl $0x13b, %r15d           # imm = 0x13B
jne 0x3dc6
movl -0x2c(%rbp), %r14d
addl $0xf, %r14d
incl %ecx
cmpl $0x7, %ecx
jne 0x3db8
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x31a0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: change_background_color(_XDisplay*, unsigned long, rgb)
void change_background_color(Display * display, Window window, rgb rgb){
    XSetWindowAttributes attributes;
    attributes.background_pixel = create_color(display, rgb).pixel;
    XChangeWindowAttributes(display, window, CWBackPixel, &attributes);
    XClearWindow(display, window);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x211b(%rip), %xmm0     # 0x6008
movsd 0x10(%rbp), %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movsd 0x18(%rbp), %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
mulsd 0x20(%rbp), %xmm0
cvttsd2si %xmm0, %edx
leaq -0x88(%rbp), %r15
movw %ax, 0x8(%r15)
movw %cx, 0xa(%r15)
movw %dx, 0xc(%r15)
movslq 0xe0(%rdi), %rax
movq 0xe8(%rdi), %rcx
shlq $0x7, %rax
movq 0x50(%rcx,%rax), %rsi
movq %r15, %rdx
callq 0x3230
movq (%r15), %rax
movq %rax, 0x8(%r15)
leaq -0x88(%rbp), %rcx
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x34f0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x32a0
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: x_error(_XDisplay*, XErrorEvent*)
int x_error(Display * display, XErrorEvent * event){
    char buffer[256];
    snprintf(buffer, sizeof(buffer), "/tmp/xborder-error.%lu", window);
    FILE * log = fopen(buffer, "a");
    fprintf(log, "xborder pid %d window id %lu crashed\n", getpid(), window);
    fprintf(log, "xerror:\n");
    fprintf(log, "  serial: %lu\n", event->serial);
    char error_string[256];
    XGetErrorText(display, event->error_code, error_string, sizeof(error_string));
    fprintf(log, "  error code: %s\n", error_string);
    fprintf(log, "  request code: %d\n", event->request_code);
    fprintf(log, "  minor code: %d\n", event->minor_code);
    fprintf(log, "  resource id: %lu\n", event->resourceid);
    fprintf(log, "\n");
    show_backtrace(fileno(log));
    fclose(log);
    // exit(1);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x520, %rsp            # imm = 0x520
movq %rsi, %r14
movq %rdi, %r15
movq 0x42c1(%rip), %rcx      # 0x8318
leaq 0x2085(%rip), %rdx      # 0x60e3
leaq -0x220(%rbp), %rbx
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0x34e0
leaq 0x207f(%rip), %rsi      # 0x60fa
movq %rbx, %rdi
callq 0x3360
movq %rax, %rbx
callq 0x3450
movq 0x4286(%rip), %rcx      # 0x8318
leaq 0x2063(%rip), %rsi      # 0x60fc
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x3410
leaq 0x2076(%rip), %rdi      # 0x6122
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x35d0
movq 0x18(%r14), %rdx
leaq 0x2062(%rip), %rsi      # 0x612b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3410
movzbl 0x20(%r14), %esi
leaq -0x120(%rbp), %r12
movq %r15, %rdi
movq %r12, %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x3430
leaq 0x2044(%rip), %rsi      # 0x613a
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3410
movzbl 0x21(%r14), %edx
leaq 0x203d(%rip), %rsi      # 0x614c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3410
movzbl 0x22(%r14), %edx
leaq 0x203b(%rip), %rsi      # 0x6160
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3410
movq 0x10(%r14), %rdx
leaq 0x2038(%rip), %rsi      # 0x6172
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3410
movl $0xa, %edi
movq %rbx, %rsi
callq 0x3380
movq %rbx, %rdi
callq 0x3320
movl %eax, %r14d
leaq -0x540(%rbp), %r15
movq %r15, %rdi
movl $0x64, %esi
callq 0x3470
movq %r15, %rdi
movl %eax, %esi
movl %r14d, %edx
callq 0x34d0
movq %rbx, %rdi
callq 0x32d0
xorl %eax, %eax
addq $0x520, %rsp            # imm = 0x520
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: get_window_title[abi:cxx11](_XDisplay*, unsigned long)
std::string get_window_title(Display * display, Window window){
    char* buffer = NULL;
    if (XFetchName(display, window, &buffer) != 0){
        if (buffer != NULL){
            std::string out = buffer;
            XFree(buffer);
            return out;
        }
    }

    return "XBorder";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq -0x20(%rbp), %r14
movq $0x0, (%r14)
movq %rsi, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x3490
testl %eax, %eax
setne %al
movq (%r14), %r14
testq %r14, %r14
setne %cl
andb %al, %cl
leaq 0x10(%rbx), %r15
movq %r15, (%rbx)
cmpb $0x1, %cl
jne 0x41fd
movq %r14, %rdi
callq 0x3140
movq %r14, %rdx
addq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5956
movq -0x20(%rbp), %rdi
callq 0x33a0
jmp 0x4213
leaq 0x1f82(%rip), %rsi      # 0x6186
leaq 0x1f82(%rip), %rdx      # 0x618d
movq %rbx, %rdi
callq 0x5956
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x4237
movq (%r15), %rsi
incq %rsi
callq 0x3300
movq %r14, %rdi
callq 0x3550
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: get_parent_window(_XDisplay*, unsigned long)
Window get_parent_window(Display * display, Window window){
    Window root = 0;
    Window parent = 0;
    Window* children = NULL;
    unsigned int count = 0;
    XQueryTree(display, window, &root, &parent, &children, &count);
    if (children != NULL){
        XFree(children);
    }
    return parent;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
xorl %eax, %eax
leaq -0x28(%rbp), %rdx
movq %rax, (%rdx)
leaq -0x10(%rbp), %rcx
movq %rax, (%rcx)
leaq -0x20(%rbp), %rbx
movq %rax, (%rbx)
leaq -0x14(%rbp), %r9
movl $0x0, (%r9)
movq %rbx, %r8
callq 0x3120
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x44ab
callq 0x33a0
movq -0x10(%rbp), %rax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: do_configure_xborder()
void do_configure_xborder(){
    Display * display;

    display = XOpenDisplay(NULL);
    if (display == NULL){
        std::cerr << "Cannot open display" << std::endl;
        return;
    }

    Window chosen = find_xborder_window(display);
    if (chosen == 0){
        XCloseDisplay(display);
        return;
    }

    // std::cout << "Send event to window " << chosen << std::endl;

    Atom xborder_configure = XInternAtom(display, "xborder", false);

    XEvent event;
    XClientMessageEvent * client = &event.xclient;
    event.type = ClientMessage;
    client->message_type = xborder_configure;
    client->format = 8;
    client->window = chosen;
    client->data.b[0] = XBorderConfigure;

    if (XSendEvent(display, chosen, 0, 0, &event) != 0){
        std::cout << "Reconfigured xborder window " << chosen << std::endl;
    } else {
        std::cout << "Could not send an event" << std::endl;
    }
    XCloseDisplay(display);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
xorl %edi, %edi
callq 0x33e0
testq %rax, %rax
je 0x4ea8
movq %rax, %rbx
movq %rax, %rdi
callq 0x382e
testq %rax, %rax
je 0x4ef7
movq %rax, %r14
leaq 0x14b9(%rip), %rsi      # 0x62f2
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3200
leaq -0xd8(%rbp), %r8
movl $0x21, (%r8)
movq %rax, 0x28(%r8)
movl $0x8, 0x30(%r8)
movq %r14, 0x20(%r8)
movb $0x0, 0x38(%r8)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3070
testl %eax, %eax
je 0x4f0c
movq 0x314c(%rip), %r15      # 0x7fd0
leaq 0x146f(%rip), %rsi      # 0x62fa
movl $0x1c, %edx
movq %r15, %rdi
callq 0x3350
movq %r15, %rdi
movq %r14, %rsi
callq 0x31c0
movq %rax, %r14
jmp 0x4f27
movq 0x3141(%rip), %rbx      # 0x7ff0
leaq 0x1332(%rip), %rsi      # 0x61e8
movl $0x13, %edx
movq %rbx, %rdi
callq 0x3350
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31d0
movq %rbx, %rdi
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x35a0
movq 0x30bd(%rip), %r14      # 0x7fd0
leaq 0x13fd(%rip), %rsi      # 0x6317
movl $0x17, %edx
movq %r14, %rdi
callq 0x3350
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
movq %rbx, %rdi
callq 0x35a0
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: main
int main(int argc, char ** argv){
    bool glow = false;

    for (int i = 1; i < argc; i++){
        std::string arg(argv[i]);
        if (arg == "glow" ||
            arg == "-glow" ||
            arg == "--glow"){
            glow = true;
        } else if (arg == "configure"){
            do_configure_xborder();
            return 0;
        }
    }

    run_xborder(glow);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, -0x40(%rbp)
cmpl $0x2, %edi
setge %r13b
jl 0x505e
movl %edi, %eax
movl $0x1, %r15d
movq %rax, -0x38(%rbp)
subq %rax, %r15
movl $0x2, %ebx
movl $0x0, -0x2c(%rbp)
leaq -0x60(%rbp), %r14
movq -0x40(%rbp), %rax
movq -0x8(%rax,%rbx,8), %rsi
movq %r14, %rdi
leaq -0x2d(%rbp), %rdx
callq 0x51d6
movq %r14, %rdi
leaq 0x136d(%rip), %rsi      # 0x6331
callq 0x30b0
testl %eax, %eax
je 0x5013
movq %r14, %rdi
leaq 0x1359(%rip), %rsi      # 0x6330
callq 0x30b0
testl %eax, %eax
je 0x5013
movq %r14, %rdi
leaq 0x1345(%rip), %rsi      # 0x632f
callq 0x30b0
movb $0x1, %r12b
testl %eax, %eax
je 0x5057
movq %r14, %rdi
leaq 0x1336(%rip), %rsi      # 0x6336
callq 0x30b0
testl %eax, %eax
jne 0x501b
callq 0x4dfb
xorl %r12d, %r12d
jmp 0x501b
movb $0x1, %al
movl %eax, -0x2c(%rbp)
movb $0x1, %r12b
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x5034
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x3300
testb %r12b, %r12b
je 0x5062
cmpq -0x38(%rbp), %rbx
setb %r13b
leaq (%r15,%rbx), %rax
incq %rax
incq %rbx
cmpq $0x2, %rax
jne 0x4fa5
jmp 0x5062
movb $0x1, %al
movl %eax, -0x2c(%rbp)
jmp 0x501b
xorl %eax, %eax
jmp 0x5065
movl -0x2c(%rbp), %eax
testb $0x1, %r13b
jne 0x5076
movzbl %al, %edi
andl $0x1, %edi
callq 0x4501
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x50a3
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x3300
movq %rbx, %rdi
callq 0x3550
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: TryChildren(_XDisplay*, unsigned long, unsigned long)
static Window TryChildren(Display *dpy, Window win, Atom WM_STATE){
    Window root, parent;
    Window *children;
    unsigned int nchildren;
    unsigned int i;
    Atom type = None;
    int format;
    unsigned long nitems, after;
    unsigned char *data;
    Window inf = 0;

    if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren))
        return 0;
    for (i = 0; !inf && (i < nchildren); i++) {
        data = NULL;
        XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False,
                AnyPropertyType, &type, &format, &nitems,
                &after, &data);
        if (data)
            XFree(data);
        if (type)
            inf = children[i];
    }
    for (i = 0; !inf && (i < nchildren); i++)
        inf = TryChildren(dpy, children[i], WM_STATE);
    if (children)
        XFree(children);
    return inf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movq $0x0, -0x48(%rbp)
leaq -0x70(%rbp), %rdx
leaq -0x68(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x2c(%rbp), %r9
callq 0x3120
testl %eax, %eax
je 0x5170
cmpl $0x0, -0x2c(%rbp)
je 0x5175
movl $0x1, %r13d
xorl %r12d, %r12d
xorl %r15d, %r15d
movq %r12, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq -0x8(%rax,%r13,8), %rsi
movq %r14, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
leaq -0x40(%rbp), %rax
pushq %rax
leaq -0x58(%rbp), %rax
pushq %rax
leaq -0x60(%rbp), %rax
pushq %rax
leaq -0x4c(%rbp), %rax
pushq %rax
leaq -0x48(%rbp), %rax
pushq %rax
pushq %r12
callq 0x30c0
addq $0x30, %rsp
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x514a
callq 0x33a0
cmpq $0x0, -0x48(%rbp)
je 0x515a
movq -0x38(%rbp), %rax
movq -0x8(%rax,%r13,8), %r15
testq %r15, %r15
jne 0x5178
leaq 0x1(%r13), %rax
movl -0x2c(%rbp), %ecx
cmpq %rcx, %r13
movq %rax, %r13
jb 0x50fd
jmp 0x5178
xorl %r15d, %r15d
jmp 0x51c3
xorl %r15d, %r15d
testq %r15, %r15
jne 0x51b5
cmpl $0x0, -0x2c(%rbp)
je 0x51b5
movl $0x1, %r12d
movq -0x38(%rbp), %rax
movq -0x8(%rax,%r12,8), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x50ab
movq %rax, %r15
testq %rax, %rax
jne 0x51b5
leaq 0x1(%r12), %rax
movl -0x2c(%rbp), %ecx
cmpq %rcx, %r12
movq %rax, %r12
jb 0x5189
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x51c3
callq 0x33a0
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/kazzmir[P]xborder/src/main.cpp
// Function: OptionWindow::create(_XDisplay*, unsigned long)
static OptionWindow* create(Display * display, Window xborder_window){
        Atom wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", false);
        int screen = DefaultScreen(display);
        int width = (palette_x + 1) * palette_size_block + 5;
        int height = palette_start_y + (palette_y + 1) * palette_size_block;
        Window window = XCreateSimpleWindow(display, RootWindow(display, screen),
                                            1, 1,
                                            width, height,
                                            1, BlackPixel(display, screen), WhitePixel(display, screen));
        XFontStruct * fontInfo = XLoadQueryFont(display, "6x10");
        XGCValues values;
        // values.font = fontInfo->fid;
        values.foreground = BlackPixel(display, screen);
        GC graphics = XCreateGC(display, window, GCForeground, &values);
        XSelectInput(display, window,
                     ExposureMask |
                     KeyPress |
                     KeyRelease |
                     ButtonPressMask |
                     ButtonReleaseMask |
                     Button1MotionMask |
                     StructureNotifyMask);
        XMapWindow(display, window);
        XStoreName(display, window, "XBorder options");
        XSetWMProtocols(display, window, &wm_delete_window, 1);

        return new OptionWindow(display, window, graphics, xborder_window);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xd1e(%rip), %rsi       # 0x62c3
xorl %edx, %edx
callq 0x3200
leaq -0x30(%rbp), %r15
movq %rax, (%r15)
movslq 0xe0(%r14), %r13
movq 0xe8(%r14), %rax
shlq $0x7, %r13
movq 0x10(%rax,%r13), %rsi
subq $0x8, %rsp
movq %r14, %rdi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x140, %r8d            # imm = 0x140
movl $0x91, %r9d
pushq 0x58(%rax,%r13)
pushq 0x60(%rax,%r13)
pushq $0x1
callq 0x30d0
addq $0x20, %rsp
movq %rax, %r12
leaq 0xd7b(%rip), %rsi       # 0x6381
movq %r14, %rdi
callq 0x3570
movq 0xe8(%r14), %rax
movq 0x60(%rax,%r13), %rax
leaq -0xb0(%rbp), %rcx
movq %rax, 0x10(%rcx)
movl $0x4, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x3160
movq %rax, %r13
movl $0x2810f, %edx          # imm = 0x2810F
movq %r14, %rdi
movq %r12, %rsi
callq 0x31b0
movq %r14, %rdi
movq %r12, %rsi
callq 0x3330
leaq 0xd2c(%rip), %rdx       # 0x6386
movq %r14, %rdi
movq %r12, %rsi
callq 0x3060
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x3180
movl $0x68, %edi
callq 0x32f0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbx, %r8
callq 0x59fe
movq %r15, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x68, %esi
movq %r15, %rdi
callq 0x3300
movq %rbx, %rdi
callq 0x3550