// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas64.c
// Function: be_asmgen_gas64_new_context
ASMGeneratorGas64Context * be_asmgen_gas64_new_context(
	ParserContext *psrctx,
	FILE *out,
	int platform
) {
	assert(psrctx);
	assert(psrctx->ast);
	assert(out);
	assert(
		platform == BE_ASMGEN_PLATFORM_WINDOWS
			|| platform == BE_ASMGEN_PLATFORM_SYSTEM_V
			|| platform == BE_ASMGEN_PLATFORM_ISYSTEM
	);
	
	ASMGeneratorGas64Context *ctx = (ASMGeneratorGas64Context *)malloc(sizeof(ASMGeneratorGas64Context));
	if (ctx == NULL) {
		_error("cannot allocate memory for a new context!");
	}

	ctx->psrctx = psrctx;
	ctx->out = out;

	ctx->global = rstr_new();
	ctx->head = rstr_new();
	ctx->body = rstr_new();
	ctx->foot = rstr_new();
	ctx->local_var_defs = NULL;

	ctx->local_var_address_counter = 0;
	ctx->local_var_size = 0;

	rstr_init(ctx->global);
	rstr_init(ctx->head);
	rstr_init(ctx->body);
	rstr_init(ctx->foot);

	ctx->counter = 0;
	ctx->func_symbol = NULL;

	ctx->platform = platform;

	return ctx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x27fdc
jmp 0x27ffb
leaq 0x4d974(%rip), %rdi     # 0x75957
leaq 0x52b1a(%rip), %rsi     # 0x7ab04
movl $0x1e5a, %edx           # imm = 0x1E5A
leaq 0x52b68(%rip), %rcx     # 0x7ab5e
callq 0x30a0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x28008
jmp 0x28027
leaq 0x4d954(%rip), %rdi     # 0x75963
leaq 0x52aee(%rip), %rsi     # 0x7ab04
movl $0x1e5b, %edx           # imm = 0x1E5B
leaq 0x52b3c(%rip), %rcx     # 0x7ab5e
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x28030
jmp 0x2804f
leaq 0x4d966(%rip), %rdi     # 0x7599d
leaq 0x52ac6(%rip), %rsi     # 0x7ab04
movl $0x1e5c, %edx           # imm = 0x1E5C
leaq 0x52b14(%rip), %rcx     # 0x7ab5e
callq 0x30a0
cmpl $0x1, -0x14(%rbp)
je 0x28061
cmpl $0x2, -0x14(%rbp)
je 0x28061
cmpl $0x3, -0x14(%rbp)
jne 0x28063
jmp 0x28082
leaq 0x4d98b(%rip), %rdi     # 0x759f5
leaq 0x52a93(%rip), %rsi     # 0x7ab04
movl $0x1e61, %edx           # imm = 0x1E61
leaq 0x52ae1(%rip), %rcx     # 0x7ab5e
callq 0x30a0
movl $0x68, %edi
callq 0x3120
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x280a3
leaq 0x4d9d3(%rip), %rdi     # 0x75a71
callq 0x28180
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
callq 0x91e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
callq 0x91e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
callq 0x91e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
callq 0x91e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x8c90
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x8c90
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x8c90
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x8c90
movq -0x20(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x58(%rax)
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x60(%rax)
movq -0x20(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop