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

/* Variables and functions */
int /*<<< orphan*/ ol_lrc_free(struct OlLrc *);
struct OlLrcItem *ol_lrc_get_item(struct OlLrc *, int);
int ol_lrc_item_count(struct OlLrc *);
int /*<<< orphan*/ ol_lrc_item_get_lyric(struct OlLrcItem const *);
scalar_t__ ol_lrc_item_get_time(struct OlLrcItem const *);
struct OlLrc *ol_lrc_new(char *);
int /*<<< orphan*/ ol_lrc_set_offset(struct OlLrc *, int);
int /*<<< orphan*/ prepare_data();
int /*<<< orphan*/ printf(char *, int, char *);
scalar_t__ strcmp(int /*<<< orphan*/, int /*<<< orphan*/);
void offset_test() {
  prepare_data();
  struct OlLrc *lrc1 = ol_lrc_new("/tmp/"
                                  "lrc_basic.lrc");
  ol_lrc_set_offset(lrc1, -100);
  struct OlLrc *lrc2 = ol_lrc_new("/tmp/"
                                  "lrc_basic.lrc");
  if (!(ol_lrc_item_count(lrc1) == ol_lrc_item_count(lrc2))) {
    printf("ERROR[%d]: EXPECT %s failed\n", 73,
           "ol_lrc_item_count (lrc1) == ol_lrc_item_count (lrc2)");
  };
  int i, cnt;
  cnt = ol_lrc_item_count(lrc1);
  for (i = 0; i < cnt; i++) {
    const struct OlLrcItem *item1 = ol_lrc_get_item(lrc1, i);
    const struct OlLrcItem *item2 = ol_lrc_get_item(lrc2, i);
    if (!(ol_lrc_item_get_time(item1) == ol_lrc_item_get_time(item2))) {
      printf("ERROR[%d]: EXPECT %s failed\n", 81,
             "ol_lrc_item_get_time (item1) == ol_lrc_item_get_time (item2)");
    };
    if (!(strcmp(ol_lrc_item_get_lyric(item1), ol_lrc_item_get_lyric(item2)) ==
          0)) {
      printf("ERROR[%d]: EXPECT %s failed\n", 83,
             "strcmp (ol_lrc_item_get_lyric (item1), ol_lrc_item_get_lyric "
             "(item2)) == 0");
    };
  }
  ol_lrc_free(lrc1);
  ol_lrc_free(lrc2);
}


x86 assembly (clang, -O0):
<offset_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x0,%al
call   1080 <prepare_data@plt>
lea    0xe4a(%rip),%rdi
call   1040 <ol_lrc_new@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xffffff9c,%esi
call   1050 <ol_lrc_set_offset@plt>
lea    0xe2c(%rip),%rdi
call   1040 <ol_lrc_new@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <ol_lrc_item_count@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <ol_lrc_item_count@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
je     1217 <offset_test+0x77>
lea    0xe0d(%rip),%rdi
mov    $0x49,%esi
lea    0xe1e(%rip),%rdx
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1090 <ol_lrc_item_count@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12e8 <offset_test+0x148>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <ol_lrc_get_item@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <ol_lrc_get_item@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   10b0 <ol_lrc_item_get_time@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   10b0 <ol_lrc_item_get_time@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
je     1294 <offset_test+0xf4>
lea    0xd90(%rip),%rdi
mov    $0x51,%esi
lea    0xdd6(%rip),%rdx
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
call   10c0 <ol_lrc_item_get_lyric@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rdi
call   10c0 <ol_lrc_item_get_lyric@plt>
mov    -0x3c(%rbp),%edi
mov    %eax,%esi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12d5 <offset_test+0x135>
lea    0xd4f(%rip),%rdi
mov    $0x53,%esi
lea    0xdd2(%rip),%rdx
call   1030 <printf@plt>
jmp    12da <offset_test+0x13a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    122a <offset_test+0x8a>
mov    -0x8(%rbp),%rdi
call   10a0 <ol_lrc_free@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <ol_lrc_free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<offset_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1080 <prepare_data@plt>
lea    0xe44(%rip),%rbx
mov    %rbx,%rdi
call   1040 <ol_lrc_new@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    $0xffffff9c,%esi
call   1050 <ol_lrc_set_offset@plt>
mov    %rbx,%rdi
call   1040 <ol_lrc_new@plt>
mov    %rax,%rbx
mov    %rbp,0x8(%rsp)
mov    %rbp,%rdi
call   1090 <ol_lrc_item_count@plt>
mov    %eax,%ebp
mov    %rbx,0x10(%rsp)
mov    %rbx,%rdi
call   1090 <ol_lrc_item_count@plt>
cmp    %eax,%ebp
je     1217 <offset_test+0x77>
lea    0xe0d(%rip),%rdi
lea    0xe23(%rip),%rdx
mov    $0x49,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%rdi
call   1090 <ol_lrc_item_count@plt>
test   %eax,%eax
jle    12c7 <offset_test+0x127>
mov    %eax,%r15d
xor    %ebx,%ebx
jmp    123c <offset_test+0x9c>
add    $0x1,%ebx
cmp    %ebx,%r15d
je     12c7 <offset_test+0x127>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
call   1070 <ol_lrc_get_item@plt>
mov    %rax,%r13
mov    0x10(%rsp),%rdi
mov    %ebx,%esi
call   1070 <ol_lrc_get_item@plt>
mov    %rax,%r12
mov    %r13,%rdi
call   10b0 <ol_lrc_item_get_time@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   10b0 <ol_lrc_item_get_time@plt>
cmp    %rax,%r14
je     128a <offset_test+0xea>
lea    0xd9a(%rip),%rdi
mov    $0x51,%esi
lea    0xde0(%rip),%rdx
call   1030 <printf@plt>
mov    %r13,%rdi
call   10c0 <ol_lrc_item_get_lyric@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   10c0 <ol_lrc_item_get_lyric@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1230 <offset_test+0x90>
lea    0xd62(%rip),%rdi
mov    $0x53,%esi
lea    0xde5(%rip),%rdx
call   1030 <printf@plt>
jmp    1230 <offset_test+0x90>
mov    0x8(%rsp),%rdi
call   10a0 <ol_lrc_free@plt>
mov    0x10(%rsp),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <ol_lrc_free@plt>

