// File: /workspace/github_c_makefile_star2_O2/mattn[P]orelang/ore.c
// Function: ore_expr0
static ore_value
ore_expr0(ore_context* ore, ore_value lhs, const char* op, ore_value rhs) {
  if (lhs.t== ORE_TYPE_INT && rhs.t == ORE_TYPE_FLOAT) {
    double d = (double) lhs.v.i;
    lhs.t = ORE_TYPE_FLOAT;
    lhs.v.d = d;
  }
  switch (lhs.t) {
    case ORE_TYPE_INT:
      if (rhs.t == ORE_TYPE_INT || rhs.t== ORE_TYPE_FLOAT)
      {
        int iv = rhs.t == ORE_TYPE_INT ? rhs.v.i : rhs.t == ORE_TYPE_FLOAT ? (int) rhs.v.d : 0;
        if (*op == '+') { lhs.v.i += iv; }
        else if (*op == '-') { lhs.v.i -= iv; }
        else if (*op == '*') { lhs.v.i *= iv; }
        else if (*op == '/') { lhs.v.i /= iv; }
        else if (*op == '%') { lhs.v.i %= iv; }
        else {
          fprintf(stderr, "unknown operator '%s' for int\n", op);
          ore->err = ORE_ERROR_EXCEPTION;
          return ore_value_nil();
        }
      } else {
        fprintf(stderr, "unknown operator '%s' for int\n", op);
        ore->err = ORE_ERROR_EXCEPTION;
        return ore_value_nil();
      }
      break;
    case ORE_TYPE_FLOAT:
      if (rhs.t == ORE_TYPE_INT || rhs.t== ORE_TYPE_FLOAT)
      {
        double fv = rhs.t == ORE_TYPE_INT ? (double) rhs.v.i : rhs.t == ORE_TYPE_FLOAT ? rhs.v.d : 0;
        if (*op == '+') { lhs.v.d += fv; }
        else if (*op == '-') { lhs.v.d -= fv; }
        else if (*op == '*') { lhs.v.d *= fv; }
        else if (*op == '/') { lhs.v.d /= fv; }
        else if (*op == '%') { lhs.v.d = ((int) lhs.v.d % (int) fv); }
        else {
          fprintf(stderr, "unknown operator '%s' for float\n", op);
          ore->err = ORE_ERROR_EXCEPTION;
          return ore_value_nil();
        }
      } else {
        fprintf(stderr, "unknown operator '%s' for float\n", op);
        ore->err = ORE_ERROR_EXCEPTION;
        return ore_value_nil();
      }
      break;
    case ORE_TYPE_STRING:
      {
        char buf[32], *p = buf;
        if (*op == '+') {
          if (rhs.t == ORE_TYPE_INT)
            sprintf(buf, "%i", rhs.v.i);
          else if (rhs.t == ORE_TYPE_FLOAT)
            sprintf(buf, "%f", rhs.v.d);
          else if (rhs.t == ORE_TYPE_STRING)
            p = rhs.v.s->p;
          else {
            fprintf(stderr, "unknown operator '%s' for string\n", op);
            ore->err = ORE_ERROR_EXCEPTION;
            return ore_value_nil();
          }

          size_t l = strlen(p) + strlen(lhs.v.s->p);
          char* s = calloc(1, l + 1);
          strcpy(s, lhs.v.s->p);
          strcat(s, p);
          lhs = ore_value_str_from_ptr(ore, s, l);
        } else {
          fprintf(stderr, "unknown operator '%s' for string\n", op);
          ore->err = ORE_ERROR_EXCEPTION;
          return ore_value_nil();
        }
      }
      break;
    default:
      fprintf(stderr, "unknown operator '%s' for %s\n", op, ore_kind(lhs));
      ore->err = ORE_ERROR_EXCEPTION;
      return ore_value_nil();
  }
  return lhs;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0xb8(%rsp), %rax
leaq 0x90(%rsp), %r15
movl (%r15), %edx
movl %edx, %esi
xorl $0x2, %esi
movl (%rax), %ecx
movl %ecx, %edi
xorl $0x3, %edi
orl %esi, %edi
jne 0xeaf7
cvtsi2sdl 0x8(%r15), %xmm0
movl $0x3, (%r15)
movsd %xmm0, 0x8(%r15)
cmpl $0x3, %ecx
je 0xeb62
xorpd %xmm0, %xmm0
jmp 0xebce
cmpl $0x4, %edx
je 0xeb69
cmpl $0x3, %edx
je 0xebb2
cmpl $0x2, %edx
jne 0xed73
movl %ecx, %edx
andl $-0x2, %edx
cmpl $0x2, %edx
jne 0xed39
xorl %edx, %edx
cvttsd2si 0x8(%rax), %esi
cmpl $0x3, %ecx
cmovnel %edx, %esi
cmpl $0x2, %ecx
jne 0xeb31
movl 0x8(%rax), %esi
movzbl (%r12), %eax
addl $-0x25, %eax
cmpl $0xa, %eax
ja 0xed39
leaq 0x1d2f(%rip), %rcx      # 0x10878
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x8(%r15), %eax
cltd
idivl %esi
movl %edx, 0x8(%r15)
jmp 0xecb6
movsd 0x8(%rax), %xmm0
jmp 0xebce
cmpb $0x2b, (%r12)
jne 0xed26
cmpl $0x4, %ecx
movq %r13, 0x28(%rsp)
je 0xec39
cmpl $0x3, %ecx
je 0xec42
cmpl $0x2, %ecx
jne 0xed26
movl 0x8(%rax), %edx
leaq 0x3470(%rip), %rsi      # 0x1200e
leaq 0x30(%rsp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x2240
jmp 0xec5d
movl %ecx, %edx
andl $-0x2, %edx
cmpl $0x2, %edx
jne 0xed13
cmpl $0x2, %ecx
jne 0xeae9
cvtsi2sdl 0x8(%rax), %xmm0
movzbl (%r12), %eax
addl $-0x25, %eax
cmpl $0xa, %eax
ja 0xed13
leaq 0x1cbe(%rip), %rcx      # 0x108a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cvttsd2si 0x8(%r15), %eax
cvttsd2si %xmm0, %ecx
cltd
idivl %ecx
cvtsi2sd %edx, %xmm0
jmp 0xec31
mulsd 0x8(%r15), %xmm0
jmp 0xec31
movsd 0x8(%r15), %xmm1
divsd %xmm0, %xmm1
jmp 0xec20
movsd 0x8(%r15), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%r15)
jmp 0xecb6
addsd 0x8(%r15), %xmm0
movsd %xmm0, 0x8(%r15)
jmp 0xecb6
movq 0x8(%rax), %rax
movq (%rax), %r12
jmp 0xec5d
movsd 0x8(%rax), %xmm0
leaq 0x33c3(%rip), %rsi      # 0x12011
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movb $0x1, %al
callq 0x2240
movq %r12, %rdi
callq 0x20c0
movq %rax, %r13
movq 0x8(%r15), %rax
movq (%rax), %rbp
movq %rbp, %rdi
callq 0x20c0
leaq (%rax,%r13), %r14
leaq (%rax,%r13), %rsi
incq %rsi
pushq $0x1
popq %rdi
callq 0x2140
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2060
movq %r13, %rdi
movq %r12, %rsi
callq 0x2230
movq %r15, %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
movl %r14d, %ecx
callq 0xe0cb
movq 0x20(%r15), %rax
movq %rax, 0x20(%rbx)
movq (%r15), %rax
movl 0x8(%r15), %ecx
movl 0xc(%r15), %edx
movupd 0x10(%r15), %xmm0
movupd %xmm0, 0x10(%rbx)
movq %rax, (%rbx)
movl %ecx, 0x8(%rbx)
movl %edx, 0xc(%rbx)
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
imull 0x8(%r15), %esi
movl %esi, 0x8(%r15)
jmp 0xecb6
movl 0x8(%r15), %eax
cltd
idivl %esi
movl %eax, 0x8(%r15)
jmp 0xecb6
subl %esi, 0x8(%r15)
jmp 0xecb6
addl %esi, 0x8(%r15)
jmp 0xecb6
movq 0x92de(%rip), %rax      # 0x17ff8
movq (%rax), %rdi
leaq 0x32c9(%rip), %rsi      # 0x11fed
jmp 0xed4a
movq 0x92cb(%rip), %rax      # 0x17ff8
movq (%rax), %rdi
leaq 0x32dd(%rip), %rsi      # 0x12014
jmp 0xed4a
movq 0x92b8(%rip), %rax      # 0x17ff8
movq (%rax), %rdi
leaq 0x3284(%rip), %rsi      # 0x11fce
movq %r12, %rdx
xorl %eax, %eax
callq 0x2160
movl $0x1, 0x20(%r13)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
movupd %xmm0, 0x10(%rbx)
andq $0x0, 0x20(%rbx)
jmp 0xecdd
movq 0x927e(%rip), %rax      # 0x17ff8
movq (%rax), %r14
movq 0x20(%r15), %rax
movq %rax, 0x20(%rsp)
movupd (%r15), %xmm0
movupd 0x10(%r15), %xmm1
movupd %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
callq 0xea7b
leaq 0x328e(%rip), %rsi      # 0x12036
movq %r14, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2160
jmp 0xed54