#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 */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ nexsup_(int *, char *, float *);
int /*<<< orphan*/ printf(char *, ...);
void main(int argc, char *argv[]) {
  char *cbuf = NULL;
  float rtmp[20];
  int ifunc;
  ifunc = 1;
  printf("demo--Sending ifunc=1 showwind/getsize.\n");
  nexsup_(&ifunc, cbuf, rtmp);
  printf("demo-window size is %f %f resol=%f color=%f\n", rtmp[0], rtmp[1],
         rtmp[2], rtmp[3]);
  ifunc = 2;
  rtmp[0] = 1.;
  printf("demo--Sending ifunc=2 beginp/clear\n");
  nexsup_(&ifunc, cbuf, rtmp);
  ifunc = 3;
  printf("demo--Sending ifunc=3, pscode.\n");
  nexsup_(&ifunc, ".20 setgray newpath 50 50 moveto 100 500 lineto stroke",
          rtmp);
  ifunc = 5;
  printf("demo--Sending ifunc=5, flush\n");
  nexsup_(&ifunc, cbuf, rtmp);
  ifunc = 3;
  printf("demo--Sending ifunc=3, pscode.\n");
  nexsup_(&ifunc,
          "newpath 100 100 moveto 100 0 rlineto 0 100 rlineto -100 0 rlineto "
          "closepath eofill",
          rtmp);
  ifunc = 3;
  printf("demo--Sending ifunc=3, pscode.\n");
  nexsup_(&ifunc, "newpath 0 0 moveto 20 20 lineto stroke", rtmp);
  ifunc = 5;
  printf("demo--Sending ifunc=5, flush\n");
  nexsup_(&ifunc, cbuf, rtmp);
  ifunc = 4;
  printf("demo--Sending ifunc=4 read cursor.\n");
  nexsup_(&ifunc, cbuf, rtmp);
  printf("demo--Cursor= %f %f %f\n", rtmp[0], rtmp[1], rtmp[2]);
  ifunc = 6;
  printf("demo--Sending ifunc=6, end picture\n");
  nexsup_(&ifunc, cbuf, rtmp);
  ifunc = 7;
  printf("demo--Sending ifunc=7, close socket\n");
  nexsup_(&ifunc, cbuf, rtmp);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x74(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
call   1040 <nexsup_@plt>
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x6c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x68(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x64(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe92(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
movl   $0x2,-0x74(%rbp)
movss  0xe4f(%rip),%xmm0
movss  %xmm0,-0x70(%rbp)
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
call   1040 <nexsup_@plt>
movl   $0x3,-0x74(%rbp)
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1040 <nexsup_@plt>
movl   $0x5,-0x74(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
call   1040 <nexsup_@plt>
movl   $0x3,-0x74(%rbp)
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1040 <nexsup_@plt>
movl   $0x3,-0x74(%rbp)
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
lea    0xed5(%rip),%rsi
call   1040 <nexsup_@plt>
movl   $0x5,-0x74(%rbp)
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
call   1040 <nexsup_@plt>
movl   $0x4,-0x74(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
call   1040 <nexsup_@plt>
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x6c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x68(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xead(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movl   $0x6,-0x74(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
call   1040 <nexsup_@plt>
movl   $0x7,-0x74(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x74(%rbp),%rdi
call   1040 <nexsup_@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
movl   $0x1,0xc(%rsp)
lea    0xf9c(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r14
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x18(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0x1c(%rsp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe5b(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
movl   $0x2,0xc(%rsp)
movl   $0x3f800000,0x10(%rsp)
3f
lea    0xf5b(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movl   $0x3,0xc(%rsp)
lea    0xf5d(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe3a(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movl   $0x5,0xc(%rsp)
lea    0xf53(%rip),%r12
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movl   $0x3,0xc(%rsp)
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe2b(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movl   $0x3,0xc(%rsp)
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe5c(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movl   $0x5,0xc(%rsp)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movl   $0x4,0xc(%rsp)
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x18(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe15(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movl   $0x6,0xc(%rsp)
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
movl   $0x7,0xc(%rsp)
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1050 <nexsup_@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"demo--Sending ifunc=1 showwind/getsize.\0A\00"
@.str.1 = [45 x i8] c"demo-window size is %f %f resol=%f color=%f\0A\00"
@.str.2 = [36 x i8] c"demo--Sending ifunc=2 beginp/clear\0A\00"
@.str.3 = [32 x i8] c"demo--Sending ifunc=3, pscode.\0A\00"
@.str.4 = [55 x i8] c".20 setgray newpath 50 50 moveto 100 500 lineto stroke\00"
@.str.5 = [30 x i8] c"demo--Sending ifunc=5, flush\0A\00"
@.str.6 = [83 x i8] c"newpath 100 100 moveto 100 0 rlineto 0 100 rlineto -100 0 rlineto closepath eofill\00"
@.str.7 = [39 x i8] c"newpath 0 0 moveto 20 20 lineto stroke\00"
@.str.8 = [36 x i8] c"demo--Sending ifunc=4 read cursor.\0A\00"
@.str.9 = [24 x i8] c"demo--Cursor= %f %f %f\0A\00"
@.str.10 = [36 x i8] c"demo--Sending ifunc=6, end picture\0A\00"
@.str.11 = [37 x i8] c"demo--Sending ifunc=7, close socket\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca [20 x float]
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* null, i8** %5
store i32 1, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %5
%10 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%11 = call i32 @nexsup_(i32* %7, i8* %9, float* %10)
%12 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%13 = load float, float* %12
%14 = fpext float %13 to double
%15 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 1
%16 = load float, float* %15
%17 = fpext float %16 to double
%18 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 2
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 3
%22 = load float, float* %21
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), double %14, double %17, double %20, double %23)
store i32 2, i32* %7
%25 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
store float 1.000000e+00, float* %25
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%27 = load i8*, i8** %5
%28 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%29 = call i32 @nexsup_(i32* %7, i8* %27, float* %28)
store i32 3, i32* %7
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%31 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%32 = call i32 @nexsup_(i32* %7, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0), float* %31)
store i32 5, i32* %7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%34 = load i8*, i8** %5
%35 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%36 = call i32 @nexsup_(i32* %7, i8* %34, float* %35)
store i32 3, i32* %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%38 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%39 = call i32 @nexsup_(i32* %7, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.6, i64 0, i64 0), float* %38)
store i32 3, i32* %7
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%41 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%42 = call i32 @nexsup_(i32* %7, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), float* %41)
store i32 5, i32* %7
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%44 = load i8*, i8** %5
%45 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%46 = call i32 @nexsup_(i32* %7, i8* %44, float* %45)
store i32 4, i32* %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%48 = load i8*, i8** %5
%49 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%50 = call i32 @nexsup_(i32* %7, i8* %48, float* %49)
%51 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 1
%55 = load float, float* %54
%56 = fpext float %55 to double
%57 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 2
%58 = load float, float* %57
%59 = fpext float %58 to double
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), double %53, double %56, double %59)
store i32 6, i32* %7
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
%62 = load i8*, i8** %5
%63 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%64 = call i32 @nexsup_(i32* %7, i8* %62, float* %63)
store i32 7, i32* %7
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0))
%66 = load i8*, i8** %5
%67 = getelementptr inbounds [20 x float], [20 x float]* %6, i64 0, i64 0
%68 = call i32 @nexsup_(i32* %7, i8* %66, float* %67)
%69 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [45 x i8] c"demo-window size is %f %f resol=%f color=%f\0A\00"
@.str.4 = [55 x i8] c".20 setgray newpath 50 50 moveto 100 500 lineto stroke\00"
@.str.6 = [83 x i8] c"newpath 100 100 moveto 100 0 rlineto 0 100 rlineto -100 0 rlineto closepath eofill\00"
@.str.7 = [39 x i8] c"newpath 0 0 moveto 20 20 lineto stroke\00"
@.str.9 = [24 x i8] c"demo--Cursor= %f %f %f\0A\00"
@str = [40 x i8] c"demo--Sending ifunc=1 showwind/getsize.\00"
@str.12 = [35 x i8] c"demo--Sending ifunc=2 beginp/clear\00"
@str.16 = [31 x i8] c"demo--Sending ifunc=3, pscode.\00"
@str.17 = [29 x i8] c"demo--Sending ifunc=5, flush\00"
@str.18 = [35 x i8] c"demo--Sending ifunc=4 read cursor.\00"
@str.19 = [35 x i8] c"demo--Sending ifunc=6, end picture\00"
@str.20 = [36 x i8] c"demo--Sending ifunc=7, close socket\00"
define void @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x float]
%4 = alloca i32
%5 = bitcast [20 x float]* %3 to i8*
%6 = bitcast i32* %4 to i8*
store i32 1, i32* %4
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%8 = getelementptr inbounds [20 x float], [20 x float]* %3, i64 0, i64 0
%9 = call i32 @nexsup_(i32* %4, i8* null, float* %8)
%10 = load float, float* %8
%11 = fpext float %10 to double
%12 = getelementptr inbounds [20 x float], [20 x float]* %3, i64 0, i64 1
%13 = load float, float* %12
%14 = fpext float %13 to double
%15 = getelementptr inbounds [20 x float], [20 x float]* %3, i64 0, i64 2
%16 = load float, float* %15
%17 = fpext float %16 to double
%18 = getelementptr inbounds [20 x float], [20 x float]* %3, i64 0, i64 3
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), double %11, double %14, double %17, double %20)
store i32 2, i32* %4
store float 1.000000e+00, float* %8
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.12, i64 0, i64 0))
%23 = call i32 @nexsup_(i32* %4, i8* null, float* %8)
store i32 3, i32* %4
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.16, i64 0, i64 0))
%25 = call i32 @nexsup_(i32* %4, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0), float* %8)
store i32 5, i32* %4
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.17, i64 0, i64 0))
%27 = call i32 @nexsup_(i32* %4, i8* null, float* %8)
store i32 3, i32* %4
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.16, i64 0, i64 0))
%29 = call i32 @nexsup_(i32* %4, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.6, i64 0, i64 0), float* %8)
store i32 3, i32* %4
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.16, i64 0, i64 0))
%31 = call i32 @nexsup_(i32* %4, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), float* %8)
store i32 5, i32* %4
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.17, i64 0, i64 0))
%33 = call i32 @nexsup_(i32* %4, i8* null, float* %8)
store i32 4, i32* %4
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.18, i64 0, i64 0))
%35 = call i32 @nexsup_(i32* %4, i8* null, float* %8)
%36 = load float, float* %8
%37 = fpext float %36 to double
%38 = load float, float* %12
%39 = fpext float %38 to double
%40 = load float, float* %15
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), double %37, double %39, double %41)
store i32 6, i32* %4
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.19, i64 0, i64 0))
%44 = call i32 @nexsup_(i32* %4, i8* null, float* %8)
store i32 7, i32* %4
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.20, i64 0, i64 0))
%46 = call i32 @nexsup_(i32* %4, i8* null, float* %8)
%47 = call i32 @exit(i32 0)
unreachable
}