// File: /workspace/github_c_makefile_star2_O0/mmcco[P]sljit/sljit_src/sljitNativeX86_common.c
// Function: sljit_generate_code
void* sljit_generate_code(struct sljit_compiler *compiler)
{
	struct sljit_memory_fragment *buf;
	u_char *code;
	u_char *code_ptr;
	u_char *buf_ptr;
	u_char *buf_end;
	u_char len;

	struct sljit_label *label;
	struct sljit_jump *jump;
	struct sljit_const *const_;

	CHECK_ERROR_PTR();
	CHECK_PTR(check_sljit_generate_code(compiler));
	reverse_buf(compiler);

	/* Second code generation pass. */
	code = (u_char*)SLJIT_MALLOC_EXEC(compiler->size);
	PTR_FAIL_WITH_EXEC_IF(code);
	buf = compiler->buf;

	code_ptr = code;
	label = compiler->labels;
	jump = compiler->jumps;
	const_ = compiler->consts;
	do {
		buf_ptr = buf->memory;
		buf_end = buf_ptr + buf->used_size;
		do {
			len = *buf_ptr++;
			if (len > 0) {
				/* The code is already generated. */
				memmove(code_ptr, buf_ptr, len);
				code_ptr += len;
				buf_ptr += len;
			}
			else {
				if (*buf_ptr >= 4) {
					jump->addr = (unsigned long)code_ptr;
					if (!(jump->flags & SLJIT_REWRITABLE_JUMP))
						code_ptr = generate_near_jump_code(jump, code_ptr, code, *buf_ptr - 4);
					else
						code_ptr = generate_far_jump_code(jump, code_ptr, *buf_ptr - 4);
					jump = jump->next;
				}
				else if (*buf_ptr == 0) {
					label->addr = (unsigned long)code_ptr;
					label->size = code_ptr - code;
					label = label->next;
				}
				else if (*buf_ptr == 1) {
					const_->addr = ((unsigned long)code_ptr) - sizeof(long);
					const_ = const_->next;
				}
				else {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
					*code_ptr++ = (*buf_ptr == 2) ? CALL_i32 : JMP_i32;
					buf_ptr++;
					*(long*)code_ptr = *(long*)buf_ptr - ((long)code_ptr + sizeof(long));
					code_ptr += sizeof(long);
					buf_ptr += sizeof(long) - 1;
#else
					code_ptr = generate_fixed_jump(code_ptr, *(long*)(buf_ptr + 1), *buf_ptr);
					buf_ptr += sizeof(long);
#endif
				}
				buf_ptr++;
			}
		} while (buf_ptr < buf_end);
		SLJIT_ASSERT(buf_ptr == buf_end);
		buf = buf->next;
	} while (buf);

	SLJIT_ASSERT(!label);
	SLJIT_ASSERT(!jump);
	SLJIT_ASSERT(!const_);

	jump = compiler->jumps;
	while (jump) {
		if (jump->flags & PATCH_MB) {
			SLJIT_ASSERT((long)(jump->u.label->addr - (jump->addr + sizeof(s_char))) >= -128 && (long)(jump->u.label->addr - (jump->addr + sizeof(s_char))) <= 127);
			*(u_char*)jump->addr = (u_char)(jump->u.label->addr - (jump->addr + sizeof(s_char)));
		} else if (jump->flags & PATCH_MW) {
			if (jump->flags & JUMP_LABEL) {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
				*(long*)jump->addr = (long)(jump->u.label->addr - (jump->addr + sizeof(long)));
#else
				SLJIT_ASSERT((long)(jump->u.label->addr - (jump->addr + sizeof(int))) >= HALFWORD_MIN && (long)(jump->u.label->addr - (jump->addr + sizeof(int))) <= HALFWORD_MAX);
				*(int*)jump->addr = (int)(jump->u.label->addr - (jump->addr + sizeof(int)));
#endif
			}
			else {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
				*(long*)jump->addr = (long)(jump->u.target - (jump->addr + sizeof(long)));
#else
				SLJIT_ASSERT((long)(jump->u.target - (jump->addr + sizeof(int))) >= HALFWORD_MIN && (long)(jump->u.target - (jump->addr + sizeof(int))) <= HALFWORD_MAX);
				*(int*)jump->addr = (int)(jump->u.target - (jump->addr + sizeof(int)));
#endif
			}
		}
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
		else if (jump->flags & PATCH_MD)
			*(long*)jump->addr = jump->u.label->addr;
#endif

		jump = jump->next;
	}

	/* Maybe we waste some space because of short jumps. */
	SLJIT_ASSERT(code_ptr <= code + compiler->size);
	compiler->error = SLJIT_ERR_COMPILED;
	compiler->executable_size = code_ptr - code;
	return code;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x19092
movq $0x0, -0x8(%rbp)
jmp 0x195ca
jmp 0x19094
movq -0x10(%rbp), %rdi
callq 0x195e0
movq -0x10(%rbp), %rdi
callq 0x19670
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x18520
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x190d5
movq -0x10(%rbp), %rax
movl $0x3, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0x195ca
jmp 0x190d7
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
addq 0x8(%rcx), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0x0, %eax
jle 0x19184
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movzbl -0x39(%rbp), %eax
movl %eax, %edx
callq 0x2100
movzbl -0x39(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movzbl -0x39(%rbp), %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x19295
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x4, %eax
jl 0x191fc
movq -0x28(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
andq $0x1000, %rax           # imm = 0x1000
cmpq $0x0, %rax
jne 0x191d1
movq -0x50(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
subl $0x4, %ecx
callq 0x196d0
movq %rax, -0x28(%rbp)
jmp 0x191ec
movq -0x50(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rax
movzbl (%rax), %edx
subl $0x4, %edx
callq 0x19900
movq %rax, -0x28(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x19289
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x19234
movq -0x28(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x19287
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x1925d
movq -0x28(%rbp), %rcx
subq $0x8, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x19285
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x1(%rax), %rsi
movq -0x30(%rbp), %rax
movzbl (%rax), %edx
callq 0x19a20
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x19287
jmp 0x19289
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x19297
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jb 0x1912b
jmp 0x192a7
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0x192c9
leaq 0x17536(%rip), %rdi     # 0x307ee
movl $0x204, %esi            # imm = 0x204
movb $0x0, %al
callq 0x2070
callq 0x2040
jmp 0x192cb
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1910f
jmp 0x192e3
cmpq $0x0, -0x48(%rbp)
je 0x19302
leaq 0x174fd(%rip), %rdi     # 0x307ee
movl $0x208, %esi            # imm = 0x208
movb $0x0, %al
callq 0x2070
callq 0x2040
jmp 0x19304
jmp 0x19306
cmpq $0x0, -0x50(%rbp)
je 0x19325
leaq 0x174da(%rip), %rdi     # 0x307ee
movl $0x209, %esi            # imm = 0x209
movb $0x0, %al
callq 0x2070
callq 0x2040
jmp 0x19327
jmp 0x19329
cmpq $0x0, -0x58(%rbp)
je 0x19348
leaq 0x174b7(%rip), %rdi     # 0x307ee
movl $0x20a, %esi            # imm = 0x20A
movb $0x0, %al
callq 0x2070
callq 0x2040
jmp 0x1934a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x19574
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
je 0x19401
jmp 0x19379
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x1, %rcx
subq %rcx, %rax
cmpq $-0x80, %rax
jl 0x193bb
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x1, %rcx
subq %rcx, %rax
cmpq $0x7f, %rax
jle 0x193d3
leaq 0x1742c(%rip), %rdi     # 0x307ee
movl $0x20f, %esi            # imm = 0x20F
movb $0x0, %al
callq 0x2070
callq 0x2040
jmp 0x193d5
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x1, %rcx
subq %rcx, %rax
movb %al, %cl
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movb %cl, (%rax)
jmp 0x19564
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
andq $0x8, %rax
cmpq $0x0, %rax
je 0x19537
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x194b8
jmp 0x1942f
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x4, %rcx
subq %rcx, %rax
cmpq $-0x80000000, %rax      # imm = 0x80000000
jl 0x19475
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x4, %rcx
subq %rcx, %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jle 0x1948d
leaq 0x17372(%rip), %rdi     # 0x307ee
movl $0x216, %esi            # imm = 0x216
movb $0x0, %al
callq 0x2070
callq 0x2040
jmp 0x1948f
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x4, %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, (%rax)
jmp 0x19535
jmp 0x194ba
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x4, %rcx
subq %rcx, %rax
cmpq $-0x80000000, %rax      # imm = 0x80000000
jl 0x194f8
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x4, %rcx
subq %rcx, %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jle 0x19510
leaq 0x172ef(%rip), %rdi     # 0x307ee
movl $0x21e, %esi            # imm = 0x21E
movb $0x0, %al
callq 0x2070
callq 0x2040
jmp 0x19512
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x4, %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, (%rax)
jmp 0x19562
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
andq $0x10, %rax
cmpq $0x0, %rax
je 0x19560
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
jmp 0x19562
jmp 0x19564
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x19356
jmp 0x19576
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rdx
addq 0x60(%rdx), %rcx
cmpq %rcx, %rax
jbe 0x195a3
leaq 0x1725c(%rip), %rdi     # 0x307ee
movl $0x22c, %esi            # imm = 0x22C
movb $0x0, %al
callq 0x2070
callq 0x2040
jmp 0x195a5
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)