// File: kchan1[P]helloworld_test1/main2.cpp
// Function: vertical_convolution(double**&, int, int, double*, int)
void vertical_convolution(double** &image, int height, int width,  double* filter, int filter_length){
	double copy[height][width];
	double pass_value;
	for (int i=0; i<height ;i++){
		for (int j = 0; j<width ; j++){
			copy[i][j] = image[i][j];
		}
	}
	int offset = filter_length/2;

	for (int i=0; i<width; i++){
		for(int j = offset ; j<height+offset; j++){
			pass_value=0;
			for (int k =0; k<filter_length; k++){
				if(j-k < 0  || j-k >= height){
					continue;
				}
				pass_value+=filter[k]*copy[j-k][i];
			}
			image[j-offset][i]=pass_value;
		}
	}


	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl -0xc(%rbp), %eax
movl %eax, %ecx
movl -0x10(%rbp), %eax
movq %rax, -0x68(%rbp)
movq %rsp, %rdx
movq %rdx, -0x28(%rbp)
movq %rcx, %rdx
imulq %rax, %rdx
leaq 0xf(,%rdx,8), %rsi
andq $-0x10, %rsi
movq %rsp, %rdx
subq %rsi, %rdx
movq %rdx, -0x60(%rbp)
movq %rdx, %rsp
movq %rcx, -0x30(%rbp)
movq %rax, -0x38(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2613
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x2606
movq -0x60(%rbp), %rax
movq -0x68(%rbp), %rdx
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x44(%rbp), %rsi
movq (%rcx,%rsi,8), %rcx
movslq -0x48(%rbp), %rsi
movsd (%rcx,%rsi,8), %xmm0
movslq -0x44(%rbp), %rcx
imulq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x25bb
jmp 0x2608
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x25ac
movl -0x1c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x2709
movl -0x4c(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl -0xc(%rbp), %ecx
addl -0x4c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x26f9
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x26c9
movl -0x54(%rbp), %eax
subl -0x58(%rbp), %eax
cmpl $0x0, %eax
jl 0x2678
movl -0x54(%rbp), %eax
subl -0x58(%rbp), %eax
cmpl -0xc(%rbp), %eax
jl 0x267a
jmp 0x26be
movq -0x60(%rbp), %rax
movq -0x68(%rbp), %rdx
movq -0x18(%rbp), %rcx
movslq -0x58(%rbp), %rsi
movsd (%rcx,%rsi,8), %xmm0
movl -0x54(%rbp), %ecx
subl -0x58(%rbp), %ecx
movslq %ecx, %rcx
imulq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x50(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x40(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x265a
movsd -0x40(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x54(%rbp), %ecx
subl -0x4c(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x263a
jmp 0x26fb
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x2628
movq -0x28(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)