#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*/ diff(int, int, double, int, int, int);
void s2row(int x, int y, int dr, int dg, int db) {
  diff(x + 1, y, 4.0 / 16, dr, dg, db);
  diff(x + 2, y, 3.0 / 16, dr, dg, db);
  diff(x - 2, y + 1, 1.0 / 16, dr, dg, db);
  diff(x - 1, y + 1, 2.0 / 16, dr, dg, db);
  diff(x, y + 1, 3.0 / 16, dr, dg, db);
  diff(x + 1, y + 1, 2.0 / 16, dr, dg, db);
  diff(x + 2, y + 1, 1.0 / 16, dr, dg, db);
}


x86 assembly (clang, -O0):
<s2row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
movsd  0xed5(%rip),%xmm0
call   1030 <diff@plt>
mov    -0x4(%rbp),%edi
add    $0x2,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
movsd  0xead(%rip),%xmm0
call   1030 <diff@plt>
mov    -0x4(%rbp),%edi
sub    $0x2,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
movsd  0xe7a(%rip),%xmm0
call   1030 <diff@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
movsd  0xe5f(%rip),%xmm0
call   1030 <diff@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
movsd  0xe47(%rip),%xmm0
call   1030 <diff@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
movsd  0xe1c(%rip),%xmm0
call   1030 <diff@plt>
mov    -0x4(%rbp),%edi
add    $0x2,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
movsd  0xdf1(%rip),%xmm0
call   1030 <diff@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2row>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r12d
lea    0x1(%r12),%edi
mov    %edi,0x4(%rsp)
movsd  0xec7(%rip),%xmm0
call   1030 <diff@plt>
lea    0x2(%r12),%r13d
movsd  0xebd(%rip),%xmm0
mov    %r13d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <diff@plt>
lea    -0x2(%r12),%edi
add    $0x1,%ebp
movsd  0xea3(%rip),%xmm0
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <diff@plt>
lea    -0x1(%r12),%edi
movsd  0xe8f(%rip),%xmm0
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <diff@plt>
mov    %r12d,%edi
mov    %ebp,%esi
movsd  0xe63(%rip),%xmm0
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <diff@plt>
mov    0x4(%rsp),%edi
mov    %ebp,%esi
movsd  0xe58(%rip),%xmm0
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <diff@plt>
mov    %r13d,%edi
mov    %ebp,%esi
movsd  0xe36(%rip),%xmm0
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <diff@plt>

LLVM IR (-O0):
define void @s2row(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = call i32 @diff(i32 %12, i32 %13, double 2.500000e-01, i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 2
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = load i32, i32* %10
%24 = call i32 @diff(i32 %19, i32 %20, double 1.875000e-01, i32 %21, i32 %22, i32 %23)
%25 = load i32, i32* %6
%26 = sub nsw i32 %25, 2
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = load i32, i32* %10
%32 = call i32 @diff(i32 %26, i32 %28, double 6.250000e-02, i32 %29, i32 %30, i32 %31)
%33 = load i32, i32* %6
%34 = sub nsw i32 %33, 1
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
%37 = load i32, i32* %8
%38 = load i32, i32* %9
%39 = load i32, i32* %10
%40 = call i32 @diff(i32 %34, i32 %36, double 1.250000e-01, i32 %37, i32 %38, i32 %39)
%41 = load i32, i32* %6
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
%44 = load i32, i32* %8
%45 = load i32, i32* %9
%46 = load i32, i32* %10
%47 = call i32 @diff(i32 %41, i32 %43, double 1.875000e-01, i32 %44, i32 %45, i32 %46)
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
%52 = load i32, i32* %8
%53 = load i32, i32* %9
%54 = load i32, i32* %10
%55 = call i32 @diff(i32 %49, i32 %51, double 1.250000e-01, i32 %52, i32 %53, i32 %54)
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 2
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
%60 = load i32, i32* %8
%61 = load i32, i32* %9
%62 = load i32, i32* %10
%63 = call i32 @diff(i32 %57, i32 %59, double 6.250000e-02, i32 %60, i32 %61, i32 %62)
ret void
}

LLVM IR (-O2):
define void @s2row(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = add nsw i32 %0, 1
%7 = tail call i32 @diff(i32 %6, i32 %1, double 2.500000e-01, i32 %2, i32 %3, i32 %4)
%8 = add nsw i32 %0, 2
%9 = tail call i32 @diff(i32 %8, i32 %1, double 1.875000e-01, i32 %2, i32 %3, i32 %4)
%10 = add nsw i32 %0, -2
%11 = add nsw i32 %1, 1
%12 = tail call i32 @diff(i32 %10, i32 %11, double 6.250000e-02, i32 %2, i32 %3, i32 %4)
%13 = add nsw i32 %0, -1
%14 = tail call i32 @diff(i32 %13, i32 %11, double 1.250000e-01, i32 %2, i32 %3, i32 %4)
%15 = tail call i32 @diff(i32 %0, i32 %11, double 1.875000e-01, i32 %2, i32 %3, i32 %4)
%16 = tail call i32 @diff(i32 %6, i32 %11, double 1.250000e-01, i32 %2, i32 %3, i32 %4)
%17 = tail call i32 @diff(i32 %8, i32 %11, double 6.250000e-02, i32 %2, i32 %3, i32 %4)
ret void
}