int detect_edges(the_image, out_image, detect_type, threshold, high, rows, cols,
                 bits_per_pixel)
int detect_type, high, threshold;
long rows, cols, bits_per_pixel;
short **the_image, **out_image;
{
  perform_convolution(the_image, out_image, detect_type, threshold, rows, cols,
                      bits_per_pixel, high);
  fix_edges(out_image, 1, rows, cols);
  return (1);
}


x86 assembly (clang, -O0):
<detect_edges>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    0x10(%rbp),%r9
mov    0x18(%rbp),%r10
mov    -0x1c(%rbp),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1040 <perform_convolution@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <fix_edges@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detect_edges>:
push   %r15
push   %r14
push   %rbx
mov    %r9,%r14
mov    %r8d,%r10d
mov    %rsi,%rbx
mov    0x20(%rsp),%r15
mov    %r9,%r8
mov    %r15,%r9
xor    %eax,%eax
push   %r10
push   0x30(%rsp)
call   1040 <perform_convolution@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <fix_edges@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @detect_edges(i16** %0, i16** %1, i32 %2, i32 %3, i32 %4, i64 %5, i64 %6, i64 %7) {
%9 = alloca i16**
%10 = alloca i16**
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
store i16** %0, i16*** %9
store i16** %1, i16*** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i64 %5, i64* %14
store i64 %6, i64* %15
store i64 %7, i64* %16
%17 = load i16**, i16*** %9
%18 = load i16**, i16*** %10
%19 = load i32, i32* %11
%20 = load i32, i32* %12
%21 = load i64, i64* %14
%22 = load i64, i64* %15
%23 = load i64, i64* %16
%24 = load i32, i32* %13
%25 = call i32 (i16**, i16**, i32, i32, i64, i64, i64, i32, ...) bitcast (i32 (...)* @perform_convolution to i32 (i16**, i16**, i32, i32, i64, i64, i64, i32, ...)*)(i16** %17, i16** %18, i32 %19, i32 %20, i64 %21, i64 %22, i64 %23, i32 %24)
%26 = load i16**, i16*** %10
%27 = load i64, i64* %14
%28 = load i64, i64* %15
%29 = call i32 (i16**, i32, i64, i64, ...) bitcast (i32 (...)* @fix_edges to i32 (i16**, i32, i64, i64, ...)*)(i16** %26, i32 1, i64 %27, i64 %28)
ret i32 1
}

LLVM IR (-O2):
define i32 @detect_edges(i16** %0, i16** %1, i32 %2, i32 %3, i32 %4, i64 %5, i64 %6, i64 %7) {
%9 = tail call i32 (i16**, i16**, i32, i32, i64, i64, i64, i32, ...) bitcast (i32 (...)* @perform_convolution to i32 (i16**, i16**, i32, i32, i64, i64, i64, i32, ...)*)(i16** %0, i16** %1, i32 %2, i32 %3, i64 %5, i64 %6, i64 %7, i32 %4)
%10 = tail call i32 (i16**, i32, i64, i64, ...) bitcast (i32 (...)* @fix_edges to i32 (i16**, i32, i64, i64, ...)*)(i16** %1, i32 1, i64 %5, i64 %6)
ret i32 1
}