#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*/ errAbort(char *, char *);
char *strchr(char *, char);
scalar_t__ strtod(char *, char **);
float sqlFloatInList(char **pS) {
  char *s = *pS;
  char *end;
  float val = (float)strtod(s, &end);
  if ((end == s) || !(*end == '\0' || *end == ',')) {
    char *e = strchr(s, ',');
    if (e)
      *e = 0;
    errAbort("invalid float: %s", s);
  }
  *pS = end;
  return val;
}


x86 assembly (clang, -O0):
<sqlFloatInList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strtod@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     118c <sqlFloatInList+0x5c>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11c0 <sqlFloatInList+0x90>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
je     11c0 <sqlFloatInList+0x90>
mov    -0x10(%rbp),%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11b0 <sqlFloatInList+0x80>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rsi
lea    0xe45(%rip),%rdi
call   1050 <errAbort@plt>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movss  -0x1c(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlFloatInList>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strtod@plt>
mov    %rax,%r15
mov    (%rsp),%r12
cmp    %rbx,%r12
je     1161 <sqlFloatInList+0x31>
mov    (%r12),%al
test   %al,%al
je     1185 <sqlFloatInList+0x55>
cmp    $0x2c,%al
je     1185 <sqlFloatInList+0x55>
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1176 <sqlFloatInList+0x46>
movb   $0x0,(%rax)
lea    0xe83(%rip),%rdi
mov    %rbx,%rsi
call   1050 <errAbort@plt>
cvtsi2ss %r15,%xmm0
mov    %r12,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"invalid float: %s\00"
define float @sqlFloatInList(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca float
%6 = alloca i8*
store i8** %0, i8*** %2
%7 = load i8**, i8*** %2
%8 = load i8*, i8** %7
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = call i64 @strtod(i8* %9, i8** %4)
%11 = sitofp i64 %10 to float
store float %11, float* %5
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = icmp eq i8* %12, %13
br i1 %14, label %25, label %15
15: ; preds = %1
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %35, label %20
20: ; preds = %15
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 44
br i1 %24, label %35, label %25
25: ; preds = %20, %1
%26 = load i8*, i8** %3
%27 = call i8* @strchr(i8* %26, i8 signext 44)
store i8* %27, i8** %6
%28 = load i8*, i8** %6
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = load i8*, i8** %6
store i8 0, i8* %31
br label %32
32: ; preds = %30, %25
%33 = load i8*, i8** %3
%34 = call i32 @errAbort(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %32, %20, %15
%36 = load i8*, i8** %4
%37 = load i8**, i8*** %2
store i8* %36, i8** %37
%38 = load float, float* %5
ret float %38
}

LLVM IR (-O2):
@.str = [18 x i8] c"invalid float: %s\00"
define float @sqlFloatInList(i8** nocapture %0) {
%2 = alloca i8*
%3 = load i8*, i8** %0
%4 = bitcast i8** %2 to i8*
%5 = call i64 @strtod(i8* %3, i8** %2)
%6 = load i8*, i8** %2
%7 = icmp eq i8* %6, %3
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = load i8, i8* %6
switch i8 %9, label %10 [
i8 0, label %16
i8 44, label %16
]
10: ; preds = %8, %1
%11 = tail call i8* @strchr(i8* dereferenceable(1) %3, i8 signext 44)
%12 = icmp eq i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %10
store i8 0, i8* %11
br label %14
14: ; preds = %13, %10
%15 = tail call i32 @errAbort(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %16
16: ; preds = %8, %8, %14
%17 = sitofp i64 %5 to float
store i8* %6, i8** %0
ret float %17
}