// File: /workspace/github_c_makefile_star2_O2/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 0xa5ae
movq %rax, (%rsp)
movq 0x30(%rbx), %rdi
callq 0xa4a3
movq %rax, %rdi
callq 0x2a03
movq %rax, %r15
leaq 0xab7b(%rip), %rdi      # 0xd09e
callq 0x7bc7
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xaa2f
movq %rax, %r12
leaq 0xaac5(%rip), %rdi      # 0xd004
callq 0x7bc7
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xaa2f
movq %rax, 0x8(%rsp)
leaq 0xaaec(%rip), %rax      # 0xd049
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0xfd9c(%rip), %r14      # 0x12308
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x51, 0xc(%rdi)
leaq 0xc6c5(%rip), %rbp      # 0xec4c
movq %rbp, 0x10(%rdi)
leaq 0xfb9e(%rip), %rcx      # 0x12130
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0xc321
leaq 0x102fa(%rip), %r13     # 0x128a0
cmpl $0x0, (%r13)
je 0x263a
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0xba9c
testl %eax, %eax
je 0x25f0
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x52, 0xc(%rax)
movq 0x30(%rbx), %rdi
callq 0xa4a3
leaq 0xaa2f(%rip), %rdi      # 0xd015
movq %rax, %rsi
xorl %eax, %eax
callq 0xc398
cmpl $0x0, (%r13)
je 0x263a
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0xba9c
testl %eax, %eax
je 0x263a
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x53, 0xc(%rax)
movq %r12, %rdx
shrq $0x2, %rdx
leaq 0xaa02(%rip), %rdi      # 0xd02c
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0xc398
movq %r12, %rax
shrq $0x2, %rax
testl %eax, %eax
jle 0x26d4
leaq 0xaa4e(%rip), %rdi      # 0xd09e
callq 0x7bc7
movabsq $0x3fffffffc, %rcx      # imm = 0x3FFFFFFFC
addq %rcx, %r12
andq %rcx, %r12
orq $0x3, %r12
leaq 0xfc08(%rip), %rdi      # 0x12278
movq %rax, %rsi
movq %r12, %rdx
callq 0xaaa1
leaq -0x198(%rip), %rsi      # 0x24ea
movq %rbx, %rdi
movq %rax, %rdx
callq 0x365f
movq %rax, %r12
movq 0x30(%rbx), %rdi
callq 0xa4a3
movq %rax, %r13
leaq 0xa961(%rip), %rdi      # 0xd004
callq 0x7bc7
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xaaa1
leaq -0x391(%rip), %rsi      # 0x232c
movq %r13, %rdi
movq %rax, %rdx
callq 0x2dbe
movq %rbx, %rdi
movq %r12, %rsi
movq (%rsp), %rdx
jmp 0x273c
leaq 0xa929(%rip), %rdi      # 0xd004
callq 0x7bc7
leaq 0xfb91(%rip), %rdi      # 0x12278
movq %rax, %rsi
movq (%rsp), %r14
movq %r14, %rdx
callq 0xaaa1
movq %rax, %r15
leaq 0xa99e(%rip), %rdi      # 0xd09e
callq 0x7bc7
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xaaa1
movq %rax, %r15
movq 0x30(%rbx), %rdi
callq 0xa4a3
leaq -0x3fa(%rip), %rsi      # 0x232c
movq %rax, %rdi
movq %r15, %rdx
callq 0x2dbe
movl $0x193, %edx            # imm = 0x193
movq %rbx, %rdi
movq %r14, %rsi
callq 0x373c
leaq 0x10(%rsp), %rdi
movl $0x5f, 0xc(%rdi)
callq 0xc49a
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq