#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_assert_(char *, char *, int);
int _glp_fp2rat(double x, double eps, double *p, double *q) {
  int k;
  double xk, Akm1, Ak, Bkm1, Bk, ak, bk, fk, temp;
  ((void)((0.0 <= x && x < 1.0) ||
          (glp_assert_(
               "0.0 <= x && x < 1.0",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/MarhesLab/NeeleyThesisCode/"
               "refs/heads/master/lib/glpk-4.55/src/misc/fp2rat.c",
               119),
           1)));
  for (k = 0;; k++) {
    ((void)((k <= 100) ||
            (glp_assert_(
                 "k <= 100",
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/MarhesLab/NeeleyThesisCode/"
                 "refs/heads/master/lib/glpk-4.55/src/misc/fp2rat.c",
                 121),
             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_assert_("temp != 0.0",
                           "/scratch/repos/new/home/jordi_armengol_estape/"
                           "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                           "MarhesLab/NeeleyThesisCode/refs/heads/master/lib/"
                           "glpk-4.55/src/misc/fp2rat.c",
                           137),
               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_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     1167 <_glp_fp2rat+0x47>
mov    $0x1,%al
movsd  0xea7(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
mov    %al,-0x71(%rbp)
ja     1184 <_glp_fp2rat+0x64>
lea    0xeb2(%rip),%rdi
lea    0xebf(%rip),%rsi
mov    $0x77,%edx
call   1030 <glp_assert_@plt>
mov    $0x1,%al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
movl   $0x0,-0x24(%rbp)
mov    $0x1,%al
cmpl   $0x64,-0x24(%rbp)
mov    %al,-0x72(%rbp)
jle    11ba <_glp_fp2rat+0x9a>
lea    0xf37(%rip),%rdi
lea    0xe89(%rip),%rsi
mov    $0x79,%edx
call   1030 <glp_assert_@plt>
mov    $0x1,%al
mov    %al,-0x72(%rbp)
mov    -0x72(%rbp),%al
cmpl   $0x0,-0x24(%rbp)
jne    1200 <_glp_fp2rat+0xe0>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe27(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe0a(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    12fa <_glp_fp2rat+0x1da>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <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,-0x73(%rbp)
jne    125f <_glp_fp2rat+0x13f>
jp     125f <_glp_fp2rat+0x13f>
lea    0xe9b(%rip),%rdi
lea    0xde4(%rip),%rsi
mov    $0x89,%edx
call   1030 <glp_assert_@plt>
mov    $0x1,%al
mov    %al,-0x73(%rbp)
mov    -0x73(%rbp),%al
movsd  0xd96(%rip),%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd84(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <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 0xcf6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1332 <_glp_fp2rat+0x212>
jmp    1345 <_glp_fp2rat+0x225>
jmp    1337 <_glp_fp2rat+0x217>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118e <_glp_fp2rat+0x6e>
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_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     115c <_glp_fp2rat+0x3c>
movsd  0xeaa(%rip),%xmm0
ucomisd %xmm3,%xmm0
ja     117a <_glp_fp2rat+0x5a>
lea    0xebd(%rip),%rdi
lea    0xeca(%rip),%rsi
mov    $0x77,%edx
call   1030 <glp_assert_@plt>
movapd 0x10(%rsp),%xmm3
movapd 0xe8e(%rip),%xmm1
andpd  %xmm3,%xmm1
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm2
movhpd 0xe68(%rip),%xmm0
ucomisd %xmm1,%xmm2
jae    12af <_glp_fp2rat+0x18f>
movsd  0xe56(%rip),%xmm1
xor    %ebp,%ebp
lea    0xf31(%rip),%r12
lea    0xe7a(%rip),%rbx
lea    0xf1a(%rip),%r13
movapd %xmm3,%xmm2
jmp    1253 <_glp_fp2rat+0x133>
nopw   0x0(%rax,%rax,1)
movapd %xmm2,%xmm0
call   1040 <floor@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xe1e(%rip),%xmm1
jne    11f2 <_glp_fp2rat+0xd2>
jnp    1290 <_glp_fp2rat+0x170>
movsd  0xe06(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
call   1040 <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  0xdd2(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
ucomisd %xmm1,%xmm2
movsd  (%rsp),%xmm2
movapd %xmm3,%xmm1
jae    12b1 <_glp_fp2rat+0x191>
movapd %xmm1,0x30(%rsp)
movapd %xmm0,0x20(%rsp)
add    $0x1,%ebp
cmp    $0x65,%ebp
movsd  %xmm2,(%rsp)
jb     11d0 <_glp_fp2rat+0xb0>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x79,%edx
call   1030 <glp_assert_@plt>
movsd  (%rsp),%xmm2
jmp    11d0 <_glp_fp2rat+0xb0>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x89,%edx
movsd  %xmm1,(%rsp)
call   1030 <glp_assert_@plt>
movsd  (%rsp),%xmm1
jmp    11f2 <_glp_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 = [20 x i8] c"0.0 <= x && x < 1.0\00"
@.str.1 = [167 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MarhesLab/NeeleyThesisCode/refs/heads/master/lib/glpk-4.55/src/misc/fp2rat.c\00"
@.str.2 = [9 x i8] c"k <= 100\00"
@.str.3 = [12 x i8] c"temp != 0.0\00"
define i32 @_glp_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 %26, label %24
24: ; preds = %21, %4
%25 = call i32 @glp_assert_(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 119)
br label %26
26: ; preds = %24, %21
%27 = phi i1 [ true, %21 ], [ true, %24 ]
%28 = zext i1 %27 to i32
store i32 0, i32* %9
br label %29
29: ; preds = %85, %26
%30 = load i32, i32* %9
%31 = icmp sle i32 %30, 100
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = call i32 @glp_assert_(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 121)
br label %34
34: ; preds = %32, %29
%35 = phi i1 [ true, %29 ], [ true, %32 ]
%36 = zext i1 %35 to i32
%37 = load i32, i32* %9
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = load double, double* %5
store double %40, 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 %73
41: ; preds = %34
%42 = load double, double* %10
%43 = load double, double* %10
%44 = call double @llvm.floor.f64(double %43)
%45 = fsub double %42, %44
store double %45, double* %18
%46 = load double, double* %18
%47 = fcmp une double %46, 0.000000e+00
br i1 %47, label %50, label %48
48: ; preds = %41
%49 = call i32 @glp_assert_(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 137)
br label %50
50: ; preds = %48, %41
%51 = phi i1 [ true, %41 ], [ true, %48 ]
%52 = zext i1 %51 to i32
%53 = load double, double* %18
%54 = fdiv double 1.000000e+00, %53
store double %54, double* %10
store double 1.000000e+00, double* %15
%55 = load double, double* %10
%56 = call double @llvm.floor.f64(double %55)
store double %56, double* %16
%57 = load double, double* %16
%58 = load double, double* %12
%59 = load double, double* %15
%60 = load double, double* %11
%61 = fmul double %59, %60
%62 = call double @llvm.fmuladd.f64(double %57, double %58, double %61)
store double %62, double* %18
%63 = load double, double* %12
store double %63, double* %11
%64 = load double, double* %18
store double %64, double* %12
%65 = load double, double* %16
%66 = load double, double* %14
%67 = load double, double* %15
%68 = load double, double* %13
%69 = fmul double %67, %68
%70 = call double @llvm.fmuladd.f64(double %65, double %66, double %69)
store double %70, double* %18
%71 = load double, double* %14
store double %71, double* %13
%72 = load double, double* %18
store double %72, double* %14
br label %73
73: ; preds = %50, %39
%74 = load double, double* %12
%75 = load double, double* %14
%76 = fdiv double %74, %75
store double %76, double* %17
%77 = load double, double* %5
%78 = load double, double* %17
%79 = fsub double %77, %78
%80 = call double @llvm.fabs.f64(double %79)
%81 = load double, double* %6
%82 = fcmp ole double %80, %81
br i1 %82, label %83, label %84
83: ; preds = %73
br label %88
84: ; preds = %73
br label %85
85: ; preds = %84
%86 = load i32, i32* %9
%87 = add nsw i32 %86, 1
store i32 %87, i32* %9
br label %29
88: ; preds = %83
%89 = load double, double* %12
%90 = load double*, double** %7
store double %89, double* %90
%91 = load double, double* %14
%92 = load double*, double** %8
store double %91, double* %92
%93 = load i32, i32* %9
ret i32 %93
}

LLVM IR (-O2):
@.str = [20 x i8] c"0.0 <= x && x < 1.0\00"
@.str.1 = [167 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MarhesLab/NeeleyThesisCode/refs/heads/master/lib/glpk-4.55/src/misc/fp2rat.c\00"
@.str.2 = [9 x i8] c"k <= 100\00"
@.str.3 = [12 x i8] c"temp != 0.0\00"
define i32 @_glp_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_assert_(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 119)
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_assert_(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 121)
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_assert_(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0), i32 137)
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
}