#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 */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ *popen(char *, char *);
void plot(void) {
  FILE *gplot = popen("gnuplot -persist", "w");
  fprintf(gplot, "set term png\n");
  fprintf(gplot, "set output 'Plot_Data.png'\n");
  fprintf(gplot, "set xlabel 'Segundos\n");
  fprintf(gplot, "set ylabel 'Concentracion de Metano [ppm]'\n");
  fprintf(gplot, "set title 'Gas(t)'\n");
  fprintf(gplot, "unset key\n");
  fprintf(gplot, "plot 'Data.txt' using 1:2 \n");
  fclose(gplot);
}


x86 assembly (clang, -O0):
<plot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee5(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee9(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee4(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plot>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1040 <popen@plt>
mov    %rax,%rbx
lea    0xec5(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
lea    0xeba(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xebd(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xeba(%rip),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xecd(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xec8(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xeba(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"gnuplot -persist\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [14 x i8] c"set term png\0A\00"
@.str.3 = [28 x i8] c"set output 'Plot_Data.png'\0A\00"
@.str.4 = [22 x i8] c"set xlabel 'Segundos\0A\00"
@.str.5 = [44 x i8] c"set ylabel 'Concentracion de Metano [ppm]'\0A\00"
@.str.6 = [20 x i8] c"set title 'Gas(t)'\0A\00"
@.str.7 = [11 x i8] c"unset key\0A\00"
@.str.8 = [28 x i8] c"plot 'Data.txt' using 1:2 \0A\00"
define void @plot() {
%1 = alloca i32*
%2 = call i32* @popen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32*, i32** %1
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32*, i32** %1
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%9 = load i32*, i32** %1
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32*, i32** %1
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%13 = load i32*, i32** %1
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%15 = load i32*, i32** %1
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%17 = load i32*, i32** %1
%18 = call i32 @fclose(i32* %17)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"gnuplot -persist\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [14 x i8] c"set term png\0A\00"
@.str.3 = [28 x i8] c"set output 'Plot_Data.png'\0A\00"
@.str.4 = [22 x i8] c"set xlabel 'Segundos\0A\00"
@.str.5 = [44 x i8] c"set ylabel 'Concentracion de Metano [ppm]'\0A\00"
@.str.6 = [20 x i8] c"set title 'Gas(t)'\0A\00"
@.str.7 = [11 x i8] c"unset key\0A\00"
@.str.8 = [28 x i8] c"plot 'Data.txt' using 1:2 \0A\00"
define void @plot() {
%1 = tail call i32* @popen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i64 13, i64 1, i32* %1)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 27, i64 1, i32* %1)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i64 21, i64 1, i32* %1)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i64 43, i64 1, i32* %1)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i64 19, i64 1, i32* %1)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i64 10, i64 1, i32* %1)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i64 27, i64 1, i32* %1)
%9 = tail call i32 @fclose(i32* %1)
ret void
}