#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 ceil(float);
double vol_draw_cube_fill_value(int, int, int, int);
int /*<<< orphan*/ vol_draw_op(float, float, float, double);
void vol_draw_fill_pyramid(float x, float y, float z, float size) {
  x = ceil(x);
  y = ceil(y);
  z = ceil(z);
  size = ceil(size);
  int j, k, l;
  float pyr_size = size;
  for (k = 0; k < size; k++) {
    for (j = 0; j < ceil(pyr_size); j++)
      for (l = 0; l < ceil(pyr_size); l++) {
        double val = vol_draw_cube_fill_value(j, l, -1, ceil(pyr_size));
        vol_draw_op((float)j + x, (float)k + y, (float)l + z, val);
      }
    if (k % 2 == 1)
      pyr_size -= 2;
    x += 0.5;
    z += 0.5;
  }
}


x86 assembly (clang, -O0):
<vol_draw_fill_pyramid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <ceil@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <ceil@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <ceil@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <ceil@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
cvtsi2ssl -0x18(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    12ee <vol_draw_fill_pyramid+0x1be>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movss  -0x20(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jge    127a <vol_draw_fill_pyramid+0x14a>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
movss  -0x20(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
jge    1267 <vol_draw_fill_pyramid+0x137>
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
movss  -0x20(%rbp),%xmm0
call   1030 <ceil@plt>
mov    -0x38(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    %eax,%ecx
mov    $0xffffffff,%edx
call   1040 <vol_draw_cube_fill_value@plt>
movsd  %xmm0,-0x28(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
addss  -0x8(%rbp),%xmm1
cvtsi2ssl -0x1c(%rbp),%xmm2
addss  -0xc(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
call   1050 <vol_draw_op@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e7 <vol_draw_fill_pyramid+0xb7>
jmp    126c <vol_draw_fill_pyramid+0x13c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c3 <vol_draw_fill_pyramid+0x93>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    12a4 <vol_draw_fill_pyramid+0x174>
movss  -0x20(%rbp),%xmm0
movss  0xd65(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd53(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd35(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a9 <vol_draw_fill_pyramid+0x79>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vol_draw_fill_pyramid>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
movss  %xmm3,0xc(%rsp)
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0x10(%rsp)
call   1030 <ceil@plt>
mov    %eax,%r14d
movss  0x10(%rsp),%xmm0
call   1030 <ceil@plt>
mov    %eax,%ebp
movss  0x14(%rsp),%xmm0
call   1030 <ceil@plt>
mov    %eax,%ebx
movss  0xc(%rsp),%xmm0
call   1030 <ceil@plt>
test   %eax,%eax
jle    12f3 <vol_draw_fill_pyramid+0x1c3>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm0,0x18(%rsp)
xorps  %xmm2,%xmm2
cvtsi2ss %eax,%xmm2
movd   %ebx,%xmm0
movd   %r14d,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm0
movaps %xmm0,0x20(%rsp)
xor    %r14d,%r14d
xorps  %xmm1,%xmm1
movss  %xmm2,0x1c(%rsp)
jmp    11ec <vol_draw_fill_pyramid+0xbc>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r14d
xorps  %xmm1,%xmm1
cvtsi2ss %r14d,%xmm1
movaps 0x20(%rsp),%xmm0
addps  0xe38(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movss  0x1c(%rsp),%xmm0
ucomiss %xmm1,%xmm0
jbe    12f3 <vol_draw_fill_pyramid+0x1c3>
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x10(%rsp)
movaps %xmm2,%xmm0
call   1030 <ceil@plt>
test   %eax,%eax
jle    12d0 <vol_draw_fill_pyramid+0x1a0>
movss  0x10(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
movaps 0x20(%rsp),%xmm0
shufps $0x55,%xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
xor    %ebx,%ebx
jmp    1246 <vol_draw_fill_pyramid+0x116>
nopl   0x0(%rax)
add    $0x1,%ebx
movss  0xc(%rsp),%xmm0
call   1030 <ceil@plt>
cmp    %eax,%ebx
jge    12d0 <vol_draw_fill_pyramid+0x1a0>
movss  0xc(%rsp),%xmm0
call   1030 <ceil@plt>
test   %eax,%eax
jle    1230 <vol_draw_fill_pyramid+0x100>
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
addss  0x20(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm0
call   1030 <ceil@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0xffffffff,%edx
mov    %eax,%ecx
call   1040 <vol_draw_cube_fill_value@plt>
movaps %xmm0,%xmm3
xorps  %xmm2,%xmm2
cvtsi2ss %ebp,%xmm2
addss  0x30(%rsp),%xmm2
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1050 <vol_draw_op@plt>
add    $0x1,%ebp
movss  0xc(%rsp),%xmm0
call   1030 <ceil@plt>
cmp    %eax,%ebp
jl     1270 <vol_draw_fill_pyramid+0x140>
jmp    1230 <vol_draw_fill_pyramid+0x100>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  0xc(%rsp),%xmm2
movaps %xmm2,%xmm0
addss  0xd1f(%rip),%xmm0
test   $0x1,%r14b
je     11c0 <vol_draw_fill_pyramid+0x90>
movaps %xmm0,%xmm2
jmp    11c0 <vol_draw_fill_pyramid+0x90>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @vol_draw_fill_pyramid(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca double
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%14 = load float, float* %5
%15 = call i32 @ceil(float %14)
%16 = sitofp i32 %15 to float
store float %16, float* %5
%17 = load float, float* %6
%18 = call i32 @ceil(float %17)
%19 = sitofp i32 %18 to float
store float %19, float* %6
%20 = load float, float* %7
%21 = call i32 @ceil(float %20)
%22 = sitofp i32 %21 to float
store float %22, float* %7
%23 = load float, float* %8
%24 = call i32 @ceil(float %23)
%25 = sitofp i32 %24 to float
store float %25, float* %8
%26 = load float, float* %8
store float %26, float* %12
store i32 0, i32* %10
br label %27
27: ; preds = %87, %4
%28 = load i32, i32* %10
%29 = sitofp i32 %28 to float
%30 = load float, float* %8
%31 = fcmp olt float %29, %30
br i1 %31, label %32, label %90
32: ; preds = %27
store i32 0, i32* %9
br label %33
33: ; preds = %68, %32
%34 = load i32, i32* %9
%35 = load float, float* %12
%36 = call i32 @ceil(float %35)
%37 = icmp slt i32 %34, %36
br i1 %37, label %38, label %71
38: ; preds = %33
store i32 0, i32* %11
br label %39
39: ; preds = %64, %38
%40 = load i32, i32* %11
%41 = load float, float* %12
%42 = call i32 @ceil(float %41)
%43 = icmp slt i32 %40, %42
br i1 %43, label %44, label %67
44: ; preds = %39
%45 = load i32, i32* %9
%46 = load i32, i32* %11
%47 = load float, float* %12
%48 = call i32 @ceil(float %47)
%49 = call double @vol_draw_cube_fill_value(i32 %45, i32 %46, i32 -1, i32 %48)
store double %49, double* %13
%50 = load i32, i32* %9
%51 = sitofp i32 %50 to float
%52 = load float, float* %5
%53 = fadd float %51, %52
%54 = load i32, i32* %10
%55 = sitofp i32 %54 to float
%56 = load float, float* %6
%57 = fadd float %55, %56
%58 = load i32, i32* %11
%59 = sitofp i32 %58 to float
%60 = load float, float* %7
%61 = fadd float %59, %60
%62 = load double, double* %13
%63 = call i32 @vol_draw_op(float %53, float %57, float %61, double %62)
br label %64
64: ; preds = %44
%65 = load i32, i32* %11
%66 = add nsw i32 %65, 1
store i32 %66, i32* %11
br label %39
67: ; preds = %39
br label %68
68: ; preds = %67
%69 = load i32, i32* %9
%70 = add nsw i32 %69, 1
store i32 %70, i32* %9
br label %33
71: ; preds = %33
%72 = load i32, i32* %10
%73 = srem i32 %72, 2
%74 = icmp eq i32 %73, 1
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = load float, float* %12
%77 = fsub float %76, 2.000000e+00
store float %77, float* %12
br label %78
78: ; preds = %75, %71
%79 = load float, float* %5
%80 = fpext float %79 to double
%81 = fadd double %80, 5.000000e-01
%82 = fptrunc double %81 to float
store float %82, float* %5
%83 = load float, float* %7
%84 = fpext float %83 to double
%85 = fadd double %84, 5.000000e-01
%86 = fptrunc double %85 to float
store float %86, float* %7
br label %87
87: ; preds = %78
%88 = load i32, i32* %10
%89 = add nsw i32 %88, 1
store i32 %89, i32* %10
br label %27
90: ; preds = %27
ret void
}

LLVM IR (-O2):
define void @vol_draw_fill_pyramid(float %0, float %1, float %2, float %3) {
%5 = tail call i32 @ceil(float %0)
%6 = tail call i32 @ceil(float %1)
%7 = sitofp i32 %6 to float
%8 = tail call i32 @ceil(float %2)
%9 = tail call i32 @ceil(float %3)
%10 = sitofp i32 %9 to float
%11 = icmp sgt i32 %9, 0
br i1 %11, label %12, label %57
12: ; preds = %4
%13 = insertelement <2 x i32> poison, i32 %5, i64 0
%14 = insertelement <2 x i32> %13, i32 %8, i64 1
%15 = sitofp <2 x i32> %14 to <2 x float>
br label %16
16: ; preds = %12, %48
%17 = phi float [ %55, %48 ], [ 0.000000e+00, %12 ]
%18 = phi float [ %52, %48 ], [ %10, %12 ]
%19 = phi i32 [ %54, %48 ], [ 0, %12 ]
%20 = phi <2 x float> [ %53, %48 ], [ %15, %12 ]
%21 = tail call i32 @ceil(float %18)
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %48
23: ; preds = %16
%24 = fadd float %17, %7
%25 = extractelement <2 x float> %20, i64 0
%26 = extractelement <2 x float> %20, i64 1
br label %27
27: ; preds = %23, %44
%28 = phi i32 [ 0, %23 ], [ %45, %44 ]
%29 = tail call i32 @ceil(float %18)
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %44
31: ; preds = %27
%32 = sitofp i32 %28 to float
%33 = fadd float %25, %32
br label %34
34: ; preds = %31, %34
%35 = phi i32 [ 0, %31 ], [ %41, %34 ]
%36 = tail call i32 @ceil(float %18)
%37 = tail call double @vol_draw_cube_fill_value(i32 %28, i32 %35, i32 -1, i32 %36)
%38 = sitofp i32 %35 to float
%39 = fadd float %26, %38
%40 = tail call i32 @vol_draw_op(float %33, float %24, float %39, double %37)
%41 = add nuw nsw i32 %35, 1
%42 = tail call i32 @ceil(float %18)
%43 = icmp slt i32 %41, %42
br i1 %43, label %34, label %44
44: ; preds = %34, %27
%45 = add nuw nsw i32 %28, 1
%46 = tail call i32 @ceil(float %18)
%47 = icmp slt i32 %45, %46
br i1 %47, label %27, label %48
48: ; preds = %44, %16
%49 = and i32 %19, 1
%50 = icmp eq i32 %49, 0
%51 = fadd float %18, -2.000000e+00
%52 = select i1 %50, float %18, float %51
%53 = fadd <2 x float> %20, <float 5.000000e-01, float 5.000000e-01>
%54 = add nuw nsw i32 %19, 1
%55 = sitofp i32 %54 to float
%56 = fcmp olt float %55, %10
br i1 %56, label %16, label %57
57: ; preds = %48, %4
ret void
}