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


x86 assembly (clang, -O0):
<scan_input_planes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11e6 <scan_input_planes+0xd6>
jmp    114c <scan_input_planes+0x3c>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    116d <scan_input_planes+0x5d>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    114c <scan_input_planes+0x3c>
mov    -0x30(%rbp),%rdi
lea    0xe88(%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
imul   -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11d3 <scan_input_planes+0xc3>
jmp    11ad <scan_input_planes+0x9d>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     11ce <scan_input_planes+0xbe>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11ad <scan_input_planes+0x9d>
jmp    11d3 <scan_input_planes+0xc3>
jmp    11d8 <scan_input_planes+0xc8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1135 <scan_input_planes+0x25>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_input_planes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
imul   %esi,%edi
test   %edi,%edi
jle    118f <scan_input_planes+0x7f>
mov    %rcx,%r14
mov    %rdx,%r12
lea    -0x1(%rdi),%r13d
mov    %edi,%ebp
xor    %r15d,%r15d
jmp    1149 <scan_input_planes+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15
cmp    %rbp,%r15
je     118f <scan_input_planes+0x7f>
add    $0xffffffffffffffff,%r12
nopl   (%rax)
mov    %r12,%rbx
add    $0x1,%r12
cmpb   $0x20,0x1(%rbx)
je     1150 <scan_input_planes+0x40>
mov    %r12,%rdi
lea    0xe99(%rip),%rsi
mov    %rsp,%rdx
call   1030 <sscanf@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r14,%r15,8)
cmp    %r13,%r15
jae    1140 <scan_input_planes+0x30>
nop
lea    0x1(%rbx),%r12
cmpb   $0x20,0x1(%rbx)
mov    %r12,%rbx
jne    1180 <scan_input_planes+0x70>
jmp    1140 <scan_input_planes+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_input_planes(i32 %0, i32 %1, i8* %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store double* %3, double** %8
%12 = load i8*, i8** %7
store i8* %12, i8** %11
store i32 0, i32* %9
br label %13
13: ; preds = %54, %4
%14 = load i32, i32* %9
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = mul nsw i32 %15, %16
%18 = icmp slt i32 %14, %17
br i1 %18, label %19, label %57
19: ; preds = %13
br label %20
20: ; preds = %25, %19
%21 = load i8*, i8** %11
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %11
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %11
br label %20
28: ; preds = %20
%29 = load i8*, i8** %11
%30 = getelementptr inbounds i8, i8* %29, i64 0
%31 = call i32 @sscanf(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %10)
%32 = load double, double* %10
%33 = load double*, double** %8
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
store double %32, double* %36
%37 = load i32, i32* %9
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = mul nsw i32 %38, %39
%41 = sub nsw i32 %40, 1
%42 = icmp slt i32 %37, %41
br i1 %42, label %43, label %53
43: ; preds = %28
br label %44
44: ; preds = %49, %43
%45 = load i8*, i8** %11
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 32
br i1 %48, label %49, label %52
49: ; preds = %44
%50 = load i8*, i8** %11
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %11
br label %44
52: ; preds = %44
br label %53
53: ; preds = %52, %28
br label %54
54: ; preds = %53
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %13
57: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define i32 @scan_input_planes(i32 %0, i32 %1, i8* nocapture %2, double* nocapture writeonly %3) {
%5 = alloca double
%6 = bitcast double* %5 to i8*
%7 = mul i32 %1, %0
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %35
9: ; preds = %4
%10 = add nsw i32 %7, -1
%11 = zext i32 %10 to i64
%12 = zext i32 %7 to i64
br label %13
13: ; preds = %9, %31
%14 = phi i64 [ 0, %9 ], [ %33, %31 ]
%15 = phi i8* [ %2, %9 ], [ %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* %5)
%23 = load double, double* %5
%24 = getelementptr inbounds double, double* %3, i64 %14
store double %23, double* %24
%25 = icmp ult i64 %14, %11
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, %4
ret i32 0
}