// File: /workspace/github_c_makefile_star2_O3/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 %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x98(%rsp), %rax
leaq 0x70(%rsp), %r15
movl (%r15), %edi
movl %edi, %edx
xorl $0x2, %edx
movl (%rax), %ecx
movl %ecx, %esi
xorl $0x3, %esi
orl %edx, %esi
jne 0x111e3
cvtsi2sdl 0x8(%r15), %xmm0
movl $0x3, (%r15)
movsd %xmm0, 0x8(%r15)
cmpl $0x3, %ecx
je 0x1124e
xorpd %xmm0, %xmm0
jmp 0x112ba
cmpl $0x4, %edi
je 0x11255
cmpl $0x3, %edi
je 0x1129e
cmpl $0x2, %edi
jne 0x11464
movl %ecx, %edx
andl $-0x2, %edx
cmpl $0x2, %edx
jne 0x11427
xorl %edx, %edx
cvttsd2si 0x8(%rax), %esi
cmpl $0x3, %ecx
cmovnel %edx, %esi
cmpl $0x2, %ecx
jne 0x1121d
movl 0x8(%rax), %esi
movzbl (%r12), %eax
addl $-0x25, %eax
cmpl $0xa, %eax
ja 0x11427
leaq 0x3677(%rip), %rcx      # 0x148ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x8(%r15), %eax
cltd
idivl %esi
movl %edx, 0x8(%r15)
jmp 0x113a7
movsd 0x8(%rax), %xmm0
jmp 0x112ba
cmpb $0x2b, (%r12)
jne 0x11414
cmpl $0x4, %ecx
movq %r13, 0x8(%rsp)
je 0x11328
cmpl $0x3, %ecx
je 0x11331
cmpl $0x2, %ecx
jne 0x11414
movl 0x8(%rax), %edx
leaq 0x4e10(%rip), %rsi      # 0x1609a
leaq 0x10(%rsp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x2240
jmp 0x1134c
movl %ecx, %edx
andl $-0x2, %edx
cmpl $0x2, %edx
jne 0x11401
cmpl $0x2, %ecx
jne 0x111d5
cvtsi2sdl 0x8(%rax), %xmm0
movzbl (%r12), %eax
addl $-0x25, %eax
cmpl $0xa, %eax
ja 0x11401
leaq 0x3606(%rip), %rcx      # 0x148d8
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 0x11320
mulsd 0x8(%r15), %xmm0
jmp 0x11320
movsd 0x8(%r15), %xmm1
divsd %xmm0, %xmm1
jmp 0x1130f
movsd 0x8(%r15), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%r15)
jmp 0x113a7
addsd 0x8(%r15), %xmm0
movsd %xmm0, 0x8(%r15)
jmp 0x113a7
movq 0x8(%rax), %rax
movq (%rax), %r12
jmp 0x1134c
movsd 0x8(%rax), %xmm0
leaq 0x4d60(%rip), %rsi      # 0x1609d
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 0x10344
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)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
imull 0x8(%r15), %esi
movl %esi, 0x8(%r15)
jmp 0x113a7
movl 0x8(%r15), %eax
cltd
idivl %esi
movl %eax, 0x8(%r15)
jmp 0x113a7
subl %esi, 0x8(%r15)
jmp 0x113a7
addl %esi, 0x8(%r15)
jmp 0x113a7
movq 0xabf0(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
leaq 0x4c67(%rip), %rsi      # 0x16079
jmp 0x11438
movq 0xabdd(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
leaq 0x4c7b(%rip), %rsi      # 0x160a0
jmp 0x11438
movq 0xabca(%rip), %rax      # 0x1bff8
movq (%rax), %rdi
leaq 0x4c22(%rip), %rsi      # 0x1605a
movq %r12, %rdx
xorl %eax, %eax
callq 0x2160
movl $0x1, 0x20(%r13)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
movupd %xmm0, 0x10(%rbx)
movq $0x0, 0x20(%rbx)
jmp 0x113ce
movq 0xab8d(%rip), %rax      # 0x1bff8
movq (%rax), %r14
callq 0x11085
leaq 0x4c48(%rip), %rsi      # 0x160c2
movq %r14, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2160
jmp 0x11442