#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__ EOF;
double atof(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ system(char *);
void format_4_em4gmm(char *file_name) {
  FILE *fp1 = fopen(file_name, "r+");
  char msg1[200];
  sprintf(msg1, "%s%s.txt", "data/features/", "temp");
  FILE *fp2 = fopen(msg1, "w");
  char tmp[200];
  int count = 0;
  char *line = NULL;
  size_t len = 0;
  while ((getline(&line, &len, fp1)) != -1) {
    count++;
  }
  fprintf(fp2, "%d %d\n", 40, count);
  rewind(fp1);
  count = 0;
  while (fscanf(fp1, "%s", tmp) != EOF) {
    fprintf(fp2, "%0.4f ", atof(tmp));
    if (++count == 40) {
      fprintf(fp2, "\n");
      count = 0;
    }
  }
  fclose(fp1);
  fclose(fp2);
  sprintf(msg1, "octave --silent %splots.m %s &", "data/features/", file_name);
  system(msg1);
}


x86 assembly (clang, -O0):
<format_4_em4gmm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0xe0(%rbp),%rdi
lea    0xe42(%rip),%rsi
lea    0xe44(%rip),%rdx
lea    0xe4c(%rip),%rcx
call   10b0 <sprintf@plt>
lea    -0xe0(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xe8(%rbp)
movl   $0x0,-0x1b4(%rbp)
movq   $0x0,-0x1c0(%rbp)
movq   $0x0,-0x1c8(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x1c0(%rbp),%rdi
lea    -0x1c8(%rbp),%rsi
call   10a0 <getline@plt>
cmp    $0xffffffff,%eax
je     1242 <format_4_em4gmm+0xb2>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    120e <format_4_em4gmm+0x7e>
mov    -0xe8(%rbp),%rdi
mov    -0x1b4(%rbp),%ecx
lea    0xdcc(%rip),%rsi
mov    $0x28,%edx
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <rewind@plt>
movl   $0x0,-0x1b4(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1b0(%rbp),%rdx
lea    0xda2(%rip),%rsi
call   1070 <fscanf@plt>
mov    0x2d55(%rip),%rcx
cmp    (%rcx),%rax
je     1307 <format_4_em4gmm+0x177>
mov    -0xe8(%rbp),%rax
mov    %rax,-0x1d0(%rbp)
lea    -0x1b0(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x1d0(%rbp),%rdi
lea    0xd68(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
cmp    $0x28,%eax
jne    1302 <format_4_em4gmm+0x172>
mov    -0xe8(%rbp),%rdi
lea    0xd36(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x1b4(%rbp)
jmp    1275 <format_4_em4gmm+0xe5>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xe8(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rcx
lea    0xd05(%rip),%rsi
lea    0xcd7(%rip),%rdx
call   10b0 <sprintf@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <system@plt>
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_4_em4gmm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b8,%rsp
lea    0xe48(%rip),%rsi
mov    %rdi,0x8(%rsp)
call   10a0 <fopen@plt>
mov    %rax,%r14
lea    0xe37(%rip),%rsi
lea    0xe39(%rip),%rdx
lea    0xe41(%rip),%rcx
lea    0xf0(%rsp),%rbx
mov    %rbx,%rdi
call   10c0 <sprintf@plt>
lea    0xe2f(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r15
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
mov    $0xffffffff,%ebp
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%rbx
nopl   (%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10b0 <getline@plt>
add    $0x1,%ebp
cmp    $0xffffffff,%eax
jne    1220 <format_4_em4gmm+0x80>
lea    0xde5(%rip),%rsi
xor    %ebx,%ebx
mov    %r15,%rdi
mov    $0x28,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r14,%rdi
call   1060 <rewind@plt>
lea    0xdca(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %r14,%rdi
call   1070 <fscanf@plt>
mov    0x2d75(%rip),%rcx
cmp    (%rcx),%rax
jne    12c5 <format_4_em4gmm+0x125>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xda4(%rip),%rsi
lea    0xd76(%rip),%rdx
lea    0xf0(%rsp),%rbx
mov    %rbx,%rdi
mov    0x8(%rsp),%rcx
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x20(%rsp),%r12
lea    0xd5b(%rip),%r13
lea    0xd51(%rip),%rbp
jmp    12fe <format_4_em4gmm+0x15e>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1070 <fscanf@plt>
mov    0x2cf3(%rip),%rcx
cmp    (%rcx),%rax
je     1278 <format_4_em4gmm+0xd8>
mov    %r12,%rdi
call   1030 <atof@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
add    $0x1,%ebx
cmp    $0x28,%ebx
jne    12e0 <format_4_em4gmm+0x140>
mov    $0xa,%edi
mov    %r15,%rsi
call   1080 <fputc@plt>
xor    %ebx,%ebx
jmp    12e0 <format_4_em4gmm+0x140>

LLVM IR (-O0):
@.str = [3 x i8] c"r+\00"
@.str.1 = [9 x i8] c"%s%s.txt\00"
@.str.2 = [15 x i8] c"data/features/\00"
@.str.3 = [5 x i8] c"temp\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [7 x i8] c"%d %d\0A\00"
@.str.6 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.7 = [7 x i8] c"%0.4f \00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [31 x i8] c"octave --silent %splots.m %s &\00"
define void @format_4_em4gmm(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [200 x i8]
%5 = alloca i32*
%6 = alloca [200 x i8]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i8* %0, i8** %2
%10 = load i8*, i8** %2
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %3
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%13 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %15, i32** %5
store i32 0, i32* %7
store i8* null, i8** %8
store i64 0, i64* %9
br label %16
16: ; preds = %20, %1
%17 = load i32*, i32** %3
%18 = call i32 @getline(i8** %8, i64* %9, i32* %17)
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %16
23: ; preds = %16
%24 = load i32*, i32** %5
%25 = load i32, i32* %7
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 40, i32 %25)
%27 = load i32*, i32** %3
%28 = call i32 @rewind(i32* %27)
store i32 0, i32* %7
br label %29
29: ; preds = %46, %23
%30 = load i32*, i32** %3
%31 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%32 = call i64 @fscanf(i32* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%33 = load i64, i64* @EOF
%34 = icmp ne i64 %32, %33
br i1 %34, label %35, label %47
35: ; preds = %29
%36 = load i32*, i32** %5
%37 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%38 = call double @atof(i8* %37)
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), double %38)
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
%42 = icmp eq i32 %41, 40
br i1 %42, label %43, label %46
43: ; preds = %35
%44 = load i32*, i32** %5
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %7
br label %46
46: ; preds = %43, %35
br label %29
47: ; preds = %29
%48 = load i32*, i32** %3
%49 = call i32 @fclose(i32* %48)
%50 = load i32*, i32** %5
%51 = call i32 @fclose(i32* %50)
%52 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%53 = load i8*, i8** %2
%54 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %53)
%55 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%56 = call i32 @system(i8* %55)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"r+\00"
@.str.1 = [9 x i8] c"%s%s.txt\00"
@.str.2 = [15 x i8] c"data/features/\00"
@.str.3 = [5 x i8] c"temp\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [7 x i8] c"%d %d\0A\00"
@.str.6 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.7 = [7 x i8] c"%0.4f \00"
@.str.9 = [31 x i8] c"octave --silent %splots.m %s &\00"
define void @format_4_em4gmm(i8* %0) {
%2 = alloca [200 x i8]
%3 = alloca [200 x i8]
%4 = alloca i8*
%5 = alloca i64
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%11 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%12 = bitcast i64* %5 to i8*
store i64 0, i64* %5
br label %13
13: ; preds = %13, %1
%14 = phi i32 [ 0, %1 ], [ %17, %13 ]
%15 = call i32 @getline(i8** %4, i64* %5, i32* %6)
%16 = icmp eq i32 %15, -1
%17 = add nuw nsw i32 %14, 1
br i1 %16, label %18, label %13
18: ; preds = %13
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 40, i32 %14)
%20 = call i32 @rewind(i32* %6)
%21 = call i64 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %10)
%22 = load i64, i64* @EOF
%23 = icmp eq i64 %21, %22
br i1 %23, label %37, label %24
24: ; preds = %18, %32
%25 = phi i32 [ %33, %32 ], [ 0, %18 ]
%26 = call double @atof(i8* %10)
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), double %26)
%28 = add nsw i32 %25, 1
%29 = icmp eq i32 %28, 40
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 @fputc(i32 10, i32* %9)
br label %32
32: ; preds = %30, %24
%33 = phi i32 [ 0, %30 ], [ %28, %24 ]
%34 = call i64 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %10)
%35 = load i64, i64* @EOF
%36 = icmp eq i64 %34, %35
br i1 %36, label %37, label %24
37: ; preds = %32, %18
%38 = call i32 @fclose(i32* %6)
%39 = call i32 @fclose(i32* %9)
%40 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%41 = call i32 @system(i8* %7)
ret void
}