#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*/ sscanf(char *, char *, float *, char *);
float psnd_scan_float(char *value) {
  float result = 0.0;
  char modify = 0;
  sscanf(value, "%f%c", &result, &modify);
  if (modify) {
    switch (modify) {
    case 'k':
    case 'K':
      result *= 1024.0;
      break;
    case 'm':
    case 'M':
      result *= 1024.0e3;
      break;
    case 'g':
    case 'G':
      result *= 1024.0e6;
      break;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<psnd_scan_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movb   $0x0,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xee5(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0xd(%rbp),%rcx
call   1030 <sscanf@plt>
cmpb   $0x0,-0xd(%rbp)
je     121d <psnd_scan_float+0x10d>
movsbl -0xd(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x47,%eax
je     11fa <psnd_scan_float+0xea>
jmp    115f <psnd_scan_float+0x4f>
mov    -0x14(%rbp),%eax
sub    $0x4b,%eax
je     11b4 <psnd_scan_float+0xa4>
jmp    1170 <psnd_scan_float+0x60>
mov    -0x14(%rbp),%eax
sub    $0x4d,%eax
je     11d7 <psnd_scan_float+0xc7>
jmp    1181 <psnd_scan_float+0x71>
mov    -0x14(%rbp),%eax
sub    $0x67,%eax
je     11fa <psnd_scan_float+0xea>
jmp    1192 <psnd_scan_float+0x82>
mov    -0x14(%rbp),%eax
sub    $0x6b,%eax
je     11b4 <psnd_scan_float+0xa4>
jmp    11a3 <psnd_scan_float+0x93>
mov    -0x14(%rbp),%eax
sub    $0x6d,%eax
je     11d7 <psnd_scan_float+0xc7>
jmp    1218 <psnd_scan_float+0x108>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1218 <psnd_scan_float+0x108>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe20(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1218 <psnd_scan_float+0x108>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf5(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    121d <psnd_scan_float+0x10d>
movss  -0xc(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psnd_scan_float>:
push   %rax
movl   $0x0,0x4(%rsp)
movb   $0x0,0x3(%rsp)
lea    0xee7(%rip),%rsi
lea    0x4(%rsp),%rdx
lea    0x3(%rsp),%rcx
call   1030 <sscanf@plt>
movsbl 0x3(%rsp),%eax
test   %eax,%eax
je     11a9 <psnd_scan_float+0x99>
add    $0xffffffb9,%eax
cmp    $0x26,%eax
ja     11a9 <psnd_scan_float+0x99>
movabs $0x100000001,%rcx
bt     %rax,%rcx
jb     1185 <psnd_scan_float+0x75>
movabs $0x1000000010,%rcx
bt     %rax,%rcx
jb     1195 <psnd_scan_float+0x85>
movabs $0x4000000040,%rcx
bt     %rax,%rcx
jae    11a9 <psnd_scan_float+0x99>
movss  0x4(%rsp),%xmm0
mulss  0xe81(%rip),%xmm0
jmp    11a3 <psnd_scan_float+0x93>
movss  0x4(%rsp),%xmm0
mulss  0xe6d(%rip),%xmm0
jmp    11a3 <psnd_scan_float+0x93>
movss  0x4(%rsp),%xmm0
mulss  0xe65(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%f%c\00"
define float @psnd_scan_float(i8* %0) {
%2 = alloca i8*
%3 = alloca float
%4 = alloca i8
store i8* %0, i8** %2
store float 0.000000e+00, float* %3
store i8 0, i8* %4
%5 = load i8*, i8** %2
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float* %3, i8* %4)
%7 = load i8, i8* %4
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %28
9: ; preds = %1
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
switch i32 %11, label %27 [
i32 107, label %12
i32 75, label %12
i32 109, label %17
i32 77, label %17
i32 103, label %22
i32 71, label %22
]
12: ; preds = %9, %9
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = fmul double %14, 1.024000e+03
%16 = fptrunc double %15 to float
store float %16, float* %3
br label %27
17: ; preds = %9, %9
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = fmul double %19, 1.024000e+06
%21 = fptrunc double %20 to float
store float %21, float* %3
br label %27
22: ; preds = %9, %9
%23 = load float, float* %3
%24 = fpext float %23 to double
%25 = fmul double %24, 1.024000e+09
%26 = fptrunc double %25 to float
store float %26, float* %3
br label %27
27: ; preds = %9, %22, %17, %12
br label %28
28: ; preds = %27, %1
%29 = load float, float* %3
ret float %29
}

LLVM IR (-O2):
@.str = [5 x i8] c"%f%c\00"
define float @psnd_scan_float(i8* nocapture %0) {
%2 = alloca float
%3 = alloca i8
%4 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
store i8 0, i8* %3
%5 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float* %2, i8* %3)
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %1
%9 = sext i8 %6 to i32
switch i32 %9, label %19 [
i32 107, label %10
i32 75, label %10
i32 109, label %13
i32 77, label %13
i32 103, label %16
i32 71, label %16
]
10: ; preds = %8, %8
%11 = load float, float* %2
%12 = fmul float %11, 1.024000e+03
store float %12, float* %2
br label %19
13: ; preds = %8, %8
%14 = load float, float* %2
%15 = fmul float %14, 1.024000e+06
store float %15, float* %2
br label %19
16: ; preds = %8, %8
%17 = load float, float* %2
%18 = fmul float %17, 1.024000e+09
store float %18, float* %2
br label %19
19: ; preds = %10, %13, %16, %8, %1
%20 = load float, float* %2
ret float %20
}