#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 Noise(float, float);
float SmoothedNoise(float x, float y) {
  float corners = (Noise(x - 1, y - 1) + Noise(x + 1, y - 1) +
                   Noise(x - 1, y + 1) + Noise(x + 1, y + 1)) /
                  16;
  float sides =
      (Noise(x - 1, y) + Noise(x + 1, y) + Noise(x, y - 1) + Noise(x, y + 1)) /
      8;
  float center = Noise(x, y) / 4;
  return corners + sides + center;
}


x86 assembly (clang, -O0):
<SmoothedNoise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xed1(%rip),%xmm1
subss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xec0(%rip),%xmm2
subss  %xmm2,%xmm1
call   1030 <Noise@plt>
mov    %eax,-0x2c(%rbp)
movss  0xeac(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xe9a(%rip),%xmm2
subss  %xmm2,%xmm1
call   1030 <Noise@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe7a(%rip),%xmm1
subss  %xmm1,%xmm0
movss  0xe6e(%rip),%xmm1
addss  -0x8(%rbp),%xmm1
call   1030 <Noise@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movss  0xe52(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xe45(%rip),%xmm1
addss  -0x8(%rbp),%xmm1
call   1030 <Noise@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe16(%rip),%xmm1
subss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <Noise@plt>
mov    %eax,-0x20(%rbp)
movss  0xdfd(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <Noise@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xdd2(%rip),%xmm2
subss  %xmm2,%xmm1
call   1030 <Noise@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xdb2(%rip),%xmm1
addss  -0x8(%rbp),%xmm1
call   1030 <Noise@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <Noise@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SmoothedNoise>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
movss  0xed6(%rip),%xmm2
addss  %xmm2,%xmm0
movss  %xmm0,0x1c(%rsp)
addss  %xmm1,%xmm2
movss  %xmm2,0xc(%rsp)
movaps %xmm2,%xmm1
call   1030 <Noise@plt>
mov    %eax,%ebx
movss  0x14(%rsp),%xmm0
addss  0xeae(%rip),%xmm0
movss  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm1
call   1030 <Noise@plt>
mov    %eax,%ebp
add    %ebx,%ebp
movss  0xe91(%rip),%xmm1
addss  0x10(%rsp),%xmm1
movss  %xmm1,0x20(%rsp)
movss  0x1c(%rsp),%xmm0
call   1030 <Noise@plt>
mov    %eax,%ebx
add    %ebp,%ebx
movss  0x18(%rsp),%xmm0
movss  0x20(%rsp),%xmm1
call   1030 <Noise@plt>
mov    %ebx,%ecx
add    %eax,%ecx
lea    0xf(%rax,%rbx,1),%eax
cmovns %ecx,%eax
sar    $0x4,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x24(%rsp)
movss  0x1c(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1030 <Noise@plt>
mov    %eax,%ebx
movss  0x18(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1030 <Noise@plt>
mov    %eax,%ebp
add    %ebx,%ebp
movss  0x14(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1030 <Noise@plt>
mov    %eax,%ebx
add    %ebp,%ebx
movss  0x14(%rsp),%xmm0
movss  0x20(%rsp),%xmm1
call   1030 <Noise@plt>
mov    %ebx,%ecx
add    %eax,%ecx
lea    0x7(%rax,%rbx,1),%eax
cmovns %ecx,%eax
sar    $0x3,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
addss  0x24(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1030 <Noise@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x2,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
addss  0xc(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @SmoothedNoise(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %3
store float %1, float* %4
%8 = load float, float* %3
%9 = fsub float %8, 1.000000e+00
%10 = load float, float* %4
%11 = fsub float %10, 1.000000e+00
%12 = call i32 @Noise(float %9, float %11)
%13 = load float, float* %3
%14 = fadd float %13, 1.000000e+00
%15 = load float, float* %4
%16 = fsub float %15, 1.000000e+00
%17 = call i32 @Noise(float %14, float %16)
%18 = add nsw i32 %12, %17
%19 = load float, float* %3
%20 = fsub float %19, 1.000000e+00
%21 = load float, float* %4
%22 = fadd float %21, 1.000000e+00
%23 = call i32 @Noise(float %20, float %22)
%24 = add nsw i32 %18, %23
%25 = load float, float* %3
%26 = fadd float %25, 1.000000e+00
%27 = load float, float* %4
%28 = fadd float %27, 1.000000e+00
%29 = call i32 @Noise(float %26, float %28)
%30 = add nsw i32 %24, %29
%31 = sdiv i32 %30, 16
%32 = sitofp i32 %31 to float
store float %32, float* %5
%33 = load float, float* %3
%34 = fsub float %33, 1.000000e+00
%35 = load float, float* %4
%36 = call i32 @Noise(float %34, float %35)
%37 = load float, float* %3
%38 = fadd float %37, 1.000000e+00
%39 = load float, float* %4
%40 = call i32 @Noise(float %38, float %39)
%41 = add nsw i32 %36, %40
%42 = load float, float* %3
%43 = load float, float* %4
%44 = fsub float %43, 1.000000e+00
%45 = call i32 @Noise(float %42, float %44)
%46 = add nsw i32 %41, %45
%47 = load float, float* %3
%48 = load float, float* %4
%49 = fadd float %48, 1.000000e+00
%50 = call i32 @Noise(float %47, float %49)
%51 = add nsw i32 %46, %50
%52 = sdiv i32 %51, 8
%53 = sitofp i32 %52 to float
store float %53, float* %6
%54 = load float, float* %3
%55 = load float, float* %4
%56 = call i32 @Noise(float %54, float %55)
%57 = sdiv i32 %56, 4
%58 = sitofp i32 %57 to float
store float %58, float* %7
%59 = load float, float* %5
%60 = load float, float* %6
%61 = fadd float %59, %60
%62 = load float, float* %7
%63 = fadd float %61, %62
ret float %63
}

LLVM IR (-O2):
define float @SmoothedNoise(float %0, float %1) {
%3 = fadd float %0, -1.000000e+00
%4 = fadd float %1, -1.000000e+00
%5 = tail call i32 @Noise(float %3, float %4)
%6 = fadd float %0, 1.000000e+00
%7 = tail call i32 @Noise(float %6, float %4)
%8 = add nsw i32 %7, %5
%9 = fadd float %1, 1.000000e+00
%10 = tail call i32 @Noise(float %3, float %9)
%11 = add nsw i32 %8, %10
%12 = tail call i32 @Noise(float %6, float %9)
%13 = add nsw i32 %11, %12
%14 = sdiv i32 %13, 16
%15 = sitofp i32 %14 to float
%16 = tail call i32 @Noise(float %3, float %1)
%17 = tail call i32 @Noise(float %6, float %1)
%18 = add nsw i32 %17, %16
%19 = tail call i32 @Noise(float %0, float %4)
%20 = add nsw i32 %18, %19
%21 = tail call i32 @Noise(float %0, float %9)
%22 = add nsw i32 %20, %21
%23 = sdiv i32 %22, 8
%24 = sitofp i32 %23 to float
%25 = tail call i32 @Noise(float %0, float %1)
%26 = sdiv i32 %25, 4
%27 = sitofp i32 %26 to float
%28 = fadd float %15, %24
%29 = fadd float %28, %27
ret float %29
}