#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 OlLrc {
  int dummy;
};

/* Variables and functions */
int fabsl(double);
int /*<<< orphan*/ ol_lrc_free(struct OlLrc *);
int /*<<< orphan*/ ol_lrc_get_lyric_by_time(struct OlLrc *, int, int, char **,
                                            double *, int *);
struct OlLrc *ol_lrc_new(char const *);
int /*<<< orphan*/ printf(char *, int, char *);
void tail_test() {
  const char *DATAFILE = "lrc_tail.lrc";
  struct OlLrc *lrc = ol_lrc_new(DATAFILE);
  double per = 0;
  char *lyric = NULL;
  ol_lrc_get_lyric_by_time(lrc, 40000, 60000, &lyric, &per, (int *)NULL);
  if (!(fabsl(per - 0.33333333) < 1e-6)) {
    printf("ERROR[%d]: EXPECT %s failed\n", 109,
           "fabsl (per - 0.33333333) < 1e-6");
  };
  ol_lrc_free(lrc);
}


x86 assembly (clang, -O0):
<tail_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <ol_lrc_new@plt>
mov    %rax,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x9c40,%esi
mov    $0xea60,%edx
lea    -0x20(%rbp),%rcx
lea    -0x18(%rbp),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1060 <ol_lrc_get_lyric_by_time@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe5b(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <fabsl@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe3e(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     11e4 <tail_test+0x94>
lea    0xe4a(%rip),%rdi
mov    $0x6d,%esi
lea    0xe5b(%rip),%rdx
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <ol_lrc_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tail_test>:
push   %rbx
sub    $0x10,%rsp
lea    0xeac(%rip),%rdi
call   1050 <ol_lrc_new@plt>
mov    %rax,%rbx
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
mov    %rax,%rdi
mov    $0x9c40,%esi
mov    $0xea60,%edx
xor    %r9d,%r9d
call   1060 <ol_lrc_get_lyric_by_time@plt>
movsd  (%rsp),%xmm0
addsd  0xe61(%rip),%xmm0
call   1030 <fabsl@plt>
test   %eax,%eax
jle    11c0 <tail_test+0x70>
lea    0xe66(%rip),%rdi
lea    0xe7c(%rip),%rdx
mov    $0x6d,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1070 <ol_lrc_free@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.OlLrc = type { i32 }
@.str = [13 x i8] c"lrc_tail.lrc\00"
@.str.1 = [29 x i8] c"ERROR[%d]: EXPECT %s failed\0A\00"
@.str.2 = [32 x i8] c"fabsl (per - 0.33333333) < 1e-6\00"
define void @tail_test() {
%1 = alloca i8*
%2 = alloca %struct.OlLrc*
%3 = alloca double
%4 = alloca i8*
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %1
%5 = load i8*, i8** %1
%6 = call %struct.OlLrc* @ol_lrc_new(i8* %5)
store %struct.OlLrc* %6, %struct.OlLrc** %2
store double 0.000000e+00, double* %3
store i8* null, i8** %4
%7 = load %struct.OlLrc*, %struct.OlLrc** %2
%8 = call i32 @ol_lrc_get_lyric_by_time(%struct.OlLrc* %7, i32 40000, i32 60000, i8** %4, double* %3, i32* null)
%9 = load double, double* %3
%10 = fsub double %9, 0x3FD5555551C112DA
%11 = call i32 @fabsl(double %10)
%12 = sitofp i32 %11 to double
%13 = fcmp olt double %12, 0x3EB0C6F7A0B5ED8D
br i1 %13, label %16, label %14
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 109, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %0
%17 = load %struct.OlLrc*, %struct.OlLrc** %2
%18 = call i32 @ol_lrc_free(%struct.OlLrc* %17)
ret void
}

LLVM IR (-O2):
%struct.OlLrc = type { i32 }
@.str = [13 x i8] c"lrc_tail.lrc\00"
@.str.1 = [29 x i8] c"ERROR[%d]: EXPECT %s failed\0A\00"
@.str.2 = [32 x i8] c"fabsl (per - 0.33333333) < 1e-6\00"
define void @tail_test() {
%1 = alloca double
%2 = alloca i8*
%3 = tail call %struct.OlLrc* @ol_lrc_new(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%5 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%6 = call i32 @ol_lrc_get_lyric_by_time(%struct.OlLrc* %3, i32 40000, i32 60000, i8** %2, double* %1, i32* null)
%7 = load double, double* %1
%8 = fadd double %7, 0xBFD5555551C112DA
%9 = call i32 @fabsl(double %8)
%10 = icmp slt i32 %9, 1
br i1 %10, label %13, label %11
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 109, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %0
%14 = call i32 @ol_lrc_free(%struct.OlLrc* %3)
ret void
}