// File: /workspace/github_c_makefile_star2_O3/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 0xad85
movq %rax, (%rsp)
movq 0x30(%rbx), %rdi
callq 0xace6
movq %rax, %rdi
callq 0x2dd9
movq %rax, %r15
leaq 0xa7db(%rip), %rdi      # 0xd09e
callq 0x8173
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xb1ba
movq %rax, %r12
leaq 0xa725(%rip), %rdi      # 0xd004
callq 0x8173
movq %r15, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xb1ba
movq %rax, 0x8(%rsp)
leaq 0xa74c(%rip), %rax      # 0xd049
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0xf9ec(%rip), %r14      # 0x122f8
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x51, 0xc(%rdi)
leaq 0xc34d(%rip), %rbp      # 0xec74
movq %rbp, 0x10(%rdi)
leaq 0xf7ee(%rip), %rcx      # 0x12120
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0xca9a
leaq 0xff4a(%rip), %r13      # 0x12890
cmpl $0x0, (%r13)
je 0x29da
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0xc1fc
testl %eax, %eax
je 0x2990
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x52, 0xc(%rax)
movq 0x30(%rbx), %rdi
callq 0xace6
leaq 0xa68f(%rip), %rdi      # 0xd015
movq %rax, %rsi
xorl %eax, %eax
callq 0xcb0b
cmpl $0x0, (%r13)
je 0x29da
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0xc1fc
testl %eax, %eax
je 0x29da
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x53, 0xc(%rax)
movq %r12, %rdx
shrq $0x2, %rdx
leaq 0xa662(%rip), %rdi      # 0xd02c
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0xcb0b
movq %r12, %rax
shrq $0x2, %rax
testl %eax, %eax
jle 0x2a74
leaq 0xa6ae(%rip), %rdi      # 0xd09e
callq 0x8173
movabsq $0x3fffffffc, %rcx      # imm = 0x3FFFFFFFC
addq %rcx, %r12
andq %rcx, %r12
orq $0x3, %r12
leaq 0xf858(%rip), %rdi      # 0x12268
movq %rax, %rsi
movq %r12, %rdx
callq 0xb22c
leaq -0x198(%rip), %rsi      # 0x288a
movq %rbx, %rdi
movq %rax, %rdx
callq 0x3932
movq %rax, %r12
movq 0x30(%rbx), %rdi
callq 0xace6
movq %rax, %r13
leaq 0xa5c1(%rip), %rdi      # 0xd004
callq 0x8173
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xb22c
leaq -0x391(%rip), %rsi      # 0x26cc
movq %r13, %rdi
movq %rax, %rdx
callq 0x3032
movq %rbx, %rdi
movq %r12, %rsi
movq (%rsp), %rdx
jmp 0x2adc
leaq 0xa589(%rip), %rdi      # 0xd004
callq 0x8173
leaq 0xf7e1(%rip), %rdi      # 0x12268
movq %rax, %rsi
movq (%rsp), %r14
movq %r14, %rdx
callq 0xb22c
movq %rax, %r15
leaq 0xa5fe(%rip), %rdi      # 0xd09e
callq 0x8173
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xb22c
movq %rax, %r15
movq 0x30(%rbx), %rdi
callq 0xace6
leaq -0x3fa(%rip), %rsi      # 0x26cc
movq %rax, %rdi
movq %r15, %rdx
callq 0x3032
movl $0x193, %edx            # imm = 0x193
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a0f
leaq 0x10(%rsp), %rdi
movl $0x5f, 0xc(%rdi)
callq 0xcc1f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq