#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 */
double fabs(double);
double floor(double);
int /*<<< orphan*/ glp_lib_fault(char *, double);
int /*<<< orphan*/ glp_lib_insist(char *, char *, int);
int glp_lib_fp2rat(double x, double eps, double *p, double *q) {
  int k;
  double xk, Akm1, Ak, Bkm1, Bk, ak, bk, fk, temp;
  if (!(0.0 <= x && x < 1.0))
    glp_lib_fault("fp2rat: x = %g; number out of range", x);
  for (k = 0;; k++) {
    ((void)((k <= 100) ||
            (glp_lib_insist(
                 "k <= 100",
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/ecotox/pacfm/refs/heads/"
                 "master/pacfm/tools/minpath-1.2/glpk-4.6/src/glplib3.c",
                 315),
             1)));
    if (k == 0) {
      xk = x;
      Akm1 = 1.0;
      Ak = 0.0;
      Bkm1 = 0.0;
      Bk = 1.0;
    } else {
      temp = xk - floor(xk);
      ((void)((temp != 0.0) ||
              (glp_lib_insist(
                   "temp != 0.0",
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/ecotox/pacfm/refs/heads/"
                   "master/pacfm/tools/minpath-1.2/glpk-4.6/src/glplib3.c",
                   331),
               1)));
      xk = 1.0 / temp;
      ak = 1.0;
      bk = floor(xk);
      temp = bk * Ak + ak * Akm1;
      Akm1 = Ak, Ak = temp;
      temp = bk * Bk + ak * Bkm1;
      Bkm1 = Bk, Bk = temp;
    }
    fk = Ak / Bk;
    if (fabs(x - fk) <= eps)
      break;
  }
  *p = Ak;
  *q = Bk;
  return k;
}


