#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*/ buttress(double, double, double, double);
int /*<<< orphan*/ endrotate();
int /*<<< orphan*/ endxlate();
int /*<<< orphan*/ rotate(int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ xlate(double, int /*<<< orphan*/, int /*<<< orphan*/);
void buttress_array(double width, double length, double height, double angle,
                    double spacing, int count) {
  int i;
  double x;
  x = -(spacing / 2.0) * (count - 1);
  for (i = 0; i < count; i++) {
    xlate(x, 0, 0);
    rotate(90, 0, 0, 1);
    buttress(width, length, height, angle);
    endrotate();
    x += spacing;
    endxlate();
  }
}


x86 assembly (clang, -O0):
<buttress_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %edi,-0x2c(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe7f(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1227 <buttress_array+0xd7>
movsd  -0x38(%rbp),%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1030 <xlate@plt>
mov    $0x5a,%edi
xor    %edx,%edx
mov    $0x1,%ecx
mov    %edx,%esi
call   1040 <rotate@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
call   1050 <buttress@plt>
mov    $0x0,%al
call   1060 <endrotate@plt>
movsd  -0x28(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    $0x0,%al
call   1070 <endxlate@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b6 <buttress_array+0x66>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buttress_array>:
push   %rbx
sub    $0x30,%rsp
movsd  %xmm4,0x8(%rsp)
movsd  %xmm3,0x28(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
test   %edi,%edi
jle    1201 <buttress_array+0xb1>
mov    %edi,%ebx
movsd  0xe7b(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
lea    -0x1(%rbx),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
xchg   %ax,%ax
movsd  (%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1030 <xlate@plt>
mov    $0x5a,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <rotate@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
call   1050 <buttress@plt>
xor    %eax,%eax
call   1060 <endrotate@plt>
movsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1070 <endxlate@plt>
add    $0xffffffff,%ebx
jne    11a0 <buttress_array+0x50>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @buttress_array(double %0, double %1, double %2, double %3, double %4, i32 %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store i32 %5, i32* %12
%15 = load double, double* %11
%16 = fdiv double %15, 2.000000e+00
%17 = fneg double %16
%18 = load i32, i32* %12
%19 = sub nsw i32 %18, 1
%20 = sitofp i32 %19 to double
%21 = fmul double %17, %20
store double %21, double* %14
store i32 0, i32* %13
br label %22
22: ; preds = %40, %6
%23 = load i32, i32* %13
%24 = load i32, i32* %12
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %43
26: ; preds = %22
%27 = load double, double* %14
%28 = call i32 @xlate(double %27, i32 0, i32 0)
%29 = call i32 @rotate(i32 90, i32 0, i32 0, i32 1)
%30 = load double, double* %7
%31 = load double, double* %8
%32 = load double, double* %9
%33 = load double, double* %10
%34 = call i32 @buttress(double %30, double %31, double %32, double %33)
%35 = call i32 (...) @endrotate()
%36 = load double, double* %11
%37 = load double, double* %14
%38 = fadd double %37, %36
store double %38, double* %14
%39 = call i32 (...) @endxlate()
br label %40
40: ; preds = %26
%41 = load i32, i32* %13
%42 = add nsw i32 %41, 1
store i32 %42, i32* %13
br label %22
43: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @buttress_array(double %0, double %1, double %2, double %3, double %4, i32 %5) {
%7 = icmp sgt i32 %5, 0
br i1 %7, label %8, label %24
8: ; preds = %6
%9 = fmul double %4, -5.000000e-01
%10 = add nsw i32 %5, -1
%11 = sitofp i32 %10 to double
%12 = fmul double %9, %11
br label %13
13: ; preds = %8, %13
%14 = phi double [ %20, %13 ], [ %12, %8 ]
%15 = phi i32 [ %22, %13 ], [ 0, %8 ]
%16 = tail call i32 @xlate(double %14, i32 0, i32 0)
%17 = tail call i32 @rotate(i32 90, i32 0, i32 0, i32 1)
%18 = tail call i32 @buttress(double %0, double %1, double %2, double %3)
%19 = tail call i32 (...) @endrotate()
%20 = fadd double %14, %4
%21 = tail call i32 (...) @endxlate()
%22 = add nuw nsw i32 %15, 1
%23 = icmp eq i32 %22, %5
br i1 %23, label %24, label %13
24: ; preds = %13, %6
ret void
}