// File: /workspace/github_c_makefile_star2_O0/cogbee[P]vmir-latest/src/vmir_wasm_parser.c
// Function: wasm_convert
static void
wasm_convert(ir_unit_t *iu, ir_bb_t *ib, int code)
{
  ir_instr_unary_t *i = instr_add(ib, sizeof(ir_instr_unary_t), IR_IC_CAST);
  int op;
  int type;
  switch(code) {
  case 0xa7:  op = CAST_TRUNC;   type = WASM_TYPE_I32;   break;
  case 0xa8:  op = CAST_FPTOSI;  type = WASM_TYPE_I32;   break;
  case 0xa9:  op = CAST_FPTOUI;  type = WASM_TYPE_I32;   break;
  case 0xaa:  op = CAST_FPTOSI;  type = WASM_TYPE_I32;   break;
  case 0xab:  op = CAST_FPTOUI;  type = WASM_TYPE_I32;   break;

  case 0xac:  op = CAST_SEXT;    type = WASM_TYPE_I64;   break;
  case 0xad:  op = CAST_ZEXT;    type = WASM_TYPE_I64;   break;
  case 0xae:  op = CAST_FPTOSI;  type = WASM_TYPE_I64;   break;
  case 0xaf:  op = CAST_FPTOUI;  type = WASM_TYPE_I64;   break;
  case 0xb0:  op = CAST_FPTOSI;  type = WASM_TYPE_I64;   break;
  case 0xb1:  op = CAST_FPTOUI;  type = WASM_TYPE_I64;   break;

  case 0xb2:  op = CAST_SITOFP;  type = WASM_TYPE_F32;   break;
  case 0xb3:  op = CAST_UITOFP;  type = WASM_TYPE_F32;   break;
  case 0xb4:  op = CAST_SITOFP;  type = WASM_TYPE_F32;   break;
  case 0xb5:  op = CAST_UITOFP;  type = WASM_TYPE_F32;   break;
  case 0xb6:  op = CAST_FPTRUNC; type = WASM_TYPE_F32;   break;

  case 0xb7:  op = CAST_SITOFP;  type = WASM_TYPE_F64;   break;
  case 0xb8:  op = CAST_UITOFP;  type = WASM_TYPE_F64;   break;
  case 0xb9:  op = CAST_SITOFP;  type = WASM_TYPE_F64;   break;
  case 0xba:  op = CAST_UITOFP;  type = WASM_TYPE_F64;   break;
  case 0xbb:  op = CAST_FPEXT;   type = WASM_TYPE_F64;   break;
  case 0xbc:  op = CAST_BITCAST; type = WASM_TYPE_I32;   break;
  case 0xbd:  op = CAST_BITCAST; type = WASM_TYPE_I64;   break;
  case 0xbe:  op = CAST_BITCAST; type = WASM_TYPE_F32;   break;
  case 0xbf:  op = CAST_BITCAST; type = WASM_TYPE_F64;   break;

  default:
    parser_error(iu, "Can't handle convert opcode 0x%x", code);
  }
  i->op = op;
  i->value = vstack_pop(iu);
  value_alloc_instr_ret(iu, type, &i->super);
  vstack_push(iu, i->super.ii_ret);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl $0x68, %esi
movl $0x3, %edx
callq 0x20c10
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %eax
addl $0xffffff59, %eax       # imm = 0xFFFFFF59
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x18, %eax
ja 0x220be
movq -0x38(%rbp), %rax
leaq 0x1b4f8(%rip), %rcx     # 0x3d3e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
jmp 0x220e0
movl $0x4, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
jmp 0x220e0
movl $0x3, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
jmp 0x220e0
movl $0x4, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
jmp 0x220e0
movl $0x3, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
jmp 0x220e0
movl $0x2, -0x24(%rbp)
movl $0x2, -0x28(%rbp)
jmp 0x220e0
movl $0x1, -0x24(%rbp)
movl $0x2, -0x28(%rbp)
jmp 0x220e0
movl $0x4, -0x24(%rbp)
movl $0x2, -0x28(%rbp)
jmp 0x220e0
movl $0x3, -0x24(%rbp)
movl $0x2, -0x28(%rbp)
jmp 0x220e0
movl $0x4, -0x24(%rbp)
movl $0x2, -0x28(%rbp)
jmp 0x220e0
movl $0x3, -0x24(%rbp)
movl $0x2, -0x28(%rbp)
jmp 0x220e0
movl $0x6, -0x24(%rbp)
movl $0x3, -0x28(%rbp)
jmp 0x220e0
movl $0x5, -0x24(%rbp)
movl $0x3, -0x28(%rbp)
jmp 0x220e0
movl $0x6, -0x24(%rbp)
movl $0x3, -0x28(%rbp)
jmp 0x220e0
movl $0x5, -0x24(%rbp)
movl $0x3, -0x28(%rbp)
jmp 0x220e0
movl $0x7, -0x24(%rbp)
movl $0x3, -0x28(%rbp)
jmp 0x220e0
movl $0x6, -0x24(%rbp)
movl $0x4, -0x28(%rbp)
jmp 0x220e0
movl $0x5, -0x24(%rbp)
movl $0x4, -0x28(%rbp)
jmp 0x220e0
movl $0x6, -0x24(%rbp)
movl $0x4, -0x28(%rbp)
jmp 0x220e0
movl $0x5, -0x24(%rbp)
movl $0x4, -0x28(%rbp)
jmp 0x220e0
movl $0x8, -0x24(%rbp)
movl $0x4, -0x28(%rbp)
jmp 0x220e0
movl $0xb, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
jmp 0x220e0
movl $0xb, -0x24(%rbp)
movl $0x2, -0x28(%rbp)
jmp 0x220e0
movl $0xb, -0x24(%rbp)
movl $0x3, -0x28(%rbp)
jmp 0x220e0
movl $0xb, -0x24(%rbp)
movl $0x4, -0x28(%rbp)
jmp 0x220e0
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %r8d
leaq 0x1c70f(%rip), %rsi     # 0x3e7dc
movl $0x2a6, %edx            # imm = 0x2A6
leaq 0x1cf43(%rip), %rcx     # 0x3f01c
movb $0x0, %al
callq 0x18220
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x60(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1ea10
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq %rcx, 0x58(%rax)
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0x22410
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x2c(%rax), %rsi
callq 0x1f360
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)