#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 sqrt(double);
int /*<<< orphan*/ vol_draw_op(float, float, float, double);
void vol_draw_fill_sphere(float x, float y, float z, float size) {
  float cntr = size / 2;
  double center[3];
  center[0] = x + cntr;
  center[1] = y + cntr;
  center[2] = z + cntr;
  ;
  float j, k, l;
  for (j = 0; j < size; j++)
    for (k = 0; k < size; k++)
      for (l = 0; l < size; l++) {
        double cur[3];
        cur[0] = x + j;
        cur[1] = y + k;
        cur[2] = z + l;
        ;
        cur[0] -= center[0];
        cur[1] -= center[1];
        cur[2] -= center[2];
        ;
        float vlen =
            sqrt((cur[0] * cur[0] + cur[1] * cur[1] + cur[2] * cur[2]));
        float diff = vlen - (cntr - (size / 10));
        if (diff < 0) {
          double sphere_val = (-diff / cntr);
          vol_draw_op(x + j, y + k, z + l, sphere_val);
        }
      }
}


x86 assembly (clang, -O0):
<vol_draw_fill_sphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xeb7(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1357 <vol_draw_fill_sphere+0x237>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    133b <vol_draw_fill_sphere+0x21b>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    131f <vol_draw_fill_sphere+0x1ff>
movss  -0x4(%rbp),%xmm0
addss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x64(%rbp)
movss  -0x64(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  0xd6b(%rip),%xmm3
divss  %xmm3,%xmm2
subss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x68(%rbp),%xmm0
jbe    1303 <vol_draw_fill_sphere+0x1e3>
movss  -0x68(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x34(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
addss  -0x38(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
addss  -0x3c(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
call   1040 <vol_draw_op@plt>
jmp    1308 <vol_draw_fill_sphere+0x1e8>
movss  0xcf4(%rip),%xmm0
addss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
jmp    11c9 <vol_draw_fill_sphere+0xa9>
jmp    1324 <vol_draw_fill_sphere+0x204>
movss  0xcd8(%rip),%xmm0
addss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
jmp    11ae <vol_draw_fill_sphere+0x8e>
jmp    1340 <vol_draw_fill_sphere+0x220>
movss  0xcbc(%rip),%xmm0
addss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    1193 <vol_draw_fill_sphere+0x73>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vol_draw_fill_sphere>:
sub    $0x58,%rsp
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm3,(%rsp)
ucomiss %xmm0,%xmm3
jbe    12e5 <vol_draw_fill_sphere+0x1c5>
movss  0xeb1(%rip),%xmm2
movss  (%rsp),%xmm1
mulss  %xmm1,%xmm2
movaps %xmm2,%xmm0
addss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
movaps %xmm2,%xmm0
addss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x38(%rsp)
movaps %xmm2,%xmm0
addss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x48(%rsp)
divss  0xe6b(%rip),%xmm1
movss  %xmm2,0x18(%rsp)
addss  %xmm2,%xmm1
movss  %xmm1,0x24(%rsp)
xorps  %xmm1,%xmm1
jmp    11cc <vol_draw_fill_sphere+0xac>
xchg   %ax,%ax
movss  0x10(%rsp),%xmm1
addss  0xe4a(%rip),%xmm1
movss  (%rsp),%xmm0
ucomiss %xmm1,%xmm0
jbe    12e5 <vol_draw_fill_sphere+0x1c5>
movss  %xmm1,0x10(%rsp)
addss  0x4(%rsp),%xmm1
movss  %xmm1,0x1c(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
subsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
xorps  %xmm1,%xmm1
jmp    1218 <vol_draw_fill_sphere+0xf8>
cs nopw 0x0(%rax,%rax,1)
movss  0x14(%rsp),%xmm1
addss  0xdfa(%rip),%xmm1
movss  (%rsp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11b0 <vol_draw_fill_sphere+0x90>
movss  %xmm1,0x14(%rsp)
addss  0x8(%rsp),%xmm1
movss  %xmm1,0x20(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
subsd  0x38(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0x40(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x50(%rsp)
xorpd  %xmm0,%xmm0
jmp    127b <vol_draw_fill_sphere+0x15b>
cs nopw 0x0(%rax,%rax,1)
nop
movss  0x2c(%rsp),%xmm1
addss  0xd9a(%rip),%xmm1
movss  (%rsp),%xmm0
ucomiss %xmm1,%xmm0
movaps %xmm1,%xmm0
jbe    1200 <vol_draw_fill_sphere+0xe0>
movss  %xmm0,0x2c(%rsp)
addss  0xc(%rsp),%xmm0
movss  %xmm0,0x28(%rsp)
cvtss2sd %xmm0,%xmm0
subsd  0x48(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  0x50(%rsp),%xmm0
call   1030 <sqrt@plt>
subss  0x24(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    1260 <vol_draw_fill_sphere+0x140>
xorps  0xd54(%rip),%xmm0
divss  0x18(%rsp),%xmm0
xorps  %xmm3,%xmm3
cvtss2sd %xmm0,%xmm3
movss  0x1c(%rsp),%xmm0
movss  0x20(%rsp),%xmm1
movss  0x28(%rsp),%xmm2
call   1040 <vol_draw_op@plt>
jmp    1260 <vol_draw_fill_sphere+0x140>
add    $0x58,%rsp
ret

LLVM IR (-O0):
define void @vol_draw_fill_sphere(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca [3 x double]
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca [3 x double]
%15 = alloca float
%16 = alloca float
%17 = alloca double
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%18 = load float, float* %8
%19 = fdiv float %18, 2.000000e+00
store float %19, float* %9
%20 = load float, float* %5
%21 = load float, float* %9
%22 = fadd float %20, %21
%23 = fpext float %22 to double
%24 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
store double %23, double* %24
%25 = load float, float* %6
%26 = load float, float* %9
%27 = fadd float %25, %26
%28 = fpext float %27 to double
%29 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
store double %28, double* %29
%30 = load float, float* %7
%31 = load float, float* %9
%32 = fadd float %30, %31
%33 = fpext float %32 to double
%34 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
store double %33, double* %34
store float 0.000000e+00, float* %11
br label %35
35: ; preds = %130, %4
%36 = load float, float* %11
%37 = load float, float* %8
%38 = fcmp olt float %36, %37
br i1 %38, label %39, label %133
39: ; preds = %35
store float 0.000000e+00, float* %12
br label %40
40: ; preds = %126, %39
%41 = load float, float* %12
%42 = load float, float* %8
%43 = fcmp olt float %41, %42
br i1 %43, label %44, label %129
44: ; preds = %40
store float 0.000000e+00, float* %13
br label %45
45: ; preds = %122, %44
%46 = load float, float* %13
%47 = load float, float* %8
%48 = fcmp olt float %46, %47
br i1 %48, label %49, label %125
49: ; preds = %45
%50 = load float, float* %5
%51 = load float, float* %11
%52 = fadd float %50, %51
%53 = fpext float %52 to double
%54 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
store double %53, double* %54
%55 = load float, float* %6
%56 = load float, float* %12
%57 = fadd float %55, %56
%58 = fpext float %57 to double
%59 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 1
store double %58, double* %59
%60 = load float, float* %7
%61 = load float, float* %13
%62 = fadd float %60, %61
%63 = fpext float %62 to double
%64 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 2
store double %63, double* %64
%65 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%66 = load double, double* %65
%67 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%68 = load double, double* %67
%69 = fsub double %68, %66
store double %69, double* %67
%70 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
%71 = load double, double* %70
%72 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 1
%73 = load double, double* %72
%74 = fsub double %73, %71
store double %74, double* %72
%75 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
%76 = load double, double* %75
%77 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 2
%78 = load double, double* %77
%79 = fsub double %78, %76
store double %79, double* %77
%80 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%81 = load double, double* %80
%82 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%83 = load double, double* %82
%84 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 1
%85 = load double, double* %84
%86 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 1
%87 = load double, double* %86
%88 = fmul double %85, %87
%89 = call double @llvm.fmuladd.f64(double %81, double %83, double %88)
%90 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 2
%91 = load double, double* %90
%92 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 2
%93 = load double, double* %92
%94 = call double @llvm.fmuladd.f64(double %91, double %93, double %89)
%95 = call float @sqrt(double %94)
store float %95, float* %15
%96 = load float, float* %15
%97 = load float, float* %9
%98 = load float, float* %8
%99 = fdiv float %98, 1.000000e+01
%100 = fsub float %97, %99
%101 = fsub float %96, %100
store float %101, float* %16
%102 = load float, float* %16
%103 = fcmp olt float %102, 0.000000e+00
br i1 %103, label %104, label %121
104: ; preds = %49
%105 = load float, float* %16
%106 = fneg float %105
%107 = load float, float* %9
%108 = fdiv float %106, %107
%109 = fpext float %108 to double
store double %109, double* %17
%110 = load float, float* %5
%111 = load float, float* %11
%112 = fadd float %110, %111
%113 = load float, float* %6
%114 = load float, float* %12
%115 = fadd float %113, %114
%116 = load float, float* %7
%117 = load float, float* %13
%118 = fadd float %116, %117
%119 = load double, double* %17
%120 = call i32 @vol_draw_op(float %112, float %115, float %118, double %119)
br label %121
121: ; preds = %104, %49
br label %122
122: ; preds = %121
%123 = load float, float* %13
%124 = fadd float %123, 1.000000e+00
store float %124, float* %13
br label %45
125: ; preds = %45
br label %126
126: ; preds = %125
%127 = load float, float* %12
%128 = fadd float %127, 1.000000e+00
store float %128, float* %12
br label %40
129: ; preds = %40
br label %130
130: ; preds = %129
%131 = load float, float* %11
%132 = fadd float %131, 1.000000e+00
store float %132, float* %11
br label %35
133: ; preds = %35
ret void
}

LLVM IR (-O2):
define void @vol_draw_fill_sphere(float %0, float %1, float %2, float %3) {
%5 = fmul float %3, 5.000000e-01
%6 = fadd float %5, %0
%7 = fpext float %6 to double
%8 = fadd float %5, %1
%9 = fpext float %8 to double
%10 = fadd float %5, %2
%11 = fpext float %10 to double
%12 = fcmp ogt float %3, 0.000000e+00
br i1 %12, label %13, label %51
13: ; preds = %4
%14 = fdiv float %3, 1.000000e+01
%15 = fsub float %5, %14
br label %16
16: ; preds = %48, %13
%17 = phi float [ 0.000000e+00, %13 ], [ %49, %48 ]
%18 = fadd float %17, %0
%19 = fpext float %18 to double
%20 = fsub double %19, %7
br label %21
21: ; preds = %45, %16
%22 = phi float [ 0.000000e+00, %16 ], [ %46, %45 ]
%23 = fadd float %22, %1
%24 = fpext float %23 to double
%25 = fsub double %24, %9
%26 = fmul double %25, %25
%27 = tail call double @llvm.fmuladd.f64(double %20, double %20, double %26)
br label %28
28: ; preds = %21, %42
%29 = phi float [ 0.000000e+00, %21 ], [ %43, %42 ]
%30 = fadd float %29, %2
%31 = fpext float %30 to double
%32 = fsub double %31, %11
%33 = tail call double @llvm.fmuladd.f64(double %32, double %32, double %27)
%34 = tail call float @sqrt(double %33)
%35 = fsub float %34, %15
%36 = fcmp olt float %35, 0.000000e+00
br i1 %36, label %37, label %42
37: ; preds = %28
%38 = fneg float %35
%39 = fdiv float %38, %5
%40 = fpext float %39 to double
%41 = tail call i32 @vol_draw_op(float %18, float %23, float %30, double %40)
br label %42
42: ; preds = %37, %28
%43 = fadd float %29, 1.000000e+00
%44 = fcmp olt float %43, %3
br i1 %44, label %28, label %45
45: ; preds = %42
%46 = fadd float %22, 1.000000e+00
%47 = fcmp olt float %46, %3
br i1 %47, label %21, label %48
48: ; preds = %45
%49 = fadd float %17, 1.000000e+00
%50 = fcmp olt float %49, %3
br i1 %50, label %16, label %51
51: ; preds = %48, %4
ret void
}