// File: SMT-COMP[P]scrambler/scrambler.cpp
// Function: get_named_annot(scrambler::node*)
std::string get_named_annot(scrambler::node *root)
{
    std::vector<scrambler::node *> to_process;
    std::unordered_set<scrambler::node *> seen;

    to_process.push_back(root);
    while (!to_process.empty()) {
        scrambler::node *cur = to_process.back();
        to_process.pop_back();

        if (!seen.insert(cur).second) {
            continue;
        }
        if (cur->symbol == "!") {
            if (cur->children.size() >= 1) {
                to_process.push_back(cur->children[0]);
            }
            if (cur->children.size() >= 2) {
                for (size_t j = 1; j < cur->children.size(); ++j) {
                    scrambler::node *attr = cur->children[j];
                    if (attr->symbol == ":named" &&
                        !attr->children.empty()) {
                        return attr->children[0]->symbol;
                    }
                }
            }
        } else {
            for (size_t j = 0; j < cur->children.size(); ++j) {
                to_process.push_back(cur->children[j]);
            }
        }
    }

    return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0xd8(%rbp)
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x7290
leaq -0x60(%rbp), %rdi
callq 0x7a90
movq -0xc8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x7340
jmp 0x5bbf
jmp 0x5bc1
leaq -0x28(%rbp), %rdi
callq 0x73b0
xorb $-0x1, %al
testb $0x1, %al
jne 0x5bd5
jmp 0x5e2f
leaq -0x28(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x7ab0
movq -0xf0(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x78(%rbp)
callq 0x7af0
leaq -0x60(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x7b20
movb %dl, -0xe1(%rbp)
movq %rax, -0xe0(%rbp)
jmp 0x5c14
movb -0xe1(%rbp), %al
movq -0xe0(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movb %al, -0x90(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x88(%rbp)
movb -0x90(%rbp), %al
movb %al, -0x80(%rbp)
movb -0x80(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5c50
jmp 0x5c66
jmp 0x5bc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5eb2
movq -0x78(%rbp), %rdi
leaq 0x1363d(%rip), %rsi     # 0x192ae
callq 0x74e0
movb %al, -0xf1(%rbp)
jmp 0x5c7e
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x5c8d
jmp 0x5dbb
movq -0x78(%rbp), %rdi
addq $0x10, %rdi
callq 0x7430
cmpq $0x1, %rax
jb 0x5cc1
movq -0x78(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7450
movq %rax, %rsi
leaq -0x28(%rbp), %rdi
callq 0x7340
jmp 0x5cbf
jmp 0x5cc1
movq -0x78(%rbp), %rdi
addq $0x10, %rdi
callq 0x7430
cmpq $0x2, %rax
jb 0x5db9
movq $0x1, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x78(%rbp), %rdi
addq $0x10, %rdi
callq 0x7430
movq %rax, %rcx
movq -0x100(%rbp), %rax
cmpq %rcx, %rax
jae 0x5db7
movq -0x78(%rbp), %rdi
addq $0x10, %rdi
movq -0xa0(%rbp), %rsi
callq 0x7450
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
leaq 0x13666(%rip), %rsi     # 0x193a3
callq 0x74e0
movb %al, -0x101(%rbp)
jmp 0x5d4a
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x5d56
jmp 0x5d9e
movq -0xa8(%rbp), %rdi
addq $0x10, %rdi
callq 0x73b0
testb $0x1, %al
jne 0x5d9e
movq -0xa8(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7450
movq -0xd8(%rbp), %rdi
movq (%rax), %rsi
callq 0x3160
jmp 0x5d8f
movl $0x1, -0xac(%rbp)
jmp 0x5e90
jmp 0x5da0
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x5ce3
jmp 0x5db9
jmp 0x5e2a
movq $0x0, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x78(%rbp), %rdi
addq $0x10, %rdi
callq 0x7430
movq %rax, %rcx
movq -0x110(%rbp), %rax
cmpq %rcx, %rax
jae 0x5e28
movq -0x78(%rbp), %rdi
addq $0x10, %rdi
movq -0xb8(%rbp), %rsi
callq 0x7450
movq %rax, %rsi
leaq -0x28(%rbp), %rdi
callq 0x7340
jmp 0x5e12
jmp 0x5e14
movq -0xb8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x5dc6
jmp 0x5e2a
jmp 0x5bc1
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x3470
movq -0xd8(%rbp), %rdi
movq -0x118(%rbp), %rdx
leaq 0x13b07(%rip), %rsi     # 0x1995e
callq 0x32b0
jmp 0x5e5e
leaq -0xb9(%rbp), %rdi
callq 0x32a0
movl $0x1, -0xac(%rbp)
jmp 0x5e90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xb9(%rbp), %rdi
callq 0x32a0
jmp 0x5eb2
leaq -0x60(%rbp), %rdi
callq 0x7b60
leaq -0x28(%rbp), %rdi
callq 0x72b0
movq -0xd0(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x7b60
leaq -0x28(%rbp), %rdi
callq 0x72b0
movq -0x68(%rbp), %rdi
callq 0x3460
nopl (%rax)