// File: /workspace/github_c_makefile_star2_O0/sharmaeklavya2[P]cerplag/parser.c
// Function: copy_symbol
void copy_symbol(Symbol* symb, const Token* tok)
{
    symb->line = tok->line;
    symb->col = tok->col;
    symb->sid = tok->tid;
    symb->f = tok->f;
    symb->tree = symb->next = symb->driver = NULL;
    int sid = symb->sid;
    if(sid == T_ERR || sid == T_EOF) {
        symb->lexeme = NULL;
        fprintf(stderr, "copy_symbol: Bad token type assigned to a symbol\n");
    }
    else if(sid == T_ID) {
        pch_int_hmap_node* pnode = pch_int_hmap_insert(&intern_table, tok->lexeme, intern_counter);
        if(pnode->key == tok->lexeme) {
            // this means the lexeme wasn't already present in intern_table
            symb->lexeme = malloc(sizeof(char) * (tok->size + 1));
            strcpy(symb->lexeme, tok->lexeme);
            pnode->key = symb->lexeme;
            intern_counter++;
            //fprintf(stderr, "new insert %p(\"%s\"): %d\n", pnode->key, pnode->key, pnode->value);
        }
        else {
            symb->lexeme = (char*)pnode->key;
            //fprintf(stderr, "already present %p(\"%s\"): %d\n", pnode->key, pnode->key, pnode->value);
        }
    }
    else if(sid == T_NUM || sid == T_RNUM) {
        symb->lexeme = NULL;
    }
    else {
        symb->lexeme = TOK_STRS2[sid];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movss 0x1c(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x14(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x6664
cmpl $0x1, -0x14(%rbp)
jne 0x668d
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
movq 0x13981(%rip), %rax     # 0x19ff8
movq (%rax), %rdi
leaq 0xe132(%rip), %rsi      # 0x147b3
movb $0x0, %al
callq 0x3120
jmp 0x6765
cmpl $0x2, -0x14(%rbp)
jne 0x6730
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movl 0x1560f(%rip), %edx     # 0x1bcb4
leaq 0x1560c(%rip), %rdi     # 0x1bcb8
callq 0x35c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x671e
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x0, %rdi
callq 0x3130
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3050
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movl 0x155a1(%rip), %eax     # 0x1bcb4
addl $0x1, %eax
movl %eax, 0x15598(%rip)     # 0x1bcb4
jmp 0x672e
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x6763
cmpl $0x3, -0x14(%rbp)
je 0x673c
cmpl $0x4, -0x14(%rbp)
jne 0x674a
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0x6761
movslq -0x14(%rbp), %rcx
leaq 0x13beb(%rip), %rax     # 0x1a340
movq (%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x6763
jmp 0x6765
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)