#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(double, double, double, int);
int /*<<< orphan*/ diff();
int /*<<< orphan*/ enddiff();
int /*<<< orphan*/ endrotate();
int /*<<< orphan*/ endscale();
int /*<<< orphan*/ endxlate();
int /*<<< orphan*/ rotate(int, int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ scale(double, double, double);
double sqrt(double);
int /*<<< orphan*/ xlate(int /*<<< orphan*/, int /*<<< orphan*/, double);
void gabled_roof(double length, double width, double height) {
  double side;
  side = (height * 2.0) / sqrt(2.0);
  scale(width / (height * 2.0), 1.0, 1.0);
  diff();
  rotate(45, 0, 1, 0);
  cube(side, length, side, 1);
  endrotate();
  xlate(0, 0, -side);
  cube(side * 2, length * 2, side * 2, 1);
  endxlate();
  enddiff();
  endscale();
}


x86 assembly (clang, -O0):
<gabled_roof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xe41(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe2f(%rip),%xmm0
call   10a0 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe0c(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe03(%rip),%xmm2
movaps %xmm2,%xmm1
call   1090 <scale@plt>
mov    $0x0,%al
call   10c0 <diff@plt>
mov    $0x2d,%edi
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
call   1060 <rotate@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mov    $0x1,%edi
call   10b0 <cube@plt>
mov    $0x0,%al
call   1070 <endrotate@plt>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1030 <xlate@plt>
movsd  0xd8c(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xd7f(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xd72(%rip),%xmm2
mulsd  -0x20(%rbp),%xmm2
mov    $0x1,%edi
call   10b0 <cube@plt>
mov    $0x0,%al
call   1080 <endxlate@plt>
mov    $0x0,%al
call   1040 <enddiff@plt>
mov    $0x0,%al
call   1050 <endscale@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gabled_roof>:
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
addsd  %xmm2,%xmm2
divsd  %xmm2,%xmm1
divsd  0xe56(%rip),%xmm2
movapd %xmm2,0x10(%rsp)
movsd  0xe50(%rip),%xmm2
movapd %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1090 <scale@plt>
xor    %eax,%eax
call   10b0 <diff@plt>
mov    $0x2d,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1060 <rotate@plt>
movaps 0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movaps %xmm0,%xmm2
mov    $0x1,%edi
call   10a0 <cube@plt>
xor    %eax,%eax
call   1070 <endrotate@plt>
movaps 0xe0c(%rip),%xmm0
xorps  0x10(%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1030 <xlate@plt>
movapd 0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
movapd %xmm0,%xmm2
mov    $0x1,%edi
call   10a0 <cube@plt>
xor    %eax,%eax
call   1080 <endxlate@plt>
xor    %eax,%eax
call   1040 <enddiff@plt>
xor    %eax,%eax
add    $0x28,%rsp
jmp    1050 <endscale@plt>

LLVM IR (-O0):
define void @gabled_roof(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %6
%9 = fmul double %8, 2.000000e+00
%10 = call double @sqrt(double 2.000000e+00)
%11 = fdiv double %9, %10
store double %11, double* %7
%12 = load double, double* %5
%13 = load double, double* %6
%14 = fmul double %13, 2.000000e+00
%15 = fdiv double %12, %14
%16 = call i32 @scale(double %15, double 1.000000e+00, double 1.000000e+00)
%17 = call i32 (...) @diff()
%18 = call i32 @rotate(i32 45, i32 0, i32 1, i32 0)
%19 = load double, double* %7
%20 = load double, double* %4
%21 = load double, double* %7
%22 = call i32 @cube(double %19, double %20, double %21, i32 1)
%23 = call i32 (...) @endrotate()
%24 = load double, double* %7
%25 = fneg double %24
%26 = call i32 @xlate(i32 0, i32 0, double %25)
%27 = load double, double* %7
%28 = fmul double %27, 2.000000e+00
%29 = load double, double* %4
%30 = fmul double %29, 2.000000e+00
%31 = load double, double* %7
%32 = fmul double %31, 2.000000e+00
%33 = call i32 @cube(double %28, double %30, double %32, i32 1)
%34 = call i32 (...) @endxlate()
%35 = call i32 (...) @enddiff()
%36 = call i32 (...) @endscale()
ret void
}

LLVM IR (-O2):
define void @gabled_roof(double %0, double %1, double %2) {
%4 = fmul double %2, 2.000000e+00
%5 = fdiv double %4, 0x3FF6A09E667F3BCD
%6 = fdiv double %1, %4
%7 = tail call i32 @scale(double %6, double 1.000000e+00, double 1.000000e+00)
%8 = tail call i32 (...) @diff()
%9 = tail call i32 @rotate(i32 45, i32 0, i32 1, i32 0)
%10 = tail call i32 @cube(double %5, double %0, double %5, i32 1)
%11 = tail call i32 (...) @endrotate()
%12 = fneg double %5
%13 = tail call i32 @xlate(i32 0, i32 0, double %12)
%14 = fmul double %5, 2.000000e+00
%15 = fmul double %0, 2.000000e+00
%16 = tail call i32 @cube(double %14, double %15, double %14, i32 1)
%17 = tail call i32 (...) @endxlate()
%18 = tail call i32 (...) @enddiff()
%19 = tail call i32 (...) @endscale()
ret void
}