#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*/ call_module(char *);
int /*<<< orphan*/ cube(float, float, float, int /*<<< orphan*/);
int /*<<< orphan*/ end();
int /*<<< orphan*/ end_module();
int /*<<< orphan*/ intersection();
int /*<<< orphan*/ module(char *);
int /*<<< orphan*/ xlate(int /*<<< orphan*/, float, float);
void cut_in_half(char *newmodule, char *module_to_cut_in_half, float size) {
  module(newmodule);
  intersection();
  xlate(0, -size / 2.0, -size / 2.0);
  cube(size, size, size, 0);
  end();
  call_module(module_to_cut_in_half);
  end();
  end_module();
}


x86 assembly (clang, -O0):
<cut_in_half>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <module@plt>
mov    $0x0,%al
call   1070 <intersection@plt>
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4d(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe27(%rip),%xmm2
divsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
xor    %edi,%edi
call   1030 <xlate@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
xor    %edi,%edi
call   1090 <cube@plt>
mov    $0x0,%al
call   1050 <end@plt>
mov    -0x10(%rbp),%rdi
call   1040 <call_module@plt>
mov    $0x0,%al
call   1050 <end@plt>
mov    $0x0,%al
call   1060 <end_module@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cut_in_half>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
mov    %rsi,%rbx
call   1080 <module@plt>
xor    %eax,%eax
call   1070 <intersection@plt>
movss  0xe6e(%rip),%xmm0
mulss  0xc(%rsp),%xmm0
xor    %edi,%edi
movaps %xmm0,%xmm1
call   1030 <xlate@plt>
movss  0xc(%rsp),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
xor    %edi,%edi
call   1090 <cube@plt>
xor    %eax,%eax
call   1050 <end@plt>
mov    %rbx,%rdi
call   1040 <call_module@plt>
xor    %eax,%eax
call   1050 <end@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1060 <end_module@plt>

LLVM IR (-O0):
define void @cut_in_half(i8* %0, i8* %1, float %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float
store i8* %0, i8** %4
store i8* %1, i8** %5
store float %2, float* %6
%7 = load i8*, i8** %4
%8 = call i32 @module(i8* %7)
%9 = call i32 (...) @intersection()
%10 = load float, float* %6
%11 = fneg float %10
%12 = fpext float %11 to double
%13 = fdiv double %12, 2.000000e+00
%14 = fptrunc double %13 to float
%15 = load float, float* %6
%16 = fneg float %15
%17 = fpext float %16 to double
%18 = fdiv double %17, 2.000000e+00
%19 = fptrunc double %18 to float
%20 = call i32 @xlate(i32 0, float %14, float %19)
%21 = load float, float* %6
%22 = load float, float* %6
%23 = load float, float* %6
%24 = call i32 @cube(float %21, float %22, float %23, i32 0)
%25 = call i32 (...) @end()
%26 = load i8*, i8** %5
%27 = call i32 @call_module(i8* %26)
%28 = call i32 (...) @end()
%29 = call i32 (...) @end_module()
ret void
}

LLVM IR (-O2):
define void @cut_in_half(i8* %0, i8* %1, float %2) {
%4 = tail call i32 @module(i8* %0)
%5 = tail call i32 (...) @intersection()
%6 = fmul float %2, -5.000000e-01
%7 = tail call i32 @xlate(i32 0, float %6, float %6)
%8 = tail call i32 @cube(float %2, float %2, float %2, i32 0)
%9 = tail call i32 (...) @end()
%10 = tail call i32 @call_module(i8* %1)
%11 = tail call i32 (...) @end()
%12 = tail call i32 (...) @end_module()
ret void
}