// File: /workspace/github_c_makefile_star2_O3/sisshiki1969[P]monocc/src/codegen.c
// Function: gen_land
void gen_land(Node *node) {
  Type *l_ty = type(node->lhs);
  Type *r_ty = type(node->rhs);
  int reg_mode;
  char *false_label = new_label();
  char *exit_label = new_label();
  gen(node->lhs);

  if (!is_arith(l_ty) && !is_ptr(l_ty))
    error_at_node(node->lhs, "Illegal operation. (Type mismatch)");
  if (!is_arith(r_ty) && !is_ptr(r_ty))
    error_at_node(node->rhs, "Illegal operation. (Type mismatch)");

  reg_mode = reg_size(l_ty);
  fprintf(output, "\tpop  rax\n");
  fprintf(output, "\tcmp  %s, 0\n", reg_rax[reg_mode]);
  fprintf(output, "\tje   %s\n", false_label);

  gen(node->rhs);

  reg_mode = reg_size(r_ty);
  fprintf(output, "\tpop  rax\n");
  fprintf(output, "\tcmp  %s, 0\n", reg_rax[reg_mode]);
  fprintf(output, "\tje   %s\n", false_label);

  fprintf(output, "\tmov  rax, 1\n");
  emit_jmp(exit_label);

  emit_label(false_label);
  fprintf(output, "\tmov  rax, 0\n");
  emit_label(exit_label);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
movq 0x8(%rdi), %rdi
callq 0xb225
movq %rax, %r13
movq 0x10(%r15), %rdi
callq 0xb225
movq %rax, %r12
callq 0x1958
movq %rax, 0x8(%rsp)
callq 0x1958
movq %rax, 0x10(%rsp)
movq 0x8(%r15), %rdi
callq 0x1eaf
movq %r13, %rdi
callq 0xadc4
testb %al, %al
jne 0x329f
movq %r13, %rdi
callq 0xad74
testb %al, %al
jne 0x329f
movq 0x8(%r15), %rdi
leaq 0x94eb(%rip), %rsi      # 0xc783
xorl %eax, %eax
callq 0x5502
movq %r12, %rdi
callq 0xadc4
testb %al, %al
jne 0x32c9
movq %r12, %rdi
callq 0xad74
testb %al, %al
jne 0x32c9
movq 0x10(%r15), %rdi
leaq 0x94c1(%rip), %rsi      # 0xc783
xorl %eax, %eax
callq 0x5502
movq %r13, %rdi
callq 0x1b38
movl %eax, %ebx
leaq 0xff46(%rip), %r14      # 0x13220
movq (%r14), %rcx
leaq 0x906c(%rip), %rdi      # 0xc350
movl $0xa, %esi
movl $0x1, %edx
callq 0x1190
movq (%r14), %rdi
movslq %ebx, %rax
leaq 0xfe00(%rip), %rcx      # 0x13100
leaq (%rcx,%rax,4), %rdx
leaq 0x949b(%rip), %rbp      # 0xc7a6
movq %rbp, %rsi
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rdi
leaq 0x9196(%rip), %rbx      # 0xc4b5
movq %rbx, %rsi
movq 0x8(%rsp), %r13
movq %r13, %rdx
xorl %eax, %eax
callq 0x10f0
movq 0x10(%r15), %rdi
callq 0x1eaf
movq %r12, %rdi
callq 0x1b38
movl %eax, %r15d
movq (%r14), %rcx
movl $0xa, %esi
movl $0x1, %edx
leaq 0x8ff7(%rip), %rdi      # 0xc350
callq 0x1190
movq (%r14), %rdi
movslq %r15d, %rax
leaq 0xfd95(%rip), %rcx      # 0x13100
leaq (%rcx,%rax,4), %rdx
movq %rbp, %rsi
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rdi
movq %rbx, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rcx
leaq 0x9420(%rip), %rdi      # 0xc7b3
movl $0xd, %esi
movl $0x1, %edx
callq 0x1190
movq (%r14), %rdi
leaq 0x8dd4(%rip), %rsi      # 0xc180
movq 0x10(%rsp), %r15
movq %r15, %rdx
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rdi
leaq 0x8db6(%rip), %rbx      # 0xc17b
movq %rbx, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rcx
leaq 0x91ca(%rip), %rdi      # 0xc5a6
movl $0xd, %esi
movl $0x1, %edx
callq 0x1190
movq (%r14), %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0