#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 */
float convl(float, double, float, float, float);
float g_get_charsize();
int /*<<< orphan*/ g_label(char *);
int /*<<< orphan*/ g_lineto(float, float);
int /*<<< orphan*/ g_moveto(float, float);
int /*<<< orphan*/ g_select_viewport(int);
int /*<<< orphan*/ g_set_charsize(float);
int /*<<< orphan*/ g_set_textdirection(int);
char *psnd_sprintf_temp(char *, float);
void labplot(int vp, int vp_box, int *picked, int *labpos, float *ppml, int i,
             int nlabel, float lheight, float box_height, float *xr, float xmin,
             float xmax, float ymin, float ymax) {
  float fac, p, xp, yp;
  float ticlength, lval, lx, charsize;
  char *label;
  g_select_viewport(vp_box);
  p = box_height / 10;
  lx = convl((float)(i + 1), 1.0, (float)nlabel, xmin, xmax);
  if (lx == xmin || lx == xmax)
    return;
  lval = ppml[labpos[i] - 1];
  g_moveto(lx + 0.5 * lheight, box_height / 2);
  g_set_textdirection(90);
  charsize = g_get_charsize();
  g_set_charsize(2 * lheight);
  label = psnd_sprintf_temp("%6.4f", lval);
  g_label(label);
  g_set_charsize(charsize);
  g_set_textdirection(0);
  g_moveto(lx, box_height / 2);
  xp = lx;
  yp = box_height / 2 - p;
  g_lineto(xp, yp);
  xp = (float)picked[labpos[i] - 1];
  yp = p;
  g_lineto(xp, yp);
  yp = 0;
  g_lineto(xp, yp);
  g_select_viewport(vp);
  yp = xr[picked[labpos[i] - 1] - 1];
  ticlength = (ymax - ymin) / 100;
  if (yp > 0.0)
    fac = 1.0;
  else
    fac = -1.0;
  yp += fac * ticlength;
  g_moveto(xp, yp);
  yp += fac * ticlength;
  g_lineto(xp, yp);
}


