// File: jstaursky[P]hutch/src/Sleigh/pcodecompile.cc
// Function: PcodeCompile::force_size(VarnodeTpl*, ConstTpl const&, std::vector<OpTpl*, std::allocator<OpTpl*>> const&)
void PcodeCompile::force_size(VarnodeTpl *vt,const ConstTpl &size,const vector<OpTpl *> &ops)

{
  if ((vt->getSize().getType()!=ConstTpl::real)||(vt->getSize().getReal() != 0))
    return;			// Size already exists

  vt->setSize(size);
  if (!vt->isLocalTemp()) return;
				// If the variable is a local temporary
				// The size may need to be propagated to the various
				// uses of the variable
  OpTpl *op;
  VarnodeTpl *vn;

  for(int4 i=0;i<ops.size();++i) {
    op = ops[i];
    vn = op->getOut();
    if ((vn!=(VarnodeTpl *)0)&&(vn->isLocalTemp())) {
      if (vn->getOffset() == vt->getOffset()) {
	if ((size.getType() == ConstTpl::real)&&(vn->getSize().getType() == ConstTpl::real)&&
	    (vn->getSize().getReal() != 0) && (vn->getSize().getReal() != size.getReal()))
	  throw SleighError("Localtemp size mismatch");
	vn->setSize(size);
      }
    }
    for(int4 j=0;j<op->numInput();++j) {
      vn = op->getIn(j);
      if (vn->isLocalTemp()&&(vn->getOffset()==vt->getOffset())) {
	if ((size.getType() == ConstTpl::real)&&(vn->getSize().getType() == ConstTpl::real)&&
	    (vn->getSize().getReal() != 0) && (vn->getSize().getReal() != size.getReal()))
	  throw SleighError("Localtemp size mismatch");
	vn->setSize(size);
      }
    }
  }
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movq %rdx, 0xd0(%rsp)
movq 0xe0(%rsp), %rdi
callq 0xd4930
movq %rax, %rdi
callq 0xde5d0
cmpl $0x0, %eax
jne 0x10d0e4
movq 0xe0(%rsp), %rdi
callq 0xd4930
movq %rax, %rdi
callq 0xdd890
cmpq $0x0, %rax
je 0x10d0e9
jmp 0x10d56d
movq 0xe0(%rsp), %rdi
movq 0xd8(%rsp), %rsi
callq 0xe29d0
movq 0xe0(%rsp), %rdi
callq 0xd5bf0
testb $0x1, %al
jne 0x10d114
jmp 0x10d56d
movl $0x0, 0xbc(%rsp)
movslq 0xbc(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xd0(%rsp), %rdi
callq 0xdd5e0
movq %rax, %rcx
movq 0x48(%rsp), %rax
cmpq %rcx, %rax
jae 0x10d56d
movq 0xd0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0xdc190
movq (%rax), %rax
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rdi
callq 0xdab40
movq %rax, 0xc0(%rsp)
cmpq $0x0, 0xc0(%rsp)
je 0x10d357
movq 0xc0(%rsp), %rdi
callq 0xd5bf0
testb $0x1, %al
jne 0x10d1a4
jmp 0x10d357
movq 0xc0(%rsp), %rdi
callq 0xdbaf0
movq %rax, 0x40(%rsp)
movq 0xe0(%rsp), %rdi
callq 0xdbaf0
movq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0xd7450
testb $0x1, %al
jne 0x10d1d9
jmp 0x10d355
movq 0xd8(%rsp), %rdi
callq 0xde5d0
cmpl $0x0, %eax
jne 0x10d340
movq 0xc0(%rsp), %rdi
callq 0xd4930
movq %rax, %rdi
callq 0xde5d0
cmpl $0x0, %eax
jne 0x10d340
movq 0xc0(%rsp), %rdi
callq 0xd4930
movq %rax, %rdi
callq 0xdd890
cmpq $0x0, %rax
je 0x10d340
movq 0xc0(%rsp), %rdi
callq 0xd4930
movq %rax, %rdi
callq 0xdd890
movq %rax, 0x38(%rsp)
movq 0xd8(%rsp), %rdi
callq 0xdd890
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
je 0x10d340
movb $0x1, 0x83(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, 0x28(%rsp)
leaq 0x97(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xe0c80
movq 0x30(%rsp), %rdx
leaq 0x7ac6c(%rip), %rsi     # 0x187f05
leaq 0x98(%rsp), %rdi
callq 0xe00a0
jmp 0x10d2a8
movq 0x28(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0xd06e0
jmp 0x10d2bc
movq 0x28(%rsp), %rdi
movb $0x0, 0x83(%rsp)
movq 0xbab98(%rip), %rsi     # 0x1c7e68
movq 0xba749(%rip), %rdx     # 0x1c7a20
callq 0xe01f0
jmp 0x10d582
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x10d318
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x98(%rsp), %rdi
callq 0xd4550
leaq 0x97(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0x83(%rsp)
jne 0x10d331
jmp 0x10d33b
movq 0x28(%rsp), %rdi
callq 0xd5400
jmp 0x10d575
movq 0xc0(%rsp), %rdi
movq 0xd8(%rsp), %rsi
callq 0xe29d0
jmp 0x10d357
movl $0x0, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0xc8(%rsp), %rdi
callq 0xdf850
movl %eax, %ecx
movl 0x24(%rsp), %eax
cmpl %ecx, %eax
jge 0x10d555
movq 0xc8(%rsp), %rdi
movl 0x7c(%rsp), %esi
callq 0xd3b80
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
callq 0xd5bf0
testb $0x1, %al
jne 0x10d3b1
jmp 0x10d543
movq 0xc0(%rsp), %rdi
callq 0xdbaf0
movq %rax, 0x18(%rsp)
movq 0xe0(%rsp), %rdi
callq 0xdbaf0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0xd7450
testb $0x1, %al
jne 0x10d3e6
jmp 0x10d543
movq 0xd8(%rsp), %rdi
callq 0xde5d0
cmpl $0x0, %eax
jne 0x10d52e
movq 0xc0(%rsp), %rdi
callq 0xd4930
movq %rax, %rdi
callq 0xde5d0
cmpl $0x0, %eax
jne 0x10d52e
movq 0xc0(%rsp), %rdi
callq 0xd4930
movq %rax, %rdi
callq 0xdd890
cmpq $0x0, %rax
je 0x10d52e
movq 0xc0(%rsp), %rdi
callq 0xd4930
movq %rax, %rdi
callq 0xdd890
movq %rax, 0x10(%rsp)
movq 0xd8(%rsp), %rdi
callq 0xdd890
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
je 0x10d52e
movb $0x1, 0x56(%rsp)
movl $0x20, %edi
callq 0xd2b40
movq %rax, (%rsp)
leaq 0x57(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xe0c80
movq 0x8(%rsp), %rdx
leaq 0x7aa66(%rip), %rsi     # 0x187f05
leaq 0x58(%rsp), %rdi
callq 0xe00a0
jmp 0x10d4ab
movq (%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xd06e0
jmp 0x10d4bb
movq (%rsp), %rdi
movb $0x0, 0x56(%rsp)
movq 0xba99d(%rip), %rsi     # 0x1c7e68
movq 0xba54e(%rip), %rdx     # 0x1c7a20
callq 0xe01f0
jmp 0x10d582
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
jmp 0x10d510
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x58(%rsp), %rdi
callq 0xd4550
leaq 0x57(%rsp), %rdi
callq 0xd8ec0
testb $0x1, 0x56(%rsp)
jne 0x10d523
jmp 0x10d52c
movq (%rsp), %rdi
callq 0xd5400
jmp 0x10d575
movq 0xc0(%rsp), %rdi
movq 0xd8(%rsp), %rsi
callq 0xe29d0
jmp 0x10d545
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0x10d35f
jmp 0x10d557
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0x10d11f
addq $0xe8, %rsp
retq
movq 0x88(%rsp), %rdi
callq 0xe0be0
nopw %cs:(%rax,%rax)