// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/semantics.c
// Function: stat_asm
static void _stat_asm(
	ParserContext *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == FE_NODE_STAT_ASM);
	assert(node->nchilds >= 1);

	ParserASTNode *node_asm_code = node->childs[0];
	assert(node_asm_code->type == FE_NODE_LITERAL_STRING);

	for (int i = 1; i < node->nchilds; i++) {
		ParserASTNode *node_asm_option = node->childs[i];
		assert(node_asm_option->type == FE_NODE_STAT_ASM_OPTION);
		assert(node_asm_option->nchilds == 2);

		ParserASTNode *node_expr = node_asm_option->childs[1];
		assert(node_expr->type == FE_NODE_EXPR);
		_expr_wrapper(ctx, node_expr);

		ParserASTNode *node_specifier = node_asm_option->childs[0];
		assert(node_specifier->type == FE_NODE_LITERAL_STRING);
		LexerToken *tk_specifier = node_specifier->token;
		if (tk_specifier->len >= 4) {
			if (strncmp("set#", tk_specifier->content + 1, 4) == 0) {
				if (!_is_primitive_type_node(ctx, node_expr)
						&& !_is_pointer_type_node(ctx, node_expr)) {
					_SYNERR_NODE(
						ctx,
						node_expr,
						"parameter type must be primitive type or pointer type."
					);
				}
			} else if (strncmp("get#", tk_specifier->content + 1, 4) == 0) {
				if (!_is_primitive_type_node(ctx, node_expr)
						&& !_is_pointer_type_node(ctx, node_expr)) {
					_SYNERR_NODE(
						ctx,
						node_expr,
						"parameter type must be primitive type or pointer type."
					);
				}

				if (node_expr->childs[0]->type != FE_NODE_EXPR_ATOM
						|| node_expr->childs[0]->childs[0]->type != FE_NODE_IDENTIFIER) {
					_SYNERR_NODE(
						ctx,
						node_expr,
						"parameter must be identifier."
					);
				}
			} else {
				_SYNERR_NODE(
					ctx,
					node_specifier,
					"invalid asm option specifier."
				);
			}
		} else {
			_SYNERR_NODE(
				ctx,
				node_specifier,
				"invalid asm option specifier."
			);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1440, %rsp           # imm = 0x1440
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x5e8ec
jmp 0x5e90b
leaq 0x1dc63(%rip), %rdi     # 0x7c556
leaq 0x1f950(%rip), %rsi     # 0x7e24a
movl $0x60f, %edx            # imm = 0x60F
leaq 0x223c4(%rip), %rcx     # 0x80cca
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x5e914
jmp 0x5e933
leaq 0x176b8(%rip), %rdi     # 0x75fd3
leaq 0x1f928(%rip), %rsi     # 0x7e24a
movl $0x610, %edx            # imm = 0x610
leaq 0x2239c(%rip), %rcx     # 0x80cca
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xba0, (%rax)          # imm = 0xBA0
jne 0x5e941
jmp 0x5e960
leaq 0x223b3(%rip), %rdi     # 0x80cfb
leaq 0x1f8fb(%rip), %rsi     # 0x7e24a
movl $0x611, %edx            # imm = 0x611
leaq 0x2236f(%rip), %rcx     # 0x80cca
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jl 0x5e96c
jmp 0x5e98b
leaq 0x223a7(%rip), %rdi     # 0x80d1a
leaq 0x1f8d0(%rip), %rsi     # 0x7e24a
movl $0x612, %edx            # imm = 0x612
leaq 0x22344(%rip), %rcx     # 0x80cca
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x303, (%rax)          # imm = 0x303
jne 0x5e9a8
jmp 0x5e9c7
leaq 0x180ce(%rip), %rdi     # 0x76a7d
leaq 0x1f894(%rip), %rsi     # 0x7e24a
movl $0x615, %edx            # imm = 0x615
leaq 0x22308(%rip), %rcx     # 0x80cca
callq 0x30a0
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x5eca4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0xba1, (%rax)          # imm = 0xBA1
jne 0x5ea00
jmp 0x5ea1f
leaq 0x180a4(%rip), %rdi     # 0x76aab
leaq 0x1f83c(%rip), %rsi     # 0x7e24a
movl $0x619, %edx            # imm = 0x619
leaq 0x222b0(%rip), %rcx     # 0x80cca
callq 0x30a0
movq -0x28(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x5ea2b
jmp 0x5ea4a
leaq 0x180aa(%rip), %rdi     # 0x76adc
leaq 0x1f811(%rip), %rsi     # 0x7e24a
movl $0x61a, %edx            # imm = 0x61A
leaq 0x22285(%rip), %rcx     # 0x80cca
callq 0x30a0
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0xe00, (%rax)          # imm = 0xE00
jne 0x5ea68
jmp 0x5ea87
leaq 0x17c14(%rip), %rdi     # 0x76683
leaq 0x1f7d4(%rip), %rsi     # 0x7e24a
movl $0x61d, %edx            # imm = 0x61D
leaq 0x22248(%rip), %rcx     # 0x80cca
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x4f680
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x303, (%rax)          # imm = 0x303
jne 0x5eab1
jmp 0x5ead0
leaq 0x18042(%rip), %rdi     # 0x76afa
leaq 0x1f78b(%rip), %rsi     # 0x7e24a
movl $0x621, %edx            # imm = 0x621
leaq 0x221ff(%rip), %rcx     # 0x80cca
callq 0x30a0
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x4, 0x4(%rax)
jl 0x5ec66
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x1, %rsi
leaq 0x1802c(%rip), %rdi     # 0x76b29
movl $0x4, %edx
callq 0x3030
cmpl $0x0, %eax
jne 0x5eb61
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x52820
testb $0x1, %al
jne 0x5eb5c
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x52770
testb $0x1, %al
jne 0x5eb5c
leaq -0x440(%rbp), %rdi
leaq 0x221f1(%rip), %rsi     # 0x80d2d
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x440(%rbp), %rdx
callq *%rax
jmp 0x5ec64
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x1, %rsi
leaq 0x17fd1(%rip), %rdi     # 0x76b45
movl $0x4, %edx
callq 0x3030
cmpl $0x0, %eax
jne 0x5ec34
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x52820
testb $0x1, %al
jne 0x5ebd7
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x52770
testb $0x1, %al
jne 0x5ebd7
leaq -0x840(%rbp), %rdi
leaq 0x22176(%rip), %rsi     # 0x80d2d
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x840(%rbp), %rdx
callq *%rax
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
cmpl $0xee0, (%rax)          # imm = 0xEE0
jne 0x5ec04
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
cmpl $0x200, (%rax)          # imm = 0x200
je 0x5ec32
leaq -0xc40(%rbp), %rdi
leaq 0x22152(%rip), %rsi     # 0x80d64
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0xc40(%rbp), %rdx
callq *%rax
jmp 0x5ec62
leaq -0x1040(%rbp), %rdi
leaq 0x22140(%rip), %rsi     # 0x80d82
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x1040(%rbp), %rdx
callq *%rax
jmp 0x5ec64
jmp 0x5ec94
leaq -0x1440(%rbp), %rdi
leaq 0x2210e(%rip), %rsi     # 0x80d82
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x1440(%rbp), %rdx
callq *%rax
jmp 0x5ec96
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5e9ce
addq $0x1440, %rsp           # imm = 0x1440
popq %rbp
retq
nopl (%rax)