// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/schemer.c
// Function: apply_sleep_beh
BEH_DECL(apply_sleep_beh)
{
	CONS* args = WHAT;
	CONS* to = pr_head(MINE);
	CONS* env = pr_tail(MINE);
	CONS* msg;
	CONS* a;

	DBUG_ENTER("apply_sleep_beh");
	DBUG_PRINT("", ("args = %s", cons_to_str(args)));
	if (have_n_args(1, args) && is_number(lst_first(args))) {
		int n = MK_INT(lst_first(args));
		
		n *= 1000;		/* convert ms to us */
		DBUG_PRINT("", ("sleep %dus", n));
		a = ACTOR(eval_time_beh, NIL);
		msg = mk_pair(NIL, env);
		msg = mk_pair(to, msg);
		SEND_AFTER(NUMBER(n), a, msg);
	} else {
		DBUG_PRINT("", ("error"));
		FAIL(env, mk_list(ATOM("sleep"), args));
	}
	DBUG_RETURN;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
callq 0x14906
movq %rax, %r15
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rax, %rdi
callq 0xcd5b
movq %rax, %rdi
callq 0x147fb
movq %rax, 0x8(%rsp)
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rax, %rdi
callq 0xcd5b
movq %rax, %rdi
callq 0x14906
movq %rax, %r14
leaq 0xcf01(%rip), %rax      # 0x174eb
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x13d27(%rip), %r12     # 0x1e320
movq (%r12), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x8a7, 0xc(%rdi)       # imm = 0x8A7
leaq 0xf3a7(%rip), %r13      # 0x199bc
movq %r13, 0x10(%rdi)
leaq 0x13b20(%rip), %rcx     # 0x1e140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x16679
leaq 0x142bc(%rip), %rbp     # 0x1e8f0
cmpl $0x0, (%rbp)
je 0xa67a
movq (%r12), %rax
movq 0x50(%rax), %rax
movq %r13, 0x10(%rax)
movq %r13, %rdi
callq 0x15df4
testl %eax, %eax
je 0xa67a
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x8a8, 0xc(%rax)       # imm = 0x8A8
movq %r15, %rdi
callq 0xed08
leaq 0xcaae(%rip), %rdi      # 0x1711e
movq %rax, %rsi
xorl %eax, %eax
callq 0x166f0
pushq $0x1
popq %rdi
movq %r15, %rsi
callq 0x4beb
testq %rax, %rax
je 0xa742
movq %r15, %rdi
callq 0x147fb
notl %eax
testb $0x3, %al
jne 0xa742
movq %r15, %rdi
callq 0x147fb
shrl $0x2, %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
cmpl $0x0, (%rbp)
movl %eax, %ebp
je 0xa6f0
movq (%r12), %rax
movq 0x50(%rax), %rax
movq %r13, 0x10(%rax)
movq %r13, %rdi
callq 0x15df4
testl %eax, %eax
je 0xa6f0
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x8ad, 0xc(%rax)       # imm = 0x8AD
leaq 0xce14(%rip), %rdi      # 0x174fb
movl %ebp, %esi
xorl %eax, %eax
callq 0x166f0
leaq -0x589f(%rip), %rsi     # 0x4e58
leaq 0x13b92(%rip), %r15     # 0x1e290
movq %rbx, %rdi
movq %r15, %rdx
callq 0xd9b7
movq %rax, %r13
movq %r15, %rdi
movq %r14, %rsi
callq 0x14764
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x14764
movslq %ebp, %rcx
leaq 0x3(,%rcx,4), %rsi
movq %rbx, %rdi
movq %r13, %rdx
movq %rax, %rcx
callq 0xdd1d
jmp 0xa7fb
cmpl $0x0, (%rbp)
je 0xa77d
movq (%r12), %rax
movq 0x50(%rax), %rax
movq %r13, 0x10(%rax)
movq %r13, %rdi
callq 0x15df4
testl %eax, %eax
je 0xa77d
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x8b3, 0xc(%rax)       # imm = 0x8B3
leaq 0xcab7(%rip), %rdi      # 0x1722d
xorl %eax, %eax
callq 0x166f0
leaq 0xcd82(%rip), %rdi      # 0x17506
callq 0x11f1f
movq %rax, %rdi
movq %r15, %rsi
callq 0x14764
leaq -0x80c3(%rip), %rsi     # 0x26d8
movq %rbx, %rdi
movq %rax, %rdx
callq 0xd9b7
movq %rax, %r15
leaq 0xc8da(%rip), %rdi      # 0x1708a
callq 0x11f1f
movq %rax, %r12
callq 0xccde
leaq 0x13acc(%rip), %rsi     # 0x1e290
movq %rax, %rdi
callq 0x14764
movq %r12, %rdi
movq %rax, %rsi
callq 0x14764
movq %rax, %rdi
movq %r14, %rsi
callq 0x14764
movq %r15, %rdi
movq %rax, %rsi
callq 0x14764
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xda94
leaq 0x10(%rsp), %rdi
movl $0x8b6, 0xc(%rdi)       # imm = 0x8B6
callq 0x167f2
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq