// File: /workspace/github_c_makefile_star2_O0/cogbee[P]vmir-latest/src/vmir_transform.c
// Function: split_const_store_aggregate
static ir_instr_t *
split_const_store_aggregate(ir_unit_t *iu, ir_instr_store_t *ii)
{
  const ir_value_t *iv = value_get(iu, ii->value.value);
  const ir_valuetype_t *values;

  switch(iv->iv_class) {
  case IR_VC_AGGREGATE:
    values = iv->iv_data;
    break;
  case IR_VC_ZERO_INITIALIZER:
    values = NULL;
    break;

  default:
    return &ii->super;
  }

  ir_instr_t *ret = &ii->super;
  const ir_type_t *it = type_get(iu, ii->value.type);
  const int offset = ii->immediate_offset;

  ii->ptr.type = type_make_pointer(iu, it->it_struct.elements[0].type, 1);
  ii->immediate_offset = offset + it->it_struct.elements[0].offset;
  ii->value = values ? values[0] :
    value_create_zero(iu, it->it_struct.elements[0].type);
  for(int i = 1; i < it->it_struct.num_elements; i++) {
    ir_instr_store_t *str = instr_add_after(sizeof(ir_instr_store_t),
                                            IR_IC_STORE, ret);
    str->immediate_offset = offset + it->it_struct.elements[i].offset;
    str->ptr.value = ii->ptr.value;
    str->ptr.type = type_make_pointer(iu, it->it_struct.elements[i].type, 1);
    str->value = values ? values[i] :
      value_create_zero(iu, it->it_struct.elements[i].type);
    ret = &str->super;
  }
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x60(%rax), %esi
callq 0x20ee0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
subl $0x9, %eax
je 0x259de
jmp 0x259d4
movl -0x5c(%rbp), %eax
subl $0xb, %eax
je 0x259ec
jmp 0x259f6
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x25a03
movq $0x0, -0x28(%rbp)
jmp 0x25a03
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x25b93
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x64(%rax), %esi
callq 0x1ee20
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %esi
movl $0x1, %edx
callq 0x1e6e0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x5c(%rax)
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
addl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x68(%rax)
movq -0x18(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x25a82
movq -0x68(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x25aa7
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %esi
callq 0x20d30
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x44(%rbp)
movq -0x44(%rbp), %rcx
movq %rcx, (%rax)
movl $0x1, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x25b8b
movq -0x30(%rbp), %rdx
movl $0x70, %edi
movl $0x5, %esi
callq 0x265e0
movq %rax, -0x50(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x48(%rbp), %rdx
addl 0x4(%rax,%rdx,8), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x68(%rax)
movq -0x18(%rbp), %rax
movl 0x58(%rax), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x58(%rax)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,8), %esi
movl $0x1, %edx
callq 0x1e6e0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x5c(%rax)
movq -0x50(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x25b4b
movq -0x70(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, (%rax)
jmp 0x25b75
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,8), %esi
callq 0x20d30
movq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, -0x58(%rbp)
movq -0x58(%rbp), %rcx
movq %rcx, (%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x25aae
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)