#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*/ blurXAlpha(unsigned char *, int, int, int, unsigned char,
                              int, int, int, int);
int /*<<< orphan*/ blurYAlpha(unsigned char *, int, int, int, unsigned char,
                              int, int, int, int);
void blurAlpha(unsigned char *img, int width, int height, int bx, int by,
               int quality, unsigned char borderAlpha, int rx, int ry, int rw,
               int rh) {
  int bxTotal = bx * (quality - 1);
  int byTotal = by * (quality - 1);
  rx += bxTotal;
  ry += byTotal;
  rw -= bxTotal << 1;
  rh -= byTotal << 1;
  for (int i = 0; i < quality; ++i) {
    blurXAlpha(img, width, height, bx, borderAlpha, rx, ry, rw, rh);
    blurYAlpha(img, width, height, by, borderAlpha, rx, ry, rw, rh);
    rx -= bx;
    ry -= by;
    rw += bx << 1;
    rh += by << 1;
  }
}


x86 assembly (clang, -O0):
<blurAlpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    0x18(%rbp),%eax
mov    %eax,0x18(%rbp)
mov    -0x24(%rbp),%eax
add    0x20(%rbp),%eax
mov    %eax,0x20(%rbp)
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
mov    0x28(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x28(%rbp)
mov    -0x24(%rbp),%ecx
shl    $0x1,%ecx
mov    0x30(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x30(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1253 <blurAlpha+0x133>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    0x10(%rbp),%r8b
mov    0x18(%rbp),%r9d
mov    0x20(%rbp),%r11d
mov    0x28(%rbp),%r10d
mov    0x30(%rbp),%eax
movzbl %r8b,%r8d
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <blurXAlpha@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    0x10(%rbp),%r8b
mov    0x18(%rbp),%r9d
mov    0x20(%rbp),%r11d
mov    0x28(%rbp),%r10d
mov    0x30(%rbp),%eax
movzbl %r8b,%r8d
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <blurYAlpha@plt>
mov    -0x14(%rbp),%ecx
mov    0x18(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,0x20(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    0x28(%rbp),%eax
mov    %eax,0x28(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
add    0x30(%rbp),%eax
mov    %eax,0x30(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119f <blurAlpha+0x7f>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blurAlpha>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,0x20(%rsp)
mov    %rcx,0x8(%rsp)
test   %r9d,%r9d
jle    122b <blurAlpha+0x10b>
mov    %edx,%r13d
mov    0x90(%rsp),%r14d
mov    0x88(%rsp),%ebp
lea    -0x1(%r9),%r15d
mov    %r15d,%r12d
mov    0x8(%rsp),%rbx
imul   %ebx,%r12d
mov    0x20(%rsp),%rcx
imul   %ecx,%r15d
sub    %r15d,%r14d
sub    %r15d,%r14d
lea    (%r12,%r12,1),%eax
add    0x80(%rsp),%r15d
add    0x78(%rsp),%r12d
sub    %eax,%ebp
lea    (%rbx,%rbx,1),%eax
mov    %eax,0x14(%rsp)
lea    (%rcx,%rcx,1),%eax
mov    %eax,0x10(%rsp)
movzbl 0x70(%rsp),%eax
mov    %eax,0x4(%rsp)
mov    %edx,0x1c(%rsp)
mov    %esi,0x18(%rsp)
mov    %rdi,0x28(%rsp)
nopl   0x0(%rax)
mov    %esi,%ebx
mov    %r9,0x30(%rsp)
sub    $0x8,%rsp
mov    0x30(%rsp),%rdi
mov    %r13d,%edx
mov    0x10(%rsp),%rcx
mov    0xc(%rsp),%r8d
mov    %r12d,%r9d
push   %r14
push   %rbp
push   %r15
call   1040 <blurXAlpha@plt>
add    $0x18,%rsp
mov    0x30(%rsp),%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    0x28(%rsp),%r13
mov    %r13d,%ecx
mov    0xc(%rsp),%r8d
mov    %r12d,%r9d
push   %r14
push   %rbp
push   %r15
call   1030 <blurYAlpha@plt>
mov    0x50(%rsp),%r9
add    $0x20,%rsp
sub    0x8(%rsp),%r12d
sub    %r13d,%r15d
mov    0x18(%rsp),%esi
mov    0x1c(%rsp),%r13d
add    0x14(%rsp),%ebp
add    0x10(%rsp),%r14d
add    $0xffffffff,%r9d
jne    11b0 <blurAlpha+0x90>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @blurAlpha(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8 zeroext %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
store i8* %0, i8** %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i32 %3, i32* %15
store i32 %4, i32* %16
store i32 %5, i32* %17
store i8 %6, i8* %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
store i32 %10, i32* %22
%26 = load i32, i32* %15
%27 = load i32, i32* %17
%28 = sub nsw i32 %27, 1
%29 = mul nsw i32 %26, %28
store i32 %29, i32* %23
%30 = load i32, i32* %16
%31 = load i32, i32* %17
%32 = sub nsw i32 %31, 1
%33 = mul nsw i32 %30, %32
store i32 %33, i32* %24
%34 = load i32, i32* %23
%35 = load i32, i32* %19
%36 = add nsw i32 %35, %34
store i32 %36, i32* %19
%37 = load i32, i32* %24
%38 = load i32, i32* %20
%39 = add nsw i32 %38, %37
store i32 %39, i32* %20
%40 = load i32, i32* %23
%41 = shl i32 %40, 1
%42 = load i32, i32* %21
%43 = sub nsw i32 %42, %41
store i32 %43, i32* %21
%44 = load i32, i32* %24
%45 = shl i32 %44, 1
%46 = load i32, i32* %22
%47 = sub nsw i32 %46, %45
store i32 %47, i32* %22
store i32 0, i32* %25
br label %48
48: ; preds = %87, %11
%49 = load i32, i32* %25
%50 = load i32, i32* %17
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %90
52: ; preds = %48
%53 = load i8*, i8** %12
%54 = load i32, i32* %13
%55 = load i32, i32* %14
%56 = load i32, i32* %15
%57 = load i8, i8* %18
%58 = load i32, i32* %19
%59 = load i32, i32* %20
%60 = load i32, i32* %21
%61 = load i32, i32* %22
%62 = call i32 @blurXAlpha(i8* %53, i32 %54, i32 %55, i32 %56, i8 zeroext %57, i32 %58, i32 %59, i32 %60, i32 %61)
%63 = load i8*, i8** %12
%64 = load i32, i32* %13
%65 = load i32, i32* %14
%66 = load i32, i32* %16
%67 = load i8, i8* %18
%68 = load i32, i32* %19
%69 = load i32, i32* %20
%70 = load i32, i32* %21
%71 = load i32, i32* %22
%72 = call i32 @blurYAlpha(i8* %63, i32 %64, i32 %65, i32 %66, i8 zeroext %67, i32 %68, i32 %69, i32 %70, i32 %71)
%73 = load i32, i32* %15
%74 = load i32, i32* %19
%75 = sub nsw i32 %74, %73
store i32 %75, i32* %19
%76 = load i32, i32* %16
%77 = load i32, i32* %20
%78 = sub nsw i32 %77, %76
store i32 %78, i32* %20
%79 = load i32, i32* %15
%80 = shl i32 %79, 1
%81 = load i32, i32* %21
%82 = add nsw i32 %81, %80
store i32 %82, i32* %21
%83 = load i32, i32* %16
%84 = shl i32 %83, 1
%85 = load i32, i32* %22
%86 = add nsw i32 %85, %84
store i32 %86, i32* %22
br label %87
87: ; preds = %52
%88 = load i32, i32* %25
%89 = add nsw i32 %88, 1
store i32 %89, i32* %25
br label %48
90: ; preds = %48
ret void
}

LLVM IR (-O2):
define void @blurAlpha(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i8 zeroext %6, i32 %7, i32 %8, i32 %9, i32 %10) {
%12 = add nsw i32 %5, -1
%13 = mul nsw i32 %12, %3
%14 = mul nsw i32 %12, %4
%15 = icmp sgt i32 %5, 0
br i1 %15, label %16, label %25
16: ; preds = %11
%17 = mul i32 %14, -2
%18 = add i32 %17, %10
%19 = mul i32 %13, -2
%20 = add i32 %19, %9
%21 = add nsw i32 %14, %8
%22 = add nsw i32 %13, %7
%23 = shl i32 %3, 1
%24 = shl i32 %4, 1
br label %26
25: ; preds = %26, %11
ret void
26: ; preds = %16, %26
%27 = phi i32 [ 0, %16 ], [ %38, %26 ]
%28 = phi i32 [ %22, %16 ], [ %34, %26 ]
%29 = phi i32 [ %21, %16 ], [ %35, %26 ]
%30 = phi i32 [ %18, %16 ], [ %37, %26 ]
%31 = phi i32 [ %20, %16 ], [ %36, %26 ]
%32 = tail call i32 @blurXAlpha(i8* %0, i32 %1, i32 %2, i32 %3, i8 zeroext %6, i32 %28, i32 %29, i32 %31, i32 %30)
%33 = tail call i32 @blurYAlpha(i8* %0, i32 %1, i32 %2, i32 %4, i8 zeroext %6, i32 %28, i32 %29, i32 %31, i32 %30)
%34 = sub nsw i32 %28, %3
%35 = sub nsw i32 %29, %4
%36 = add nsw i32 %31, %23
%37 = add nsw i32 %30, %24
%38 = add nuw nsw i32 %27, 1
%39 = icmp eq i32 %38, %5
br i1 %39, label %25, label %26
}