#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 initialize_quaddobl_monodromy(int, int, int);
int initialize_quaddobl_sampler(int);
int new_quaddobl_slices(int, int);
int number_of_quaddobl_factors(int *);
int permutation_after_quaddobl_loop(int, int *);
int /*<<< orphan*/ printf(char *, ...);
int quaddobl_monodromy_permutation(int, int *);
int quaddobl_trace_grid_diagnostics(double *, double *);
int quaddobl_trace_sum_difference(int, int *, double *);
int quaddobl_track_paths();
int restore_quaddobl_solutions();
int set_quaddobl_trace_slice(int);
int solcon_clear_quaddobl_solutions();
int store_quaddobl_gammas(int);
int store_quaddobl_solutions();
int swap_quaddobl_slices();
int witness_points_of_quaddobl_factor(int, int *, int *);
int quaddobl_monodromy_breakup(int nbloops, int n, int k, int d) {
  int fail, i, j, done;
  double err, dis;
  fail = initialize_quaddobl_sampler(k);
  fail = initialize_quaddobl_monodromy(nbloops, d, k);
  if (1 > 0)
    printf("\nInitialized sampler and monodromy permutations ...\n");
  fail = store_quaddobl_solutions();
  printf("... initializing the grid in quad double precision ...\n");
  for (i = 1; i <= 2; i++) {
    fail = set_quaddobl_trace_slice(i);
    fail = store_quaddobl_gammas(n);
    fail = quaddobl_track_paths();
    fail = store_quaddobl_solutions();
    fail = restore_quaddobl_solutions();
    fail = swap_quaddobl_slices();
  }
  fail = quaddobl_trace_grid_diagnostics(&err, &dis);
  printf("Trace grid diagnostics : \n");
  printf("  largest error of the samples : %.3e\n", err);
  printf("  smallest distance between samples : %.3e\n", dis);
  done = 0;
  for (i = 1; (i <= nbloops) && (done == 0); i++) {
    printf("... starting loop #\%d in quad double precision ...\n", i);
    fail = new_quaddobl_slices(k, n);
    fail = store_quaddobl_gammas(n);
    fail = quaddobl_track_paths();
    fail = solcon_clear_quaddobl_solutions();
    fail = store_quaddobl_gammas(n);
    fail = quaddobl_track_paths();
    fail = store_quaddobl_solutions();
    {
      int permutation[d];
      fail = permutation_after_quaddobl_loop(d, permutation);
      printf("the permutation at step %d:", i);
      for (j = 0; j < d; j++)
        printf(" %d", permutation[j]);
      printf("\n");
    }
    fail = quaddobl_monodromy_permutation(d, &done);
    {
      int nf, deg, jp, w[d];
      double trace_difference;
      fail = number_of_quaddobl_factors(&nf);
      printf("number of irreducible factors : %d\n", nf);
      for (j = 1; j <= nf; j++) {
        fail = witness_points_of_quaddobl_factor(j, &deg, w);
        printf(" %d :", j);
        for (jp = 0; jp < deg; jp++)
          printf(" %d", w[jp]);
        fail = quaddobl_trace_sum_difference(deg, w, &trace_difference);
        printf(" : %.3e\n", trace_difference);
      }
    }
    fail = restore_quaddobl_solutions();
  }
  if (done == 1)
    printf("Found factorization using %d loops.\n", i - 1);
  else
    printf("Failed to factor using %d loops.\n", i - 1);
  return fail;
}


