#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_pyramid(float, float, float, float);
void vol_draw_sierpinski_pyramid(float x, float y, float z, float size,
                                 unsigned short lvl) {
  if (lvl == 0) {
    vol_draw_fill_pyramid(x, y, z, size);
    return;
  }
  float half = size / 2;
  vol_draw_sierpinski_pyramid(x, y, z, half, lvl - 1);
  vol_draw_sierpinski_pyramid(x + half, y, z, half, lvl - 1);
  vol_draw_sierpinski_pyramid(x, y, z + half, half, lvl - 1);
  vol_draw_sierpinski_pyramid(x + half, y, z + half, half, lvl - 1);
  vol_draw_sierpinski_pyramid(x + (half / 2), y + half, z + (half / 2), half,
                              lvl - 1);
}


x86 assembly (clang, -O0):
<vol_draw_sierpinski_pyramid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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_sierpinski_pyramid+0x4e>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1040 <vol_draw_fill_pyramid@plt>
jmp    1276 <vol_draw_sierpinski_pyramid+0x156>
movss  -0x10(%rbp),%xmm0
movss  0xe85(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
movzwl -0x12(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
movss  -0x4(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
movzwl -0x12(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
addss  -0x18(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
movzwl -0x12(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
movss  -0x4(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
addss  -0x18(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
movzwl -0x12(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  0xdca(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
addss  -0x18(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
movss  0xda6(%rip),%xmm4
divss  %xmm4,%xmm3
addss  %xmm3,%xmm2
movss  -0x18(%rbp),%xmm3
movzwl -0x12(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vol_draw_sierpinski_pyramid>:
push   %rbx
sub    $0x20,%rsp
movaps %xmm2,%xmm4
test   %edi,%edi
je     1232 <vol_draw_sierpinski_pyramid+0x112>
mov    %edi,%ebx
add    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movss  %xmm4,0x14(%rsp)
movss  %xmm0,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
movss  0xea6(%rip),%xmm0
mulss  %xmm0,%xmm3
movss  %xmm3,0x8(%rsp)
movzwl %bx,%ebx
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movaps %xmm4,%xmm2
movss  0x8(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
movss  0x10(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
movss  0xc(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movss  0x8(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
movss  0x14(%rsp),%xmm2
addss  0x8(%rsp),%xmm2
movss  %xmm2,0x18(%rsp)
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
movss  0x1c(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
movss  0x8(%rsp),%xmm3
mov    %ebx,%edi
call   1030 <vol_draw_sierpinski_pyramid@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm3
movaps %xmm3,%xmm2
mulss  0xdeb(%rip),%xmm2
addss  %xmm2,%xmm0
addss  %xmm3,%xmm1
addss  0x14(%rsp),%xmm2
movaps %xmm2,%xmm4
add    $0xffff,%bx
jb     1140 <vol_draw_sierpinski_pyramid+0x20>
jmp    1235 <vol_draw_sierpinski_pyramid+0x115>
movaps %xmm4,%xmm2
add    $0x20,%rsp
pop    %rbx
jmp    1040 <vol_draw_fill_pyramid@plt>

LLVM IR (-O0):
define void @vol_draw_sierpinski_pyramid(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
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
%12 = load i16, i16* %10
%13 = zext i16 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %5
%16 = load float, float* %6
%17 = load float, float* %7
%18 = load float, float* %8
%19 = load float, float* %9
%20 = call i32 @vol_draw_fill_pyramid(float %16, float %17, float %18, float %19)
br label %80
21: ; preds = %5
%22 = load float, float* %9
%23 = fdiv float %22, 2.000000e+00
store float %23, float* %11
%24 = load float, float* %6
%25 = load float, float* %7
%26 = load float, float* %8
%27 = load float, float* %11
%28 = load i16, i16* %10
%29 = zext i16 %28 to i32
%30 = sub nsw i32 %29, 1
%31 = trunc i32 %30 to i16
%32 = load float, float* %6
%33 = load float, float* %11
%34 = fadd float %32, %33
%35 = load float, float* %7
%36 = load float, float* %8
%37 = load float, float* %11
%38 = load i16, i16* %10
%39 = zext i16 %38 to i32
%40 = sub nsw i32 %39, 1
%41 = trunc i32 %40 to i16
%42 = load float, float* %6
%43 = load float, float* %7
%44 = load float, float* %8
%45 = load float, float* %11
%46 = fadd float %44, %45
%47 = load float, float* %11
%48 = load i16, i16* %10
%49 = zext i16 %48 to i32
%50 = sub nsw i32 %49, 1
%51 = trunc i32 %50 to i16
%52 = load float, float* %6
%53 = load float, float* %11
%54 = fadd float %52, %53
%55 = load float, float* %7
%56 = load float, float* %8
%57 = load float, float* %11
%58 = fadd float %56, %57
%59 = load float, float* %11
%60 = load i16, i16* %10
%61 = zext i16 %60 to i32
%62 = sub nsw i32 %61, 1
%63 = trunc i32 %62 to i16
%64 = load float, float* %6
%65 = load float, float* %11
%66 = fdiv float %65, 2.000000e+00
%67 = fadd float %64, %66
%68 = load float, float* %7
%69 = load float, float* %11
%70 = fadd float %68, %69
%71 = load float, float* %8
%72 = load float, float* %11
%73 = fdiv float %72, 2.000000e+00
%74 = fadd float %71, %73
%75 = load float, float* %11
%76 = load i16, i16* %10
%77 = zext i16 %76 to i32
%78 = sub nsw i32 %77, 1
%79 = trunc i32 %78 to i16
br label %80
80: ; preds = %21, %15
ret void
}

LLVM IR (-O2):
define void @vol_draw_sierpinski_pyramid(float %0, float %1, float %2, float %3, i16 zeroext %4) {
%6 = icmp eq i16 %4, 0
br i1 %6, label %7, label %13
7: ; preds = %13, %5
%8 = phi float [ %0, %5 ], [ %24, %13 ]
%9 = phi float [ %1, %5 ], [ %25, %13 ]
%10 = phi float [ %2, %5 ], [ %26, %13 ]
%11 = phi float [ %3, %5 ], [ %19, %13 ]
%12 = tail call i32 @vol_draw_fill_pyramid(float %8, float %9, float %10, float %11)
ret void
13: ; preds = %5, %13
%14 = phi i16 [ %20, %13 ], [ %4, %5 ]
%15 = phi float [ %19, %13 ], [ %3, %5 ]
%16 = phi float [ %26, %13 ], [ %2, %5 ]
%17 = phi float [ %25, %13 ], [ %1, %5 ]
%18 = phi float [ %24, %13 ], [ %0, %5 ]
%19 = fmul float %15, 5.000000e-01
%20 = add i16 %14, -1
tail call void @vol_draw_sierpinski_pyramid(float %18, float %17, float %16, float %19, i16 zeroext %20)
%21 = fadd float %18, %19
tail call void @vol_draw_sierpinski_pyramid(float %21, float %17, float %16, float %19, i16 zeroext %20)
%22 = fadd float %16, %19
tail call void @vol_draw_sierpinski_pyramid(float %18, float %17, float %22, float %19, i16 zeroext %20)
tail call void @vol_draw_sierpinski_pyramid(float %21, float %17, float %22, float %19, i16 zeroext %20)
%23 = fmul float %19, 5.000000e-01
%24 = fadd float %18, %23
%25 = fadd float %17, %19
%26 = fadd float %16, %23
%27 = icmp eq i16 %20, 0
br i1 %27, label %7, label %13
}