// File: ocornoc[P]crolol/tests/basic_arith.cpp
// Function: mod_test()
bool mod_test()
{
	bool success = true;
	
	for (const argans& arg_and_ans: mod_args) {
		const crolol::num lhs = arg_and_ans.first.first;
		const crolol::num rhs = arg_and_ans.first.second;
		const crolol::num ans = arg_and_ans.second;
		const crolol::num result = lhs % rhs;
		
		if (!crolol::equals(ans, result)) {
			success = false;
			
			std::cout << static_cast<std::string>(lhs) << " % "
				<< static_cast<std::string>(rhs)
				<< " should be "
				<< static_cast<std::string>(ans) << ", was "
				<< static_cast<std::string>(result)
				<< std::endl;
		}
	}
	
	std::cout << "Modulo: ";
	report(success);
	
	return success;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movb $0x1, -0x1(%rbp)
leaq 0x37892(%rip), %rax     # 0x40488
movq %rax, -0x10(%rbp)
leaq 0x37887(%rip), %rdi     # 0x40488
callq 0x9170
movq %rax, -0x18(%rbp)
leaq 0x37877(%rip), %rdi     # 0x40488
callq 0x91a0
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x91d0
testb $0x1, %al
jne 0x8c30
jmp 0x8e95
leaq -0x18(%rbp), %rdi
callq 0x9210
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0xa410
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x9cd0
testb $0x1, %al
jne 0x8e85
movb $0x0, -0x1(%rbp)
leaq -0x88(%rbp), %rdi
movq %rdi, -0x108(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x9d70
movq -0x108(%rbp), %rsi
movq 0x372e9(%rip), %rdi     # 0x3ffb8
callq 0x5380
movq %rax, -0x100(%rbp)
jmp 0x8cdd
movq -0x100(%rbp), %rdi
leaq 0x23437(%rip), %rsi     # 0x2c122
callq 0x53d0
movq %rax, -0x110(%rbp)
jmp 0x8cf9
leaq -0xb8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x9d70
jmp 0x8d0b
movq -0x110(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x5380
movq %rax, -0x118(%rbp)
jmp 0x8d27
movq -0x118(%rbp), %rdi
leaq 0x2338d(%rip), %rsi     # 0x2c0c2
callq 0x53d0
movq %rax, -0x120(%rbp)
jmp 0x8d43
leaq -0xd8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x9d70
jmp 0x8d55
movq -0x120(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x5380
movq %rax, -0x128(%rbp)
jmp 0x8d71
movq -0x128(%rbp), %rdi
leaq 0x2334f(%rip), %rsi     # 0x2c0ce
callq 0x53d0
movq %rax, -0x130(%rbp)
jmp 0x8d8d
leaq -0xf8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x9d70
jmp 0x8d9f
movq -0x130(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x5380
movq %rax, -0x138(%rbp)
jmp 0x8dbb
movq -0x138(%rbp), %rdi
movq 0x371af(%rip), %rsi     # 0x3ff78
callq 0x5410
jmp 0x8dd0
leaq -0xf8(%rbp), %rdi
callq 0x5250
leaq -0xd8(%rbp), %rdi
callq 0x5250
leaq -0xb8(%rbp), %rdi
callq 0x5250
leaq -0x88(%rbp), %rdi
callq 0x5250
jmp 0x8e85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x8e77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x8e5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x5250
leaq -0xd8(%rbp), %rdi
callq 0x5250
leaq -0xb8(%rbp), %rdi
callq 0x5250
leaq -0x88(%rbp), %rdi
callq 0x5250
jmp 0x8ec3
jmp 0x8e87
leaq -0x18(%rbp), %rdi
callq 0x9230
jmp 0x8c1a
movq 0x3711c(%rip), %rdi     # 0x3ffb8
leaq 0x23283(%rip), %rsi     # 0x2c126
callq 0x53d0
movb -0x1(%rbp), %al
andb $0x1, %al
movzbl %al, %edi
callq 0x7b80
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x56b0
nop