#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*/ crenelation_matrix(double, double, double, double);
int /*<<< orphan*/ cube(double, double, double, int);
int /*<<< orphan*/ diff();
int /*<<< orphan*/ enddiff();
int /*<<< orphan*/ endxlate();
int /*<<< orphan*/ xlate(int /*<<< orphan*/, int /*<<< orphan*/, double);
void crenelated_rectangle(double width, double length, double height,
                          double crenheight, double wall_thickness) {
  double spacing = wall_thickness * 2;
  diff();
  xlate(0, 0, height / 2.0);
  diff();
  cube(width, length, height, 1);
  cube(width - 2 * wall_thickness, length - 2 * wall_thickness,
       height + wall_thickness, 1);
  enddiff();
  endxlate();
  xlate(0, 0, height - crenheight * 0.95);
  crenelation_matrix(length, width, crenheight, wall_thickness);
  endxlate();
  enddiff();
}


x86 assembly (clang, -O0):
<crenelated_rectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  0xe7f(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   1080 <diff@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe61(%rip),%xmm1
divsd  %xmm1,%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1030 <xlate@plt>
mov    $0x0,%al
call   1080 <diff@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mov    $0x1,%edi
call   1070 <cube@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm2
addsd  -0x28(%rbp),%xmm2
mov    $0x1,%edi
call   1070 <cube@plt>
mov    $0x0,%al
call   1040 <enddiff@plt>
mov    $0x0,%al
call   1060 <endxlate@plt>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdbd(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1030 <xlate@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
call   1050 <crenelation_matrix@plt>
mov    $0x0,%al
call   1060 <endxlate@plt>
mov    $0x0,%al
call   1040 <enddiff@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crenelated_rectangle>:
sub    $0x28,%rsp
movsd  %xmm4,0x18(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1080 <diff@plt>
movsd  0xe70(%rip),%xmm0
mulsd  (%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1030 <xlate@plt>
xor    %eax,%eax
call   1080 <diff@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
call   1070 <cube@plt>
movsd  0xe40(%rip),%xmm1
movsd  0x18(%rsp),%xmm3
mulsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
addsd  %xmm3,%xmm2
mov    $0x1,%edi
call   1070 <cube@plt>
xor    %eax,%eax
call   1040 <enddiff@plt>
xor    %eax,%eax
call   1060 <endxlate@plt>
movsd  0xe05(%rip),%xmm0
mulsd  0x20(%rsp),%xmm0
addsd  (%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1030 <xlate@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
call   1050 <crenelation_matrix@plt>
xor    %eax,%eax
call   1060 <endxlate@plt>
xor    %eax,%eax
add    $0x28,%rsp
jmp    1040 <enddiff@plt>

LLVM IR (-O0):
define void @crenelated_rectangle(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%12 = load double, double* %10
%13 = fmul double %12, 2.000000e+00
store double %13, double* %11
%14 = call i32 (...) @diff()
%15 = load double, double* %8
%16 = fdiv double %15, 2.000000e+00
%17 = call i32 @xlate(i32 0, i32 0, double %16)
%18 = call i32 (...) @diff()
%19 = load double, double* %6
%20 = load double, double* %7
%21 = load double, double* %8
%22 = call i32 @cube(double %19, double %20, double %21, i32 1)
%23 = load double, double* %6
%24 = load double, double* %10
%25 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %24, double %23)
%26 = load double, double* %7
%27 = load double, double* %10
%28 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %27, double %26)
%29 = load double, double* %8
%30 = load double, double* %10
%31 = fadd double %29, %30
%32 = call i32 @cube(double %25, double %28, double %31, i32 1)
%33 = call i32 (...) @enddiff()
%34 = call i32 (...) @endxlate()
%35 = load double, double* %8
%36 = load double, double* %9
%37 = fneg double %36
%38 = call double @llvm.fmuladd.f64(double %37, double 0x3FEE666666666666, double %35)
%39 = call i32 @xlate(i32 0, i32 0, double %38)
%40 = load double, double* %7
%41 = load double, double* %6
%42 = load double, double* %9
%43 = load double, double* %10
%44 = call i32 @crenelation_matrix(double %40, double %41, double %42, double %43)
%45 = call i32 (...) @endxlate()
%46 = call i32 (...) @enddiff()
ret void
}

LLVM IR (-O2):
define void @crenelated_rectangle(double %0, double %1, double %2, double %3, double %4) {
%6 = tail call i32 (...) @diff()
%7 = fmul double %2, 5.000000e-01
%8 = tail call i32 @xlate(i32 0, i32 0, double %7)
%9 = tail call i32 (...) @diff()
%10 = tail call i32 @cube(double %0, double %1, double %2, i32 1)
%11 = tail call double @llvm.fmuladd.f64(double %4, double -2.000000e+00, double %0)
%12 = tail call double @llvm.fmuladd.f64(double %4, double -2.000000e+00, double %1)
%13 = fadd double %2, %4
%14 = tail call i32 @cube(double %11, double %12, double %13, i32 1)
%15 = tail call i32 (...) @enddiff()
%16 = tail call i32 (...) @endxlate()
%17 = fneg double %3
%18 = tail call double @llvm.fmuladd.f64(double %17, double 0x3FEE666666666666, double %2)
%19 = tail call i32 @xlate(i32 0, i32 0, double %18)
%20 = tail call i32 @crenelation_matrix(double %1, double %0, double %3, double %4)
%21 = tail call i32 (...) @endxlate()
%22 = tail call i32 (...) @enddiff()
ret void
}