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

/* Variables and functions */
int /*<<< orphan*/ blurX(unsigned char *, int, int, int, unsigned int);
int /*<<< orphan*/ blurY(unsigned char *, int, int, int, unsigned int);
void blur(unsigned char *img, int width, int height, int bx, int by,
          int quality, unsigned int borderColor) {
  unsigned int abgrBorderColor = 0;
  if (borderColor != 0) {
    unsigned char r = (borderColor >> 16) & 0xff;
    unsigned char g = (borderColor >> 8) & 0xff;
    unsigned char b = borderColor & 0xff;
    abgrBorderColor = r | g << 8 | b << 16 | 0xff000000;
  }
  for (int i = 0; i < quality; ++i) {
    blurX(img, width, height, bx, abgrBorderColor);
    blurY(img, width, height, by, abgrBorderColor);
  }
}


x86 assembly (clang, -O0):
<blur>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x0,0x10(%rbp)
je     1196 <blur+0x76>
mov    0x10(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,-0x21(%rbp)
mov    0x10(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x22(%rbp)
mov    0x10(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x23(%rbp)
movzbl -0x21(%rbp),%eax
movzbl -0x22(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x23(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
or     $0xff000000,%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e3 <blur+0xc3>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <blurX@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1040 <blurY@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119d <blur+0x7d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blur>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%ebx
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%r13d
mov    %rdi,%rbp
mov    0x40(%rsp),%r14d
test   %r14d,%r14d
je     1168 <blur+0x48>
mov    %r14d,%eax
shr    $0x10,%eax
movzbl %al,%eax
mov    %r14d,%edx
and    $0xff00,%edx
or     %eax,%edx
shl    $0x10,%r14d
or     %edx,%r14d
or     $0xff000000,%r14d
jmp    116b <blur+0x4b>
xor    %r14d,%r14d
mov    %r8d,0x4(%rsp)
test   %ebx,%ebx
jle    11ae <blur+0x8e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <blurX@plt>
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
mov    0x4(%rsp),%ecx
mov    %r14d,%r8d
call   1040 <blurY@plt>
add    $0xffffffff,%ebx
jne    1180 <blur+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @blur(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8
%17 = alloca i8
%18 = alloca i8
%19 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
store i32 0, i32* %15
%20 = load i32, i32* %14
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %45
22: ; preds = %7
%23 = load i32, i32* %14
%24 = lshr i32 %23, 16
%25 = and i32 %24, 255
%26 = trunc i32 %25 to i8
store i8 %26, i8* %16
%27 = load i32, i32* %14
%28 = lshr i32 %27, 8
%29 = and i32 %28, 255
%30 = trunc i32 %29 to i8
store i8 %30, i8* %17
%31 = load i32, i32* %14
%32 = and i32 %31, 255
%33 = trunc i32 %32 to i8
store i8 %33, i8* %18
%34 = load i8, i8* %16
%35 = zext i8 %34 to i32
%36 = load i8, i8* %17
%37 = zext i8 %36 to i32
%38 = shl i32 %37, 8
%39 = or i32 %35, %38
%40 = load i8, i8* %18
%41 = zext i8 %40 to i32
%42 = shl i32 %41, 16
%43 = or i32 %39, %42
%44 = or i32 %43, -16777216
store i32 %44, i32* %15
br label %45
45: ; preds = %22, %7
store i32 0, i32* %19
br label %46
46: ; preds = %63, %45
%47 = load i32, i32* %19
%48 = load i32, i32* %13
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %66
50: ; preds = %46
%51 = load i8*, i8** %8
%52 = load i32, i32* %9
%53 = load i32, i32* %10
%54 = load i32, i32* %11
%55 = load i32, i32* %15
%56 = call i32 @blurX(i8* %51, i32 %52, i32 %53, i32 %54, i32 %55)
%57 = load i8*, i8** %8
%58 = load i32, i32* %9
%59 = load i32, i32* %10
%60 = load i32, i32* %12
%61 = load i32, i32* %15
%62 = call i32 @blurY(i8* %57, i32 %58, i32 %59, i32 %60, i32 %61)
br label %63
63: ; preds = %50
%64 = load i32, i32* %19
%65 = add nsw i32 %64, 1
store i32 %65, i32* %19
br label %46
66: ; preds = %46
ret void
}

LLVM IR (-O2):
define void @blur(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = icmp eq i32 %6, 0
br i1 %8, label %17, label %9
9: ; preds = %7
%10 = lshr i32 %6, 16
%11 = and i32 %10, 255
%12 = and i32 %6, 65280
%13 = or i32 %12, %11
%14 = shl i32 %6, 16
%15 = or i32 %13, %14
%16 = or i32 %15, -16777216
br label %17
17: ; preds = %9, %7
%18 = phi i32 [ %16, %9 ], [ 0, %7 ]
%19 = icmp sgt i32 %5, 0
br i1 %19, label %21, label %20
20: ; preds = %21, %17
ret void
21: ; preds = %17, %21
%22 = phi i32 [ %25, %21 ], [ 0, %17 ]
%23 = tail call i32 @blurX(i8* %0, i32 %1, i32 %2, i32 %3, i32 %18)
%24 = tail call i32 @blurY(i8* %0, i32 %1, i32 %2, i32 %4, i32 %18)
%25 = add nuw nsw i32 %22, 1
%26 = icmp eq i32 %25, %5
br i1 %26, label %20, label %21
}