#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*/ set_led_8_8_12(float, float, float, int);
void sphere_shape(float xi, float yi, float zi, float rsq_min, float rsq_max,
                  float fac) {
  for (float x = xi; x < 8 + xi; x++) {
    for (float y = yi; y < 8 + yi; y++) {
      for (float z = zi; z < 8 + zi; z++) {
        float sq = x * x + y * y + z * z;
        if (rsq_min * fac < sq && sq < rsq_max * fac) {
          set_led_8_8_12(x - xi, y - yi, z - zi, ((1 << 12) - 1));
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<sphere_shape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  0xeb3(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1284 <sphere_shape+0x174>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm1
movss  0xe8e(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1268 <sphere_shape+0x158>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm1
movss  0xe69(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    124c <sphere_shape+0x13c>
movss  -0x1c(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
movss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
movss  -0x24(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x10(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
movss  -0x28(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1230 <sphere_shape+0x120>
movss  -0x28(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1230 <sphere_shape+0x120>
movss  -0x1c(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
subss  -0xc(%rbp),%xmm2
mov    $0xfff,%edi
call   1030 <set_led_8_8_12@plt>
jmp    1235 <sphere_shape+0x125>
movss  0xdc7(%rip),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    118a <sphere_shape+0x7a>
jmp    1251 <sphere_shape+0x141>
movss  0xdab(%rip),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    1165 <sphere_shape+0x55>
jmp    126d <sphere_shape+0x15d>
movss  0xd8f(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1140 <sphere_shape+0x30>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sphere_shape>:
sub    $0x38,%rsp
movss  %xmm4,0x10(%rsp)
movss  %xmm2,0x8(%rsp)
movss  %xmm1,(%rsp)
movss  0xed3(%rip),%xmm1
addss  %xmm0,%xmm1
movss  %xmm0,0x14(%rsp)
movss  %xmm1,0x1c(%rsp)
ucomiss %xmm0,%xmm1
jbe    12bb <sphere_shape+0x1ab>
movss  0xeb2(%rip),%xmm2
movss  (%rsp),%xmm0
addss  %xmm2,%xmm0
movss  %xmm0,0x18(%rsp)
addss  0x8(%rsp),%xmm2
mulss  %xmm5,%xmm3
movss  0x10(%rsp),%xmm0
mulss  %xmm5,%xmm0
movss  %xmm0,0x10(%rsp)
movss  0xe85(%rip),%xmm4
movss  0x14(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  %xmm3,0x24(%rsp)
movss  %xmm2,0x20(%rsp)
jmp    11bf <sphere_shape+0xaf>
nopl   0x0(%rax)
movss  0x4(%rsp),%xmm1
addss  %xmm4,%xmm1
movss  0x1c(%rsp),%xmm0
movss  %xmm1,0x4(%rsp)
ucomiss %xmm1,%xmm0
jbe    12bb <sphere_shape+0x1ab>
movss  0x18(%rsp),%xmm0
ucomiss (%rsp),%xmm0
jbe    11a0 <sphere_shape+0x90>
movss  0x4(%rsp),%xmm0
subss  0x14(%rsp),%xmm0
movss  %xmm0,0x28(%rsp)
movss  (%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
jmp    120b <sphere_shape+0xfb>
nopw   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm1
addss  %xmm4,%xmm1
movss  0x18(%rsp),%xmm0
movss  %xmm1,0xc(%rsp)
ucomiss %xmm1,%xmm0
jbe    11a0 <sphere_shape+0x90>
ucomiss 0x8(%rsp),%xmm2
jbe    11f0 <sphere_shape+0xe0>
movss  0xc(%rsp),%xmm1
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
movss  0x4(%rsp),%xmm5
mulss  %xmm5,%xmm5
addss  %xmm0,%xmm5
subss  (%rsp),%xmm1
movss  %xmm1,0x2c(%rsp)
movss  0x8(%rsp),%xmm6
movss  %xmm5,0x30(%rsp)
jmp    1259 <sphere_shape+0x149>
cs nopw 0x0(%rax,%rax,1)
addss  %xmm4,%xmm6
ucomiss %xmm6,%xmm2
jbe    11f0 <sphere_shape+0xe0>
movaps %xmm6,%xmm0
mulss  %xmm6,%xmm0
addss  %xmm5,%xmm0
ucomiss %xmm3,%xmm0
jbe    1250 <sphere_shape+0x140>
movss  0x10(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    1250 <sphere_shape+0x140>
movaps %xmm6,%xmm2
subss  0x8(%rsp),%xmm2
movss  0x28(%rsp),%xmm0
movss  0x2c(%rsp),%xmm1
mov    $0xfff,%edi
movss  %xmm6,0x34(%rsp)
call   1030 <set_led_8_8_12@plt>
movss  0x34(%rsp),%xmm6
movss  0x30(%rsp),%xmm5
movss  0xd57(%rip),%xmm4
movss  0x20(%rsp),%xmm2
movss  0x24(%rsp),%xmm3
jmp    1250 <sphere_shape+0x140>
add    $0x38,%rsp
ret

LLVM IR (-O0):
define void @sphere_shape(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%17 = load float, float* %7
store float %17, float* %13
br label %18
18: ; preds = %78, %6
%19 = load float, float* %13
%20 = load float, float* %7
%21 = fadd float 8.000000e+00, %20
%22 = fcmp olt float %19, %21
br i1 %22, label %23, label %81
23: ; preds = %18
%24 = load float, float* %8
store float %24, float* %14
br label %25
25: ; preds = %74, %23
%26 = load float, float* %14
%27 = load float, float* %8
%28 = fadd float 8.000000e+00, %27
%29 = fcmp olt float %26, %28
br i1 %29, label %30, label %77
30: ; preds = %25
%31 = load float, float* %9
store float %31, float* %15
br label %32
32: ; preds = %70, %30
%33 = load float, float* %15
%34 = load float, float* %9
%35 = fadd float 8.000000e+00, %34
%36 = fcmp olt float %33, %35
br i1 %36, label %37, label %73
37: ; preds = %32
%38 = load float, float* %13
%39 = load float, float* %13
%40 = load float, float* %14
%41 = load float, float* %14
%42 = fmul float %40, %41
%43 = call float @llvm.fmuladd.f32(float %38, float %39, float %42)
%44 = load float, float* %15
%45 = load float, float* %15
%46 = call float @llvm.fmuladd.f32(float %44, float %45, float %43)
store float %46, float* %16
%47 = load float, float* %10
%48 = load float, float* %12
%49 = fmul float %47, %48
%50 = load float, float* %16
%51 = fcmp olt float %49, %50
br i1 %51, label %52, label %69
52: ; preds = %37
%53 = load float, float* %16
%54 = load float, float* %11
%55 = load float, float* %12
%56 = fmul float %54, %55
%57 = fcmp olt float %53, %56
br i1 %57, label %58, label %69
58: ; preds = %52
%59 = load float, float* %13
%60 = load float, float* %7
%61 = fsub float %59, %60
%62 = load float, float* %14
%63 = load float, float* %8
%64 = fsub float %62, %63
%65 = load float, float* %15
%66 = load float, float* %9
%67 = fsub float %65, %66
%68 = call i32 @set_led_8_8_12(float %61, float %64, float %67, i32 4095)
br label %69
69: ; preds = %58, %52, %37
br label %70
70: ; preds = %69
%71 = load float, float* %15
%72 = fadd float %71, 1.000000e+00
store float %72, float* %15
br label %32
73: ; preds = %32
br label %74
74: ; preds = %73
%75 = load float, float* %14
%76 = fadd float %75, 1.000000e+00
store float %76, float* %14
br label %25
77: ; preds = %25
br label %78
78: ; preds = %77
%79 = load float, float* %13
%80 = fadd float %79, 1.000000e+00
store float %80, float* %13
br label %18
81: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @sphere_shape(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = fadd float %0, 8.000000e+00
%8 = fcmp ogt float %7, %0
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = fadd float %1, 8.000000e+00
%11 = fcmp ogt float %10, %1
%12 = fadd float %2, 8.000000e+00
%13 = fcmp ogt float %12, %2
%14 = fmul float %3, %5
%15 = fmul float %4, %5
br label %16
16: ; preds = %9, %27
%17 = phi float [ %0, %9 ], [ %28, %27 ]
br i1 %11, label %18, label %27
18: ; preds = %16
%19 = fsub float %17, %0
br label %21
20: ; preds = %27, %6
ret void
21: ; preds = %18, %30
%22 = phi float [ %1, %18 ], [ %31, %30 ]
br i1 %13, label %23, label %30
23: ; preds = %21
%24 = fmul float %22, %22
%25 = tail call float @llvm.fmuladd.f32(float %17, float %17, float %24)
%26 = fsub float %22, %1
br label %33
27: ; preds = %30, %16
%28 = fadd float %17, 1.000000e+00
%29 = fcmp olt float %28, %7
br i1 %29, label %16, label %20
30: ; preds = %42, %21
%31 = fadd float %22, 1.000000e+00
%32 = fcmp olt float %31, %10
br i1 %32, label %21, label %27
33: ; preds = %23, %42
%34 = phi float [ %2, %23 ], [ %43, %42 ]
%35 = tail call float @llvm.fmuladd.f32(float %34, float %34, float %25)
%36 = fcmp olt float %14, %35
%37 = fcmp olt float %35, %15
%38 = and i1 %36, %37
br i1 %38, label %39, label %42
39: ; preds = %33
%40 = fsub float %34, %2
%41 = tail call i32 @set_led_8_8_12(float %19, float %26, float %40, i32 4095)
br label %42
42: ; preds = %39, %33
%43 = fadd float %34, 1.000000e+00
%44 = fcmp olt float %43, %12
br i1 %44, label %33, label %30
}