#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ freeup(char **, int);
int /*<<< orphan*/ openit(char *, int /*<<< orphan*/ **, char *);
int /*<<< orphan*/ printf(char *, int, int, char *);
int splitup(char *, char **, int);
int /*<<< orphan*/ *stdin;
int getxx(double **xx, int maxrow, int numcol, char *fname) {
  char line[10000];
  char *spt[50];
  char *sx;
  int nsplit, i, j, num = 0, maxff;
  FILE *fff;
  int nbad = 0;
  if (fname == NULL)
    fff = stdin;
  else {
    openit(fname, &fff, "r");
  }
  maxff = ((50) < (numcol) ? (numcol) : (50));
  while (fgets(line, 10000, fff) != NULL) {
    nsplit = splitup(line, spt, maxff);
    sx = spt[0];
    if (sx[0] == '#') {
      freeup(spt, nsplit);
      continue;
    }
    if (nsplit < numcol) {
      ++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]);
    }
    freeup(spt, nsplit);
    ++num;
  }
  if (fname != NULL)
    fclose(fff);
  return num;
}


x86 assembly (clang, -O0):
<getxx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x28f0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x28d8(%rbp)
movl   $0x0,-0x28ec(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11ce <getxx+0x4e>
mov    0x2e29(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28e8(%rbp)
jmp    11e5 <getxx+0x65>
mov    -0x18(%rbp),%rdi
lea    -0x28e8(%rbp),%rsi
lea    0xe20(%rip),%rdx
call   10a0 <openit@plt>
mov    $0x32,%eax
cmp    -0x10(%rbp),%eax
jge    1201 <getxx+0x81>
mov    -0x10(%rbp),%eax
mov    %eax,-0x28f0(%rbp)
jmp    1211 <getxx+0x91>
mov    $0x32,%eax
mov    %eax,-0x28f0(%rbp)
jmp    1211 <getxx+0x91>
mov    -0x28f0(%rbp),%eax
mov    %eax,-0x28dc(%rbp)
lea    -0x2730(%rbp),%rdi
mov    -0x28e8(%rbp),%rdx
mov    $0x2710,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     137f <getxx+0x1ff>
lea    -0x2730(%rbp),%rdi
lea    -0x28c0(%rbp),%rsi
mov    -0x28dc(%rbp),%edx
call   1050 <splitup@plt>
mov    %eax,-0x28cc(%rbp)
mov    -0x28c0(%rbp),%rax
mov    %rax,-0x28c8(%rbp)
mov    -0x28c8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    1296 <getxx+0x116>
lea    -0x28c0(%rbp),%rdi
mov    -0x28cc(%rbp),%esi
call   1090 <freeup@plt>
jmp    121d <getxx+0x9d>
mov    -0x28cc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12e2 <getxx+0x162>
mov    -0x28ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28ec(%rbp)
cmpl   $0xa,-0x28ec(%rbp)
jge    12dd <getxx+0x15d>
mov    -0x28cc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0x2730(%rbp),%rcx
lea    0xd2a(%rip),%rdi
call   1070 <printf@plt>
jmp    121d <getxx+0x9d>
mov    -0x28d8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     12fd <getxx+0x17d>
lea    0xd32(%rip),%rdi
call   1030 <fatalx@plt>
movl   $0x0,-0x28d0(%rbp)
mov    -0x28d0(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1359 <getxx+0x1d9>
movslq -0x28d0(%rbp),%rax
mov    -0x28c0(%rbp,%rax,8),%rdi
ff
call   1040 <atof@plt>
mov    -0x8(%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    1307 <getxx+0x187>
lea    -0x28c0(%rbp),%rdi
mov    -0x28cc(%rbp),%esi
call   1090 <freeup@plt>
mov    -0x28d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28d8(%rbp)
jmp    121d <getxx+0x9d>
cmpq   $0x0,-0x18(%rbp)
je     1396 <getxx+0x216>
mov    -0x28e8(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28d8(%rbp),%eax
add    $0x28f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getxx>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28e8,%rsp
mov    %rcx,%r13
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%r15
test   %rcx,%rcx
je     11bc <getxx+0x3c>
lea    0xe58(%rip),%rdx
lea    0x10(%rsp),%rsi
mov    %r13,%rdi
call   10a0 <openit@plt>
mov    0x10(%rsp),%rdx
jmp    11cb <getxx+0x4b>
mov    0x2e25(%rip),%rax
mov    (%rax),%rdx
mov    %rdx,0x10(%rsp)
cmp    $0x33,%ebp
mov    $0x32,%ebx
cmovge %ebp,%ebx
lea    0x1d0(%rsp),%rdi
mov    $0x2710,%esi
call   1080 <fgets@plt>
test   %rax,%rax
je     135a <getxx+0x1da>
mov    %r15,0x38(%rsp)
movslq %r14d,%rax
mov    %rax,0x28(%rsp)
mov    %ebp,0xc(%rsp)
mov    %ebp,%eax
mov    %rax,0x30(%rsp)
xor    %r15d,%r15d
lea    0x1d0(%rsp),%rbp
lea    0x40(%rsp),%r14
xor    %r12d,%r12d
mov    %r15,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <splitup@plt>
mov    %eax,%r15d
mov    0x40(%rsp),%rax
cmpb   $0x23,(%rax)
jne    1271 <getxx+0xf1>
mov    %r14,%rdi
mov    %r15d,%esi
call   1090 <freeup@plt>
mov    0x10(%rsp),%rdx
mov    %rbp,%rdi
mov    $0x2710,%esi
call   1080 <fgets@plt>
test   %rax,%rax
jne    1230 <getxx+0xb0>
jmp    1331 <getxx+0x1b1>
cmp    0xc(%rsp),%r15d
jge    129a <getxx+0x11a>
cmp    $0x8,%r12d
jg     1294 <getxx+0x114>
lea    0xd7d(%rip),%rdi
mov    %r15d,%esi
mov    0xc(%rsp),%edx
mov    %rbp,%rcx
call   1070 <printf@plt>
add    $0x1,%r12d
jmp    1255 <getxx+0xd5>
mov    %r13,0x20(%rsp)
mov    0x28(%rsp),%rax
cmp    %rax,0x18(%rsp)
jl     12b7 <getxx+0x137>
lea    0xd78(%rip),%rdi
call   1030 <fatalx@plt>
cmpl   $0x0,0xc(%rsp)
jle    12fb <getxx+0x17b>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x40(%rsp,%r13,8),%rdi
call   1040 <atof@plt>
mov    0x38(%rsp),%rdx
mov    (%rdx,%r13,8),%rax
mov    0x18(%rsp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x30(%rsp),%rax
add    $0x1,%r13
cmp    %r13,%rax
jne    12d0 <getxx+0x150>
mov    %r14,%rdi
mov    %r15d,%esi
call   1090 <freeup@plt>
mov    0x18(%rsp),%r15
add    $0x1,%r15
mov    0x10(%rsp),%rdx
mov    %rbp,%rdi
mov    $0x2710,%esi
call   1080 <fgets@plt>
test   %rax,%rax
mov    0x20(%rsp),%r13
jne    121c <getxx+0x9c>
jmp    1336 <getxx+0x1b6>
mov    0x18(%rsp),%r15
test   %r13,%r13
je     1345 <getxx+0x1c5>
mov    0x10(%rsp),%rdi
call   1060 <fclose@plt>
mov    %r15d,%eax
add    $0x28e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r15d,%r15d
test   %r13,%r13
jne    133b <getxx+0x1bb>
jmp    1345 <getxx+0x1c5>

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

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