// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x12e0e
cmpl $0x0, (%rbx)
je 0x2976c
xorl %ebp, %ebp
jmp 0x29798
cmpl $0x2, (%r15)
jne 0x29785
movq %r15, %rdi
callq 0x12a25
cmpb $0x28, (%rax)
jne 0x29785
cmpb $0x0, 0x1(%rax)
je 0x297f8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2f17f
movq %rax, %rbp
cmpl $0x0, (%rbx)
je 0x297bf
xorl %r15d, %r15d
movq %rbp, %rdi
callq 0x29d88
movq %r15, %rdi
callq 0x29d88
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x341c4
movq %rax, %r15
cmpl $0x0, (%rbx)
jne 0x2979b
leaq 0x7c997(%rip), %rax     # 0xa6170
movq (%rax), %rsi
leaq 0x450e5(%rip), %rdx     # 0x6e8c8
movq %r14, %rdi
movq %r15, %rcx
movq %rbx, %r8
callq 0x33be8
cmpl $0x0, (%rbx)
jne 0x2979b
jmp 0x297ad
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1e2a1
movq %rax, %rbp
cmpl $0x0, (%rbx)
jne 0x29798
movq (%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x29798
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x347d5
movq %rax, %rbp
cmpl $0x0, (%rbx)
jne 0x29798
cmpl $0x1, (%rbp)
jne 0x29880
movl 0x148(%rbp), %r15d
movq %rbp, %rdi
callq 0x29d88
movq %r14, %rdi
cmpl $0x1, %r15d
je 0x298f9
testl %r15d, %r15d
jne 0x29958
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f231
movq 0x48(%r14), %rdi
callq 0x2b774
movq %rax, %r12
movq 0x48(%r14), %rdi
callq 0x2b774
movq %rax, 0x18(%rsp)
movq 0x48(%r14), %rdi
callq 0x2b774
movq %rax, 0x10(%rsp)
movq 0x48(%r14), %rax
movq 0x20(%rax), %r15
leaq 0x1(%r15), %rcx
movq %rcx, 0x20(%rax)
movq 0x148(%rbp), %r13
movq %rbp, %rdi
callq 0x29d88
leaq 0x441f1(%rip), %rsi     # 0x6dabf
leaq 0x44ff3(%rip), %rdx     # 0x6e8c8
movq %r14, %rdi
movq %rbx, %rcx
callq 0x3169f
movl (%rbx), %ecx
testl %ecx, %ecx
je 0x2990f
cmpl $0x20, %ecx
jne 0x29a17
movq %rbx, %rdi
callq 0x140a4
jmp 0x29926
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f308
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x2f591
cmpl $0x0, (%rbx)
jne 0x29a17
leaq 0x4419b(%rip), %rsi     # 0x6dac8
leaq 0x44e4c(%rip), %rdx     # 0x6e780
movq %r14, %rdi
movq %rbx, %rcx
callq 0x3169f
movl (%rbx), %ecx
testl %ecx, %ecx
je 0x29977
cmpl $0x20, %ecx
jne 0x29a17
movq %rbx, %rdi
callq 0x140a4
jmp 0x2998e
movl %r15d, %esi
movq %rbx, %rdx
js 0x29a21
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f40e
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x2f924
cmpl $0x0, (%rbx)
jne 0x29a17
movq 0x48(%r14), %rdi
xorl %ebp, %ebp
pushq $0x2d
popq %rsi
movq %r13, %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x2a819
movq %rax, 0x20(%rsp)
cmpl $0x0, (%rbx)
jne 0x29a19
movq 0x48(%r14), %rdi
pushq $0x2d
popq %rsi
pushq $0x1
popq %rcx
movq %r13, %rdx
movq %rbx, %r8
callq 0x2a819
cmpl $0x0, (%rbx)
jne 0x29a17
movq 0x48(%r14), %rdi
pushq $0x26
popq %rsi
movq 0x20(%rsp), %rdx
movq %rax, %rcx
movq %rbx, %r8
callq 0x2a819
cmpl $0x0, (%rbx)
jne 0x29a17
movq 0x48(%r14), %rdi
pushq $0x43
popq %rsi
movq %rax, %rdx
movq %r12, %rcx
movq 0x18(%rsp), %r8
movq %rbx, %r9
callq 0x2a8c1
cmpl $0x0, (%rbx)
jne 0x29a17
movq 0x48(%r14), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2b781
cmpl $0x0, (%rbx)
je 0x29a34
xorl %ebp, %ebp
movq %rbp, %rdi
jmp 0x297a6
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2f51e
movq %rbx, 0x8(%rsp)
andl $0x0, (%rsp)
leaq 0x44084(%rip), %rsi     # 0x6dac8
leaq 0x44d35(%rip), %r9      # 0x6e780
pushq $0x9
popq %rcx
movq %r14, %rdi
movq %r13, %rdx
xorl %r8d, %r8d
callq 0x1de0d
movq %rax, %rbp
cmpl $0x0, (%rbx)
jne 0x29a19
movq 0x48(%r14), %rdi
movq 0x148(%rbp), %rcx
pushq $0x1e
popq %rsi
movq %r15, %rdx
movq %rbx, %r8
callq 0x2a9a4
cmpl $0x0, (%rbx)
jne 0x29a19
movq %rbp, %rdi
callq 0x29d88
movq 0x48(%r14), %rdi
pushq $0x45
popq %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq 0x2a997
cmpl $0x0, (%rbx)
jne 0x29a17
movq 0x48(%r14), %rdi
movq 0x18(%rsp), %rsi
movq %rbx, %rdx
callq 0x2b781
cmpl $0x0, (%rbx)
jne 0x29a17
movq %rbx, 0x8(%rsp)
andl $0x0, (%rsp)
leaq 0x43fee(%rip), %rsi     # 0x6dabf
leaq 0x44df0(%rip), %r9      # 0x6e8c8
pushq $0x9
popq %rcx
movq %r14, %rdi
movq %r13, %rdx
xorl %r8d, %r8d
callq 0x1de0d
movq %rax, %rbp
cmpl $0x0, (%rbx)
jne 0x29a19
movq 0x48(%r14), %rdi
movq 0x148(%rbp), %rcx
pushq $0x51
popq %rsi
movq %r15, %rdx
movq %rbx, %r8
callq 0x2a9a4
cmpl $0x0, (%rbx)
jne 0x29a19
movq %rbp, %rdi
callq 0x29d88
movq 0x48(%r14), %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x2b781
cmpl $0x0, (%rbx)
jne 0x29a17
movl %r15d, %edi
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2a358
nop