#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);
void vol_draw_menger_sponge_box(float x, float y, float z, float size,
                                unsigned short lvl) {
  if (lvl == 0) {
    vol_draw_fill_box(x, y, z, size);
    return;
  }
  float j, k, l;
  float s3 = size / 3;
  for (j = 0; j < 3; j++)
    for (k = 0; k < 3; k++)
      for (l = 0; l < 3; l++) {
        int cnt_max = 0;
        if (j == 0 || j == 2)
          cnt_max++;
        if (k == 0 || k == 2)
          cnt_max++;
        if (l == 0 || l == 2)
          cnt_max++;
        if (cnt_max < 2)
          continue;
        vol_draw_menger_sponge_box(x + j * s3, y + k * s3, z + l * s3, s3,
                                   lvl - 1);
      }
}


x86 assembly (clang, -O0):
<vol_draw_menger_sponge_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %di,%ax
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
cmp    $0x0,%eax
jne    116e <vol_draw_menger_sponge_box+0x4e>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1040 <vol_draw_fill_box@plt>
jmp    1353 <vol_draw_menger_sponge_box+0x233>
movss  -0x10(%rbp),%xmm0
movss  0xe85(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe6c(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    1353 <vol_draw_menger_sponge_box+0x233>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe52(%rip),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    1337 <vol_draw_menger_sponge_box+0x217>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xe38(%rip),%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    131b <vol_draw_menger_sponge_box+0x1fb>
movl   $0x0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11f5 <vol_draw_menger_sponge_box+0xd5>
jp     11f5 <vol_draw_menger_sponge_box+0xd5>
jmp    1211 <vol_draw_menger_sponge_box+0xf1>
movss  -0x18(%rbp),%xmm0
movss  0xe06(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    121a <vol_draw_menger_sponge_box+0xfa>
jp     121a <vol_draw_menger_sponge_box+0xfa>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1236 <vol_draw_menger_sponge_box+0x116>
jp     1236 <vol_draw_menger_sponge_box+0x116>
jmp    1252 <vol_draw_menger_sponge_box+0x132>
movss  -0x1c(%rbp),%xmm0
movss  0xdc5(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    125b <vol_draw_menger_sponge_box+0x13b>
jp     125b <vol_draw_menger_sponge_box+0x13b>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1277 <vol_draw_menger_sponge_box+0x157>
jp     1277 <vol_draw_menger_sponge_box+0x157>
jmp    1293 <vol_draw_menger_sponge_box+0x173>
movss  -0x20(%rbp),%xmm0
movss  0xd84(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    129c <vol_draw_menger_sponge_box+0x17c>
jp     129c <vol_draw_menger_sponge_box+0x17c>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x2,-0x28(%rbp)
jge    12ab <vol_draw_menger_sponge_box+0x18b>
jmp    1304 <vol_draw_menger_sponge_box+0x1e4>
movss  -0x4(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
movss  -0x24(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm2
movss  -0x1c(%rbp),%xmm1
movss  -0x24(%rbp),%xmm3
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
movss  -0xc(%rbp),%xmm3
movss  -0x20(%rbp),%xmm2
movss  -0x24(%rbp),%xmm4
mulss  %xmm4,%xmm2
addss  %xmm3,%xmm2
movss  -0x24(%rbp),%xmm3
movzwl -0x12(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
movss  0xcf8(%rip),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    11c0 <vol_draw_menger_sponge_box+0xa0>
jmp    1320 <vol_draw_menger_sponge_box+0x200>
movss  0xcdc(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11a6 <vol_draw_menger_sponge_box+0x86>
jmp    133c <vol_draw_menger_sponge_box+0x21c>
movss  0xcc0(%rip),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    118c <vol_draw_menger_sponge_box+0x6c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vol_draw_menger_sponge_box>:
test   %edi,%edi
je     12f2 <vol_draw_menger_sponge_box+0x1d2>
push   %rbp
push   %rbx
sub    $0x28,%rsp
divss  0xeca(%rip),%xmm3
add    $0xffffffff,%edi
xorps  %xmm4,%xmm4
mulss  %xmm3,%xmm4
movaps %xmm4,%xmm5
addss  %xmm1,%xmm5
addss  %xmm2,%xmm4
movaps %xmm3,%xmm6
addss  %xmm2,%xmm6
movss  %xmm6,0x20(%rsp)
movaps %xmm3,%xmm6
addss  %xmm3,%xmm6
addss  %xmm6,%xmm2
movss  %xmm2,0x18(%rsp)
movss  %xmm3,0x4(%rsp)
addss  %xmm1,%xmm3
movss  %xmm3,0x1c(%rsp)
addss  %xmm1,%xmm6
movss  %xmm6,0xc(%rsp)
xor    %ebp,%ebp
movzwl %di,%ebx
movss  %xmm5,0x10(%rsp)
movss  %xmm0,0x24(%rsp)
movss  %xmm4,0x14(%rsp)
jmp    11dd <vol_draw_menger_sponge_box+0xbd>
nopl   0x0(%rax)
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
movss  0x4(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
add    $0x1,%ebp
cmp    $0x3,%ebp
movss  0x24(%rsp),%xmm0
movss  0x14(%rsp),%xmm4
movss  0x10(%rsp),%xmm5
je     12eb <vol_draw_menger_sponge_box+0x1cb>
xorps  %xmm1,%xmm1
cvtsi2ss %ebp,%xmm1
movss  0x4(%rsp),%xmm3
mulss  %xmm3,%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movaps %xmm1,%xmm0
movaps %xmm5,%xmm1
movaps %xmm4,%xmm2
mov    %ebx,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
test   $0x7ffffffd,%ebp
je     1220 <vol_draw_menger_sponge_box+0x100>
movss  0x8(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
jmp    1289 <vol_draw_menger_sponge_box+0x169>
xchg   %ax,%ax
movss  0x8(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0x20(%rsp),%xmm2
movss  0x4(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
movss  0x8(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
movss  0x4(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
movss  0x8(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movss  0x4(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
movss  0x8(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
movss  0x4(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
movss  0x14(%rsp),%xmm2
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
test   $0x7ffffffd,%ebp
jne    11a0 <vol_draw_menger_sponge_box+0x80>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x20(%rsp),%xmm2
movss  0x4(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_menger_sponge_box@plt>
jmp    11a0 <vol_draw_menger_sponge_box+0x80>
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret
jmp    1040 <vol_draw_fill_box@plt>

LLVM IR (-O0):
define void @vol_draw_menger_sponge_box(float %0, float %1, float %2, float %3, i16 zeroext %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i16
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca i32
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store i16 %4, i16* %10
%16 = load i16, i16* %10
%17 = zext i16 %16 to i32
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %5
%20 = load float, float* %6
%21 = load float, float* %7
%22 = load float, float* %8
%23 = load float, float* %9
%24 = call i32 @vol_draw_fill_box(float %20, float %21, float %22, float %23)
br label %99
25: ; preds = %5
%26 = load float, float* %9
%27 = fdiv float %26, 3.000000e+00
store float %27, float* %14
store float 0.000000e+00, float* %11
br label %28
28: ; preds = %96, %25
%29 = load float, float* %11
%30 = fcmp olt float %29, 3.000000e+00
br i1 %30, label %31, label %99
31: ; preds = %28
store float 0.000000e+00, float* %12
br label %32
32: ; preds = %92, %31
%33 = load float, float* %12
%34 = fcmp olt float %33, 3.000000e+00
br i1 %34, label %35, label %95
35: ; preds = %32
store float 0.000000e+00, float* %13
br label %36
36: ; preds = %88, %35
%37 = load float, float* %13
%38 = fcmp olt float %37, 3.000000e+00
br i1 %38, label %39, label %91
39: ; preds = %36
store i32 0, i32* %15
%40 = load float, float* %11
%41 = fcmp oeq float %40, 0.000000e+00
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = load float, float* %11
%44 = fcmp oeq float %43, 2.000000e+00
br i1 %44, label %45, label %48
45: ; preds = %42, %39
%46 = load i32, i32* %15
%47 = add nsw i32 %46, 1
store i32 %47, i32* %15
br label %48
48: ; preds = %45, %42
%49 = load float, float* %12
%50 = fcmp oeq float %49, 0.000000e+00
br i1 %50, label %54, label %51
51: ; preds = %48
%52 = load float, float* %12
%53 = fcmp oeq float %52, 2.000000e+00
br i1 %53, label %54, label %57
54: ; preds = %51, %48
%55 = load i32, i32* %15
%56 = add nsw i32 %55, 1
store i32 %56, i32* %15
br label %57
57: ; preds = %54, %51
%58 = load float, float* %13
%59 = fcmp oeq float %58, 0.000000e+00
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load float, float* %13
%62 = fcmp oeq float %61, 2.000000e+00
br i1 %62, label %63, label %66
63: ; preds = %60, %57
%64 = load i32, i32* %15
%65 = add nsw i32 %64, 1
store i32 %65, i32* %15
br label %66
66: ; preds = %63, %60
%67 = load i32, i32* %15
%68 = icmp slt i32 %67, 2
br i1 %68, label %69, label %70
69: ; preds = %66
br label %88
70: ; preds = %66
%71 = load float, float* %6
%72 = load float, float* %11
%73 = load float, float* %14
%74 = call float @llvm.fmuladd.f32(float %72, float %73, float %71)
%75 = load float, float* %7
%76 = load float, float* %12
%77 = load float, float* %14
%78 = call float @llvm.fmuladd.f32(float %76, float %77, float %75)
%79 = load float, float* %8
%80 = load float, float* %13
%81 = load float, float* %14
%82 = call float @llvm.fmuladd.f32(float %80, float %81, float %79)
%83 = load float, float* %14
%84 = load i16, i16* %10
%85 = zext i16 %84 to i32
%86 = sub nsw i32 %85, 1
%87 = trunc i32 %86 to i16
br label %88
88: ; preds = %70, %69
%89 = load float, float* %13
%90 = fadd float %89, 1.000000e+00
store float %90, float* %13
br label %36
91: ; preds = %36
br label %92
92: ; preds = %91
%93 = load float, float* %12
%94 = fadd float %93, 1.000000e+00
store float %94, float* %12
br label %32
95: ; preds = %32
br label %96
96: ; preds = %95
%97 = load float, float* %11
%98 = fadd float %97, 1.000000e+00
store float %98, float* %11
br label %28
99: ; preds = %19, %28
ret void
}

LLVM IR (-O2):
define void @vol_draw_menger_sponge_box(float %0, float %1, float %2, float %3, i16 zeroext %4) {
%6 = icmp eq i16 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @vol_draw_fill_box(float %0, float %1, float %2, float %3)
br label %36
9: ; preds = %5
%10 = fdiv float %3, 3.000000e+00
%11 = add i16 %4, -1
%12 = tail call float @llvm.fmuladd.f32(float %10, float 0.000000e+00, float %1)
%13 = tail call float @llvm.fmuladd.f32(float %10, float 0.000000e+00, float %2)
%14 = fadd float %10, %2
%15 = tail call float @llvm.fmuladd.f32(float %10, float 2.000000e+00, float %2)
%16 = fadd float %10, %1
%17 = tail call float @llvm.fmuladd.f32(float %10, float 0.000000e+00, float %2)
%18 = tail call float @llvm.fmuladd.f32(float %10, float 2.000000e+00, float %2)
%19 = tail call float @llvm.fmuladd.f32(float %10, float 2.000000e+00, float %1)
%20 = tail call float @llvm.fmuladd.f32(float %10, float 0.000000e+00, float %2)
%21 = fadd float %10, %2
%22 = tail call float @llvm.fmuladd.f32(float %10, float 2.000000e+00, float %2)
br label %23
23: ; preds = %9, %33
%24 = phi i32 [ 0, %9 ], [ %34, %33 ]
%25 = sitofp i32 %24 to float
%26 = and i32 %24, 2147483645
%27 = icmp eq i32 %26, 0
%28 = tail call float @llvm.fmuladd.f32(float %25, float %10, float %0)
tail call void @vol_draw_menger_sponge_box(float %28, float %12, float %13, float %10, i16 zeroext %11)
br i1 %27, label %29, label %30
29: ; preds = %23
tail call void @vol_draw_menger_sponge_box(float %28, float %12, float %14, float %10, i16 zeroext %11)
tail call void @vol_draw_menger_sponge_box(float %28, float %12, float %15, float %10, i16 zeroext %11)
tail call void @vol_draw_menger_sponge_box(float %28, float %16, float %17, float %10, i16 zeroext %11)
tail call void @vol_draw_menger_sponge_box(float %28, float %16, float %18, float %10, i16 zeroext %11)
br label %31
30: ; preds = %23
tail call void @vol_draw_menger_sponge_box(float %28, float %12, float %15, float %10, i16 zeroext %11)
br label %31
31: ; preds = %30, %29
tail call void @vol_draw_menger_sponge_box(float %28, float %19, float %20, float %10, i16 zeroext %11)
br i1 %27, label %32, label %33
32: ; preds = %31
tail call void @vol_draw_menger_sponge_box(float %28, float %19, float %21, float %10, i16 zeroext %11)
br label %33
33: ; preds = %32, %31
tail call void @vol_draw_menger_sponge_box(float %28, float %19, float %22, float %10, i16 zeroext %11)
%34 = add nuw nsw i32 %24, 1
%35 = icmp eq i32 %34, 3
br i1 %35, label %36, label %23
36: ; preds = %33, %7
ret void
}