// File: /workspace/github_c_makefile_star2_O0/cogbee[P]vmir-latest/src/vmir_vm.c
// Function: emit_select
static void
emit_select(ir_unit_t *iu, ir_instr_select_t *ii)
{
  const ir_value_t *p  = value_get(iu, ii->pred.value);
  const ir_value_t *tv = value_get(iu, ii->true_value.value);
  const ir_value_t *fv = value_get(iu, ii->false_value.value);
  const ir_value_t *ret = value_get(iu, ii->super.ii_ret.value);
  const ir_type_t *ty = type_get(iu, ii->super.ii_ret.type);
  //  assert(tv->iv_type == fv->iv_type);
  const int code = legalize_type(ty);
  switch(COMBINE3(tv->iv_class, fv->iv_class, code)) {

  case COMBINE3(IR_VC_REGFRAME, IR_VC_REGFRAME, IR_TYPE_INT8):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_REGFRAME, IR_TYPE_INT16):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_REGFRAME, IR_TYPE_INT32):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_REGFRAME, IR_TYPE_POINTER):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_REGFRAME, IR_TYPE_FLOAT):
    emit_op4(iu, VM_SELECT32RR, value_reg(ret), value_reg(p),
             value_reg(tv), value_reg(fv));
    break;

  case COMBINE3(IR_VC_REGFRAME, IR_VC_CONSTANT, IR_TYPE_INT8):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_CONSTANT, IR_TYPE_INT16):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_CONSTANT, IR_TYPE_INT32):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_CONSTANT, IR_TYPE_FLOAT):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_CONSTANT, IR_TYPE_POINTER):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_GLOBALVAR, IR_TYPE_POINTER):
    emit_op3(iu, VM_SELECT32RC, value_reg(ret), value_reg(p),
             value_reg(tv));
    emit_i32(iu, value_get_const32(iu, fv) & type_code_mask(code));
    break;
  case COMBINE3(IR_VC_CONSTANT, IR_VC_REGFRAME, IR_TYPE_INT8):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_REGFRAME, IR_TYPE_INT16):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_REGFRAME, IR_TYPE_INT32):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_REGFRAME, IR_TYPE_FLOAT):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_REGFRAME, IR_TYPE_POINTER):
  case COMBINE3(IR_VC_GLOBALVAR, IR_VC_REGFRAME, IR_TYPE_POINTER):
    emit_op3(iu, VM_SELECT32CR, value_reg(ret), value_reg(p),
             value_reg(fv));
    emit_i32(iu, value_get_const32(iu, tv) & type_code_mask(code));
    break;
  case COMBINE3(IR_VC_CONSTANT, IR_VC_CONSTANT, IR_TYPE_INT8):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_CONSTANT, IR_TYPE_INT16):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_CONSTANT, IR_TYPE_INT32):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_CONSTANT, IR_TYPE_FLOAT):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_CONSTANT, IR_TYPE_POINTER):
  case COMBINE3(IR_VC_GLOBALVAR, IR_VC_CONSTANT, IR_TYPE_POINTER):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_GLOBALVAR, IR_TYPE_POINTER):
  case COMBINE3(IR_VC_GLOBALVAR, IR_VC_GLOBALVAR, IR_TYPE_POINTER):
    emit_op2(iu, VM_SELECT32CC, value_reg(ret), value_reg(p));
    emit_i32(iu, value_get_const32(iu, tv) & type_code_mask(code));
    emit_i32(iu, value_get_const32(iu, fv) & type_code_mask(code));
    break;


  case COMBINE3(IR_VC_REGFRAME, IR_VC_REGFRAME, IR_TYPE_INT64):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_REGFRAME, IR_TYPE_DOUBLE):
    emit_op4(iu, VM_SELECT64RR, value_reg(ret), value_reg(p),
             value_reg(tv), value_reg(fv));
    break;
  case COMBINE3(IR_VC_REGFRAME, IR_VC_CONSTANT, IR_TYPE_INT64):
  case COMBINE3(IR_VC_REGFRAME, IR_VC_CONSTANT, IR_TYPE_DOUBLE):
    vm_align32(iu, 0);
    emit_op3(iu, VM_SELECT64RC, value_reg(ret), value_reg(p),
             value_reg(tv));
    emit_i64(iu, value_get_const64(iu, fv));
    break;
  case COMBINE3(IR_VC_CONSTANT, IR_VC_REGFRAME, IR_TYPE_INT64):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_REGFRAME, IR_TYPE_DOUBLE):
    vm_align32(iu, 0);
    emit_op3(iu, VM_SELECT64CR, value_reg(ret), value_reg(p),
             value_reg(fv));
    emit_i64(iu, value_get_const64(iu, tv));
    break;
  case COMBINE3(IR_VC_CONSTANT, IR_VC_CONSTANT, IR_TYPE_INT64):
  case COMBINE3(IR_VC_CONSTANT, IR_VC_CONSTANT, IR_TYPE_DOUBLE):
    vm_align32(iu, 1);
    emit_op2(iu, VM_SELECT64CC, value_reg(ret), value_reg(p));
    emit_i64(iu, value_get_const64(iu, tv));
    emit_i64(iu, value_get_const64(iu, fv));
    break;


  default:
    parser_error(iu, "Unable to emit select for %s class %d,%d",
                 type_str(iu, ty), tv->iv_class, fv->iv_class);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x68(%rax), %esi
