int read_n_columns(char *arg, int *n, double ***data) {
  char **L;
  int i, nr, nrec, ncol;
  double *dp;
  *n = str_parseline(arg, &L, ':');
  if (*n <= 1)
    goto invalid_format;
  (*n)--;
  *data = xmalloc(sizeof(double *) * (*n));
  nrec = -1;
  for (i = 0; i < (*n); i++) {
    ncol = atoi(L[i + 1]);
    nr = read_column(L[0], ncol, &dp);
    if (i > 1 && nr != nrec)
      error1("different number of rows for different columns\n");
    nrec = nr;
    (*data)[i] = dp;
    free(L[i + 1]);
  }
  free(L[0]);
  free(L);
  return nrec;
invalid_format:
  warning1("invalid file:column1[:column2[:...]] specification '%s'\n", arg);
  free(L);
  return -1;
}


x86 assembly (clang, -O0):
<read_n_columns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x3a,%edx
mov    $0x0,%al
call   1070 <str_parseline@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x1,(%rax)
jg     11b2 <read_n_columns+0x42>
jmp    12aa <read_n_columns+0x13a>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movslq (%rax),%rdi
shl    $0x3,%rdi
mov    $0x0,%al
call   1050 <xmalloc@plt>
movslq %eax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0xffffffff,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    128a <read_n_columns+0x11a>
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1080 <atoi@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
mov    -0x38(%rbp),%esi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1040 <read_column@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jle    124d <read_n_columns+0xdd>
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
je     124d <read_n_columns+0xdd>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1090 <error1@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x40(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movslq -0x2c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e7 <read_n_columns+0x77>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12cc <read_n_columns+0x15c>
mov    -0x10(%rbp),%rsi
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1060 <warning1@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_n_columns>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%rbp
lea    0x8(%rsp),%rsi
mov    $0x3a,%edx
xor    %eax,%eax
call   1070 <str_parseline@plt>
mov    %eax,0x0(%r13)
cmp    $0x2,%eax
jge    11bd <read_n_columns+0x4d>
lea    0xe88(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <warning1@plt>
mov    $0xffffffff,%r15d
jmp    1276 <read_n_columns+0x106>
add    $0xffffffff,%eax
mov    %eax,0x0(%r13)
shl    $0x3,%rax
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <xmalloc@plt>
cltq
mov    %rax,(%r14)
cmpl   $0x0,0x0(%r13)
jle    1263 <read_n_columns+0xf3>
mov    $0xffffffff,%ebp
xor    %r12d,%r12d
jmp    1217 <read_n_columns+0xa7>
nopl   0x0(%rax)
mov    0x10(%rsp),%rax
mov    (%r14),%rcx
mov    %rax,(%rcx,%rbx,8)
mov    0x8(%rsp),%rax
mov    0x8(%rax,%rbx,8),%rdi
call   1030 <free@plt>
movslq 0x0(%r13),%rax
mov    %r15d,%ebp
cmp    %rax,%r12
jge    1269 <read_n_columns+0xf9>
mov    %r12,%rbx
mov    0x8(%rsp),%rax
add    $0x1,%r12
mov    0x8(%rax,%rbx,8),%rdi
xor    %eax,%eax
call   1080 <atoi@plt>
mov    0x8(%rsp),%rcx
mov    (%rcx),%rdi
mov    %eax,%esi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <read_column@plt>
mov    %eax,%r15d
cmp    $0x2,%rbx
jb     11f0 <read_n_columns+0x80>
cmp    %ebp,%r15d
je     11f0 <read_n_columns+0x80>
lea    0xda6(%rip),%rdi
xor    %eax,%eax
call   1090 <error1@plt>
jmp    11f0 <read_n_columns+0x80>
mov    $0xffffffff,%r15d
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"different number of rows for different columns\0A\00"
@.str.1 = [57 x i8] c"invalid file:column1[:column2[:...]] specification '%s'\0A\00"
define i32 @read_n_columns(i8* %0, i32* %1, double*** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca double***
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
store i8* %0, i8** %5
store i32* %1, i32** %6
store double*** %2, double**** %7
%14 = load i8*, i8** %5
%15 = call i32 (i8*, i8***, i32, ...) bitcast (i32 (...)* @str_parseline to i32 (i8*, i8***, i32, ...)*)(i8* %14, i8*** %8, i32 58)
%16 = load i32*, i32** %6
store i32 %15, i32* %16
%17 = load i32*, i32** %6
%18 = load i32, i32* %17
%19 = icmp sle i32 %18, 1
br i1 %19, label %20, label %21
20: ; preds = %3
br label %83
21: ; preds = %3
%22 = load i32*, i32** %6
%23 = load i32, i32* %22
%24 = add nsw i32 %23, -1
store i32 %24, i32* %22
%25 = load i32*, i32** %6
%26 = load i32, i32* %25
%27 = sext i32 %26 to i64
%28 = mul i64 8, %27
%29 = call i32 (i64, ...) bitcast (i32 (...)* @xmalloc to i32 (i64, ...)*)(i64 %28)
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to double**
%32 = load double***, double**** %7
store double** %31, double*** %32
store i32 -1, i32* %11
store i32 0, i32* %9
br label %33
33: ; preds = %73, %21
%34 = load i32, i32* %9
%35 = load i32*, i32** %6
%36 = load i32, i32* %35
%37 = icmp slt i32 %34, %36
br i1 %37, label %38, label %76
38: ; preds = %33
%39 = load i8**, i8*** %8
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %39, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %44)
store i32 %45, i32* %12
%46 = load i8**, i8*** %8
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = load i32, i32* %12
%50 = call i32 (i8*, i32, double**, ...) bitcast (i32 (...)* @read_column to i32 (i8*, i32, double**, ...)*)(i8* %48, i32 %49, double** %13)
store i32 %50, i32* %10
%51 = load i32, i32* %9
%52 = icmp sgt i32 %51, 1
br i1 %52, label %53, label %59
53: ; preds = %38
%54 = load i32, i32* %10
%55 = load i32, i32* %11
%56 = icmp ne i32 %54, %55
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 (i8*, ...) bitcast (i32 (...)* @error1 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %59
59: ; preds = %57, %53, %38
%60 = load i32, i32* %10
store i32 %60, i32* %11
%61 = load double*, double** %13
%62 = load double***, double**** %7
%63 = load double**, double*** %62
%64 = load i32, i32* %9
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double*, double** %63, i64 %65
store double* %61, double** %66
%67 = load i8**, i8*** %8
%68 = load i32, i32* %9
%69 = add nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %67, i64 %70
%72 = load i8*, i8** %71
br label %73
73: ; preds = %59
%74 = load i32, i32* %9
%75 = add nsw i32 %74, 1
store i32 %75, i32* %9
br label %33
76: ; preds = %33
%77 = load i8**, i8*** %8
%78 = getelementptr inbounds i8*, i8** %77, i64 0
%79 = load i8*, i8** %78
%80 = load i8**, i8*** %8
%81 = bitcast i8** %80 to i8*
%82 = load i32, i32* %11
store i32 %82, i32* %4
br label %88
83: ; preds = %20
%84 = load i8*, i8** %5
%85 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @warning1 to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i8* %84)
%86 = load i8**, i8*** %8
%87 = bitcast i8** %86 to i8*
store i32 -1, i32* %4
br label %88
88: ; preds = %83, %76
%89 = load i32, i32* %4
ret i32 %89
}

LLVM IR (-O2):
@.str = [48 x i8] c"different number of rows for different columns\0A\00"
@.str.1 = [57 x i8] c"invalid file:column1[:column2[:...]] specification '%s'\0A\00"
define i32 @read_n_columns(i8* %0, i32* nocapture %1, double*** nocapture %2) {
%4 = alloca i8**
%5 = alloca double*
%6 = bitcast i8*** %4 to i8*
%7 = bitcast double** %5 to i8*
%8 = call i32 (i8*, i8***, i32, ...) bitcast (i32 (...)* @str_parseline to i32 (i8*, i8***, i32, ...)*)(i8* %0, i8*** %4, i32 58)
store i32 %8, i32* %1
%9 = icmp slt i32 %8, 2
br i1 %9, label %49, label %10
10: ; preds = %3
%11 = add nsw i32 %8, -1
store i32 %11, i32* %1
%12 = zext i32 %11 to i64
%13 = shl nuw nsw i64 %12, 3
%14 = call i32 (i64, ...) bitcast (i32 (...)* @xmalloc to i32 (i64, ...)*)(i64 %13)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to double**
store double** %16, double*** %2
%17 = load i32, i32* %1
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %45
19: ; preds = %10, %35
%20 = phi i64 [ %23, %35 ], [ 0, %10 ]
%21 = phi i32 [ %29, %35 ], [ -1, %10 ]
%22 = load i8**, i8*** %4
%23 = add nuw nsw i64 %20, 1
%24 = getelementptr inbounds i8*, i8** %22, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %25)
%27 = load i8**, i8*** %4
%28 = load i8*, i8** %27
%29 = call i32 (i8*, i32, double**, ...) bitcast (i32 (...)* @read_column to i32 (i8*, i32, double**, ...)*)(i8* %28, i32 %26, double** %5)
%30 = icmp ult i64 %20, 2
%31 = icmp eq i32 %29, %21
%32 = select i1 %30, i1 true, i1 %31
br i1 %32, label %35, label %33
33: ; preds = %19
%34 = call i32 (i8*, ...) bitcast (i32 (...)* @error1 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %35
35: ; preds = %33, %19
%36 = load double*, double** %5
%37 = load double**, double*** %2
%38 = getelementptr inbounds double*, double** %37, i64 %20
store double* %36, double** %38
%39 = load i8**, i8*** %4
%40 = getelementptr inbounds i8*, i8** %39, i64 %23
%41 = load i8*, i8** %40
%42 = load i32, i32* %1
%43 = sext i32 %42 to i64
%44 = icmp slt i64 %23, %43
br i1 %44, label %19, label %45
45: ; preds = %35, %10
%46 = phi i32 [ -1, %10 ], [ %29, %35 ]
%47 = load i8**, i8*** %4
%48 = load i8*, i8** %47
br label %51
49: ; preds = %3
%50 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @warning1 to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %51
51: ; preds = %49, %45
%52 = phi i32 [ -1, %49 ], [ %46, %45 ]
%53 = bitcast i8*** %4 to i8**
%54 = load i8*, i8** %53
ret i32 %52
}