#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*/ vol_draw_fill_box(float, float, float, float);
int /*<<< orphan*/ vol_draw_fill_pyramid(float, float, float, float);
int /*<<< orphan*/ vol_draw_fill_sphere(float, float, float, float);
void vol_draw_subdiv(int type, float x, float y, float z, float size,
                     float shrink_fact, unsigned short lvl) {
  float offs = size * 0.5f * shrink_fact;
  if (type == 1)
    vol_draw_fill_sphere(x + offs, y + offs, z + offs, size - 2 * offs);
  else if (type == 2)
    vol_draw_fill_pyramid(x + offs, y + offs, z + offs, size - 2 * offs);
  else
    vol_draw_fill_box(x + offs, y + offs, z + offs, size - 2 * offs);
  if (lvl > 1) {
    float cntr = size / 2;
    vol_draw_subdiv(type, x, y, z, cntr, shrink_fact, lvl - 1);
    vol_draw_subdiv(type, x, y, z + cntr, cntr, shrink_fact, lvl - 1);
    vol_draw_subdiv(type, x + cntr, y, z, cntr, shrink_fact, lvl - 1);
    vol_draw_subdiv(type, x + cntr, y, z + cntr, cntr, shrink_fact, lvl - 1);
    vol_draw_subdiv(type, x, y + cntr, z, cntr, shrink_fact, lvl - 1);
    vol_draw_subdiv(type, x, y + cntr, z + cntr, cntr, shrink_fact, lvl - 1);
    vol_draw_subdiv(type, x + cntr, y + cntr, z, cntr, shrink_fact, lvl - 1);
    vol_draw_subdiv(type, x + cntr, y + cntr, z + cntr, cntr, shrink_fact,
                    lvl - 1);
  }
}


