// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser_rnd.c
// Function: subtilis_parser_rnd
subtilis_exp_t *subtilis_parser_rnd(subtilis_parser_t *p, subtilis_token_t *t,
				    subtilis_error_t *err)
{
	const char *tbuf;
	subtilis_exp_t *e = NULL;
	subtilis_exp_t *e_dup = NULL;

	subtilis_lexer_get(p->l, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (t->type == SUBTILIS_TOKEN_OPERATOR) {
		tbuf = subtilis_token_get_text(t);
		if (!strcmp(tbuf, "(")) {
			e = subtilis_parser_bracketed_exp_internal(p, t, err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;

			subtilis_lexer_get(p->l, t, err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;

			e = subtilis_type_if_to_int(p, e, err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;

			if (e->type.type == SUBTILIS_TYPE_CONST_INTEGER)
				return prv_rnd_const(p, e, err);
			return prv_rnd_var(p, e, err);
		}
	}

	e = subtilis_builtins_ir_basic_rnd(p, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	e_dup = subtilis_type_if_dup(e, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_var_assign_hidden(p, subtilis_rnd_hidden_var,
				   &subtilis_type_integer, e_dup, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	return e;

cleanup:

	subtilis_exp_delete(e);
	subtilis_exp_delete(e_dup);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x133f0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36526
jmp 0x3666f
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x36600
movq -0x18(%rbp), %rdi
callq 0x12d70
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x74d51(%rip), %rsi     # 0xab29c
callq 0x12140
cmpl $0x0, %eax
jne 0x365fe
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x24f20
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3657c
jmp 0x3666f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x133f0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3659e
jmp 0x3666f
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x488b0
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x365c1
jmp 0x3666f
movq -0x30(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x365e4
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x366a0
movq %rax, -0x8(%rbp)
jmp 0x36689
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x36740
movq %rax, -0x8(%rbp)
jmp 0x36689
jmp 0x36600
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x40390
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3661c
jmp 0x3666f
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x47d20
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36638
jmp 0x3666f
movq -0x10(%rbp), %rdi
leaq 0x9e1ed(%rip), %rax     # 0xd4830
movq (%rax), %rsi
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %r8
leaq 0x7527b(%rip), %rdx     # 0xab8d0
callq 0x47150
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36665
jmp 0x3666f
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36689
movq -0x30(%rbp), %rdi
callq 0x36ee0
movq -0x38(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)