#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*/ strcmp(char *, char *);
float strtof(char const *, char **);
float SI_atof(const char *nptr) {
  float f = 0;
  float m = 1;
  char *suffixptr;
  f = strtof(nptr, &suffixptr);
  if (*suffixptr) {
    if (!strcmp(suffixptr, "Ki"))
      m = 1 << 10;
    else if (!strcmp(suffixptr, "Mi"))
      m = 1 << 20;
    else if (!strcmp(suffixptr, "Gi"))
      m = 1 << 30;
    else if (!strcmp(suffixptr, "k"))
      m = 1000;
    else if (!strcmp(suffixptr, "M"))
      m = 1000 * 1000;
    else if (!strcmp(suffixptr, "G"))
      m = 1000 * 1000 * 1000;
  }
  return f * m;
}


x86 assembly (clang, -O0):
<SI_atof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xec4(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strtof@plt>
movss  %xmm0,-0xc(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     127b <SI_atof+0x15b>
mov    -0x18(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    118b <SI_atof+0x6b>
movss  0xe83(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1276 <SI_atof+0x156>
mov    -0x18(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11b6 <SI_atof+0x96>
movss  0xe5c(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1271 <SI_atof+0x151>
mov    -0x18(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11e1 <SI_atof+0xc1>
movss  0xe35(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    126c <SI_atof+0x14c>
mov    -0x18(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    120c <SI_atof+0xec>
movss  0xe0e(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1267 <SI_atof+0x147>
mov    -0x18(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1237 <SI_atof+0x117>
movss  0xde7(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1262 <SI_atof+0x142>
mov    -0x18(%rbp),%rdi
lea    0xde7(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    125d <SI_atof+0x13d>
movss  0xdc0(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1262 <SI_atof+0x142>
jmp    1267 <SI_atof+0x147>
jmp    126c <SI_atof+0x14c>
jmp    1271 <SI_atof+0x151>
jmp    1276 <SI_atof+0x156>
jmp    127b <SI_atof+0x15b>
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SI_atof>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rsi
call   1030 <strtof@plt>
mov    0x8(%rsp),%rbx
cmpb   $0x0,(%rbx)
je     11c6 <SI_atof+0xa6>
movss  %xmm0,0x4(%rsp)
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11d0 <SI_atof+0xb0>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11da <SI_atof+0xba>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11e4 <SI_atof+0xc4>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11ee <SI_atof+0xce>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11f8 <SI_atof+0xd8>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    0xe59(%rip),%rax
movss  (%rax,%rcx,4),%xmm1
jmp    1200 <SI_atof+0xe0>
movss  0xe32(%rip),%xmm1
jmp    1206 <SI_atof+0xe6>
movss  0xe2c(%rip),%xmm1
jmp    1200 <SI_atof+0xe0>
movss  0xe26(%rip),%xmm1
jmp    1200 <SI_atof+0xe0>
movss  0xe20(%rip),%xmm1
jmp    1200 <SI_atof+0xe0>
movss  0xe1a(%rip),%xmm1
jmp    1200 <SI_atof+0xe0>
movss  0xe14(%rip),%xmm1
movss  0x4(%rsp),%xmm0
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"Ki\00"
@.str.1 = [3 x i8] c"Mi\00"
@.str.2 = [3 x i8] c"Gi\00"
@.str.3 = [2 x i8] c"k\00"
@.str.4 = [2 x i8] c"M\00"
@.str.5 = [2 x i8] c"G\00"
define float @SI_atof(i8* %0) {
%2 = alloca i8*
%3 = alloca float
%4 = alloca float
%5 = alloca i8*
store i8* %0, i8** %2
store float 0.000000e+00, float* %3
store float 1.000000e+00, float* %4
%6 = load i8*, i8** %2
%7 = call float @strtof(i8* %6, i8** %5)
store float %7, float* %3
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %47
11: ; preds = %1
%12 = load i8*, i8** %5
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11
store float 1.024000e+03, float* %4
br label %46
16: ; preds = %11
%17 = load i8*, i8** %5
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
store float 0x4130000000000000, float* %4
br label %45
21: ; preds = %16
%22 = load i8*, i8** %5
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21
store float 0x41D0000000000000, float* %4
br label %44
26: ; preds = %21
%27 = load i8*, i8** %5
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %26
store float 1.000000e+03, float* %4
br label %43
31: ; preds = %26
%32 = load i8*, i8** %5
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %31
store float 1.000000e+06, float* %4
br label %42
36: ; preds = %31
%37 = load i8*, i8** %5
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %36
store float 1.000000e+09, float* %4
br label %41
41: ; preds = %40, %36
br label %42
42: ; preds = %41, %35
br label %43
43: ; preds = %42, %30
br label %44
44: ; preds = %43, %25
br label %45
45: ; preds = %44, %20
br label %46
46: ; preds = %45, %15
br label %47
47: ; preds = %46, %1
%48 = load float, float* %3
%49 = load float, float* %4
%50 = fmul float %48, %49
ret float %50
}

LLVM IR (-O2):
@.str = [3 x i8] c"Ki\00"
@.str.1 = [3 x i8] c"Mi\00"
@.str.2 = [3 x i8] c"Gi\00"
@.str.3 = [2 x i8] c"k\00"
@.str.4 = [2 x i8] c"M\00"
@.str.5 = [2 x i8] c"G\00"
define float @SI_atof(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call float @strtof(i8* %0, i8** %2)
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %27, label %8
8: ; preds = %1
%9 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %27, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %11
%15 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %17
%21 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %20
%24 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, float 1.000000e+09, float 1.000000e+00
br label %27
27: ; preds = %23, %20, %17, %14, %11, %8, %1
%28 = phi float [ 1.000000e+00, %1 ], [ 1.024000e+03, %8 ], [ 0x4130000000000000, %11 ], [ 0x41D0000000000000, %14 ], [ 1.000000e+03, %17 ], [ 1.000000e+06, %20 ], [ %26, %23 ]
%29 = fmul float %4, %28
ret float %29
}