x86 assembly (clang, -O0):
<vol_draw_subdiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  %xmm4,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
movss  0xe8d(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    11c6 <vol_draw_subdiv+0x86>
movss  -0x8(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
addss  -0x20(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
addss  -0x20(%rbp),%xmm2
movss  -0x14(%rbp),%xmm3
movss  -0x20(%rbp),%xmm4
addss  %xmm4,%xmm4
subss  %xmm4,%xmm3
call   1040 <vol_draw_fill_sphere@plt>
jmp    1244 <vol_draw_subdiv+0x104>
cmpl   $0x2,-0x4(%rbp)
jne    120a <vol_draw_subdiv+0xca>
movss  -0x8(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
addss  -0x20(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
addss  -0x20(%rbp),%xmm2
movss  -0x14(%rbp),%xmm3
movss  -0x20(%rbp),%xmm4
addss  %xmm4,%xmm4
subss  %xmm4,%xmm3
call   1060 <vol_draw_fill_pyramid@plt>
jmp    123f <vol_draw_subdiv+0xff>
movss  -0x8(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
addss  -0x20(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
addss  -0x20(%rbp),%xmm2
movss  -0x14(%rbp),%xmm3
movss  -0x20(%rbp),%xmm4
addss  %xmm4,%xmm4
subss  %xmm4,%xmm3
call   1050 <vol_draw_fill_box@plt>
jmp    1244 <vol_draw_subdiv+0x104>
movzwl -0x1a(%rbp),%eax
cmp    $0x1,%eax
jle    13fb <vol_draw_subdiv+0x2bb>
movss  -0x14(%rbp),%xmm0
movss  0xda6(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x24(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movzwl -0x1a(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%esi
call   1030 <vol_draw_subdiv@plt>
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
addss  -0x24(%rbp),%xmm2
movss  -0x24(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movzwl -0x1a(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%esi
call   1030 <vol_draw_subdiv@plt>
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x24(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movzwl -0x1a(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%esi
call   1030 <vol_draw_subdiv@plt>
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
addss  -0x24(%rbp),%xmm2
movss  -0x24(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movzwl -0x1a(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%esi
call   1030 <vol_draw_subdiv@plt>
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
addss  -0x24(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x24(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movzwl -0x1a(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%esi
call   1030 <vol_draw_subdiv@plt>
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
addss  -0x24(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
addss  -0x24(%rbp),%xmm2
movss  -0x24(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movzwl -0x1a(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%esi
call   1030 <vol_draw_subdiv@plt>
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
addss  -0x24(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x24(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movzwl -0x1a(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%esi
call   1030 <vol_draw_subdiv@plt>
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
addss  -0x24(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
addss  -0x24(%rbp),%xmm2
movss  -0x24(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movzwl -0x1a(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%esi
call   1030 <vol_draw_subdiv@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vol_draw_subdiv>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%r14d
movss  %xmm1,0x4(%rsp)
mov    %edi,%ebp
movaps %xmm3,%xmm1
movss  %xmm4,0x8(%rsp)
nopl   0x0(%rax)
mulss  0xe98(%rip),%xmm1
movaps %xmm1,%xmm5
mulss  %xmm4,%xmm5
cmp    $0x2,%ebp
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x10(%rsp)
addss  %xmm5,%xmm0
je     11c0 <vol_draw_subdiv+0x80>
cmp    $0x1,%ebp
jne    11f0 <vol_draw_subdiv+0xb0>
movss  0x4(%rsp),%xmm1
addss  %xmm5,%xmm1
addss  %xmm5,%xmm2
addss  %xmm5,%xmm5
subss  %xmm5,%xmm3
call   1040 <vol_draw_fill_sphere@plt>
cmp    $0x2,%r14w
jae    1216 <vol_draw_subdiv+0xd6>
jmp    136d <vol_draw_subdiv+0x22d>
cs nopw 0x0(%rax,%rax,1)
movss  0x4(%rsp),%xmm1
addss  %xmm5,%xmm1
addss  %xmm5,%xmm2
addss  %xmm5,%xmm5
subss  %xmm5,%xmm3
call   1060 <vol_draw_fill_pyramid@plt>
cmp    $0x2,%r14w
jae    1216 <vol_draw_subdiv+0xd6>
jmp    136d <vol_draw_subdiv+0x22d>
nopw   0x0(%rax,%rax,1)
movss  0x4(%rsp),%xmm1
addss  %xmm5,%xmm1
addss  %xmm5,%xmm2
addss  %xmm5,%xmm5
subss  %xmm5,%xmm3
call   1050 <vol_draw_fill_box@plt>
cmp    $0x2,%r14w
jb     136d <vol_draw_subdiv+0x22d>
add    $0xffffffff,%r14d
movzwl %r14w,%ebx
mov    %ebp,%edi
movss  0x10(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
movss  0x8(%rsp),%xmm4
mov    %ebx,%esi
call   1030 <vol_draw_subdiv@plt>
movss  0x14(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
addss  %xmm3,%xmm2
movss  %xmm2,0x1c(%rsp)
mov    %ebp,%edi
movss  0x10(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0x8(%rsp),%xmm4
mov    %ebx,%esi
call   1030 <vol_draw_subdiv@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm3
addss  %xmm3,%xmm0
movss  %xmm0,0x18(%rsp)
mov    %ebp,%edi
movss  0x4(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movss  0x8(%rsp),%xmm4
mov    %ebx,%esi
call   1030 <vol_draw_subdiv@plt>
mov    %ebp,%edi
movss  0x18(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0x1c(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
movss  0x8(%rsp),%xmm4
mov    %ebx,%esi
call   1030 <vol_draw_subdiv@plt>
movss  0xc(%rsp),%xmm3
movss  0x4(%rsp),%xmm1
addss  %xmm3,%xmm1
movss  %xmm1,0x4(%rsp)
mov    %ebp,%edi
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm2
movss  0x8(%rsp),%xmm4
mov    %ebx,%esi
call   1030 <vol_draw_subdiv@plt>
mov    %ebp,%edi
movss  0x10(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0x1c(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
movss  0x8(%rsp),%xmm4
mov    %ebx,%esi
call   1030 <vol_draw_subdiv@plt>
mov    %ebp,%edi
movss  0x18(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
movss  0x8(%rsp),%xmm4
mov    %ebx,%esi
call   1030 <vol_draw_subdiv@plt>
movss  0x8(%rsp),%xmm4
movss  0xc(%rsp),%xmm1
movss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm2
movaps %xmm1,%xmm3
jmp    1160 <vol_draw_subdiv+0x20>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @vol_draw_subdiv(i32 %0, float %1, float %2, float %3, float %4, float %5, i16 zeroext %6) {
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i16
%15 = alloca float
%16 = alloca float
store i32 %0, i32* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store float %4, float* %12
store float %5, float* %13
store i16 %6, i16* %14
%17 = load float, float* %12
%18 = fmul float %17, 5.000000e-01
%19 = load float, float* %13
%20 = fmul float %18, %19
store float %20, float* %15
%21 = load i32, i32* %8
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %37
23: ; preds = %7
%24 = load float, float* %9
%25 = load float, float* %15
%26 = fadd float %24, %25
%27 = load float, float* %10
%28 = load float, float* %15
%29 = fadd float %27, %28
%30 = load float, float* %11
%31 = load float, float* %15
%32 = fadd float %30, %31
%33 = load float, float* %12
%34 = load float, float* %15
%35 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %34, float %33)
%36 = call i32 @vol_draw_fill_sphere(float %26, float %29, float %32, float %35)
br label %69
37: ; preds = %7
%38 = load i32, i32* %8
%39 = icmp eq i32 %38, 2
br i1 %39, label %40, label %54
40: ; preds = %37
%41 = load float, float* %9
%42 = load float, float* %15
%43 = fadd float %41, %42
%44 = load float, float* %10
%45 = load float, float* %15
%46 = fadd float %44, %45
%47 = load float, float* %11
%48 = load float, float* %15
%49 = fadd float %47, %48
%50 = load float, float* %12
%51 = load float, float* %15
%52 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %51, float %50)
%53 = call i32 @vol_draw_fill_pyramid(float %43, float %46, float %49, float %52)
br label %68
54: ; preds = %37
%55 = load float, float* %9
%56 = load float, float* %15
%57 = fadd float %55, %56
%58 = load float, float* %10
%59 = load float, float* %15
%60 = fadd float %58, %59
%61 = load float, float* %11
%62 = load float, float* %15
%63 = fadd float %61, %62
%64 = load float, float* %12
%65 = load float, float* %15
%66 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %65, float %64)
%67 = call i32 @vol_draw_fill_box(float %57, float %60, float %63, float %66)
br label %68
68: ; preds = %54, %40
br label %69
69: ; preds = %68, %23
%70 = load i16, i16* %14
%71 = zext i16 %70 to i32
%72 = icmp sgt i32 %71, 1
br i1 %72, label %73, label %180
73: ; preds = %69
%74 = load float, float* %12
%75 = fdiv float %74, 2.000000e+00
store float %75, float* %16
%76 = load i32, i32* %8
%77 = load float, float* %9
%78 = load float, float* %10
%79 = load float, float* %11
%80 = load float, float* %16
%81 = load float, float* %13
%82 = load i16, i16* %14
%83 = zext i16 %82 to i32
%84 = sub nsw i32 %83, 1
%85 = trunc i32 %84 to i16
%86 = load i32, i32* %8
%87 = load float, float* %9
%88 = load float, float* %10
%89 = load float, float* %11
%90 = load float, float* %16
%91 = fadd float %89, %90
%92 = load float, float* %16
%93 = load float, float* %13
%94 = load i16, i16* %14
%95 = zext i16 %94 to i32
%96 = sub nsw i32 %95, 1
%97 = trunc i32 %96 to i16
%98 = load i32, i32* %8
%99 = load float, float* %9
%100 = load float, float* %16
%101 = fadd float %99, %100
%102 = load float, float* %10
%103 = load float, float* %11
%104 = load float, float* %16
%105 = load float, float* %13
%106 = load i16, i16* %14
%107 = zext i16 %106 to i32
%108 = sub nsw i32 %107, 1
%109 = trunc i32 %108 to i16
%110 = load i32, i32* %8
%111 = load float, float* %9
%112 = load float, float* %16
%113 = fadd float %111, %112
%114 = load float, float* %10
%115 = load float, float* %11
%116 = load float, float* %16
%117 = fadd float %115, %116
%118 = load float, float* %16
%119 = load float, float* %13
%120 = load i16, i16* %14
%121 = zext i16 %120 to i32
%122 = sub nsw i32 %121, 1
%123 = trunc i32 %122 to i16
%124 = load i32, i32* %8
%125 = load float, float* %9
%126 = load float, float* %10
%127 = load float, float* %16
%128 = fadd float %126, %127
%129 = load float, float* %11
%130 = load float, float* %16
%131 = load float, float* %13
%132 = load i16, i16* %14
%133 = zext i16 %132 to i32
%134 = sub nsw i32 %133, 1
%135 = trunc i32 %134 to i16
%136 = load i32, i32* %8
%137 = load float, float* %9
%138 = load float, float* %10
%139 = load float, float* %16
%140 = fadd float %138, %139
%141 = load float, float* %11
%142 = load float, float* %16
%143 = fadd float %141, %142
%144 = load float, float* %16
%145 = load float, float* %13
%146 = load i16, i16* %14
%147 = zext i16 %146 to i32
%148 = sub nsw i32 %147, 1
%149 = trunc i32 %148 to i16
%150 = load i32, i32* %8
%151 = load float, float* %9
%152 = load float, float* %16
%153 = fadd float %151, %152
%154 = load float, float* %10
%155 = load float, float* %16
%156 = fadd float %154, %155
%157 = load float, float* %11
%158 = load float, float* %16
%159 = load float, float* %13
%160 = load i16, i16* %14
%161 = zext i16 %160 to i32
%162 = sub nsw i32 %161, 1
%163 = trunc i32 %162 to i16
%164 = load i32, i32* %8
%165 = load float, float* %9
%166 = load float, float* %16
%167 = fadd float %165, %166
%168 = load float, float* %10
%169 = load float, float* %16
%170 = fadd float %168, %169
%171 = load float, float* %11
%172 = load float, float* %16
%173 = fadd float %171, %172
%174 = load float, float* %16
%175 = load float, float* %13
%176 = load i16, i16* %14
%177 = zext i16 %176 to i32
%178 = sub nsw i32 %177, 1
%179 = trunc i32 %178 to i16
br label %180
180: ; preds = %73, %69
ret void
}

LLVM IR (-O2):
define void @vol_draw_subdiv(i32 %0, float %1, float %2, float %3, float %4, float %5, i16 zeroext %6) {
br label %8
8: ; preds = %36, %7
%9 = phi float [ %1, %7 ], [ %39, %36 ]
%10 = phi float [ %2, %7 ], [ %40, %36 ]
%11 = phi float [ %3, %7 ], [ %38, %36 ]
%12 = phi float [ %4, %7 ], [ %14, %36 ]
%13 = phi i16 [ %6, %7 ], [ %37, %36 ]
%14 = fmul float %12, 5.000000e-01
%15 = fmul float %14, %5
switch i32 %0, label %28 [
i32 1, label %16
i32 2, label %22
]
16: ; preds = %8
%17 = fadd float %9, %15
%18 = fadd float %10, %15
%19 = fadd float %11, %15
%20 = tail call float @llvm.fmuladd.f32(float %15, float -2.000000e+00, float %12)
%21 = tail call i32 @vol_draw_fill_sphere(float %17, float %18, float %19, float %20)
br label %34
22: ; preds = %8
%23 = fadd float %9, %15
%24 = fadd float %10, %15
%25 = fadd float %11, %15
%26 = tail call float @llvm.fmuladd.f32(float %15, float -2.000000e+00, float %12)
%27 = tail call i32 @vol_draw_fill_pyramid(float %23, float %24, float %25, float %26)
br label %34
28: ; preds = %8
%29 = fadd float %9, %15
%30 = fadd float %10, %15
%31 = fadd float %11, %15
%32 = tail call float @llvm.fmuladd.f32(float %15, float -2.000000e+00, float %12)
%33 = tail call i32 @vol_draw_fill_box(float %29, float %30, float %31, float %32)
br label %34
34: ; preds = %22, %28, %16
%35 = icmp ugt i16 %13, 1
br i1 %35, label %36, label %41
36: ; preds = %34
%37 = add i16 %13, -1
tail call void @vol_draw_subdiv(i32 %0, float %9, float %10, float %11, float %14, float %5, i16 zeroext %37)
%38 = fadd float %11, %14
tail call void @vol_draw_subdiv(i32 %0, float %9, float %10, float %38, float %14, float %5, i16 zeroext %37)
%39 = fadd float %9, %14
tail call void @vol_draw_subdiv(i32 %0, float %39, float %10, float %11, float %14, float %5, i16 zeroext %37)
tail call void @vol_draw_subdiv(i32 %0, float %39, float %10, float %38, float %14, float %5, i16 zeroext %37)
%40 = fadd float %10, %14
tail call void @vol_draw_subdiv(i32 %0, float %9, float %40, float %11, float %14, float %5, i16 zeroext %37)
tail call void @vol_draw_subdiv(i32 %0, float %9, float %40, float %38, float %14, float %5, i16 zeroext %37)
tail call void @vol_draw_subdiv(i32 %0, float %39, float %40, float %11, float %14, float %5, i16 zeroext %37)
br label %8
41: ; preds = %34
ret void
}