#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 ceil(float);
double vol_draw_cube_fill_value(int, int, int, float);
int /*<<< orphan*/ vol_draw_op(int, int, int, double);
void vol_draw_fill_box(float x, float y, float z, float size) {
  int j, k, l;
  size = ceil(size);
  for (j = 0; j < size; j++)
    for (k = 0; k < size; k++)
      for (l = 0; l < size; l++) {
        int dx = x + j, dy = y + k, dz = z + l;
        double val = vol_draw_cube_fill_value(j, k, l, size);
        vol_draw_op(dx, dy, dz, val);
      }
}


x86 assembly (clang, -O0):
<vol_draw_fill_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <ceil@plt>
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1247 <vol_draw_fill_box+0x117>
movl   $0x0,-0x18(%rbp)
cvtsi2ssl -0x18(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1234 <vol_draw_fill_box+0x104>
movl   $0x0,-0x1c(%rbp)
cvtsi2ssl -0x1c(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1221 <vol_draw_fill_box+0xf1>
movss  -0x4(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
movss  -0x10(%rbp),%xmm0
call   1040 <vol_draw_cube_fill_value@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
movsd  -0x30(%rbp),%xmm0
call   1050 <vol_draw_op@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1196 <vol_draw_fill_box+0x66>
jmp    1226 <vol_draw_fill_box+0xf6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117c <vol_draw_fill_box+0x4c>
jmp    1239 <vol_draw_fill_box+0x109>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <vol_draw_fill_box+0x32>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vol_draw_fill_box>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
movaps %xmm3,%xmm0
call   1030 <ceilf@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11ff <vol_draw_fill_box+0xcf>
xor    %r14d,%r14d
movss  %xmm0,0x10(%rsp)
nopl   (%rax)
addss  0x8(%rsp),%xmm1
cvttss2si %xmm1,%r15d
xorps  %xmm1,%xmm1
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addss  0xc(%rsp),%xmm1
cvttss2si %xmm1,%r13d
xor    %ebx,%ebx
xorps  %xmm1,%xmm1
addss  0x14(%rsp),%xmm1
cvttss2si %xmm1,%ebp
mov    %r14d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
call   1040 <vol_draw_cube_fill_value@plt>
mov    %r15d,%edi
mov    %r13d,%esi
mov    %ebp,%edx
call   1050 <vol_draw_op@plt>
movss  0x10(%rsp),%xmm0
add    $0x1,%ebx
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
ucomiss %xmm1,%xmm0
ja     11a0 <vol_draw_fill_box+0x70>
add    $0x1,%r12d
xorps  %xmm1,%xmm1
cvtsi2ss %r12d,%xmm1
ucomiss %xmm1,%xmm0
ja     1190 <vol_draw_fill_box+0x60>
add    $0x1,%r14d
xorps  %xmm1,%xmm1
cvtsi2ss %r14d,%xmm1
ucomiss %xmm1,%xmm0
ja     1170 <vol_draw_fill_box+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vol_draw_fill_box(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 i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%16 = load float, float* %8
%17 = call float @ceil(float %16)
store float %17, float* %8
store i32 0, i32* %9
br label %18
18: ; preds = %69, %4
%19 = load i32, i32* %9
%20 = sitofp i32 %19 to float
%21 = load float, float* %8
%22 = fcmp olt float %20, %21
br i1 %22, label %23, label %72
23: ; preds = %18
store i32 0, i32* %10
br label %24
24: ; preds = %65, %23
%25 = load i32, i32* %10
%26 = sitofp i32 %25 to float
%27 = load float, float* %8
%28 = fcmp olt float %26, %27
br i1 %28, label %29, label %68
29: ; preds = %24
store i32 0, i32* %11
br label %30
30: ; preds = %61, %29
%31 = load i32, i32* %11
%32 = sitofp i32 %31 to float
%33 = load float, float* %8
%34 = fcmp olt float %32, %33
br i1 %34, label %35, label %64
35: ; preds = %30
%36 = load float, float* %5
%37 = load i32, i32* %9
%38 = sitofp i32 %37 to float
%39 = fadd float %36, %38
%40 = fptosi float %39 to i32
store i32 %40, i32* %12
%41 = load float, float* %6
%42 = load i32, i32* %10
%43 = sitofp i32 %42 to float
%44 = fadd float %41, %43
%45 = fptosi float %44 to i32
store i32 %45, i32* %13
%46 = load float, float* %7
%47 = load i32, i32* %11
%48 = sitofp i32 %47 to float
%49 = fadd float %46, %48
%50 = fptosi float %49 to i32
store i32 %50, i32* %14
%51 = load i32, i32* %9
%52 = load i32, i32* %10
%53 = load i32, i32* %11
%54 = load float, float* %8
%55 = call double @vol_draw_cube_fill_value(i32 %51, i32 %52, i32 %53, float %54)
store double %55, double* %15
%56 = load i32, i32* %12
%57 = load i32, i32* %13
%58 = load i32, i32* %14
%59 = load double, double* %15
%60 = call i32 @vol_draw_op(i32 %56, i32 %57, i32 %58, double %59)
br label %61
61: ; preds = %35
%62 = load i32, i32* %11
%63 = add nsw i32 %62, 1
store i32 %63, i32* %11
br label %30
64: ; preds = %30
br label %65
65: ; preds = %64
%66 = load i32, i32* %10
%67 = add nsw i32 %66, 1
store i32 %67, i32* %10
br label %24
68: ; preds = %24
br label %69
69: ; preds = %68
%70 = load i32, i32* %9
%71 = add nsw i32 %70, 1
store i32 %71, i32* %9
br label %18
72: ; preds = %18
ret void
}

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