#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*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
char *strtok(char *, char *);
void read_mu_sigma(int dim, int mixture, FILE *gmmfile, double **mu,
                   double **sigma) {
  int i, k, l;
  char inbuf[10000], *tp;
  memset(inbuf, 0, 10000);
  for (i = 0; i < 8; i++)
    fgets(inbuf, 10000, gmmfile);
  for (k = 0; k < mixture; k++) {
    for (i = 0; i < 3; i++)
      fgets(inbuf, 10000, gmmfile);
    l = 0;
    tp = strtok(inbuf, " \n");
    if (tp != NULL)
      mu[k][l++] = atof(tp);
    while (tp != NULL) {
      tp = strtok(NULL, " \n");
      if (tp != NULL)
        mu[k][l++] = atof(tp);
    }
    for (i = 0; i < 2; i++)
      fgets(inbuf, 10000, gmmfile);
    l = 0;
    tp = strtok(inbuf, " \n");
    if (tp != NULL)
      sigma[k][l++] = atof(tp);
    while (tp != NULL) {
      tp = strtok(NULL, " \n");
      if (tp != NULL)
        sigma[k][l++] = atof(tp);
    }
    fgets(inbuf, 10000, gmmfile);
  }
}


x86 assembly (clang, -O0):
<read_mu_sigma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2750,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
lea    -0x2740(%rbp),%rdi
xor    %esi,%esi
mov    $0x2710,%edx
call   1040 <memset@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x8,-0x24(%rbp)
jge    11a4 <read_mu_sigma+0x64>
lea    -0x2740(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1177 <read_mu_sigma+0x37>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13c6 <read_mu_sigma+0x286>
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    11eb <read_mu_sigma+0xab>
lea    -0x2740(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11be <read_mu_sigma+0x7e>
movl   $0x0,-0x2c(%rbp)
lea    -0x2740(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x2748(%rbp)
cmpq   $0x0,-0x2748(%rbp)
je     1245 <read_mu_sigma+0x105>
mov    -0x2748(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    124a <read_mu_sigma+0x10a>
cmpq   $0x0,-0x2748(%rbp)
je     12ad <read_mu_sigma+0x16d>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd9d(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x2748(%rbp)
cmpq   $0x0,-0x2748(%rbp)
je     12a8 <read_mu_sigma+0x168>
mov    -0x2748(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    124a <read_mu_sigma+0x10a>
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    12e1 <read_mu_sigma+0x1a1>
lea    -0x2740(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12b4 <read_mu_sigma+0x174>
movl   $0x0,-0x2c(%rbp)
lea    -0x2740(%rbp),%rdi
lea    0xd0a(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x2748(%rbp)
cmpq   $0x0,-0x2748(%rbp)
je     133b <read_mu_sigma+0x1fb>
mov    -0x2748(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1340 <read_mu_sigma+0x200>
cmpq   $0x0,-0x2748(%rbp)
je     13a3 <read_mu_sigma+0x263>
xor    %eax,%eax
mov    %eax,%edi
lea    0xca7(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x2748(%rbp)
cmpq   $0x0,-0x2748(%rbp)
je     139e <read_mu_sigma+0x25e>
mov    -0x2748(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1340 <read_mu_sigma+0x200>
lea    -0x2740(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ab <read_mu_sigma+0x6b>
add    $0x2750,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_mu_sigma>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2728,%rsp
mov    %r8,%r14
mov    %rcx,%r13
mov    %rdx,%r12
mov    %esi,%ebp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2710,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
test   %ebp,%ebp
jle    1369 <read_mu_sigma+0x229>
mov    %ebp,%eax
mov    %rax,0x8(%rsp)
xor    %ebp,%ebp
lea    0x10(%rsp),%rbx
lea    0xdf3(%rip),%r15
mov    %r12,(%rsp)
jmp    1244 <read_mu_sigma+0x104>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
add    $0x1,%rbp
cmp    0x8(%rsp),%rbp
je     1369 <read_mu_sigma+0x229>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strtok@plt>
test   %rax,%rax
je     12d6 <read_mu_sigma+0x196>
mov    %rax,%rdi
call   1030 <atof@plt>
mov    0x0(%r13,%rbp,8),%rax
movsd  %xmm0,(%rax)
xor    %edi,%edi
mov    %r15,%rsi
call   1060 <strtok@plt>
test   %rax,%rax
je     12d6 <read_mu_sigma+0x196>
mov    $0x8,%r12d
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1030 <atof@plt>
mov    0x0(%r13,%rbp,8),%rax
movsd  %xmm0,(%rax,%r12,1)
xor    %edi,%edi
mov    %r15,%rsi
call   1060 <strtok@plt>
add    $0x8,%r12
test   %rax,%rax
jne    12b0 <read_mu_sigma+0x170>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    (%rsp),%r12
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strtok@plt>
test   %rax,%rax
je     1220 <read_mu_sigma+0xe0>
mov    %rax,%rdi
call   1030 <atof@plt>
mov    (%r14,%rbp,8),%rax
movsd  %xmm0,(%rax)
xor    %edi,%edi
mov    %r15,%rsi
call   1060 <strtok@plt>
test   %rax,%rax
je     1220 <read_mu_sigma+0xe0>
mov    $0x8,%ebx
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1030 <atof@plt>
mov    (%r14,%rbp,8),%rax
movsd  %xmm0,(%rax,%rbx,1)
xor    %edi,%edi
mov    %r15,%rsi
call   1060 <strtok@plt>
add    $0x8,%rbx
test   %rax,%rax
jne    1340 <read_mu_sigma+0x200>
jmp    1220 <read_mu_sigma+0xe0>
add    $0x2728,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c" \0A\00"
define void @read_mu_sigma(i32 %0, i32 %1, i32* nocapture %2, double** nocapture %3, double** nocapture %4) {
%6 = alloca [10000 x i8]
%7 = getelementptr inbounds [10000 x i8], [10000 x i8]* %6, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 10000)
%9 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%10 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%11 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%12 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%13 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%14 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%15 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%16 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%17 = icmp sgt i32 %1, 0
br i1 %17, label %18, label %70
18: ; preds = %5
%19 = zext i32 %1 to i64
br label %20
20: ; preds = %18, %66
%21 = phi i64 [ 0, %18 ], [ %68, %66 ]
%22 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%23 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%24 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%25 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i8* %25, null
br i1 %26, label %34, label %27
27: ; preds = %20
%28 = call double @atof(i8* %25)
%29 = getelementptr inbounds double*, double** %3, i64 %21
%30 = load double*, double** %29
store double %28, double* %30
%31 = getelementptr inbounds double*, double** %3, i64 %21
%32 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %39
34: ; preds = %39, %27, %20
%35 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%36 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%37 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%38 = icmp eq i8* %37, null
br i1 %38, label %66, label %49
39: ; preds = %27, %39
%40 = phi i8* [ %47, %39 ], [ %32, %27 ]
%41 = phi i32 [ %44, %39 ], [ 1, %27 ]
%42 = call double @atof(i8* %40)
%43 = load double*, double** %31
%44 = add nuw nsw i32 %41, 1
%45 = zext i32 %41 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
store double %42, double* %46
%47 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%48 = icmp eq i8* %47, null
br i1 %48, label %34, label %39
49: ; preds = %34
%50 = call double @atof(i8* %37)
%51 = getelementptr inbounds double*, double** %4, i64 %21
%52 = load double*, double** %51
store double %50, double* %52
%53 = getelementptr inbounds double*, double** %4, i64 %21
%54 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%55 = icmp eq i8* %54, null
br i1 %55, label %66, label %56
56: ; preds = %49, %56
%57 = phi i8* [ %64, %56 ], [ %54, %49 ]
%58 = phi i32 [ %61, %56 ], [ 1, %49 ]
%59 = call double @atof(i8* %57)
%60 = load double*, double** %53
%61 = add nuw nsw i32 %58, 1
%62 = zext i32 %58 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
store double %59, double* %63
%64 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%65 = icmp eq i8* %64, null
br i1 %65, label %66, label %56
66: ; preds = %56, %49, %34
%67 = call i32 @fgets(i8* %7, i32 10000, i32* %2)
%68 = add nuw nsw i64 %21, 1
%69 = icmp eq i64 %68, %19
br i1 %69, label %70, label %20
70: ; preds = %66, %5
ret void
}