x86 assembly (clang, -O0):
<glp_lib_fp2rat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1172 <glp_lib_fp2rat+0x42>
movsd  0xe99(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
ja     1183 <glp_lib_fp2rat+0x53>
movsd  -0x8(%rbp),%xmm0
lea    0xea2(%rip),%rdi
call   1030 <glp_lib_fault@plt>
movl   $0x0,-0x24(%rbp)
mov    $0x1,%al
cmpl   $0x64,-0x24(%rbp)
mov    %al,-0x71(%rbp)
jle    11b6 <glp_lib_fp2rat+0x86>
lea    0xea4(%rip),%rdi
lea    0xea6(%rip),%rsi
mov    $0x13b,%edx
call   1040 <glp_lib_insist@plt>
mov    $0x1,%al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
cmpl   $0x0,-0x24(%rbp)
jne    11fc <glp_lib_fp2rat+0xcc>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe2b(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe0e(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    12f6 <glp_lib_fp2rat+0x1c6>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
mov    $0x1,%al
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x72(%rbp)
jne    125b <glp_lib_fp2rat+0x12b>
jp     125b <glp_lib_fp2rat+0x12b>
lea    0xeb0(%rip),%rdi
lea    0xe01(%rip),%rsi
mov    $0x14b,%edx
call   1040 <glp_lib_insist@plt>
mov    $0x1,%al
mov    %al,-0x72(%rbp)
mov    -0x72(%rbp),%al
movsd  0xd9a(%rip),%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd88(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <floor@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x68(%rbp),%xmm1
movaps 0xcfa(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     132e <glp_lib_fp2rat+0x1fe>
jmp    1341 <glp_lib_fp2rat+0x211>
jmp    1333 <glp_lib_fp2rat+0x203>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118a <glp_lib_fp2rat+0x5a>
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x24(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glp_lib_fp2rat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
movapd %xmm3,0x10(%rsp)
jb     116c <glp_lib_fp2rat+0x3c>
movsd  0xe9a(%rip),%xmm0
ucomisd %xmm3,%xmm0
ja     1182 <glp_lib_fp2rat+0x52>
lea    0xead(%rip),%rdi
movapd %xmm3,%xmm0
call   1030 <glp_lib_fault@plt>
movapd 0x10(%rsp),%xmm3
movapd 0xe86(%rip),%xmm1
andpd  %xmm3,%xmm1
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm2
movhpd 0xe60(%rip),%xmm0
ucomisd %xmm1,%xmm2
jae    12bf <glp_lib_fp2rat+0x18f>
movsd  0xe4e(%rip),%xmm1
xor    %ebp,%ebp
lea    0xf3a(%rip),%r12
lea    0xe8b(%rip),%rbx
lea    0xe7b(%rip),%r13
movapd %xmm3,%xmm2
jmp    1263 <glp_lib_fp2rat+0x133>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm2,%xmm0
call   1050 <floor@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xe0e(%rip),%xmm1
jne    1202 <glp_lib_fp2rat+0xd2>
jnp    12a0 <glp_lib_fp2rat+0x170>
movsd  0xdf6(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
call   1050 <floor@plt>
unpcklpd %xmm0,%xmm0
movapd 0x20(%rsp),%xmm3
mulpd  %xmm3,%xmm0
addpd  0x30(%rsp),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
movapd 0x10(%rsp),%xmm1
subsd  %xmm2,%xmm1
andpd  0xdc2(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
ucomisd %xmm1,%xmm2
movsd  (%rsp),%xmm2
movapd %xmm3,%xmm1
jae    12c1 <glp_lib_fp2rat+0x191>
movapd %xmm1,0x30(%rsp)
movapd %xmm0,0x20(%rsp)
add    $0x1,%ebp
cmp    $0x65,%ebp
movsd  %xmm2,(%rsp)
jb     11e0 <glp_lib_fp2rat+0xb0>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x13b,%edx
call   1040 <glp_lib_insist@plt>
movsd  (%rsp),%xmm2
jmp    11e0 <glp_lib_fp2rat+0xb0>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x14b,%edx
movsd  %xmm1,(%rsp)
call   1040 <glp_lib_insist@plt>
movsd  (%rsp),%xmm1
jmp    1202 <glp_lib_fp2rat+0xd2>
xor    %ebp,%ebp
movlpd %xmm0,(%r15)
movhpd %xmm0,(%r14)
mov    %ebp,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"fp2rat: x = %g; number out of range\00"
@.str.1 = [9 x i8] c"k <= 100\00"
@.str.2 = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ecotox/pacfm/refs/heads/master/pacfm/tools/minpath-1.2/glpk-4.6/src/glplib3.c\00"
@.str.3 = [12 x i8] c"temp != 0.0\00"
define i32 @glp_lib_fp2rat(double %0, double %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double %0, double* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
%19 = load double, double* %5
%20 = fcmp ole double 0.000000e+00, %19
br i1 %20, label %21, label %24
21: ; preds = %4
%22 = load double, double* %5
%23 = fcmp olt double %22, 1.000000e+00
br i1 %23, label %27, label %24
24: ; preds = %21, %4
%25 = load double, double* %5
%26 = call i32 @glp_lib_fault(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %25)
br label %27
27: ; preds = %24, %21
store i32 0, i32* %9
br label %28
28: ; preds = %84, %27
%29 = load i32, i32* %9
%30 = icmp sle i32 %29, 100
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = call i32 @glp_lib_insist(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.2, i64 0, i64 0), i32 315)
br label %33
33: ; preds = %31, %28
%34 = phi i1 [ true, %28 ], [ true, %31 ]
%35 = zext i1 %34 to i32
%36 = load i32, i32* %9
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = load double, double* %5
store double %39, double* %10
store double 1.000000e+00, double* %11
store double 0.000000e+00, double* %12
store double 0.000000e+00, double* %13
store double 1.000000e+00, double* %14
br label %72
40: ; preds = %33
%41 = load double, double* %10
%42 = load double, double* %10
%43 = call double @llvm.floor.f64(double %42)
%44 = fsub double %41, %43
store double %44, double* %18
%45 = load double, double* %18
%46 = fcmp une double %45, 0.000000e+00
br i1 %46, label %49, label %47
47: ; preds = %40
%48 = call i32 @glp_lib_insist(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.2, i64 0, i64 0), i32 331)
br label %49
49: ; preds = %47, %40
%50 = phi i1 [ true, %40 ], [ true, %47 ]
%51 = zext i1 %50 to i32
%52 = load double, double* %18
%53 = fdiv double 1.000000e+00, %52
store double %53, double* %10
store double 1.000000e+00, double* %15
%54 = load double, double* %10
%55 = call double @llvm.floor.f64(double %54)
store double %55, double* %16
%56 = load double, double* %16
%57 = load double, double* %12
%58 = load double, double* %15
%59 = load double, double* %11
%60 = fmul double %58, %59
%61 = call double @llvm.fmuladd.f64(double %56, double %57, double %60)
store double %61, double* %18
%62 = load double, double* %12
store double %62, double* %11
%63 = load double, double* %18
store double %63, double* %12
%64 = load double, double* %16
%65 = load double, double* %14
%66 = load double, double* %15
%67 = load double, double* %13
%68 = fmul double %66, %67
%69 = call double @llvm.fmuladd.f64(double %64, double %65, double %68)
store double %69, double* %18
%70 = load double, double* %14
store double %70, double* %13
%71 = load double, double* %18
store double %71, double* %14
br label %72
72: ; preds = %49, %38
%73 = load double, double* %12
%74 = load double, double* %14
%75 = fdiv double %73, %74
store double %75, double* %17
%76 = load double, double* %5
%77 = load double, double* %17
%78 = fsub double %76, %77
%79 = call double @llvm.fabs.f64(double %78)
%80 = load double, double* %6
%81 = fcmp ole double %79, %80
br i1 %81, label %82, label %83
82: ; preds = %72
br label %87
83: ; preds = %72
br label %84
84: ; preds = %83
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
br label %28
87: ; preds = %82
%88 = load double, double* %12
%89 = load double*, double** %7
store double %88, double* %89
%90 = load double, double* %14
%91 = load double*, double** %8
store double %90, double* %91
%92 = load i32, i32* %9
ret i32 %92
}

LLVM IR (-O2):
@.str = [36 x i8] c"fp2rat: x = %g; number out of range\00"
@.str.1 = [9 x i8] c"k <= 100\00"
@.str.2 = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ecotox/pacfm/refs/heads/master/pacfm/tools/minpath-1.2/glpk-4.6/src/glplib3.c\00"
@.str.3 = [12 x i8] c"temp != 0.0\00"
define i32 @glp_lib_fp2rat(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = fcmp oge double %0, 0.000000e+00
%6 = fcmp olt double %0, 1.000000e+00
%7 = and i1 %5, %6
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @glp_lib_fault(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %0)
br label %10
10: ; preds = %4, %8
%11 = tail call double @llvm.fabs.f64(double %0)
%12 = fcmp ugt double %11, %1
br i1 %12, label %13, label %41
13: ; preds = %10, %27
%14 = phi double [ %28, %27 ], [ %0, %10 ]
%15 = phi i32 [ %40, %27 ], [ 1, %10 ]
%16 = phi <2 x double> [ %32, %27 ], [ <double 0.000000e+00, double 1.000000e+00>, %10 ]
%17 = phi <2 x double> [ %16, %27 ], [ <double 1.000000e+00, double 0.000000e+00>, %10 ]
%18 = icmp ult i32 %15, 101
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = tail call i32 @glp_lib_insist(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.2, i64 0, i64 0), i32 315)
br label %21
21: ; preds = %13, %19
%22 = tail call double @llvm.floor.f64(double %14)
%23 = fsub double %14, %22
%24 = fcmp une double %23, 0.000000e+00
br i1 %24, label %27, label %25
25: ; preds = %21
%26 = tail call i32 @glp_lib_insist(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.2, i64 0, i64 0), i32 331)
br label %27
27: ; preds = %21, %25
%28 = fdiv double 1.000000e+00, %23
%29 = tail call double @llvm.floor.f64(double %28)
%30 = insertelement <2 x double> poison, double %29, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
%32 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %31, <2 x double> %16, <2 x double> %17)
%33 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %31, <2 x double> %16, <2 x double> %17)
%34 = extractelement <2 x double> %33, i64 0
%35 = extractelement <2 x double> %33, i64 1
%36 = fdiv double %34, %35
%37 = fsub double %0, %36
%38 = tail call double @llvm.fabs.f64(double %37)
%39 = fcmp ugt double %38, %1
%40 = add nuw nsw i32 %15, 1
br i1 %39, label %13, label %41
41: ; preds = %27, %10
%42 = phi i32 [ 0, %10 ], [ %15, %27 ]
%43 = phi <2 x double> [ <double 0.000000e+00, double 1.000000e+00>, %10 ], [ %33, %27 ]
%44 = extractelement <2 x double> %43, i64 0
store double %44, double* %2
%45 = extractelement <2 x double> %43, i64 1
store double %45, double* %3
ret i32 %42
}