LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/BattleRandomizer.cpp
// Function: DoaERando::BattleRandomizer::RandomizeZone2(std::vector<unsigned char, std::allocator<unsigned char>>&, DoaERando::RandomNumberGenerator&)
void BattleRandomizer::RandomizeZone2(std::vector<BYTE>& generalIds, RNG& rng)
{
    // There are no special considerations in this zone.  We may want to reconsider because
    // Luo Yang can change for the final battle, but for now, we'll leave it intact.

    vector<int> battlesToFill = {0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D};
    // Make sure every general goes to a relevant battle
    for (auto& id : generalIds)
    {
        int battleIndex = rng.GetRandomInt(0, battlesToFill.size() - 1);
        int battleId = battlesToFill[battleIndex];
        while (!PlaceGeneralInBattle(id, battleId))
        {
            battleIndex = ((battleIndex + 1) % battlesToFill.size());
            battleId = battlesToFill[battleIndex];
        }
    }

    // Now fill all battles with generals/rebel forces
    FillBattlesRandomly(generalIds, battlesToFill, rng);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movups 0x17d895(%rip), %xmm0   # 0x58caec
leaq -0xa0(%rbp), %rsi
movaps %xmm0, 0x10(%rsi)
movups 0x17d873(%rip), %xmm0   # 0x58cadc
movaps %xmm0, (%rsi)
leaq -0x48(%rbp), %rdi
leaq -0x29(%rbp), %rcx
movl $0x8, %edx
callq 0x40ff6a
movq (%r15), %r13
movq %r15, -0x50(%rbp)
movq 0x8(%r15), %r15
cmpq %r15, %r13
je 0x40f2ea
movq -0x40(%rbp), %rdx
subq -0x48(%rbp), %rdx
shrq $0x2, %rdx
decl %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x41086c
movl %eax, %r12d
cltq
movq -0x48(%rbp), %rcx
movl (%rcx,%rax,4), %edx
movzbl (%r13), %esi
movq %r14, %rdi
callq 0x40d678
testb %al, %al
jne 0x40f2e5
incl %r12d
movslq %r12d, %rax
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
xorl %edx, %edx
divq %rsi
movq %rdx, %r12
movslq %r12d, %rax
jmp 0x40f2af
incq %r13
jmp 0x40f289
leaq -0x80(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x40abb0
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x40ffa8
leaq -0x80(%rbp), %rsi
leaq -0x68(%rbp), %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x40d6d4
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x40f325
callq 0x410b90
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x40f333
callq 0x410b90
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x40f341
callq 0x410b90
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x40f366
callq 0x410b90
jmp 0x40f366
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x40f37b
callq 0x410b90
jmp 0x40f37b
jmp 0x40f378
movq %rax, %rbx
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x40f389
callq 0x410b90
movq %rbx, %rdi
callq 0x4bb660
nop
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/BattleRandomizer.cpp
// Function: DoaERando::BattleRandomizer::RandomizeZone3(std::vector<unsigned char, std::allocator<unsigned char>>&, DoaERando::RandomNumberGenerator&)
void BattleRandomizer::RandomizeZone3(std::vector<BYTE>& generalIds, RNG& rng)
{
    // There are no special considerations in this zone.

    vector<int> battlesToFill = {0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13};
    // Make sure every general goes to a relevant battle
    for (auto& id : generalIds)
    {
        int battleIndex = rng.GetRandomInt(0, battlesToFill.size() - 1);
        int battleId = battlesToFill[battleIndex];
        while (!PlaceGeneralInBattle(id, battleId))
        {
            battleIndex = ((battleIndex + 1) % battlesToFill.size());
            battleId = battlesToFill[battleIndex];
        }
    }

    // Now fill all battles with generals/rebel forces
    FillBattlesRandomly(generalIds, battlesToFill, rng);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movups 0x17d601(%rip), %xmm0   # 0x58c9b4
leaq -0xa0(%rbp), %rsi
movaps %xmm0, (%rsi)
movabsq $0x1300000012, %rax     # imm = 0x1300000012
movq %rax, 0x10(%rsi)
leaq -0x48(%rbp), %rdi
leaq -0x29(%rbp), %rcx
movl $0x6, %edx
callq 0x40ff6a
movq (%r15), %r13
movq %r15, -0x50(%rbp)
movq 0x8(%r15), %r15
cmpq %r15, %r13
je 0x40f449
movq -0x40(%rbp), %rdx
subq -0x48(%rbp), %rdx
shrq $0x2, %rdx
decl %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x41086c
movl %eax, %r12d
cltq
movq -0x48(%rbp), %rcx
movl (%rcx,%rax,4), %edx
movzbl (%r13), %esi
movq %r14, %rdi
callq 0x40d678
testb %al, %al
jne 0x40f444
incl %r12d
movslq %r12d, %rax
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
xorl %edx, %edx
divq %rsi
movq %rdx, %r12
movslq %r12d, %rax
jmp 0x40f40e
incq %r13
jmp 0x40f3e8
leaq -0x80(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x40abb0
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x40ffa8
leaq -0x80(%rbp), %rsi
leaq -0x68(%rbp), %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x40d6d4
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x40f484
callq 0x410b90
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x40f492
callq 0x410b90
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x40f4a0
callq 0x410b90
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x40f4c5
callq 0x410b90
jmp 0x40f4c5
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x40f4da
callq 0x410b90
jmp 0x40f4da
jmp 0x40f4d7
movq %rax, %rbx
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x40f4e8
callq 0x410b90
movq %rbx, %rdi
callq 0x4bb660
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/BattleRandomizer.cpp
// Function: DoaERando::BattleRandomizer::UpdateBattles(DoaERando::ROM&)
void BattleRandomizer::UpdateBattles(ROM& rom)
{
    const int BATTLE0_OFFSET = 0x30D70;

    for (auto& battle : myBattles)
    {
        if (battle.battleModified)
        {
            printf("Battle 0x%02X is now 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
                   battle.battleId, battle.generals[0], battle.generals[1],
                   battle.generals[2], battle.generals[3], battle.generals[4]);
            int battleOffset = BATTLE0_OFFSET + (5 * battle.battleId);
            for (int i = 0; i < 5; ++i)
            {
                rom.WriteByte(battleOffset + i, battle.generals[i]);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %r15
movq 0x8(%rdi), %r12
cmpq %r12, %r15
je 0x40ff5a
movq %rsi, %rbx
cmpb $0x1, 0x14(%r15)
jne 0x40ff51
movl 0x4(%r15), %esi
movzbl 0x8(%r15), %edx
movzbl 0x9(%r15), %ecx
movzbl 0xa(%r15), %r8d
movzbl 0xb(%r15), %r9d
movzbl 0xc(%r15), %eax
movl %eax, (%rsp)
leaq 0x17cb85(%rip), %rdi    # 0x58caa2
xorl %eax, %eax
callq 0x4e21a0
movslq 0x4(%r15), %rax
leaq (%rax,%rax,4), %r13
addq $0x30d70, %r13          # imm = 0x30D70
xorl %r14d, %r14d
movzbl 0x8(%r15,%r14), %edx
leal (%r14,%r13), %esi
movq %rbx, %rdi
callq 0x404a24
incq %r14
cmpq $0x5, %r14
jne 0x40ff36
addq $0x18, %r15
cmpq %r12, %r15
jne 0x40feef
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/NPCManipulator.cpp
// Function: DoaERando::NPCManipulator::ReplaceChenDeng(unsigned char)
void NPCManipulator::ReplaceChenDeng(BYTE generalId)
{
    myRom.WriteByte(0x311C0, generalId);
    // This replaces the name given by Chen Deng's father
    myRom.WriteByte(0x2963D, generalId);
    // This is a temporary fix for extra long names before
    // we overhaul the text stuff.
    // It rewrites (so)n to s(on) so that it can create a
    // newline before the general name.
    myRom.WriteByte(0x29639, 0x2E);
    myRom.WriteByte(0x2963A, 0xE0);
    myRom.WriteByte(0x2963B, 0xEC);
    myRom.WriteByte(0x2963C, 0xD2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0x311c0, %esi          # imm = 0x311C0
movl %r14d, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2963d, %esi          # imm = 0x2963D
movl %r14d, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x29639, %esi          # imm = 0x29639
movl $0x2e, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2963a, %esi          # imm = 0x2963A
movl $0xe0, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2963b, %esi          # imm = 0x2963B
movl $0xec, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2963c, %esi          # imm = 0x2963C
movl $0xd2, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x404a24
nop
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/NPCManipulator.cpp
// Function: DoaERando::NPCManipulator::ReplaceHuangZhongAndWeiYan(unsigned char, unsigned char)
void NPCManipulator::ReplaceHuangZhongAndWeiYan(BYTE generalId1, BYTE generalId2)
{
    // This is the NPC data
    myRom.WriteByte(0x31772, generalId1);
    myRom.WriteByte(0x31779, generalId2);
    // This is for the post-battle flags change
    myRom.WriteByte(0x3B062, generalId1);
    myRom.WriteByte(0x3B065, generalId2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
movq (%rdi), %rdi
movl $0x31772, %esi          # imm = 0x31772
movl %r14d, %edx
callq 0x404a24
movq (%r15), %rdi
movl $0x31779, %esi          # imm = 0x31779
movl %ebx, %edx
callq 0x404a24
movq (%r15), %rdi
movl $0x3b062, %esi          # imm = 0x3B062
movl %r14d, %edx
callq 0x404a24
movq (%r15), %rdi
movl $0x3b065, %esi          # imm = 0x3B065
movl %ebx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x404a24
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/NPCManipulator.cpp
// Function: DoaERando::NPCManipulator::ReplacePangTong(unsigned char)
void NPCManipulator::ReplacePangTong(BYTE generalId)
{
    // Set the flags for the new general after the "Pang Tong went out
    // with his soldiers" Text
    myRom.WriteByte(0x36EAF, generalId);
    // Read the new general's recruitment flags, which are used to determine
    // whether to launch the battle.
    myRom.WriteByte(0x3B3C5, generalId);
    // Actual replacement for who joined our army after the battle
    myRom.WriteByte(0x36ECC, generalId);
    // Text replace for Pang Tong went out with his soldiers
    myRom.WriteByte(0x2EA09, generalId);
    // Text replace for Pang Tong joined our army
    myRom.WriteByte(0x2EA62, generalId);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rdi
movl $0x36eaf, %esi          # imm = 0x36EAF
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x3b3c5, %esi          # imm = 0x3B3C5
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x36ecc, %esi          # imm = 0x36ECC
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x2ea09, %esi          # imm = 0x2EA09
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x2ea62, %esi          # imm = 0x2EA62
movl %ebx, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x404a24
nop
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/NPCManipulator.cpp
// Function: DoaERando::NPCManipulator::ReplaceZhugeLiang(unsigned char)
void NPCManipulator::ReplaceZhugeLiang(BYTE generalId)
{
    // Replace 2 versions of Zhuge Liang in his house.
    // This is the lying down version
    myRom.WriteByte(0x312C5, generalId);
    // This is the standing up version
    myRom.WriteByte(0x312D3, generalId);
    // Replace Zhuge Liang in Gui Yang
    myRom.WriteByte(0x31343, generalId);
    // Text replace for "X is sleeping"
    myRom.WriteByte(0x2B9B2, generalId);
    // Text replace for "My brother X is not home"
    myRom.WriteByte(0x2B8F7, generalId);
    // Text replace for "X has joined them!"
    myRom.WriteByte(0x2BAE5, generalId);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rdi
movl $0x312c5, %esi          # imm = 0x312C5
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x312d3, %esi          # imm = 0x312D3
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x31343, %esi          # imm = 0x31343
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x2b9b2, %esi          # imm = 0x2B9B2
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x2b8f7, %esi          # imm = 0x2B8F7
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x2bae5, %esi          # imm = 0x2BAE5
movl %ebx, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x404a24
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/NPCManipulator.cpp
// Function: DoaERando::NPCManipulator::ReplaceXuZheBridgeTrigger(unsigned char)
void NPCManipulator::ReplaceXuZheBridgeTrigger(BYTE generalId)
{
    // Replace the general that the bridge lady looks for
    myRom.WriteByte(0x3684F, generalId);

    // Xu Zhe, my love, where are you?
    myRom.WriteByte(0x2AF53, generalId); // Replace Id
    myRom.WriteByte(0x2AF55, 0xE0); // newline in case of long name

    // Xu Zhe!  Oh, I'm blocking the bridge...
    myRom.WriteByte(0x2AF65, generalId); // Replace ID
    // Adjust text to protect against long names.
    myRom.WriteByte(0x2AF67, 0xFB);
    myRom.WriteByte(0x2AF68, 0x18);
    myRom.WriteByte(0x2AF69, 0x0A);
    myRom.WriteByte(0x2AF6A, 0x30);
    myRom.WriteByte(0x2AF6B, 0x3C);
    myRom.WriteByte(0x2AF6C, 0x8E);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0x3684f, %esi          # imm = 0x3684F
movl %r14d, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af53, %esi          # imm = 0x2AF53
movl %r14d, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af55, %esi          # imm = 0x2AF55
movl $0xe0, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af65, %esi          # imm = 0x2AF65
movl %r14d, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af67, %esi          # imm = 0x2AF67
movl $0xfb, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af68, %esi          # imm = 0x2AF68
movl $0x18, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af69, %esi          # imm = 0x2AF69
movl $0xa, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af6a, %esi          # imm = 0x2AF6A
movl $0x30, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af6b, %esi          # imm = 0x2AF6B
movl $0x3c, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x2af6c, %esi          # imm = 0x2AF6C
movl $0x8e, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x404a24
nop
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/NPCManipulator.cpp
// Function: DoaERando::NPCManipulator::ReplaceMaYuanyi(unsigned char)
void NPCManipulator::ReplaceMaYuanyi(BYTE generalId)
{
    // Replace the actual NPC
    myRom.WriteByte(0x31A73, generalId);
    // This requires a bit of explanation.  There are 2 bits that can tell the NPC to
    // use text 2 instead of text 1.  One of those bits is set when the yellow scarves
    // are defeated, the other is set when Ma Yuanyi is defeated.  It doesn't matter
    // if one or both are set - as long as both aren't clear, we will move to text 2.
    // EXCEPT we can actually move one id past text 2 if both bits are set AND bit 6 of
    // the YZone is set.  Thus, we swizzle this a bit so that both of Ma Yuanyi's texts
    // are the battle text (the textId + 1 is the text we get on future interactions), and
    // then set both bits when the battle is complete.  This way, we can't lock the battle
    // out when we clear the yellow scarves.  (Note that this will go ahead and change the
    // other NPCs in Qing Zhou texts, but those aren't really relevant any more anyway)
    myRom.WriteByte(0x31A6E, 0xCB); // Set bit 6 of YZone
    myRom.WriteByte(0x31A72, 0xAB); // Set text 2 to the battle text
    myRom.WriteByte(0x3B076, 0x83); // Set bit 7 & bit 0 of the location flags
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %edx
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0x31a73, %esi          # imm = 0x31A73
callq 0x404a24
movq (%rbx), %rdi
movl $0x31a6e, %esi          # imm = 0x31A6E
movl $0xcb, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x31a72, %esi          # imm = 0x31A72
movl $0xab, %edx
callq 0x404a24
movq (%rbx), %rdi
movl $0x3b076, %esi          # imm = 0x3B076
movl $0x83, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x404a24
// File: /workspace/github_cpp_makefile_star2_O3/Thilotilo[P]DoaERando/NPCManipulator.cpp
// Function: DoaERando::NPCManipulator::ReplaceYuanShang(unsigned char)
void NPCManipulator::ReplaceYuanShang(BYTE generalId)
{
    // Replace the actual NPC
    myRom.WriteByte(0x317C3, generalId);
    myRom.WriteByte(0x3695A, generalId);
    // Set the correct general's flags to 0x90 (recruitable & encounterable)
    // rather than setting Yuan Shang's flags to 00 after defeating the
    // Yuan Shang battle.
    myRom.WriteByte(0x3693A, 0x90);
    myRom.WriteByte(0x3693C, generalId);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rdi
movl $0x317c3, %esi          # imm = 0x317C3
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x3695a, %esi          # imm = 0x3695A
movl %ebx, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x3693a, %esi          # imm = 0x3693A
movl $0x90, %edx
callq 0x404a24
movq (%r14), %rdi
movl $0x3693c, %esi          # imm = 0x3693C
movl %ebx, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x404a24
nop
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::str_to_int(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) const
int Assembler::str_to_int(string &num) const
{
    istringstream iss(num);

    int a = 0;

    string::iterator it=num.begin();
    
    if(*it=='+' || *it=='-')
        ++it;
    

    if(*it=='0')    // oct or hex
    {
        ++it;

        if(it==num.end())
            return 0;

        if(*it=='x' || *it=='X')
            iss>>hex>>a;
            

        else
            iss>>oct>>a;
        
    }

    else        // normal decimal
        iss>>a;


    iss>>dec;
    return a;
}

// Assembly:
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rsi, %rbx
leaq 0x10(%rsp), %rdi
movl $0x8, %edx
callq 0x22d0
movl $0x0, 0xc(%rsp)
movq (%rbx), %rax
movzbl (%rax), %edx
cmpl $0x2d, %edx
je 0x36c3
movq %rax, %rcx
cmpl $0x2b, %edx
jne 0x36ca
leaq 0x1(%rax), %rcx
movb 0x1(%rax), %dl
cmpb $0x30, %dl
jne 0x3704
incq %rcx
addq 0x8(%rbx), %rax
cmpq %rax, %rcx
je 0x3757
movb (%rcx), %al
addb $-0x58, %al
testb $-0x21, %al
movl $0x8, %eax
movl $0x40, %ecx
cmovel %eax, %ecx
movq 0x10(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x28(%rsp,%rax), %edx
andl $-0x4b, %edx
orl %ecx, %edx
movl %edx, 0x28(%rsp,%rax)
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x2100
movq 0x10(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x28(%rsp,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x28(%rsp,%rax)
movl 0xc(%rsp), %ebx
movq 0xa89b(%rip), %rsi      # 0xdfd0
leaq 0x10(%rsp), %rdi
callq 0x2270
leaq 0x88(%rsp), %rdi
callq 0x20b0
movl %ebx, %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbx
retq
xorl %ebx, %ebx
jmp 0x372e
movq %rax, %rbx
movq 0xa86b(%rip), %rsi      # 0xdfd0
leaq 0x10(%rsp), %rdi
callq 0x2270
leaq 0x88(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x22e0
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::assemble()
void Assembler::assemble()
{   
    if(assembled==true)
        return;

    lines.clear();
    aux_lines.clear();
    errors.clear();
    warnings.clear();
    reset_pc();
    reset_data_addr();
    reset_line_cnt();

    first_pass();

    second_pass();

    generate_warnings();
    
    if(errors.empty())
    {
        generate_object_file();
        assembled = true;
    }

    if(!warnings.empty())
        warn = true;

    return ;
}

// Assembly:
cmpb $0x0, 0x128(%rdi)
jne 0x384b
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x60(%rdi), %r14
movq %r14, %rdi
callq 0x332e
movq %r14, 0x68(%rbx)
movq %r14, 0x60(%rbx)
xorl %r15d, %r15d
movq %r15, 0x70(%rbx)
leaq 0x78(%rbx), %r14
movq %r14, %rdi
callq 0x332e
movq %r14, 0x80(%rbx)
movq %r14, 0x78(%rbx)
movq %r15, 0x88(%rbx)
leaq 0xc8(%rbx), %rdi
callq 0x893c
leaq 0xf8(%rbx), %rdi
callq 0x896a
movabsq $0x40000000000, %rax    # imm = 0x40000000000
movq %rax, 0x90(%rbx)
movl $0x0, 0x98(%rbx)
movq %rbx, %rdi
callq 0x384c
movq %rbx, %rdi
callq 0x39aa
movq %rbx, %rdi
callq 0x3cb4
cmpq %r15, 0xf0(%rbx)
jne 0x3835
movq %rbx, %rdi
callq 0x3e00
movb $0x1, 0x128(%rbx)
cmpq $0x0, 0x120(%rbx)
je 0x3846
movb $0x1, 0x129(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::first_pass()
void Assembler::first_pass()
{
    string s;

    while(getline(src, s))
    {
        ++line_cnt;

        string::iterator it = s.begin();

        while(it!=s.end() && *it <= 32)     // remove leading whitespace
            ++it;
        
        string::iterator jt=it;

        while(jt!=s.end() && *jt!=';')      // remove comment part
            ++jt;

                                // removing trailing spaces -> NO NEED
        string tmp(it, jt);

        if(tmp.size()>0)    // put the non-empty line in the list
        {
            analyze(tmp);
        }

    }

    return ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
leaq 0x18(%rsp), %rbp
leaq 0x28(%rsp), %r14
leaq 0x8(%rsp), %r15
movq 0xa0(%rbx), %r12
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0x2300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3943
incl 0x98(%rbx)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rax
leaq (%rsi,%rax), %rdx
testq %rax, %rax
je 0x38e9
cmpb $0x20, (%rsi)
jg 0x38e9
incq %rsi
decq %rax
jne 0x38d7
movq %rdx, %rsi
jmp 0x3903
cmpq %rdx, %rsi
je 0x3903
movq %rsi, %rax
cmpb $0x3b, (%rax)
je 0x3900
incq %rax
cmpq %rdx, %rax
jne 0x38f1
jmp 0x3903
movq %rax, %rdx
movq %rbp, 0x8(%rsp)
movq %r15, %rdi
callq 0x8998
cmpq $0x0, 0x10(%rsp)
je 0x3923
movq %rbx, %rdi
movq %r15, %rsi
callq 0x406e
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3882
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3882
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x395a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x398a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x398a
jmp 0x3987
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x39a1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x22e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::insert_into_symtab(label&)
void Assembler::insert_into_symtab(struct label& l)
{
    if(symtab.find(l.name)!=symtab.end())
    {
        errors.insert({line_cnt, Error(7)});
    }

    else
    {
        symtab[l.name] = l;
    }
    
    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r15
callq 0x8ee2
leaq 0x8(%r15), %rcx
cmpq %rcx, %rax
je 0x63a3
leaq 0xc8(%r15), %r14
leaq 0x2c(%rsp), %rsi
movl $0x7, (%rsi)
leaq 0x7ea0(%rip), %rdi      # 0xe1f0
callq 0x82f6
leaq 0x18(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x3298
movl 0x98(%r15), %eax
leaq 0x48(%rsp), %r15
movl %eax, -0x18(%r15)
movq %r15, -0x10(%r15)
movq (%r12), %rax
cmpq %rbx, %rax
je 0x63cd
movq %rax, 0x38(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x48(%rsp)
jmp 0x63d4
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8108
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x20f0
movl 0x28(%rbx), %eax
movl %eax, 0x28(%r14)
movq 0x20(%rbx), %rax
movq %rax, 0x20(%r14)
jmp 0x642b
movups (%rbx), %xmm0
movups %xmm0, (%r15)
movq 0x10(%rsp), %rax
leaq 0x30(%rsp), %rsi
movq %rax, 0x10(%rsi)
movq %rbx, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq %r14, %rdi
callq 0x8a12
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x6414
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x642b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x6451
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x2359
movq %r14, %rdi
callq 0x22e0
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::encode_zeroth(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int const&, unsigned int const&)
unsigned Assembler::encode_zeroth(const string& s, const unsigned& opcode, const unsigned& line_no)
{
    istringstream iss(s);
    string t;

    iss>>t;     // 'dump' mnemonic

    string more;
    iss>>more;

    if(!more.empty())   // more operands than required
    {
        errors.insert({line_no, Error(6)});
        return 0xffffffff;
    }

    return opcode;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rbx
leaq 0x90(%rsp), %r12
movq %r12, %rdi
movl $0x8, %edx
callq 0x22d0
leaq 0x80(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
leaq 0x70(%rsp), %rsi
movq %r12, %rdi
callq 0x2230
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x2230
cmpq $0x0, 0x30(%rsp)
je 0x654f
leaq 0x24(%rsp), %rsi
movl $0x6, (%rsi)
leaq 0x7cf2(%rip), %rdi      # 0xe1f0
callq 0x82f6
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0x3298
addq $0xc8, %rbx
movl (%r14), %eax
leaq 0x60(%rsp), %r14
movl %eax, -0x18(%r14)
movq %r14, -0x10(%r14)
movq (%rsp), %rax
cmpq %r15, %rax
je 0x6554
movq %rax, 0x50(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x655c
movl (%r15), %ebx
jmp 0x65b6
movups (%r15), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rsp), %rax
leaq 0x48(%rsp), %rsi
movq %rax, 0x10(%rsi)
movq %r15, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rbx, %rdi
callq 0x8a12
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x659b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21c0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x65b1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x65cd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0x65e7
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x79e2(%rip), %rsi      # 0xdfd0
leaq 0x90(%rsp), %rdi
callq 0x2270
leaq 0x108(%rsp), %rdi
callq 0x20b0
movl %ebx, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x6635
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21c0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x6657
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x6657
jmp 0x6654
movq %rax, %rbx
jmp 0x666e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x666e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0x6688
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x7941(%rip), %rsi      # 0xdfd0
leaq 0x90(%rsp), %rdi
callq 0x2270
leaq 0x108(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x22e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::print_bytes(std::ostream&, unsigned int) const
void Assembler::print_bytes(ostream& os, unsigned a) const
{
    char *ptr = (char *) &a;

    if(machine_type==lil_endian)     // reverse bytes
    {
        ptr += 3;

        os.write(ptr, 1);

        ptr--;
        os.write(ptr, 1);

        ptr--;
        os.write(ptr, 1);

        ptr--;
        os.write(ptr, 1);    
    }

    else        // no need to reverse bytes
    {
        os.write(ptr, 1);

        ptr++;
        os.write(ptr, 1);

        ptr++;
        os.write(ptr, 1);

        ptr++;
        os.write(ptr, 1);
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movl %edx, 0xc(%rsp)
cmpl $0x0, 0x6889(%rip)      # 0xe250
je 0x7a06
leaq 0xc(%rsp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2250
leaq 0xd(%rsp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2250
leaq 0xe(%rsp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2250
leaq 0xf(%rsp), %rsi
jmp 0x7a41
leaq 0xf(%rsp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2250
leaq 0xe(%rsp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2250
leaq 0xd(%rsp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2250
leaq 0xc(%rsp), %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2250
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::print_errors(std::ostream&) const
void Assembler::print_errors(ostream &os) const
{
    for(map<unsigned, class Error>::const_iterator it=errors.begin(); it!=errors.end(); ++it)
    {
        unsigned line_no = it->first;

        class Error tmp = it->second;

        os<<"Line "<<line_no<<": "<<tmp.message<<endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0xe0(%rdi), %r15
addq $0xd0, %r14
cmpq %r14, %r15
je 0x7cc2
movq %rsi, %rbx
leaq 0x18(%rsp), %r13
leaq 0x245d(%rip), %rbp      # 0xa068
movl 0x20(%r15), %r12d
movq %r13, 0x8(%rsp)
movq 0x28(%r15), %rsi
movq 0x30(%r15), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x3298
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x25b7(%rip), %rsi      # 0xa1ef
callq 0x2200
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2200
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7cae
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %r15, %rdi
callq 0x2210
movq %rax, %r15
cmpq %r14, %rax
jne 0x7c0b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7ceb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x22e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::print_symtab(std::ostream&) const
void Assembler::print_symtab(ostream& os) const
{
    for(map<string, struct label>::const_iterator it=symtab.begin(); it!=symtab.end(); ++it)
    {
        string name = it->first;
        struct label l = it->second;

        os<<name<<'\t'<<l.addr<<endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0x7e07
movq %rsi, %rbx
leaq 0x18(%rsp), %r13
leaq 0x38(%rsp), %rbp
movq %r13, 0x8(%rsp)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x3298
movq %rbp, 0x28(%rsp)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x3298
movl 0x68(%r15), %eax
movl %eax, 0x18(%rbp)
movq 0x60(%r15), %rax
movq %rax, 0x10(%rbp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x2200
movb $0x9, 0x7(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7(%rsp), %rsi
callq 0x2200
movl 0x48(%rsp), %esi
movq %rax, %rdi
callq 0x2120
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7ddc
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7df3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %r15, %rdi
callq 0x2210
movq %rax, %r15
cmpq %r14, %rax
jne 0x7d23
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x7e35
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7e35
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7e4c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x22e0
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/Assembler.cpp
// Function: Assembler::print_warnings(std::ostream&) const
void Assembler::print_warnings(ostream& os) const
{
    for(map<unsigned, class Warning>::const_iterator it=warnings.begin(); it!=warnings.end(); ++it)
    {
        unsigned a = it->first;
        class Warning b = it->second;

        os<<"Line "<<a<<": "<<b.message<<endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0x110(%rdi), %r15
addq $0x100, %r14            # imm = 0x100
cmpq %r14, %r15
je 0x7f42
movq %rsi, %rbx
leaq 0x18(%rsp), %r13
leaq 0x21dd(%rip), %rbp      # 0xa068
movl 0x20(%r15), %r12d
movq %r13, 0x8(%rsp)
movq 0x28(%r15), %rsi
movq 0x30(%r15), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x3298
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x2337(%rip), %rsi      # 0xa1ef
callq 0x2200
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2120
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2200
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7f2e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %r15, %rdi
callq 0x2210
movq %rax, %r15
cmpq %r14, %rax
jne 0x7e8b
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x7f6b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x22e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/saumya-prakash[P]AssemblerEmulator/./Assembler.h
// Function: label::validate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
string validate(const string &s)    // checks for valid label name
        {
            if(isalpha(s[0])==0)    // first character should be an alphabet
                return string();
                
            for(string::const_iterator it=s.begin(); it!=s.end(); ++it)     // should consist of only alpha-numerics
                if(*it<=32 || isalnum(*it)==0)
                    return string();

            return s;
        }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %rbx
movq (%rdx), %r14
movsbl (%r14), %edi
callq 0x22b0
testl %eax, %eax
je 0x82d3
movq 0x8(%r15), %r15
testq %r15, %r15
je 0x82b9
xorl %r12d, %r12d
movsbl (%r14,%r12), %edi
cmpl $0x21, %edi
jl 0x82d3
callq 0x21d0
testl %eax, %eax
je 0x82d3
incq %r12
cmpq %r12, %r15
jne 0x829e
addq %r14, %r15
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3298
jmp 0x82e6
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/hollanderic[P]dp832/main.cpp
// Function: getDevicePathArg[abi:cxx11](int, char**)
const std::string getDevicePathArg(int argc, char** argv) {
    char opt;
    std::string result = kDefaultUSBDevicePath;
    while ((opt = getopt(argc, argv, kValidArgs.c_str())) >= 0) {
        if (opt == 'd') {
            result = string(optarg);
            break;
        }
    }

    // Reset option parser.
    optind = 1; 

    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
movq 0x3334(%rip), %rsi      # 0x6160
movq 0x3335(%rip), %rdx      # 0x6168
addq %rsi, %rdx
callq 0x375c
movq 0x32fe(%rip), %rdx      # 0x6140
movl %ebp, %edi
movq %r14, %rsi
callq 0x2080
shll $0x18, %eax
js 0x2e9b
cmpl $0x64000000, %eax       # imm = 0x64000000
jne 0x2e3b
movq 0x3161(%rip), %rax      # 0x5fc0
movq (%rax), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x371e
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2180
movq (%r14), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2e9b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2160
movq 0x3136(%rip), %rax      # 0x5fd8
movl $0x1, (%rax)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x2ecc
movq (%r15), %rsi
incq %rsi
callq 0x2160
movq %r14, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/hollanderic[P]dp832/main.cpp
// Function: isExtraMode(int, char**)
bool isExtraMode(int argc, char** argv) {
    char opt;
    bool result = false;
    while ((opt = getopt(argc, argv, kValidArgs.c_str())) >= 0) {
        if (opt == 'x') {
            result = true;
            break;
        }
    }

    // Reset option parser.
    optind = 1; 

    return result;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
movq 0x325d(%rip), %rdx      # 0x6140
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2080
shll $0x18, %eax
cmpl $0x78000000, %eax       # imm = 0x78000000
je 0x2efb
testl %eax, %eax
jns 0x2edc
testl %eax, %eax
setns %al
movq 0x30d1(%rip), %rcx      # 0x5fd8
movl $0x1, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/nanjiangshu[P]calSOV/calSOV.cpp
// Function: my_strcpy(char*, char const*, int)
int my_strcpy(char* to, const char* from, int max)/*{{{*/
/******************************************************************************
 * my modification of strcpy
 * copy max characters from "from" to "to", add NULL terminator automatically
 * updated 2008-04-23, memcpy win in speed when the copying string is long
 * updated 2011-10-27:
 *   since calling strlen will be time consuming for very large from string,
 *   e.g. when "from" is the buffer of a whole trunk of file. Therefore, strlen
 *   part is removed.
 *****************************************************************************/
{
    if(max < 200) {
        strncpy(to,from,max);
    } else {
        memcpy(to,from,max);
    }
    to[max] = '\0';
    return max;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
cmpl $0xc7, %edx
jg 0x28e0
movslq %ebx, %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x20f0
jmp 0x28ee
movl %ebx, %r15d
movq %r14, %rdi
movq %r15, %rdx
callq 0x2130
movb $0x0, (%r14,%r15)
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/nanjiangshu[P]calSOV/calSOV.cpp
// Function: rootname(char const*, char*, int)
char *rootname(const char* filename, char* rtname, int max_rtname /*= MAX_PATH*/)/*{{{*/
/*****************************************************************************
 * rootname
 * given the file name, 
 * return the rootname of the filename
 ****************************************************************************/
{
    const char *pch;
    char *pstr;
    if((pch = strrchr(filename,'/')) != NULL)
        pstr = (char*) pch+1;
    else
        pstr = (char*) filename;

    if((pch = strrchr(pstr,'.')) != NULL)
        my_strcpy(rtname,pstr, min((int)(pch - pstr), max_rtname));
    else
        rtname = pstr;
    return rtname;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r15
movl $0x2f, %esi
callq 0x21b0
leaq 0x1(%rax), %r14
testq %rax, %rax
cmoveq %r15, %r14
movq %r14, %rdi
movl $0x2e, %esi
callq 0x21b0
testq %rax, %rax
je 0x2953
subl %r14d, %eax
cmpl %ebp, %eax
cmovgel %ebp, %eax
cmpl $0xc7, %eax
jg 0x2958
movslq %eax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x20f0
jmp 0x2969
movq %r14, %rbx
jmp 0x296e
movl %eax, %r15d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2130
movb $0x0, (%rbx,%r15)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/nanjiangshu[P]calSOV/calSOV.cpp
// Function: option_parser_filename(int, char**, int, char*)
int option_parser_filename(int argc, char **argv, int beg, char *filename)/*{{{*/
/*****************************************************************************
 * beg is the current index of argument list, e.g., argv[i] = "--out"
 ****************************************************************************/
{
    int i ; 
    bool isNonOptionArg = false;
    bool isFileNameSet = false;

    for(i = beg +1 ; i < argc ; i++)
    {
        if(argv[i][0] == '-' && strcmp(argv[i], "--") != 0 && !isNonOptionArg)
        {
            fprintf(stderr,"option '%s' must be followed by a filename, not option\n", argv[beg]);
            return -1;
        }
        else if(strcmp(argv[i], "--") == 0 && !isNonOptionArg)
        {
            isNonOptionArg = true;
        }
        else
        {
            my_strcpy(filename, argv[i], MAX_PATH-1);
            isFileNameSet = true;
            break;
        }
    }

    if(!isFileNameSet)
    {
        fprintf(stderr,"option '%s' must be followed by a filename\n", argv[beg]);
        return -1;
    }
    else 
    {
        return i+1;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movslq %edx, %rcx
movslq %edi, %rdx
leal 0x2(%rcx), %r9d
leaq 0x1(%rcx), %rdi
xorl %r8d, %r8d
cmpq %rdx, %rdi
jge 0x2a04
movl %r9d, %r14d
movq (%rsi,%rdi,8), %rax
cmpb $0x2d, (%rax)
jne 0x29e2
cmpb $0x2d, 0x1(%rax)
jne 0x29b5
cmpb $0x0, 0x2(%rax)
sete %r9b
jmp 0x29b8
xorl %r9d, %r9d
orb %r8b, %r9b
testb $0x1, %r9b
je 0x2a1b
cmpb $0x2d, 0x1(%rax)
jne 0x29e2
cmpb $0x0, 0x2(%rax)
setne %r9b
orb %r9b, %r8b
leal 0x1(%r14), %r9d
incq %rdi
testb $0x1, %r8b
movb $0x1, %r8b
je 0x2994
movl $0x1f3, %edx            # imm = 0x1F3
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2130
movb $0x0, 0x1f3(%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x85cd(%rip), %rax      # 0xafd8
movq (%rax), %rdi
movq (%rsi,%rcx,8), %rdx
leaq 0x4d0a(%rip), %rsi      # 0x7723
jmp 0x2a30
movq 0x85b6(%rip), %rax      # 0xafd8
movq (%rax), %rdi
movq (%rsi,%rcx,8), %rdx
leaq 0x4cbb(%rip), %rsi      # 0x76eb
xorl %eax, %eax
callq 0x2240
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x29f9
// File: /workspace/github_cpp_makefile_star2_O3/nanjiangshu[P]calSOV/calSOV.cpp
// Function: IsNumeric(char const*)
bool IsNumeric(const char* str)/*{{{*/
//**********************************************************************
//IsNumeric(char*)
//check if a string is a numeric number
{
	int i = 0;
    int cntdot = 0;
	while(str[i] != '\0')
	{
        if( i == 0)
        {
            if(!isdigit(str[i]) && str[i] != '+' && str[i] != '-' && str[i] != '.' )
                return false;
            if(str[i] == '.')
                cntdot ++;
        }
        else
        {
            if(! isdigit(str[i]) && str[i] != '.')
                return false;
            if(str[i] == '.')
                cntdot ++;
        }
        i ++;
	}
    if(cntdot >= 2)
        return false;
    else 
        return true;
}

// Assembly:
movb (%rdi), %r8b
testb %r8b, %r8b
je 0x2ab1
xorl %ecx, %ecx
movabsq $0x680000000000, %rdx   # imm = 0x680000000000
xorl %esi, %esi
movsbl %r8b, %eax
addl $-0x30, %eax
testq %rcx, %rcx
je 0x2a7a
cmpl $0xa, %eax
setae %r9b
cmpb $0x2e, %r8b
sete %al
setne %r8b
testb %r9b, %r8b
je 0x2a98
jmp 0x2ab4
cmpl $0xa, %eax
jb 0x2a91
xorl %eax, %eax
cmpb $0x2e, %r8b
ja 0x2ab0
movzbl %r8b, %r9d
btq %r9, %rdx
jae 0x2ab0
cmpb $0x2e, %r8b
sete %al
movzbl %al, %eax
addl %eax, %esi
movb 0x1(%rdi,%rcx), %r8b
incq %rcx
testb %r8b, %r8b
jne 0x2a55
cmpl $0x2, %esi
setb %al
retq
movb $0x1, %al
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/nanjiangshu[P]calSOV/calSOV.cpp
// Function: fgetline(_IO_FILE*, char*, int)
int fgetline(FILE* fp, char* line, int max/* = 0x7FFFFFFF*/)/*{{{*/
/*****************************************************************************
 * Read one line from fp, copying it to line array (but no more than max
 * chars). Does not place terminating \n in line array.  
 * it can be called without "max" flag, but should make sure the allocated
 * memory for "line" is larger than the longest line.
 *
 * Returns: line length, or 0 for empty line, or "EOF" for end-of-file.
 * 
 * since fgetc(), getc(), getchar(), returns int value,always use an int
 * variable to store the result of the fgetc(), getc() and getchar().  
 * getc() is faster than fgetc()
 *   LOG: 2006-04-26 16:31:29 Wednesday  Week 17 <nanjiang@shu>
 *   bug fixed for '\n' return keys, 
 *   now it is valid for both dos and unix
 ****************************************************************************/
{
    int nch = 0; /* record number of characters actually read */
    int c;
    max = max - 1;			/* leave room for '\0' */
    while((c = getc(fp)) != EOF)
    {
        if(c == 0x0d ) continue; /* in unix, '\n'= 0x0a, thus 0x0d will be cheated as another character*/ 
        if(c == '\n') break; /* in dos, '\n' is also equal to 0x0a, but the preceding 0x0d will not be read*/ 

        if(nch < max)
        {
            line[nch] = c;
            nch = nch + 1;
        }
    }
    line[nch] = '\0';

    if(c == EOF && nch == 0) return EOF;
    else return nch;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
decl %ebp
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x20c0
cmpl $0xd, %eax
je 0x2c69
cmpl $-0x1, %eax
je 0x2c90
cmpl $0xa, %eax
je 0x2c90
cmpl %ebp, %r15d
jge 0x2c69
movl %r15d, %ecx
movb %al, (%rbx,%rcx)
incl %r15d
jmp 0x2c69
movl %r15d, %ecx
movb $0x0, (%rbx,%rcx)
notl %eax
orl %r15d, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnel %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/nanjiangshu[P]calSOV/calSOV.cpp
// Function: IsInCharSet(char, char const*, int)
bool IsInCharSet(const char ch, const char *charSet, int n /*= 0 */)/*{{{*/
/*****************************************************************************
 * check if the character "ch" is in charSet,
 ****************************************************************************/
{
	if(n == 0)
        n = strlen(charSet);
    int i;
	for(i = 0 ;i < n ; i ++)
	{
		if(ch == charSet[i])
			return true;
	}
	return false;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
testl %edx, %edx
jne 0x2cc7
movq %rbx, %rdi
callq 0x20e0
movq %rax, %rdx
testl %edx, %edx
jle 0x2cf3
movb $0x1, %al
cmpb %bpl, (%rbx)
je 0x2cf5
movl %edx, %eax
movl $0x1, %edx
movq %rdx, %rcx
cmpq %rdx, %rax
je 0x2ceb
leaq 0x1(%rcx), %rdx
cmpb %bpl, (%rbx,%rcx)
jne 0x2cd9
cmpq %rax, %rcx
setb %al
jmp 0x2cf5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/nanjiangshu[P]calSOV/calSOV.cpp
// Function: GetRawHSRConfidence(int, int, int)
double GetRawHSRConfidence(int probH, int probS, int probR)/*{{{*/
/*Determine raw confidence of the prediction based on the probability on H, S
 * and R
 * 2009-07-21, Nanjiang*/
{
    double sumHSR =  double(probH+probS+probR) + 1e-6; /*plus 1e-6 to avoid division by zero*/
    double maxHSR =  double (max (max(probH, probS), probR ));
    double rawConf = maxHSR/sumHSR;
    return rawConf;
}

// Assembly:
leal (%rsi,%rdi), %eax
addl %edx, %eax
cvtsi2sd %eax, %xmm1
addsd 0x42d8(%rip), %xmm1     # 0x7008
cmpl %esi, %edi
cmovgl %edi, %esi
cmpl %edx, %esi
cmovlel %edx, %esi
cvtsi2sd %esi, %xmm0
divsd %xmm1, %xmm0
retq