#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ _calc_single_line(int *, int /*<<< orphan*/ *, int, int,
                                     int);
void _calc_gradients_line_by_line(int *gradient, uint8_t *image, int width,
                                  int height) {
  for (int y = 1; y < height - 1; y++) {
    _calc_single_line(gradient, image, width, height, y);
  }
}


x86 assembly (clang, -O0):
<_calc_gradients_line_by_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1163 <_calc_gradients_line_by_line+0x53>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
call   1030 <_calc_single_line@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <_calc_gradients_line_by_line+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_calc_gradients_line_by_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x3,%ecx
jl     1166 <_calc_gradients_line_by_line+0x56>
mov    %ecx,%r13d
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
mov    $0x2,%ebx
sub    %ecx,%ebx
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    %ebp,%r8d
call   1030 <_calc_single_line@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1140 <_calc_gradients_line_by_line+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @_calc_gradients_line_by_line(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 1, i32* %9
br label %10
10: ; preds = %22, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %8
%13 = sub nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %25
15: ; preds = %10
%16 = load i32*, i32** %5
%17 = load i32*, i32** %6
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = call i32 @_calc_single_line(i32* %16, i32* %17, i32 %18, i32 %19, i32 %20)
br label %22
22: ; preds = %15
%23 = load i32, i32* %9
%24 = add nsw i32 %23, 1
store i32 %24, i32* %9
br label %10
25: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @_calc_gradients_line_by_line(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = add i32 %3, -1
%6 = icmp sgt i32 %3, 2
br i1 %6, label %8, label %7
7: ; preds = %8, %4
ret void
8: ; preds = %4, %8
%9 = phi i32 [ %11, %8 ], [ 1, %4 ]
%10 = tail call i32 @_calc_single_line(i32* %0, i32* %1, i32 %2, i32 %3, i32 %9)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, %5
br i1 %12, label %7, label %8
}