#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 */
struct vtx_data {
  int dummy;
};
struct bilist {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free_kl(struct bilist ****, struct bilist **, int **,
                           int **);
int nway_kl(struct vtx_data **, int, struct bilist ****, struct bilist **,
            int **, int **, int *, int, int, double *, float **, int **, int,
            int, int **, double *);
int /*<<< orphan*/ printf(char *, ...);
void klspiff(struct vtx_data **graph, int nvtxs, int *sets, int nsets,
             int (*hops)[8], double *goal, float *term_wgts[], int max_dev,
             double maxdeg, int using_ewgts, int **bndy_list, double *weights) {
  extern FILE *Output_File;
  extern double CUT_TO_HOP_COST;
  extern int DEBUG_TRACE;
  extern int DEBUG_KL;
  extern double kl_total_time;
  extern double kl_init_time;
  extern double nway_kl_time;
  struct bilist ****buckets;
  struct bilist **listspace;
  float *twptr;
  int **dvals;
  int **tops;
  double time, time1;
  float maxterm;
  int maxhop;
  int maxdval;
  double cut_cost;
  double hop_cost;
  int error;
  int i, j;
  double seconds();
  int kl_init(), nway_kl();
  void count();
  time = seconds();
  if (DEBUG_TRACE > 0) {
    printf("<Entering klspiff, nvtxs = %d>\n", nvtxs);
  }
  maxhop = 0;
  for (i = 0; i < nsets; i++) {
    for (j = 0; j < nsets; j++) {
      if (hops[i][j] > maxhop) {
        maxhop = hops[i][j];
      }
    }
  }
  maxterm = 0;
  cut_cost = hop_cost = 1;
  if (term_wgts[1] != NULL) {
    for (j = 1; j < nsets; j++) {
      twptr = term_wgts[j];
      for (i = nvtxs; i; i--) {
        ++twptr;
        if (*twptr > maxterm) {
          maxterm = *twptr;
        } else if (-*twptr > maxterm) {
          maxterm = -*twptr;
        }
      }
    }
    if (CUT_TO_HOP_COST > 1) {
      cut_cost = CUT_TO_HOP_COST;
    } else {
      hop_cost = 1.0 / CUT_TO_HOP_COST;
    }
  }
  maxdval = (2 * maxterm * hop_cost + .5) + (maxdeg * cut_cost + .5) * maxhop;
  time1 = seconds();
  error = kl_init(&buckets, &listspace, &dvals, &tops, nvtxs, nsets, maxdval);
  kl_init_time += seconds() - time1;
  if (!error) {
    if (DEBUG_KL > 0) {
      printf(" Before KL: ");
      count(graph, nvtxs, sets, nsets, hops, 0, using_ewgts);
    }
    time1 = seconds();
    error = nway_kl(graph, nvtxs, buckets, listspace, tops, dvals, sets,
                    maxdval, nsets, goal, term_wgts, hops, max_dev, using_ewgts,
                    bndy_list, weights);
    nway_kl_time += seconds() - time1;
    if (DEBUG_KL > 1) {
      printf(" After KL:");
      count(graph, nvtxs, sets, nsets, hops, 0, using_ewgts);
    }
  }
  if (error) {
    printf("\nWARNING: No space to perform KL on graph with %d vertices.\n",
           nvtxs);
    printf("         NO LOCAL REFINEMENT PERFORMED.\n\n");
    if (Output_File != NULL) {
      fprintf(Output_File,
              "\nWARNING: No space to perform KL on graph with %d vertices.\n",
              nvtxs);
      fprintf(Output_File, "         LOCAL REFINEMENT NOT PERFORMED.\n\n");
    }
  }
  free_kl(buckets, listspace, dvals, tops);
  kl_total_time += seconds() - time;
}


x86 assembly (clang, -O0):
<klspiff>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x30(%rbp)
mov    %esi,-0x34(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %ecx,-0x44(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
movsd  %xmm0,-0x60(%rbp)
mov    $0x0,%al
call   1050 <seconds@plt>
movsd  %xmm0,-0x90(%rbp)
ff
mov    0x2de1(%rip),%rax
cmpl   $0x0,(%rax)
jle    11e1 <klspiff+0x71>
mov    -0x34(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0xa0(%rbp)
movl   $0x0,-0xc0(%rbp)
mov    -0xc0(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1299 <klspiff+0x129>
movl   $0x0,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1280 <klspiff+0x110>
mov    -0x50(%rbp),%rax
movslq -0xc0(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0xc4(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0xa0(%rbp),%eax
jle    1267 <klspiff+0xf7>
mov    -0x50(%rbp),%rax
movslq -0xc0(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0xc4(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0xa0(%rbp)
jmp    126c <klspiff+0xfc>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    120e <klspiff+0x9e>
jmp    1285 <klspiff+0x115>
mov    -0xc0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc0(%rbp)
jmp    11f5 <klspiff+0x85>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
movsd  0xd54(%rip),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xd44(%rip),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1416 <klspiff+0x2a6>
movl   $0x1,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    13c1 <klspiff+0x251>
mov    0x10(%rbp),%rax
movslq -0xc4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x78(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0xc0(%rbp)
cmpl   $0x0,-0xc0(%rbp)
je     13a8 <klspiff+0x238>
mov    -0x78(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
movss  (%rax),%xmm0
ucomiss -0x9c(%rbp),%xmm0
jbe    134b <klspiff+0x1db>
mov    -0x78(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
jmp    138f <klspiff+0x21f>
mov    -0x78(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
ucomiss -0x9c(%rbp),%xmm0
jbe    138a <klspiff+0x21a>
mov    -0x78(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
jmp    138f <klspiff+0x21f>
jmp    1394 <klspiff+0x224>
mov    -0xc0(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc0(%rbp)
jmp    1308 <klspiff+0x198>
jmp    13ad <klspiff+0x23d>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    12dd <klspiff+0x16d>
mov    0x2bf8(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xc2c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13f6 <klspiff+0x286>
mov    0x2bdb(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    1411 <klspiff+0x2a1>
movsd  0xc02(%rip),%xmm0
mov    0x2bbb(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    1416 <klspiff+0x2a6>
movss  0xbf2(%rip),%xmm0
mulss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm0,%xmm1
movsd  0xbca(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0xb0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
movsd  0xbad(%rip),%xmm2
addsd  %xmm2,%xmm0
cvtsi2sdl -0xa0(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xa4(%rbp)
mov    $0x0,%al
call   1050 <seconds@plt>
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x34(%rbp),%r8d
mov    -0x44(%rbp),%r9d
mov    -0xa4(%rbp),%eax
lea    -0x68(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    -0x88(%rbp),%rcx
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <kl_init@plt>
mov    %eax,-0xbc(%rbp)
mov    $0x0,%al
call   1050 <seconds@plt>
subsd  -0x98(%rbp),%xmm0
ff
mov    0x2b11(%rip),%rax
addsd  (%rax),%xmm0
mov    0x2b06(%rip),%rax
movsd  %xmm0,(%rax)
cmpl   $0x0,-0xbc(%rbp)
jne    1649 <klspiff+0x4d9>
mov    0x2ad6(%rip),%rax
cmpl   $0x0,(%rax)
jle    152b <klspiff+0x3bb>
lea    0xb32(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x44(%rbp),%ecx
mov    -0x50(%rbp),%r8
mov    0x20(%rbp),%eax
xor    %r9d,%r9d
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <count@plt>
mov    $0x0,%al
call   1050 <seconds@plt>
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x68(%rbp),%rdx
mov    -0x70(%rbp),%rcx
mov    -0x88(%rbp),%r8
mov    -0x80(%rbp),%r9
mov    -0x40(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0xa4(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    -0x44(%rbp),%r13d
mov    -0x58(%rbp),%r12
mov    0x10(%rbp),%r15
mov    -0x50(%rbp),%r14
mov    0x18(%rbp),%ebx
mov    0x20(%rbp),%r11d
mov    0x28(%rbp),%r10
mov    0x30(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0xe0(%rbp),%rax
mov    %rax,(%rsp)
mov    -0xd4(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0xd0(%rbp),%rax
mov    %r13d,0x10(%rsp)
mov    %r12,0x18(%rsp)
mov    %r15,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %ebx,0x30(%rsp)
mov    %r11d,0x38(%rsp)
mov    %r10,0x40(%rsp)
mov    %rax,0x48(%rsp)
call   1090 <nway_kl@plt>
mov    %eax,-0xbc(%rbp)
mov    $0x0,%al
call   1050 <seconds@plt>
subsd  -0x98(%rbp),%xmm0
ff
mov    0x29e3(%rip),%rax
addsd  (%rax),%xmm0
mov    0x29d8(%rip),%rax
movsd  %xmm0,(%rax)
mov    0x29bd(%rip),%rax
cmpl   $0x1,(%rax)
jle    1644 <klspiff+0x4d4>
lea    0xa26(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x44(%rbp),%ecx
mov    -0x50(%rbp),%r8
mov    0x20(%rbp),%eax
xor    %r9d,%r9d
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <count@plt>
jmp    1649 <klspiff+0x4d9>
cmpl   $0x0,-0xbc(%rbp)
je     16be <klspiff+0x54e>
mov    -0x34(%rbp),%esi
lea    0x9ec(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xa1b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x296c(%rip),%rax
cmpq   $0x0,(%rax)
je     16b9 <klspiff+0x549>
mov    0x295b(%rip),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%edx
lea    0x9b2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2940(%rip),%rax
mov    (%rax),%rdi
lea    0xa01(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    16be <klspiff+0x54e>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x80(%rbp),%rdx
mov    -0x88(%rbp),%rcx
call   1040 <free_kl@plt>
mov    $0x0,%al
call   1050 <seconds@plt>
subsd  -0x90(%rbp),%xmm0
ff
mov    0x28cc(%rip),%rax
addsd  (%rax),%xmm0
mov    0x28c1(%rip),%rax
movsd  %xmm0,(%rax)
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<klspiff>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movq   %xmm0,(%rsp)
mov    %r9,0x30(%rsp)
mov    %r8,%r14
mov    %ecx,%r15d
mov    %rdx,0x38(%rsp)
mov    %esi,%r13d
mov    %rdi,%r12
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <seconds@plt>
movq   %xmm0,0x40(%rsp)
mov    0x2dd9(%rip),%rax
cmpl   $0x0,(%rax)
jle    11e5 <klspiff+0x55>
lea    0xe45(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
test   %r15d,%r15d
jle    13bb <klspiff+0x22b>
mov    %r15d,%eax
mov    %eax,%r11d
and    $0xfffffff8,%r11d
lea    -0x8(%r11),%r9
mov    %r9,%r10
shr    $0x3,%r10
add    $0x1,%r10
mov    %r10,%r8
and    $0xfffffffffffffffe,%r8
lea    0x30(%r14),%rdi
xor    %ebx,%ebx
mov    %r14,%rdx
xor    %ebp,%ebp
jmp    1235 <klspiff+0xa5>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0x20,%rdi
add    $0x20,%rdx
cmp    %rax,%rbx
je     13bb <klspiff+0x22b>
cmp    $0x8,%r15d
jae    1250 <klspiff+0xc0>
xor    %esi,%esi
jmp    1390 <klspiff+0x200>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movd   %ebp,%xmm0
pshufd $0x0,%xmm0,%xmm0
test   %r9,%r9
je     13a6 <klspiff+0x216>
mov    %r8,%rsi
xor    %ebp,%ebp
movdqa %xmm0,%xmm1
nopl   0x0(%rax,%rax,1)
movdqu -0x30(%rdi,%rbp,4),%xmm2
movdqu -0x20(%rdi,%rbp,4),%xmm3
movdqu -0x10(%rdi,%rbp,4),%xmm4
movdqu (%rdi,%rbp,4),%xmm5
movdqa %xmm2,%xmm6
pcmpgtd %xmm0,%xmm6
pand   %xmm6,%xmm2
pandn  %xmm0,%xmm6
por    %xmm2,%xmm6
movdqa %xmm3,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm3
pandn  %xmm1,%xmm2
por    %xmm3,%xmm2
movdqa %xmm4,%xmm0
pcmpgtd %xmm6,%xmm0
pand   %xmm0,%xmm4
pandn  %xmm6,%xmm0
por    %xmm4,%xmm0
movdqa %xmm5,%xmm1
pcmpgtd %xmm2,%xmm1
pand   %xmm1,%xmm5
pandn  %xmm2,%xmm1
por    %xmm5,%xmm1
add    $0x10,%rbp
add    $0xfffffffffffffffe,%rsi
jne    1270 <klspiff+0xe0>
test   $0x1,%r10b
je     132c <klspiff+0x19c>
mov    %rbx,%rsi
shl    $0x5,%rsi
add    %r14,%rsi
movdqu (%rsi,%rbp,4),%xmm2
movdqu 0x10(%rsi,%rbp,4),%xmm3
movdqa %xmm2,%xmm4
pcmpgtd %xmm0,%xmm4
pand   %xmm4,%xmm2
pandn  %xmm0,%xmm4
por    %xmm2,%xmm4
movdqa %xmm3,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm3
pandn  %xmm1,%xmm2
por    %xmm3,%xmm2
movdqa %xmm4,%xmm0
movdqa %xmm2,%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm0
pandn  %xmm1,%xmm2
por    %xmm0,%xmm2
pshufd $0xee,%xmm2,%xmm0
movdqa %xmm2,%xmm1
pcmpgtd %xmm0,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm0,%xmm1
por    %xmm2,%xmm1
pshufd $0x55,%xmm1,%xmm0
movdqa %xmm1,%xmm2
pcmpgtd %xmm0,%xmm2
pand   %xmm2,%xmm1
pandn  %xmm0,%xmm2
por    %xmm1,%xmm2
movd   %xmm2,%ebp
mov    %r11,%rsi
cmp    %rax,%r11
je     1220 <klspiff+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rdx,%rsi,4),%ecx
cmp    %ebp,%ecx
cmovg  %ecx,%ebp
add    $0x1,%rsi
cmp    %rsi,%rax
jne    1390 <klspiff+0x200>
jmp    1220 <klspiff+0x90>
xor    %ebp,%ebp
movdqa %xmm0,%xmm1
test   $0x1,%r10b
jne    12e7 <klspiff+0x157>
jmp    132c <klspiff+0x19c>
mov    0x80(%rsp),%rdx
mov    0x8(%rdx),%rcx
test   %rcx,%rcx
je     14c5 <klspiff+0x335>
pxor   %xmm0,%xmm0
cmp    $0x2,%r15d
jl     1496 <klspiff+0x306>
mov    %r15d,%eax
lea    -0x1(%r13),%r8d
pxor   %xmm0,%xmm0
mov    $0x1,%esi
movaps 0xc1b(%rip),%xmm1
test   %r13d,%r13d
je     1435 <klspiff+0x2a5>
nopw   0x0(%rax,%rax,1)
test   $0x1,%r13b
jne    1410 <klspiff+0x280>
mov    %r13d,%edi
movaps %xmm0,%xmm2
jmp    142c <klspiff+0x29c>
xchg   %ax,%ax
movss  0x4(%rcx),%xmm2
add    $0x4,%rcx
ucomiss %xmm0,%xmm2
ja     1429 <klspiff+0x299>
xorps  %xmm1,%xmm2
ucomiss %xmm0,%xmm2
ja     1429 <klspiff+0x299>
movaps %xmm0,%xmm2
mov    %r8d,%edi
movaps %xmm2,%xmm0
cmp    $0x1,%r13d
jne    1450 <klspiff+0x2c0>
add    $0x1,%rsi
cmp    %rax,%rsi
je     1496 <klspiff+0x306>
mov    (%rdx,%rsi,8),%rcx
test   %r13d,%r13d
jne    1400 <klspiff+0x270>
jmp    1435 <klspiff+0x2a5>
nopl   0x0(%rax)
mov    %edi,%edi
xor    %ebx,%ebx
movaps %xmm2,%xmm0
jmp    146b <klspiff+0x2db>
nopl   0x0(%rax)
movaps %xmm2,%xmm0
add    $0x2,%rbx
cmp    %ebx,%edi
je     1435 <klspiff+0x2a5>
movss  0x4(%rcx,%rbx,4),%xmm2
ucomiss %xmm0,%xmm2
ja     147e <klspiff+0x2ee>
xorps  %xmm1,%xmm2
ucomiss %xmm0,%xmm2
jbe    1481 <klspiff+0x2f1>
movaps %xmm2,%xmm0
movss  0x8(%rcx,%rbx,4),%xmm2
ucomiss %xmm0,%xmm2
ja     1460 <klspiff+0x2d0>
xorps  %xmm1,%xmm2
ucomiss %xmm0,%xmm2
ja     1460 <klspiff+0x2d0>
jmp    1463 <klspiff+0x2d3>
mov    0x2b23(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xb57(%rip),%xmm2
ucomisd %xmm2,%xmm1
ja     14d5 <klspiff+0x345>
movsd  0xb49(%rip),%xmm3
movapd %xmm3,%xmm2
divsd  %xmm1,%xmm2
movapd %xmm3,%xmm1
jmp    14d5 <klspiff+0x345>
movsd  0xb33(%rip),%xmm1
pxor   %xmm0,%xmm0
movapd %xmm1,%xmm2
addss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
movsd  0xb1f(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  (%rsp),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%ebx
xor    %eax,%eax
call   1060 <seconds@plt>
movsd  %xmm0,(%rsp)
sub    $0x8,%rsp
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %r13d,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
push   %rbx
call   1070 <kl_init@plt>
add    $0x10,%rsp
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <seconds@plt>
subsd  (%rsp),%xmm0
mov    0x2a88(%rip),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
test   %ebp,%ebp
jne    1683 <klspiff+0x4f3>
mov    0x2a59(%rip),%rax
cmpl   $0x0,(%rax)
mov    %r12,%rbp
mov    0x38(%rsp),%r12
mov    %rbp,(%rsp)
jle    15bc <klspiff+0x42c>
lea    0xab9(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r12,%rdx
mov    %r15d,%ecx
mov    %r14,%r8
xor    %r9d,%r9d
xor    %eax,%eax
mov    0x98(%rsp),%ebp
push   %rbp
mov    0x10(%rsp),%rbp
call   1030 <count@plt>
add    $0x10,%rsp
xor    %eax,%eax
call   1060 <seconds@plt>
movsd  %xmm0,0x28(%rsp)
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
mov    %rbp,%rdi
mov    %r13d,%esi
push   0xa0(%rsp)
push   0xa0(%rsp)
mov    0xa0(%rsp),%eax
push   %rax
mov    0xa0(%rsp),%eax
push   %rax
push   %r14
push   0xa8(%rsp)
push   0x60(%rsp)
push   %r15
push   %rbx
push   %r12
call   10a0 <nway_kl@plt>
add    $0x50,%rsp
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <seconds@plt>
subsd  0x28(%rsp),%xmm0
mov    0x29a6(%rip),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    0x2987(%rip),%rax
cmpl   $0x2,(%rax)
jl     167f <klspiff+0x4ef>
lea    0xa00(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
sub    $0x8,%rsp
mov    0x8(%rsp),%rdi
mov    %r13d,%esi
mov    %r12,%rdx
mov    %r15d,%ecx
mov    %r14,%r8
xor    %r9d,%r9d
xor    %eax,%eax
mov    0x98(%rsp),%ebx
push   %rbx
call   1030 <count@plt>
add    $0x10,%rsp
test   %ebp,%ebp
je     16d9 <klspiff+0x549>
lea    0x9ce(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xa25(%rip),%rdi
call   1050 <puts@plt>
mov    0x2941(%rip),%rbx
mov    (%rbx),%rdi
test   %rdi,%rdi
je     16d9 <klspiff+0x549>
lea    0x9a2(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%rcx
lea    0x9cb(%rip),%rdi
mov    $0x2a,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    0x20(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
call   1040 <free_kl@plt>
xor    %eax,%eax
call   1060 <seconds@plt>
subsd  0x40(%rsp),%xmm0
mov    0x28b2(%rip),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.vtx_data = type { i32 }
%struct.bilist = type { i32 }
@DEBUG_TRACE = external global i32
@.str = [32 x i8] c"<Entering klspiff, nvtxs = %d>\0A\00"
@CUT_TO_HOP_COST = external global double
@kl_init_time = external global double
@DEBUG_KL = external global i32
@.str.1 = [13 x i8] c" Before KL: \00"
@nway_kl_time = external global double
@.str.2 = [11 x i8] c" After KL:\00"
@.str.3 = [61 x i8] c"\0AWARNING: No space to perform KL on graph with %d vertices.\0A\00"
@.str.4 = [42 x i8] c" NO LOCAL REFINEMENT PERFORMED.\0A\0A\00"
@Output_File = external global i32*
@.str.5 = [43 x i8] c" LOCAL REFINEMENT NOT PERFORMED.\0A\0A\00"
@kl_total_time = external global double
define void @klspiff(%struct.vtx_data** %0, i32 %1, i32* %2, i32 %3, [8 x i32]* %4, double* %5, float** %6, i32 %7, double %8, i32 %9, i32** %10, double* %11) {
%13 = alloca %struct.vtx_data**
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca [8 x i32]*
%18 = alloca double*
%19 = alloca float**
%20 = alloca i32
%21 = alloca double
%22 = alloca i32
%23 = alloca i32**
%24 = alloca double*
%25 = alloca %struct.bilist****
%26 = alloca %struct.bilist**
%27 = alloca float*
%28 = alloca i32**
%29 = alloca i32**
%30 = alloca double
%31 = alloca double
%32 = alloca float
%33 = alloca i32
%34 = alloca i32
%35 = alloca double
%36 = alloca double
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
store %struct.vtx_data** %0, %struct.vtx_data*** %13
store i32 %1, i32* %14
store i32* %2, i32** %15
store i32 %3, i32* %16
store [8 x i32]* %4, [8 x i32]** %17
store double* %5, double** %18
store float** %6, float*** %19
store i32 %7, i32* %20
store double %8, double* %21
store i32 %9, i32* %22
store i32** %10, i32*** %23
store double* %11, double** %24
%40 = call double (...) @seconds()
store double %40, double* %30
%41 = load i32, i32* @DEBUG_TRACE
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %12
%44 = load i32, i32* %14
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %43, %12
store i32 0, i32* %33
store i32 0, i32* %38
br label %47
47: ; preds = %81, %46
%48 = load i32, i32* %38
%49 = load i32, i32* %16
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %84
51: ; preds = %47
store i32 0, i32* %39
br label %52
52: ; preds = %77, %51
%53 = load i32, i32* %39
%54 = load i32, i32* %16
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %80
56: ; preds = %52
%57 = load [8 x i32]*, [8 x i32]** %17
%58 = load i32, i32* %38
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [8 x i32], [8 x i32]* %57, i64 %59
%61 = load i32, i32* %39
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [8 x i32], [8 x i32]* %60, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = load i32, i32* %33
%66 = icmp sgt i32 %64, %65
br i1 %66, label %67, label %76
67: ; preds = %56
%68 = load [8 x i32]*, [8 x i32]** %17
%69 = load i32, i32* %38
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [8 x i32], [8 x i32]* %68, i64 %70
%72 = load i32, i32* %39
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [8 x i32], [8 x i32]* %71, i64 0, i64 %73
%75 = load i32, i32* %74
store i32 %75, i32* %33
br label %76
76: ; preds = %67, %56
br label %77
77: ; preds = %76
%78 = load i32, i32* %39
%79 = add nsw i32 %78, 1
store i32 %79, i32* %39
br label %52
80: ; preds = %52
br label %81
81: ; preds = %80
%82 = load i32, i32* %38
%83 = add nsw i32 %82, 1
store i32 %83, i32* %38
br label %47
84: ; preds = %47
store float 0.000000e+00, float* %32
store double 1.000000e+00, double* %36
store double 1.000000e+00, double* %35
%85 = load float**, float*** %19
%86 = getelementptr inbounds float*, float** %85, i64 1
%87 = load float*, float** %86
%88 = icmp ne float* %87, null
br i1 %88, label %89, label %142
89: ; preds = %84
store i32 1, i32* %39
br label %90
90: ; preds = %130, %89
%91 = load i32, i32* %39
%92 = load i32, i32* %16
%93 = icmp slt i32 %91, %92
br i1 %93, label %94, label %133
94: ; preds = %90
%95 = load float**, float*** %19
%96 = load i32, i32* %39
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds float*, float** %95, i64 %97
%99 = load float*, float** %98
store float* %99, float** %27
%100 = load i32, i32* %14
store i32 %100, i32* %38
br label %101
101: ; preds = %126, %94
%102 = load i32, i32* %38
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %129
104: ; preds = %101
%105 = load float*, float** %27
%106 = getelementptr inbounds float, float* %105, i32 1
store float* %106, float** %27
%107 = load float*, float** %27
%108 = load float, float* %107
%109 = load float, float* %32
%110 = fcmp ogt float %108, %109
br i1 %110, label %111, label %114
111: ; preds = %104
%112 = load float*, float** %27
%113 = load float, float* %112
store float %113, float* %32
br label %125
114: ; preds = %104
%115 = load float*, float** %27
%116 = load float, float* %115
%117 = fneg float %116
%118 = load float, float* %32
%119 = fcmp ogt float %117, %118
br i1 %119, label %120, label %124
120: ; preds = %114
%121 = load float*, float** %27
%122 = load float, float* %121
%123 = fneg float %122
store float %123, float* %32
br label %124
124: ; preds = %120, %114
br label %125
125: ; preds = %124, %111
br label %126
126: ; preds = %125
%127 = load i32, i32* %38
%128 = add nsw i32 %127, -1
store i32 %128, i32* %38
br label %101
129: ; preds = %101
br label %130
130: ; preds = %129
%131 = load i32, i32* %39
%132 = add nsw i32 %131, 1
store i32 %132, i32* %39
br label %90
133: ; preds = %90
%134 = load double, double* @CUT_TO_HOP_COST
%135 = fcmp ogt double %134, 1.000000e+00
br i1 %135, label %136, label %138
136: ; preds = %133
%137 = load double, double* @CUT_TO_HOP_COST
store double %137, double* %35
br label %141
138: ; preds = %133
%139 = load double, double* @CUT_TO_HOP_COST
%140 = fdiv double 1.000000e+00, %139
store double %140, double* %36
br label %141
141: ; preds = %138, %136
br label %142
142: ; preds = %141, %84
%143 = load float, float* %32
%144 = fmul float 2.000000e+00, %143
%145 = fpext float %144 to double
%146 = load double, double* %36
%147 = call double @llvm.fmuladd.f64(double %145, double %146, double 5.000000e-01)
%148 = load double, double* %21
%149 = load double, double* %35
%150 = call double @llvm.fmuladd.f64(double %148, double %149, double 5.000000e-01)
%151 = load i32, i32* %33
%152 = sitofp i32 %151 to double
%153 = call double @llvm.fmuladd.f64(double %150, double %152, double %147)
%154 = fptosi double %153 to i32
store i32 %154, i32* %34
%155 = call double (...) @seconds()
store double %155, double* %31
%156 = load i32, i32* %14
%157 = load i32, i32* %16
%158 = load i32, i32* %34
%159 = call i32 (%struct.bilist*****, %struct.bilist***, i32***, i32***, i32, i32, i32, ...) bitcast (i32 (...)* @kl_init to i32 (%struct.bilist*****, %struct.bilist***, i32***, i32***, i32, i32, i32, ...)*)(%struct.bilist***** %25, %struct.bilist*** %26, i32*** %28, i32*** %29, i32 %156, i32 %157, i32 %158)
store i32 %159, i32* %37
%160 = call double (...) @seconds()
%161 = load double, double* %31
%162 = fsub double %160, %161
%163 = load double, double* @kl_init_time
%164 = fadd double %163, %162
store double %164, double* @kl_init_time
%165 = load i32, i32* %37
%166 = icmp ne i32 %165, 0
br i1 %166, label %214, label %167
167: ; preds = %142
%168 = load i32, i32* @DEBUG_KL
%169 = icmp sgt i32 %168, 0
br i1 %169, label %170, label %178
170: ; preds = %167
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%172 = load %struct.vtx_data**, %struct.vtx_data*** %13
%173 = load i32, i32* %14
%174 = load i32*, i32** %15
%175 = load i32, i32* %16
%176 = load [8 x i32]*, [8 x i32]** %17
%177 = load i32, i32* %22
br label %178
178: ; preds = %170, %167
%179 = call double (...) @seconds()
store double %179, double* %31
%180 = load %struct.vtx_data**, %struct.vtx_data*** %13
%181 = load i32, i32* %14
%182 = load %struct.bilist****, %struct.bilist***** %25
%183 = load %struct.bilist**, %struct.bilist*** %26
%184 = load i32**, i32*** %29
%185 = load i32**, i32*** %28
%186 = load i32*, i32** %15
%187 = load i32, i32* %34
%188 = load i32, i32* %16
%189 = load double*, double** %18
%190 = load float**, float*** %19
%191 = load [8 x i32]*, [8 x i32]** %17
%192 = bitcast [8 x i32]* %191 to i32**
%193 = load i32, i32* %20
%194 = load i32, i32* %22
%195 = load i32**, i32*** %23
%196 = load double*, double** %24
%197 = call i32 @nway_kl(%struct.vtx_data** %180, i32 %181, %struct.bilist**** %182, %struct.bilist** %183, i32** %184, i32** %185, i32* %186, i32 %187, i32 %188, double* %189, float** %190, i32** %192, i32 %193, i32 %194, i32** %195, double* %196)
store i32 %197, i32* %37
%198 = call double (...) @seconds()
%199 = load double, double* %31
%200 = fsub double %198, %199
%201 = load double, double* @nway_kl_time
%202 = fadd double %201, %200
store double %202, double* @nway_kl_time
%203 = load i32, i32* @DEBUG_KL
%204 = icmp sgt i32 %203, 1
br i1 %204, label %205, label %213
205: ; preds = %178
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%207 = load %struct.vtx_data**, %struct.vtx_data*** %13
%208 = load i32, i32* %14
%209 = load i32*, i32** %15
%210 = load i32, i32* %16
%211 = load [8 x i32]*, [8 x i32]** %17
%212 = load i32, i32* %22
br label %213
213: ; preds = %205, %178
br label %214
214: ; preds = %213, %142
%215 = load i32, i32* %37
%216 = icmp ne i32 %215, 0
br i1 %216, label %217, label %230
217: ; preds = %214
%218 = load i32, i32* %14
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %218)
%220 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%221 = load i32*, i32** @Output_File
%222 = icmp ne i32* %221, null
br i1 %222, label %223, label %229
223: ; preds = %217
%224 = load i32*, i32** @Output_File
%225 = load i32, i32* %14
%226 = call i32 (i32*, i8*, ...) @fprintf(i32* %224, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %225)
%227 = load i32*, i32** @Output_File
%228 = call i32 (i32*, i8*, ...) @fprintf(i32* %227, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
br label %229
229: ; preds = %223, %217
br label %230
230: ; preds = %229, %214
%231 = load %struct.bilist****, %struct.bilist***** %25
%232 = load %struct.bilist**, %struct.bilist*** %26
%233 = load i32**, i32*** %28
%234 = load i32**, i32*** %29
%235 = call i32 @free_kl(%struct.bilist**** %231, %struct.bilist** %232, i32** %233, i32** %234)
%236 = call double (...) @seconds()
%237 = load double, double* %30
%238 = fsub double %236, %237
%239 = load double, double* @kl_total_time
%240 = fadd double %239, %238
store double %240, double* @kl_total_time
ret void
}

LLVM IR (-O2):
%struct.vtx_data = type { i32 }
%struct.bilist = type { i32 }
@DEBUG_TRACE = external global i32
@.str = [32 x i8] c"<Entering klspiff, nvtxs = %d>\0A\00"
@CUT_TO_HOP_COST = external global double
@kl_init_time = external global double
@DEBUG_KL = external global i32
@.str.1 = [13 x i8] c" Before KL: \00"
@nway_kl_time = external global double
@.str.2 = [11 x i8] c" After KL:\00"
@.str.3 = [61 x i8] c"\0AWARNING: No space to perform KL on graph with %d vertices.\0A\00"
@Output_File = external global i32*
@.str.5 = [43 x i8] c" LOCAL REFINEMENT NOT PERFORMED.\0A\0A\00"
@kl_total_time = external global double
@str = [41 x i8] c" NO LOCAL REFINEMENT PERFORMED.\0A\00"
define void @klspiff(%struct.vtx_data** %0, i32 %1, i32* %2, i32 %3, [8 x i32]* %4, double* %5, float** %6, i32 %7, double %8, i32 %9, i32** %10, double* %11) {
%13 = alloca %struct.bilist****
%14 = alloca %struct.bilist**
%15 = alloca i32**
%16 = alloca i32**
%17 = bitcast %struct.bilist***** %13 to i8*
%18 = bitcast %struct.bilist*** %14 to i8*
%19 = bitcast i32*** %15 to i8*
%20 = bitcast i32*** %16 to i8*
%21 = tail call double (...) @seconds()
%22 = load i32, i32* @DEBUG_TRACE
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %12
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %26
26: ; preds = %24, %12
%27 = icmp sgt i32 %3, 0
br i1 %27, label %28, label %115
28: ; preds = %26
%29 = zext i32 %3 to i64
%30 = and i64 %29, 4294967288
%31 = add nsw i64 %30, -8
%32 = lshr exact i64 %31, 3
%33 = add nuw nsw i64 %32, 1
%34 = icmp ult i32 %3, 8
%35 = and i64 %29, 4294967288
%36 = and i64 %33, 1
%37 = icmp eq i64 %31, 0
%38 = and i64 %33, 4611686018427387902
%39 = icmp eq i64 %36, 0
%40 = icmp eq i64 %35, %29
br label %41
41: ; preds = %111, %28
%42 = phi i64 [ 0, %28 ], [ %113, %111 ]
%43 = phi i32 [ 0, %28 ], [ %112, %111 ]
br i1 %34, label %99, label %44
44: ; preds = %41
%45 = insertelement <4 x i32> poison, i32 %43, i64 0
%46 = shufflevector <4 x i32> %45, <4 x i32> poison, <4 x i32> zeroinitializer
br i1 %37, label %76, label %47
47: ; preds = %44, %47
%48 = phi i64 [ %73, %47 ], [ 0, %44 ]
%49 = phi <4 x i32> [ %71, %47 ], [ %46, %44 ]
%50 = phi <4 x i32> [ %72, %47 ], [ %46, %44 ]
%51 = phi i64 [ %74, %47 ], [ 0, %44 ]
%52 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 %42, i64 %48
%53 = bitcast i32* %52 to <4 x i32>*
%54 = load <4 x i32>, <4 x i32>* %53
%55 = getelementptr inbounds i32, i32* %52, i64 4
%56 = bitcast i32* %55 to <4 x i32>*
%57 = load <4 x i32>, <4 x i32>* %56
%58 = icmp sgt <4 x i32> %54, %49
%59 = icmp sgt <4 x i32> %57, %50
%60 = select <4 x i1> %58, <4 x i32> %54, <4 x i32> %49
%61 = select <4 x i1> %59, <4 x i32> %57, <4 x i32> %50
%62 = or i64 %48, 8
%63 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 %42, i64 %62
%64 = bitcast i32* %63 to <4 x i32>*
%65 = load <4 x i32>, <4 x i32>* %64
%66 = getelementptr inbounds i32, i32* %63, i64 4
%67 = bitcast i32* %66 to <4 x i32>*
%68 = load <4 x i32>, <4 x i32>* %67
%69 = icmp sgt <4 x i32> %65, %60
%70 = icmp sgt <4 x i32> %68, %61
%71 = select <4 x i1> %69, <4 x i32> %65, <4 x i32> %60
%72 = select <4 x i1> %70, <4 x i32> %68, <4 x i32> %61
%73 = add nuw i64 %48, 16
%74 = add i64 %51, 2
%75 = icmp eq i64 %74, %38
br i1 %75, label %76, label %47
76: ; preds = %47, %44
%77 = phi <4 x i32> [ undef, %44 ], [ %71, %47 ]
%78 = phi <4 x i32> [ undef, %44 ], [ %72, %47 ]
%79 = phi i64 [ 0, %44 ], [ %73, %47 ]
%80 = phi <4 x i32> [ %46, %44 ], [ %71, %47 ]
%81 = phi <4 x i32> [ %46, %44 ], [ %72, %47 ]
br i1 %39, label %93, label %82
82: ; preds = %76
%83 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 %42, i64 %79
%84 = bitcast i32* %83 to <4 x i32>*
%85 = load <4 x i32>, <4 x i32>* %84
%86 = getelementptr inbounds i32, i32* %83, i64 4
%87 = bitcast i32* %86 to <4 x i32>*
%88 = load <4 x i32>, <4 x i32>* %87
%89 = icmp sgt <4 x i32> %85, %80
%90 = icmp sgt <4 x i32> %88, %81
%91 = select <4 x i1> %89, <4 x i32> %85, <4 x i32> %80
%92 = select <4 x i1> %90, <4 x i32> %88, <4 x i32> %81
br label %93
93: ; preds = %76, %82
%94 = phi <4 x i32> [ %77, %76 ], [ %91, %82 ]
%95 = phi <4 x i32> [ %78, %76 ], [ %92, %82 ]
%96 = icmp sgt <4 x i32> %94, %95
%97 = select <4 x i1> %96, <4 x i32> %94, <4 x i32> %95
%98 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %97)
br i1 %40, label %111, label %99
99: ; preds = %41, %93
%100 = phi i64 [ 0, %41 ], [ %35, %93 ]
%101 = phi i32 [ %43, %41 ], [ %98, %93 ]
br label %102
102: ; preds = %99, %102
%103 = phi i64 [ %109, %102 ], [ %100, %99 ]
%104 = phi i32 [ %108, %102 ], [ %101, %99 ]
%105 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 %42, i64 %103
%106 = load i32, i32* %105
%107 = icmp sgt i32 %106, %104
%108 = select i1 %107, i32 %106, i32 %104
%109 = add nuw nsw i64 %103, 1
%110 = icmp eq i64 %109, %29
br i1 %110, label %111, label %102
111: ; preds = %102, %93
%112 = phi i32 [ %98, %93 ], [ %108, %102 ]
%113 = add nuw nsw i64 %42, 1
%114 = icmp eq i64 %113, %29
br i1 %114, label %115, label %41
115: ; preds = %111, %26
%116 = phi i32 [ 0, %26 ], [ %112, %111 ]
%117 = getelementptr inbounds float*, float** %6, i64 1
%118 = load float*, float** %117
%119 = icmp eq float* %118, null
br i1 %119, label %184, label %120
120: ; preds = %115
%121 = icmp sgt i32 %3, 1
br i1 %121, label %122, label %178
122: ; preds = %120
%123 = icmp eq i32 %1, 0
%124 = zext i32 %3 to i64
%125 = and i32 %1, 1
%126 = icmp eq i32 %125, 0
%127 = add nsw i32 %1, -1
%128 = icmp eq i32 %1, 1
br label %129
129: ; preds = %175, %122
%130 = phi float* [ %118, %122 ], [ %177, %175 ]
%131 = phi i64 [ 1, %122 ], [ %173, %175 ]
%132 = phi float [ 0.000000e+00, %122 ], [ %172, %175 ]
br i1 %123, label %171, label %133
133: ; preds = %129
br i1 %126, label %142, label %134
134: ; preds = %133
%135 = getelementptr inbounds float, float* %130, i64 1
%136 = load float, float* %135
%137 = fcmp ogt float %136, %132
br i1 %137, label %142, label %138
138: ; preds = %134
%139 = fneg float %136
%140 = fcmp olt float %132, %139
br i1 %140, label %141, label %142
141: ; preds = %138
br label %142
142: ; preds = %134, %138, %141, %133
%143 = phi float [ undef, %133 ], [ %139, %141 ], [ %132, %138 ], [ %136, %134 ]
%144 = phi i32 [ %1, %133 ], [ %127, %141 ], [ %127, %138 ], [ %127, %134 ]
%145 = phi float* [ %130, %133 ], [ %135, %141 ], [ %135, %138 ], [ %135, %134 ]
%146 = phi float [ %132, %133 ], [ %139, %141 ], [ %132, %138 ], [ %136, %134 ]
br i1 %128, label %171, label %147
147: ; preds = %142, %167
%148 = phi i32 [ %169, %167 ], [ %144, %142 ]
%149 = phi float* [ %160, %167 ], [ %145, %142 ]
%150 = phi float [ %168, %167 ], [ %146, %142 ]
%151 = getelementptr inbounds float, float* %149, i64 1
%152 = load float, float* %151
%153 = fcmp ogt float %152, %150
br i1 %153, label %158, label %154
154: ; preds = %147
%155 = fneg float %152
%156 = fcmp olt float %150, %155
br i1 %156, label %157, label %158
157: ; preds = %154
br label %158
158: ; preds = %147, %157, %154
%159 = phi float [ %155, %157 ], [ %150, %154 ], [ %152, %147 ]
%160 = getelementptr inbounds float, float* %149, i64 2
%161 = load float, float* %160
%162 = fcmp ogt float %161, %159
br i1 %162, label %167, label %163
163: ; preds = %158
%164 = fneg float %161
%165 = fcmp olt float %159, %164
br i1 %165, label %166, label %167
166: ; preds = %163
br label %167
167: ; preds = %166, %163, %158
%168 = phi float [ %164, %166 ], [ %159, %163 ], [ %161, %158 ]
%169 = add nsw i32 %148, -2
%170 = icmp eq i32 %169, 0
br i1 %170, label %171, label %147
171: ; preds = %142, %167, %129
%172 = phi float [ %132, %129 ], [ %143, %142 ], [ %168, %167 ]
%173 = add nuw nsw i64 %131, 1
%174 = icmp eq i64 %173, %124
br i1 %174, label %178, label %175
175: ; preds = %171
%176 = getelementptr inbounds float*, float** %6, i64 %173
%177 = load float*, float** %176
br label %129
178: ; preds = %171, %120
%179 = phi float [ 0.000000e+00, %120 ], [ %172, %171 ]
%180 = load double, double* @CUT_TO_HOP_COST
%181 = fcmp ogt double %180, 1.000000e+00
br i1 %181, label %184, label %182
182: ; preds = %178
%183 = fdiv double 1.000000e+00, %180
br label %184
184: ; preds = %178, %182, %115
%185 = phi float [ %179, %182 ], [ 0.000000e+00, %115 ], [ %179, %178 ]
%186 = phi double [ 1.000000e+00, %182 ], [ 1.000000e+00, %115 ], [ %180, %178 ]
%187 = phi double [ %183, %182 ], [ 1.000000e+00, %115 ], [ 1.000000e+00, %178 ]
%188 = fmul float %185, 2.000000e+00
%189 = fpext float %188 to double
%190 = tail call double @llvm.fmuladd.f64(double %189, double %187, double 5.000000e-01)
%191 = tail call double @llvm.fmuladd.f64(double %8, double %186, double 5.000000e-01)
%192 = sitofp i32 %116 to double
%193 = tail call double @llvm.fmuladd.f64(double %191, double %192, double %190)
%194 = fptosi double %193 to i32
%195 = tail call double (...) @seconds()
%196 = call i32 (%struct.bilist*****, %struct.bilist***, i32***, i32***, i32, i32, i32, ...) bitcast (i32 (...)* @kl_init to i32 (%struct.bilist*****, %struct.bilist***, i32***, i32***, i32, i32, i32, ...)*)(%struct.bilist***** %13, %struct.bilist*** %14, i32*** %15, i32*** %16, i32 %1, i32 %3, i32 %194)
%197 = call double (...) @seconds()
%198 = fsub double %197, %195
%199 = load double, double* @kl_init_time
%200 = fadd double %199, %198
store double %200, double* @kl_init_time
%201 = icmp eq i32 %196, 0
br i1 %201, label %202, label %225
202: ; preds = %184
%203 = load i32, i32* @DEBUG_KL
%204 = icmp sgt i32 %203, 0
br i1 %204, label %205, label %207
205: ; preds = %202
%206 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %207
207: ; preds = %205, %202
%208 = call double (...) @seconds()
%209 = load %struct.bilist****, %struct.bilist***** %13
%210 = load %struct.bilist**, %struct.bilist*** %14
%211 = load i32**, i32*** %16
%212 = load i32**, i32*** %15
%213 = bitcast [8 x i32]* %4 to i32**
%214 = call i32 @nway_kl(%struct.vtx_data** %0, i32 %1, %struct.bilist**** %209, %struct.bilist** %210, i32** %211, i32** %212, i32* %2, i32 %194, i32 %3, double* %5, float** %6, i32** %213, i32 %7, i32 %9, i32** %10, double* %11)
%215 = call double (...) @seconds()
%216 = fsub double %215, %208
%217 = load double, double* @nway_kl_time
%218 = fadd double %217, %216
store double %218, double* @nway_kl_time
%219 = load i32, i32* @DEBUG_KL
%220 = icmp sgt i32 %219, 1
br i1 %220, label %221, label %223
221: ; preds = %207
%222 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %223
223: ; preds = %207, %221
%224 = icmp eq i32 %214, 0
br i1 %224, label %234, label %225
225: ; preds = %184, %223
%226 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %1)
%227 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%228 = load i32*, i32** @Output_File
%229 = icmp eq i32* %228, null
br i1 %229, label %234, label %230
230: ; preds = %225
%231 = call i32 (i32*, i8*, ...) @fprintf(i32* %228, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), i32 %1)
%232 = load i32*, i32** @Output_File
%233 = call i64 @fwrite(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i64 42, i64 1, i32* %232)
br label %234
234: ; preds = %225, %230, %223
%235 = load %struct.bilist****, %struct.bilist***** %13
%236 = load %struct.bilist**, %struct.bilist*** %14
%237 = load i32**, i32*** %15
%238 = load i32**, i32*** %16
%239 = call i32 @free_kl(%struct.bilist**** %235, %struct.bilist** %236, i32** %237, i32** %238)
%240 = call double (...) @seconds()
%241 = fsub double %240, %21
%242 = load double, double* @kl_total_time
%243 = fadd double %242, %241
store double %243, double* @kl_total_time
ret void
}