LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/TestWarcraft.cpp
// Function: test2()
void test2()
{
    GameTime::getInstance()->showTime();
    GameTime::getInstance()->updateTime();
    cout << endl;
    GameTime::getInstance()->showTime();
    GameTime::getInstance()->updateTime();
    cout << endl;
    GameTime::getInstance()->showTime();
    GameTime::getInstance()->updateTime();
    cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0xaf12(%rip), %r14      # 0x17168
movq (%r14), %rdi
callq 0xca98
movq (%r14), %rax
movq 0x8(%rax), %rcx
addq $0x5, %rcx
cmpq $0x3c, %rcx
jne 0xc274
incq (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq 0xad51(%rip), %rbx      # 0x16fd0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq (%r14), %rdi
callq 0xca98
movq (%r14), %rax
movq 0x8(%rax), %rcx
addq $0x5, %rcx
cmpq $0x3c, %rcx
jne 0xc2c4
incq (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq (%r14), %rdi
callq 0xca98
movq (%r14), %rax
movq 0x8(%rax), %rcx
addq $0x5, %rcx
cmpq $0x3c, %rcx
jne 0xc30d
incq (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x40f0
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/TestWarcraft.cpp
// Function: test3()
void test3()
{
    test1();
    WeaponPtr weapon(new Arrow(DRAGON));
    cout << weapon->getAttackValue() << endl;
    cout << weapon->getName() << endl;
    cout << weapon->getDurability() << endl;
    weapon->decreaseDuribility();
    cout << weapon->getDurability() << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
callq 0xc154
movl $0x48, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x8890
leaq -0x18(%rbp), %rbx
movq %r14, -0x8(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xbfe6
movq -0x8(%rbx), %rax
movq 0x30(%rax), %rsi
movq 0xac4b(%rip), %rdi      # 0x16fd0
callq 0x40e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq -0x20(%rbp), %rax
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %rdi
callq 0x570a
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0xabed(%rip), %rdi      # 0x16fd0
callq 0x4190
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0xc427
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rsi
movq 0xab9a(%rip), %rdi      # 0x16fd0
callq 0x40e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rsi
decq %rsi
movq %rsi, 0x38(%rax)
movq 0xab55(%rip), %rdi      # 0x16fd0
callq 0x40e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq -0x18(%rbp), %rdi
testq %rdi, %rdi
je 0xc4b8
callq 0x57a8
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0xc4ef
movq %rax, %rbx
movl $0x48, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc500
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0xc4f2
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0xc4f2
movq %rax, %rbx
movq -0x18(%rbp), %rdi
testq %rdi, %rdi
je 0xc500
callq 0x57a8
movq %rbx, %rdi
callq 0x4230
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/./WarcraftWorld.h
// Function: warcraft::WarcraftWorld::~WarcraftWorld()
~WarcraftWorld()
    {
        if (_red)
            delete _red;
        if (_blue)
            delete _blue;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0xcc44
leaq 0x70(%r14), %rdi
callq 0xccee
leaq 0x38(%r14), %rdi
callq 0xcda4
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0xcc37
movq 0x30(%r14), %rsi
subq %rdi, %rsi
callq 0x4170
movl $0xa8, %esi
movq %r14, %rdi
callq 0x4170
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0xcc81
leaq 0x70(%r14), %rdi
callq 0xccee
leaq 0x38(%r14), %rdi
callq 0xcda4
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0xcc74
movq 0x30(%r14), %rsi
subq %rdi, %rsi
callq 0x4170
movl $0xa8, %esi
movq %r14, %rdi
callq 0x4170
addq $0x10, %rbx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xcc92
nop
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/Warrior.cpp
// Function: warcraft::Warrior::attack(std::shared_ptr<warcraft::Warrior>, std::shared_ptr<warcraft::Weapon>)
void Warrior::attack(WarriorPtr enemy, WeaponPtr weapon)
{
    switch (weapon->getType())
    {
    case SWORD:
    {
        enemy->sufferAttack(weapon->getAttackValue());
        break;
    }
    case BOMB:
    {
        enemy->sufferAttack(weapon->getAttackValue());
        if (this->getType() != NINJA)
            this->sufferAttack(weapon->getAttackValue() / 2);
        break;
    }
    case ARROW:
    {
        enemy->sufferAttack(weapon->getAttackValue());
        break;
    }
    }
    weapon->decreaseDuribility();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdx), %rax
movl 0x8(%rax), %ecx
cmpl $0x2, %ecx
je 0xd030
cmpl $0x1, %ecx
je 0xd040
testl %ecx, %ecx
jne 0xd03a
movq (%rsi), %rdi
movq 0x30(%rax), %rcx
subl %ecx, 0x38(%rdi)
decq 0x38(%rax)
popq %rbp
retq
movq (%rsi), %rdx
movq 0x30(%rax), %rcx
subl %ecx, 0x38(%rdx)
cmpl $0x1, 0x3c(%rdi)
je 0xd03a
shrq %rcx
jmp 0xd037
nop
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/Warrior.cpp
// Function: warcraft::Warrior::getNewWeapon(std::shared_ptr<warcraft::Weapon>)
void Warrior::getNewWeapon(WeaponPtr weapon) 
{
    if (!weapon.get())
        return;
    WeaponPtr newWeapon;
    switch (weapon->getType())
    {
        case SWORD:newWeapon.reset(new Sword(_type)); break;
        case BOMB:newWeapon.reset(new Bomb(_type));break;
        case ARROW:newWeapon.reset(new Arrow(_type)); newWeapon->setDurability(weapon->getDurability()); break;
    }
    _weapons.push_back(newWeapon);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq (%rsi), %rax
testq %rax, %rax
je 0xd12e
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
movl 0x8(%rax), %eax
testl %eax, %eax
je 0xd0ec
cmpl $0x1, %eax
je 0xd0c6
cmpl $0x2, %eax
jne 0xd110
movq %rsi, %r14
movl $0x48, %edi
callq 0x4160
movq %rax, %r15
movl 0x3c(%rbx), %esi
movq %rax, %rdi
callq 0x8890
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x8842
movq -0x30(%rbp), %rax
movq (%r14), %rcx
movq 0x38(%rcx), %rcx
movq %rcx, 0x38(%rax)
jmp 0xd110
movl $0x40, %edi
callq 0x4160
movq %rax, %r14
movl 0x3c(%rbx), %esi
movq %rax, %rdi
callq 0x8644
leaq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x85f6
jmp 0xd110
movl $0x40, %edi
callq 0x4160
movq %rax, %r14
movl 0x3c(%rbx), %esi
movq %rax, %rdi
callq 0x83f8
leaq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x83aa
addq $0x40, %rbx
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x8f74
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0xd12e
callq 0x57a8
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x48, %esi
movq %r15, %rdi
jmp 0xd153
jmp 0xd148
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xd15d
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0xd16b
callq 0x57a8
movq %rbx, %rdi
callq 0x4230
nop
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/warcraftWorld.cpp
// Function: warcraft::WarcraftWorld::wolfStealing()
void WarcraftWorld::wolfStealing()
{
    for (auto &e : _citys)
    {
        WarriorPtr redWarrior = e->getRedWarrior();
        WarriorPtr blueWarrior = e->getBlueWarrior();
        if (redWarrior.get() && WOLF == redWarrior->getType())
        {
            redWarrior->stealWeapons(blueWarrior);
        }
        if (blueWarrior.get() && WOLF == blueWarrior->getType())
        {
            blueWarrior->stealWeapons(redWarrior);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x10(%rdi), %r15
movq 0x18(%rdi), %rax
movq %rax, -0x50(%rbp)
cmpq %rax, %r15
je 0xe7cb
movq (%r15), %rax
movq 0x8(%rax), %r13
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0xe6e6
movq 0x88f3(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xe6df
incl 0x8(%rbx)
jmp 0xe6e6
lock
incl 0x8(%rbx)
movq (%r15), %rax
movq 0x18(%rax), %r14
movq 0x20(%rax), %r12
testq %r12, %r12
je 0xe70c
movq 0x88ce(%rip), %rax      # 0x16fc8
cmpb $0x0, (%rax)
je 0xe706
incl 0x8(%r12)
jmp 0xe70c
lock
incl 0x8(%r12)
testq %r13, %r13
je 0xe75a
cmpl $0x4, 0x3c(%r13)
jne 0xe75a
movq %r14, -0x48(%rbp)
movq %r12, -0x40(%rbp)
testq %r12, %r12
je 0xe73e
movq 0x889c(%rip), %rax      # 0x16fc8
cmpb $0x0, (%rax)
je 0xe738
incl 0x8(%r12)
jmp 0xe73e
lock
incl 0x8(%r12)
movq (%r13), %rax
movq %r13, %rdi
leaq -0x48(%rbp), %rsi
callq *0x28(%rax)
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xe75a
callq 0x57a8
testq %r14, %r14
je 0xe7a3
cmpl $0x4, 0x3c(%r14)
jne 0xe7a3
movq %r13, -0x38(%rbp)
movq %rbx, -0x30(%rbp)
testq %rbx, %rbx
je 0xe788
movq 0x884e(%rip), %rax      # 0x16fc8
cmpb $0x0, (%rax)
je 0xe784
incl 0x8(%rbx)
jmp 0xe788
lock
incl 0x8(%rbx)
movq (%r14), %rax
movq %r14, %rdi
leaq -0x38(%rbp), %rsi
callq *0x28(%rax)
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xe7a3
callq 0x57a8
testq %r12, %r12
je 0xe7b0
movq %r12, %rdi
callq 0x57a8
testq %rbx, %rbx
je 0xe7bd
movq %rbx, %rdi
callq 0x57a8
addq $0x10, %r15
cmpq -0x50(%rbp), %r15
jne 0xe6be
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x30(%rbp), %rdi
jmp 0xe7ea
movq %rax, %r14
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xe7f4
callq 0x57a8
testq %r12, %r12
je 0xe801
movq %r12, %rdi
callq 0x57a8
testq %rbx, %rbx
je 0xe80e
movq %rbx, %rdi
callq 0x57a8
movq %r14, %rdi
callq 0x4230
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/warcraftWorld.cpp
// Function: warcraft::WarcraftWorld::dragonCheer()
void WarcraftWorld::dragonCheer()
{
    for (auto &e : _citys)
    {
        WarriorPtr redWarrior = e->getRedWarrior();
        WarriorPtr blueWarrior = e->getBlueWarrior();
        if (redWarrior.get() && DRAGON == redWarrior->getType())
        {
            redWarrior->cheer();
        }
        if (blueWarrior.get() && DRAGON == blueWarrior->getType())
        {
            blueWarrior->cheer();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x10(%rdi), %r12
movq 0x18(%rdi), %r13
cmpq %r13, %r12
je 0xe8f4
movq (%r12), %rax
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0xe887
movq 0x8753(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xe87f
incl 0x8(%rbx)
jmp 0xe887
lock
incl 0x8(%rbx)
movq (%r12), %rax
movq 0x18(%rax), %r15
movq 0x20(%rax), %r14
testq %r14, %r14
je 0xe8ab
movq 0x872d(%rip), %rax      # 0x16fc8
cmpb $0x0, (%rax)
je 0xe8a6
incl 0x8(%r14)
jmp 0xe8ab
lock
incl 0x8(%r14)
testq %rdi, %rdi
je 0xe8bc
cmpl $0x0, 0x3c(%rdi)
jne 0xe8bc
movq (%rdi), %rax
callq *0x18(%rax)
testq %r15, %r15
je 0xe8d1
cmpl $0x0, 0x3c(%r15)
jne 0xe8d1
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
testq %r14, %r14
je 0xe8de
movq %r14, %rdi
callq 0x57a8
testq %rbx, %rbx
je 0xe8eb
movq %rbx, %rdi
callq 0x57a8
addq $0x10, %r12
jmp 0xe854
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
testq %r14, %r14
je 0xe913
movq %r14, %rdi
callq 0x57a8
testq %rbx, %rbx
je 0xe920
movq %rbx, %rdi
callq 0x57a8
movq %r15, %rdi
callq 0x4230
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/warcraftWorld.cpp
// Function: warcraft::WarcraftWorld::occupyHeadquarters()
void WarcraftWorld::occupyHeadquarters()
{
    //蓝方基地
    WarriorPtr redWarrior = _citys[GameConfig::getInstance()->getCityNum(_caseNum) + 1]->getRedWarrior();
    if (redWarrior.get()){
        cout << "blue headquarter was taken" << endl;
        exit(0);
    }
    //红方基地
    WarriorPtr blueWarrior = _citys[0]->getBlueWarrior();
    if (blueWarrior.get())
    {
        cout << "red headquarter was taken" << endl;
        exit(0);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x84b7(%rip), %rax      # 0x17158
movq (%rax), %rax
movq 0x10(%rdi), %rcx
movq 0x28(%rdi), %rdx
movq 0x18(%rax), %rax
shlq $0x7, %rdx
movq -0x78(%rax,%rdx), %rax
shlq $0x4, %rax
movq 0x10(%rcx,%rax), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rbx
testq %rbx, %rbx
je 0xece4
movq 0x82f2(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xece0
incl 0x8(%rbx)
jmp 0xece4
lock
incl 0x8(%rbx)
testq %rax, %rax
jne 0xed4a
movq 0x10(%rdi), %rax
movq (%rax), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %r14
testq %r14, %r14
je 0xed0f
movq 0x82c4(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xed16
incl 0x8(%r14)
jmp 0xed1b
testq %rax, %rax
je 0xed28
jmp 0xed70
lock
incl 0x8(%r14)
testq %rax, %rax
jne 0xed70
movq %r14, %rdi
callq 0x57a8
testq %rbx, %rbx
je 0xed3f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x57a8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x827f(%rip), %rdi      # 0x16fd0
leaq 0x1c85(%rip), %rsi      # 0x109dd
movl $0x1a, %edx
callq 0x4190
movq 0x8267(%rip), %rdi      # 0x16fd0
callq 0x40a0
jmp 0xed94
movq 0x8259(%rip), %rdi      # 0x16fd0
leaq 0x1c7a(%rip), %rsi      # 0x109f8
movl $0x19, %edx
callq 0x4190
movq 0x8241(%rip), %rdi      # 0x16fd0
callq 0x40a0
xorl %edi, %edi
callq 0x41b0
movq %rax, %r15
testq %r14, %r14
je 0xedb0
movq %r14, %rdi
callq 0x57a8
jmp 0xedb0
movq %rax, %r15
testq %rbx, %rbx
je 0xedbd
movq %rbx, %rdi
callq 0x57a8
movq %r15, %rdi
callq 0x4230
nop
// File: /workspace/github_cpp_makefile_star2_O3/Worthy-Wang[P]Warcraft3-StartWar/warcraftWorld.cpp
// Function: warcraft::WarcraftWorld::headquartersReport()
void WarcraftWorld::headquartersReport()
{
    //红方基地
    cout << _red->getBaseHp() << " elememts in red headquarters" << endl;
    //蓝方基地
    cout << _blue->getBaseHp() << " elememts in blue headquarters" << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rax), %rsi
movq 0x81ef(%rip), %r14      # 0x16fd0
movq %r14, %rdi
callq 0x40e0
movq %rax, %r15
leaq 0x1bad(%rip), %rsi      # 0x109a0
movl $0x1d, %edx
movq %rax, %rdi
callq 0x4190
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0x40e0
movq %rax, %rbx
leaq 0x1b7d(%rip), %rsi      # 0x109be
movl $0x1e, %edx
movq %rax, %rdi
callq 0x4190
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x40f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/dinitctl.cc
// Function: unpin_service(int, cpbuffer<1024u>&, char const*, bool)
static int unpin_service(int socknum, cpbuffer_t &rbuffer, const char *service_name, bool verbose)
{
    using std::cout;
    using std::cerr;

    handle_t handle;
    
    // Build buffer;
    if (! load_service(socknum, rbuffer, service_name, &handle, nullptr)) {
        return 1;
    }
    
    // Issue UNPIN command.
    {
        auto m = membuf()
                .append((char)cp_cmd::UNPINSERVICE)
                .append(handle);
        write_all_x(socknum, m);
        
        wait_for_reply(rbuffer, socknum);
        if (rbuffer[0] != (char)cp_rply::ACK) {
            cerr << "dinitctl: protocol error.\n";
            return 1;
        }
        rbuffer.consume(1);
    }

    if (verbose) {
        cout << "Service '" << service_name << "' unpinned.\n";
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r13d
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %r12d
xorl %ebp, %ebp
leaq 0xc(%rsp), %rcx
movl $0x1, %ebx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xd2a8
testb %al, %al
je 0x9d50
movl %r13d, 0x8(%rsp)
movl 0xc(%rsp), %eax
movq %rax, %rcx
shlq $0x8, %rcx
orq $0x7, %rcx
shrl $0x18, %eax
leaq 0x10(%rsp), %r13
movb %al, 0x4(%r13)
movl %ecx, (%r13)
movl $0x5, %ebx
movl %ebx, %edx
movl %r12d, %edi
movq %r13, %rsi
callq 0x4100
cmpl $-0x1, %eax
je 0x9c2c
addl %eax, %ebp
movslq %eax, %rcx
addq %rcx, %r13
subl %eax, %ebx
jmp 0x9c3a
callq 0x4040
cmpl $0x4, (%rax)
jne 0x9cf1
testl %ebx, %ebx
jg 0x9c0e
cmpl $-0x1, %ebp
je 0x9cf9
movq %r15, %rdi
movl %r12d, %esi
callq 0xed47
movl 0x400(%r15), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x32, (%r15,%rcx)
movl $0x1, %ebx
movl 0x8(%rsp), %edx
jne 0x9cdc
leal 0x1(%rax), %ecx
addl $0xfffffc01, %eax       # imm = 0xFFFFFC01
cmpl $0x400, %ecx            # imm = 0x400
cmovbl %ecx, %eax
movl %eax, 0x400(%r15)
decl 0x404(%r15)
xorl %ebx, %ebx
testb %dl, %dl
je 0x9d50
movq 0x13301(%rip), %r15     # 0x1cfa8
leaq 0xc3cf(%rip), %rsi      # 0x1607d
movl $0x9, %edx
movq %r15, %rdi
callq 0x4330
testq %r14, %r14
je 0x9d20
movq %r14, %rdi
callq 0x4150
movq 0x132d9(%rip), %rdi     # 0x1cfa8
movq %r14, %rsi
movq %rax, %rdx
callq 0x4330
jmp 0x9d38
movq 0x13305(%rip), %rdi     # 0x1cfe8
leaq 0xc473(%rip), %rsi      # 0x1615d
movl $0x1a, %edx
jmp 0x9d4b
testl %ebp, %ebp
jg 0x9c47
movl $0x4, %edi
callq 0x4190
movq %rax, %rbx
callq 0x4040
movl (%rax), %eax
movl %eax, (%rbx)
leaq 0x12e3a(%rip), %rsi     # 0x1cb50
movq %rbx, %rdi
xorl %edx, %edx
callq 0x44d0
movq (%r15), %rax
movq -0x18(%rax), %rax
leaq (%r15,%rax), %rdi
movl 0x20(%r15,%rax), %esi
orl $0x1, %esi
callq 0x44c0
movq 0x13269(%rip), %rdi     # 0x1cfa8
leaq 0xc879(%rip), %rsi      # 0x165bf
movl $0xc, %edx
callq 0x4330
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/dinitctl.cc
// Function: shutdown_dinit(int, cpbuffer<1024u>&, bool)
static int shutdown_dinit(int socknum, cpbuffer_t &rbuffer, bool verbose)
{
    // TODO support no-wait option.
    using std::cout;
    using std::cerr;

    auto m = membuf()
            .append((char)cp_cmd::SHUTDOWN)
            .append(static_cast<char>(shutdown_type_t::HALT));
    write_all_x(socknum, m);

    wait_for_reply(rbuffer, socknum);

    if (rbuffer[0] != (char)cp_rply::ACK) {
        cerr << "dinitctl: control socket protocol error\n";
        return 1;
    }

    if (verbose) {
        std::cout << "Shutting down dinit...\n";
    }

    // Now wait for rollback complete, by waiting for the connection to close:
    try {
        while (true) {
            wait_for_info(rbuffer, socknum);
            rbuffer.consume(rbuffer[1]);
        }
    }
    catch (cp_read_exception &exc) {
        // Assume that the connection closed.
    }

    if (verbose) {
        std::cout << "Connection closed." << std::endl;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %ebp
leaq 0x6(%rsp), %r15
movw $0x20a, (%r15)          # imm = 0x20A
movl $0x2, %r13d
xorl %r12d, %r12d
movl %r13d, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x4100
cmpl $-0x1, %eax
je 0xb46a
addl %eax, %r12d
movslq %eax, %rcx
addq %rcx, %r15
subl %eax, %r13d
jmp 0xb474
callq 0x4040
cmpl $0x4, (%rax)
jne 0xb4d3
testl %r13d, %r13d
jg 0xb44a
cmpl $-0x1, %r12d
je 0xb4d8
movq %r14, %rdi
movl %ebp, %esi
callq 0xed47
movl 0x400(%r14), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x32, (%r14,%rcx)
je 0xb4ff
movq 0x11b3c(%rip), %rdi     # 0x1cfe8
leaq 0xb276(%rip), %rsi      # 0x16729
movl $0x28, %edx
callq 0x4330
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r12d, %r12d
jg 0xb47f
movl $0x4, %edi
callq 0x4190
movq %rax, %rbx
callq 0x4040
movl (%rax), %eax
movl %eax, (%rbx)
leaq 0x1165b(%rip), %rsi     # 0x1cb50
movq %rbx, %rdi
xorl %edx, %edx
callq 0x44d0
testb %bl, %bl
je 0xb51b
movq 0x11a9e(%rip), %rdi     # 0x1cfa8
leaq 0xb4b0(%rip), %rsi      # 0x169c1
movl $0x17, %edx
callq 0x4330
movl $0x400, %r15d           # imm = 0x400
movq %r14, %rdi
movl %ebp, %esi
callq 0xf632
movl 0x400(%r14), %eax
leal 0x1(%rax), %ecx
leal -0x3ff(%rax), %edx
cmpl %r15d, %ecx
cmovbl %ecx, %edx
movsbl (%r14,%rdx), %ecx
leal (%rax,%rcx), %edx
cmpl %r15d, %edx
leal -0x400(%rax,%rcx), %eax
cmovbl %edx, %eax
movl %eax, 0x400(%r14)
subl %ecx, 0x404(%r14)
jmp 0xb521
movq %rax, %rdi
cmpl $0x1, %edx
jne 0xb5aa
callq 0x4130
callq 0x44b0
xorl %ebp, %ebp
testb %bl, %bl
je 0xb4c2
movq 0x11a1f(%rip), %rbx     # 0x1cfa8
leaq 0xb449(%rip), %rsi      # 0x169d9
movl $0x12, %edx
movq %rbx, %rdi
callq 0x4330
movq %rbx, %rdi
callq 0x4180
jmp 0xb4c2
callq 0x44f0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/dinitctl.cc
// Function: trigger_service(int, cpbuffer<1024u>&, char const*, bool)
static int trigger_service(int socknum, cpbuffer_t &rbuffer, const char *service_name, bool trigger_value)
{
    using std::cerr;

    handle_t handle;
    if (!load_service(socknum, rbuffer, service_name, &handle, nullptr, true)) {
        return 1;
    }

    // Issue SET_TRIGGER command.
    {
        auto m = membuf()
                .append((char)cp_cmd::SETTRIGGER)
                .append(handle)
                .append<trigger_val_t>(trigger_value);
        write_all_x(socknum, m);

        wait_for_reply(rbuffer, socknum);
        if (rbuffer[0] == (char)cp_rply::NAK) {
            cerr << "dinitctl: cannot trigger a service that is not of 'triggered' type.\n";
            return 1;
        }
        if (rbuffer[0] != (char)cp_rply::ACK) {
            cerr << "dinitctl: protocol error.\n";
            return 1;
        }
        rbuffer.consume(1);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
movq %rsi, %r14
movl %edi, %ebp
xorl %r12d, %r12d
leaq 0xc(%rsp), %rcx
movl $0x1, %ebx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xd2a8
testb %al, %al
je 0xbd2c
movl 0xc(%rsp), %eax
shlq $0x8, %rax
leaq 0x13(%rax), %rcx
movzbl %r15b, %edx
shlq $0x28, %rdx
movabsq $0xff00000000, %rsi     # imm = 0xFF00000000
andq %rax, %rsi
orq %rdx, %rsi
leaq 0x10(%rsp), %r15
movl %ecx, (%r15)
shrq $0x20, %rsi
movw %si, 0x4(%r15)
movl $0x6, %r13d
movl %r13d, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x4100
cmpl $-0x1, %eax
je 0xbc98
addl %eax, %r12d
movslq %eax, %rcx
addq %rcx, %r15
subl %eax, %r13d
jmp 0xbca6
callq 0x4040
cmpl $0x4, (%rax)
jne 0xbd3d
testl %r13d, %r13d
jg 0xbc78
cmpl $-0x1, %r12d
je 0xbd46
movq %r14, %rdi
movl %ebp, %esi
callq 0xed47
movl 0x400(%r14), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
movzbl (%r14,%rcx), %ecx
cmpl $0x32, %ecx
je 0xbcf8
movq 0x11303(%rip), %rdi     # 0x1cfe8
cmpl $0x33, %ecx
jne 0xbd1b
leaq 0xb4b9(%rip), %rsi      # 0x171aa
movl $0x44, %edx
jmp 0xbd27
leal 0x1(%rax), %ecx
addl $0xfffffc01, %eax       # imm = 0xFFFFFC01
cmpl $0x400, %ecx            # imm = 0x400
cmovbl %ecx, %eax
movl %eax, 0x400(%r14)
decl 0x404(%r14)
xorl %ebx, %ebx
jmp 0xbd2c
leaq 0xa43b(%rip), %rsi      # 0x1615d
movl $0x1a, %edx
callq 0x4330
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r12d, %r12d
jg 0xbcb5
movl $0x4, %edi
callq 0x4190
movq %rax, %rbx
callq 0x4040
movl (%rax), %eax
movl %eax, (%rbx)
leaq 0x10ded(%rip), %rsi     # 0x1cb50
movq %rbx, %rdi
xorl %edx, %edx
callq 0x44d0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/dinitctl.cc
// Function: issue_load_service(int, char const*, bool)
static int issue_load_service(int socknum, const char *service_name, bool find_only)
{
    // Build buffer;
    srvname_len_t srvname_len = strlen(service_name);
    int bufsize = 3 + srvname_len;
    
    std::unique_ptr<char[]> ubuf(new char[bufsize]);
    auto buf = ubuf.get();

    buf[0] = (char)(find_only ? cp_cmd::FINDSERVICE : cp_cmd::LOADSERVICE);
    memcpy(buf + 1, &srvname_len, sizeof(srvname_len));
    memcpy(buf + 3, service_name, srvname_len);

    write_all_x(socknum, buf, bufsize);
    
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r12d
movq %rsi, %r15
movl %edi, %ebp
movq %rsi, %rdi
callq 0x4150
movq %rax, %r13
movzwl %r13w, %r14d
addl $0x3, %r14d
movq %r14, %rdi
callq 0x4030
movq %rax, %rbx
movb $0x2, %al
subb %r12b, %al
movb %al, (%rbx)
movw %r13w, 0x1(%rbx)
leaq 0x3(%rbx), %rdi
movzwl %r13w, %edx
movq %r15, %rsi
callq 0x4270
xorl %r12d, %r12d
movq %rbx, %r15
movl %r14d, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x4100
cmpl $-0x1, %eax
je 0xd6ef
addl %eax, %r12d
movslq %eax, %rcx
addq %rcx, %r15
subl %eax, %r14d
jmp 0xd6f9
callq 0x4040
cmpl $0x4, (%rax)
jne 0xd71a
testl %r14d, %r14d
jg 0xd6cf
cmpl $-0x1, %r12d
je 0xd71f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x43a0
testl %r12d, %r12d
jg 0xd704
movl $0x4, %edi
callq 0x4190
movq %rax, %r14
callq 0x4040
movl (%rax), %eax
movl %eax, (%r14)
leaq 0xf413(%rip), %rsi      # 0x1cb50
movq %r14, %rdi
xorl %edx, %edx
callq 0x44d0
jmp 0xd749
movq %rax, %r14
movq %rbx, %rdi
callq 0x43a0
movq %r14, %rdi
callq 0x44f0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/dinitctl.cc
// Function: print_termination_details(int)
static void print_termination_details(int exit_status)
{
    using std::cout;

    if (WIFSIGNALED(exit_status)) {
        cout << "signalled - signal ";
        cout << WTERMSIG(exit_status);
    }
    else if (WIFEXITED(exit_status)) {
        cout << "exited - status ";
        cout << WEXITSTATUS(exit_status);
    }
    else {
        cout << "unknown reason";
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
andl $0x7f, %ebx
movl %ebx, %eax
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x2000000, %eax        # imm = 0x2000000
jl 0xdebf
movq 0xf104(%rip), %r14      # 0x1cfa8
leaq 0x86e0(%rip), %rsi      # 0x1658b
movl $0x13, %edx
movq %r14, %rdi
callq 0x4330
movq %r14, %rdi
movl %ebx, %esi
jmp 0xdf07
testl %ebx, %ebx
je 0xdee2
movq 0xf0de(%rip), %rdi      # 0x1cfa8
leaq 0x86df(%rip), %rsi      # 0x165b0
movl $0xe, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4330
movl %edi, %ecx
movq 0xf0bd(%rip), %r14      # 0x1cfa8
leaq 0x86ad(%rip), %rsi      # 0x1659f
movl $0x10, %edx
movq %r14, %rdi
movl %ecx, %ebx
callq 0x4330
movzbl %bh, %esi
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x44e0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-client.h
// Function: get_passed_cfd()
inline int get_passed_cfd()
{
    int socknum = -1;
    char * dinit_cs_fd_env = getenv("DINIT_CS_FD");
    if (dinit_cs_fd_env != nullptr) {
        char * endptr;
        long int cfdnum = strtol(dinit_cs_fd_env, &endptr, 10);
        if (endptr != dinit_cs_fd_env) {
            socknum = (int) cfdnum;
            // Set blocking mode (and validate file descriptor):
            errno = 0;
            int sock_flags = fcntl(socknum, F_GETFL, 0);
            if (sock_flags == -1 && errno != 0) {
                socknum = 0;
            }
            else {
                fcntl(socknum, F_SETFL, sock_flags & ~O_NONBLOCK);
            }
        }
    }
    return socknum;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x793a(%rip), %rdi      # 0x15ee3
callq 0x4380
testq %rax, %rax
je 0xe60f
movq %rax, %r14
movq %rsp, %r15
movq %rax, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x4410
cmpq %r14, (%r15)
je 0xe60f
movq %rax, %rbx
callq 0x4040
movq %rax, %r14
movl $0x0, (%rax)
xorl %ebp, %ebp
movl %ebx, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x41f0
cmpl $-0x1, %eax
je 0xe621
andl $0xfffff7ff, %eax       # imm = 0xFFFFF7FF
movl %ebx, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x41f0
movl %ebx, %ebp
jmp 0xe614
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, (%r14)
jne 0xe614
jmp 0xe5f6
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-client.h
// Function: write_all_x(int, void const*, int)
inline int write_all(int fd, const void *buf, int count)
{
    const char *cbuf = static_cast<const char *>(buf);
    int w = 0;
    while (count > 0) {
        int r = write(fd, cbuf, count);
        if (r == -1) {
            if (errno == EINTR) continue;
            return (w > 0) ? w : r;
        }
        w += r;
        cbuf += r;
        count -= r;
    }
    return w;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testl %edx, %edx
jle 0xed10
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %ebp
xorl %r15d, %r15d
movl %ebx, %edx
movl %ebp, %edi
movq %r14, %rsi
callq 0x4100
cmpl $-0x1, %eax
je 0xecfc
addl %eax, %r15d
movslq %eax, %rcx
addq %rcx, %r14
subl %eax, %ebx
jmp 0xed06
callq 0x4040
cmpl $0x4, (%rax)
jne 0xed1b
testl %ebx, %ebx
jg 0xecde
cmpl $-0x1, %r15d
je 0xed20
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testl %r15d, %r15d
jg 0xed10
movl $0x4, %edi
callq 0x4190
movq %rax, %rbx
callq 0x4040
movl (%rax), %eax
movl %eax, (%rbx)
leaq 0xde13(%rip), %rsi      # 0x1cb50
movq %rbx, %rdi
xorl %edx, %edx
callq 0x44d0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-client.h
// Function: fill_buffer_to(cpbuffer<1024u>&, int, int)
inline void fill_buffer_to(cpbuffer_t &buf, int fd, int rlength)
{
    do {
        int r = buf.fill_to(fd, rlength);
        if (r == -1) {
            if (errno != EINTR) {
                throw cp_read_exception(errno);
            }
        }
        else if (r == 0) {
            throw cp_read_exception(0);
        }
        else {
            return;
        }
    }
    while (true);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
cmpl %ebx, 0x404(%r14)
jae 0xef26
movq %r14, %rdi
movl %ebp, %esi
callq 0xef52
testl %eax, %eax
jg 0xeee8
cmpl $-0x1, %eax
jne 0xef22
callq 0x4040
cmpl $0x4, (%rax)
je 0xeee8
movq %rax, %r15
movl $0x4, %edi
callq 0x4190
movl (%r15), %ecx
movl %ecx, (%rax)
jmp 0xef41
testl %eax, %eax
je 0xef31
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x4190
movl $0x0, (%rax)
leaq 0xdbf8(%rip), %rsi      # 0x1cb40
movq %rax, %rdi
xorl %edx, %edx
callq 0x44d0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-client.h
// Function: wait_for_info(cpbuffer<1024u>&, int)
inline void wait_for_info(cpbuffer_t &rbuffer, int fd)
{
    fill_buffer_to(rbuffer, fd, 2);

    if (rbuffer[0] < 100) {
        throw cp_read_exception(0);
    }

    int pktlen = (unsigned char) rbuffer[1];
    fill_buffer_to(rbuffer, fd, pktlen);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
cmpl $0x1, 0x404(%r14)
ja 0xf66b
movq %r14, %rdi
movl %ebx, %esi
callq 0xef52
testl %eax, %eax
jg 0xf63e
cmpl $-0x1, %eax
jne 0xf667
callq 0x4040
cmpl $0x4, (%rax)
je 0xf63e
jmp 0xf6c3
testl %eax, %eax
je 0xf6e6
movl 0x400(%r14), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x63, (%r14,%rcx)
jle 0xf6e6
leal 0x1(%rax), %ecx
addl $0xfffffc01, %eax       # imm = 0xFFFFFC01
cmpl $0x400, %ecx            # imm = 0x400
cmovbl %ecx, %eax
movzbl (%r14,%rax), %ebp
cmpl %ebp, 0x404(%r14)
jae 0xf6db
movq %r14, %rdi
movl %ebx, %esi
callq 0xef52
testl %eax, %eax
jg 0xf69d
cmpl $-0x1, %eax
jne 0xf6d7
callq 0x4040
cmpl $0x4, (%rax)
je 0xf69d
movq %rax, %r15
movl $0x4, %edi
callq 0x4190
movl (%r15), %ecx
movl %ecx, (%rax)
jmp 0xf6f6
testl %eax, %eax
je 0xf6e6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x4190
movl $0x0, (%rax)
leaq 0xd443(%rip), %rsi      # 0x1cb40
movq %rax, %rdi
xorl %edx, %edx
callq 0x44d0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/file-input-stack.h
// Function: file_input_stack::push(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, dio::istream&&, int)
void push(std::string file_name, dio::istream &&file, int parent_dir_fd)
    {
        try {
            input_stack.emplace(std::move(file), std::move(file_name), 0, parent_dir_fd);
        }
        catch (...) {
            // we accept ownership of 'parent_dir_fd' at call:
            bp_sys::close(parent_dir_fd);
            throw;
        }
    }

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rax
leaq 0x8(%rsp), %r8
movl %ecx, (%r8)
leaq 0xc(%rsp), %rcx
movl $0x0, (%rcx)
movq %rdx, %rsi
movq %rax, %rdx
callq 0x10fe8
addq $0x10, %rsp
popq %rbx
retq
movq %rax, %rdi
callq 0x4130
movl 0x8(%rsp), %edi
callq 0x4560
callq 0x4440
movq %rax, %rbx
callq 0x44b0
movq %rbx, %rdi
callq 0x44f0
movq %rax, %rdi
callq 0xe590
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-util.h
// Function: combine_paths[abi:cxx11](string_view, char const*)
inline std::string combine_paths(string_view p1, const char *p2)
{
    if (*p2 == 0) return (std::string)p1;
    if (p1.empty()) return std::string(p2);

    if (p2[0] == '/') return p2;

    if (*(p1.rbegin()) == '/') return (std::string)p1 + p2;
    return (std::string)p1 + '/' + p2;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movb (%rcx), %al
testb %al, %al
je 0x100bb
movq %rcx, %r14
testq %rdx, %rdx
je 0x100a0
cmpb $0x2f, %al
jne 0x100dc
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x4150
leaq (%rax,%r14), %rdx
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x100c8
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
addq %rsi, %rdx
movq %rbx, %rdi
callq 0xec34
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq (%rsi,%rdx), %rax
cmpb $0x2f, -0x1(%rsi,%rdx)
jne 0x1012e
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rax, %rdx
callq 0xec34
movq %r15, %rdi
movq %r14, %rsi
callq 0x4540
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x10188
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x1018e
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %rax, %rdx
callq 0xec34
movq 0x8(%r15), %rsi
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
movl $0x2f, %r8d
callq 0x4510
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x101bd
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x101c4
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x100cd
movq 0x18(%rsp), %rsi
jmp 0x10251
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rsi
callq 0x4540
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x1020a
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x10210
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1023e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42f0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x100cd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42f0
jmp 0x100cd
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1027d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42f0
jmp 0x1027d
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x102a8
movq 0x38(%rsp), %rsi
jmp 0x102a0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x102a8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42f0
movq %rbx, %rdi
callq 0x44f0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-client.h
// Function: read_string[abi:cxx11](int, cpbuffer<1024u>&, unsigned int)
inline std::string read_string(int socknum, cpbuffer_t &rbuffer, uint32_t length)
{
    int rb_len = rbuffer.get_length();
    if (uint32_t(rb_len) >= length) {
        std::string r = rbuffer.extract_string(0, length);
        rbuffer.consume(length);
        return r;
    }

    std::string r = rbuffer.extract_string(0, rb_len);
    uint32_t rlen = length - rb_len;
    uint32_t clen;
    do {
        rbuffer.reset();
        fill_some(rbuffer, socknum);
        char *bptr = rbuffer.get_ptr(0);
        clen = rbuffer.get_length();
        clen = std::min(clen, rlen);
        r.append(bptr, clen);
        rlen -= clen;
    } while (rlen > 0);

    rbuffer.consume(clen);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rdx, %r14
movq %rdi, %rbx
movl 0x404(%rdx), %ecx
movl %r15d, %r12d
subl %ecx, %r12d
jbe 0x1036e
movl %esi, %ebp
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x10414
movq $0x0, 0x400(%r14)
movq %r14, %rdi
movl %ebp, %esi
callq 0xef52
testl %eax, %eax
je 0x103ba
jg 0x1032a
callq 0x4040
cmpl $0x4, (%rax)
je 0x10307
jmp 0x103cc
movl 0x400(%r14), %eax
movl 0x404(%r14), %r13d
leal -0x400(%rax), %esi
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %esi
addq %r14, %rsi
cmpl %r13d, %r12d
movl %r13d, %r15d
cmovbl %r12d, %r15d
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4070
movl %r12d, %eax
subl %r15d, %eax
cmpl %r13d, %r12d
movl %eax, %r12d
ja 0x102fc
jmp 0x1037e
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movl %r15d, %ecx
callq 0x10414
movl 0x400(%r14), %eax
leal (%rax,%r15), %ecx
cmpl $0x400, %ecx            # imm = 0x400
leal -0x400(%rax,%r15), %eax
cmovbl %ecx, %eax
movl %eax, 0x400(%r14)
subl %r15d, 0x404(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x4190
movl $0x0, (%rax)
jmp 0x103de
movq %rax, %r15
movl $0x4, %edi
callq 0x4190
movl (%r15), %ecx
movl %ecx, (%rax)
leaq 0xc75b(%rip), %rsi      # 0x1cb40
movq %rax, %rdi
xorl %edx, %edx
callq 0x44d0
jmp 0x103f1
movq %rax, %r14
movq (%rbx), %rdi
addq $0x10, %rbx
cmpq %rbx, %rdi
je 0x1040b
movq (%rbx), %rsi
incq %rsi
callq 0x42f0
movq %r14, %rdi
callq 0x44f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/cpbuffer.h
// Function: cpbuffer<1024u>::extract_string[abi:cxx11](unsigned int, unsigned int)
std::string extract_string(unsigned index, unsigned length)
    {
        index += cur_idx;
        if (index >= SIZE) index -= SIZE;
        if (index + length > SIZE) {
            std::string r(buf + index, SIZE - index);
            r.insert(r.end(), buf, buf + length - (SIZE - index));
            return r;
        }
        else {
            return std::string(buf + index, length);
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %ecx, %r15d
movq %rsi, %r14
movl 0x400(%rsi), %eax
leal (%rax,%rdx), %ecx
cmpl $0x400, %ecx            # imm = 0x400
leal -0x400(%rax,%rdx), %eax
cmovbl %ecx, %eax
movq %rdi, %rbx
leal (%rax,%r15), %ecx
addq %rax, %rsi
cmpl $0x401, %ecx            # imm = 0x401
jb 0x10483
movl $0x400, %r13d           # imm = 0x400
subl %eax, %r13d
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
leaq (%rsi,%r13), %rdx
movq %rbx, %rdi
callq 0xec34
movq 0x8(%rbx), %rsi
movl %r15d, %r8d
subq %r13, %r8
movq %rbx, %rdi
xorl %edx, %edx
movq %r14, %rcx
callq 0x4320
jmp 0x10498
movl %r15d, %edx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
addq %rsi, %rdx
movq %rbx, %rdi
callq 0xec34
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x104bc
movq (%r12), %rsi
incq %rsi
callq 0x42f0
movq %r14, %rdi
callq 0x44f0
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-util.h
// Function: readlink_at_str(int, char const*)
inline std::pair<bool, std::vector<char>> readlink_at_str(int dirfd, const char *path) noexcept
{
    struct stat sb;
    if (bp_sys::fstatat(dirfd, path, &sb, AT_SYMLINK_NOFOLLOW) == -1) {
        return {false, {}};
    }

    size_t vec_size = sb.st_size + 1; // add one for nul terminator

    try {
        std::vector<char> vec_str(vec_size);

        try_read_link:

        ssize_t r = bp_sys::readlinkat(dirfd, path, vec_str.data(), vec_size);

        if (r < 0) {
            return {false, {}};
        }

        if ((size_t)r > vec_size) {
            // Our size estimate was off (link changed?), try again
            vec_size = r;
            vec_str.resize(vec_size);
            goto try_read_link;
        }

        // shrink, or even expand (append nul) as necessary
        vec_str.resize(r + 1);

        return {true, std::move(vec_str)};
    }
    catch (std::bad_alloc &) {
        errno = ENOMEM;
        return {false, {}};
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x28(%rsp), %rdx
movl %esi, %edi
movq %r14, %rsi
movl $0x100, %ecx            # imm = 0x100
callq 0x40c0
cmpl $-0x1, %eax
je 0x107b3
movq 0x58(%rsp), %r15
incq %r15
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r15, %rsi
callq 0x108cc
leaq 0x10(%rsp), %r12
movq 0x10(%rsp), %rdx
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4080
testq %rax, %rax
js 0x107da
movq %rax, %r13
cmpq %r15, %rax
jbe 0x10818
movq %r12, %rdi
movq %r13, %rsi
callq 0x1092c
movq %r13, %r15
jmp 0x10784
movb $0x0, (%rbx)
leaq 0x8(%rbx), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movq $0x0, 0x18(%rbx)
xorl %esi, %esi
callq 0x10958
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
jmp 0x1083d
movb $0x0, (%rbx)
leaq 0x8(%rbx), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movq $0x0, 0x18(%rbx)
xorl %esi, %esi
callq 0x10958
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1083d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
jmp 0x1083d
incq %r13
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x1092c
movb $0x1, (%rbx)
movaps 0x10(%rsp), %xmm0
movups %xmm0, 0x8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rbx)
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1085e
jmp 0x1085e
movq %rdx, %r15
movq %rax, %r14
jmp 0x1087b
movq %rdx, %r15
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1087b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x42f0
movq %r14, %rdi
cmpl $0x2, %r15d
jne 0x108c6
callq 0x4130
callq 0x4040
movl $0xc, (%rax)
movb $0x0, (%rbx)
leaq 0x8(%rbx), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movq $0x0, 0x18(%rbx)
xorl %esi, %esi
callq 0x10958
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
callq 0x44b0
jmp 0x1083d
movq %rax, %rdi
callq 0xe590
nop
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-util.h
// Function: combine_paths[abi:cxx11](string_view, string_view)
inline std::string combine_paths(string_view p1, string_view p2)
{
    if (p2.empty()) return (std::string)p1;
    if (p1.empty()) return (std::string)p2;

    if (p2[0] == '/') return p2;

    if (*(p1.rbegin()) == '/') return (std::string)p1 + p2;
    return (std::string)p1 + '/' + p2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
testq %r8, %r8
je 0x10c85
movq %r8, %r14
movq %rcx, %r15
testq %rdx, %rdx
je 0x10c70
cmpb $0x2f, (%r15)
jne 0x10ca9
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
addq %r15, %r14
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
jmp 0x10c92
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
addq %rsi, %rdx
movq %rbx, %rdi
callq 0xec34
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%rsi,%rdx), %rax
cmpb $0x2f, -0x1(%rsi,%rdx)
jne 0x10d10
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rax, %rdx
callq 0xec34
leaq 0x10(%rbx), %rbp
movq %rbp, (%rbx)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x11358
movq 0x8(%rbx), %rsi
movq %rbx, %rdi
xorl %edx, %edx
movq %r15, %rcx
movq %r14, %r8
callq 0x4320
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x10c97
movq 0x18(%rsp), %rsi
jmp 0x10dde
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %rax, %rdx
callq 0xec34
movq 0x8(%r12), %rsi
movl $0x1, %ecx
movq %r12, %rdi
xorl %edx, %edx
movl $0x2f, %r8d
callq 0x4510
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x10d6b
movq %rsi, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x10d76
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %r12, %rsi
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x10(%rbx), %rbp
movq %rbp, (%rbx)
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x11358
movq 0x8(%rbx), %rsi
movq %rbx, %rdi
xorl %edx, %edx
movq %r15, %rcx
movq %r14, %r8
callq 0x4320
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x10dcb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42f0
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x10c97
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42f0
jmp 0x10c97
movq %rax, %r14
movq (%rbx), %rdi
cmpq %rbp, %rdi
je 0x10e07
movq (%rbp), %rsi
incq %rsi
callq 0x42f0
jmp 0x10e07
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x10e3c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42f0
jmp 0x10e3c
movq %rax, %r14
movq (%rbx), %rdi
cmpq %rbp, %rdi
je 0x10e50
movq (%rbp), %rsi
incq %rsi
callq 0x42f0
jmp 0x10e50
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x10e67
movq 0x38(%rsp), %rsi
jmp 0x10e5f
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x10e67
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42f0
movq %r14, %rdi
callq 0x44f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/options-processing.cc
// Function: service_dir_opt::get_user_home()
const char *service_dir_opt::get_user_home()
{
    if (user_home_path == nullptr) {
        user_home_path = getenv("HOME");
        if (user_home_path == nullptr) {
            struct passwd * pwuid_p = getpwuid(getuid());
            if (pwuid_p != nullptr) {
                user_home_path = pwuid_p->pw_dir;
            }
        }
    }
    return user_home_path;
}

// Assembly:
movq 0xb515(%rip), %rax      # 0x1d660
testq %rax, %rax
je 0x12151
retq
pushq %rax
leaq 0x5328(%rip), %rdi      # 0x17481
callq 0x4380
movq %rax, 0xb4fb(%rip)      # 0x1d660
testq %rax, %rax
jne 0x1218f
callq 0x41a0
movl %eax, %edi
callq 0x4350
testq %rax, %rax
je 0x12188
movq 0x20(%rax), %rax
movq %rax, 0xb4da(%rip)      # 0x1d660
jmp 0x1218f
movq 0xb4d1(%rip), %rax      # 0x1d660
addq $0x8, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/dinit-iostream.cc
// Function: dio::ostream::throw_exception_on(int)
void ostream::throw_exception_on(const int states)
{
    if ((states & io_states::buffer_fail_bit) && buffer_failure()) {
        throw std::bad_alloc();
    }
    if ((states & io_states::io_fail_bit) && io_failure()) {
        throw iostream_system_err(io_failure());
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testb $0x2, %sil
je 0x130df
cmpq $0x0, 0x8(%rbx)
je 0x130ed
testb $0x8, %sil
je 0x130eb
cmpl $0x0, 0x10(%rbx)
jne 0x1311b
popq %rbx
retq
movl $0x8, %edi
callq 0x4190
movq 0x9e9a(%rip), %rcx      # 0x1cf98
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x9ea4(%rip), %rsi      # 0x1cfb0
movq 0x9e75(%rip), %rdx      # 0x1cf88
movq %rax, %rdi
callq 0x44d0
movl $0x4, %edi
callq 0x4190
movl 0x10(%rbx), %ecx
movl %ecx, (%rax)
leaq 0x9c07(%rip), %rsi      # 0x1cd38
movq %rax, %rdi
xorl %edx, %edx
callq 0x44d0
nop