#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*/ cube_buffer();
int /*<<< orphan*/ cube_rotate_layer(float, int);
void cube_rotate(float angle, int use_existing_buffer) {
  int layer;
  if (!use_existing_buffer)
    cube_buffer();
  for (layer = 0; layer < 8; layer++)
    cube_rotate_layer(angle, layer);
}


x86 assembly (clang, -O0):
<cube_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1141 <cube_rotate+0x21>
mov    $0x0,%al
call   1040 <cube_buffer@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    116d <cube_rotate+0x4d>
movss  -0x4(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <cube_rotate_layer@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <cube_rotate+0x28>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cube_rotate>:
push   %rax
test   %edi,%edi
movss  %xmm0,0x4(%rsp)
jne    1138 <cube_rotate+0x18>
xor    %eax,%eax
call   1040 <cube_buffer@plt>
movss  0x4(%rsp),%xmm0
xor    %edi,%edi
call   1030 <cube_rotate_layer@plt>
movss  0x4(%rsp),%xmm0
mov    $0x1,%edi
call   1030 <cube_rotate_layer@plt>
movss  0x4(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <cube_rotate_layer@plt>
movss  0x4(%rsp),%xmm0
mov    $0x3,%edi
call   1030 <cube_rotate_layer@plt>
movss  0x4(%rsp),%xmm0
mov    $0x4,%edi
call   1030 <cube_rotate_layer@plt>
movss  0x4(%rsp),%xmm0
mov    $0x5,%edi
call   1030 <cube_rotate_layer@plt>
movss  0x4(%rsp),%xmm0
mov    $0x6,%edi
call   1030 <cube_rotate_layer@plt>
movss  0x4(%rsp),%xmm0
mov    $0x7,%edi
pop    %rax
jmp    1030 <cube_rotate_layer@plt>

LLVM IR (-O0):
define void @cube_rotate(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 (...) @cube_buffer()
br label %10
10: ; preds = %8, %2
store i32 0, i32* %5
br label %11
11: ; preds = %18, %10
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load float, float* %3
%16 = load i32, i32* %5
%17 = call i32 @cube_rotate_layer(float %15, i32 %16)
br label %18
18: ; preds = %14
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %11
21: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @cube_rotate(float %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @cube_buffer()
br label %6
6: ; preds = %4, %2
%7 = tail call i32 @cube_rotate_layer(float %0, i32 0)
%8 = tail call i32 @cube_rotate_layer(float %0, i32 1)
%9 = tail call i32 @cube_rotate_layer(float %0, i32 2)
%10 = tail call i32 @cube_rotate_layer(float %0, i32 3)
%11 = tail call i32 @cube_rotate_layer(float %0, i32 4)
%12 = tail call i32 @cube_rotate_layer(float %0, i32 5)
%13 = tail call i32 @cube_rotate_layer(float %0, i32 6)
%14 = tail call i32 @cube_rotate_layer(float %0, i32 7)
ret void
}