x86 assembly (clang, -O0):
<labplot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movss  %xmm0,-0x28(%rbp)
movss  %xmm1,-0x2c(%rbp)
movss  %xmm2,-0x30(%rbp)
movss  %xmm3,-0x34(%rbp)
movss  %xmm4,-0x38(%rbp)
movss  %xmm5,-0x3c(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <g_select_viewport@plt>
movss  -0x2c(%rbp),%xmm0
movss  0xe28(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
cvtsi2ssl 0x10(%rbp),%xmm2
movss  -0x30(%rbp),%xmm3
movss  -0x34(%rbp),%xmm4
movsd  0xdee(%rip),%xmm1
call   1080 <convl@plt>
movss  %xmm0,-0x58(%rbp)
movss  -0x58(%rbp),%xmm0
ucomiss -0x30(%rbp),%xmm0
jne    1236 <labplot+0xa6>
jp     1236 <labplot+0xa6>
jmp    124b <labplot+0xbb>
movss  -0x58(%rbp),%xmm0
ucomiss -0x34(%rbp),%xmm0
jne    1250 <labplot+0xc0>
jp     1250 <labplot+0xc0>
jmp    147a <labplot+0x2ea>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x58(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd7f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x2c(%rbp),%xmm1
movss  0xd76(%rip),%xmm2
divss  %xmm2,%xmm1
call   1060 <g_moveto@plt>
mov    $0x5a,%edi
call   1090 <g_set_textdirection@plt>
mov    $0x0,%al
call   1050 <g_get_charsize@plt>
movss  %xmm0,-0x5c(%rbp)
movss  0xd4f(%rip),%xmm0
mulss  -0x28(%rbp),%xmm0
call   1040 <g_set_charsize@plt>
movss  -0x54(%rbp),%xmm0
lea    0xd45(%rip),%rdi
call   1030 <psnd_sprintf_temp@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   10a0 <g_label@plt>
movss  -0x5c(%rbp),%xmm0
call   1040 <g_set_charsize@plt>
xor    %edi,%edi
call   1090 <g_set_textdirection@plt>
movss  -0x58(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm1
movss  0xd04(%rip),%xmm2
divss  %xmm2,%xmm1
call   1060 <g_moveto@plt>
movss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  0xce4(%rip),%xmm1
divss  %xmm1,%xmm0
subss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm1
call   10b0 <g_lineto@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm1
call   10b0 <g_lineto@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm1
call   10b0 <g_lineto@plt>
mov    -0x4(%rbp),%edi
call   1070 <g_select_viewport@plt>
mov    0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movslq -0x24(%rbp),%rsi
mov    (%rdx,%rsi,4),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,4),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x3c(%rbp),%xmm0
subss  -0x38(%rbp),%xmm0
movss  0xc2e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x4c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1417 <labplot+0x287>
movss  0xc13(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
jmp    1424 <labplot+0x294>
movss  0xbfd(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
movss  -0x50(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm1
call   1060 <g_moveto@plt>
movss  -0x40(%rbp),%xmm0
movss  -0x50(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm1
call   10b0 <g_lineto@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<labplot>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movss  %xmm5,0x14(%rsp)
movss  %xmm4,0x24(%rsp)
movss  %xmm3,0x10(%rsp)
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0x1c(%rsp)
mov    %r9d,%ebx
mov    %r8,%rbp
mov    %rcx,%r12
mov    %rdx,%r14
mov    %edi,%r15d
mov    0x68(%rsp),%r13
mov    %esi,%edi
call   1070 <g_select_viewport@plt>
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
xorps  %xmm2,%xmm2
cvtsi2ssl 0x60(%rsp),%xmm2
movsd  0xe18(%rip),%xmm1
movss  0xc(%rsp),%xmm3
movss  0x10(%rsp),%xmm4
call   1080 <convl@plt>
ucomiss 0xc(%rsp),%xmm0
jne    1216 <labplot+0x86>
jnp    13b2 <labplot+0x222>
ucomiss 0x10(%rsp),%xmm0
jne    1223 <labplot+0x93>
jnp    13b2 <labplot+0x222>
movss  0x8(%rsp),%xmm1
movaps %xmm1,%xmm2
divss  0xdcc(%rip),%xmm2
movss  %xmm2,0xc(%rsp)
movslq %ebx,%rbx
movslq (%r12,%rbx,4),%rax
movss  -0x4(%rbp,%rax,4),%xmm2
movss  %xmm2,0x10(%rsp)
movss  %xmm0,0x18(%rsp)
cvtss2sd %xmm0,%xmm0
movss  0x1c(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  0xdaf(%rip),%xmm2
addsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
mulss  0xd88(%rip),%xmm1
movss  %xmm1,0x8(%rsp)
call   1060 <g_moveto@plt>
mov    $0x5a,%edi
call   1090 <g_set_textdirection@plt>
xor    %eax,%eax
call   1050 <g_get_charsize@plt>
movss  %xmm0,0x20(%rsp)
movss  0x1c(%rsp),%xmm0
addss  %xmm0,%xmm0
call   1040 <g_set_charsize@plt>
lea    0xd74(%rip),%rdi
movss  0x10(%rsp),%xmm0
call   1030 <psnd_sprintf_temp@plt>
mov    %rax,%rdi
call   10a0 <g_label@plt>
movss  0x20(%rsp),%xmm0
call   1040 <g_set_charsize@plt>
xor    %edi,%edi
call   1090 <g_set_textdirection@plt>
movss  0x18(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1060 <g_moveto@plt>
movss  0x8(%rsp),%xmm1
subss  0xc(%rsp),%xmm1
movss  0x18(%rsp),%xmm0
call   10b0 <g_lineto@plt>
movslq (%r12,%rbx,4),%rax
xorps  %xmm0,%xmm0
cvtsi2ssl -0x4(%r14,%rax,4),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm1
call   10b0 <g_lineto@plt>
xorps  %xmm1,%xmm1
movss  0x8(%rsp),%xmm0
call   10b0 <g_lineto@plt>
mov    %r15d,%edi
call   1070 <g_select_viewport@plt>
movslq (%r12,%rbx,4),%rax
movslq -0x4(%r14,%rax,4),%rax
movss  -0x4(%r13,%rax,4),%xmm1
xor    %eax,%eax
ucomiss 0xcbd(%rip),%xmm1
seta   %al
movss  0x14(%rsp),%xmm0
subss  0x24(%rsp),%xmm0
divss  0xca2(%rip),%xmm0
lea    0xcb3(%rip),%rcx
mulss  (%rcx,%rax,4),%xmm0
movss  %xmm0,0x14(%rsp)
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <g_moveto@plt>
movss  0xc(%rsp),%xmm1
addss  0x14(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <g_lineto@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%6.4f\00"
define void @labplot(i32 %0, i32 %1, i32* %2, i32* %3, float* %4, i32 %5, i32 %6, float %7, float %8, float* %9, float %10, float %11, float %12, float %13) {
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca float*
%20 = alloca i32
%21 = alloca i32
%22 = alloca float
%23 = alloca float
%24 = alloca float*
%25 = alloca float
%26 = alloca float
%27 = alloca float
%28 = alloca float
%29 = alloca float
%30 = alloca float
%31 = alloca float
%32 = alloca float
%33 = alloca float
%34 = alloca float
%35 = alloca float
%36 = alloca float
%37 = alloca i8*
store i32 %0, i32* %15
store i32 %1, i32* %16
store i32* %2, i32** %17
store i32* %3, i32** %18
store float* %4, float** %19
store i32 %5, i32* %20
store i32 %6, i32* %21
store float %7, float* %22
store float %8, float* %23
store float* %9, float** %24
store float %10, float* %25
store float %11, float* %26
store float %12, float* %27
store float %13, float* %28
%38 = load i32, i32* %16
%39 = call i32 @g_select_viewport(i32 %38)
%40 = load float, float* %23
%41 = fdiv float %40, 1.000000e+01
store float %41, float* %30
%42 = load i32, i32* %20
%43 = add nsw i32 %42, 1
%44 = sitofp i32 %43 to float
%45 = load i32, i32* %21
%46 = sitofp i32 %45 to float
%47 = load float, float* %25
%48 = load float, float* %26
%49 = call float @convl(float %44, double 1.000000e+00, float %46, float %47, float %48)
store float %49, float* %35
%50 = load float, float* %35
%51 = load float, float* %25
%52 = fcmp oeq float %50, %51
br i1 %52, label %57, label %53
53: ; preds = %14
%54 = load float, float* %35
%55 = load float, float* %26
%56 = fcmp oeq float %54, %55
br i1 %56, label %57, label %58
57: ; preds = %53, %14
br label %161
58: ; preds = %53
%59 = load float*, float** %19
%60 = load i32*, i32** %18
%61 = load i32, i32* %20
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
%64 = load i32, i32* %63
%65 = sub nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds float, float* %59, i64 %66
%68 = load float, float* %67
store float %68, float* %34
%69 = load float, float* %35
%70 = fpext float %69 to double
%71 = load float, float* %22
%72 = fpext float %71 to double
%73 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %72, double %70)
%74 = fptrunc double %73 to float
%75 = load float, float* %23
%76 = fdiv float %75, 2.000000e+00
%77 = call i32 @g_moveto(float %74, float %76)
%78 = call i32 @g_set_textdirection(i32 90)
%79 = call float (...) @g_get_charsize()
store float %79, float* %36
%80 = load float, float* %22
%81 = fmul float 2.000000e+00, %80
%82 = call i32 @g_set_charsize(float %81)
%83 = load float, float* %34
%84 = call i8* @psnd_sprintf_temp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %83)
store i8* %84, i8** %37
%85 = load i8*, i8** %37
%86 = call i32 @g_label(i8* %85)
%87 = load float, float* %36
%88 = call i32 @g_set_charsize(float %87)
%89 = call i32 @g_set_textdirection(i32 0)
%90 = load float, float* %35
%91 = load float, float* %23
%92 = fdiv float %91, 2.000000e+00
%93 = call i32 @g_moveto(float %90, float %92)
%94 = load float, float* %35
store float %94, float* %31
%95 = load float, float* %23
%96 = fdiv float %95, 2.000000e+00
%97 = load float, float* %30
%98 = fsub float %96, %97
store float %98, float* %32
%99 = load float, float* %31
%100 = load float, float* %32
%101 = call i32 @g_lineto(float %99, float %100)
%102 = load i32*, i32** %17
%103 = load i32*, i32** %18
%104 = load i32, i32* %20
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i32, i32* %103, i64 %105
%107 = load i32, i32* %106
%108 = sub nsw i32 %107, 1
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i32, i32* %102, i64 %109
%111 = load i32, i32* %110
%112 = sitofp i32 %111 to float
store float %112, float* %31
%113 = load float, float* %30
store float %113, float* %32
%114 = load float, float* %31
%115 = load float, float* %32
%116 = call i32 @g_lineto(float %114, float %115)
store float 0.000000e+00, float* %32
%117 = load float, float* %31
%118 = load float, float* %32
%119 = call i32 @g_lineto(float %117, float %118)
%120 = load i32, i32* %15
%121 = call i32 @g_select_viewport(i32 %120)
%122 = load float*, float** %24
%123 = load i32*, i32** %17
%124 = load i32*, i32** %18
%125 = load i32, i32* %20
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %124, i64 %126
%128 = load i32, i32* %127
%129 = sub nsw i32 %128, 1
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %123, i64 %130
%132 = load i32, i32* %131
%133 = sub nsw i32 %132, 1
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds float, float* %122, i64 %134
%136 = load float, float* %135
store float %136, float* %32
%137 = load float, float* %28
%138 = load float, float* %27
%139 = fsub float %137, %138
%140 = fdiv float %139, 1.000000e+02
store float %140, float* %33
%141 = load float, float* %32
%142 = fpext float %141 to double
%143 = fcmp ogt double %142, 0.000000e+00
br i1 %143, label %144, label %145
144: ; preds = %58
store float 1.000000e+00, float* %29
br label %146
145: ; preds = %58
store float -1.000000e+00, float* %29
br label %146
146: ; preds = %145, %144
%147 = load float, float* %29
%148 = load float, float* %33
%149 = load float, float* %32
%150 = call float @llvm.fmuladd.f32(float %147, float %148, float %149)
store float %150, float* %32
%151 = load float, float* %31
%152 = load float, float* %32
%153 = call i32 @g_moveto(float %151, float %152)
%154 = load float, float* %29
%155 = load float, float* %33
%156 = load float, float* %32
%157 = call float @llvm.fmuladd.f32(float %154, float %155, float %156)
store float %157, float* %32
%158 = load float, float* %31
%159 = load float, float* %32
%160 = call i32 @g_lineto(float %158, float %159)
br label %161
161: ; preds = %146, %57
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%6.4f\00"
define void @labplot(i32 %0, i32 %1, i32* nocapture %2, i32* nocapture %3, float* nocapture %4, i32 %5, i32 %6, float %7, float %8, float* nocapture %9, float %10, float %11, float %12, float %13) {
%15 = tail call i32 @g_select_viewport(i32 %1)
%16 = fdiv float %8, 1.000000e+01
%17 = add nsw i32 %5, 1
%18 = sitofp i32 %17 to float
%19 = sitofp i32 %6 to float
%20 = tail call float @convl(float %18, double 1.000000e+00, float %19, float %10, float %11)
%21 = fcmp oeq float %20, %10
%22 = fcmp oeq float %20, %11
%23 = or i1 %21, %22
br i1 %23, label %75, label %24
24: ; preds = %14
%25 = sext i32 %5 to i64
%26 = getelementptr inbounds i32, i32* %3, i64 %25
%27 = load i32, i32* %26
%28 = add nsw i32 %27, -1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %4, i64 %29
%31 = load float, float* %30
%32 = fpext float %20 to double
%33 = fpext float %7 to double
%34 = tail call double @llvm.fmuladd.f64(double %33, double 5.000000e-01, double %32)
%35 = fptrunc double %34 to float
%36 = fmul float %8, 5.000000e-01
%37 = tail call i32 @g_moveto(float %35, float %36)
%38 = tail call i32 @g_set_textdirection(i32 90)
%39 = tail call float (...) @g_get_charsize()
%40 = fmul float %7, 2.000000e+00
%41 = tail call i32 @g_set_charsize(float %40)
%42 = tail call i8* @psnd_sprintf_temp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %31)
%43 = tail call i32 @g_label(i8* %42)
%44 = tail call i32 @g_set_charsize(float %39)
%45 = tail call i32 @g_set_textdirection(i32 0)
%46 = tail call i32 @g_moveto(float %20, float %36)
%47 = fsub float %36, %16
%48 = tail call i32 @g_lineto(float %20, float %47)
%49 = load i32, i32* %26
%50 = add nsw i32 %49, -1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %2, i64 %51
%53 = load i32, i32* %52
%54 = sitofp i32 %53 to float
%55 = tail call i32 @g_lineto(float %54, float %16)
%56 = tail call i32 @g_lineto(float %54, float 0.000000e+00)
%57 = tail call i32 @g_select_viewport(i32 %0)
%58 = load i32, i32* %26
%59 = add nsw i32 %58, -1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %2, i64 %60
%62 = load i32, i32* %61
%63 = add nsw i32 %62, -1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds float, float* %9, i64 %64
%66 = load float, float* %65
%67 = fsub float %13, %12
%68 = fdiv float %67, 1.000000e+02
%69 = fcmp ogt float %66, 0.000000e+00
%70 = select i1 %69, float 1.000000e+00, float -1.000000e+00
%71 = tail call float @llvm.fmuladd.f32(float %70, float %68, float %66)
%72 = tail call i32 @g_moveto(float %54, float %71)
%73 = tail call float @llvm.fmuladd.f32(float %70, float %68, float %71)
%74 = tail call i32 @g_lineto(float %54, float %73)
br label %75
75: ; preds = %14, %24
ret void
}