#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 */
typedef int /*<<< orphan*/ mpq_t;

/* Variables and functions */
int /*<<< orphan*/ convertNum(int /*<<< orphan*/, int, double *, double *);
scalar_t__ mpq_cmp(int /*<<< orphan*/, int /*<<< orphan*/);
int convert(mpq_t infq, int isInfinityInf, mpq_t supq, int isInfinitySup,
            double *inf, double *sup, int strictBoundsCheck) {
  double inf1, sup1;
  if (isInfinityInf == +1 || isInfinitySup == -1)
    return 1;
  if (strictBoundsCheck) {
    if (isInfinityInf == 0 && isInfinitySup == 0 && mpq_cmp(infq, supq) > 0)
      return 1;
  }
  convertNum(infq, isInfinityInf, inf, &inf1);
  convertNum(supq, isInfinitySup, &sup1, sup);
  if (!strictBoundsCheck) {
    if (inf1 >= sup1 && (*inf != sup1 || inf1 != *sup))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<convert>:
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    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1153 <convert+0x33>
cmpl   $0xffffffff,-0x14(%rbp)
jne    115f <convert+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1232 <convert+0x112>
cmpl   $0x0,0x10(%rbp)
je     11a3 <convert+0x83>
cmpl   $0x0,-0xc(%rbp)
jne    119e <convert+0x7e>
cmpl   $0x0,-0x14(%rbp)
jne    119e <convert+0x7e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <mpq_cmp@plt>
cmp    $0x0,%rax
jle    119e <convert+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    1232 <convert+0x112>
jmp    11a3 <convert+0x83>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1030 <convertNum@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rcx
lea    -0x38(%rbp),%rdx
call   1030 <convertNum@plt>
cmpl   $0x0,0x10(%rbp)
jne    122b <convert+0x10b>
movsd  -0x30(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jb     1226 <convert+0x106>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd -0x38(%rbp),%xmm0
jne    121a <convert+0xfa>
jp     121a <convert+0xfa>
movsd  -0x30(%rbp),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jne    121a <convert+0xfa>
jp     121a <convert+0xfa>
jmp    1226 <convert+0x106>
movl   $0x1,-0x4(%rbp)
jmp    1232 <convert+0x112>
jmp    122b <convert+0x10b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%r12d
cmp    $0x1,%esi
je     11ae <convert+0x8e>
mov    %ecx,%ebp
cmp    $0xffffffff,%ecx
je     11ae <convert+0x8e>
mov    %r8,%r15
mov    %edx,%r13d
mov    %esi,%ebx
mov    %edi,%r14d
mov    %r9,(%rsp)
mov    0x50(%rsp),%ecx
mov    %ebp,%eax
or     %esi,%eax
jne    116d <convert+0x4d>
test   %ecx,%ecx
je     116d <convert+0x4d>
mov    %r14d,%edi
mov    %r13d,%esi
call   1040 <mpq_cmp@plt>
test   %rax,%rax
jg     11ae <convert+0x8e>
lea    0x10(%rsp),%rcx
mov    %r14d,%edi
mov    %ebx,%esi
mov    %r15,%rdx
call   1030 <convertNum@plt>
lea    0x8(%rsp),%rdx
mov    %r13d,%edi
mov    %ebp,%esi
mov    (%rsp),%rcx
call   1030 <convertNum@plt>
cmpl   $0x0,0x50(%rsp)
jne    11ab <convert+0x8b>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jae    11c0 <convert+0xa0>
xor    %r12d,%r12d
mov    %r12d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movsd  (%r15),%xmm2
ucomisd %xmm1,%xmm2
jne    11ae <convert+0x8e>
jp     11ae <convert+0x8e>
mov    (%rsp),%rax
ucomisd (%rax),%xmm0
jne    11ae <convert+0x8e>
jp     11ae <convert+0x8e>
jmp    11ab <convert+0x8b>

LLVM IR (-O0):
define i32 @convert(i32 %0, i32 %1, i32 %2, i32 %3, double* %4, double* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
%16 = alloca double
%17 = alloca double
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store double* %4, double** %13
store double* %5, double** %14
store i32 %6, i32* %15
%18 = load i32, i32* %10
%19 = icmp eq i32 %18, 1
br i1 %19, label %23, label %20
20: ; preds = %7
%21 = load i32, i32* %12
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %24
23: ; preds = %20, %7
store i32 1, i32* %8
br label %68
24: ; preds = %20
%25 = load i32, i32* %15
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %40
27: ; preds = %24
%28 = load i32, i32* %10
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %27
%31 = load i32, i32* %12
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load i32, i32* %9
%35 = load i32, i32* %11
%36 = call i64 @mpq_cmp(i32 %34, i32 %35)
%37 = icmp sgt i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33
store i32 1, i32* %8
br label %68
39: ; preds = %33, %30, %27
br label %40
40: ; preds = %39, %24
%41 = load i32, i32* %9
%42 = load i32, i32* %10
%43 = load double*, double** %13
%44 = call i32 @convertNum(i32 %41, i32 %42, double* %43, double* %16)
%45 = load i32, i32* %11
%46 = load i32, i32* %12
%47 = load double*, double** %14
%48 = call i32 @convertNum(i32 %45, i32 %46, double* %17, double* %47)
%49 = load i32, i32* %15
%50 = icmp ne i32 %49, 0
br i1 %50, label %67, label %51
51: ; preds = %40
%52 = load double, double* %16
%53 = load double, double* %17
%54 = fcmp oge double %52, %53
br i1 %54, label %55, label %66
55: ; preds = %51
%56 = load double*, double** %13
%57 = load double, double* %56
%58 = load double, double* %17
%59 = fcmp une double %57, %58
br i1 %59, label %65, label %60
60: ; preds = %55
%61 = load double, double* %16
%62 = load double*, double** %14
%63 = load double, double* %62
%64 = fcmp une double %61, %63
br i1 %64, label %65, label %66
65: ; preds = %60, %55
store i32 1, i32* %8
br label %68
66: ; preds = %60, %51
br label %67
67: ; preds = %66, %40
store i32 0, i32* %8
br label %68
68: ; preds = %67, %65, %38, %23
%69 = load i32, i32* %8
ret i32 %69
}

LLVM IR (-O2):
define i32 @convert(i32 %0, i32 %1, i32 %2, i32 %3, double* %4, double* %5, i32 %6) {
%8 = alloca double
%9 = alloca double
%10 = bitcast double* %8 to i8*
%11 = bitcast double* %9 to i8*
%12 = icmp eq i32 %1, 1
%13 = icmp eq i32 %3, -1
%14 = or i1 %12, %13
br i1 %14, label %37, label %15
15: ; preds = %7
%16 = icmp eq i32 %6, 0
%17 = or i32 %3, %1
%18 = icmp ne i32 %17, 0
%19 = or i1 %18, %16
br i1 %19, label %23, label %20
20: ; preds = %15
%21 = tail call i64 @mpq_cmp(i32 %0, i32 %2)
%22 = icmp sgt i64 %21, 0
br i1 %22, label %37, label %23
23: ; preds = %20, %15
%24 = call i32 @convertNum(i32 %0, i32 %1, double* %4, double* %8)
%25 = call i32 @convertNum(i32 %2, i32 %3, double* %9, double* %5)
br i1 %16, label %26, label %36
26: ; preds = %23
%27 = load double, double* %8
%28 = load double, double* %9
%29 = fcmp ult double %27, %28
br i1 %29, label %36, label %30
30: ; preds = %26
%31 = load double, double* %4
%32 = fcmp une double %31, %28
br i1 %32, label %37, label %33
33: ; preds = %30
%34 = load double, double* %5
%35 = fcmp une double %27, %34
br i1 %35, label %37, label %36
36: ; preds = %26, %33, %23
br label %37
37: ; preds = %30, %33, %20, %7, %36
%38 = phi i32 [ 0, %36 ], [ 1, %7 ], [ 1, %20 ], [ 1, %33 ], [ 1, %30 ]
ret i32 %38
}