// File: /workspace/github_cpp_makefile_star2_O1/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 0x12d09
movq %rdx, %rbx
movq %rsi, %r14
movq %rsi, %rdi
callq 0x11276
movl %eax, %r12d
movq %rdx, 0x8(%rsp)
movq %r14, %rdi
callq 0x11276
movl %eax, %ebp
movq %rdx, %r15
movq %r14, %rdi
callq 0x11276
movl %eax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
cmpl $0x6, %r12d
jne 0x12d27
cmpl $0x5, %eax
jne 0x12d27
movq 0x8(%rsp), %r12
movq 0x50(%r12), %rax
cmpq %rax, 0x58(%r12)
je 0x12c49
xorl %ecx, %ecx
xorl %r13d, %r13d
shlq $0x4, %rcx
movl (%rax,%rcx), %esi
movq 0x8(%rax,%rcx), %rdx
movq %r14, %rdi
callq 0x11230
movl %r13d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movq %xmm0, %rdx
movq %r14, %rdi
movl $0x1, %esi
callq 0x11230
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x11230
movq (%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0x12bfe
movq 0xe3c8(%rip), %rcx      # 0x20fb8
cmpb $0x0, (%rcx)
je 0x12bfa
incl 0x8(%rax)
jmp 0x12bfe
lock
incl 0x8(%rax)
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movl $0x3, %edx
leaq 0x20(%rsp), %rcx
callq 0xf6cc
movl %eax, %ebp
movq %rdx, %r15
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x12c29
callq 0x6614
incl %r13d
movq 0x50(%r12), %rax
movq 0x58(%r12), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
movq %r13, %rcx
cmpq %r13, %rdx
ja 0x12b95
movq %rbx, 0x30(%rsp)
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rbx
testq %rbx, %rbx
je 0x12cf5
movl 0x8(%rbx), %r12d
movq 0x10(%rbx), %r13
movl 0x18(%rbx), %esi
movq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x11230
movq %r14, %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0x11230
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x11230
movq 0x30(%rsp), %rcx
movq (%rcx), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rcx), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x12cc2
movq 0xe304(%rip), %rcx      # 0x20fb8
cmpb $0x0, (%rcx)
je 0x12cbe
incl 0x8(%rax)
jmp 0x12cc2
lock
incl 0x8(%rax)
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movl $0x3, %edx
leaq 0x10(%rsp), %rcx
callq 0xf6cc
movl %eax, %ebp
movq %rdx, %r15
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x12ced
callq 0x6614
movq (%rbx), %rbx
jmp 0x12c57
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 0x55fb(%rip), %rsi      # 0x18318
movq %rax, %rdi
callq 0x5150
jmp 0x12d43
movl $0x10, %edi
callq 0x51b0
movq %rax, %r14
leaq 0x55dd(%rip), %rsi      # 0x18318
movq %rax, %rdi
callq 0x5150
movq 0xe2a6(%rip), %rsi      # 0x20ff0
movq 0xe25f(%rip), %rdx      # 0x20fb0
movq %r14, %rdi
callq 0x55d0
jmp 0x12d5b
movq %rax, %rbx
movq %r14, %rdi
callq 0x5280
jmp 0x12d84
movq %rax, %rbx
movq 0x18(%rsp), %rdi
jmp 0x12d7a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x12d84
callq 0x6614
movq %rbx, %rdi
callq 0x55e0