#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*/ endrotate();
int /*<<< orphan*/ endxlate();
int /*<<< orphan*/ gothic_arch(double, double, double);
int /*<<< orphan*/ rotate(int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ xlate(double, int /*<<< orphan*/, int /*<<< orphan*/);
void gothic_arch_array(double length, double width, double height,
                       double border_thickness, int narches) {
  int i;
  double l = length - border_thickness * 2.0;
  double wspan = (l + border_thickness) / narches;
  double wwidth = wspan - border_thickness;
  double x;
  x = -(length / 2.0) + border_thickness + (wwidth / 2.0);
  for (i = 0; i < narches; i++) {
    xlate(x, 0, 0);
    rotate(90, 0, 0, 1);
    gothic_arch(wwidth, height, width);
    endrotate();
    endxlate();
    x += wspan;
  }
}


x86 assembly (clang, -O0):
<gothic_arch_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe2f(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  0xe02(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    127e <gothic_arch_array+0x12e>
movsd  -0x48(%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   1050 <rotate@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
call   1040 <gothic_arch@plt>
mov    $0x0,%al
call   1060 <endrotate@plt>
mov    $0x0,%al
call   1070 <endxlate@plt>
movsd  -0x38(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1212 <gothic_arch_array+0xc2>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gothic_arch_array>:
push   %rbx
sub    $0x30,%rsp
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
test   %edi,%edi
jle    121c <gothic_arch_array+0xcc>
mov    %edi,%ebx
movapd %xmm3,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
addsd  %xmm3,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
subsd  %xmm3,%xmm2
movsd  0xe64(%rip),%xmm1
mulsd  %xmm1,%xmm0
subsd  %xmm0,%xmm3
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm1,0x28(%rsp)
movapd %xmm1,%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1030 <xlate@plt>
mov    $0x5a,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1050 <rotate@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
call   1040 <gothic_arch@plt>
xor    %eax,%eax
call   1060 <endrotate@plt>
xor    %eax,%eax
call   1070 <endxlate@plt>
movsd  0x28(%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
add    $0xffffffff,%ebx
jne    11c0 <gothic_arch_array+0x70>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @gothic_arch_array(double %0, double %1, double %2, double %3, i32 %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store i32 %4, i32* %10
%16 = load double, double* %6
%17 = load double, double* %9
%18 = fneg double %17
%19 = call double @llvm.fmuladd.f64(double %18, double 2.000000e+00, double %16)
store double %19, double* %12
%20 = load double, double* %12
%21 = load double, double* %9
%22 = fadd double %20, %21
%23 = load i32, i32* %10
%24 = sitofp i32 %23 to double
%25 = fdiv double %22, %24
store double %25, double* %13
%26 = load double, double* %13
%27 = load double, double* %9
%28 = fsub double %26, %27
store double %28, double* %14
%29 = load double, double* %6
%30 = fdiv double %29, 2.000000e+00
%31 = fneg double %30
%32 = load double, double* %9
%33 = fadd double %31, %32
%34 = load double, double* %14
%35 = fdiv double %34, 2.000000e+00
%36 = fadd double %33, %35
store double %36, double* %15
store i32 0, i32* %11
br label %37
37: ; preds = %54, %5
%38 = load i32, i32* %11
%39 = load i32, i32* %10
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %57
41: ; preds = %37
%42 = load double, double* %15
%43 = call i32 @xlate(double %42, i32 0, i32 0)
%44 = call i32 @rotate(i32 90, i32 0, i32 0, i32 1)
%45 = load double, double* %14
%46 = load double, double* %8
%47 = load double, double* %7
%48 = call i32 @gothic_arch(double %45, double %46, double %47)
%49 = call i32 (...) @endrotate()
%50 = call i32 (...) @endxlate()
%51 = load double, double* %13
%52 = load double, double* %15
%53 = fadd double %52, %51
store double %53, double* %15
br label %54
54: ; preds = %41
%55 = load i32, i32* %11
%56 = add nsw i32 %55, 1
store i32 %56, i32* %11
br label %37
57: ; preds = %37
ret void
}

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