// File: leobru[P]ACPUfont/averager.cc
// Function: Picture::add(Picture const&, int, int) const
Picture add(const Picture & other, int voff, int hoff) const {
	Picture ret = *this;
	for (int i = max(0, voff); i < min(height, height+voff); ++i)
	for (int j = max(0, hoff); j < min(width, width+hoff); ++j) {
            int pixel = other.p(i-voff,j-hoff);
            if (decontrast != -1) {
                // Experiment with decontrasting dot gain (useful for adding to the mean)
                double pivot = decontrast ? decontrast*other.weight : other.find_knee(true);
                if (pixel <= pivot) {
                    pixel = lround(pixel*255*other.weight/pivot);
                } else {
                    pixel = lround(255*other.weight + (pivot - pixel)/2);
                }
            }
            ret.p(i,j) += pixel; 
	}
        ret.weight += other.weight;
	return ret;
    }

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0x50(%rsp)
movq %rdi, %rax
movq %rax, 0x58(%rsp)
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movq %rdx, 0xb0(%rsp)
movl %ecx, 0xac(%rsp)
movl %r8d, 0xa8(%rsp)
movq 0xb8(%rsp), %rsi
movq %rsi, 0x60(%rsp)
movb $0x0, 0xa7(%rsp)
callq 0x2430
movl $0x0, 0x9c(%rsp)
leaq 0x9c(%rsp), %rdi
leaq 0xac(%rsp), %rsi
callq 0x42e0
movq %rax, 0x68(%rsp)
jmp 0x250c
movq 0x68(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xa0(%rsp)
movq 0x60(%rsp), %rax
movl 0xa0(%rsp), %ecx
movl %ecx, 0x44(%rsp)
movq %rax, %rdi
addq $0x24, %rdi
movl 0x24(%rax), %eax
movl 0xac(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x88(%rsp)
leaq 0x88(%rsp), %rsi
callq 0x4320
movq %rax, 0x48(%rsp)
jmp 0x2558
movl 0x44(%rsp), %eax
movq 0x48(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x278c
movl $0x0, 0x80(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x42e0
movq %rax, 0x38(%rsp)
jmp 0x2590
movq 0x38(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x84(%rsp)
movq 0x60(%rsp), %rax
movl 0x84(%rsp), %ecx
movl %ecx, 0x2c(%rsp)
movq %rax, %rdi
addq $0x20, %rdi
movl 0x20(%rax), %eax
movl 0xa8(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x7c(%rsp)
leaq 0x7c(%rsp), %rsi
callq 0x4320
movq %rax, 0x30(%rsp)
jmp 0x25d6
movl 0x2c(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x2774
movq 0xb0(%rsp), %rdi
movl 0xa0(%rsp), %esi
movl 0xac(%rsp), %eax
subl %eax, %esi
movl 0x84(%rsp), %edx
movl 0xa8(%rsp), %eax
subl %eax, %edx
callq 0x4360
movl %eax, 0x28(%rsp)
jmp 0x261a
movl 0x28(%rsp), %eax
movl %eax, 0x78(%rsp)
cmpl $-0x1, 0xfad7(%rip)     # 0x12100
je 0x272a
cmpl $0x0, 0xfaca(%rip)      # 0x12100
je 0x2655
cvtsi2sdl 0xfac0(%rip), %xmm0 # 0x12100
movq 0xb0(%rsp), %rax
mulsd 0x18(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
jmp 0x267b
movq 0xb0(%rsp), %rdi
movl $0x1, %esi
callq 0x2a40
movl %eax, 0x1c(%rsp)
jmp 0x266d
movl 0x1c(%rsp), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
cvtsi2sdl 0x78(%rsp), %xmm1
movsd 0x70(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x26e6
imull $0xff, 0x78(%rsp), %eax
cvtsi2sd %eax, %xmm0
movq 0xb0(%rsp), %rax
mulsd 0x18(%rax), %xmm0
divsd 0x70(%rsp), %xmm0
callq 0x1030
movl %eax, 0x78(%rsp)
jmp 0x2728
movq 0x50(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
callq 0x2840
jmp 0x27d1
movq 0xb0(%rsp), %rax
movsd 0x18(%rax), %xmm0
movsd 0x70(%rsp), %xmm1
cvtsi2sdl 0x78(%rsp), %xmm2
subsd %xmm2, %xmm1
movsd 0xa905(%rip), %xmm2     # 0xd010
divsd %xmm2, %xmm1
movsd 0xa8f1(%rip), %xmm2     # 0xd008
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x1030
movl %eax, 0x78(%rsp)
jmp 0x272a
movq 0x50(%rsp), %rdi
movl 0x78(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0xa0(%rsp), %esi
movl 0x84(%rsp), %edx
callq 0x43a0
movq %rax, 0x10(%rsp)
jmp 0x2751
movq 0x10(%rsp), %rax
movl 0xc(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x259e
jmp 0x2776
movl 0xa0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa0(%rsp)
jmp 0x251a
movq 0x50(%rsp), %rax
movq 0xb0(%rsp), %rcx
movsd 0x18(%rcx), %xmm0
addsd 0x18(%rax), %xmm0
movsd %xmm0, 0x18(%rax)
movb $0x1, 0xa7(%rsp)
testb $0x1, 0xa7(%rsp)
jne 0x27c4
movq 0x50(%rsp), %rdi
callq 0x2840
movq 0x58(%rsp), %rax
addq $0xc8, %rsp
retq
movq 0x90(%rsp), %rdi
callq 0x11b0
nop