#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 */
scalar_t__ isdigit(char const);
float parse_digits(const char **c) {
  float sign = 1.f;
  float value = 0.f;
  if (**c == '+')
    ++(*c);
  else if (**c == '-') {
    sign = -1.f;
    ++(*c);
  }
  for (; isdigit(**c); ++(*c)) {
    value *= 10.f;
    value += **c - '0';
  }
  return sign * value;
}


x86 assembly (clang, -O0):
<parse_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  0xedc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    1157 <parse_digits+0x47>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    118a <parse_digits+0x7a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1185 <parse_digits+0x75>
movss  0xe92(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    118a <parse_digits+0x7a>
jmp    118f <parse_digits+0x7f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11e8 <parse_digits+0xd8>
movss  0xe58(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
cvtsi2ss %eax,%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    118f <parse_digits+0x7f>
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_digits>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    (%rax),%cl
movss  0xedb(%rip),%xmm0
cmp    $0x2b,%cl
je     1137 <parse_digits+0x27>
cmp    $0x2d,%cl
jne    1146 <parse_digits+0x36>
movss  0xecd(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
add    $0x1,%rax
mov    %rax,(%rbx)
jmp    114c <parse_digits+0x3c>
movss  %xmm0,0x8(%rsp)
movsbl (%rax),%edi
call   1030 <isdigit@plt>
xorps  %xmm1,%xmm1
test   %rax,%rax
je     119d <parse_digits+0x8d>
nopl   0x0(%rax)
mulss  0xea0(%rip),%xmm1
mov    (%rbx),%rax
movsbl (%rax),%ecx
add    $0xffffffd0,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
movss  0xc(%rsp),%xmm1
test   %rax,%rax
jne    1160 <parse_digits+0x50>
movss  0x8(%rsp),%xmm0
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @parse_digits(i8** %0) {
%2 = alloca i8**
%3 = alloca float
%4 = alloca float
store i8** %0, i8*** %2
store float 1.000000e+00, float* %3
store float 0.000000e+00, float* %4
%5 = load i8**, i8*** %2
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 43
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i8**, i8*** %2
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %11
br label %25
14: ; preds = %1
%15 = load i8**, i8*** %2
%16 = load i8*, i8** %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 45
br i1 %19, label %20, label %24
20: ; preds = %14
store float -1.000000e+00, float* %3
%21 = load i8**, i8*** %2
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %21
br label %24
24: ; preds = %20, %14
br label %25
25: ; preds = %24, %10
br label %26
26: ; preds = %43, %25
%27 = load i8**, i8*** %2
%28 = load i8*, i8** %27
%29 = load i8, i8* %28
%30 = call i64 @isdigit(i8 signext %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %47
32: ; preds = %26
%33 = load float, float* %4
%34 = fmul float %33, 1.000000e+01
store float %34, float* %4
%35 = load i8**, i8*** %2
%36 = load i8*, i8** %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = sub nsw i32 %38, 48
%40 = sitofp i32 %39 to float
%41 = load float, float* %4
%42 = fadd float %41, %40
store float %42, float* %4
br label %43
43: ; preds = %32
%44 = load i8**, i8*** %2
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %44
br label %26
47: ; preds = %26
%48 = load float, float* %3
%49 = load float, float* %4
%50 = fmul float %48, %49
ret float %50
}

LLVM IR (-O2):
define float @parse_digits(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
switch i8 %3, label %8 [
i8 43, label %5
i8 45, label %4
]
4: ; preds = %1
br label %5
5: ; preds = %1, %4
%6 = phi float [ -1.000000e+00, %4 ], [ 1.000000e+00, %1 ]
%7 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %7, i8** %0
br label %8
8: ; preds = %5, %1
%9 = phi i8* [ %2, %1 ], [ %7, %5 ]
%10 = phi float [ 1.000000e+00, %1 ], [ %6, %5 ]
%11 = load i8, i8* %9
%12 = tail call i64 @isdigit(i8 signext %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %27, label %14
14: ; preds = %8, %14
%15 = phi float [ %22, %14 ], [ 0.000000e+00, %8 ]
%16 = fmul float %15, 1.000000e+01
%17 = load i8*, i8** %0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = add nsw i32 %19, -48
%21 = sitofp i32 %20 to float
%22 = fadd float %16, %21
%23 = getelementptr inbounds i8, i8* %17, i64 1
store i8* %23, i8** %0
%24 = load i8, i8* %23
%25 = tail call i64 @isdigit(i8 signext %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %14
27: ; preds = %14, %8
%28 = phi float [ 0.000000e+00, %8 ], [ %22, %14 ]
%29 = fmul float %10, %28
ret float %29
}