// File: /workspace/github_cpp_makefile_star2_O1/tsoding[P]wcc/src/./wcc_wat_compiler.cpp
// Function: Wat_Compiler::compile_and(Binary_Op)
S_Expr *Wat_Compiler::compile_and(Binary_Op andd)
{
    assert(andd.lhs->type == andd.rhs->type && "Type Checking step didn't work correctly.");

    switch (andd.lhs->type) {
    case Type::U0:
        assert(0 && "Type Checking step didn't work correctly. There is no and operation defined for Type::U0");
        break;
    case Type::U8:
        assert(0 && "Type Checking step didn't work correctly. There is no and operation defined for Type::U8");
        break;
    case Type::U32:
        assert(0 && "Type Checking step didn't work correctly. There is no and operation defined for Type::U32");
        break;
    case Type::U64:
        assert(0 && "Type Checking step didn't work correctly. There is no and operation defined for Type::U64");
        break;
    case Type::Bool:
        return list(atom("i32.and"_sv), compile_expression(andd.lhs), compile_expression(andd.rhs));
    case Type::Unchecked:
        assert(0 && "Type checking step didn't work correctly");
        break;
    }

    assert(0 && "Memory corruption?");
    return nullptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x4(%rsi), %eax
cmpl 0x4(%rdx), %eax
jne 0x5be7
cmpl $0x5, %eax
jne 0x5bb0
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0x1, %esi
callq 0x85c6
movq %rax, %r15
movl $0x1, (%rax)
movq $0x7, 0x8(%rax)
leaq 0x5d29(%rip), %rax      # 0xb887
movq %rax, 0x10(%r15)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x51b2
movq %rax, %r12
movq %rbx, %rdi
movq %r14, %rsi
callq 0x51b2
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x7e62
movq %rax, %r14
movq (%rbx), %rdi
movl $0x1, %esi
callq 0x85c6
movl $0x0, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jae 0x5c82
movl %eax, %eax
leaq 0x46f5(%rip), %rcx      # 0xa2b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x539b(%rip), %rdi      # 0xaf6a
leaq 0x4fe4(%rip), %rsi      # 0xabba
leaq 0x5afb(%rip), %rcx      # 0xb6d8
movl $0x13c, %edx            # imm = 0x13C
callq 0x1090
leaq 0x5a9a(%rip), %rdi      # 0xb688
leaq 0x4fc5(%rip), %rsi      # 0xabba
leaq 0x5adc(%rip), %rcx      # 0xb6d8
movl $0x12a, %edx            # imm = 0x12A
callq 0x1090
leaq 0x5c19(%rip), %rdi      # 0xb826
leaq 0x4fa6(%rip), %rsi      # 0xabba
leaq 0x5abd(%rip), %rcx      # 0xb6d8
movl $0x137, %edx            # imm = 0x137
callq 0x1090
leaq 0x5b39(%rip), %rdi      # 0xb765
leaq 0x4f87(%rip), %rsi      # 0xabba
leaq 0x5a9e(%rip), %rcx      # 0xb6d8
movl $0x131, %edx            # imm = 0x131
callq 0x1090
leaq 0x5b7a(%rip), %rdi      # 0xb7c5
leaq 0x4f68(%rip), %rsi      # 0xabba
leaq 0x5a7f(%rip), %rcx      # 0xb6d8
movl $0x134, %edx            # imm = 0x134
callq 0x1090
leaq 0x5a9b(%rip), %rdi      # 0xb705
leaq 0x4f49(%rip), %rsi      # 0xabba
leaq 0x5a60(%rip), %rcx      # 0xb6d8
movl $0x12e, %edx            # imm = 0x12E
callq 0x1090
leaq 0x516e(%rip), %rdi      # 0xadf7
leaq 0x4f2a(%rip), %rsi      # 0xabba
leaq 0x5a41(%rip), %rcx      # 0xb6d8
movl $0x140, %edx            # imm = 0x140
callq 0x1090
nop