// File: /workspace/github_c_makefile_star2_O1/Encryptr[P]O-plus-plus/opp/ir/ir.c
// Function: oppir_eval_const
static void oppir_eval_const(struct OppIr* ir, struct OppIr_Const* imm)
{
	enum Regs reg_type;

	if (!imm->nopush) {
		enum OppIr_Const_Type t;

		if (imm->loc_type == 0)
			t = imm->val.type;
		else
			t = imm->loc_type;

		reg_type = oppir_push_reg(ir, t);
	}
	else
		reg_type = REG_RAX;

	if (imm->val.type == IMM_SYM) {
		oppir_eval_sym(ir, reg_type, imm);
	}
	else if (imm->val.type > IMM_LOC && imm->val.type < IMM_F32) {
		oppir_check_realloc(ir, 2);
		imm->val.type = IMM_I64;
		ir->code.bytes[ir->code.idx++] = 0x48;
		ir->code.bytes[ir->code.idx++] = 0xb8 + reg_type;
	}
	else if (imm->val.type > IMM_I64) {
		oppir_eval_float(ir, reg_type, imm);
	}
	else if (imm->val.type == IMM_LOC) {
		oppir_write_reg(ir, reg_type, imm);
	}
	else if (imm->val.type == IMM_STR) {
		oppir_gen_label();
		make_global_sym((char*)a_label, ir->data_seg.idx, 0);
		oppir_write_data(ir, strlen(imm->val.imm_sym), imm->val.imm_sym);
		oppir_check_realloc(ir, 7);
		IR_EMIT(0x48);
		IR_EMIT(0x8d);
		IR_EMIT(0x05 + (reg_type*8));
		make_reloc(ir->code.idx, (char*)a_label, 2);
		imm->val.type = IMM_I32;
		imm->val.imm_i32 = 0;
	}

	oppir_write_const(ir, &imm->val);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %ebp, %ebp
cmpb $0x0, 0x14(%rsi)
jne 0x692f
movl 0x10(%rbx), %esi
testl %esi, %esi
jne 0x6925
movl (%rbx), %esi
movq %r14, %rdi
callq 0x6f0f
movl %eax, %ebp
movl (%rbx), %eax
testl %eax, %eax
je 0x6983
leal -0x3(%rax), %ecx
cmpl $0x7, %ecx
ja 0x69e8
movq %r14, %rdi
movl $0x2, %esi
callq 0x686f
movl $0xa, (%rbx)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0x48, (%rax,%rcx)
addb $-0x48, %bpl
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb %bpl, (%rax,%rcx)
jmp 0x6ba3
movq %r14, %rdi
movl $0x3, %esi
callq 0x686f
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0x48, (%rax,%rcx)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $-0x75, (%rax,%rcx)
shlb $0x3, %bpl
orb $0x5, %bpl
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb %bpl, (%rax,%rcx)
movl 0x8(%r14), %edi
movq 0x8(%rbx), %rsi
movl $0x9, %edx
callq 0x7854
jmp 0x6b96
cmpl $0xb, %eax
jb 0x6a2c
movq %r14, %rdi
movl $0x8, %esi
callq 0x686f
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
cmpl $0xc, (%rbx)
movq %rdx, 0x8(%r14)
jne 0x6aee
movb $-0xe, (%rax,%rcx)
movsd 0x8(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x7, %r15d
jmp 0x6b03
cmpl $0x1, %eax
je 0x6bba
cmpl $0x2, %eax
jne 0x6ba3
movl 0x8(%rbx), %r15d
xorl %eax, %eax
cmpl $-0x7f, %r15d
setl %al
leal 0x4(,%rax,4), %eax
movl %eax, (%rbx)
movq %r14, %rdi
movl $0x8, %esi
callq 0x686f
movl 0x10(%rbx), %eax
addl $-0x3, %eax
cmpl $0x9, %eax
ja 0x6cfa
leaq 0x586d(%rip), %rcx      # 0xc2e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0x48, (%rax,%rcx)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
cmpl $0x8, 0x10(%rbx)
movq %rdx, 0x8(%r14)
movl $0x63, %edx
movl $0xf, %esi
cmovel %edx, %esi
movb %sil, (%rax,%rcx)
movl 0x10(%rbx), %eax
addl $-0x3, %eax
cmpl $0x3, %eax
ja 0x6cfa
leaq 0x583f(%rip), %rcx      # 0xc30c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $-0x49, (%rax,%rcx)
jmp 0x6cfa
movb $-0xd, (%rax,%rcx)
cvtsd2ss 0x8(%rbx), %xmm0
movss %xmm0, 0x8(%rsp)
movl $0x3, %r15d
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0xf, (%rax,%rcx)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0x10, (%rax,%rcx)
addb $0x2, %bpl
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb %bpl, (%rax,%rcx)
movl 0x969a(%rip), %edx      # 0x101e0
leaq 0x968b(%rip), %r12      # 0x101d8
leaq 0x587f(%rip), %rsi      # 0xc3d3
movq %r12, %rdi
xorl %eax, %eax
callq 0x1200
incl 0x967c(%rip)            # 0x101e0
movq 0x88(%r14), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x77bf
movl 0x8(%r14), %edi
movq %r12, %rsi
movl $0x2, %edx
callq 0x7854
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
movl %r15d, %esi
callq 0x7049
movl $0x8, (%rbx)
movl $0x0, 0x8(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x709f
movl 0x9620(%rip), %edx      # 0x101e0
leaq 0x9611(%rip), %r15      # 0x101d8
leaq 0x5805(%rip), %rsi      # 0xc3d3
movq %r15, %rdi
xorl %eax, %eax
callq 0x1200
incl 0x9602(%rip)            # 0x101e0
movq 0x88(%r14), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x77bf
movq 0x8(%rbx), %r12
movq %r12, %rdi
callq 0x10b0
movq %r14, %rdi
movl %eax, %esi
movq %r12, %rdx
callq 0x7049
movq %r14, %rdi
movl $0x7, %esi
callq 0x686f
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0x48, (%rax,%rcx)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $-0x73, (%rax,%rcx)
shlb $0x3, %bpl
orb $0x5, %bpl
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb %bpl, (%rax,%rcx)
movl 0x8(%r14), %edi
movq %r15, %rsi
movl $0x2, %edx
jmp 0x69de
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0x48, (%rax,%rcx)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $-0x75, (%rax,%rcx)
jmp 0x6cfa
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $-0x42, (%rax,%rcx)
jmp 0x6cfa
movb $-0xe, %al
jmp 0x6cbf
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $-0x41, (%rax,%rcx)
jmp 0x6cfa
movb $-0xd, %al
movq (%r14), %rcx
movq 0x8(%r14), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%r14)
movb %al, (%rcx,%rdx)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0xf, (%rax,%rcx)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
movb $0x10, (%rax,%rcx)
addl $-0x3, %ebp
shlb $0x3, %bpl
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
cmpl $-0x7f, %r15d
jl 0x6d1c
addb $0x45, %bpl
jmp 0x697a
addb $-0x7b, %bpl
jmp 0x697a