#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 floor(int /*<<< orphan*/);
int /*<<< orphan*/ log10(double);
double pow(int, double);
double normalised_notation_split(double number, double *m) {
  int neg = 0;
  double vexp, vm;
  if (number < 0.) {
    neg = 1;
    number = -number;
  }
  vexp = floor(log10(number));
  vm = number * pow(10., -vexp);
  if (neg)
    vm = -vm;
  if (m)
    *m = vm;
  return vexp;
}


x86 assembly (clang, -O0):
<normalised_notation_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    117e <normalised_notation_split+0x4e>
movl   $0x1,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <log10@plt>
mov    %eax,%edi
call   1050 <floor@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1200 <normalised_notation_split+0xd0>
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1218 <normalised_notation_split+0xe8>
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalised_notation_split>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
cmpltsd %xmm1,%xmm2
movapd %xmm2,%xmm1
andnpd %xmm0,%xmm1
xorpd  0xeab(%rip),%xmm0
movapd %xmm2,0x10(%rsp)
andpd  %xmm2,%xmm0
orpd   %xmm0,%xmm1
movapd %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1040 <log10@plt>
mov    %eax,%edi
call   1050 <floor@plt>
movapd %xmm0,0x20(%rsp)
xorpd  0xe7a(%rip),%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
test   %rbx,%rbx
je     11c0 <normalised_notation_split+0x90>
movapd (%rsp),%xmm2
mulsd  %xmm0,%xmm2
movapd 0xe5a(%rip),%xmm0
xorpd  %xmm2,%xmm0
movapd 0x10(%rsp),%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm0,%xmm1
movlpd %xmm1,(%rbx)
movaps 0x20(%rsp),%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @normalised_notation_split(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store double* %1, double** %4
store i32 0, i32* %5
%8 = load double, double* %3
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %10, label %13
10: ; preds = %2
store i32 1, i32* %5
%11 = load double, double* %3
%12 = fneg double %11
store double %12, double* %3
br label %13
13: ; preds = %10, %2
%14 = load double, double* %3
%15 = call i32 @log10(double %14)
%16 = call double @floor(i32 %15)
store double %16, double* %6
%17 = load double, double* %3
%18 = load double, double* %6
%19 = fneg double %18
%20 = call double @pow(i32 10, double %19)
%21 = fmul double %17, %20
store double %21, double* %7
%22 = load i32, i32* %5
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %13
%25 = load double, double* %7
%26 = fneg double %25
store double %26, double* %7
br label %27
27: ; preds = %24, %13
%28 = load double*, double** %4
%29 = icmp ne double* %28, null
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load double, double* %7
%32 = load double*, double** %4
store double %31, double* %32
br label %33
33: ; preds = %30, %27
%34 = load double, double* %6
ret double %34
}

LLVM IR (-O2):
define double @normalised_notation_split(double %0, double* writeonly %1) {
%3 = fcmp olt double %0, 0.000000e+00
%4 = fneg double %0
%5 = select i1 %3, double %4, double %0
%6 = tail call i32 @log10(double %5)
%7 = tail call double @floor(i32 %6)
%8 = fneg double %7
%9 = tail call double @pow(i32 10, double %8)
%10 = fmul double %5, %9
%11 = icmp eq double* %1, null
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = fneg double %10
%14 = select i1 %3, double %13, double %10
store double %14, double* %1
br label %15
15: ; preds = %12, %2
ret double %7
}