// File: /workspace/github_c_makefile_star2_O0/cogbee[P]vmir-latest/src/vmir_vm.c
// Function: emit_load1
static void
emit_load1(ir_unit_t *iu, const ir_value_t *src,
           const ir_value_t *ret, const ir_type_t *retty,
           const ir_value_t *roff,
           int immediate_offset, int value_offset_multiply,
           const ir_instr_load_t *ii)
{
  const int has_offset = immediate_offset != 0 || roff != NULL;

  switch(COMBINE3(src->iv_class, legalize_type(retty), has_offset)) {

  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT1, 0):
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT8, 0):
    emit_op2(iu, VM_LOAD8, value_reg(ret), value_reg(src));
    return;
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT8, 1):
    emit_op2(iu, roff ? VM_LOAD8_ROFF : VM_LOAD8_OFF,
             value_reg(ret), value_reg(src));
    emit_imm16(iu, immediate_offset);
    break;
  case COMBINE3(IR_VC_CONSTANT,  IR_TYPE_INT8, 0):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_INT8, 0):
  case COMBINE3(IR_VC_CONSTANT,  IR_TYPE_INT8, 1):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_INT8, 1):
    emit_op1(iu, VM_LOAD8_G, value_reg(ret));
    emit_i32(iu, value_get_const32(iu, src) + immediate_offset);
    return;

  case COMBINE3(IR_VC_CONSTANT, IR_TYPE_INT1, 0):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_INT1, 0):
    emit_op1(iu, VM_LOAD8_G, 0);
    emit_i32(iu, value_get_const32(iu, src));
    emit_op2(iu, VM_CAST_1_TRUNC_8, value_reg(ret), 0);
    return;

  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT16, 0):
    emit_op2(iu, VM_LOAD16, value_reg(ret), value_reg(src));
    return;
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_INT16, 0):
  case COMBINE3(IR_VC_CONSTANT,  IR_TYPE_INT16, 0):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_INT16, 1):
  case COMBINE3(IR_VC_CONSTANT,  IR_TYPE_INT16, 1):
    emit_op1(iu, VM_LOAD16_G, value_reg(ret));
    emit_i32(iu, value_get_const32(iu, src) + immediate_offset);
    return;
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT16, 1):
    emit_op2(iu, roff ? VM_LOAD16_ROFF : VM_LOAD16_OFF,
             value_reg(ret), value_reg(src));
    emit_imm16(iu, immediate_offset);
    break;

  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_INT32, 0):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_POINTER, 0):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_FLOAT, 0):
  case COMBINE3(IR_VC_CONSTANT, IR_TYPE_INT32, 0):
  case COMBINE3(IR_VC_CONSTANT, IR_TYPE_POINTER, 0):
  case COMBINE3(IR_VC_CONSTANT, IR_TYPE_FLOAT, 0):
  case COMBINE3(IR_VC_CONSTANT, IR_TYPE_INT32, 1):
  case COMBINE3(IR_VC_CONSTANT, IR_TYPE_POINTER, 1):
  case COMBINE3(IR_VC_CONSTANT, IR_TYPE_FLOAT, 1):
    emit_op1(iu, VM_LOAD32_G, value_reg(ret));
    emit_i32(iu, value_get_const32(iu, src) + immediate_offset);
    return;
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT32, 0):
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_POINTER, 0):
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_FLOAT, 0):
    emit_op2(iu, VM_LOAD32, value_reg(ret), value_reg(src));
    return;
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT32, 1):
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_POINTER, 1):
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_FLOAT, 1):
    emit_op2(iu, roff ? VM_LOAD32_ROFF : VM_LOAD32_OFF,
             value_reg(ret), value_reg(src));
    emit_imm16(iu, immediate_offset);
    break;


  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_INT64,  0):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_DOUBLE, 0):
  case COMBINE3(IR_VC_CONSTANT,  IR_TYPE_INT64,  0):
  case COMBINE3(IR_VC_CONSTANT,  IR_TYPE_DOUBLE, 0):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_INT64,  1):
  case COMBINE3(IR_VC_GLOBALVAR, IR_TYPE_DOUBLE, 1):
  case COMBINE3(IR_VC_CONSTANT,  IR_TYPE_INT64,  1):
  case COMBINE3(IR_VC_CONSTANT,  IR_TYPE_DOUBLE, 1):
    emit_op1(iu, VM_LOAD64_G, value_reg(ret));
    emit_i32(iu, value_get_const32(iu, src) + immediate_offset);
    return;
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT64, 0):
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_DOUBLE, 0):
    emit_op2(iu, VM_LOAD64, value_reg(ret), value_reg(src));
    return;
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_INT64, 1):
  case COMBINE3(IR_VC_REGFRAME, IR_TYPE_DOUBLE, 1):
    emit_op2(iu, roff ? VM_LOAD64_ROFF : VM_LOAD64_OFF,
             value_reg(ret), value_reg(src));
    emit_imm16(iu, immediate_offset);
    break;

  default:
    parser_error(iu, "Can't load from class %d %s immediate-offset:%d (%s)",
                 src->iv_class, type_str(iu, retty),
                 has_offset,
                 instr_str(iu, &ii->super, 0));
  }
  if(roff != NULL) {
    emit_i16(iu, value_reg(roff));
    emit_i16(iu, value_offset_multiply);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movb $0x1, %al
cmpl $0x0, -0x2c(%rbp)
movb %al, -0x31(%rbp)
jne 0x32630
cmpq $0x0, -0x28(%rbp)
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
movzbl %al, %eax
andl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shll $0x10, %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rdi
callq 0x45d0
movl %eax, %ecx
movl -0x3c(%rbp), %eax
shll $0x8, %ecx
orl %ecx, %eax
movl -0x30(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x38(%rbp)
subl $0x20200, %eax          # imm = 0x20200
je 0x32956
jmp 0x32670
movl -0x38(%rbp), %eax
addl $0xfffdfd00, %eax       # imm = 0xFFFDFD00
subl $0x2, %eax
jb 0x3290c
jmp 0x32683
movl -0x38(%rbp), %eax
addl $0xfffdfc00, %eax       # imm = 0xFFFDFC00
subl $0x2, %eax
jb 0x329f0
jmp 0x32696
movl -0x38(%rbp), %eax
subl $0x20500, %eax          # imm = 0x20500
je 0x32ab5
jmp 0x326a6
movl -0x38(%rbp), %eax
addl $0xfffdfa00, %eax       # imm = 0xFFFDFA00
subl $0x2, %eax
jb 0x32bc1
jmp 0x326b9
movl -0x38(%rbp), %eax
subl $0x20800, %eax          # imm = 0x20800
je 0x32ab5
jmp 0x326c9
movl -0x38(%rbp), %eax
addl $0xfffdf700, %eax       # imm = 0xFFFDF700
subl $0x2, %eax
jb 0x32bc1
jmp 0x326dc
movl -0x38(%rbp), %eax
subl $0x20b00, %eax          # imm = 0x20B00
je 0x32ab5
jmp 0x326ec
movl -0x38(%rbp), %eax
subl $0x30200, %eax          # imm = 0x30200
je 0x32956
jmp 0x326fc
movl -0x38(%rbp), %eax
addl $0xfffcfd00, %eax       # imm = 0xFFFCFD00
subl $0x2, %eax
jb 0x3290c
jmp 0x3270f
movl -0x38(%rbp), %eax
addl $0xfffcfc00, %eax       # imm = 0xFFFCFC00
subl $0x2, %eax
jb 0x329f0
jmp 0x32722
movl -0x38(%rbp), %eax
addl $0xfffcfb00, %eax       # imm = 0xFFFCFB00
subl $0x2, %eax
jb 0x32ab5
jmp 0x32735
movl -0x38(%rbp), %eax
addl $0xfffcfa00, %eax       # imm = 0xFFFCFA00
subl $0x2, %eax
jb 0x32bc1
jmp 0x32748
movl -0x38(%rbp), %eax
addl $0xfffcf800, %eax       # imm = 0xFFFCF800
subl $0x2, %eax
jb 0x32ab5
jmp 0x3275b
movl -0x38(%rbp), %eax
addl $0xfffcf700, %eax       # imm = 0xFFFCF700
subl $0x2, %eax
jb 0x32bc1
jmp 0x3276e
movl -0x38(%rbp), %eax
addl $0xfffcf500, %eax       # imm = 0xFFFCF500
subl $0x2, %eax
jb 0x32ab5
jmp 0x32781
movl -0x38(%rbp), %eax
subl $0x50200, %eax          # imm = 0x50200
je 0x32874
jmp 0x32791
movl -0x38(%rbp), %eax
subl $0x50300, %eax          # imm = 0x50300
je 0x32874
jmp 0x327a1
movl -0x38(%rbp), %eax
subl $0x50301, %eax          # imm = 0x50301
je 0x328af
jmp 0x327b1
movl -0x38(%rbp), %eax
subl $0x50400, %eax          # imm = 0x50400
je 0x329af
jmp 0x327c1
movl -0x38(%rbp), %eax
subl $0x50401, %eax          # imm = 0x50401
je 0x32a46
jmp 0x327d1
movl -0x38(%rbp), %eax
subl $0x50500, %eax          # imm = 0x50500
je 0x32b0b
jmp 0x327e1
movl -0x38(%rbp), %eax
subl $0x50501, %eax          # imm = 0x50501
je 0x32b52
jmp 0x327f1
movl -0x38(%rbp), %eax
subl $0x50600, %eax          # imm = 0x50600
je 0x32c17
jmp 0x32801
movl -0x38(%rbp), %eax
subl $0x50601, %eax          # imm = 0x50601
je 0x32c5e
jmp 0x32811
movl -0x38(%rbp), %eax
subl $0x50800, %eax          # imm = 0x50800
je 0x32b0b
jmp 0x32821
movl -0x38(%rbp), %eax
subl $0x50801, %eax          # imm = 0x50801
je 0x32b52
jmp 0x32831
movl -0x38(%rbp), %eax
subl $0x50900, %eax          # imm = 0x50900
je 0x32c17
jmp 0x32841
movl -0x38(%rbp), %eax
subl $0x50901, %eax          # imm = 0x50901
je 0x32c5e
jmp 0x32851
movl -0x38(%rbp), %eax
subl $0x50b00, %eax          # imm = 0x50B00
je 0x32b0b
jmp 0x32861
movl -0x38(%rbp), %eax
subl $0x50b01, %eax          # imm = 0x50B01
je 0x32b52
jmp 0x32ccd
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0x3e(%rbp)
movq -0x10(%rbp), %rdi
callq 0x321a0
movq -0x48(%rbp), %rdi
movw -0x3e(%rbp), %cx
movl $0x73, %esi
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
jmp 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdx
movl $0x75, %eax
movl $0x78, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movl %eax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0x4a(%rbp)
movq -0x10(%rbp), %rdi
callq 0x321a0
movq -0x58(%rbp), %rdi
movl -0x50(%rbp), %esi
movw -0x4a(%rbp), %cx
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x32590
jmp 0x32d4f
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movq -0x68(%rbp), %rdi
movl $0x74, %esi
movzwl %ax, %edx
callq 0x32150
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x261a0
movq -0x60(%rbp), %rdi
movl %eax, %esi
addl -0x2c(%rbp), %esi
callq 0x2b450
jmp 0x32d88
movq -0x8(%rbp), %rdi
movl $0x74, %esi
xorl %edx, %edx
callq 0x32150
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x261a0
movq -0x78(%rbp), %rdi
movl %eax, %esi
callq 0x2b450
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movq -0x70(%rbp), %rdi
movl $0x185, %esi            # imm = 0x185
xorl %ecx, %ecx
movzwl %ax, %edx
callq 0x324a0
jmp 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0x7a(%rbp)
movq -0x10(%rbp), %rdi
callq 0x321a0
movq -0x88(%rbp), %rdi
movw -0x7a(%rbp), %cx
movl $0x81, %esi
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
jmp 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movq -0x98(%rbp), %rdi
movl $0x82, %esi
movzwl %ax, %edx
callq 0x32150
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x261a0
movq -0x90(%rbp), %rdi
movl %eax, %esi
addl -0x2c(%rbp), %esi
callq 0x2b450
jmp 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x28(%rbp), %rdx
movl $0x83, %eax
movl $0x86, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movl %eax, -0xa0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0x9a(%rbp)
movq -0x10(%rbp), %rdi
callq 0x321a0
movq -0xa8(%rbp), %rdi
movl -0xa0(%rbp), %esi
movw -0x9a(%rbp), %cx
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x32590
jmp 0x32d4f
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movq -0xb8(%rbp), %rdi
movl $0x90, %esi
movzwl %ax, %edx
callq 0x32150
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x261a0
movq -0xb0(%rbp), %rdi
movl %eax, %esi
addl -0x2c(%rbp), %esi
callq 0x2b450
jmp 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0xba(%rbp)
movq -0x10(%rbp), %rdi
callq 0x321a0
movq -0xc8(%rbp), %rdi
movw -0xba(%rbp), %cx
movl $0x8f, %esi
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
jmp 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x28(%rbp), %rdx
movl $0x91, %eax
movl $0x92, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movl %eax, -0xd0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0xca(%rbp)
movq -0x10(%rbp), %rdi
callq 0x321a0
movq -0xd8(%rbp), %rdi
movl -0xd0(%rbp), %esi
movw -0xca(%rbp), %cx
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x32590
jmp 0x32d4f
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movq -0xe8(%rbp), %rdi
movl $0x98, %esi
movzwl %ax, %edx
callq 0x32150
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x261a0
movq -0xe0(%rbp), %rdi
movl %eax, %esi
addl -0x2c(%rbp), %esi
callq 0x2b450
jmp 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0xea(%rbp)
movq -0x10(%rbp), %rdi
callq 0x321a0
movq -0xf8(%rbp), %rdi
movw -0xea(%rbp), %cx
movl $0x97, %esi
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
jmp 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x28(%rbp), %rdx
movl $0x99, %eax
movl $0x9a, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movl %eax, -0x100(%rbp)
movq -0x18(%rbp), %rdi
callq 0x321a0
movw %ax, -0xfa(%rbp)
movq -0x10(%rbp), %rdi
callq 0x321a0
movq -0x108(%rbp), %rdi
movl -0x100(%rbp), %esi
movw -0xfa(%rbp), %cx
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x324a0
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x32590
jmp 0x32d4f
movq -0x8(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x11c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x4760
movq %rax, -0x118(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x10c(%rbp)
movq -0x8(%rbp), %rdi
movq 0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x225c0
movq -0x128(%rbp), %rdi
movl -0x11c(%rbp), %r8d
movq -0x118(%rbp), %r9
movl -0x10c(%rbp), %r10d
leaq 0xd1ec(%rip), %rsi      # 0x3ff1f
movl $0xb30, %edx            # imm = 0xB30
leaq 0xd4c8(%rip), %rcx      # 0x40207
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x18220
cmpq $0x0, -0x28(%rbp)
je 0x32d88
movq -0x8(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x28(%rbp), %rdi
callq 0x321a0
movq -0x130(%rbp), %rdi
movzwl %ax, %esi
callq 0x2bae0
movq -0x8(%rbp), %rdi
movl 0x10(%rbp), %eax
movzwl %ax, %esi
callq 0x2bae0
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)