#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*/ clrvoxel(unsigned char, unsigned char, int);
int /*<<< orphan*/ delay_ms(int);
int /*<<< orphan*/ setvoxel(unsigned char, unsigned char, int);
void sendvoxel_z(unsigned char x, unsigned char y, unsigned char z, int delay) {
  int i, ii;
  for (i = 0; i < 4; i++) {
    if (z == 3) {
      ii = 3 - i;
      clrvoxel(x, y, ii + 1);
    } else {
      ii = i;
      clrvoxel(x, y, ii - 1);
    }
    setvoxel(x, y, ii);
    delay_ms(delay);
  }
}


x86 assembly (clang, -O0):
<sendvoxel_z>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %ecx,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11d9 <sendvoxel_z+0xa9>
movzbl -0x3(%rbp),%eax
cmp    $0x3,%eax
jne    1192 <sendvoxel_z+0x62>
mov    $0x3,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x2(%rbp),%al
mov    -0x10(%rbp),%edx
add    $0x1,%edx
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <clrvoxel@plt>
jmp    11af <sendvoxel_z+0x7f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x2(%rbp),%al
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <clrvoxel@plt>
mov    -0x1(%rbp),%cl
mov    -0x2(%rbp),%al
mov    -0x10(%rbp),%edx
movzbl %cl,%edi
movzbl %al,%esi
call   1040 <setvoxel@plt>
mov    -0x8(%rbp),%edi
call   1050 <delay_ms@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <sendvoxel_z+0x24>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendvoxel_z>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %esi,%r13d
mov    %edi,%ebx
xor    %eax,%eax
xor    %r14d,%r14d
cmp    $0x3,%dl
setne  %al
mov    %rax,(%rsp)
sete   %r14b
lea    (%r14,%r14,4),%edx
add    $0xffffffff,%edx
lea    (%r14,%r14,2),%r15d
call   1030 <clrvoxel@plt>
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r15d,%edx
call   1040 <setvoxel@plt>
mov    %ebp,%edi
call   1050 <delay_ms@plt>
lea    0x1(%r14),%r12d
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r15d,%edx
call   1030 <clrvoxel@plt>
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r12d,%edx
call   1040 <setvoxel@plt>
mov    %ebp,%r15d
mov    %ebp,%edi
call   1050 <delay_ms@plt>
mov    $0x2,%ebp
sub    %r14d,%ebp
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r12d,%edx
call   1030 <clrvoxel@plt>
mov    %ebx,%edi
mov    %r13d,%esi
mov    %ebp,%edx
call   1040 <setvoxel@plt>
mov    %r15d,%r14d
mov    %r15d,%edi
call   1050 <delay_ms@plt>
mov    (%rsp),%rax
lea    (%rax,%rax,2),%r15d
mov    %ebx,%edi
mov    %r13d,%esi
mov    %ebp,%edx
call   1030 <clrvoxel@plt>
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r15d,%edx
call   1040 <setvoxel@plt>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <delay_ms@plt>

LLVM IR (-O0):
define void @sendvoxel_z(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i32 %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %11
11: ; preds = %40, %4
%12 = load i32, i32* %9
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %43
14: ; preds = %11
%15 = load i8, i8* %7
%16 = zext i8 %15 to i32
%17 = icmp eq i32 %16, 3
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %9
%20 = sub nsw i32 3, %19
store i32 %20, i32* %10
%21 = load i8, i8* %5
%22 = load i8, i8* %6
%23 = load i32, i32* %10
%24 = add nsw i32 %23, 1
%25 = call i32 @clrvoxel(i8 zeroext %21, i8 zeroext %22, i32 %24)
br label %33
26: ; preds = %14
%27 = load i32, i32* %9
store i32 %27, i32* %10
%28 = load i8, i8* %5
%29 = load i8, i8* %6
%30 = load i32, i32* %10
%31 = sub nsw i32 %30, 1
%32 = call i32 @clrvoxel(i8 zeroext %28, i8 zeroext %29, i32 %31)
br label %33
33: ; preds = %26, %18
%34 = load i8, i8* %5
%35 = load i8, i8* %6
%36 = load i32, i32* %10
%37 = call i32 @setvoxel(i8 zeroext %34, i8 zeroext %35, i32 %36)
%38 = load i32, i32* %8
%39 = call i32 @delay_ms(i32 %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %11
43: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @sendvoxel_z(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i32 %3) {
%5 = icmp eq i8 %2, 3
%6 = select i1 %5, i32 4, i32 -1
%7 = select i1 %5, i32 3, i32 0
%8 = tail call i32 @clrvoxel(i8 zeroext %0, i8 zeroext %1, i32 %6)
%9 = tail call i32 @setvoxel(i8 zeroext %0, i8 zeroext %1, i32 %7)
%10 = tail call i32 @delay_ms(i32 %3)
%11 = select i1 %5, i32 3, i32 0
%12 = select i1 %5, i32 2, i32 1
%13 = tail call i32 @clrvoxel(i8 zeroext %0, i8 zeroext %1, i32 %11)
%14 = tail call i32 @setvoxel(i8 zeroext %0, i8 zeroext %1, i32 %12)
%15 = tail call i32 @delay_ms(i32 %3)
%16 = select i1 %5, i32 2, i32 1
%17 = select i1 %5, i32 1, i32 2
%18 = tail call i32 @clrvoxel(i8 zeroext %0, i8 zeroext %1, i32 %16)
%19 = tail call i32 @setvoxel(i8 zeroext %0, i8 zeroext %1, i32 %17)
%20 = tail call i32 @delay_ms(i32 %3)
%21 = select i1 %5, i32 1, i32 2
%22 = select i1 %5, i32 0, i32 3
%23 = tail call i32 @clrvoxel(i8 zeroext %0, i8 zeroext %1, i32 %21)
%24 = tail call i32 @setvoxel(i8 zeroext %0, i8 zeroext %1, i32 %22)
%25 = tail call i32 @delay_ms(i32 %3)
ret void
}