#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*/ om;

/* Variables and functions */
int /*<<< orphan*/ memmove(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ memset(unsigned char *, int, int);
void filter(unsigned char im[70 * 200]) {
  unsigned char om[70 * 200];
  unsigned char *i = im;
  unsigned char *o = om;
  memset(om, 0xff, sizeof(om));
  int x, y;
  for (y = 0; y < 70; y++) {
    for (x = 4; x < 200 - 4; x++) {
      if (i[0] > 0xf0 && i[1] < 0xf0) {
        o[0] = 0;
        o[1] = 0;
      } else if (i[0] < 0xf0 && i[1] > 0xf0) {
        o[0] = 0;
        o[1] = 0;
      }
      i++;
      o++;
    }
  }
  memmove(im, om, sizeof(om));
}


x86 assembly (clang, -O0):
<filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x36e0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x36c8(%rbp)
lea    -0x36c0(%rbp),%rax
mov    %rax,-0x36d0(%rbp)
lea    -0x36c0(%rbp),%rdi
mov    $0xff,%esi
mov    $0x36b0,%edx
call   1030 <memset@plt>
movl   $0x0,-0x36d8(%rbp)
cmpl   $0x46,-0x36d8(%rbp)
jge    126a <filter+0x14a>
movl   $0x4,-0x36d4(%rbp)
cmpl   $0xc4,-0x36d4(%rbp)
jge    1251 <filter+0x131>
mov    -0x36c8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xf0,%eax
jle    11d4 <filter+0xb4>
mov    -0x36c8(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0xf0,%eax
jge    11d4 <filter+0xb4>
mov    -0x36d0(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x36d0(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    1219 <filter+0xf9>
mov    -0x36c8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xf0,%eax
jge    1214 <filter+0xf4>
mov    -0x36c8(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0xf0,%eax
jle    1214 <filter+0xf4>
mov    -0x36d0(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x36d0(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    1219 <filter+0xf9>
mov    -0x36c8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x36c8(%rbp)
mov    -0x36d0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x36d0(%rbp)
mov    -0x36d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x36d4(%rbp)
jmp    117f <filter+0x5f>
jmp    1256 <filter+0x136>
mov    -0x36d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x36d8(%rbp)
jmp    1168 <filter+0x48>
mov    -0x8(%rbp),%rdi
lea    -0x36c0(%rbp),%rsi
mov    $0x36b0,%edx
call   1040 <memmove@plt>
add    $0x36e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter>:
push   %r14
push   %rbx
sub    $0x36b8,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x36b0,%edx
call   1030 <memset@plt>
xor    %esi,%esi
mov    %r14,%rcx
jmp    1162 <filter+0x42>
nopl   0x0(%rax)
add    $0xc0,%rcx
add    $0x1,%esi
add    %rdx,%rbx
cmp    $0x46,%esi
je     11ad <filter+0x8d>
xor    %edx,%edx
jmp    1182 <filter+0x62>
cs nopw 0x0(%rax,%rax,1)
movw   $0x0,(%rbx,%rdx,1)
add    $0x1,%rdx
cmp    $0xc0,%edx
je     1150 <filter+0x30>
movzbl (%rcx,%rdx,1),%eax
cmp    $0xf1,%al
jb     11a0 <filter+0x80>
cmpb   $0xf0,0x1(%rcx,%rdx,1)
jb     1170 <filter+0x50>
jmp    1176 <filter+0x56>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0xf0,%al
je     1176 <filter+0x56>
cmpb   $0xf1,0x1(%rcx,%rdx,1)
jae    1170 <filter+0x50>
jmp    1176 <filter+0x56>
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x36b0,%edx
call   1040 <memmove@plt>
add    $0x36b8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @filter(i8* %0) {
%2 = alloca i8*
%3 = alloca [14000 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
store i8* %8, i8** %4
%9 = getelementptr inbounds [14000 x i8], [14000 x i8]* %3, i64 0, i64 0
store i8* %9, i8** %5
%10 = getelementptr inbounds [14000 x i8], [14000 x i8]* %3, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 255, i32 14000)
store i32 0, i32* %7
br label %12
12: ; preds = %63, %1
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 70
br i1 %14, label %15, label %66
15: ; preds = %12
store i32 4, i32* %6
br label %16
16: ; preds = %59, %15
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 196
br i1 %18, label %19, label %62
19: ; preds = %16
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = icmp sgt i32 %23, 240
br i1 %24, label %25, label %36
25: ; preds = %19
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = icmp slt i32 %29, 240
br i1 %30, label %31, label %36
31: ; preds = %25
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 0
store i8 0, i8* %33
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i64 1
store i8 0, i8* %35
br label %54
36: ; preds = %25, %19
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i64 0
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = icmp slt i32 %40, 240
br i1 %41, label %42, label %53
42: ; preds = %36
%43 = load i8*, i8** %4
%44 = getelementptr inbounds i8, i8* %43, i64 1
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = icmp sgt i32 %46, 240
br i1 %47, label %48, label %53
48: ; preds = %42
%49 = load i8*, i8** %5
%50 = getelementptr inbounds i8, i8* %49, i64 0
store i8 0, i8* %50
%51 = load i8*, i8** %5
%52 = getelementptr inbounds i8, i8* %51, i64 1
store i8 0, i8* %52
br label %53
53: ; preds = %48, %42, %36
br label %54
54: ; preds = %53, %31
%55 = load i8*, i8** %4
%56 = getelementptr inbounds i8, i8* %55, i32 1
store i8* %56, i8** %4
%57 = load i8*, i8** %5
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %5
br label %59
59: ; preds = %54
%60 = load i32, i32* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
br label %16
62: ; preds = %16
br label %63
63: ; preds = %62
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
store i32 %65, i32* %7
br label %12
66: ; preds = %12
%67 = load i8*, i8** %2
%68 = getelementptr inbounds [14000 x i8], [14000 x i8]* %3, i64 0, i64 0
%69 = call i32 @memmove(i8* %67, i8* %68, i32 14000)
ret void
}

LLVM IR (-O2):
define void @filter(i8* %0) {
%2 = alloca [14000 x i8]
%3 = getelementptr inbounds [14000 x i8], [14000 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 255, i32 14000)
br label %5
5: ; preds = %1, %32
%6 = phi i32 [ 0, %1 ], [ %34, %32 ]
%7 = phi i8* [ %3, %1 ], [ %29, %32 ]
%8 = phi i8* [ %0, %1 ], [ %33, %32 ]
br label %9
9: ; preds = %5, %27
%10 = phi i32 [ 4, %5 ], [ %30, %27 ]
%11 = phi i8* [ %7, %5 ], [ %29, %27 ]
%12 = phi i8* [ %8, %5 ], [ %28, %27 ]
%13 = load i8, i8* %12
%14 = icmp ugt i8 %13, -16
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = getelementptr inbounds i8, i8* %12, i64 1
%17 = load i8, i8* %16
%18 = icmp ult i8 %17, -16
br i1 %18, label %25, label %27
19: ; preds = %9
%20 = icmp eq i8 %13, -16
br i1 %20, label %27, label %21
21: ; preds = %19
%22 = getelementptr inbounds i8, i8* %12, i64 1
%23 = load i8, i8* %22
%24 = icmp ugt i8 %23, -16
br i1 %24, label %25, label %27
25: ; preds = %21, %15
store i8 0, i8* %11
%26 = getelementptr inbounds i8, i8* %11, i64 1
store i8 0, i8* %26
br label %27
27: ; preds = %25, %15, %19, %21
%28 = getelementptr inbounds i8, i8* %12, i64 1
%29 = getelementptr inbounds i8, i8* %11, i64 1
%30 = add nuw nsw i32 %10, 1
%31 = icmp eq i32 %30, 196
br i1 %31, label %32, label %9
32: ; preds = %27
%33 = getelementptr i8, i8* %8, i64 192
%34 = add nuw nsw i32 %6, 1
%35 = icmp eq i32 %34, 70
br i1 %35, label %36, label %5
36: ; preds = %32
%37 = call i32 @memmove(i8* %0, i8* %3, i32 14000)
ret void
}