// File: /workspace/github_cpp_makefile_star2_O3/iamlouk[P]asbi/src/macros.cc
// Function: macro_reduce(int, asbi::Context*, std::shared_ptr<asbi::Env>)
static Value macro_reduce(int n, Context* ctx, std::shared_ptr<Env> env) {
	if (n != 3)
		throw std::runtime_error("reduce macro usage error");

	auto map = ctx->pop();
	auto acc = ctx->pop();
	auto fn  = ctx->pop();
	if (map.type != type_t::Map || fn.type != type_t::Lambda)
		throw std::runtime_error("reduce macro usage error");

	auto &vecdata = map._map->vecdata;
	for (unsigned int i = 0; i < vecdata.size(); ++i) {
		ctx->push(vecdata[i]);
		ctx->push(Value::number(i));
		ctx->push(acc);
		acc = fn.call(ctx, 3, env);
	}

	for (auto [key, value]: map._map->data) {
		ctx->push(value);
		ctx->push(key);
		ctx->push(acc);
		acc = fn.call(ctx, 3, env);
	}

	return acc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpl $0x3, %edi
jne 0x12b8b
movq %rdx, %rbx
movq %rsi, %r14
movq %rsi, %rdi
callq 0x11122
movl %eax, %r13d
movq %rdx, %r12
movq %rdx, 0x40(%rsp)
movq %r14, %rdi
callq 0x11122
movl %eax, %ebp
movq %rdx, %r15
movq %r14, %rdi
callq 0x11122
movl %eax, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
cmpl $0x6, %r13d
jne 0x12ba9
cmpl $0x5, %eax
jne 0x12ba9
movq 0x50(%r12), %rax
cmpq %rax, 0x58(%r12)
movq %rbx, 0x28(%rsp)
je 0x12ad4
xorl %ecx, %ecx
xorl %r13d, %r13d
shlq $0x4, %rcx
movl (%rax,%rcx), %esi
movq 0x8(%rax,%rcx), %rdx
movq %r14, %rdi
callq 0x110dc
movl %r13d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movq %xmm0, %rdx
movq %r14, %rdi
movl $0x1, %esi
callq 0x110dc
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x110dc
movq (%rbx), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x12a84
movq 0xe542(%rip), %rcx      # 0x20fb8
cmpb $0x0, (%rcx)
je 0x12a80
incl 0x8(%rax)
jmp 0x12a84
lock
incl 0x8(%rax)
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
movl $0x3, %edx
leaq 0x18(%rsp), %rcx
callq 0xf64e
movl %eax, %ebp
movq %rdx, %r15
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x12aaf
callq 0x65d6
incl %r13d
movq 0x50(%r12), %rax
movq 0x58(%r12), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
movq %r13, %rcx
cmpq %r13, %rdx
ja 0x12a1b
movq 0x40(%rsp), %r12
movq 0x28(%r12), %rbx
testq %rbx, %rbx
je 0x12b77
movl 0x8(%rbx), %r12d
movq 0x10(%rbx), %r13
movl 0x18(%rbx), %esi
movq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x110dc
movq %r14, %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0x110dc
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x110dc
movq 0x28(%rsp), %rcx
movq (%rcx), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rcx), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x12b44
movq 0xe482(%rip), %rcx      # 0x20fb8
cmpb $0x0, (%rcx)
je 0x12b40
incl 0x8(%rax)
jmp 0x12b44
lock
incl 0x8(%rax)
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
movl $0x3, %edx
leaq 0x8(%rsp), %rcx
callq 0xf64e
movl %eax, %ebp
movq %rdx, %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x12b6f
callq 0x65d6
movq (%rbx), %rbx
jmp 0x12ad9
movl %ebp, %eax
movq %r15, %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x51b0
movq %rax, %r14
leaq 0x5779(%rip), %rsi      # 0x18318
movq %rax, %rdi
callq 0x5150
jmp 0x12bc5
movl $0x10, %edi
callq 0x51b0
movq %rax, %r14
leaq 0x575b(%rip), %rsi      # 0x18318
movq %rax, %rdi
callq 0x5150
movq 0xe424(%rip), %rsi      # 0x20ff0
movq 0xe3dd(%rip), %rdx      # 0x20fb0
movq %r14, %rdi
callq 0x55d0
jmp 0x12bdd
movq %rax, %rbx
movq %r14, %rdi
callq 0x5280
jmp 0x12c06
movq %rax, %rbx
movq 0x10(%rsp), %rdi
jmp 0x12bfc
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x12c06
callq 0x65d6
movq %rbx, %rdi
callq 0x55e0