#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 scan_complex_interpolation_points(int n, char *points, double *cff) {
  int i;
  double c;
  char *ptr;
  ptr = points;
  for (i = 0; i < 2 * n; i++) {
    while (*ptr == ' ')
      ptr++;
    sscanf(&ptr[0], "%lf", &c);
    cff[i] = c;
    if (i < 2 * n - 1)
      while (*ptr != ' ')
        ptr++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<scan_complex_interpolation_points>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    11e1 <scan_complex_interpolation_points+0xd1>
jmp    1148 <scan_complex_interpolation_points+0x38>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1169 <scan_complex_interpolation_points+0x59>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1148 <scan_complex_interpolation_points+0x38>
mov    -0x30(%rbp),%rdi
lea    0xe8c(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <sscanf@plt>
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11ce <scan_complex_interpolation_points+0xbe>
jmp    11a8 <scan_complex_interpolation_points+0x98>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     11c9 <scan_complex_interpolation_points+0xb9>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11a8 <scan_complex_interpolation_points+0x98>
jmp    11ce <scan_complex_interpolation_points+0xbe>
jmp    11d3 <scan_complex_interpolation_points+0xc3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1132 <scan_complex_interpolation_points+0x22>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_complex_interpolation_points>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    118f <scan_complex_interpolation_points+0x7f>
mov    %rdx,%r14
mov    %rsi,%r12
add    %edi,%edi
lea    -0x1(%rdi),%eax
cmp    $0x2,%edi
mov    $0x1,%r13d
cmovge %edi,%r13d
movslq %eax,%rbp
xor    %r15d,%r15d
jmp    1149 <scan_complex_interpolation_points+0x39>
nop
add    $0x1,%r15
cmp    %r13,%r15
je     118f <scan_complex_interpolation_points+0x7f>
add    $0xffffffffffffffff,%r12
nopl   (%rax)
mov    %r12,%rbx
add    $0x1,%r12
cmpb   $0x20,0x1(%rbx)
je     1150 <scan_complex_interpolation_points+0x40>
mov    %r12,%rdi
lea    0xe99(%rip),%rsi
mov    %rsp,%rdx
call   1030 <sscanf@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r14,%r15,8)
cmp    %rbp,%r15
jge    1140 <scan_complex_interpolation_points+0x30>
nop
lea    0x1(%rbx),%r12
cmpb   $0x20,0x1(%rbx)
mov    %r12,%rbx
jne    1180 <scan_complex_interpolation_points+0x70>
jmp    1140 <scan_complex_interpolation_points+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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