// File: AndrewAlbert[P]Compiler-Theory/SourceCode/codeGenerator.cpp
// Function: codeGenerator::NotOnRegister(int, int)
void codeGenerator::NotOnRegister( int type, int size ){
	if( !ShouldGenerate() ) return;
	string reg;
	comment("Not Operation on Register");
	
	//Ensure size is at least 1 for the loops
	if( size == 0 ) size++;
	
	for( int i = 0; i < size; i++ ){
		reg = popStack('E', type);
		pushStack( reg, 'R', type );
	}
	for( int i = 0; i < size; i++ ){
		reg = popStack('R', type);
		pushStack(reg, 'E', type);
		if( type == TYPE_BOOL ){
			// boolean not
			fprintf( oFile, "   %s = !( %s );\n", reg.c_str(), reg.c_str() );
		}
		else if( type == TYPE_INTEGER ){
			// bitwise not
			fprintf( oFile, "   %s = ~( %s );\n", reg.c_str(), reg.c_str() );
		}
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x19590
testb $0x1, %al
jne 0x1be3e
jmp 0x1c127
leaq -0x30(%rbp), %rdi
callq 0x3370
leaq -0x51(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x3430
movq -0x100(%rbp), %rdx
leaq 0xb2ca(%rip), %rsi      # 0x2712f
leaq -0x50(%rbp), %rdi
callq 0x62d0
jmp 0x1be70
movq -0xf8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x19bb0
leaq -0x50(%rbp), %rdi
callq 0x31a0
leaq -0x51(%rbp), %rdi
callq 0x32e0
cmpl $0x0, -0x10(%rbp)
jne 0x1bebf
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1bebf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x51(%rbp), %rdi
callq 0x32e0
jmp 0x1c11c
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x1bf93
movq -0xf8(%rbp), %rsi
movl -0xc(%rbp), %ecx
leaq -0x88(%rbp), %rdi
movl $0x45, %edx
callq 0x1a7a0
jmp 0x1beef
leaq -0x30(%rbp), %rdi
movq %rdi, -0x108(%rbp)
leaq -0x88(%rbp), %rsi
movq %rsi, -0x110(%rbp)
callq 0x3340
movq -0x110(%rbp), %rdi
callq 0x31a0
movq -0x108(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x3130
jmp 0x1bf2e
movq -0xf8(%rbp), %rdi
movl -0xc(%rbp), %ecx
leaq -0xa8(%rbp), %rsi
movl $0x52, %edx
callq 0x1a6b0
jmp 0x1bf4b
leaq -0xa8(%rbp), %rdi
callq 0x31a0
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x1bec6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x1c11c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x31a0
jmp 0x1c11c
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x1c111
movq -0xf8(%rbp), %rsi
movl -0xc(%rbp), %ecx
leaq -0xd0(%rbp), %rdi
movl $0x52, %edx
callq 0x1a7a0
jmp 0x1bfc9
leaq -0x30(%rbp), %rdi
movq %rdi, -0x118(%rbp)
leaq -0xd0(%rbp), %rsi
movq %rsi, -0x120(%rbp)
callq 0x3340
movq -0x120(%rbp), %rdi
callq 0x31a0
movq -0x118(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x3130
jmp 0x1c008
movq -0xf8(%rbp), %rdi
movl -0xc(%rbp), %ecx
leaq -0xf0(%rbp), %rsi
movl $0x45, %edx
callq 0x1a6b0
jmp 0x1c025
leaq -0xf0(%rbp), %rdi
callq 0x31a0
cmpl $0x10c, -0xc(%rbp)      # imm = 0x10C
jne 0x1c0a3
movq -0xf8(%rbp), %rax
movq 0x308(%rax), %rax
movq %rax, -0x130(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3120
movq %rax, -0x128(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3120
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rdx
movq %rax, %rcx
leaq 0xb0c9(%rip), %rsi      # 0x27149
movb $0x0, %al
callq 0x3380
jmp 0x1c0fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x31a0
jmp 0x1c11c
cmpl $0x10a, -0xc(%rbp)      # imm = 0x10A
jne 0x1c0f9
movq -0xf8(%rbp), %rax
movq 0x308(%rax), %rax
movq %rax, -0x140(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3120
movq %rax, -0x138(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3120
movq -0x140(%rbp), %rdi
movq -0x138(%rbp), %rdx
movq %rax, %rcx
leaq 0xb069(%rip), %rsi      # 0x2715b
movb $0x0, %al
callq 0x3380
jmp 0x1c0fb
jmp 0x1c0fd
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x1bf9d
leaq -0x30(%rbp), %rdi
callq 0x31a0
jmp 0x1c127
leaq -0x30(%rbp), %rdi
callq 0x31a0
jmp 0x1c130
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x3420
nopl (%rax)