#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*/ memmove(char *, char *, int);
double modf(double, double *);
int sprintf(char *, char *, long long, ...);
void fb_hGetNumberParts(double number, char *pachFixPart, int *pcchLenFix,
                        char *pachFracPart, int *pcchLenFrac, char *pchSign,
                        char chDecimalPoint, int precision) {
  char *pszFracStart, *pszFracEnd;
  char chSign;
  double dblFix;
  double dblFrac = modf(number, &dblFix);
  long long llFix = (long long)dblFix;
  int len_fix, len_frac;
  if (dblFrac < 0.0)
    dblFrac = -dblFrac;
  len_frac = sprintf(pachFracPart, "%.*f", precision, dblFrac);
  pszFracStart = pachFracPart;
  if (*pszFracStart == '-')
    ++pszFracStart;
  ++pszFracStart;
  pszFracEnd = pachFracPart + len_frac;
  while (pszFracEnd != pszFracStart) {
    --pszFracEnd;
    if (*pszFracEnd != '0') {
      if (*pszFracEnd != chDecimalPoint) {
        ++pszFracStart;
        ++pszFracEnd;
      }
      break;
    }
  }
  len_frac = pszFracEnd - pszFracStart;
  memmove(pachFracPart, pszFracStart, len_frac);
  pachFracPart[len_frac] = 0;
  if (llFix == 0 && number < 0.0) {
    pachFixPart[0] = 0;
    len_fix = 0;
    chSign = '-';
  } else if (llFix == 0 && number > 0.0) {
    pachFixPart[0] = 0;
    len_fix = 0;
    chSign = '+';
  } else {
    if (llFix < 0) {
      chSign = '-';
      llFix = -llFix;
    } else if (llFix > 0) {
      chSign = '+';
    } else {
      chSign = 0;
    }
    len_fix = sprintf(pachFixPart,
                      "%"
                      "ll"
                      "d",
                      llFix);
  }
  if (pcchLenFix != 0)
    *pcchLenFix = len_fix;
  if (pcchLenFrac != 0)
    *pcchLenFrac = len_frac;
  if (pchSign != 0)
    *pchSign = chSign;
}


