// File: /workspace/github_c_makefile_star2_O3/sisshiki1969[P]monocc/src/codegen.c
// Function: gen_lor
void gen_lor(Node *node) {
  Type *l_ty = type(node->lhs);
  Type *r_ty = type(node->rhs);
  int reg_mode;
  char *true_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, "\tjne  %s\n", true_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, "\tjne  %s\n", true_label);

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

  emit_label(true_label);
  fprintf(output, "\tmov  rax, 1\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 0x3479
movq %r13, %rdi
callq 0xad74
testb %al, %al
jne 0x3479
movq 0x8(%r15), %rdi
leaq 0x9311(%rip), %rsi      # 0xc783
xorl %eax, %eax
callq 0x5502
movq %r12, %rdi
callq 0xadc4
testb %al, %al
jne 0x34a3
movq %r12, %rdi
callq 0xad74
testb %al, %al
jne 0x34a3
movq 0x10(%r15), %rdi
leaq 0x92e7(%rip), %rsi      # 0xc783
xorl %eax, %eax
callq 0x5502
movq %r13, %rdi
callq 0x1b38
movl %eax, %ebx
leaq 0xfd6c(%rip), %r14      # 0x13220
movq (%r14), %rcx
leaq 0x8e92(%rip), %rdi      # 0xc350
movl $0xa, %esi
movl $0x1, %edx
callq 0x1190
movq (%r14), %rdi
movslq %ebx, %rax
leaq 0xfc26(%rip), %rcx      # 0x13100
leaq (%rcx,%rax,4), %rdx
leaq 0x92c1(%rip), %rbp      # 0xc7a6
movq %rbp, %rsi
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rdi
leaq 0x92c8(%rip), %rbx      # 0xc7c1
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 0x8e1d(%rip), %rdi      # 0xc350
callq 0x1190
movq (%r14), %rdi
movslq %r15d, %rax
leaq 0xfbbb(%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 0x9039(%rip), %rdi      # 0xc5a6
movl $0xd, %esi
movl $0x1, %edx
callq 0x1190
movq (%r14), %rdi
leaq 0x8bfa(%rip), %rsi      # 0xc180
movq 0x10(%rsp), %r15
movq %r15, %rdx
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rdi
leaq 0x8bdc(%rip), %rbx      # 0xc17b
movq %rbx, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x10f0
movq (%r14), %rcx
leaq 0x91fd(%rip), %rdi      # 0xc7b3
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