#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ fatalx(char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ freeup(char **, int);
int /*<<< orphan*/ printf(char *, int, int, char *);
int splitup(char *, char **, int);
char *strdup(char *);
int getxxnamesf(char ***pnames, double **xx, int maxrow, int numcol,
                FILE *fff) {
  char line[10000];
  char *spt[50];
  char *sx;
  int nsplit, i, j, num = 0, maxff, numcolp;
  int nbad = 0;
  char **names;
  if (pnames != NULL)
    names = *pnames;
  numcolp = numcol + 1;
  maxff = ((50) < (numcolp) ? (numcolp) : (50));
  while (fgets(line, 10000, fff) != NULL) {
    nsplit = splitup(line, spt, maxff);
    if (nsplit == 0) {
      freeup(spt, nsplit);
      continue;
    }
    sx = spt[0];
    if (sx[0] == '#') {
      freeup(spt, nsplit);
      continue;
    }
    if (names != NULL)
      names[num] = strdup(sx);
    if (nsplit < numcolp) {
      ++nbad;
      if (nbad < 10)
        printf("+++ bad line: nsplit: %d numcol: %d\n%s\n", nsplit, numcol,
               line);
      continue;
    }
    if (num >= maxrow)
      fatalx("too much data\n");
    for (i = 0; i < numcol; i++) {
      xx[i][num] = atof(spt[i + 1]);
    }
    freeup(spt, nsplit);
    ++num;
  }
  return num;
}


