#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 *, double *);
int readNumberList(char *pc, double list[], int count) {
  int i = 0;
  while (*pc && i < count) {
    while (*pc && *pc != ',')
      pc++;
    if (*pc) {
      pc++;
      if (*pc)
        sscanf(pc, "%lf", &list[i++]);
    }
  }
  return i;
}


x86 assembly (clang, -O0):
<readNumberList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     114b <readNumberList+0x3b>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    115b <readNumberList+0x4b>
jmp    11fe <readNumberList+0xee>
jmp    1160 <readNumberList+0x50>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1a(%rbp)
je     1185 <readNumberList+0x75>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    1195 <readNumberList+0x85>
jmp    11a6 <readNumberList+0x96>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <readNumberList+0x50>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11f9 <readNumberList+0xe9>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11f4 <readNumberList+0xe4>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x18(%rbp)
cltq
shl    $0x3,%rax
add    %rax,%rdx
lea    0xe11(%rip),%rsi
call   1030 <sscanf@plt>
jmp    11f9 <readNumberList+0xe9>
jmp    112a <readNumberList+0x1a>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readNumberList>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    (%rdi),%al
xor    %ebx,%ebx
test   %al,%al
je     1177 <readNumberList+0x67>
mov    %edx,%r15d
test   %edx,%edx
jle    1177 <readNumberList+0x67>
mov    %rsi,%r14
mov    %rdi,%rbp
xor    %ebx,%ebx
lea    0xeca(%rip),%r12
jmp    1144 <readNumberList+0x34>
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
je     1177 <readNumberList+0x67>
cmp    $0x2c,%al
jne    1140 <readNumberList+0x30>
cmpb   $0x0,0x0(%rbp)
je     1177 <readNumberList+0x67>
mov    %ebx,%eax
add    $0x1,%ebx
lea    (%r14,%rax,8),%rdx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1030 <sscanf@plt>
movzbl 0x0(%rbp),%eax
test   %al,%al
je     1177 <readNumberList+0x67>
cmp    %r15d,%ebx
jl     1144 <readNumberList+0x34>
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define i32 @readNumberList(i8* %0, double* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store double* %1, double** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %54, %3
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br label %17
17: ; preds = %13, %8
%18 = phi i1 [ false, %8 ], [ %16, %13 ]
br i1 %18, label %19, label %55
19: ; preds = %17
br label %20
20: ; preds = %32, %19
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = load i8*, i8** %4
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 44
br label %30
30: ; preds = %25, %20
%31 = phi i1 [ false, %20 ], [ %29, %25 ]
br i1 %31, label %32, label %35
32: ; preds = %30
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %4
br label %20
35: ; preds = %30
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = icmp ne i8 %37, 0
br i1 %38, label %39, label %54
39: ; preds = %35
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %4
%42 = load i8*, i8** %4
%43 = load i8, i8* %42
%44 = icmp ne i8 %43, 0
br i1 %44, label %45, label %53
45: ; preds = %39
%46 = load i8*, i8** %4
%47 = load double*, double** %5
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds double, double* %47, i64 %50
%52 = call i32 @sscanf(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %51)
br label %53
53: ; preds = %45, %39
br label %54
54: ; preds = %53, %35
br label %8
55: ; preds = %17
%56 = load i32, i32* %7
ret i32 %56
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define i32 @readNumberList(i8* nocapture %0, double* %1, i32 %2) {
%4 = load i8, i8* %0
%5 = icmp ne i8 %4, 0
%6 = icmp sgt i32 %2, 0
%7 = and i1 %5, %6
br i1 %7, label %8, label %31
8: ; preds = %3, %22
%9 = phi i8 [ %27, %22 ], [ %4, %3 ]
%10 = phi i32 [ %23, %22 ], [ 0, %3 ]
%11 = phi i8* [ %19, %22 ], [ %0, %3 ]
br label %12
12: ; preds = %8, %15
%13 = phi i8 [ %17, %15 ], [ %9, %8 ]
%14 = phi i8* [ %16, %15 ], [ %11, %8 ]
switch i8 %13, label %15 [
i8 0, label %31
i8 44, label %18
]
15: ; preds = %12
%16 = getelementptr inbounds i8, i8* %14, i64 1
%17 = load i8, i8* %16
br label %12
18: ; preds = %12
%19 = getelementptr inbounds i8, i8* %14, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %18
%23 = add nuw nsw i32 %10, 1
%24 = zext i32 %10 to i64
%25 = getelementptr inbounds double, double* %1, i64 %24
%26 = tail call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %25)
%27 = load i8, i8* %19
%28 = icmp ne i8 %27, 0
%29 = icmp slt i32 %23, %2
%30 = select i1 %28, i1 %29, i1 false
br i1 %30, label %8, label %31
31: ; preds = %18, %22, %12, %3
%32 = phi i32 [ 0, %3 ], [ %10, %12 ], [ %10, %18 ], [ %23, %22 ]
ret i32 %32
}