// File: /workspace/github_cpp_makefile_star2_O3/brianwu02[P]ImageProcessing/sharpen.cpp
// Function: main
int main(int argc, char** argv) {

    int sz, fctr;
    imageP I1, I2, tmp_img, final_img; 
    
    cout << "in   : " << argv[1] << endl;
    cout << "sz   : " << argv[2] << endl;
    cout << "fctr : " << argv[3] << endl;
    cout << "out  : " << argv[4] << endl;


    I1 = IP_readImage(argv[1]);
    sz = atoi(argv[2]);
    fctr = atoi(argv[3]);

    I2 = NEWIMAGE;
    tmp_img = NEWIMAGE;
    final_img = NEWIMAGE;

    if ((sz & 1) == 0) {
        cerr << "sz: " << sz << "is not odd" << endl;
        exit(1);
    }


    blur(I1, tmp_img, sz, sz, I2);

    IP_freeImage(tmp_img);

    sharpen(I1, I2, fctr, final_img);

    IP_freeImage(I1);
    IP_freeImage(I2);

    IP_saveImage(final_img, argv[4]);
    IP_freeImage(final_img);

    cout << "done!" << endl;
    
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r12
movq 0x2c7c(%rip), %rbx      # 0x4fd0
leaq 0xca9(%rip), %rsi       # 0x3004
movl $0x7, %edx
movq %rbx, %rdi
callq 0x2100
movq 0x8(%r12), %r14
testq %r14, %r14
je 0x238e
movq %r14, %rdi
callq 0x2070
movq 0x2c4f(%rip), %rdi      # 0x4fd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x2100
jmp 0x23a5
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
leaq 0xc39(%rip), %rsi       # 0x300c
movl $0x7, %edx
movq %rbx, %rdi
callq 0x2100
movq 0x10(%r12), %r14
testq %r14, %r14
je 0x2406
movq %r14, %rdi
callq 0x2070
movq 0x2bd7(%rip), %rdi      # 0x4fd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x2100
jmp 0x241d
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
leaq 0xbc9(%rip), %rsi       # 0x3014
movl $0x7, %edx
movq %rbx, %rdi
callq 0x2100
movq 0x18(%r12), %r14
testq %r14, %r14
je 0x247e
movq %r14, %rdi
callq 0x2070
movq 0x2b5f(%rip), %rdi      # 0x4fd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x2100
jmp 0x2495
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
leaq 0xb59(%rip), %rsi       # 0x301c
movl $0x7, %edx
movq %rbx, %rdi
callq 0x2100
movq 0x20(%r12), %r14
testq %r14, %r14
je 0x24f6
movq %r14, %rdi
callq 0x2070
movq 0x2ae7(%rip), %rdi      # 0x4fd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x2100
jmp 0x250d
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq 0x8(%r12), %rdi
callq 0x2aa0
movq %rax, %r15
movq 0x10(%r12), %rdi
callq 0x2190
movl %eax, %ebp
movq 0x18(%r12), %rdi
callq 0x2190
movl %eax, 0xc(%rsp)
movl $0x10, %edi
callq 0x2150
movq %r12, 0x10(%rsp)
movq %rax, %r12
movl $0x10, %edi
callq 0x2150
movq %rax, %r14
movl $0x10, %edi
callq 0x2150
testb $0x1, %bpl
je 0x2635
movq %rax, %r13
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebp, %ecx
movq %r12, %r8
callq 0x2673
movq %r14, %rdi
callq 0x2e77
movq %r15, %rdi
movq %r12, %rsi
movl 0xc(%rsp), %edx
movq %r13, %rcx
callq 0x296a
movq %r15, %rdi
callq 0x2e77
movq %r12, %rdi
callq 0x2e77
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rsi
movq %r13, %rdi
callq 0x2cc6
movq %r13, %rdi
callq 0x2e77
leaq 0xa47(%rip), %rsi       # 0x3034
movl $0x5, %edx
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x29b4(%rip), %rdi      # 0x4ff0
leaq 0x9e1(%rip), %rsi       # 0x3024
callq 0x20e0
movq %rax, %rdi
movl %ebp, %esi
callq 0x21b0
leaq 0x9d0(%rip), %rsi       # 0x3029
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x2080
movl $0x1, %edi
callq 0x2120