// File: /workspace/github_c_makefile_star2_O0/Yamsman[P]scc/src/gen.c
// Function: gen_stmt
void gen_stmt(asm_f *f, ast_n *n) {
	switch (n->dat.stmt.kind) {
		case STMT_EXPR:   gen_expr(f, n->dat.stmt.expr);break;
		case STMT_CMPD:   gen_stmt_cmpd(f, n); 		break;
		case STMT_IF: 	  gen_stmt_if(f, n);		break;
		case STMT_SWITCH: gen_stmt_switch(f, n);	break;
		case STMT_WHILE:
		case STMT_FOR:
		case STMT_DO_WHILE:
			gen_stmt_loop(f, n);
			break;
		case STMT_LABEL:
			gen_stmt_label(f, n);
			break;
		case STMT_CASE:
			c_error(NULL, "Case label not inside switch statement\n");
			break;
		case STMT_DEFAULT:
			c_error(NULL, "'default' label not inside switch statement\n");
			break;
		case STMT_GOTO: gen_stmt_goto(f, n);		break;
		case STMT_CONTINUE:
			if (f->cont_tgt == NULL) {
				c_error(NULL, "'continue' not inside loop\n");
				break;
			}
			asmf_add_inst(f, mk_inst(INST_JMP, 1,
				mk_oprd_label(f->cont_tgt)
			));
			break;
		case STMT_BREAK:
			if (f->break_tgt == NULL) {
				c_error(NULL, "'break' not inside loop or switch\n");
				break;
			}
			asmf_add_inst(f, mk_inst(INST_JMP, 1,
				mk_oprd_label(f->break_tgt)
			));
			break;
		case STMT_RETURN: 
			gen_stmt_return(f, n);
			break;
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq %rax, -0x58(%rbp)
subq $0xd, %rax
ja 0x5739
movq -0x58(%rbp), %rax
leaq 0xbf7d(%rip), %rcx      # 0x114f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x4920
jmp 0x5739
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x54d0
jmp 0x5739
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5750
jmp 0x5739
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5980
jmp 0x5739
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5990
jmp 0x5739
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5d90
jmp 0x5739
xorl %eax, %eax
movl %eax, %edi
leaq 0xbffe(%rip), %rsi      # 0x115f5
movb $0x0, %al
callq 0x3880
jmp 0x5739
xorl %eax, %eax
movl %eax, %edi
leaq 0xc00f(%rip), %rsi      # 0x1161d
movb $0x0, %al
callq 0x3880
jmp 0x5739
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5e50
jmp 0x5739
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x564e
xorl %eax, %eax
movl %eax, %edi
leaq 0xc008(%rip), %rsi      # 0x1164a
movb $0x0, %al
callq 0x3880
jmp 0x5739
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x6420
movl $0x45, %edi
movl $0x1, %esi
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x6460
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x68f0
jmp 0x5739
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x56ce
xorl %eax, %eax
movl %eax, %edi
leaq 0xbfa1(%rip), %rsi      # 0x11666
movb $0x0, %al
callq 0x3880
jmp 0x5739
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x50(%rbp), %rdi
callq 0x6420
movl $0x45, %edi
movl $0x1, %esi
leaq -0x50(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x6460
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x68f0
jmp 0x5739
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5f10
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)