x86 assembly (clang, -O0):
<quaddobl_monodromy_breakup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   10c0 <initialize_quaddobl_sampler@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1100 <initialize_quaddobl_monodromy@plt>
mov    %eax,-0x14(%rbp)
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1110 <store_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jg     12c6 <quaddobl_monodromy_breakup+0xb6>
mov    -0x18(%rbp),%edi
call   1040 <set_quaddobl_trace_slice@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1090 <store_quaddobl_gammas@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   10f0 <quaddobl_track_paths@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1110 <store_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <restore_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   10a0 <swap_quaddobl_slices@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1270 <quaddobl_monodromy_breakup+0x60>
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <quaddobl_trace_grid_diagnostics@plt>
mov    %eax,-0x14(%rbp)
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xd98(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xdac(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0x69(%rbp)
jg     1333 <quaddobl_monodromy_breakup+0x123>
cmpl   $0x0,-0x20(%rbp)
sete   %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
test   $0x1,%al
jne    1343 <quaddobl_monodromy_breakup+0x133>
jmp    1564 <quaddobl_monodromy_breakup+0x354>
mov    -0x18(%rbp),%esi
lea    0xd8e(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x79(%rbp)
call   1070 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1120 <new_quaddobl_slices@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1090 <store_quaddobl_gammas@plt>
mov    %eax,%ecx
mov    -0x79(%rbp),%al
mov    %ecx,-0x14(%rbp)
call   10f0 <quaddobl_track_paths@plt>
mov    %eax,%ecx
mov    -0x79(%rbp),%al
mov    %ecx,-0x14(%rbp)
call   1030 <solcon_clear_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1090 <store_quaddobl_gammas@plt>
mov    %eax,%ecx
mov    -0x79(%rbp),%al
mov    %ecx,-0x14(%rbp)
call   10f0 <quaddobl_track_paths@plt>
mov    %eax,%ecx
mov    -0x79(%rbp),%al
mov    %ecx,-0x14(%rbp)
call   1110 <store_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x78(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%edi
call   1080 <permutation_after_quaddobl_loop@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    142c <quaddobl_monodromy_breakup+0x21c>
mov    -0x78(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13f9 <quaddobl_monodromy_breakup+0x1e9>
lea    0xc53(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x10(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   10e0 <quaddobl_monodromy_permutation@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x58(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x60(%rbp)
lea    -0x44(%rbp),%rdi
call   10b0 <number_of_quaddobl_factors@plt>
mov    %eax,-0x14(%rbp)
mov    -0x44(%rbp),%esi
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     1545 <quaddobl_monodromy_breakup+0x335>
mov    -0x88(%rbp),%rdx
mov    -0x1c(%rbp),%edi
lea    -0x48(%rbp),%rsi
call   10d0 <witness_points_of_quaddobl_factor@plt>
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    150e <quaddobl_monodromy_breakup+0x2fe>
mov    -0x88(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xc32(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    14d8 <quaddobl_monodromy_breakup+0x2c8>
mov    -0x88(%rbp),%rsi
mov    -0x48(%rbp),%edi
lea    -0x68(%rbp),%rdx
call   1130 <quaddobl_trace_sum_difference@plt>
mov    %eax,-0x14(%rbp)
movsd  -0x68(%rbp),%xmm0
lea    0xb76(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    149e <quaddobl_monodromy_breakup+0x28e>
mov    -0x58(%rbp),%rax
mov    %rax,%rsp
mov    $0x0,%al
call   1060 <restore_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1318 <quaddobl_monodromy_breakup+0x108>
cmpl   $0x1,-0x20(%rbp)
jne    1587 <quaddobl_monodromy_breakup+0x377>
mov    -0x18(%rbp),%esi
sub    $0x1,%esi
lea    0xbde(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    159b <quaddobl_monodromy_breakup+0x38b>
mov    -0x18(%rbp),%esi
sub    $0x1,%esi
lea    0xbea(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaddobl_monodromy_breakup>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%r15d
mov    %edi,%r13d
mov    %edx,%edi
call   10e0 <initialize_quaddobl_sampler@plt>
mov    %r13d,%edi
mov    %r14d,%esi
mov    %ebx,-0x4c(%rbp)
mov    %ebx,%edx
call   1120 <initialize_quaddobl_monodromy@plt>
lea    0xeae(%rip),%rdi
call   1070 <puts@plt>
xor    %eax,%eax
call   1130 <store_quaddobl_solutions@plt>
lea    0xecf(%rip),%rdi
call   1070 <puts@plt>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1050 <set_quaddobl_trace_slice@plt>
mov    %r15d,%edi
call   10b0 <store_quaddobl_gammas@plt>
xor    %eax,%eax
call   1110 <quaddobl_track_paths@plt>
xor    %eax,%eax
call   1130 <store_quaddobl_solutions@plt>
xor    %eax,%eax
call   1080 <restore_quaddobl_solutions@plt>
xor    %eax,%eax
call   10c0 <swap_quaddobl_slices@plt>
mov    $0x2,%edi
call   1050 <set_quaddobl_trace_slice@plt>
mov    %r15d,-0x48(%rbp)
mov    %r15d,%edi
call   10b0 <store_quaddobl_gammas@plt>
xor    %eax,%eax
call   1110 <quaddobl_track_paths@plt>
xor    %eax,%eax
call   1130 <store_quaddobl_solutions@plt>
xor    %eax,%eax
call   1080 <restore_quaddobl_solutions@plt>
xor    %eax,%eax
call   10c0 <swap_quaddobl_slices@plt>
lea    -0x78(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1060 <quaddobl_trace_grid_diagnostics@plt>
mov    %eax,%r12d
lea    0xe85(%rip),%rdi
call   1070 <puts@plt>
movsd  -0x78(%rbp),%xmm0
lea    0xcf1(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
movsd  -0x70(%rbp),%xmm0
lea    0xd05(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    %r13d,-0x44(%rbp)
test   %r13d,%r13d
jle    1503 <quaddobl_monodromy_breakup+0x2d3>
mov    %r14d,-0x30(%rbp)
mov    %r14d,%r13d
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,-0x58(%rbp)
lea    0xd48(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebx,%r15d
lea    0xce9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%ebx
mov    %ebx,%esi
call   1140 <new_quaddobl_slices@plt>
mov    %ebx,%edi
call   10b0 <store_quaddobl_gammas@plt>
xor    %eax,%eax
call   1110 <quaddobl_track_paths@plt>
xor    %eax,%eax
call   1030 <solcon_clear_quaddobl_solutions@plt>
mov    %ebx,%edi
call   10b0 <store_quaddobl_gammas@plt>
xor    %eax,%eax
call   1110 <quaddobl_track_paths@plt>
xor    %eax,%eax
call   1130 <store_quaddobl_solutions@plt>
mov    %rsp,-0x40(%rbp)
mov    %rsp,%r12
sub    -0x58(%rbp),%r12
mov    %r12,%rsp
mov    -0x30(%rbp),%ebx
mov    %ebx,%edi
mov    %r12,%rsi
call   10a0 <permutation_after_quaddobl_loop@plt>
lea    0xcbb(%rip),%rdi
mov    %r15,-0x60(%rbp)
mov    %r15d,%esi
xor    %eax,%eax
call   1090 <printf@plt>
test   %ebx,%ebx
jle    13f7 <quaddobl_monodromy_breakup+0x1c7>
xor    %ebx,%ebx
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    13e0 <quaddobl_monodromy_breakup+0x1b0>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    -0x40(%rbp),%rsp
mov    -0x30(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1100 <quaddobl_monodromy_permutation@plt>
mov    %rsp,-0x40(%rbp)
mov    %rsp,%r12
sub    -0x58(%rbp),%r12
mov    %r12,%rsp
lea    -0x2c(%rbp),%rdi
call   10d0 <number_of_quaddobl_factors@plt>
mov    -0x2c(%rbp),%esi
lea    0xc75(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    14d0 <quaddobl_monodromy_breakup+0x2a0>
mov    $0x1,%r15d
jmp    147c <quaddobl_monodromy_breakup+0x24c>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rsi
lea    -0x68(%rbp),%rdx
call   1150 <quaddobl_trace_sum_difference@plt>
movsd  -0x68(%rbp),%xmm0
lea    0xbb6(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
lea    0x1(%r15),%eax
cmp    -0x2c(%rbp),%r15d
mov    %eax,%r15d
jge    14d0 <quaddobl_monodromy_breakup+0x2a0>
mov    %r15d,%edi
lea    -0x34(%rbp),%rsi
mov    %r12,%rdx
call   10f0 <witness_points_of_quaddobl_factor@plt>
lea    0xc39(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    -0x34(%rbp),%edi
test   %edi,%edi
jle    1450 <quaddobl_monodromy_breakup+0x220>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
add    $0x1,%rbx
movslq -0x34(%rbp),%rdi
cmp    %rdi,%rbx
jl     14b0 <quaddobl_monodromy_breakup+0x280>
jmp    1450 <quaddobl_monodromy_breakup+0x220>
nopl   (%rax)
mov    -0x40(%rbp),%rsp
xor    %eax,%eax
call   1080 <restore_quaddobl_solutions@plt>
mov    %eax,%r12d
mov    -0x38(%rbp),%eax
mov    -0x60(%rbp),%rsi
cmp    -0x44(%rbp),%esi
jge    14f5 <quaddobl_monodromy_breakup+0x2c5>
lea    0x1(%rsi),%ebx
test   %eax,%eax
je     1360 <quaddobl_monodromy_breakup+0x130>
cmp    $0x1,%eax
jne    1505 <quaddobl_monodromy_breakup+0x2d5>
lea    0xbd0(%rip),%rdi
jmp    150c <quaddobl_monodromy_breakup+0x2dc>
xor    %esi,%esi
lea    0xbea(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r12d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"\0AInitialized sampler and monodromy permutations ...\0A\00"
@.str.1 = [56 x i8] c"... initializing the grid in quad double precision ...\0A\00"
@.str.2 = [27 x i8] c"Trace grid diagnostics : \0A\00"
@.str.3 = [39 x i8] c" largest error of the samples : %.3e\0A\00"
@.str.4 = [44 x i8] c" smallest distance between samples : %.3e\0A\00"
@.str.5 = [52 x i8] c"... starting loop #%d in quad double precision ...\0A\00"
@.str.6 = [28 x i8] c"the permutation at step %d:\00"
@.str.7 = [4 x i8] c" %d\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [36 x i8] c"number of irreducible factors : %d\0A\00"
@.str.10 = [6 x i8] c" %d :\00"
@.str.11 = [9 x i8] c" : %.3e\0A\00"
@.str.12 = [37 x i8] c"Found factorization using %d loops.\0A\00"
@.str.13 = [34 x i8] c"Failed to factor using %d loops.\0A\00"
define i32 @quaddobl_monodromy_breakup(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8*
%21 = alloca i64
%22 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%23 = load i32, i32* %7
%24 = call i32 @initialize_quaddobl_sampler(i32 %23)
store i32 %24, i32* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %8
%27 = load i32, i32* %7
%28 = call i32 @initialize_quaddobl_monodromy(i32 %25, i32 %26, i32 %27)
store i32 %28, i32* %9
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%30 = call i32 (...) @store_quaddobl_solutions()
store i32 %30, i32* %9
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %10
br label %32
32: ; preds = %44, %4
%33 = load i32, i32* %10
%34 = icmp sle i32 %33, 2
br i1 %34, label %35, label %47
35: ; preds = %32
%36 = load i32, i32* %10
%37 = call i32 @set_quaddobl_trace_slice(i32 %36)
store i32 %37, i32* %9
%38 = load i32, i32* %6
%39 = call i32 @store_quaddobl_gammas(i32 %38)
store i32 %39, i32* %9
%40 = call i32 (...) @quaddobl_track_paths()
store i32 %40, i32* %9
%41 = call i32 (...) @store_quaddobl_solutions()
store i32 %41, i32* %9
%42 = call i32 (...) @restore_quaddobl_solutions()
store i32 %42, i32* %9
%43 = call i32 (...) @swap_quaddobl_slices()
store i32 %43, i32* %9
br label %44
44: ; preds = %35
%45 = load i32, i32* %10
%46 = add nsw i32 %45, 1
store i32 %46, i32* %10
br label %32
47: ; preds = %32
%48 = call i32 @quaddobl_trace_grid_diagnostics(double* %13, double* %14)
store i32 %48, i32* %9
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%50 = load double, double* %13
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), double %50)
%52 = load double, double* %14
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), double %52)
store i32 0, i32* %12
store i32 1, i32* %10
br label %54
54: ; preds = %143, %47
%55 = load i32, i32* %10
%56 = load i32, i32* %5
%57 = icmp sle i32 %55, %56
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i32, i32* %12
%60 = icmp eq i32 %59, 0
br label %61
61: ; preds = %58, %54
%62 = phi i1 [ false, %54 ], [ %60, %58 ]
br i1 %62, label %63, label %146
63: ; preds = %61
%64 = load i32, i32* %10
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %7
%67 = load i32, i32* %6
%68 = call i32 @new_quaddobl_slices(i32 %66, i32 %67)
store i32 %68, i32* %9
%69 = load i32, i32* %6
%70 = call i32 @store_quaddobl_gammas(i32 %69)
store i32 %70, i32* %9
%71 = call i32 (...) @quaddobl_track_paths()
store i32 %71, i32* %9
%72 = call i32 (...) @solcon_clear_quaddobl_solutions()
store i32 %72, i32* %9
%73 = load i32, i32* %6
%74 = call i32 @store_quaddobl_gammas(i32 %73)
store i32 %74, i32* %9
%75 = call i32 (...) @quaddobl_track_paths()
store i32 %75, i32* %9
%76 = call i32 (...) @store_quaddobl_solutions()
store i32 %76, i32* %9
%77 = load i32, i32* %8
%78 = zext i32 %77 to i64
%79 = call i8* @llvm.stacksave()
store i8* %79, i8** %15
%80 = alloca i32, i64 %78
store i64 %78, i64* %16
%81 = load i32, i32* %8
%82 = call i32 @permutation_after_quaddobl_loop(i32 %81, i32* %80)
store i32 %82, i32* %9
%83 = load i32, i32* %10
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %83)
store i32 0, i32* %11
br label %85
85: ; preds = %95, %63
%86 = load i32, i32* %11
%87 = load i32, i32* %8
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %98
89: ; preds = %85
%90 = load i32, i32* %11
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i32, i32* %80, i64 %91
%93 = load i32, i32* %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %93)
br label %95
95: ; preds = %89
%96 = load i32, i32* %11
%97 = add nsw i32 %96, 1
store i32 %97, i32* %11
br label %85
98: ; preds = %85
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%100 = load i8*, i8** %15
%101 = load i32, i32* %8
%102 = call i32 @quaddobl_monodromy_permutation(i32 %101, i32* %12)
store i32 %102, i32* %9
%103 = load i32, i32* %8
%104 = zext i32 %103 to i64
%105 = call i8* @llvm.stacksave()
store i8* %105, i8** %20
%106 = alloca i32, i64 %104
store i64 %104, i64* %21
%107 = call i32 @number_of_quaddobl_factors(i32* %17)
store i32 %107, i32* %9
%108 = load i32, i32* %17
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i32 %108)
store i32 1, i32* %11
br label %110
110: ; preds = %137, %98
%111 = load i32, i32* %11
%112 = load i32, i32* %17
%113 = icmp sle i32 %111, %112
br i1 %113, label %114, label %140
114: ; preds = %110
%115 = load i32, i32* %11
%116 = call i32 @witness_points_of_quaddobl_factor(i32 %115, i32* %18, i32* %106)
store i32 %116, i32* %9
%117 = load i32, i32* %11
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 %117)
store i32 0, i32* %19
br label %119
119: ; preds = %129, %114
%120 = load i32, i32* %19
%121 = load i32, i32* %18
%122 = icmp slt i32 %120, %121
br i1 %122, label %123, label %132
123: ; preds = %119
%124 = load i32, i32* %19
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i32, i32* %106, i64 %125
%127 = load i32, i32* %126
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %127)
br label %129
129: ; preds = %123
%130 = load i32, i32* %19
%131 = add nsw i32 %130, 1
store i32 %131, i32* %19
br label %119
132: ; preds = %119
%133 = load i32, i32* %18
%134 = call i32 @quaddobl_trace_sum_difference(i32 %133, i32* %106, double* %22)
store i32 %134, i32* %9
%135 = load double, double* %22
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %135)
br label %137
137: ; preds = %132
%138 = load i32, i32* %11
%139 = add nsw i32 %138, 1
store i32 %139, i32* %11
br label %110
140: ; preds = %110
%141 = load i8*, i8** %20
%142 = call i32 (...) @restore_quaddobl_solutions()
store i32 %142, i32* %9
br label %143
143: ; preds = %140
%144 = load i32, i32* %10
%145 = add nsw i32 %144, 1
store i32 %145, i32* %10
br label %54
146: ; preds = %61
%147 = load i32, i32* %12
%148 = icmp eq i32 %147, 1
br i1 %148, label %149, label %153
149: ; preds = %146
%150 = load i32, i32* %10
%151 = sub nsw i32 %150, 1
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0), i32 %151)
br label %157
153: ; preds = %146
%154 = load i32, i32* %10
%155 = sub nsw i32 %154, 1
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0), i32 %155)
br label %157
157: ; preds = %153, %149
%158 = load i32, i32* %9
ret i32 %158
}

LLVM IR (-O2):
@.str.3 = [39 x i8] c" largest error of the samples : %.3e\0A\00"
@.str.4 = [44 x i8] c" smallest distance between samples : %.3e\0A\00"
@.str.5 = [52 x i8] c"... starting loop #%d in quad double precision ...\0A\00"
@.str.6 = [28 x i8] c"the permutation at step %d:\00"
@.str.7 = [4 x i8] c" %d\00"
@.str.9 = [36 x i8] c"number of irreducible factors : %d\0A\00"
@.str.10 = [6 x i8] c" %d :\00"
@.str.11 = [9 x i8] c" : %.3e\0A\00"
@.str.12 = [37 x i8] c"Found factorization using %d loops.\0A\00"
@.str.13 = [34 x i8] c"Failed to factor using %d loops.\0A\00"
@str = [52 x i8] c"\0AInitialized sampler and monodromy permutations ...\00"
@str.14 = [55 x i8] c"... initializing the grid in quad double precision ...\00"
@str.15 = [26 x i8] c"Trace grid diagnostics : \00"
define i32 @quaddobl_monodromy_breakup(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = bitcast i32* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = bitcast double* %7 to i8*
%14 = tail call i32 @initialize_quaddobl_sampler(i32 %2)
%15 = tail call i32 @initialize_quaddobl_monodromy(i32 %0, i32 %3, i32 %2)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%17 = tail call i32 (...) @store_quaddobl_solutions()
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.14, i64 0, i64 0))
%19 = tail call i32 @set_quaddobl_trace_slice(i32 1)
%20 = tail call i32 @store_quaddobl_gammas(i32 %1)
%21 = tail call i32 (...) @quaddobl_track_paths()
%22 = tail call i32 (...) @store_quaddobl_solutions()
%23 = tail call i32 (...) @restore_quaddobl_solutions()
%24 = tail call i32 (...) @swap_quaddobl_slices()
%25 = tail call i32 @set_quaddobl_trace_slice(i32 2)
%26 = tail call i32 @store_quaddobl_gammas(i32 %1)
%27 = tail call i32 (...) @quaddobl_track_paths()
%28 = tail call i32 (...) @store_quaddobl_solutions()
%29 = tail call i32 (...) @restore_quaddobl_solutions()
%30 = tail call i32 (...) @swap_quaddobl_slices()
%31 = call i32 @quaddobl_trace_grid_diagnostics(double* %6, double* %7)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.15, i64 0, i64 0))
%33 = load double, double* %6
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), double %33)
%35 = load double, double* %7
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), double %35)
store i32 0, i32* %5
%37 = icmp sgt i32 %0, 0
br i1 %37, label %38, label %109
38: ; preds = %4
%39 = zext i32 %3 to i64
%40 = icmp sgt i32 %3, 0
%41 = bitcast i32* %8 to i8*
%42 = bitcast i32* %9 to i8*
%43 = bitcast double* %10 to i8*
br label %44
44: ; preds = %38, %98
%45 = phi i32 [ 1, %38 ], [ %100, %98 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32 %45)
%47 = call i32 @new_quaddobl_slices(i32 %2, i32 %1)
%48 = call i32 @store_quaddobl_gammas(i32 %1)
%49 = call i32 (...) @quaddobl_track_paths()
%50 = call i32 (...) @solcon_clear_quaddobl_solutions()
%51 = call i32 @store_quaddobl_gammas(i32 %1)
%52 = call i32 (...) @quaddobl_track_paths()
%53 = call i32 (...) @store_quaddobl_solutions()
%54 = call i8* @llvm.stacksave()
%55 = alloca i32, i64 %39
%56 = call i32 @permutation_after_quaddobl_loop(i32 %3, i32* %55)
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %45)
br i1 %40, label %58, label %65
58: ; preds = %44, %58
%59 = phi i64 [ %63, %58 ], [ 0, %44 ]
%60 = getelementptr inbounds i32, i32* %55, i64 %59
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %61)
%63 = add nuw nsw i64 %59, 1
%64 = icmp eq i64 %63, %39
br i1 %64, label %65, label %58
65: ; preds = %58, %44
%66 = call i32 @putchar(i32 10)
%67 = call i32 @quaddobl_monodromy_permutation(i32 %3, i32* %5)
%68 = call i8* @llvm.stacksave()
%69 = alloca i32, i64 %39
%70 = call i32 @number_of_quaddobl_factors(i32* %8)
%71 = load i32, i32* %8
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %8
%74 = icmp slt i32 %73, 1
br i1 %74, label %98, label %75
75: ; preds = %65, %90
%76 = phi i32 [ %95, %90 ], [ 1, %65 ]
%77 = call i32 @witness_points_of_quaddobl_factor(i32 %76, i32* %9, i32* %69)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 %76)
%79 = load i32, i32* %9
%80 = icmp sgt i32 %79, 0
br i1 %80, label %81, label %90
81: ; preds = %75, %81
%82 = phi i64 [ %86, %81 ], [ 0, %75 ]
%83 = getelementptr inbounds i32, i32* %69, i64 %82
%84 = load i32, i32* %83
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %84)
%86 = add nuw nsw i64 %82, 1
%87 = load i32, i32* %9
%88 = sext i32 %87 to i64
%89 = icmp slt i64 %86, %88
br i1 %89, label %81, label %90
90: ; preds = %81, %75
%91 = phi i32 [ %79, %75 ], [ %87, %81 ]
%92 = call i32 @quaddobl_trace_sum_difference(i32 %91, i32* %69, double* %10)
%93 = load double, double* %10
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %93)
%95 = add nuw nsw i32 %76, 1
%96 = load i32, i32* %8
%97 = icmp slt i32 %76, %96
br i1 %97, label %75, label %98
98: ; preds = %90, %65
%99 = call i32 (...) @restore_quaddobl_solutions()
%100 = add nuw nsw i32 %45, 1
%101 = load i32, i32* %5
%102 = icmp slt i32 %45, %0
%103 = icmp eq i32 %101, 0
%104 = select i1 %102, i1 %103, i1 false
br i1 %104, label %44, label %105
105: ; preds = %98
%106 = icmp eq i32 %101, 1
br i1 %106, label %107, label %109
107: ; preds = %105
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0), i32 %45)
br label %113
109: ; preds = %4, %105
%110 = phi i32 [ %99, %105 ], [ %31, %4 ]
%111 = phi i32 [ %45, %105 ], [ 0, %4 ]
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0), i32 %111)
br label %113
113: ; preds = %109, %107
%114 = phi i32 [ %110, %109 ], [ %99, %107 ]
ret i32 %114
}