#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 */
scalar_t__ calloc(size_t, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(double *);
float getMIpair(double *, size_t, int, int, int, int, int);
double *readMicroarray(char const *, size_t, int);
float *getMIline(const char *nmilinef, const char *nmif, size_t ngenes,
                 int nexp, int numbins, int splineord, int linei) {
  int i;
  double *X = readMicroarray(nmif, ngenes, nexp);
  float *row = (float *)calloc(ngenes, sizeof(float));
  FILE *fo;
  fo = fopen(nmilinef, "w");
  for (i = 0; i < ngenes; i++) {
    row[i] = getMIpair(X, ngenes, nexp, linei, i, numbins, splineord);
    fprintf(fo, "%f", row[i]);
    if (i < ngenes - 1)
      fprintf(fo, " ");
  }
  fprintf(fo, "\n");
  fclose(fo);
  free(X);
  return row;
}


x86 assembly (clang, -O0):
<getMIline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1080 <readMicroarray@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe3d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x28(%rbp)
movslq -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    126c <getMIline+0xfc>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    -0x24(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <getMIpair@plt>
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd7(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
movslq -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    1259 <getMIline+0xe9>
mov    -0x40(%rbp),%rdi
lea    0xdb3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    125e <getMIline+0xee>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d3 <getMIline+0x63>
mov    -0x40(%rbp),%rdi
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMIline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0xc(%rsp)
mov    %r8d,0x8(%rsp)
mov    %ecx,%r13d
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
call   1090 <readMicroarray@plt>
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%rbp
lea    0xe36(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     124c <getMIline+0xcc>
lea    -0x1(%rbx),%r12
xor    %r15d,%r15d
jmp    11f9 <getMIline+0x79>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15
cmp    %r15,%rbx
je     124c <getMIline+0xcc>
mov    0xc(%rsp),%eax
mov    %eax,(%rsp)
mov    0x10(%rsp),%rdi
mov    %rbx,%rsi
mov    %r13d,%edx
mov    0x50(%rsp),%ecx
mov    %r15d,%r8d
mov    0x8(%rsp),%r9d
call   1040 <getMIpair@plt>
movss  %xmm0,0x0(%rbp,%r15,4)
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
lea    0xdd1(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
cmp    %r15,%r12
jbe    11f0 <getMIline+0x70>
mov    $0x20,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
jmp    11f0 <getMIline+0x70>
mov    $0xa,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"\0A\00"
define float* @getMIline(i8* %0, i8* %1, i64 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double*
%17 = alloca float*
%18 = alloca i32*
store i8* %0, i8** %8
store i8* %1, i8** %9
store i64 %2, i64* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%19 = load i8*, i8** %9
%20 = load i64, i64* %10
%21 = load i32, i32* %11
%22 = call double* @readMicroarray(i8* %19, i64 %20, i32 %21)
store double* %22, double** %16
%23 = load i64, i64* %10
%24 = call i64 @calloc(i64 %23, i32 4)
%25 = inttoptr i64 %24 to float*
store float* %25, float** %17
%26 = load i8*, i8** %8
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %27, i32** %18
store i32 0, i32* %15
br label %28
28: ; preds = %63, %7
%29 = load i32, i32* %15
%30 = sext i32 %29 to i64
%31 = load i64, i64* %10
%32 = icmp ult i64 %30, %31
br i1 %32, label %33, label %66
33: ; preds = %28
%34 = load double*, double** %16
%35 = load i64, i64* %10
%36 = load i32, i32* %11
%37 = load i32, i32* %14
%38 = load i32, i32* %15
%39 = load i32, i32* %12
%40 = load i32, i32* %13
%41 = call float @getMIpair(double* %34, i64 %35, i32 %36, i32 %37, i32 %38, i32 %39, i32 %40)
%42 = load float*, float** %17
%43 = load i32, i32* %15
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds float, float* %42, i64 %44
store float %41, float* %45
%46 = load i32*, i32** %18
%47 = load float*, float** %17
%48 = load i32, i32* %15
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds float, float* %47, i64 %49
%51 = load float, float* %50
%52 = fpext float %51 to double
%53 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %52)
%54 = load i32, i32* %15
%55 = sext i32 %54 to i64
%56 = load i64, i64* %10
%57 = sub i64 %56, 1
%58 = icmp ult i64 %55, %57
br i1 %58, label %59, label %62
59: ; preds = %33
%60 = load i32*, i32** %18
%61 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %62
62: ; preds = %59, %33
br label %63
63: ; preds = %62
%64 = load i32, i32* %15
%65 = add nsw i32 %64, 1
store i32 %65, i32* %15
br label %28
66: ; preds = %28
%67 = load i32*, i32** %18
%68 = call i32 (i32*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%69 = load i32*, i32** %18
%70 = call i32 @fclose(i32* %69)
%71 = load double*, double** %16
%72 = call i32 @free(double* %71)
%73 = load float*, float** %17
ret float* %73
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [3 x i8] c"%f\00"
define float* @getMIline(i8* nocapture %0, i8* %1, i64 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call double* @readMicroarray(i8* %1, i64 %2, i32 %3)
%9 = tail call i64 @calloc(i64 %2, i32 4)
%10 = inttoptr i64 %9 to float*
%11 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %2, 0
br i1 %12, label %28, label %13
13: ; preds = %7
%14 = add i64 %2, -1
br label %15
15: ; preds = %13, %25
%16 = phi i64 [ 0, %13 ], [ %26, %25 ]
%17 = trunc i64 %16 to i32
%18 = tail call float @getMIpair(double* %8, i64 %2, i32 %3, i32 %6, i32 %17, i32 %4, i32 %5)
%19 = getelementptr inbounds float, float* %10, i64 %16
store float %18, float* %19
%20 = fpext float %18 to double
%21 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = icmp ugt i64 %14, %16
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = tail call i32 @fputc(i32 32, i32* %11)
br label %25
25: ; preds = %15, %23
%26 = add nuw i64 %16, 1
%27 = icmp eq i64 %26, %2
br i1 %27, label %28, label %15
28: ; preds = %25, %7
%29 = tail call i32 @fputc(i32 10, i32* %11)
%30 = tail call i32 @fclose(i32* %11)
%31 = tail call i32 @free(double* %8)
ret float* %10
}