#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 */
struct xrdp_orders {
  int dummy;
};

/* Variables and functions */
int g_abs(int);
int xrdp_orders_send_delta(struct xrdp_orders *self, int *vals, int count) {
  int i;
  for (i = 0; i < count; i += 2) {
    if (g_abs(vals[i] - vals[i + 1]) >= 128) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<xrdp_orders_send_delta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1180 <xrdp_orders_send_delta+0x70>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
sub    (%rax,%rcx,4),%edi
call   1030 <g_abs@plt>
cmp    $0x80,%eax
jl     116d <xrdp_orders_send_delta+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    1187 <xrdp_orders_send_delta+0x77>
jmp    1172 <xrdp_orders_send_delta+0x62>
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
jmp    112a <xrdp_orders_send_delta+0x1a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrdp_orders_send_delta>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
test   %edx,%edx
jle    1151 <xrdp_orders_send_delta+0x41>
mov    %edx,%r15d
mov    %rsi,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%rbx,%rbp,4),%edi
sub    0x4(%rbx,%rbp,4),%edi
call   1030 <g_abs@plt>
cmp    $0x80,%eax
jge    114e <xrdp_orders_send_delta+0x3e>
add    $0x2,%rbp
cmp    %r15d,%ebp
jl     1130 <xrdp_orders_send_delta+0x20>
jmp    1151 <xrdp_orders_send_delta+0x41>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.xrdp_orders = type { i32 }
define i32 @xrdp_orders_send_delta(%struct.xrdp_orders* %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.xrdp_orders*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store %struct.xrdp_orders* %0, %struct.xrdp_orders** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %30, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %33
13: ; preds = %9
%14 = load i32*, i32** %6
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32*, i32** %6
%20 = load i32, i32* %8
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %19, i64 %22
%24 = load i32, i32* %23
%25 = sub nsw i32 %18, %24
%26 = call i32 @g_abs(i32 %25)
%27 = icmp sge i32 %26, 128
br i1 %27, label %28, label %29
28: ; preds = %13
store i32 0, i32* %4
br label %34
29: ; preds = %13
br label %30
30: ; preds = %29
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 2
store i32 %32, i32* %8
br label %9
33: ; preds = %9
store i32 1, i32* %4
br label %34
34: ; preds = %33, %28
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
%struct.xrdp_orders = type { i32 }
define i32 @xrdp_orders_send_delta(%struct.xrdp_orders* nocapture readnone %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %8, label %19
5: ; preds = %8
%6 = trunc i64 %18 to i32
%7 = icmp slt i32 %6, %2
br i1 %7, label %8, label %19
8: ; preds = %3, %5
%9 = phi i64 [ %18, %5 ], [ 0, %3 ]
%10 = getelementptr inbounds i32, i32* %1, i64 %9
%11 = load i32, i32* %10
%12 = or i64 %9, 1
%13 = getelementptr inbounds i32, i32* %1, i64 %12
%14 = load i32, i32* %13
%15 = sub nsw i32 %11, %14
%16 = tail call i32 @g_abs(i32 %15)
%17 = icmp sgt i32 %16, 127
%18 = add nuw i64 %9, 2
br i1 %17, label %19, label %5
19: ; preds = %8, %5, %3
%20 = phi i32 [ 1, %3 ], [ 1, %5 ], [ 0, %8 ]
ret i32 %20
}