#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*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ *popen(char *, char *);
int main() {
  char *commandsForGnuplot[] = {"set title \"TITLEEEEE\"", "plot 'data.temp'"};
  double xvals[5] = {1.0, 2.0, 3.0, 4.0, 5.0};
  double yvals[5] = {5.0, 3.0, 1.0, 3.0, 5.0};
  FILE *temp = fopen("data.temp", "w");
  FILE *gnuplotPipe = popen("gnuplot -persistent", "w");
  int i;
  for (i = 0; i < 5; i++) {
    fprintf(temp, "%lf %lf \n", xvals[i], yvals[i]);
  }
  for (i = 0; i < 2; i++) {
    fprintf(gnuplotPipe, "%s \n", commandsForGnuplot[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cb7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cb4(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe93(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe6e(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe4c(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movsd  0xe2f(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe2a(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe25(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe10(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xdfb(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
lea    0xe3e(%rip),%rdi
lea    0xe41(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x88(%rbp)
lea    0xe30(%rip),%rdi
lea    0xe27(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x90(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x5,-0x94(%rbp)
jge    1298 <main+0x158>
mov    -0x88(%rbp),%rdi
movslq -0x94(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
movslq -0x94(%rbp),%rax
movsd  -0x80(%rbp,%rax,8),%xmm1
lea    0xdf2(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1248 <main+0x108>
movl   $0x0,-0x94(%rbp)
cmpl   $0x2,-0x94(%rbp)
jge    12e4 <main+0x1a4>
mov    -0x90(%rbp),%rdi
movslq -0x94(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rdx
lea    0xdb0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    12a2 <main+0x162>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xf13(%rip),%rdi
lea    0xf16(%rip),%r14
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xf06(%rip),%rdi
mov    %r14,%rsi
call   1040 <popen@plt>
mov    %rax,%r14
lea    0xf08(%rip),%r15
movsd  0xe91(%rip),%xmm0
movsd  0xe91(%rip),%xmm1
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%al
call   1030 <fprintf@plt>
movsd  0xe84(%rip),%xmm0
movsd  0xe84(%rip),%xmm1
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%al
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
movsd  0xe69(%rip),%xmm0
movsd  0xe49(%rip),%xmm1
mov    $0x2,%al
call   1030 <fprintf@plt>
movsd  0xe5a(%rip),%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
movsd  0xe44(%rip),%xmm1
mov    $0x2,%al
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
movsd  0xe1f(%rip),%xmm0
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <fprintf@plt>
lea    0xe7f(%rip),%rbx
lea    0xe27(%rip),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xe29(%rip),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"set title \22TITLEEEEE\22\00"
@.str.1 = [17 x i8] c"plot 'data.temp'\00"
@__const.main.commandsForGnuplot = [2 x i8*] [i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [10 x i8] c"data.temp\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [20 x i8] c"gnuplot -persistent\00"
@.str.5 = [10 x i8] c"%lf %lf \0A\00"
@.str.6 = [5 x i8] c"%s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8*]
%3 = alloca [5 x double]
%4 = alloca [5 x double]
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [2 x i8*]* %2 to i8*
%9 = bitcast [5 x double]* %3 to i8*
%10 = bitcast i8* %9 to [5 x double]*
%11 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 0
store double 1.000000e+00, double* %11
%12 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 1
store double 2.000000e+00, double* %12
%13 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 2
store double 3.000000e+00, double* %13
%14 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 3
store double 4.000000e+00, double* %14
%15 = getelementptr inbounds [5 x double], [5 x double]* %10, i32 0, i32 4
store double 5.000000e+00, double* %15
%16 = bitcast [5 x double]* %4 to i8*
%17 = bitcast i8* %16 to [5 x double]*
%18 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 0
store double 5.000000e+00, double* %18
%19 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 1
store double 3.000000e+00, double* %19
%20 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 2
store double 1.000000e+00, double* %20
%21 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 3
store double 3.000000e+00, double* %21
%22 = getelementptr inbounds [5 x double], [5 x double]* %17, i32 0, i32 4
store double 5.000000e+00, double* %22
%23 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %23, i32** %5
%24 = call i32* @popen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %24, i32** %6
store i32 0, i32* %7
br label %25
25: ; preds = %39, %0
%26 = load i32, i32* %7
%27 = icmp slt i32 %26, 5
br i1 %27, label %28, label %42
28: ; preds = %25
%29 = load i32*, i32** %5
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 %31
%33 = load double, double* %32
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x double], [5 x double]* %4, i64 0, i64 %35
%37 = load double, double* %36
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %33, double %37)
br label %39
39: ; preds = %28
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %25
42: ; preds = %25
store i32 0, i32* %7
br label %43
43: ; preds = %53, %42
%44 = load i32, i32* %7
%45 = icmp slt i32 %44, 2
br i1 %45, label %46, label %56
46: ; preds = %43
%47 = load i32*, i32** %6
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 %49
%51 = load i8*, i8** %50
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %46
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %43
56: ; preds = %43
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"set title \22TITLEEEEE\22\00"
@.str.1 = [17 x i8] c"plot 'data.temp'\00"
@.str.2 = [10 x i8] c"data.temp\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [20 x i8] c"gnuplot -persistent\00"
@.str.5 = [10 x i8] c"%lf %lf \0A\00"
@.str.6 = [5 x i8] c"%s \0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%2 = tail call i32* @popen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double 1.000000e+00, double 5.000000e+00)
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double 2.000000e+00, double 3.000000e+00)
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double 3.000000e+00, double 1.000000e+00)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double 4.000000e+00, double 3.000000e+00)
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double 5.000000e+00, double 5.000000e+00)
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}