x86 assembly (clang, -O0):
<fb_hGetNumberParts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %r9b,%al
mov    0x10(%rbp),%r9d
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %al,-0x31(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x58(%rbp),%rdi
call   1030 <modf@plt>
movsd  %xmm0,-0x60(%rbp)
cvttsd2si -0x58(%rbp),%rax
mov    %rax,-0x68(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    11a7 <fb_hGetNumberParts+0x77>
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rdi
movslq 0x10(%rbp),%rdx
movsd  -0x60(%rbp),%xmm0
lea    0xe45(%rip),%rsi
mov    $0x1,%al
call   1050 <sprintf@plt>
mov    %eax,-0x70(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11e9 <fb_hGetNumberParts+0xb9>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x70(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     1263 <fb_hGetNumberParts+0x133>
mov    -0x48(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
je     125e <fb_hGetNumberParts+0x12e>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x31(%rbp),%ecx
cmp    %ecx,%eax
je     1259 <fb_hGetNumberParts+0x129>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1263 <fb_hGetNumberParts+0x133>
jmp    1204 <fb_hGetNumberParts+0xd4>
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x70(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x70(%rbp),%edx
call   1040 <memmove@plt>
mov    -0x20(%rbp),%rax
movslq -0x70(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x68(%rbp)
jne    12bd <fb_hGetNumberParts+0x18d>
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    12bd <fb_hGetNumberParts+0x18d>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x6c(%rbp)
movb   $0x2d,-0x49(%rbp)
jmp    134a <fb_hGetNumberParts+0x21a>
cmpq   $0x0,-0x68(%rbp)
jne    12f1 <fb_hGetNumberParts+0x1c1>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12f1 <fb_hGetNumberParts+0x1c1>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x6c(%rbp)
movb   $0x2b,-0x49(%rbp)
jmp    1345 <fb_hGetNumberParts+0x215>
cmpq   $0x0,-0x68(%rbp)
jge    130f <fb_hGetNumberParts+0x1df>
movb   $0x2d,-0x49(%rbp)
xor    %eax,%eax
sub    -0x68(%rbp),%rax
mov    %rax,-0x68(%rbp)
jmp    132c <fb_hGetNumberParts+0x1fc>
cmpq   $0x0,-0x68(%rbp)
jle    1323 <fb_hGetNumberParts+0x1f3>
movb   $0x2b,-0x49(%rbp)
jmp    1327 <fb_hGetNumberParts+0x1f7>
movb   $0x0,-0x49(%rbp)
jmp    132c <fb_hGetNumberParts+0x1fc>
mov    -0x10(%rbp),%rdi
mov    -0x68(%rbp),%rdx
lea    0xcca(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    %eax,-0x6c(%rbp)
jmp    134a <fb_hGetNumberParts+0x21a>
cmpq   $0x0,-0x18(%rbp)
je     135e <fb_hGetNumberParts+0x22e>
mov    -0x6c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     1372 <fb_hGetNumberParts+0x242>
mov    -0x70(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     1386 <fb_hGetNumberParts+0x256>
mov    -0x49(%rbp),%cl
mov    -0x30(%rbp),%rax
mov    %cl,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_hGetNumberParts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9d,%r12d
mov    %r8,0x10(%rsp)
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %rsi,%r13
mov    %rdi,0x8(%rsp)
movslq 0x60(%rsp),%rbp
lea    0x20(%rsp),%rdi
movsd  %xmm0,0x18(%rsp)
call   1030 <modf@plt>
cvttsd2si 0x20(%rsp),%r14
movapd 0xe88(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
lea    0xe74(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1050 <sprintf@plt>
xor    %edx,%edx
cmpb   $0x2d,(%rbx)
sete   %dl
lea    (%rbx,%rdx,1),%rdi
lea    (%rbx,%rdx,1),%rsi
add    $0x1,%rsi
movslq %eax,%rcx
lea    (%rbx,%rcx,1),%rax
sub    %rcx,%rdx
add    $0x1,%rdx
nop
test   %rdx,%rdx
je     11fb <fb_hGetNumberParts+0xcb>
movzbl -0x1(%rax),%ecx
add    $0xffffffffffffffff,%rax
add    $0x1,%rdx
cmp    $0x30,%cl
je     11d0 <fb_hGetNumberParts+0xa0>
add    $0x2,%rdi
lea    0x1(%rax),%rbp
cmp    %r12b,%cl
cmovne %rdi,%rsi
cmove  %rax,%rbp
jmp    11fe <fb_hGetNumberParts+0xce>
mov    %rsi,%rbp
sub    %rsi,%rbp
mov    %rbx,%rdi
mov    %ebp,%edx
call   1040 <memmove@plt>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
xorpd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1235 <fb_hGetNumberParts+0x105>
test   %r14,%r14
jne    1235 <fb_hGetNumberParts+0x105>
mov    0x8(%rsp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
mov    $0x2d,%bl
jmp    1280 <fb_hGetNumberParts+0x150>
ucomisd %xmm0,%xmm1
jbe    124e <fb_hGetNumberParts+0x11e>
test   %r14,%r14
jne    124e <fb_hGetNumberParts+0x11e>
mov    0x8(%rsp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
mov    $0x2b,%bl
jmp    1280 <fb_hGetNumberParts+0x150>
xor    %eax,%eax
test   %r14,%r14
mov    $0x2b,%ecx
cmove  %eax,%ecx
mov    $0x2d,%ebx
cmovns %ecx,%ebx
mov    %r14,%rdx
neg    %rdx
cmovs  %r14,%rdx
lea    0xda1(%rip),%rsi
mov    0x8(%rsp),%rdi
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    0x10(%rsp),%rcx
test   %r13,%r13
je     128e <fb_hGetNumberParts+0x15e>
mov    %eax,0x0(%r13)
test   %r15,%r15
je     1296 <fb_hGetNumberParts+0x166>
mov    %ebp,(%r15)
test   %rcx,%rcx
je     129d <fb_hGetNumberParts+0x16d>
mov    %bl,(%rcx)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.*f\00"
@.str.1 = [5 x i8] c"%lld\00"
define void @fb_hGetNumberParts(double %0, i8* %1, i32* %2, i8* %3, i32* %4, i8* %5, i8 signext %6, i32 %7) {
%9 = alloca double
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i8*
%15 = alloca i8
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8
%20 = alloca double
%21 = alloca double
%22 = alloca i64
%23 = alloca i32
%24 = alloca i32
store double %0, double* %9
store i8* %1, i8** %10
store i32* %2, i32** %11
store i8* %3, i8** %12
store i32* %4, i32** %13
store i8* %5, i8** %14
store i8 %6, i8* %15
store i32 %7, i32* %16
%25 = load double, double* %9
%26 = call double @modf(double %25, double* %20)
store double %26, double* %21
%27 = load double, double* %20
%28 = fptosi double %27 to i64
store i64 %28, i64* %22
%29 = load double, double* %21
%30 = fcmp olt double %29, 0.000000e+00
br i1 %30, label %31, label %34
31: ; preds = %8
%32 = load double, double* %21
%33 = fneg double %32
store double %33, double* %21
br label %34
34: ; preds = %31, %8
%35 = load i8*, i8** %12
%36 = load i32, i32* %16
%37 = sext i32 %36 to i64
%38 = load double, double* %21
%39 = call i32 (i8*, i8*, i64, ...) @sprintf(i8* %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %37, double %38)
store i32 %39, i32* %24
%40 = load i8*, i8** %12
store i8* %40, i8** %17
%41 = load i8*, i8** %17
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 45
br i1 %44, label %45, label %48
45: ; preds = %34
%46 = load i8*, i8** %17
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %17
br label %48
48: ; preds = %45, %34
%49 = load i8*, i8** %17
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %17
%51 = load i8*, i8** %12
%52 = load i32, i32* %24
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
store i8* %54, i8** %18
br label %55
55: ; preds = %79, %48
%56 = load i8*, i8** %18
%57 = load i8*, i8** %17
%58 = icmp ne i8* %56, %57
br i1 %58, label %59, label %80
59: ; preds = %55
%60 = load i8*, i8** %18
%61 = getelementptr inbounds i8, i8* %60, i32 -1
store i8* %61, i8** %18
%62 = load i8*, i8** %18
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp ne i32 %64, 48
br i1 %65, label %66, label %79
66: ; preds = %59
%67 = load i8*, i8** %18
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = load i8, i8* %15
%71 = sext i8 %70 to i32
%72 = icmp ne i32 %69, %71
br i1 %72, label %73, label %78
73: ; preds = %66
%74 = load i8*, i8** %17
%75 = getelementptr inbounds i8, i8* %74, i32 1
store i8* %75, i8** %17
%76 = load i8*, i8** %18
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %18
br label %78
78: ; preds = %73, %66
br label %80
79: ; preds = %59
br label %55
80: ; preds = %78, %55
%81 = load i8*, i8** %18
%82 = load i8*, i8** %17
%83 = ptrtoint i8* %81 to i64
%84 = ptrtoint i8* %82 to i64
%85 = sub i64 %83, %84
%86 = trunc i64 %85 to i32
store i32 %86, i32* %24
%87 = load i8*, i8** %12
%88 = load i8*, i8** %17
%89 = load i32, i32* %24
%90 = call i32 @memmove(i8* %87, i8* %88, i32 %89)
%91 = load i8*, i8** %12
%92 = load i32, i32* %24
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %91, i64 %93
store i8 0, i8* %94
%95 = load i64, i64* %22
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %103
97: ; preds = %80
%98 = load double, double* %9
%99 = fcmp olt double %98, 0.000000e+00
br i1 %99, label %100, label %103
100: ; preds = %97
%101 = load i8*, i8** %10
%102 = getelementptr inbounds i8, i8* %101, i64 0
store i8 0, i8* %102
store i32 0, i32* %23
store i8 45, i8* %19
br label %129
103: ; preds = %97, %80
%104 = load i64, i64* %22
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %112
106: ; preds = %103
%107 = load double, double* %9
%108 = fcmp ogt double %107, 0.000000e+00
br i1 %108, label %109, label %112
109: ; preds = %106
%110 = load i8*, i8** %10
%111 = getelementptr inbounds i8, i8* %110, i64 0
store i8 0, i8* %111
store i32 0, i32* %23
store i8 43, i8* %19
br label %128
112: ; preds = %106, %103
%113 = load i64, i64* %22
%114 = icmp slt i64 %113, 0
br i1 %114, label %115, label %118
115: ; preds = %112
store i8 45, i8* %19
%116 = load i64, i64* %22
%117 = sub nsw i64 0, %116
store i64 %117, i64* %22
br label %124
118: ; preds = %112
%119 = load i64, i64* %22
%120 = icmp sgt i64 %119, 0
br i1 %120, label %121, label %122
121: ; preds = %118
store i8 43, i8* %19
br label %123
122: ; preds = %118
store i8 0, i8* %19
br label %123
123: ; preds = %122, %121
br label %124
124: ; preds = %123, %115
%125 = load i8*, i8** %10
%126 = load i64, i64* %22
%127 = call i32 (i8*, i8*, i64, ...) @sprintf(i8* %125, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %126)
store i32 %127, i32* %23
br label %128
128: ; preds = %124, %109
br label %129
129: ; preds = %128, %100
%130 = load i32*, i32** %11
%131 = icmp ne i32* %130, null
br i1 %131, label %132, label %135
132: ; preds = %129
%133 = load i32, i32* %23
%134 = load i32*, i32** %11
store i32 %133, i32* %134
br label %135
135: ; preds = %132, %129
%136 = load i32*, i32** %13
%137 = icmp ne i32* %136, null
br i1 %137, label %138, label %141
138: ; preds = %135
%139 = load i32, i32* %24
%140 = load i32*, i32** %13
store i32 %139, i32* %140
br label %141
141: ; preds = %138, %135
%142 = load i8*, i8** %14
%143 = icmp ne i8* %142, null
br i1 %143, label %144, label %147
144: ; preds = %141
%145 = load i8, i8* %19
%146 = load i8*, i8** %14
store i8 %145, i8* %146
br label %147
147: ; preds = %144, %141
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.*f\00"
@.str.1 = [5 x i8] c"%lld\00"
define void @fb_hGetNumberParts(double %0, i8* nocapture writeonly %1, i32* writeonly %2, i8* %3, i32* writeonly %4, i8* writeonly %5, i8 signext %6, i32 %7) {
%9 = alloca double
%10 = bitcast double* %9 to i8*
%11 = call double @modf(double %0, double* %9)
%12 = load double, double* %9
%13 = fptosi double %12 to i64
%14 = fcmp olt double %11, 0.000000e+00
%15 = fneg double %11
%16 = select i1 %14, double %15, double %11
%17 = sext i32 %7 to i64
%18 = tail call i32 (i8*, i8*, i64, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %17, double %16)
%19 = load i8, i8* %3
%20 = icmp eq i8 %19, 45
%21 = zext i1 %20 to i64
%22 = getelementptr i8, i8* %3, i64 %21
%23 = getelementptr i8, i8* %22, i64 1
%24 = sext i32 %18 to i64
%25 = getelementptr inbounds i8, i8* %3, i64 %24
br label %26
26: ; preds = %29, %8
%27 = phi i8* [ %25, %8 ], [ %30, %29 ]
%28 = icmp eq i8* %27, %23
br i1 %28, label %38, label %29
29: ; preds = %26
%30 = getelementptr inbounds i8, i8* %27, i64 -1
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 48
br i1 %32, label %26, label %33
33: ; preds = %29
%34 = icmp eq i8 %31, %6
%35 = getelementptr inbounds i8, i8* %22, i64 2
%36 = select i1 %34, i8* %23, i8* %35
%37 = select i1 %34, i8* %30, i8* %27
br label %38
38: ; preds = %26, %33
%39 = phi i8* [ %36, %33 ], [ %23, %26 ]
%40 = phi i8* [ %37, %33 ], [ %23, %26 ]
%41 = ptrtoint i8* %40 to i64
%42 = ptrtoint i8* %39 to i64
%43 = sub i64 %41, %42
%44 = trunc i64 %43 to i32
%45 = tail call i32 @memmove(i8* %3, i8* %39, i32 %44)
%46 = shl i64 %43, 32
%47 = ashr exact i64 %46, 32
%48 = getelementptr inbounds i8, i8* %3, i64 %47
store i8 0, i8* %48
%49 = icmp eq i64 %13, 0
%50 = fcmp olt double %0, 0.000000e+00
%51 = and i1 %50, %49
br i1 %51, label %52, label %53
52: ; preds = %38
store i8 0, i8* %1
br label %64
53: ; preds = %38
%54 = fcmp ogt double %0, 0.000000e+00
%55 = and i1 %54, %49
br i1 %55, label %56, label %57
56: ; preds = %53
store i8 0, i8* %1
br label %64
57: ; preds = %53
%58 = icmp slt i64 %13, 0
%59 = sub nsw i64 0, %13
%60 = select i1 %49, i8 0, i8 43
%61 = select i1 %58, i8 45, i8 %60
%62 = select i1 %58, i64 %59, i64 %13
%63 = tail call i32 (i8*, i8*, i64, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %62)
br label %64
64: ; preds = %56, %57, %52
%65 = phi i8 [ 45, %52 ], [ 43, %56 ], [ %61, %57 ]
%66 = phi i32 [ 0, %52 ], [ 0, %56 ], [ %63, %57 ]
%67 = icmp eq i32* %2, null
br i1 %67, label %69, label %68
68: ; preds = %64
store i32 %66, i32* %2
br label %69
69: ; preds = %68, %64
%70 = icmp eq i32* %4, null
br i1 %70, label %72, label %71
71: ; preds = %69
store i32 %44, i32* %4
br label %72
72: ; preds = %71, %69
%73 = icmp eq i8* %5, null
br i1 %73, label %75, label %74
74: ; preds = %72
store i8 %65, i8* %5
br label %75
75: ; preds = %74, %72
ret void
}