x86 assembly (clang, -O0):
<getxxnamesf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2900,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x28d8(%rbp)
movl   $0x0,-0x28e4(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11ba <getxxnamesf+0x4a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28f0(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28e0(%rbp)
mov    $0x32,%eax
cmp    -0x28e0(%rbp),%eax
jge    11e8 <getxxnamesf+0x78>
mov    -0x28e0(%rbp),%eax
mov    %eax,-0x28f4(%rbp)
jmp    11f8 <getxxnamesf+0x88>
mov    $0x32,%eax
mov    %eax,-0x28f4(%rbp)
jmp    11f8 <getxxnamesf+0x88>
mov    -0x28f4(%rbp),%eax
mov    %eax,-0x28dc(%rbp)
lea    -0x2730(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x2710,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     13bd <getxxnamesf+0x24d>
lea    -0x2730(%rbp),%rdi
lea    -0x28c0(%rbp),%rsi
mov    -0x28dc(%rbp),%edx
call   1050 <splitup@plt>
mov    %eax,-0x28cc(%rbp)
cmpl   $0x0,-0x28cc(%rbp)
jne    1266 <getxxnamesf+0xf6>
lea    -0x28c0(%rbp),%rdi
mov    -0x28cc(%rbp),%esi
call   1080 <freeup@plt>
jmp    1204 <getxxnamesf+0x94>
mov    -0x28c0(%rbp),%rax
mov    %rax,-0x28c8(%rbp)
mov    -0x28c8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    129e <getxxnamesf+0x12e>
lea    -0x28c0(%rbp),%rdi
mov    -0x28cc(%rbp),%esi
call   1080 <freeup@plt>
jmp    1204 <getxxnamesf+0x94>
cmpq   $0x0,-0x28f0(%rbp)
je     12cd <getxxnamesf+0x15d>
mov    -0x28c8(%rbp),%rdi
call   1090 <strdup@plt>
mov    %rax,%rdx
mov    -0x28f0(%rbp),%rax
movslq -0x28d8(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28cc(%rbp),%eax
cmp    -0x28e0(%rbp),%eax
jge    131c <getxxnamesf+0x1ac>
mov    -0x28e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28e4(%rbp)
cmpl   $0xa,-0x28e4(%rbp)
jge    1317 <getxxnamesf+0x1a7>
mov    -0x28cc(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0x2730(%rbp),%rcx
lea    0xcee(%rip),%rdi
call   1060 <printf@plt>
jmp    1204 <getxxnamesf+0x94>
mov    -0x28d8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     1337 <getxxnamesf+0x1c7>
lea    0xcf6(%rip),%rdi
call   1030 <fatalx@plt>
movl   $0x0,-0x28d0(%rbp)
mov    -0x28d0(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1397 <getxxnamesf+0x227>
mov    -0x28d0(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x28c0(%rbp,%rax,8),%rdi
ff
call   1040 <atof@plt>
mov    -0x10(%rbp),%rax
movslq -0x28d0(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28d8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28d0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28d0(%rbp)
jmp    1341 <getxxnamesf+0x1d1>
lea    -0x28c0(%rbp),%rdi
mov    -0x28cc(%rbp),%esi
call   1080 <freeup@plt>
mov    -0x28d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28d8(%rbp)
jmp    1204 <getxxnamesf+0x94>
mov    -0x28d8(%rbp),%eax
add    $0x2900,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getxxnamesf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28e8,%rsp
mov    %r8,%r13
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %rsi,%rbx
test   %rdi,%rdi
je     119c <getxxnamesf+0x2c>
mov    (%rdi),%rax
mov    %rax,0x18(%rsp)
jmp    119c <getxxnamesf+0x2c>
cmp    $0x32,%r15d
mov    $0x31,%ebp
cmovge %r15d,%ebp
lea    0x1d0(%rsp),%rdi
mov    $0x2710,%esi
mov    %r13,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1346 <getxxnamesf+0x1d6>
mov    %rbx,0x38(%rsp)
add    $0x1,%ebp
movslq %r14d,%rax
mov    %rax,0x28(%rsp)
mov    %r15d,%eax
mov    %rax,0x30(%rsp)
xor    %eax,%eax
lea    0x1d0(%rsp),%rbx
lea    0x40(%rsp),%r14
movl   $0x0,0x4(%rsp)
mov    %rax,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1050 <splitup@plt>
test   %eax,%eax
je     1270 <getxxnamesf+0x100>
mov    %eax,%r12d
mov    0x40(%rsp),%rdi
cmpb   $0x23,(%rdi)
je     1273 <getxxnamesf+0x103>
cmpq   $0x0,0x18(%rsp)
je     1239 <getxxnamesf+0xc9>
call   1090 <strdup@plt>
mov    0x18(%rsp),%rcx
mov    0x8(%rsp),%rdx
mov    %rax,(%rcx,%rdx,8)
cmp    %r15d,%r12d
jg     129c <getxxnamesf+0x12c>
mov    0x4(%rsp),%eax
cmp    $0x8,%eax
jg     1260 <getxxnamesf+0xf0>
lea    0xdb2(%rip),%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %rbx,%rcx
call   1060 <printf@plt>
mov    0x4(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x4(%rsp)
jmp    127e <getxxnamesf+0x10e>
nopl   0x0(%rax)
xor    %r12d,%r12d
mov    %r14,%rdi
mov    %r12d,%esi
call   1080 <freeup@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r13,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
jne    1200 <getxxnamesf+0x90>
jmp    133f <getxxnamesf+0x1cf>
mov    0x28(%rsp),%rax
cmp    %rax,0x8(%rsp)
jl     12b4 <getxxnamesf+0x144>
lea    0xd79(%rip),%rdi
call   1030 <fatalx@plt>
mov    %r15d,0x14(%rsp)
test   %r15d,%r15d
jle    1308 <getxxnamesf+0x198>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%r15),%rax
mov    %rax,0x20(%rsp)
mov    0x48(%rsp,%r15,8),%rdi
call   1040 <atof@plt>
mov    0x38(%rsp),%rdx
mov    (%rdx,%r15,8),%rax
mov    0x8(%rsp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x30(%rsp),%rax
mov    0x20(%rsp),%rcx
mov    %rcx,%r15
cmp    %rcx,%rax
jne    12d0 <getxxnamesf+0x160>
mov    %r14,%rdi
mov    %r12d,%esi
call   1080 <freeup@plt>
mov    0x8(%rsp),%r12
add    $0x1,%r12
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r13,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
mov    0x14(%rsp),%r15d
mov    %r12,%rax
jne    11f6 <getxxnamesf+0x86>
jmp    1348 <getxxnamesf+0x1d8>
mov    0x8(%rsp),%rax
jmp    1348 <getxxnamesf+0x1d8>
xor    %eax,%eax
add    $0x28e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"+++ bad line: nsplit: %d numcol: %d\0A%s\0A\00"
@.str.1 = [15 x i8] c"too much data\0A\00"
define i32 @getxxnamesf(i8*** %0, double** %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i8***
%7 = alloca double**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca [10000 x i8]
%12 = alloca [50 x i8*]
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8**
store i8*** %0, i8**** %6
store double** %1, double*** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
store i32 0, i32* %17
store i32 0, i32* %20
%22 = load i8***, i8**** %6
%23 = icmp ne i8*** %22, null
br i1 %23, label %24, label %27
24: ; preds = %5
%25 = load i8***, i8**** %6
%26 = load i8**, i8*** %25
store i8** %26, i8*** %21
br label %27
27: ; preds = %24, %5
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 1
store i32 %29, i32* %19
%30 = load i32, i32* %19
%31 = icmp slt i32 50, %30
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = load i32, i32* %19
br label %35
34: ; preds = %27
br label %35
35: ; preds = %34, %32
%36 = phi i32 [ %33, %32 ], [ 50, %34 ]
store i32 %36, i32* %18
br label %37
37: ; preds = %119, %89, %61, %49, %35
%38 = getelementptr inbounds [10000 x i8], [10000 x i8]* %11, i64 0, i64 0
%39 = load i32*, i32** %10
%40 = call i32* @fgets(i8* %38, i32 10000, i32* %39)
%41 = icmp ne i32* %40, null
br i1 %41, label %42, label %125
42: ; preds = %37
%43 = getelementptr inbounds [10000 x i8], [10000 x i8]* %11, i64 0, i64 0
%44 = getelementptr inbounds [50 x i8*], [50 x i8*]* %12, i64 0, i64 0
%45 = load i32, i32* %18
%46 = call i32 @splitup(i8* %43, i8** %44, i32 %45)
store i32 %46, i32* %14
%47 = load i32, i32* %14
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %42
%50 = getelementptr inbounds [50 x i8*], [50 x i8*]* %12, i64 0, i64 0
%51 = load i32, i32* %14
%52 = call i32 @freeup(i8** %50, i32 %51)
br label %37
53: ; preds = %42
%54 = getelementptr inbounds [50 x i8*], [50 x i8*]* %12, i64 0, i64 0
%55 = load i8*, i8** %54
store i8* %55, i8** %13
%56 = load i8*, i8** %13
%57 = getelementptr inbounds i8, i8* %56, i64 0
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 35
br i1 %60, label %61, label %65
61: ; preds = %53
%62 = getelementptr inbounds [50 x i8*], [50 x i8*]* %12, i64 0, i64 0
%63 = load i32, i32* %14
%64 = call i32 @freeup(i8** %62, i32 %63)
br label %37
65: ; preds = %53
%66 = load i8**, i8*** %21
%67 = icmp ne i8** %66, null
br i1 %67, label %68, label %75
68: ; preds = %65
%69 = load i8*, i8** %13
%70 = call i8* @strdup(i8* %69)
%71 = load i8**, i8*** %21
%72 = load i32, i32* %17
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8*, i8** %71, i64 %73
store i8* %70, i8** %74
br label %75
75: ; preds = %68, %65
%76 = load i32, i32* %14
%77 = load i32, i32* %19
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %90
79: ; preds = %75
%80 = load i32, i32* %20
%81 = add nsw i32 %80, 1
store i32 %81, i32* %20
%82 = load i32, i32* %20
%83 = icmp slt i32 %82, 10
br i1 %83, label %84, label %89
84: ; preds = %79
%85 = load i32, i32* %14
%86 = load i32, i32* %9
%87 = getelementptr inbounds [10000 x i8], [10000 x i8]* %11, i64 0, i64 0
%88 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %85, i32 %86, i8* %87)
br label %89
89: ; preds = %84, %79
br label %37
90: ; preds = %75
%91 = load i32, i32* %17
%92 = load i32, i32* %8
%93 = icmp sge i32 %91, %92
br i1 %93, label %94, label %96
94: ; preds = %90
%95 = call i32 @fatalx(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %96
96: ; preds = %94, %90
store i32 0, i32* %15
br label %97
97: ; preds = %116, %96
%98 = load i32, i32* %15
%99 = load i32, i32* %9
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %119
101: ; preds = %97
%102 = load i32, i32* %15
%103 = add nsw i32 %102, 1
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [50 x i8*], [50 x i8*]* %12, i64 0, i64 %104
%106 = load i8*, i8** %105
%107 = call double @atof(i8* %106)
%108 = load double**, double*** %7
%109 = load i32, i32* %15
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double*, double** %108, i64 %110
%112 = load double*, double** %111
%113 = load i32, i32* %17
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double, double* %112, i64 %114
store double %107, double* %115
br label %116
116: ; preds = %101
%117 = load i32, i32* %15
%118 = add nsw i32 %117, 1
store i32 %118, i32* %15
br label %97
119: ; preds = %97
%120 = getelementptr inbounds [50 x i8*], [50 x i8*]* %12, i64 0, i64 0
%121 = load i32, i32* %14
%122 = call i32 @freeup(i8** %120, i32 %121)
%123 = load i32, i32* %17
%124 = add nsw i32 %123, 1
store i32 %124, i32* %17
br label %37
125: ; preds = %37
%126 = load i32, i32* %17
ret i32 %126
}

LLVM IR (-O2):
@.str = [40 x i8] c"+++ bad line: nsplit: %d numcol: %d\0A%s\0A\00"
@.str.1 = [15 x i8] c"too much data\0A\00"
define i32 @getxxnamesf(i8*** %0, double** nocapture %1, i32 %2, i32 %3, i32* nocapture %4) {
%6 = alloca [10000 x i8]
%7 = alloca [50 x i8*]
%8 = getelementptr inbounds [10000 x i8], [10000 x i8]* %6, i64 0, i64 0
%9 = bitcast [50 x i8*]* %7 to i8*
%10 = icmp eq i8*** %0, null
br i1 %10, label %13, label %11
11: ; preds = %5
%12 = load i8**, i8*** %0
br label %13
13: ; preds = %11, %5
%14 = phi i8** [ %12, %11 ], [ undef, %5 ]
%15 = icmp sgt i32 %3, 49
%16 = select i1 %15, i32 %3, i32 49
%17 = add nuw nsw i32 %16, 1
%18 = call i32* @fgets(i8* %8, i32 10000, i32* %4)
%19 = icmp eq i32* %18, null
br i1 %19, label %83, label %20
20: ; preds = %13
%21 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 0
%22 = icmp eq i8** %14, null
%23 = icmp sgt i32 %3, 0
%24 = sext i32 %2 to i64
%25 = zext i32 %3 to i64
br label %26
26: ; preds = %20, %72
%27 = phi i64 [ 0, %20 ], [ %74, %72 ]
%28 = phi i32 [ 0, %20 ], [ %31, %72 ]
%29 = getelementptr inbounds i8*, i8** %14, i64 %27
br label %30
30: ; preds = %26, %54
%31 = phi i32 [ %28, %26 ], [ %50, %54 ]
br label %32
32: ; preds = %30, %35
%33 = call i32 @splitup(i8* %8, i8** %21, i32 %17)
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %32, %40
%36 = phi i32 [ %33, %40 ], [ 0, %32 ]
%37 = call i32 @freeup(i8** %21, i32 %36)
%38 = call i32* @fgets(i8* %8, i32 10000, i32* %4)
%39 = icmp eq i32* %38, null
br i1 %39, label %77, label %32
40: ; preds = %32
%41 = load i8*, i8** %21
%42 = load i8, i8* %41
%43 = icmp eq i8 %42, 35
br i1 %43, label %35, label %44
44: ; preds = %40
br i1 %22, label %47, label %45
45: ; preds = %44
%46 = call i8* @strdup(i8* %41)
store i8* %46, i8** %29
br label %47
47: ; preds = %45, %44
%48 = icmp sgt i32 %33, %3
br i1 %48, label %57, label %49
49: ; preds = %47
%50 = add nsw i32 %31, 1
%51 = icmp slt i32 %31, 9
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %3, i8* %8)
br label %54
54: ; preds = %52, %49
%55 = call i32* @fgets(i8* %8, i32 10000, i32* %4)
%56 = icmp eq i32* %55, null
br i1 %56, label %79, label %30
57: ; preds = %47
%58 = icmp slt i64 %27, %24
br i1 %58, label %61, label %59
59: ; preds = %57
%60 = call i32 @fatalx(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %61
61: ; preds = %59, %57
br i1 %23, label %62, label %72
62: ; preds = %61, %62
%63 = phi i64 [ %64, %62 ], [ 0, %61 ]
%64 = add nuw nsw i64 %63, 1
%65 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 %64
%66 = load i8*, i8** %65
%67 = call double @atof(i8* %66)
%68 = getelementptr inbounds double*, double** %1, i64 %63
%69 = load double*, double** %68
%70 = getelementptr inbounds double, double* %69, i64 %27
store double %67, double* %70
%71 = icmp eq i64 %64, %25
br i1 %71, label %72, label %62
72: ; preds = %62, %61
%73 = call i32 @freeup(i8** %21, i32 %33)
%74 = add nuw i64 %27, 1
%75 = call i32* @fgets(i8* %8, i32 10000, i32* %4)
%76 = icmp eq i32* %75, null
br i1 %76, label %81, label %26
77: ; preds = %35
%78 = trunc i64 %27 to i32
br label %83
79: ; preds = %54
%80 = trunc i64 %27 to i32
br label %83
81: ; preds = %72
%82 = trunc i64 %74 to i32
br label %83
83: ; preds = %81, %79, %77, %13
%84 = phi i32 [ 0, %13 ], [ %78, %77 ], [ %80, %79 ], [ %82, %81 ]
ret i32 %84
}