#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 */
float *calloc(int, int);
float expf(float);
float *load_star_texture() {
  float *texture = calloc(16 * 16, sizeof(float));
  float radius = ((float)16) / 2.0f;
  float sigma_2 = 8.0f;
  for (size_t i = 0; i < 16; ++i) {
    for (size_t j = 0; j < 16; ++j) {
      float x = ((float)i) - radius;
      float y = ((float)j) - radius;
      float exponent =
          ((x * x) / (2.0f * sigma_2)) + ((y * y) / (2.0f * sigma_2));
      float alpha = expf(-exponent);
      size_t index = i + (16 * j);
      texture[index] = alpha;
    }
  }
  return texture;
}


x86 assembly (clang, -O0):
<load_star_texture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    $0x100,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
movss  0xebd(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xeb0(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x10,-0x18(%rbp)
jae    12be <load_star_texture+0x19e>
movq   $0x0,-0x20(%rbp)
cmpq   $0x10,-0x20(%rbp)
jae    12a8 <load_star_texture+0x188>
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x40(%rbp)
test   %rax,%rax
movss  %xmm0,-0x3c(%rbp)
js     11b8 <load_star_texture+0x98>
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x48(%rbp)
test   %rax,%rax
movss  %xmm0,-0x44(%rbp)
js     1208 <load_star_texture+0xe8>
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x44(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
mulss  -0x24(%rbp),%xmm0
movss  0xddb(%rip),%xmm1
mulss  -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  -0x28(%rbp),%xmm1
mulss  -0x28(%rbp),%xmm1
movss  0xdc0(%rip),%xmm2
mulss  -0x10(%rbp),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <expf@plt>
movss  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movss  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1170 <load_star_texture+0x50>
jmp    12ad <load_star_texture+0x18d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115d <load_star_texture+0x3d>
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_star_texture>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0x100,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%r14
xor    %r12d,%r12d
mov    %rax,%r15
jmp    1162 <load_star_texture+0x42>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
add    $0x4,%r15
cmp    $0x10,%r12
je     122b <load_star_texture+0x10b>
test   %r12,%r12
js     1180 <load_star_texture+0x60>
xorps  %xmm0,%xmm0
cvtsi2ss %r12,%xmm0
jmp    119b <load_star_texture+0x7b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rax
shr    %rax
mov    %r12d,%ecx
and    $0x1,%ecx
or     %rax,%rcx
xorps  %xmm0,%xmm0
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
addss  0xe5d(%rip),%xmm0
mulss  %xmm0,%xmm0
mulss  0xe55(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r15,%r13
xor    %ebx,%ebx
jmp    120a <load_star_texture+0xea>
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %rbx,%xmm0
movss  0xc(%rsp),%xmm1
addss  0xe2a(%rip),%xmm0
mulss  %xmm0,%xmm0
mulss  0xe22(%rip),%xmm0
addss  %xmm1,%xmm0
xorps  0xe23(%rip),%xmm0
call   1030 <expf@plt>
movss  %xmm0,0x0(%r13)
add    $0x1,%rbx
add    $0x40,%r13
cmp    $0x10,%rbx
je     1150 <load_star_texture+0x30>
test   %rbx,%rbx
jns    11c0 <load_star_texture+0xa0>
mov    %rbx,%rax
shr    %rax
mov    %ebx,%ecx
and    $0x1,%ecx
or     %rax,%rcx
xorps  %xmm0,%xmm0
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
jmp    11c8 <load_star_texture+0xa8>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float* @load_star_texture() {
%1 = alloca float*
%2 = alloca float
%3 = alloca float
%4 = alloca i64
%5 = alloca i64
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i64
%11 = call float* @calloc(i32 256, i32 4)
store float* %11, float** %1
store float 8.000000e+00, float* %2
store float 8.000000e+00, float* %3
store i64 0, i64* %4
br label %12
12: ; preds = %56, %0
%13 = load i64, i64* %4
%14 = icmp ult i64 %13, 16
br i1 %14, label %15, label %59
15: ; preds = %12
store i64 0, i64* %5
br label %16
16: ; preds = %52, %15
%17 = load i64, i64* %5
%18 = icmp ult i64 %17, 16
br i1 %18, label %19, label %55
19: ; preds = %16
%20 = load i64, i64* %4
%21 = uitofp i64 %20 to float
%22 = load float, float* %2
%23 = fsub float %21, %22
store float %23, float* %6
%24 = load i64, i64* %5
%25 = uitofp i64 %24 to float
%26 = load float, float* %2
%27 = fsub float %25, %26
store float %27, float* %7
%28 = load float, float* %6
%29 = load float, float* %6
%30 = fmul float %28, %29
%31 = load float, float* %3
%32 = fmul float 2.000000e+00, %31
%33 = fdiv float %30, %32
%34 = load float, float* %7
%35 = load float, float* %7
%36 = fmul float %34, %35
%37 = load float, float* %3
%38 = fmul float 2.000000e+00, %37
%39 = fdiv float %36, %38
%40 = fadd float %33, %39
store float %40, float* %8
%41 = load float, float* %8
%42 = fneg float %41
%43 = call float @expf(float %42)
store float %43, float* %9
%44 = load i64, i64* %4
%45 = load i64, i64* %5
%46 = mul i64 16, %45
%47 = add i64 %44, %46
store i64 %47, i64* %10
%48 = load float, float* %9
%49 = load float*, float** %1
%50 = load i64, i64* %10
%51 = getelementptr inbounds float, float* %49, i64 %50
store float %48, float* %51
br label %52
52: ; preds = %19
%53 = load i64, i64* %5
%54 = add i64 %53, 1
store i64 %54, i64* %5
br label %16
55: ; preds = %16
br label %56
56: ; preds = %55
%57 = load i64, i64* %4
%58 = add i64 %57, 1
store i64 %58, i64* %4
br label %12
59: ; preds = %12
%60 = load float*, float** %1
ret float* %60
}

LLVM IR (-O2):
define noalias float* @load_star_texture() {
%1 = tail call float* @calloc(i32 256, i32 4)
br label %2
2: ; preds = %0, %9
%3 = phi i64 [ 0, %0 ], [ %10, %9 ]
%4 = uitofp i64 %3 to float
%5 = fadd float %4, -8.000000e+00
%6 = fmul float %5, %5
%7 = fmul float %6, 6.250000e-02
br label %12
8: ; preds = %9
ret float* %1
9: ; preds = %12
%10 = add nuw nsw i64 %3, 1
%11 = icmp eq i64 %10, 16
br i1 %11, label %8, label %2
12: ; preds = %2, %12
%13 = phi i64 [ 0, %2 ], [ %24, %12 ]
%14 = uitofp i64 %13 to float
%15 = fadd float %14, -8.000000e+00
%16 = fmul float %15, %15
%17 = fmul float %16, 6.250000e-02
%18 = fadd float %7, %17
%19 = fneg float %18
%20 = tail call float @expf(float %19)
%21 = shl nuw nsw i64 %13, 4
%22 = add nuw nsw i64 %21, %3
%23 = getelementptr inbounds float, float* %1, i64 %22
store float %20, float* %23
%24 = add nuw nsw i64 %13, 1
%25 = icmp eq i64 %24, 16
br i1 %25, label %9, label %12
}