#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*/ IF_inFile_1(int /*<<< orphan*/ *);
int /*<<< orphan*/ IF_inFile_2(int /*<<< orphan*/ *);
int /*<<< orphan*/ execlp(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
char *getString();
int getpid();
int /*<<< orphan*/ sprintf(char *, char *, int);
void lanceXgraph(int mode, int tit) {
  FILE *fd;
  char nf[30];
  sprintf(nf, ".nife/Nife_%d.gx", getpid());
  fd = fopen(nf, "w+");
  fprintf(fd, "Device: Postscript\nDisposition: To File\nTitleText: ");
  if (tit)
    fprintf(fd, "%s\n", getString());
  else
    fprintf(fd, "Data from Nife %s\n", "0.44");
  if (mode)
    IF_inFile_2(fd);
  else
    IF_inFile_1(fd);
  fclose(fd);
  execlp("xgraph", "xgraph", nf, NULL);
}


x86 assembly (clang, -O0):
<lanceXgraph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%edx
lea    0xe46(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x30(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1218 <lanceXgraph+0x88>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1030 <getString@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,%rdx
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1231 <lanceXgraph+0xa1>
mov    -0x10(%rbp),%rdi
lea    0xe25(%rip),%rsi
lea    0xe31(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
cmpl   $0x0,-0x4(%rbp)
je     1249 <lanceXgraph+0xb9>
mov    -0x10(%rbp),%rdi
call   1040 <IF_inFile_2@plt>
jmp    1252 <lanceXgraph+0xc2>
mov    -0x10(%rbp),%rdi
call   1080 <IF_inFile_1@plt>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
lea    -0x30(%rbp),%rdx
lea    0xdfa(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   10b0 <execlp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lanceXgraph>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%ebp
mov    %edi,%r14d
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xe45(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   10a0 <sprintf@plt>
lea    0xe42(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xe33(%rip),%rdi
mov    $0x33,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10b0 <fwrite@plt>
test   %ebp,%ebp
je     120d <lanceXgraph+0x6d>
xor    %eax,%eax
call   1030 <getString@plt>
lea    0xe52(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
jmp    121e <lanceXgraph+0x7e>
lea    0xe34(%rip),%rsi
lea    0xe40(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
test   %r14d,%r14d
je     1234 <lanceXgraph+0x94>
call   1040 <IF_inFile_2@plt>
jmp    1239 <lanceXgraph+0x99>
call   1080 <IF_inFile_1@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xe18(%rip),%rdi
mov    %rsp,%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
call   10c0 <execlp@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c".nife/Nife_%d.gx\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [52 x i8] c"Device: Postscript\0ADisposition: To File\0ATitleText: \00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [19 x i8] c"Data from Nife %s\0A\00"
@.str.5 = [5 x i8] c"0.44\00"
@.str.6 = [7 x i8] c"xgraph\00"
define void @lanceXgraph(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca [30 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%8 = call i32 (...) @getpid()
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %5
%12 = load i32*, i32** %5
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i32*, i32** %5
%18 = call i8* (...) @getString()
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %18)
br label %23
20: ; preds = %2
%21 = load i32*, i32** %5
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %23
23: ; preds = %20, %16
%24 = load i32, i32* %3
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32*, i32** %5
%28 = call i32 @IF_inFile_2(i32* %27)
br label %32
29: ; preds = %23
%30 = load i32*, i32** %5
%31 = call i32 @IF_inFile_1(i32* %30)
br label %32
32: ; preds = %29, %26
%33 = load i32*, i32** %5
%34 = call i32 @fclose(i32* %33)
%35 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%36 = call i32 @execlp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %35, i32* null)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c".nife/Nife_%d.gx\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [52 x i8] c"Device: Postscript\0ADisposition: To File\0ATitleText: \00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [19 x i8] c"Data from Nife %s\0A\00"
@.str.5 = [5 x i8] c"0.44\00"
@.str.6 = [7 x i8] c"xgraph\00"
define void @lanceXgraph(i32 %0, i32 %1) {
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (...) @getpid()
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i64 51, i64 1, i32* %7)
%9 = icmp eq i32 %1, 0
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = tail call i8* (...) @getString()
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %2
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = icmp eq i32 %0, 0
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = tail call i32 @IF_inFile_2(i32* %7)
br label %21
19: ; preds = %15
%20 = tail call i32 @IF_inFile_1(i32* %7)
br label %21
21: ; preds = %19, %17
%22 = tail call i32 @fclose(i32* %7)
%23 = call i32 @execlp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %4, i32* null)
ret void
}