#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 DBL_MAX;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int sscanf(char *, char *, float *, char *, ...);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
float getnumber(char *strpntbegin) {
  int i;
  char *strpnt, magn1, magn2;
  float number;
  strpnt = strpntbegin;
  strpnt = strchr(strpntbegin, '=');
  if (strpnt == NULL) {
    fprintf(stderr,
            "Error: getnumber: Didn't find '=' in string "
            "%s\n",
            strpntbegin);
    return DBL_MAX;
  }
  strpnt = strpnt + 1;
  if (sscanf(strpnt, "%f%c%c", &number, &magn1, &magn2) != 3) {
    if (sscanf(strpnt, "%f%c", &number, &magn1) != 2) {
      fprintf(stderr,
              "Error: getnumber : Couldn't read number in "
              "%s %s\n",
              strpntbegin, strpnt);
      return DBL_MAX;
    }
  }
  switch (magn1) {
  case 'f':
    number *= 1e-15;
    break;
  case 'p':
    number *= 1e-12;
    break;
  case 'n':
    number *= 1e-9;
    break;
  case 'u':
    number *= 1e-6;
    break;
  case 'm':
    if (magn2 == 'e')
      number *= 1e6;
    else
      number *= 1e-3;
    break;
  case 'k':
    number *= 1e3;
    break;
  case 'g':
    number *= 1e9;
    break;
  case ' ':
  default:
    return number;
  }
  return number;
}


