#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*/ calcPixelBlur(int, unsigned char *, double, int, int, int,
                                 int);
int getPixelPositionX(int, int);
int getPixelPositionY(int, int);
void setBlur(unsigned char *data, double value, int imageSize, int width,
             int height) {
  int i;
  int positionX;
  int positionY;
  int pixels = imageSize / 3;
  for (i = 0; i < pixels; i++) {
    positionX = getPixelPositionX(i, width);
    positionY = getPixelPositionY(i, width);
    calcPixelBlur(i, data, value, positionX, positionY, width, height);
  }
}


x86 assembly (clang, -O0):
<setBlur>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11b4 <setBlur+0x84>
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <getPixelPositionX@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <getPixelPositionY@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x8(%rbp),%rsi
movsd  -0x10(%rbp),%xmm0
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
call   1040 <calcPixelBlur@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115f <setBlur+0x2f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setBlur>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
cmp    $0x3,%esi
jl     11a7 <setBlur+0x77>
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %rdi,%r15
movslq %esi,%rax
imul   $0x55555556,%rax,%r13
mov    %r13,%rax
shr    $0x3f,%rax
shr    $0x20,%r13
add    %eax,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r12d,%esi
call   1030 <getPixelPositionX@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %r12d,%esi
call   1050 <getPixelPositionY@plt>
mov    %ebx,%edi
mov    %r15,%rsi
movsd  (%rsp),%xmm0
mov    %ebp,%edx
mov    %eax,%ecx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1040 <calcPixelBlur@plt>
add    $0x1,%ebx
cmp    %ebx,%r13d
jne    1170 <setBlur+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @setBlur(i8* %0, double %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %6
store double %1, double* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%15 = load i32, i32* %8
%16 = sdiv i32 %15, 3
store i32 %16, i32* %14
store i32 0, i32* %11
br label %17
17: ; preds = %36, %5
%18 = load i32, i32* %11
%19 = load i32, i32* %14
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %39
21: ; preds = %17
%22 = load i32, i32* %11
%23 = load i32, i32* %9
%24 = call i32 @getPixelPositionX(i32 %22, i32 %23)
store i32 %24, i32* %12
%25 = load i32, i32* %11
%26 = load i32, i32* %9
%27 = call i32 @getPixelPositionY(i32 %25, i32 %26)
store i32 %27, i32* %13
%28 = load i32, i32* %11
%29 = load i8*, i8** %6
%30 = load double, double* %7
%31 = load i32, i32* %12
%32 = load i32, i32* %13
%33 = load i32, i32* %9
%34 = load i32, i32* %10
%35 = call i32 @calcPixelBlur(i32 %28, i8* %29, double %30, i32 %31, i32 %32, i32 %33, i32 %34)
br label %36
36: ; preds = %21
%37 = load i32, i32* %11
%38 = add nsw i32 %37, 1
store i32 %38, i32* %11
br label %17
39: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @setBlur(i8* %0, double %1, i32 %2, i32 %3, i32 %4) {
%6 = sdiv i32 %2, 3
%7 = icmp sgt i32 %2, 2
br i1 %7, label %8, label %15
8: ; preds = %5, %8
%9 = phi i32 [ %13, %8 ], [ 0, %5 ]
%10 = tail call i32 @getPixelPositionX(i32 %9, i32 %3)
%11 = tail call i32 @getPixelPositionY(i32 %9, i32 %3)
%12 = tail call i32 @calcPixelBlur(i32 %9, i8* %0, double %1, i32 %10, i32 %11, i32 %3, i32 %4)
%13 = add nuw nsw i32 %9, 1
%14 = icmp eq i32 %13, %6
br i1 %14, label %15, label %8
15: ; preds = %8, %5
ret void
}