// File: /workspace/github_c_makefile_star2_O0/Mithreindeir[P]ewcc/src/frontend/parser.c
// Function: parse_loop
struct stmt *parse_loop(struct parser *p)
{
	struct token *t;
	struct expr *init, *cond, *iter;
	struct stmt *body;
	if ((t = match(p, t_while))) {
		if (!match(p, t_lparen))
			syntax_error(p, "Missing left parentheses");
		if (!(cond = parse_expr(p)))
			syntax_error(p, "No valid expression");
		if (!match(p, t_rparen))
			syntax_error(p, "Missing right parentheses");
		if (!(body = parse_stmt(p)))
			syntax_error(p,
				     "Missing statement after while expression");
		return loop_init(NULL, cond, NULL, body);
	}
	if ((t = match(p, t_for))) {
		if (!match(p, t_lparen))
			syntax_error(p, "Missing left parentheses");
		init = parse_declaration(p);
		if (!init)
			syntax_error(p,
				     "No valid initializer statement in for loop");
		cond = parse_expr(p);
		if (!match(p, t_semic))
			syntax_error(p,
				     "No valid condition statement in for loop");
		iter = parse_expr(p);
		if (!match(p, t_rparen))
			syntax_error(p, "Missing right parentheses");
		if (!(body = parse_stmt(p)))
			syntax_error(p, "Missing statement");
		return loop_init(init, cond, iter, body);
	}

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x24, %esi
callq 0xaab0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xa493
movq -0x10(%rbp), %rdi
movl $0x14, %esi
callq 0xaab0
cmpq $0x0, %rax
jne 0xa40c
movq -0x10(%rbp), %rdi
leaq 0x25c2(%rip), %rsi      # 0xc9c9
callq 0xabb0
movq -0x10(%rbp), %rdi
callq 0x9860
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0xa42f
movq -0x10(%rbp), %rdi
leaq 0x25b8(%rip), %rsi      # 0xc9e2
callq 0xabb0
movq -0x10(%rbp), %rdi
movl $0x15, %esi
callq 0xaab0
cmpq $0x0, %rax
jne 0xa453
movq -0x10(%rbp), %rdi
leaq 0x244a(%rip), %rsi      # 0xc898
callq 0xabb0
movq -0x10(%rbp), %rdi
callq 0xa2e0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0xa476
movq -0x10(%rbp), %rdi
leaq 0x2585(%rip), %rsi      # 0xc9f6
callq 0xabb0
movq -0x28(%rbp), %rsi
movq -0x38(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rdi
callq 0x7a50
movq %rax, -0x8(%rbp)
jmp 0xa59f
movq -0x10(%rbp), %rdi
movl $0x25, %esi
callq 0xaab0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xa597
movq -0x10(%rbp), %rdi
movl $0x14, %esi
callq 0xaab0
cmpq $0x0, %rax
jne 0xa4d3
movq -0x10(%rbp), %rdi
leaq 0x24fb(%rip), %rsi      # 0xc9c9
callq 0xabb0
movq -0x10(%rbp), %rdi
callq 0x8410
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xa4f7
movq -0x10(%rbp), %rdi
leaq 0x252d(%rip), %rsi      # 0xca1f
callq 0xabb0
movq -0x10(%rbp), %rdi
callq 0x9860
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2a, %esi
callq 0xaab0
cmpq $0x0, %rax
jne 0xa528
movq -0x10(%rbp), %rdi
leaq 0x2527(%rip), %rsi      # 0xca4a
callq 0xabb0
movq -0x10(%rbp), %rdi
callq 0x9860
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movl $0x15, %esi
callq 0xaab0
cmpq $0x0, %rax
jne 0xa559
movq -0x10(%rbp), %rdi
leaq 0x2344(%rip), %rsi      # 0xc898
callq 0xabb0
movq -0x10(%rbp), %rdi
callq 0xa2e0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0xa57c
movq -0x10(%rbp), %rdi
leaq 0x24fc(%rip), %rsi      # 0xca73
callq 0xabb0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x7a50
movq %rax, -0x8(%rbp)
jmp 0xa59f
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)