#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ uart0SendString(unsigned char *);
void printNf(float number) {
  static unsigned char noDigits = 2;
  static unsigned char noDecDigits = 4;
  unsigned char *pBuf;
  unsigned char buf[32];
  float numberAbs;
  unsigned int i, j, div, intNumberAbs;
  if (number < 0)
    numberAbs = -number;
  else
    numberAbs = number;
  pBuf = buf + sizeof(buf);
  *--pBuf = '\0';
  for (i = noDecDigits; i > 0; i--) {
    div = 1;
    for (j = 1; j < i + 1; j++)
      div *= 10;
    intNumberAbs = (int)(numberAbs * div);
    *--pBuf = (int)(intNumberAbs % 10) + '0';
  }
  *--pBuf = '.';
  intNumberAbs = (int)numberAbs;
  for (i = noDigits; i > 0; i--) {
    if (intNumberAbs != 0) {
      *--pBuf = (int)(intNumberAbs % 10) + '0';
      intNumberAbs /= 10;
    } else
      *--pBuf = '0';
  }
  if (number < 0)
    *--pBuf = '-';
  else
    *--pBuf = '0';
  uart0SendString(pBuf);
}


x86 assembly (clang, -O0):
<printNf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1146 <printNf+0x36>
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    1150 <printNf+0x40>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
lea    -0x30(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,-0x1(%rax)
movzbl 0x2eb3(%rip),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jbe    1200 <printNf+0xf0>
movl   $0x1,-0x40(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    11b7 <printNf+0xa7>
imul   $0xa,-0x40(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1191 <printNf+0x81>
movss  -0x34(%rbp),%xmm0
mov    -0x40(%rbp),%eax
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    1179 <printNf+0x69>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2e,-0x1(%rax)
cvttss2si -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
movzbl 0x2e06(%rip),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jbe    1296 <printNf+0x186>
cmpl   $0x0,-0x44(%rbp)
je     1270 <printNf+0x160>
mov    -0x44(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x44(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x44(%rbp)
jmp    1283 <printNf+0x173>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x30,-0x1(%rax)
jmp    1288 <printNf+0x178>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    1225 <printNf+0x115>
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    12bb <printNf+0x1ab>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,-0x1(%rax)
jmp    12ce <printNf+0x1be>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x30,-0x1(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <uart0SendString@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printNf>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm2
xorps  %xmm0,%xmm2
xorps  %xmm3,%xmm3
movaps %xmm0,%xmm1
cmpltss %xmm3,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movb   $0x0,0x1f(%rsp)
movss  0xed1(%rip),%xmm2
mulss  %xmm1,%xmm2
cvttss2si %xmm2,%ecx
mov    $0xcccccccd,%eax
mov    %rcx,%rdx
imul   %rax,%rdx
shr    $0x23,%rdx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
or     $0x30,%cl
mov    %cl,0x1e(%rsp)
movss  0xea7(%rip),%xmm2
mulss  %xmm1,%xmm2
cvttss2si %xmm2,%ecx
mov    %rcx,%rdx
imul   %rax,%rdx
shr    $0x23,%rdx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
or     $0x30,%cl
mov    %cl,0x1d(%rsp)
movss  0xe82(%rip),%xmm2
mulss  %xmm1,%xmm2
cvttss2si %xmm2,%ecx
mov    %rcx,%rdx
imul   %rax,%rdx
shr    $0x23,%rdx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
or     $0x30,%cl
movss  0xe61(%rip),%xmm2
mulss  %xmm1,%xmm2
cvttss2si %xmm2,%edx
mov    %cl,0x1c(%rsp)
mov    %rdx,%rcx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edx
or     $0x30,%dl
mov    %dl,0x1b(%rsp)
movb   $0x2e,0x1a(%rsp)
cvttss2si %xmm1,%edx
test   %edx,%edx
je     122e <printNf+0x11e>
mov    %edx,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %edx,%esi
sub    %eax,%esi
or     $0x30,%sil
mov    %sil,0x19(%rsp)
mov    $0x30,%al
cmp    $0xa,%edx
jb     1235 <printNf+0x125>
mov    %ecx,%eax
mov    $0xcccccccd,%edx
imul   %rax,%rdx
shr    $0x23,%rdx
add    %edx,%edx
lea    (%rdx,%rdx,4),%eax
sub    %eax,%ecx
or     $0x30,%cl
mov    %ecx,%eax
jmp    1235 <printNf+0x125>
movb   $0x30,0x19(%rsp)
mov    $0x30,%al
xorps  %xmm1,%xmm1
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
mov    %al,0x18(%rsp)
lea    0x17(%rsp),%rdi
setbe  %cl
lea    (%rcx,%rcx,2),%eax
add    $0x2d,%eax
mov    %al,0x17(%rsp)
call   1030 <uart0SendString@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@printNf.noDigits = internal global i8 2
@printNf.noDecDigits = internal global i8 4
define void @printNf(float %0) {
%2 = alloca float
%3 = alloca i8*
%4 = alloca [32 x i8]
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store float %0, float* %2
%10 = load float, float* %2
%11 = fcmp olt float %10, 0.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load float, float* %2
%14 = fneg float %13
store float %14, float* %5
br label %17
15: ; preds = %1
%16 = load float, float* %2
store float %16, float* %5
br label %17
17: ; preds = %15, %12
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%19 = getelementptr inbounds i8, i8* %18, i64 32
store i8* %19, i8** %3
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 -1
store i8* %21, i8** %3
store i8 0, i8* %21
%22 = load i8, i8* @printNf.noDecDigits
%23 = zext i8 %22 to i32
store i32 %23, i32* %6
br label %24
24: ; preds = %51, %17
%25 = load i32, i32* %6
%26 = icmp ugt i32 %25, 0
br i1 %26, label %27, label %54
27: ; preds = %24
store i32 1, i32* %8
store i32 1, i32* %7
br label %28
28: ; preds = %36, %27
%29 = load i32, i32* %7
%30 = load i32, i32* %6
%31 = add i32 %30, 1
%32 = icmp ult i32 %29, %31
br i1 %32, label %33, label %39
33: ; preds = %28
%34 = load i32, i32* %8
%35 = mul i32 %34, 10
store i32 %35, i32* %8
br label %36
36: ; preds = %33
%37 = load i32, i32* %7
%38 = add i32 %37, 1
store i32 %38, i32* %7
br label %28
39: ; preds = %28
%40 = load float, float* %5
%41 = load i32, i32* %8
%42 = uitofp i32 %41 to float
%43 = fmul float %40, %42
%44 = fptosi float %43 to i32
store i32 %44, i32* %9
%45 = load i32, i32* %9
%46 = urem i32 %45, 10
%47 = add nsw i32 %46, 48
%48 = trunc i32 %47 to i8
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i32 -1
store i8* %50, i8** %3
store i8 %48, i8* %50
br label %51
51: ; preds = %39
%52 = load i32, i32* %6
%53 = add i32 %52, -1
store i32 %53, i32* %6
br label %24
54: ; preds = %24
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i32 -1
store i8* %56, i8** %3
store i8 46, i8* %56
%57 = load float, float* %5
%58 = fptosi float %57 to i32
store i32 %58, i32* %9
%59 = load i8, i8* @printNf.noDigits
%60 = zext i8 %59 to i32
store i32 %60, i32* %6
br label %61
61: ; preds = %80, %54
%62 = load i32, i32* %6
%63 = icmp ugt i32 %62, 0
br i1 %63, label %64, label %83
64: ; preds = %61
%65 = load i32, i32* %9
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %76
67: ; preds = %64
%68 = load i32, i32* %9
%69 = urem i32 %68, 10
%70 = add nsw i32 %69, 48
%71 = trunc i32 %70 to i8
%72 = load i8*, i8** %3
%73 = getelementptr inbounds i8, i8* %72, i32 -1
store i8* %73, i8** %3
store i8 %71, i8* %73
%74 = load i32, i32* %9
%75 = udiv i32 %74, 10
store i32 %75, i32* %9
br label %79
76: ; preds = %64
%77 = load i8*, i8** %3
%78 = getelementptr inbounds i8, i8* %77, i32 -1
store i8* %78, i8** %3
store i8 48, i8* %78
br label %79
79: ; preds = %76, %67
br label %80
80: ; preds = %79
%81 = load i32, i32* %6
%82 = add i32 %81, -1
store i32 %82, i32* %6
br label %61
83: ; preds = %61
%84 = load float, float* %2
%85 = fcmp olt float %84, 0.000000e+00
br i1 %85, label %86, label %89
86: ; preds = %83
%87 = load i8*, i8** %3
%88 = getelementptr inbounds i8, i8* %87, i32 -1
store i8* %88, i8** %3
store i8 45, i8* %88
br label %92
89: ; preds = %83
%90 = load i8*, i8** %3
%91 = getelementptr inbounds i8, i8* %90, i32 -1
store i8* %91, i8** %3
store i8 48, i8* %91
br label %92
92: ; preds = %89, %86
%93 = load i8*, i8** %3
%94 = call i32 @uart0SendString(i8* %93)
ret void
}

LLVM IR (-O2):
define void @printNf(float %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = fcmp olt float %0, 0.000000e+00
%5 = fneg float %0
%6 = select i1 %4, float %5, float %0
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 31
store i8 0, i8* %7
%8 = fmul float %6, 1.000000e+04
%9 = fptosi float %8 to i32
%10 = urem i32 %9, 10
%11 = trunc i32 %10 to i8
%12 = or i8 %11, 48
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 30
store i8 %12, i8* %13
%14 = fmul float %6, 1.000000e+03
%15 = fptosi float %14 to i32
%16 = urem i32 %15, 10
%17 = trunc i32 %16 to i8
%18 = or i8 %17, 48
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 29
store i8 %18, i8* %19
%20 = fmul float %6, 1.000000e+02
%21 = fptosi float %20 to i32
%22 = urem i32 %21, 10
%23 = trunc i32 %22 to i8
%24 = or i8 %23, 48
%25 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 28
store i8 %24, i8* %25
%26 = fmul float %6, 1.000000e+01
%27 = fptosi float %26 to i32
%28 = urem i32 %27, 10
%29 = trunc i32 %28 to i8
%30 = or i8 %29, 48
%31 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 27
store i8 %30, i8* %31
%32 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 26
store i8 46, i8* %32
%33 = fptosi float %6 to i32
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %1
%36 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 25
store i8 48, i8* %36
br label %48
37: ; preds = %1
%38 = urem i32 %33, 10
%39 = udiv i32 %33, 10
%40 = trunc i32 %38 to i8
%41 = or i8 %40, 48
%42 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 25
store i8 %41, i8* %42
%43 = icmp ult i32 %33, 10
br i1 %43, label %48, label %44
44: ; preds = %37
%45 = urem i32 %39, 10
%46 = trunc i32 %45 to i8
%47 = or i8 %46, 48
br label %48
48: ; preds = %37, %35, %44
%49 = phi i8 [ %47, %44 ], [ 48, %35 ], [ 48, %37 ]
%50 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 24
store i8 %49, i8* %50
%51 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 23
%52 = select i1 %4, i8 45, i8 48
store i8 %52, i8* %51
%53 = call i32 @uart0SendString(i8* %51)
ret void
}