callq 0x20ee0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x58(%rax), %esi
callq 0x20ee0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x60(%rax), %esi
callq 0x20ee0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %esi
callq 0x20ee0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x30(%rax), %esi
callq 0x1ee20
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x45d0
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
shll $0x10, %eax
movq -0x28(%rbp), %rcx
movl (%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl -0x3c(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x40(%rbp)
subl $0x2020b, %eax          # imm = 0x2020B
je 0x30d92
jmp 0x30aac
movl -0x40(%rbp), %eax
subl $0x2030b, %eax          # imm = 0x2030B
je 0x30d92
jmp 0x30abc
movl -0x40(%rbp), %eax
subl $0x2050b, %eax          # imm = 0x2050B
je 0x30d14
jmp 0x30acc
movl -0x40(%rbp), %eax
subl $0x3020b, %eax          # imm = 0x3020B
je 0x30d92
jmp 0x30adc
movl -0x40(%rbp), %eax
addl $0xfffcfcfd, %eax       # imm = 0xFFFCFCFD
subl $0x3, %eax
jb 0x30d92
jmp 0x30aef
movl -0x40(%rbp), %eax
subl $0x30306, %eax          # imm = 0x30306
je 0x30ff3
jmp 0x30aff
movl -0x40(%rbp), %eax
subl $0x30308, %eax          # imm = 0x30308
je 0x30d92
jmp 0x30b0f
movl -0x40(%rbp), %eax
subl $0x30309, %eax          # imm = 0x30309
je 0x30ff3
jmp 0x30b1f
movl -0x40(%rbp), %eax
subl $0x3030b, %eax          # imm = 0x3030B
je 0x30d92
jmp 0x30b2f
movl -0x40(%rbp), %eax
addl $0xfffcfafd, %eax       # imm = 0xFFFCFAFD
subl $0x3, %eax
jb 0x30d14
jmp 0x30b42
movl -0x40(%rbp), %eax
subl $0x30506, %eax          # imm = 0x30506
je 0x30f5f
jmp 0x30b52
movl -0x40(%rbp), %eax
subl $0x30508, %eax          # imm = 0x30508
je 0x30d14
jmp 0x30b62
movl -0x40(%rbp), %eax
subl $0x30509, %eax          # imm = 0x30509
je 0x30f5f
jmp 0x30b72
movl -0x40(%rbp), %eax
subl $0x3050b, %eax          # imm = 0x3050B
je 0x30d14
jmp 0x30b82
movl -0x40(%rbp), %eax
subl $0x5020b, %eax          # imm = 0x5020B
je 0x30c96
jmp 0x30b92
movl -0x40(%rbp), %eax
addl $0xfffafcfd, %eax       # imm = 0xFFFAFCFD
subl $0x3, %eax
jb 0x30c96
jmp 0x30ba5
movl -0x40(%rbp), %eax
subl $0x50306, %eax          # imm = 0x50306
je 0x30ecb
jmp 0x30bb5
movl -0x40(%rbp), %eax
subl $0x50308, %eax          # imm = 0x50308
je 0x30c96
jmp 0x30bc5
movl -0x40(%rbp), %eax
subl $0x50309, %eax          # imm = 0x50309
je 0x30ecb
jmp 0x30bd5
movl -0x40(%rbp), %eax
subl $0x5030b, %eax          # imm = 0x5030B
je 0x30c96
jmp 0x30be5
movl -0x40(%rbp), %eax
addl $0xfffafafd, %eax       # imm = 0xFFFAFAFD
subl $0x3, %eax
jb 0x30c30
jmp 0x30bf4
movl -0x40(%rbp), %eax
subl $0x50506, %eax          # imm = 0x50506
je 0x30e4d
jmp 0x30c04
movl -0x40(%rbp), %eax
subl $0x50508, %eax          # imm = 0x50508
je 0x30c30
jmp 0x30c10
movl -0x40(%rbp), %eax
subl $0x50509, %eax          # imm = 0x50509
je 0x30e4d
jmp 0x30c20
movl -0x40(%rbp), %eax
subl $0x5050b, %eax          # imm = 0x5050B
jne 0x31093
jmp 0x30c30
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x321a0
movw %ax, -0x46(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0x44(%rbp)
movq -0x20(%rbp), %rdi
callq 0x321a0
movw %ax, -0x42(%rbp)
movq -0x28(%rbp), %rdi
callq 0x321a0
movq -0x50(%rbp), %rdi
movw -0x46(%rbp), %dx
movw -0x44(%rbp), %cx
movw -0x42(%rbp), %r8w
movl $0x163, %esi            # imm = 0x163
movzwl %dx, %edx
movzwl %cx, %ecx
movzwl %r8w, %r8d
movzwl %ax, %r9d
callq 0x32e90
jmp 0x310df
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rdi
callq 0x321a0
movw %ax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0x5e(%rbp)
movq -0x20(%rbp), %rdi
callq 0x321a0
movq -0x68(%rbp), %rdi
movw -0x60(%rbp), %dx
movw -0x5e(%rbp), %cx
movl $0x164, %esi            # imm = 0x164
movzwl %dx, %edx
movzwl %cx, %ecx
movzwl %ax, %r8d
callq 0x32430
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x261a0
movl %eax, -0x5c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x33080
movl -0x5c(%rbp), %esi
movq -0x58(%rbp), %rdi
andl %eax, %esi
callq 0x2b450
jmp 0x310df
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rdi
callq 0x321a0
movw %ax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0x76(%rbp)
movq -0x28(%rbp), %rdi
callq 0x321a0
movq -0x80(%rbp), %rdi
movw -0x78(%rbp), %dx
movw -0x76(%rbp), %cx
movl $0x165, %esi            # imm = 0x165
movzwl %dx, %edx
movzwl %cx, %ecx
movzwl %ax, %r8d
callq 0x32430
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x261a0
movl %eax, -0x74(%rbp)
movl -0x3c(%rbp), %edi
callq 0x33080
movl -0x74(%rbp), %esi
movq -0x70(%rbp), %rdi
andl %eax, %esi
callq 0x2b450
jmp 0x310df
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x30(%rbp), %rdi
callq 0x321a0
movw %ax, -0x9e(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movq -0xa8(%rbp), %rdi
movw -0x9e(%rbp), %cx
movl $0x166, %esi            # imm = 0x166
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x261a0
movl %eax, -0x9c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x33080
movl -0x9c(%rbp), %esi
movq -0x98(%rbp), %rdi
andl %eax, %esi
callq 0x2b450
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x261a0
movl %eax, -0x8c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x33080
movl -0x8c(%rbp), %esi
movq -0x88(%rbp), %rdi
andl %eax, %esi
callq 0x2b450
jmp 0x310df
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x30(%rbp), %rdi
callq 0x321a0
movw %ax, -0xae(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0xac(%rbp)
movq -0x20(%rbp), %rdi
callq 0x321a0
movw %ax, -0xaa(%rbp)
movq -0x28(%rbp), %rdi
callq 0x321a0
movq -0xb8(%rbp), %rdi
movw -0xae(%rbp), %dx
movw -0xac(%rbp), %cx
movw -0xaa(%rbp), %r8w
movl $0x167, %esi            # imm = 0x167
movzwl %dx, %edx
movzwl %cx, %ecx
movzwl %r8w, %r8d
movzwl %ax, %r9d
callq 0x32e90
jmp 0x310df
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x321f0
movq -0x8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x30(%rbp), %rdi
callq 0x321a0
movw %ax, -0xc4(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0xc2(%rbp)
movq -0x20(%rbp), %rdi
callq 0x321a0
movq -0xd0(%rbp), %rdi
movw -0xc4(%rbp), %dx
movw -0xc2(%rbp), %cx
movl $0x168, %esi            # imm = 0x168
movzwl %dx, %edx
movzwl %cx, %ecx
movzwl %ax, %r8d
callq 0x32430
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x322d0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x32240
jmp 0x310df
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x321f0
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x30(%rbp), %rdi
callq 0x321a0
movw %ax, -0xdc(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0xda(%rbp)
movq -0x28(%rbp), %rdi
callq 0x321a0
movq -0xe8(%rbp), %rdi
movw -0xdc(%rbp), %dx
movw -0xda(%rbp), %cx
movl $0x169, %esi            # imm = 0x169
movzwl %dx, %edx
movzwl %cx, %ecx
movzwl %ax, %r8d
callq 0x32430
movq -0x8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x322d0
movq -0xd8(%rbp), %rdi
movq %rax, %rsi
callq 0x32240
jmp 0x310df
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x321f0
movq -0x8(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x30(%rbp), %rdi
callq 0x321a0
movw %ax, -0xfa(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movq -0x108(%rbp), %rdi
movw -0xfa(%rbp), %cx
movl $0x16a, %esi            # imm = 0x16A
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x322d0
movq -0xf8(%rbp), %rdi
movq %rax, %rsi
callq 0x32240
movq -0x8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x322d0
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
callq 0x32240
jmp 0x310df
movq -0x8(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x4760
movq -0x110(%rbp), %rdi
movq %rax, %r8
movq -0x20(%rbp), %rax
movl (%rax), %r9d
movq -0x28(%rbp), %rax
movl (%rax), %eax
leaq 0xee56(%rip), %rsi      # 0x3ff1f
movl $0x113c, %edx           # imm = 0x113C
leaq 0xf4e5(%rip), %rcx      # 0x405ba
movl %eax, (%rsp)
movb $0x0, %al
callq 0x18220
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax,%rax)