#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 frexp(double, int *);
int /*<<< orphan*/ glp_assert_(char *, char *, int);
double ldexp(double, int);
double _glp_round2n(double x) {
  int e;
  double f;
  ((void)((x > 0.0) ||
          (glp_assert_(
               "x > 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/round2n.c",
               59),
           1)));
  f = frexp(x, &e);
  return ldexp(1.0, f <= 0.75 ? e - 1 : e);
}


x86 assembly (clang, -O0):
<_glp_round2n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x19(%rbp)
ja     1171 <_glp_round2n+0x41>
lea    0xeb5(%rip),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x3b,%edx
call   1050 <glp_assert_@plt>
mov    $0x1,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
movsd  -0x8(%rbp),%xmm0
lea    -0xc(%rbp),%rdi
call   1040 <frexp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe71(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     11a8 <_glp_round2n+0x78>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ae <_glp_round2n+0x7e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
movsd  0xe4f(%rip),%xmm0
call   1030 <ldexp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_glp_round2n>:
sub    $0x18,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     1162 <_glp_round2n+0x32>
lea    0xecb(%rip),%rdi
lea    0xecc(%rip),%rsi
mov    $0x3b,%edx
movsd  %xmm0,0x10(%rsp)
call   1050 <glp_assert_@plt>
movsd  0x10(%rsp),%xmm0
lea    0xc(%rsp),%rdi
call   1040 <frexp@plt>
movsd  0xe8c(%rip),%xmm1
ucomisd %xmm0,%xmm1
mov    0xc(%rsp),%edi
adc    $0xffffffff,%edi
movsd  0xe81(%rip),%xmm0
add    $0x18,%rsp
jmp    1030 <ldexp@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"x > 0.0\00"
@.str.1 = [168 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/round2n.c\00"
define double @_glp_round2n(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fcmp ogt double %5, 0.000000e+00
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @glp_assert_(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.1, i64 0, i64 0), i32 59)
br label %9
9: ; preds = %7, %1
%10 = phi i1 [ true, %1 ], [ true, %7 ]
%11 = zext i1 %10 to i32
%12 = load double, double* %2
%13 = call double @frexp(double %12, i32* %3)
store double %13, double* %4
%14 = load double, double* %4
%15 = fcmp ole double %14, 7.500000e-01
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
br label %21
19: ; preds = %9
%20 = load i32, i32* %3
br label %21
21: ; preds = %19, %16
%22 = phi i32 [ %18, %16 ], [ %20, %19 ]
%23 = call double @ldexp(double 1.000000e+00, i32 %22)
ret double %23
}

LLVM IR (-O2):
@.str = [8 x i8] c"x > 0.0\00"
@.str.1 = [168 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/round2n.c\00"
define double @_glp_round2n(double %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = fcmp ogt double %0, 0.000000e+00
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @glp_assert_(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str.1, i64 0, i64 0), i32 59)
br label %7
7: ; preds = %5, %1
%8 = call double @frexp(double %0, i32* %2)
%9 = fcmp ole double %8, 7.500000e-01
%10 = load i32, i32* %2
%11 = sext i1 %9 to i32
%12 = add nsw i32 %10, %11
%13 = tail call double @ldexp(double 1.000000e+00, i32 %12)
ret double %13
}