// File: /workspace/github_c_makefile_star2_O1/dalnefre[P]kernel_abe/challenge.c
// Function: challenge
BEH_DECL(challenge)
{
	CONS* msg = WHAT;
	CONS* state = MINE;
	CONS* n = map_get(state, ATOM("n"));
	CONS* a = map_get(state, ATOM("a"));

	DBUG_ENTER("challenge");
	DBUG_PRINT("", ("self=%p", SELF));
	DBUG_PRINT("", ("msg=%p n=%d a=%p", msg, MK_INT(n), a));
	if (0 < MK_INT(n)) {
		a = ACTOR(challenge, map_put(NIL, ATOM("n"), NUMBER(MK_INT(n) - 1)));
		BECOME(countdown_ring, map_put(state, ATOM("a"), a));
		SEND(a, msg);
	} else {
		state = NIL;
		state = map_put(state, ATOM("a"), msg);
		state = map_put(state, ATOM("n"), n);
		BECOME(countdown_ring, state);
		SEND(msg, NUMBER(M_CNT));			/* disable this line for process creation only */
	}
	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 0xad61
movq %rax, (%rsp)
movq 0x30(%rbx), %rdi
callq 0xacc2
movq %rax, %rdi
callq 0x2e2d
movq %rax, %r15
leaq 0xa780(%rip), %rdi      # 0xd09e
callq 0x8198
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xb196
movq %rax, %r12
leaq 0xa6ca(%rip), %rdi      # 0xd004
callq 0x8198
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xb196
movq %rax, 0x8(%rsp)
leaq 0xa6f1(%rip), %rax      # 0xd049
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0xf991(%rip), %r14      # 0x122f8
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x51, 0xc(%rdi)
leaq 0xc2f2(%rip), %rbp      # 0xec74
movq %rbp, 0x10(%rdi)
leaq 0xf793(%rip), %rcx      # 0x12120
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0xca2e
leaq 0xfeef(%rip), %r13      # 0x12890
cmpl $0x0, (%r13)
je 0x29e7
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0xc1a0
testl %eax, %eax
je 0x29e7
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x52, 0xc(%rax)
movq 0x30(%rbx), %rdi
callq 0xacc2
leaq 0xa638(%rip), %rdi      # 0xd015
movq %rax, %rsi
xorl %eax, %eax
callq 0xca9f
cmpl $0x0, (%r13)
je 0x2a31
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0xc1a0
testl %eax, %eax
je 0x2a31
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x53, 0xc(%rax)
movq %r12, %rdx
shrq $0x2, %rdx
leaq 0xa60b(%rip), %rdi      # 0xd02c
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0xca9f
movq %r12, %rax
shrq $0x2, %rax
testl %eax, %eax
jle 0x2acb
leaq 0xa657(%rip), %rdi      # 0xd09e
callq 0x8198
movabsq $0x3fffffffc, %rcx      # imm = 0x3FFFFFFFC
addq %rcx, %r12
andq %rcx, %r12
orq $0x3, %r12
leaq 0xf801(%rip), %rdi      # 0x12268
movq %rax, %rsi
movq %r12, %rdx
callq 0xb208
leaq -0x194(%rip), %rsi      # 0x28e5
movq %rbx, %rdi
movq %rax, %rdx
callq 0x3956
movq %rax, %r12
movq 0x30(%rbx), %rdi
callq 0xacc2
movq %rax, %r13
leaq 0xa56a(%rip), %rdi      # 0xd004
callq 0x8198
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xb208
leaq -0x388(%rip), %rsi      # 0x272c
movq %r13, %rdi
movq %rax, %rdx
callq 0x303c
movq %rbx, %rdi
movq %r12, %rsi
movq (%rsp), %rdx
jmp 0x2b33
leaq 0xa532(%rip), %rdi      # 0xd004
callq 0x8198
leaq 0xf78a(%rip), %rdi      # 0x12268
movq %rax, %rsi
movq (%rsp), %r14
movq %r14, %rdx
callq 0xb208
movq %rax, %r15
leaq 0xa5a7(%rip), %rdi      # 0xd09e
callq 0x8198
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xb208
movq %rax, %r15
movq 0x30(%rbx), %rdi
callq 0xacc2
leaq -0x3f1(%rip), %rsi      # 0x272c
movq %rax, %rdi
movq %r15, %rdx
callq 0x303c
movl $0x193, %edx            # imm = 0x193
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a33
leaq 0x10(%rsp), %rdi
movl $0x5f, 0xc(%rdi)
callq 0xcbb3
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq