// File: kchan1[P]helloworld_test1/./encoder.hh
// Function: markTree(int, int, int, int, int, unsigned char**)
void markTree(int width, int height, int depth,int x,int y,unsigned char**coded)
{
  //quickly determind what layer we are at
  int layer = depth;
  while(x > width>>layer)
    layer++;
  //first mark this node
  coded[x][y]='T';
  //if this is the deepest level, there are three children to mark
  if(x < width>>depth && y < height>>depth)
  {
    markTree(width,height,depth,
	     x+(width>>depth),y,
	     coded);
    markTree(width,height,depth,
	     x,y+(height>>depth),
	     coded);
    markTree(width,height,depth,
	     x+(width>>depth),y+(height>>depth),
	     coded);
  }
  //if this is the lowest level, there are no children to mark
  else if(x > width/2 && y > height/2)
  {
    return;
  }
  //otherwise there are 4 children to mark
  else
  {
    markTree(width,height,depth,
	     x*2,y*2,
	     coded);
    markTree(width,height,depth,
	     x*2+1,y*2,
	     coded);
    markTree(width,height,depth,
	     x*2,y*2+1,
	     coded);
    markTree(width,height,depth,
	     x*2+1,y*2+1,
	     coded);    
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movl %ecx, -0x10(%rbp)
movl %r8d, -0x14(%rbp)
movq %r9, -0x20(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x10(%rbp), %eax
movl -0x4(%rbp), %edx
movl -0x24(%rbp), %ecx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jle 0x24be
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x24a2
movq -0x20(%rbp), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
movb $0x54, (%rax,%rcx)
movl -0x10(%rbp), %eax
movl -0x4(%rbp), %edx
movl -0xc(%rbp), %ecx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x258d
movl -0x14(%rbp), %eax
movl -0x8(%rbp), %edx
movl -0xc(%rbp), %ecx
sarl %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x258d
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x4(%rbp), %eax
movl -0xc(%rbp), %ecx
sarl %cl, %eax
movl -0x30(%rbp), %ecx
addl %eax, %ecx
movl -0x14(%rbp), %r8d
movq -0x20(%rbp), %r9
callq 0x2480
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x14(%rbp), %r8d
movl -0x8(%rbp), %eax
movl -0xc(%rbp), %ecx
sarl %cl, %eax
movl -0x2c(%rbp), %ecx
addl %eax, %r8d
movq -0x20(%rbp), %r9
callq 0x2480
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %eax
movl -0x4(%rbp), %r8d
movl -0xc(%rbp), %ecx
sarl %cl, %r8d
movl %r8d, %ecx
addl %ecx, %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %r8d
movl -0x8(%rbp), %eax
movl -0xc(%rbp), %ecx
sarl %cl, %eax
movl -0x28(%rbp), %ecx
addl %eax, %r8d
movq -0x20(%rbp), %r9
callq 0x2480
jmp 0x264e
movl -0x10(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x4(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x34(%rbp), %eax
cmpl %ecx, %eax
jle 0x25c6
movl -0x14(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x8(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x38(%rbp), %eax
cmpl %ecx, %eax
jle 0x25c6
jmp 0x264e
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
shll %ecx
movl -0x14(%rbp), %r8d
shll %r8d
movq -0x20(%rbp), %r9
callq 0x2480
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movl -0x14(%rbp), %r8d
shll %r8d
movq -0x20(%rbp), %r9
callq 0x2480
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
shll %ecx
movl -0x14(%rbp), %r8d
shll %r8d
addl $0x1, %r8d
movq -0x20(%rbp), %r9
callq 0x2480
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movl -0x14(%rbp), %r8d
shll %r8d
addl $0x1, %r8d
movq -0x20(%rbp), %r9
callq 0x2480
jmp 0x264e
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)