x86 assembly (clang, -O0):
<getnumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1191 <getnumber+0x61>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xecb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e55(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    13ef <getnumber+0x2bf>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xec8(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x21(%rbp),%rcx
lea    -0x22(%rbp),%r8
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x3,%eax
je     1220 <getnumber+0xf0>
mov    -0x20(%rbp),%rdi
lea    0xea8(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x21(%rbp),%rcx
mov    $0x0,%al
call   1050 <sscanf@plt>
cmp    $0x2,%eax
je     121b <getnumber+0xeb>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe7d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dcb(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    13ef <getnumber+0x2bf>
jmp    1220 <getnumber+0xf0>
movsbl -0x21(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x20,%eax
je     13d1 <getnumber+0x2a1>
jmp    1235 <getnumber+0x105>
mov    -0x2c(%rbp),%eax
sub    $0x66,%eax
je     12ac <getnumber+0x17c>
jmp    1246 <getnumber+0x116>
mov    -0x2c(%rbp),%eax
sub    $0x67,%eax
je     13ae <getnumber+0x27e>
jmp    1257 <getnumber+0x127>
mov    -0x2c(%rbp),%eax
sub    $0x6b,%eax
je     138b <getnumber+0x25b>
jmp    1268 <getnumber+0x138>
mov    -0x2c(%rbp),%eax
sub    $0x6d,%eax
je     1338 <getnumber+0x208>
jmp    1279 <getnumber+0x149>
mov    -0x2c(%rbp),%eax
sub    $0x6e,%eax
je     12f2 <getnumber+0x1c2>
jmp    128a <getnumber+0x15a>
mov    -0x2c(%rbp),%eax
sub    $0x70,%eax
je     12cf <getnumber+0x19f>
jmp    129b <getnumber+0x16b>
mov    -0x2c(%rbp),%eax
sub    $0x75,%eax
je     1315 <getnumber+0x1e5>
jmp    13d6 <getnumber+0x2a6>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd7b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    13e5 <getnumber+0x2b5>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd50(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    13e5 <getnumber+0x2b5>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd25(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    13e5 <getnumber+0x2b5>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcfa(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    13e5 <getnumber+0x2b5>
movsbl -0x22(%rbp),%eax
cmp    $0x65,%eax
jne    1368 <getnumber+0x238>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcc2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    1386 <getnumber+0x256>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc97(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    13e5 <getnumber+0x2b5>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc6c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    13e5 <getnumber+0x2b5>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc41(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    13e5 <getnumber+0x2b5>
jmp    13d6 <getnumber+0x2a6>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    13ef <getnumber+0x2bf>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnumber>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
mov    $0x3d,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11d6 <getnumber+0xa6>
mov    %rax,%rbx
add    $0x1,%rbx
lea    0xf4b(%rip),%rsi
lea    0x8(%rsp),%r14
lea    0xe(%rsp),%rcx
lea    0xf(%rsp),%r8
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x3,%eax
je     119e <getnumber+0x6e>
lea    0xf2a(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0xe(%rsp),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x2,%eax
jne    11fc <getnumber+0xcc>
movsbl 0xe(%rsp),%eax
add    $0xffffff9a,%eax
cmp    $0xf,%eax
ja     12ae <getnumber+0x17e>
lea    0xe82(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe5f(%rip),%xmm0
jmp    12a4 <getnumber+0x174>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2de1(%rip),%r14
jmp    12ae <getnumber+0x17e>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2db8(%rip),%r14
jmp    12ae <getnumber+0x17e>
movss  0x8(%rsp),%xmm0
mulss  0xdcd(%rip),%xmm0
jmp    12a8 <getnumber+0x178>
movss  0x8(%rsp),%xmm0
mulss  0xdc1(%rip),%xmm0
jmp    12a8 <getnumber+0x178>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdd1(%rip),%xmm0
jmp    12a4 <getnumber+0x174>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdad(%rip),%xmm0
jmp    12a4 <getnumber+0x174>
cmpb   $0x65,0xf(%rsp)
movss  0x8(%rsp),%xmm0
jne    1298 <getnumber+0x168>
mulss  0xd86(%rip),%xmm0
jmp    12a8 <getnumber+0x178>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xd8a(%rip),%xmm0
jmp    12a4 <getnumber+0x174>
cvtss2sd %xmm0,%xmm0
mulsd  0xd6c(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
movss  (%r14),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [48 x i8] c"Error: getnumber: Didn't find '=' in string %s\0A\00"
@DBL_MAX = global float 0.000000e+00
@.str.1 = [7 x i8] c"%f%c%c\00"
@.str.2 = [5 x i8] c"%f%c\00"
@.str.3 = [50 x i8] c"Error: getnumber : Couldn't read number in %s %s\0A\00"
define float @getnumber(i8* %0) {
%2 = alloca float
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
%8 = alloca float
store i8* %0, i8** %3
%9 = load i8*, i8** %3
store i8* %9, i8** %5
%10 = load i8*, i8** %3
%11 = call i8* @strchr(i8* %10, i8 signext 61)
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %1
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %3
%17 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load float, float* @DBL_MAX
store float %18, float* %2
br label %89
19: ; preds = %1
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8* %21, i8** %5
%22 = load i8*, i8** %5
%23 = call i32 (i8*, i8*, float*, i8*, ...) @sscanf(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %8, i8* %6, i8* %7)
%24 = icmp ne i32 %23, 3
br i1 %24, label %25, label %36
25: ; preds = %19
%26 = load i8*, i8** %5
%27 = call i32 (i8*, i8*, float*, i8*, ...) @sscanf(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), float* %8, i8* %6)
%28 = icmp ne i32 %27, 2
br i1 %28, label %29, label %35
29: ; preds = %25
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %3
%32 = load i8*, i8** %5
%33 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %31, i8* %32)
%34 = load float, float* @DBL_MAX
store float %34, float* %2
br label %89
35: ; preds = %25
br label %36
36: ; preds = %35, %19
%37 = load i8, i8* %6
%38 = sext i8 %37 to i32
switch i32 %38, label %85 [
i32 102, label %39
i32 112, label %44
i32 110, label %49
i32 117, label %54
i32 109, label %59
i32 107, label %74
i32 103, label %79
i32 32, label %84
]
39: ; preds = %36
%40 = load float, float* %8
%41 = fpext float %40 to double
%42 = fmul double %41, 1.000000e-15
%43 = fptrunc double %42 to float
store float %43, float* %8
br label %87
44: ; preds = %36
%45 = load float, float* %8
%46 = fpext float %45 to double
%47 = fmul double %46, 0x3D719799812DEA11
%48 = fptrunc double %47 to float
store float %48, float* %8
br label %87
49: ; preds = %36
%50 = load float, float* %8
%51 = fpext float %50 to double
%52 = fmul double %51, 1.000000e-09
%53 = fptrunc double %52 to float
store float %53, float* %8
br label %87
54: ; preds = %36
%55 = load float, float* %8
%56 = fpext float %55 to double
%57 = fmul double %56, 0x3EB0C6F7A0B5ED8D
%58 = fptrunc double %57 to float
store float %58, float* %8
br label %87
59: ; preds = %36
%60 = load i8, i8* %7
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 101
br i1 %62, label %63, label %68
63: ; preds = %59
%64 = load float, float* %8
%65 = fpext float %64 to double
%66 = fmul double %65, 1.000000e+06
%67 = fptrunc double %66 to float
store float %67, float* %8
br label %73
68: ; preds = %59
%69 = load float, float* %8
%70 = fpext float %69 to double
%71 = fmul double %70, 1.000000e-03
%72 = fptrunc double %71 to float
store float %72, float* %8
br label %73
73: ; preds = %68, %63
br label %87
74: ; preds = %36
%75 = load float, float* %8
%76 = fpext float %75 to double
%77 = fmul double %76, 1.000000e+03
%78 = fptrunc double %77 to float
store float %78, float* %8
br label %87
79: ; preds = %36
%80 = load float, float* %8
%81 = fpext float %80 to double
%82 = fmul double %81, 1.000000e+09
%83 = fptrunc double %82 to float
store float %83, float* %8
br label %87
84: ; preds = %36
br label %85
85: ; preds = %36, %84
%86 = load float, float* %8
store float %86, float* %2
br label %89
87: ; preds = %79, %74, %73, %54, %49, %44, %39
%88 = load float, float* %8
store float %88, float* %2
br label %89
89: ; preds = %87, %85, %29, %14
%90 = load float, float* %2
ret float %90
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"Error: getnumber: Didn't find '=' in string %s\0A\00"
@DBL_MAX = global float 0.000000e+00
@.str.1 = [7 x i8] c"%f%c%c\00"
@.str.2 = [5 x i8] c"%f%c\00"
@.str.3 = [50 x i8] c"Error: getnumber : Couldn't read number in %s %s\0A\00"
define float @getnumber(i8* %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca float
%5 = bitcast float* %4 to i8*
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 61)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %60
11: ; preds = %1
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = call i32 (i8*, i8*, float*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %4, i8* %2, i8* %3)
%14 = icmp eq i32 %13, 3
br i1 %14, label %21, label %15
15: ; preds = %11
%16 = call i32 (i8*, i8*, float*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), float* %4, i8* %2)
%17 = icmp eq i32 %16, 2
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %12)
br label %60
21: ; preds = %15, %11
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
switch i32 %23, label %60 [
i32 102, label %24
i32 112, label %29
i32 110, label %34
i32 117, label %39
i32 109, label %44
i32 107, label %54
i32 103, label %57
]
24: ; preds = %21
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = fmul double %26, 1.000000e-15
%28 = fptrunc double %27 to float
store float %28, float* %4
br label %60
29: ; preds = %21
%30 = load float, float* %4
%31 = fpext float %30 to double
%32 = fmul double %31, 0x3D719799812DEA11
%33 = fptrunc double %32 to float
store float %33, float* %4
br label %60
34: ; preds = %21
%35 = load float, float* %4
%36 = fpext float %35 to double
%37 = fmul double %36, 1.000000e-09
%38 = fptrunc double %37 to float
store float %38, float* %4
br label %60
39: ; preds = %21
%40 = load float, float* %4
%41 = fpext float %40 to double
%42 = fmul double %41, 0x3EB0C6F7A0B5ED8D
%43 = fptrunc double %42 to float
store float %43, float* %4
br label %60
44: ; preds = %21
%45 = load i8, i8* %3
%46 = icmp eq i8 %45, 101
%47 = load float, float* %4
br i1 %46, label %48, label %50
48: ; preds = %44
%49 = fmul float %47, 1.000000e+06
store float %49, float* %4
br label %60
50: ; preds = %44
%51 = fpext float %47 to double
%52 = fmul double %51, 1.000000e-03
%53 = fptrunc double %52 to float
store float %53, float* %4
br label %60
54: ; preds = %21
%55 = load float, float* %4
%56 = fmul float %55, 1.000000e+03
store float %56, float* %4
br label %60
57: ; preds = %21
%58 = load float, float* %4
%59 = fmul float %58, 1.000000e+09
store float %59, float* %4
br label %60
60: ; preds = %24, %29, %34, %39, %54, %57, %50, %48, %21, %18, %8
%61 = phi float* [ @DBL_MAX, %8 ], [ @DBL_MAX, %18 ], [ %4, %21 ], [ %4, %48 ], [ %4, %50 ], [ %4, %57 ], [ %4, %54 ], [ %4, %39 ], [ %4, %34 ], [ %4, %29 ], [ %4, %24 ]
%62 = load float, float* %61
ret float %62
}