#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 */
double fabs(double);
int floor(double);
void separate(double num, char *signp, int *wholep, double *fracp) {
  double magnitude;
  if (num < 0) {
    *signp = '-';
  } else if (num > 0) {
    *signp = '+';
  } else {
    *signp = ' ';
  }
  magnitude = fabs(num);
  *wholep = floor(magnitude);
  *fracp = magnitude - *wholep;
}


x86 assembly (clang, -O0):
<separate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1143 <separate+0x33>
mov    -0x10(%rbp),%rax
movb   $0x2d,(%rax)
jmp    116d <separate+0x5d>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1161 <separate+0x51>
mov    -0x10(%rbp),%rax
movb   $0x2b,(%rax)
jmp    1168 <separate+0x58>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
jmp    116d <separate+0x5d>
movsd  -0x8(%rbp),%xmm0
movaps 0xe87(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <floor@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
subsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<separate>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    $0x2b,%eax
mov    $0x20,%ecx
cmova  %eax,%ecx
ucomisd %xmm0,%xmm1
mov    $0x2d,%eax
cmovbe %ecx,%eax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %al,(%rdi)
andpd  0xeb8(%rip),%xmm0
movapd %xmm0,(%rsp)
call   1030 <floor@plt>
mov    %eax,(%rbx)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @separate(double %0, i8* %1, i32* %2, double* %3) {
%5 = alloca double
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca double*
%9 = alloca double
store double %0, double* %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store double* %3, double** %8
%10 = load double, double* %5
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load i8*, i8** %6
store i8 45, i8* %13
br label %22
14: ; preds = %4
%15 = load double, double* %5
%16 = fcmp ogt double %15, 0.000000e+00
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = load i8*, i8** %6
store i8 43, i8* %18
br label %21
19: ; preds = %14
%20 = load i8*, i8** %6
store i8 32, i8* %20
br label %21
21: ; preds = %19, %17
br label %22
22: ; preds = %21, %12
%23 = load double, double* %5
%24 = call double @llvm.fabs.f64(double %23)
store double %24, double* %9
%25 = load double, double* %9
%26 = call i32 @floor(double %25)
%27 = load i32*, i32** %7
store i32 %26, i32* %27
%28 = load double, double* %9
%29 = load i32*, i32** %7
%30 = load i32, i32* %29
%31 = sitofp i32 %30 to double
%32 = fsub double %28, %31
%33 = load double*, double** %8
store double %32, double* %33
ret void
}

LLVM IR (-O2):
define void @separate(double %0, i8* nocapture writeonly %1, i32* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = fcmp olt double %0, 0.000000e+00
%6 = fcmp ogt double %0, 0.000000e+00
%7 = select i1 %6, i8 43, i8 32
%8 = select i1 %5, i8 45, i8 %7
store i8 %8, i8* %1
%9 = tail call double @llvm.fabs.f64(double %0)
%10 = tail call i32 @floor(double %9)
store i32 %10, i32* %2
%11 = sitofp i32 %10 to double
%12 = fsub double %9, %11
store double %12, double* %3
ret void
}