#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*/ printf(char *, int, double);
int lanpause_float(int j, int lastpause, int interval, float **q, int n,
                   int *pausemode, int version, double beta) {
  extern int DEBUG_EVECS;
  extern double DOUBLE_EPSILON;
  double paige_dot;
  double paigetol;
  double dot_float();
  double fabs();
  void checkorth_float();
  if (DEBUG_EVECS > 3) {
    checkorth_float(q, n, j);
  }
  if (version == 1 || version == 2) {
    if ((j - lastpause) == interval || beta < 1000 * DOUBLE_EPSILON) {
      return (1);
    }
    return (0);
  }
  if (version == 3) {
    paigetol = 1.0e-3;
    if (*pausemode == 1) {
      paige_dot = fabs(dot_float(q[1], 1, n, q[j]));
      if ((paige_dot > paigetol && j > 1) || beta < 1000 * DOUBLE_EPSILON) {
        if (DEBUG_EVECS > 1) {
          printf("  Pausing on step %3d with Paige prod. = %g\n", j, paige_dot);
        }
        *pausemode = 2;
        return (1);
      }
      return (0);
    }
    if (*pausemode == 2) {
      if ((j - lastpause) == interval || beta < 1000 * DOUBLE_EPSILON) {
        return (1);
      }
      return (0);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<lanpause_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    0x2e8c(%rip),%rax
cmpl   $0x3,(%rax)
jle    1176 <lanpause_float+0x46>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x0,%al
call   1030 <checkorth_float@plt>
cmpl   $0x1,0x10(%rbp)
je     118a <lanpause_float+0x5a>
cmpl   $0x2,0x10(%rbp)
jne    11d3 <lanpause_float+0xa3>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11bb <lanpause_float+0x8b>
movsd  -0x30(%rbp),%xmm1
movsd  0xe62(%rip),%xmm0
mov    0x2e2b(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c7 <lanpause_float+0x97>
movl   $0x1,-0x4(%rbp)
jmp    130e <lanpause_float+0x1de>
movl   $0x0,-0x4(%rbp)
jmp    130e <lanpause_float+0x1de>
cmpl   $0x3,0x10(%rbp)
jne    1307 <lanpause_float+0x1d7>
movsd  0xe1b(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%rax
cmpl   $0x1,(%rax)
jne    12ac <lanpause_float+0x17c>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <dot_float@plt>
movaps 0xdef(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1244 <lanpause_float+0x114>
cmpl   $0x1,-0x8(%rbp)
jg     1266 <lanpause_float+0x136>
movsd  -0x30(%rbp),%xmm1
movsd  0xdb7(%rip),%xmm0
mov    0x2d80(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    12a0 <lanpause_float+0x170>
mov    0x2d7b(%rip),%rax
cmpl   $0x1,(%rax)
jle    128a <lanpause_float+0x15a>
mov    -0x8(%rbp),%esi
movsd  -0x38(%rbp),%xmm0
lea    0xd9b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
movl   $0x2,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    130e <lanpause_float+0x1de>
movl   $0x0,-0x4(%rbp)
jmp    130e <lanpause_float+0x1de>
mov    -0x28(%rbp),%rax
cmpl   $0x2,(%rax)
jne    1302 <lanpause_float+0x1d2>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     12ea <lanpause_float+0x1ba>
movsd  -0x30(%rbp),%xmm1
movsd  0xd33(%rip),%xmm0
mov    0x2cfc(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    12f6 <lanpause_float+0x1c6>
movl   $0x1,-0x4(%rbp)
jmp    130e <lanpause_float+0x1de>
movl   $0x0,-0x4(%rbp)
jmp    130e <lanpause_float+0x1de>
jmp    1307 <lanpause_float+0x1d7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lanpause_float>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r12
mov    %r8d,%ebx
mov    %edx,%r13d
mov    %esi,%r14d
mov    %edi,%ebp
mov    0x40(%rsp),%esi
mov    0x2e94(%rip),%rax
cmpl   $0x4,(%rax)
jl     117b <lanpause_float+0x4b>
mov    %rcx,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
movsd  %xmm0,(%rsp)
mov    %rcx,%r15
call   1030 <checkorth_float@plt>
mov    0x40(%rsp),%esi
mov    %r15,%rcx
movsd  (%rsp),%xmm0
lea    -0x1(%rsi),%eax
cmp    $0x1,%eax
ja     11ba <lanpause_float+0x8a>
sub    %r14d,%ebp
mov    $0x1,%r12d
cmp    %r13d,%ebp
je     125a <lanpause_float+0x12a>
mov    0x2e3c(%rip),%rax
movsd  (%rax),%xmm1
mulsd  0xe58(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     125a <lanpause_float+0x12a>
xor    %r12d,%r12d
jmp    125a <lanpause_float+0x12a>
mov    %ebx,%edx
mov    %r12,%rbx
xor    %r12d,%r12d
cmp    $0x3,%esi
jne    125a <lanpause_float+0x12a>
mov    %rbx,%rax
mov    (%rbx),%eax
cmp    $0x2,%eax
je     1183 <lanpause_float+0x53>
mov    $0x0,%r12d
cmp    $0x1,%eax
jne    125a <lanpause_float+0x12a>
mov    0x8(%rcx),%rdi
movslq %ebp,%rax
mov    (%rcx,%rax,8),%rcx
xor    %r12d,%r12d
mov    $0x1,%esi
xor    %eax,%eax
movsd  %xmm0,(%rsp)
call   1050 <dot_float@plt>
movsd  (%rsp),%xmm2
andpd  0xe04(%rip),%xmm0
cmp    $0x2,%ebp
jl     121b <lanpause_float+0xeb>
ucomisd 0xdef(%rip),%xmm0
ja     1234 <lanpause_float+0x104>
mov    0x2db6(%rip),%rax
movsd  (%rax),%xmm1
mulsd  0xdd2(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    125a <lanpause_float+0x12a>
mov    0x2dad(%rip),%rax
cmpl   $0x2,(%rax)
jl     124e <lanpause_float+0x11e>
lea    0xdd9(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
movl   $0x2,(%rbx)
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@DEBUG_EVECS = external global i32
@DOUBLE_EPSILON = external global double
@.str = [45 x i8] c" Pausing on step %3d with Paige prod. = %g\0A\00"
define i32 @lanpause_float(i32 %0, i32 %1, i32 %2, float** %3, i32 %4, i32* %5, i32 %6, double %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float**
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
store i32 %0, i32* %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store float** %3, float*** %13
store i32 %4, i32* %14
store i32* %5, i32** %15
store i32 %6, i32* %16
store double %7, double* %17
%20 = load i32, i32* @DEBUG_EVECS
%21 = icmp sgt i32 %20, 3
br i1 %21, label %22, label %26
22: ; preds = %8
%23 = load float**, float*** %13
%24 = load i32, i32* %14
%25 = load i32, i32* %10
br label %26
26: ; preds = %22, %8
%27 = load i32, i32* %16
%28 = icmp eq i32 %27, 1
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = load i32, i32* %16
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %45
32: ; preds = %29, %26
%33 = load i32, i32* %10
%34 = load i32, i32* %11
%35 = sub nsw i32 %33, %34
%36 = load i32, i32* %12
%37 = icmp eq i32 %35, %36
br i1 %37, label %43, label %38
38: ; preds = %32
%39 = load double, double* %17
%40 = load double, double* @DOUBLE_EPSILON
%41 = fmul double 1.000000e+03, %40
%42 = fcmp olt double %39, %41
br i1 %42, label %43, label %44
43: ; preds = %38, %32
store i32 1, i32* %9
br label %104
44: ; preds = %38
store i32 0, i32* %9
br label %104
45: ; preds = %29
%46 = load i32, i32* %16
%47 = icmp eq i32 %46, 3
br i1 %47, label %48, label %103
48: ; preds = %45
store double 1.000000e-03, double* %19
%49 = load i32*, i32** %15
%50 = load i32, i32* %49
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %85
52: ; preds = %48
%53 = load float**, float*** %13
%54 = getelementptr inbounds float*, float** %53, i64 1
%55 = load float*, float** %54
%56 = load i32, i32* %14
%57 = load float**, float*** %13
%58 = load i32, i32* %10
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds float*, float** %57, i64 %59
%61 = load float*, float** %60
%62 = call double (float*, i32, i32, float*, ...) bitcast (double (...)* @dot_float to double (float*, i32, i32, float*, ...)*)(float* %55, i32 1, i32 %56, float* %61)
%63 = call double @llvm.fabs.f64(double %62)
store double %63, double* %18
%64 = load double, double* %18
%65 = load double, double* %19
%66 = fcmp ogt double %64, %65
br i1 %66, label %67, label %70
67: ; preds = %52
%68 = load i32, i32* %10
%69 = icmp sgt i32 %68, 1
br i1 %69, label %75, label %70
70: ; preds = %67, %52
%71 = load double, double* %17
%72 = load double, double* @DOUBLE_EPSILON
%73 = fmul double 1.000000e+03, %72
%74 = fcmp olt double %71, %73
br i1 %74, label %75, label %84
75: ; preds = %70, %67
%76 = load i32, i32* @DEBUG_EVECS
%77 = icmp sgt i32 %76, 1
br i1 %77, label %78, label %82
78: ; preds = %75
%79 = load i32, i32* %10
%80 = load double, double* %18
%81 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %79, double %80)
br label %82
82: ; preds = %78, %75
%83 = load i32*, i32** %15
store i32 2, i32* %83
store i32 1, i32* %9
br label %104
84: ; preds = %70
store i32 0, i32* %9
br label %104
85: ; preds = %48
%86 = load i32*, i32** %15
%87 = load i32, i32* %86
%88 = icmp eq i32 %87, 2
br i1 %88, label %89, label %102
89: ; preds = %85
%90 = load i32, i32* %10
%91 = load i32, i32* %11
%92 = sub nsw i32 %90, %91
%93 = load i32, i32* %12
%94 = icmp eq i32 %92, %93
br i1 %94, label %100, label %95
95: ; preds = %89
%96 = load double, double* %17
%97 = load double, double* @DOUBLE_EPSILON
%98 = fmul double 1.000000e+03, %97
%99 = fcmp olt double %96, %98
br i1 %99, label %100, label %101
100: ; preds = %95, %89
store i32 1, i32* %9
br label %104
101: ; preds = %95
store i32 0, i32* %9
br label %104
102: ; preds = %85
br label %103
103: ; preds = %102, %45
store i32 0, i32* %9
br label %104
104: ; preds = %103, %101, %100, %84, %82, %44, %43
%105 = load i32, i32* %9
ret i32 %105
}

LLVM IR (-O2):
@DEBUG_EVECS = external global i32
@DOUBLE_EPSILON = external global double
@.str = [45 x i8] c" Pausing on step %3d with Paige prod. = %g\0A\00"
define i32 @lanpause_float(i32 %0, i32 %1, i32 %2, float** %3, i32 %4, i32* nocapture %5, i32 %6, double %7) {
%9 = load i32, i32* @DEBUG_EVECS
%10 = icmp sgt i32 %9, 3
br i1 %10, label %11, label %12
11: ; preds = %8
tail call void (float**, i32, i32, ...) bitcast (void (...)* @checkorth_float to void (float**, i32, i32, ...)*)(float** %3, i32 %4, i32 %0)
br label %12
12: ; preds = %11, %8
%13 = add i32 %6, -1
%14 = icmp ult i32 %13, 2
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = sub nsw i32 %0, %1
%17 = icmp eq i32 %16, %2
br i1 %17, label %56, label %18
18: ; preds = %15
%19 = load double, double* @DOUBLE_EPSILON
%20 = fmul double %19, 1.000000e+03
%21 = fcmp ogt double %20, %7
br i1 %21, label %56, label %22
22: ; preds = %18
br label %56
23: ; preds = %12
%24 = icmp eq i32 %6, 3
br i1 %24, label %25, label %56
25: ; preds = %23
%26 = load i32, i32* %5
switch i32 %26, label %56 [
i32 1, label %27
i32 2, label %48
]
27: ; preds = %25
%28 = getelementptr inbounds float*, float** %3, i64 1
%29 = load float*, float** %28
%30 = sext i32 %0 to i64
%31 = getelementptr inbounds float*, float** %3, i64 %30
%32 = load float*, float** %31
%33 = tail call double (float*, i32, i32, float*, ...) bitcast (double (...)* @dot_float to double (float*, i32, i32, float*, ...)*)(float* %29, i32 1, i32 %4, float* %32)
%34 = tail call double @llvm.fabs.f64(double %33)
%35 = fcmp ogt double %34, 1.000000e-03
%36 = icmp sgt i32 %0, 1
%37 = and i1 %36, %35
br i1 %37, label %42, label %38
38: ; preds = %27
%39 = load double, double* @DOUBLE_EPSILON
%40 = fmul double %39, 1.000000e+03
%41 = fcmp ogt double %40, %7
br i1 %41, label %42, label %56
42: ; preds = %27, %38
%43 = load i32, i32* @DEBUG_EVECS
%44 = icmp sgt i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %0, double %34)
br label %47
47: ; preds = %45, %42
store i32 2, i32* %5
br label %56
48: ; preds = %25
%49 = sub nsw i32 %0, %1
%50 = icmp eq i32 %49, %2
br i1 %50, label %56, label %51
51: ; preds = %48
%52 = load double, double* @DOUBLE_EPSILON
%53 = fmul double %52, 1.000000e+03
%54 = fcmp ogt double %53, %7
br i1 %54, label %56, label %55
55: ; preds = %51
br label %56
56: ; preds = %23, %25, %48, %51, %38, %15, %18, %55, %47, %22
%57 = phi i32 [ 0, %22 ], [ 1, %47 ], [ 0, %55 ], [ 1, %18 ], [ 1, %15 ], [ 0, %38 ], [ 1, %51 ], [ 1, %48 ], [ 0, %25 ], [ 0, %23 ]
ret i32 %57
}