#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 */
struct s_token {
  int dummy;
};

/* Variables and functions */
long double fabs(long double);
int tokenToLongDouble(struct s_token *, long double *);
int tokensEqual(struct s_token *, struct s_token *);
int compareRealTokens(struct s_token *token1, struct s_token *token2) {
  long double x1, x2;
  int res1 = tokenToLongDouble(token1, &x1);
  int res2 = tokenToLongDouble(token2, &x2);
  if (res1 != res2)
    return 0;
  if (res1 != 0)
    return tokensEqual(token1, token2);
  if (x1 == x2)
    return 1;
  long double epsilon = fabs(x1 * 0.00001);
  if (epsilon < 1e-30)
    epsilon = 1e-30;
  return (fabs(x1 - x2) <= epsilon);
}


x86 assembly (clang, -O0):
<compareRealTokens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <tokenToLongDouble@plt>
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <tokenToLongDouble@plt>
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
je     1178 <compareRealTokens+0x48>
movl   $0x0,-0x4(%rbp)
jmp    121d <compareRealTokens+0xed>
cmpl   $0x0,-0x44(%rbp)
je     1197 <compareRealTokens+0x67>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <tokensEqual@plt>
mov    %eax,-0x4(%rbp)
jmp    121d <compareRealTokens+0xed>
fldt   -0x30(%rbp)
fldt   -0x40(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    11c0 <compareRealTokens+0x90>
jp     11c0 <compareRealTokens+0x90>
jmp    11b4 <compareRealTokens+0x84>
movl   $0x1,-0x4(%rbp)
jmp    121d <compareRealTokens+0xed>
fldt   -0x30(%rbp)
fldl   0xe37(%rip)
fmulp  %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <fabs@plt>
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
fldl   0xe27(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    11f9 <compareRealTokens+0xc9>
jmp    11f0 <compareRealTokens+0xc0>
fldl   0xe12(%rip)
fstpt  -0x60(%rbp)
fldt   -0x30(%rbp)
fldt   -0x40(%rbp)
fsubrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <fabs@plt>
fldt   -0x60(%rbp)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareRealTokens>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%rsi
call   1040 <tokenToLongDouble@plt>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <tokenToLongDouble@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%ebp
fldz
fldz
jne    1180 <compareRealTokens+0x60>
fstp   %st(1)
fstp   %st(0)
test   %ebp,%ebp
je     116a <compareRealTokens+0x4a>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <tokensEqual@plt>
fldz
fldz
jmp    1180 <compareRealTokens+0x60>
fldt   0x10(%rsp)
fldt   (%rsp)
mov    $0x1,%eax
fxch   %st(1)
fucomi %st(1),%st
fxch   %st(1)
jne    118d <compareRealTokens+0x6d>
jp     118d <compareRealTokens+0x6d>
fstp   %st(1)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
fld    %st(1)
fmull  0xe6b(%rip)
fabs
fldl   0xe6b(%rip)
fucomi %st(1),%st
fxch   %st(1)
fcmovnbe %st(1),%st
fstp   %st(1)
fxch   %st(2)
fsubp  %st,%st(1)
fabs
xor    %eax,%eax
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
jmp    1164 <compareRealTokens+0x44>

LLVM IR (-O0):
%struct.s_token = type { i32 }
define i32 @compareRealTokens(%struct.s_token* %0, %struct.s_token* %1) {
%3 = alloca i32
%4 = alloca %struct.s_token*
%5 = alloca %struct.s_token*
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca i32
%9 = alloca i32
%10 = alloca x86_fp80
store %struct.s_token* %0, %struct.s_token** %4
store %struct.s_token* %1, %struct.s_token** %5
%11 = load %struct.s_token*, %struct.s_token** %4
%12 = call i32 @tokenToLongDouble(%struct.s_token* %11, x86_fp80* %6)
store i32 %12, i32* %8
%13 = load %struct.s_token*, %struct.s_token** %5
%14 = call i32 @tokenToLongDouble(%struct.s_token* %13, x86_fp80* %7)
store i32 %14, i32* %9
%15 = load i32, i32* %8
%16 = load i32, i32* %9
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %2
store i32 0, i32* %3
br label %46
19: ; preds = %2
%20 = load i32, i32* %8
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load %struct.s_token*, %struct.s_token** %4
%24 = load %struct.s_token*, %struct.s_token** %5
%25 = call i32 @tokensEqual(%struct.s_token* %23, %struct.s_token* %24)
store i32 %25, i32* %3
br label %46
26: ; preds = %19
%27 = load x86_fp80, x86_fp80* %6
%28 = load x86_fp80, x86_fp80* %7
%29 = fcmp oeq x86_fp80 %27, %28
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 1, i32* %3
br label %46
31: ; preds = %26
%32 = load x86_fp80, x86_fp80* %6
%33 = fmul x86_fp80 %32, 0xK3FEEA7C5AC471B478800
%34 = call x86_fp80 @fabs(x86_fp80 %33)
store x86_fp80 %34, x86_fp80* %10
%35 = load x86_fp80, x86_fp80* %10
%36 = fcmp olt x86_fp80 %35, 0xK3F9BA2425FF75E150000
br i1 %36, label %37, label %38
37: ; preds = %31
store x86_fp80 0xK3F9BA2425FF75E150000, x86_fp80* %10
br label %38
38: ; preds = %37, %31
%39 = load x86_fp80, x86_fp80* %6
%40 = load x86_fp80, x86_fp80* %7
%41 = fsub x86_fp80 %39, %40
%42 = call x86_fp80 @fabs(x86_fp80 %41)
%43 = load x86_fp80, x86_fp80* %10
%44 = fcmp ole x86_fp80 %42, %43
%45 = zext i1 %44 to i32
store i32 %45, i32* %3
br label %46
46: ; preds = %38, %30, %22, %18
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
%struct.s_token = type { i32 }
define i32 @compareRealTokens(%struct.s_token* %0, %struct.s_token* %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = bitcast x86_fp80* %3 to i8*
%6 = bitcast x86_fp80* %4 to i8*
%7 = call i32 @tokenToLongDouble(%struct.s_token* %0, x86_fp80* %3)
%8 = call i32 @tokenToLongDouble(%struct.s_token* %1, x86_fp80* %4)
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %27
10: ; preds = %2
%11 = icmp eq i32 %7, 0
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = call i32 @tokensEqual(%struct.s_token* %0, %struct.s_token* %1)
br label %27
14: ; preds = %10
%15 = load x86_fp80, x86_fp80* %3
%16 = load x86_fp80, x86_fp80* %4
%17 = fcmp oeq x86_fp80 %15, %16
br i1 %17, label %27, label %18
18: ; preds = %14
%19 = fmul x86_fp80 %15, 0xK3FEEA7C5AC471B478800
%20 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %19)
%21 = fcmp olt x86_fp80 %20, 0xK3F9BA2425FF75E150000
%22 = select i1 %21, x86_fp80 0xK3F9BA2425FF75E150000, x86_fp80 %20
%23 = fsub x86_fp80 %15, %16
%24 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %23)
%25 = fcmp ole x86_fp80 %24, %22
%26 = zext i1 %25 to i32
br label %27
27: ; preds = %14, %2, %18, %12
%28 = phi i32 [ %13, %12 ], [ %26, %18 ], [ 0, %2 ], [ 1, %14 ]
ret i32 %28
}