#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 */
float fabs(float);
void get_unit(float wrldmi, float wrldma, float *divfac, char *s) {
  float r =
      (((fabs(wrldma)) > (fabs(wrldmi))) ? (fabs(wrldma)) : (fabs(wrldmi)));
  char cu = ' ';
  *divfac = 1.0;
  if (r < 1e-12) {
    cu = 'f';
    *divfac = 1e-15;
  } else if (r < 1e-9) {
    cu = 'p';
    *divfac = 1e-12;
  } else if (r < 1e-6) {
    cu = 'n';
    *divfac = 1e-9;
  } else if (r < 1e-3) {
    cu = 'u';
    *divfac = 1e-6;
  } else if (r >= 1e+9) {
    cu = 'T';
    *divfac = 1e+9;
  } else if (r >= 1e+6) {
    cu = 'M';
    *divfac = 1e+6;
  } else if (r >= 9.99e+3) {
    cu = 'k';
    *divfac = 1e+3;
  }
  s[0] = cu;
  s[1] = '\0';
}


x86 assembly (clang, -O0):
<get_unit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1168 <get_unit+0x58>
movss  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,-0x28(%rbp)
jmp    1177 <get_unit+0x67>
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movb   $0x20,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
movss  0xea7(%rip),%xmm0
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe5a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c9 <get_unit+0xb9>
movb   $0x66,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
movss  0xe94(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    131a <get_unit+0x20a>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe2e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11fd <get_unit+0xed>
movb   $0x70,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
movss  0xe5c(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    1315 <get_unit+0x205>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe02(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1231 <get_unit+0x121>
movb   $0x6e,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
movss  0xe24(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    1310 <get_unit+0x200>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdd6(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1265 <get_unit+0x155>
movb   $0x75,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
movss  0xdec(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    130b <get_unit+0x1fb>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdaa(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1299 <get_unit+0x189>
movb   $0x54,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
movss  0xdb4(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    1306 <get_unit+0x1f6>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd7e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12cd <get_unit+0x1bd>
movb   $0x4d,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
movss  0xd7c(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    1301 <get_unit+0x1f1>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd52(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12fc <get_unit+0x1ec>
movb   $0x6b,-0x1d(%rbp)
mov    -0x10(%rbp),%rax
movss  0xd44(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    1301 <get_unit+0x1f1>
jmp    1306 <get_unit+0x1f6>
jmp    130b <get_unit+0x1fb>
jmp    1310 <get_unit+0x200>
jmp    1315 <get_unit+0x205>
jmp    131a <get_unit+0x20a>
mov    -0x1d(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,0x1(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_unit>:
movaps 0xef9(%rip),%xmm2
andps  %xmm2,%xmm1
andps  %xmm2,%xmm0
maxss  %xmm0,%xmm1
movl   $0x3f800000,(%rdi)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  0xf0a(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    113b <get_unit+0x3b>
mov    $0x66,%al
movss  0xeda(%rip),%xmm0
jmp    11bc <get_unit+0xbc>
movsd  0xef5(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    1155 <get_unit+0x55>
mov    $0x70,%al
movss  0xec1(%rip),%xmm0
jmp    11bc <get_unit+0xbc>
movsd  0xee3(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    116f <get_unit+0x6f>
mov    $0x6e,%al
movss  0xeab(%rip),%xmm0
jmp    11bc <get_unit+0xbc>
movsd  0xed1(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    1189 <get_unit+0x89>
mov    $0x75,%al
movss  0xe95(%rip),%xmm0
jmp    11bc <get_unit+0xbc>
mov    $0x54,%al
movss  0xe8d(%rip),%xmm0
ucomiss %xmm0,%xmm1
jae    11bc <get_unit+0xbc>
mov    $0x4d,%al
movss  0xe82(%rip),%xmm0
ucomiss %xmm0,%xmm1
jae    11bc <get_unit+0xbc>
mov    $0x20,%al
ucomiss 0xe7c(%rip),%xmm1
jb     11c0 <get_unit+0xc0>
mov    $0x6b,%al
movss  0xe6c(%rip),%xmm0
movss  %xmm0,(%rdi)
mov    %al,(%rsi)
movb   $0x0,0x1(%rsi)
ret

LLVM IR (-O0):
define void @get_unit(float %0, float %1, float* %2, i8* %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float*
%8 = alloca i8*
%9 = alloca float
%10 = alloca i8
store float %0, float* %5
store float %1, float* %6
store float* %2, float** %7
store i8* %3, i8** %8
%11 = load float, float* %6
%12 = call float @fabs(float %11)
%13 = load float, float* %5
%14 = call float @fabs(float %13)
%15 = fcmp ogt float %12, %14
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = load float, float* %6
%18 = call float @fabs(float %17)
br label %22
19: ; preds = %4
%20 = load float, float* %5
%21 = call float @fabs(float %20)
br label %22
22: ; preds = %19, %16
%23 = phi float [ %18, %16 ], [ %21, %19 ]
store float %23, float* %9
store i8 32, i8* %10
%24 = load float*, float** %7
store float 1.000000e+00, float* %24
%25 = load float, float* %9
%26 = fpext float %25 to double
%27 = fcmp olt double %26, 0x3D719799812DEA11
br i1 %27, label %28, label %30
28: ; preds = %22
store i8 102, i8* %10
%29 = load float*, float** %7
store float 0x3CD203AFA0000000, float* %29
br label %72
30: ; preds = %22
%31 = load float, float* %9
%32 = fpext float %31 to double
%33 = fcmp olt double %32, 1.000000e-09
br i1 %33, label %34, label %36
34: ; preds = %30
store i8 112, i8* %10
%35 = load float*, float** %7
store float 0x3D71979980000000, float* %35
br label %71
36: ; preds = %30
%37 = load float, float* %9
%38 = fpext float %37 to double
%39 = fcmp olt double %38, 0x3EB0C6F7A0B5ED8D
br i1 %39, label %40, label %42
40: ; preds = %36
store i8 110, i8* %10
%41 = load float*, float** %7
store float 0x3E112E0BE0000000, float* %41
br label %70
42: ; preds = %36
%43 = load float, float* %9
%44 = fpext float %43 to double
%45 = fcmp olt double %44, 1.000000e-03
br i1 %45, label %46, label %48
46: ; preds = %42
store i8 117, i8* %10
%47 = load float*, float** %7
store float 0x3EB0C6F7A0000000, float* %47
br label %69
48: ; preds = %42
%49 = load float, float* %9
%50 = fpext float %49 to double
%51 = fcmp oge double %50, 1.000000e+09
br i1 %51, label %52, label %54
52: ; preds = %48
store i8 84, i8* %10
%53 = load float*, float** %7
store float 1.000000e+09, float* %53
br label %68
54: ; preds = %48
%55 = load float, float* %9
%56 = fpext float %55 to double
%57 = fcmp oge double %56, 1.000000e+06
br i1 %57, label %58, label %60
58: ; preds = %54
store i8 77, i8* %10
%59 = load float*, float** %7
store float 1.000000e+06, float* %59
br label %67
60: ; preds = %54
%61 = load float, float* %9
%62 = fpext float %61 to double
%63 = fcmp oge double %62, 9.990000e+03
br i1 %63, label %64, label %66
64: ; preds = %60
store i8 107, i8* %10
%65 = load float*, float** %7
store float 1.000000e+03, float* %65
br label %66
66: ; preds = %64, %60
br label %67
67: ; preds = %66, %58
br label %68
68: ; preds = %67, %52
br label %69
69: ; preds = %68, %46
br label %70
70: ; preds = %69, %40
br label %71
71: ; preds = %70, %34
br label %72
72: ; preds = %71, %28
%73 = load i8, i8* %10
%74 = load i8*, i8** %8
%75 = getelementptr inbounds i8, i8* %74, i64 0
store i8 %73, i8* %75
%76 = load i8*, i8** %8
%77 = getelementptr inbounds i8, i8* %76, i64 1
store i8 0, i8* %77
ret void
}

LLVM IR (-O2):
define void @get_unit(float %0, float %1, float* nocapture writeonly %2, i8* nocapture writeonly %3) {
%5 = tail call float @llvm.fabs.f32(float %1)
%6 = tail call float @llvm.fabs.f32(float %0)
%7 = fcmp ogt float %5, %6
%8 = select i1 %7, float %5, float %6
store float 1.000000e+00, float* %2
%9 = fpext float %8 to double
%10 = fcmp olt double %9, 0x3D719799812DEA11
br i1 %10, label %23, label %11
11: ; preds = %4
%12 = fcmp olt double %9, 1.000000e-09
br i1 %12, label %23, label %13
13: ; preds = %11
%14 = fcmp olt double %9, 0x3EB0C6F7A0B5ED8D
br i1 %14, label %23, label %15
15: ; preds = %13
%16 = fcmp olt double %9, 1.000000e-03
br i1 %16, label %23, label %17
17: ; preds = %15
%18 = fcmp ult float %8, 1.000000e+09
br i1 %18, label %19, label %23
19: ; preds = %17
%20 = fcmp ult float %8, 1.000000e+06
br i1 %20, label %21, label %23
21: ; preds = %19
%22 = fcmp ult float %8, 9.990000e+03
br i1 %22, label %26, label %23
23: ; preds = %21, %19, %17, %15, %13, %11, %4
%24 = phi float [ 0x3CD203AFA0000000, %4 ], [ 0x3D71979980000000, %11 ], [ 0x3E112E0BE0000000, %13 ], [ 0x3EB0C6F7A0000000, %15 ], [ 1.000000e+09, %17 ], [ 1.000000e+06, %19 ], [ 1.000000e+03, %21 ]
%25 = phi i8 [ 102, %4 ], [ 112, %11 ], [ 110, %13 ], [ 117, %15 ], [ 84, %17 ], [ 77, %19 ], [ 107, %21 ]
store float %24, float* %2
br label %26
26: ; preds = %23, %21
%27 = phi i8 [ 32, %21 ], [ %25, %23 ]
store i8 %27, i8* %3
%28 = getelementptr inbounds i8, i8* %3, i64 1
store i8 0, i8* %28
ret void
}