// File: Eronana[P]strawberry/src/ast_codegen.cpp
// Function: AST_PrefixExpression::codeGen(Symbol*)
DEF_AST_METHOD(PrefixExpression,AST_CODEGEN)
{
    bool isIdentifier=is_identifier(expr);
    if(isIdentifier)loadVariant(symbol,expr);
    else CODEGEN(expr);

    if(GET_LITERAL(optr).type==TOKEN_INCREMENT||GET_LITERAL(optr).type==TOKEN_DECREMENT)
    {
        if(GET_LITERAL(optr).type==TOKEN_INCREMENT)PRINTF("inc\n");
        else PRINTF("dec\n");
        if(isIdentifier)storeVariant(symbol,expr);
        else PRINTF("object_reset\n");
        return;
    }

    switch(GET_LITERAL(optr).type)
    {
        case TOKEN_ADD:
            PRINTF("pos\n");
            break;
        case TOKEN_SUB:
            PRINTF("neg\n");
            break;
        case TOKEN_BITWISE_NOT:
            PRINTF("bnot\n");
            break;
        case TOKEN_NEGATION:
            PRINTF("lnot\n");
            break;
        default:
            PRINTF("typeof\n");
            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
addq $0x8, %rdi
callq 0x52300
andb $0x1, %al
movb %al, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
je 0x533df
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdi
addq $0x8, %rsi
callq 0x554c0
jmp 0x533f9
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x8f60
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xabd0
cmpl $0x2, 0x8(%rax)
je 0x53423
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xabd0
cmpl $0x5, 0x8(%rax)
jne 0x534cb
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xabd0
cmpl $0x2, 0x8(%rax)
jne 0x5345f
movl 0x377d4(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x377cb(%rip)     # 0x8ac10
leaq 0x3749c(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x63e1(%rip), %rsi      # 0x59837
movb $0x0, %al
callq 0x74c0
jmp 0x53486
movl 0x377ab(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x377a2(%rip)     # 0x8ac10
leaq 0x37473(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x63bd(%rip), %rsi      # 0x5983c
movb $0x0, %al
callq 0x74c0
testb $0x1, -0x11(%rbp)
je 0x5349f
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdi
addq $0x8, %rsi
callq 0x55530
jmp 0x534c6
movl 0x3776b(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x37762(%rip)     # 0x8ac10
leaq 0x37433(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x6382(%rip), %rsi      # 0x59841
movb $0x0, %al
callq 0x74c0
jmp 0x535cf
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
callq 0xabd0
movl 0x8(%rax), %eax
addl $-0x4, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x1a, %eax
ja 0x535a8
movq -0x28(%rbp), %rax
leaq 0x60dc(%rip), %rcx      # 0x595d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x37709(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x37700(%rip)     # 0x8ac10
leaq 0x373d1(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x632e(%rip), %rsi      # 0x5984f
movb $0x0, %al
callq 0x74c0
jmp 0x535cf
movl 0x376dd(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x376d4(%rip)     # 0x8ac10
leaq 0x373a5(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x6307(%rip), %rsi      # 0x59854
movb $0x0, %al
callq 0x74c0
jmp 0x535cf
movl 0x376b4(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x376ab(%rip)     # 0x8ac10
leaq 0x3737c(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x62e3(%rip), %rsi      # 0x59859
movb $0x0, %al
callq 0x74c0
jmp 0x535cf
movl 0x3768b(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x37682(%rip)     # 0x8ac10
leaq 0x37353(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x62c0(%rip), %rsi      # 0x5985f
movb $0x0, %al
callq 0x74c0
jmp 0x535cf
movl 0x37662(%rip), %eax     # 0x8ac10
addl $0x1, %eax
movl %eax, 0x37659(%rip)     # 0x8ac10
leaq 0x3732a(%rip), %rax     # 0x8a8e8
movq (%rax), %rdi
leaq 0x629d(%rip), %rsi      # 0x59865
movb $0x0, %al
callq 0x74c0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)