// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x70(%rsp), %r15
movl (%r15), %eax
xorl $0x2, %eax
movl 0x98(%rsp), %ecx
movl %ecx, %esi
xorl $0x3, %esi
orl %eax, %esi
jne 0x114c2
cvtsi2sdl 0x8(%r15), %xmm0
movl $0x3, (%r15)
movsd %xmm0, 0x8(%r15)
leaq 0x98(%rsp), %rax
movl (%r15), %esi
cmpq $0x4, %rsi
je 0x11537
cmpl $0x3, %esi
je 0x11573
cmpl $0x2, %esi
jne 0x11732
movl %ecx, %esi
andl $-0x2, %esi
cmpl $0x2, %esi
jne 0x11705
xorl %edi, %edi
cvttsd2si 0x8(%rax), %esi
cmpl $0x3, %ecx
cmovnel %edi, %esi
cmpl $0x2, %ecx
jne 0x11508
movl 0x8(%rax), %esi
movzbl (%rdx), %eax
addl $-0x25, %eax
cmpl $0xa, %eax
ja 0x11705
leaq 0x33ae(%rip), %rcx      # 0x148cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x8(%r15), %eax
cltd
idivl %esi
movl %edx, 0x8(%r15)
jmp 0x116b9
cmpb $0x2b, (%rdx)
jne 0x116f2
cmpl $0x4, %ecx
movq %r14, 0x8(%rsp)
je 0x115a5
cmpl $0x3, %ecx
je 0x115ae
cmpl $0x2, %ecx
jne 0x116f2
movl 0x8(%rax), %edx
leaq 0x4b5c(%rip), %rsi      # 0x160be
leaq 0x10(%rsp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x2240
jmp 0x115c9
movl %ecx, %esi
andl $-0x2, %esi
cmpl $0x2, %esi
jne 0x11718
cmpl $0x2, %ecx
jne 0x11593
xorps %xmm0, %xmm0
cvtsi2sdl 0x8(%rax), %xmm0
jmp 0x1162e
cmpl $0x3, %ecx
je 0x11629
xorpd %xmm0, %xmm0
jmp 0x1162e
movq 0x8(%rax), %rax
movq (%rax), %r12
jmp 0x115c9
movsd 0x8(%rax), %xmm0
leaq 0x4b07(%rip), %rsi      # 0x160c1
leaq 0x10(%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
movl $0x1, %edi
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 0x8(%rsp), %rsi
movq %r13, %rdx
movl %r14d, %ecx
callq 0x1062c
jmp 0x116b9
movsd 0x8(%rax), %xmm0
movzbl (%rdx), %eax
addl $-0x25, %eax
cmpl $0xa, %eax
ja 0x11718
leaq 0x325c(%rip), %rcx      # 0x148a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cvttsd2si 0x8(%r15), %eax
cvttsd2si %xmm0, %ecx
cltd
idivl %ecx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
jmp 0x116b3
imull 0x8(%r15), %esi
movl %esi, 0x8(%r15)
jmp 0x116b9
movl 0x8(%r15), %eax
cltd
idivl %esi
movl %eax, 0x8(%r15)
jmp 0x116b9
mulsd 0x8(%r15), %xmm0
jmp 0x116b3
subl %esi, 0x8(%r15)
jmp 0x116b9
addl %esi, 0x8(%r15)
jmp 0x116b9
movsd 0x8(%r15), %xmm1
divsd %xmm0, %xmm1
jmp 0x116a5
movsd 0x8(%r15), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%r15)
jmp 0x116b9
addsd 0x8(%r15), %xmm0
movsd %xmm0, 0x8(%r15)
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 $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa8ff(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
leaq 0x49c1(%rip), %rsi      # 0x160c4
jmp 0x11729
movq 0xa8ec(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
leaq 0x4968(%rip), %rsi      # 0x1607e
jmp 0x11729
movq 0xa8d9(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
leaq 0x4974(%rip), %rsi      # 0x1609d
xorl %eax, %eax
callq 0x2160
jmp 0x11766
movq 0xa8bf(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
cmpl $0xd, %esi
ja 0x11751
leaq 0x32e8(%rip), %rax      # 0x14a30
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmp 0x11758
leaq 0x491e(%rip), %rcx      # 0x16076
leaq 0x4987(%rip), %rsi      # 0x160e6
xorl %eax, %eax
callq 0x2160
movl $0x1, 0x20(%r14)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
movupd %xmm0, 0x10(%rbx)
movq $0x0, 0x20(%rbx)
jmp 0x116e0