// File: /workspace/github_c_makefile_star2_O1/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 0xb354
movq %rax, %r13
movq 0x10(%r15), %rdi
callq 0xb354
movq %rax, %r12
callq 0x1958
movq %rax, 0x8(%rsp)
callq 0x1958
movq %rax, 0x10(%rsp)
movq 0x8(%r15), %rdi
callq 0x1ead
movq %r13, %rdi
callq 0xaef0
testb %al, %al
jne 0x32c7
movq %r13, %rdi
callq 0xaea0
testb %al, %al
jne 0x32c7
movq 0x8(%r15), %rdi
leaq 0x94c3(%rip), %rsi      # 0xc783
xorl %eax, %eax
callq 0x552e
movq %r12, %rdi
callq 0xaef0
testb %al, %al
jne 0x32f1
movq %r12, %rdi
callq 0xaea0
testb %al, %al
jne 0x32f1
movq 0x10(%r15), %rdi
leaq 0x9499(%rip), %rsi      # 0xc783
xorl %eax, %eax
callq 0x552e
movq %r13, %rdi
callq 0x1b36
movl %eax, %ebx
leaq 0xff1e(%rip), %r14      # 0x13220
movq (%r14), %rcx
leaq 0x9044(%rip), %rdi      # 0xc350
movl $0xa, %esi
movl $0x1, %edx
callq 0x1190
movq (%r14), %rdi
movslq %ebx, %rax
leaq 0xfdd8(%rip), %rcx      # 0x13100
leaq (%rcx,%rax,4), %rdx
leaq 0x9473(%rip), %rbp      # 0xc7a6
movq %rbp, %rsi
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rdi
leaq 0x916e(%rip), %rbx      # 0xc4b5
movq %rbx, %rsi
movq 0x8(%rsp), %r13
movq %r13, %rdx
xorl %eax, %eax
callq 0x10f0
movq 0x10(%r15), %rdi
callq 0x1ead
movq %r12, %rdi
callq 0x1b36
movl %eax, %r15d
movq (%r14), %rcx
movl $0xa, %esi
movl $0x1, %edx
leaq 0x8fcf(%rip), %rdi      # 0xc350
callq 0x1190
movq (%r14), %rdi
movslq %r15d, %rax
leaq 0xfd6d(%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 0x93f8(%rip), %rdi      # 0xc7b3
movl $0xd, %esi
movl $0x1, %edx
callq 0x1190
movq (%r14), %rdi
leaq 0x8dac(%rip), %rsi      # 0xc180
movq 0x10(%rsp), %r15
movq %r15, %rdx
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rdi
leaq 0x8d8e(%rip), %rbx      # 0xc17b
movq %rbx, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rcx
leaq 0x91a2(%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