// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xdda0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xdda0
movq %rax, -0x18(%rbp)
callq 0x1330
movq %rax, -0x28(%rbp)
callq 0x1330
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1b50
movq -0x10(%rbp), %rdi
callq 0xd490
testb $0x1, %al
jne 0x308d
movq -0x10(%rbp), %rdi
callq 0xd350
testb $0x1, %al
jne 0x308d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xc6ed(%rip), %rsi      # 0xf773
movb $0x0, %al
callq 0x6040
movq -0x18(%rbp), %rdi
callq 0xd490
testb $0x1, %al
jne 0x30bd
movq -0x18(%rbp), %rdi
callq 0xd350
testb $0x1, %al
jne 0x30bd
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xc6bd(%rip), %rsi      # 0xf773
movb $0x0, %al
callq 0x6040
movq -0x10(%rbp), %rdi
callq 0x1680
movl %eax, -0x1c(%rbp)
leaq 0x12140(%rip), %rax     # 0x15210
movq (%rax), %rdi
leaq 0xc266(%rip), %rsi      # 0xf340
movb $0x0, %al
callq 0x10f0
leaq 0x12128(%rip), %rax     # 0x15210
movq (%rax), %rdi
movslq -0x1c(%rbp), %rax
leaq 0x11ffa(%rip), %rdx     # 0x150f0
shlq $0x2, %rax
addq %rax, %rdx
leaq 0xc692(%rip), %rsi      # 0xf796
movb $0x0, %al
callq 0x10f0
leaq 0x120fe(%rip), %rax     # 0x15210
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0xc385(%rip), %rsi      # 0xf4a5
movb $0x0, %al
callq 0x10f0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x1b50
movq -0x18(%rbp), %rdi
callq 0x1680
movl %eax, -0x1c(%rbp)
leaq 0x120c9(%rip), %rax     # 0x15210
movq (%rax), %rdi
leaq 0xc1ef(%rip), %rsi      # 0xf340
movb $0x0, %al
callq 0x10f0
leaq 0x120b1(%rip), %rax     # 0x15210
movq (%rax), %rdi
movslq -0x1c(%rbp), %rax
leaq 0x11f83(%rip), %rdx     # 0x150f0
shlq $0x2, %rax
addq %rax, %rdx
leaq 0xc61b(%rip), %rsi      # 0xf796
movb $0x0, %al
callq 0x10f0
leaq 0x12087(%rip), %rax     # 0x15210
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0xc30e(%rip), %rsi      # 0xf4a5
movb $0x0, %al
callq 0x10f0
leaq 0x1206b(%rip), %rax     # 0x15210
movq (%rax), %rdi
leaq 0xc5f4(%rip), %rsi      # 0xf7a3
movb $0x0, %al
callq 0x10f0
movq -0x30(%rbp), %rdi
callq 0x13c0
movq -0x28(%rbp), %rdi
callq 0x1390
leaq 0x12041(%rip), %rax     # 0x15210
movq (%rax), %rdi
leaq 0xc3bd(%rip), %rsi      # 0xf596
movb $0x0, %al
callq 0x10f0
movq -0x30(%rbp), %rdi
callq 0x1390
addq $0x30, %rsp
popq %rbp
retq
nop