#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 */

/* Variables and functions */
scalar_t__ installed(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ save_3d_window(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ unlink(char *);
int print_3d_window(void) {
  static char ps_file[] = "/usr/tmp/Vis5D_image.ps";
  char cmd[1000];
  if (!save_3d_window(ps_file, 8))
    return 0;
  if (installed("lpr")) {
    sprintf(cmd, "lpr %s\n", ps_file);
    printf("Executing: %s\n", cmd);
    system(cmd);
  }
  unlink(ps_file);
  return 1;
}


x86 assembly (clang, -O0):
<print_3d_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
lea    0x2eee(%rip),%rdi
mov    $0x8,%esi
call   1060 <save_3d_window@plt>
cmp    $0x0,%eax
jne    1191 <print_3d_window+0x31>
movl   $0x0,-0x4(%rbp)
jmp    11f3 <print_3d_window+0x93>
lea    0xe68(%rip),%rdi
call   1070 <installed@plt>
cmp    $0x0,%rax
je     11e0 <print_3d_window+0x80>
lea    -0x3f0(%rbp),%rdi
lea    0xe4f(%rip),%rsi
lea    0x2ea4(%rip),%rdx
call   1080 <sprintf@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe3d(%rip),%rdi
call   1050 <printf@plt>
lea    -0x3f0(%rbp),%rdi
call   1040 <system@plt>
lea    0x2e79(%rip),%rdi
call   1030 <unlink@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_3d_window>:
push   %rbx
sub    $0x3f0,%rsp
lea    0x2ef1(%rip),%rdi
mov    $0x8,%esi
call   1060 <save_3d_window@plt>
test   %eax,%eax
je     11d1 <print_3d_window+0x71>
lea    0xe7c(%rip),%rdi
call   1070 <installed@plt>
test   %rax,%rax
je     11be <print_3d_window+0x5e>
lea    0xe6f(%rip),%rsi
lea    0x2ec4(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1080 <sprintf@plt>
lea    0xe5e(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0x2e9b(%rip),%rdi
call   1030 <unlink@plt>
mov    $0x1,%eax
jmp    11d3 <print_3d_window+0x73>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@print_3d_window.ps_file = internal global [24 x i8] c"/usr/tmp/Vis5D_image.ps\00"
@.str = [4 x i8] c"lpr\00"
@.str.1 = [8 x i8] c"lpr %s\0A\00"
@.str.2 = [15 x i8] c"Executing: %s\0A\00"
define i32 @print_3d_window() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = call i32 @save_3d_window(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @print_3d_window.ps_file, i64 0, i64 0), i32 8)
%4 = icmp ne i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %0
store i32 0, i32* %1
br label %18
6: ; preds = %0
%7 = call i64 @installed(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%11 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @print_3d_window.ps_file, i64 0, i64 0))
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%15 = call i32 @system(i8* %14)
br label %16
16: ; preds = %9, %6
%17 = call i32 @unlink(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @print_3d_window.ps_file, i64 0, i64 0))
store i32 1, i32* %1
br label %18
18: ; preds = %16, %5
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@print_3d_window.ps_file = internal global [24 x i8] c"/usr/tmp/Vis5D_image.ps\00"
@.str = [4 x i8] c"lpr\00"
@.str.1 = [8 x i8] c"lpr %s\0A\00"
@.str.2 = [15 x i8] c"Executing: %s\0A\00"
define i32 @print_3d_window() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @save_3d_window(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @print_3d_window.ps_file, i64 0, i64 0), i32 8)
%4 = icmp eq i32 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %0
%6 = tail call i64 @installed(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @print_3d_window.ps_file, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%11 = call i32 @system(i8* %2)
br label %12
12: ; preds = %8, %5
%13 = call i32 @unlink(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @print_3d_window.ps_file, i64 0, i64 0))
br label %14
14: ; preds = %0, %12
%15 = phi i32 [ 1, %12 ], [ 0, %0 ]
ret i32 %15
}