#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
void plotimage(void) {
  FILE *pipe = popen("gnuplot -persist", "w");
  fprintf(pipe, "unset border\n");
  fprintf(pipe, "unset tics\n");
  fprintf(pipe, "unset colorbox\n");
  fprintf(pipe, "set palette gray\n");
  fprintf(pipe, "plot '%s' matrix with image\n", "image.dat");
  pclose(pipe);
}


x86 assembly (clang, -O0):
<plotimage>:
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
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xead(%rip),%rsi
lea    0xec3(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <pclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plotimage>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,%rbx
lea    0xeb5(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
lea    0xeaa(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe9d(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe94(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe8d(%rip),%rsi
lea    0xea3(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <pclose@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"unset border\0A\00"
@.str.3 = [12 x i8] c"unset tics\0A\00"
@.str.4 = [16 x i8] c"unset colorbox\0A\00"
@.str.5 = [18 x i8] c"set palette gray\0A\00"
@.str.6 = [29 x i8] c"plot '%s' matrix with image\0A\00"
@.str.7 = [10 x i8] c"image.dat\00"
define void @plotimage() {
%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 (i32*, i8*, ...) @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 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32*, i32** %1
%8 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%9 = load i32*, i32** %1
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32*, i32** %1
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%13 = load i32*, i32** %1
%14 = call i32 @pclose(i32* %13)
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"unset border\0A\00"
@.str.3 = [12 x i8] c"unset tics\0A\00"
@.str.4 = [16 x i8] c"unset colorbox\0A\00"
@.str.5 = [18 x i8] c"set palette gray\0A\00"
@.str.6 = [29 x i8] c"plot '%s' matrix with image\0A\00"
@.str.7 = [10 x i8] c"image.dat\00"
define void @plotimage() {
%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 ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i64 11, i64 1, i32* %1)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i64 15, i64 1, i32* %1)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 17, i64 1, i32* %1)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%7 = tail call i32 @pclose(i32* %1)
ret void
}