LLVM IR (-O0):
%struct.OlLrc = type { i32 }
%struct.OlLrcItem = type { i32 }
@.str = [19 x i8] c"/tmp/lrc_basic.lrc\00"
@.str.1 = [29 x i8] c"ERROR[%d]: EXPECT %s failed\0A\00"
@.str.2 = [53 x i8] c"ol_lrc_item_count (lrc1) == ol_lrc_item_count (lrc2)\00"
@.str.3 = [61 x i8] c"ol_lrc_item_get_time (item1) == ol_lrc_item_get_time (item2)\00"
@.str.4 = [75 x i8] c"strcmp (ol_lrc_item_get_lyric (item1), ol_lrc_item_get_lyric (item2)) == 0\00"
define void @offset_test() {
%1 = alloca %struct.OlLrc*
%2 = alloca %struct.OlLrc*
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.OlLrcItem*
%6 = alloca %struct.OlLrcItem*
%7 = call i32 (...) @prepare_data()
%8 = call %struct.OlLrc* @ol_lrc_new(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store %struct.OlLrc* %8, %struct.OlLrc** %1
%9 = load %struct.OlLrc*, %struct.OlLrc** %1
%10 = call i32 @ol_lrc_set_offset(%struct.OlLrc* %9, i32 -100)
%11 = call %struct.OlLrc* @ol_lrc_new(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store %struct.OlLrc* %11, %struct.OlLrc** %2
%12 = load %struct.OlLrc*, %struct.OlLrc** %1
%13 = call i32 @ol_lrc_item_count(%struct.OlLrc* %12)
%14 = load %struct.OlLrc*, %struct.OlLrc** %2
%15 = call i32 @ol_lrc_item_count(%struct.OlLrc* %14)
%16 = icmp eq i32 %13, %15
br i1 %16, label %19, label %17
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 73, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %0
%20 = load %struct.OlLrc*, %struct.OlLrc** %1
%21 = call i32 @ol_lrc_item_count(%struct.OlLrc* %20)
store i32 %21, i32* %4
store i32 0, i32* %3
br label %22
22: ; preds = %50, %19
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %53
26: ; preds = %22
%27 = load %struct.OlLrc*, %struct.OlLrc** %1
%28 = load i32, i32* %3
%29 = call %struct.OlLrcItem* @ol_lrc_get_item(%struct.OlLrc* %27, i32 %28)
store %struct.OlLrcItem* %29, %struct.OlLrcItem** %5
%30 = load %struct.OlLrc*, %struct.OlLrc** %2
%31 = load i32, i32* %3
%32 = call %struct.OlLrcItem* @ol_lrc_get_item(%struct.OlLrc* %30, i32 %31)
store %struct.OlLrcItem* %32, %struct.OlLrcItem** %6
%33 = load %struct.OlLrcItem*, %struct.OlLrcItem** %5
%34 = call i64 @ol_lrc_item_get_time(%struct.OlLrcItem* %33)
%35 = load %struct.OlLrcItem*, %struct.OlLrcItem** %6
%36 = call i64 @ol_lrc_item_get_time(%struct.OlLrcItem* %35)
%37 = icmp eq i64 %34, %36
br i1 %37, label %40, label %38
38: ; preds = %26
%39 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 81, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %38, %26
%41 = load %struct.OlLrcItem*, %struct.OlLrcItem** %5
%42 = call i32 @ol_lrc_item_get_lyric(%struct.OlLrcItem* %41)
%43 = load %struct.OlLrcItem*, %struct.OlLrcItem** %6
%44 = call i32 @ol_lrc_item_get_lyric(%struct.OlLrcItem* %43)
%45 = call i64 @strcmp(i32 %42, i32 %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %40
%48 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 83, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %47, %40
br label %50
50: ; preds = %49
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %22
53: ; preds = %22
%54 = load %struct.OlLrc*, %struct.OlLrc** %1
%55 = call i32 @ol_lrc_free(%struct.OlLrc* %54)
%56 = load %struct.OlLrc*, %struct.OlLrc** %2
%57 = call i32 @ol_lrc_free(%struct.OlLrc* %56)
ret void
}

LLVM IR (-O2):
%struct.OlLrc = type { i32 }
%struct.OlLrcItem = type { i32 }
@.str = [19 x i8] c"/tmp/lrc_basic.lrc\00"
@.str.1 = [29 x i8] c"ERROR[%d]: EXPECT %s failed\0A\00"
@.str.2 = [53 x i8] c"ol_lrc_item_count (lrc1) == ol_lrc_item_count (lrc2)\00"
@.str.3 = [61 x i8] c"ol_lrc_item_get_time (item1) == ol_lrc_item_get_time (item2)\00"
@.str.4 = [75 x i8] c"strcmp (ol_lrc_item_get_lyric (item1), ol_lrc_item_get_lyric (item2)) == 0\00"
define void @offset_test() {
%1 = tail call i32 (...) @prepare_data()
%2 = tail call %struct.OlLrc* @ol_lrc_new(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @ol_lrc_set_offset(%struct.OlLrc* %2, i32 -100)
%4 = tail call %struct.OlLrc* @ol_lrc_new(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @ol_lrc_item_count(%struct.OlLrc* %2)
%6 = tail call i32 @ol_lrc_item_count(%struct.OlLrc* %4)
%7 = icmp eq i32 %5, %6
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 73, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = tail call i32 @ol_lrc_item_count(%struct.OlLrc* %2)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %10, %29
%14 = phi i32 [ %30, %29 ], [ 0, %10 ]
%15 = tail call %struct.OlLrcItem* @ol_lrc_get_item(%struct.OlLrc* %2, i32 %14)
%16 = tail call %struct.OlLrcItem* @ol_lrc_get_item(%struct.OlLrc* %4, i32 %14)
%17 = tail call i64 @ol_lrc_item_get_time(%struct.OlLrcItem* %15)
%18 = tail call i64 @ol_lrc_item_get_time(%struct.OlLrcItem* %16)
%19 = icmp eq i64 %17, %18
br i1 %19, label %22, label %20
20: ; preds = %13
%21 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 81, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %13
%23 = tail call i32 @ol_lrc_item_get_lyric(%struct.OlLrcItem* %15)
%24 = tail call i32 @ol_lrc_item_get_lyric(%struct.OlLrcItem* %16)
%25 = tail call i64 @strcmp(i32 %23, i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %22
%28 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 83, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %27, %22
%30 = add nuw nsw i32 %14, 1
%31 = icmp eq i32 %30, %11
br i1 %31, label %32, label %13
32: ; preds = %29, %10
%33 = tail call i32 @ol_lrc_free(%struct.OlLrc* %2)
%34 = tail call i32 @ol_lrc_free(%struct.OlLrc* %4)
ret void
}