#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 */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *realloc(char *, size_t);
int /*<<< orphan*/ stderr;
void setlyric(const char *file, size_t *startpointer, char **lyric,
              size_t *lyricSaved, size_t *lyricAllocated, size_t *lyricUsed) {
  (*startpointer)++;
  *lyricSaved = *lyricUsed;
  (*lyric)[(*lyricSaved)++] = '\n';
  while (file[*startpointer] != '*') {
    (*lyric)[(*lyricSaved)++] =
        (file[*startpointer] == '|' ? '\0' : file[*startpointer]);
    (*startpointer)++;
    if (*lyricSaved >= *lyricAllocated - 3) {
      void *pv = realloc(*lyric, *lyricAllocated + 32);
      if (pv == NULL) {
        fprintf(stderr, "Run out of memory!");
        exit(1);
      }
      *lyric = (char *)pv;
      (*lyricAllocated) += 32;
    }
  }
  (*lyric)[(*lyricSaved)++] = 0;
}


x86 assembly (clang, -O0):
<setlyric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rax
mov    (%rax),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movb   $0xa,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
je     1280 <setlyric+0x150>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7c,%eax
jne    11c2 <setlyric+0x92>
xor    %eax,%eax
mov    %eax,-0x3c(%rbp)
jmp    11d4 <setlyric+0xa4>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rsi
mov    (%rsi),%rcx
mov    %rcx,%rdi
add    $0x1,%rdi
mov    %rdi,(%rsi)
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
mov    (%rcx),%rcx
sub    $0x3,%rcx
cmp    %rcx,%rax
jb     127b <setlyric+0x14b>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
add    $0x20,%rsi
call   1040 <realloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1262 <setlyric+0x132>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
lea    0xdad(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%rcx
add    $0x20,%rcx
mov    %rcx,(%rax)
jmp    1188 <setlyric+0x58>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movb   $0x0,(%rax,%rcx,1)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setlyric>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
addq   $0x1,(%rsi)
mov    (%r9),%rax
mov    (%rdx),%rcx
lea    0x1(%rax),%rdx
mov    %rdx,(%rbx)
movb   $0xa,(%rcx,%rax,1)
nopl   (%rax)
mov    (%r12),%rax
movzbl 0x0(%r13,%rax,1),%eax
cmp    $0x7c,%al
je     1180 <setlyric+0x50>
cmp    $0x2a,%al
jne    1182 <setlyric+0x52>
jmp    11bd <setlyric+0x8d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
mov    (%r15),%rcx
mov    (%rbx),%rdx
lea    0x1(%rdx),%rsi
mov    %rsi,(%rbx)
mov    %al,(%rcx,%rdx,1)
addq   $0x1,(%r12)
mov    (%r14),%rsi
lea    -0x3(%rsi),%rax
cmp    %rax,(%rbx)
jb     1160 <setlyric+0x30>
mov    (%r15),%rdi
add    $0x20,%rsi
call   1040 <realloc@plt>
test   %rax,%rax
je     11d8 <setlyric+0xa8>
mov    %rax,(%r15)
addq   $0x20,(%r14)
jmp    1160 <setlyric+0x30>
mov    (%r15),%rax
mov    (%rbx),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rbx)
movb   $0x0,(%rax,%rcx,1)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
lea    0xe18(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Run out of memory!\00"
define void @setlyric(i8* %0, i64* %1, i8** %2, i64* %3, i64* %4, i64* %5) {
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i8**
%10 = alloca i64*
%11 = alloca i64*
%12 = alloca i64*
%13 = alloca i8*
store i8* %0, i8** %7
store i64* %1, i64** %8
store i8** %2, i8*** %9
store i64* %3, i64** %10
store i64* %4, i64** %11
store i64* %5, i64** %12
%14 = load i64*, i64** %8
%15 = load i64, i64* %14
%16 = add i64 %15, 1
store i64 %16, i64* %14
%17 = load i64*, i64** %12
%18 = load i64, i64* %17
%19 = load i64*, i64** %10
store i64 %18, i64* %19
%20 = load i8**, i8*** %9
%21 = load i8*, i8** %20
%22 = load i64*, i64** %10
%23 = load i64, i64* %22
%24 = add i64 %23, 1
store i64 %24, i64* %22
%25 = getelementptr inbounds i8, i8* %21, i64 %23
store i8 10, i8* %25
br label %26
26: ; preds = %87, %6
%27 = load i8*, i8** %7
%28 = load i64*, i64** %8
%29 = load i64, i64* %28
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 42
br i1 %33, label %34, label %88
34: ; preds = %26
%35 = load i8*, i8** %7
%36 = load i64*, i64** %8
%37 = load i64, i64* %36
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 124
br i1 %41, label %42, label %43
42: ; preds = %34
br label %50
43: ; preds = %34
%44 = load i8*, i8** %7
%45 = load i64*, i64** %8
%46 = load i64, i64* %45
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
br label %50
50: ; preds = %43, %42
%51 = phi i32 [ 0, %42 ], [ %49, %43 ]
%52 = trunc i32 %51 to i8
%53 = load i8**, i8*** %9
%54 = load i8*, i8** %53
%55 = load i64*, i64** %10
%56 = load i64, i64* %55
%57 = add i64 %56, 1
store i64 %57, i64* %55
%58 = getelementptr inbounds i8, i8* %54, i64 %56
store i8 %52, i8* %58
%59 = load i64*, i64** %8
%60 = load i64, i64* %59
%61 = add i64 %60, 1
store i64 %61, i64* %59
%62 = load i64*, i64** %10
%63 = load i64, i64* %62
%64 = load i64*, i64** %11
%65 = load i64, i64* %64
%66 = sub i64 %65, 3
%67 = icmp uge i64 %63, %66
br i1 %67, label %68, label %87
68: ; preds = %50
%69 = load i8**, i8*** %9
%70 = load i8*, i8** %69
%71 = load i64*, i64** %11
%72 = load i64, i64* %71
%73 = add i64 %72, 32
%74 = call i8* @realloc(i8* %70, i64 %73)
store i8* %74, i8** %13
%75 = load i8*, i8** %13
%76 = icmp eq i8* %75, null
br i1 %76, label %77, label %81
77: ; preds = %68
%78 = load i32, i32* @stderr
%79 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %68
%82 = load i8*, i8** %13
%83 = load i8**, i8*** %9
store i8* %82, i8** %83
%84 = load i64*, i64** %11
%85 = load i64, i64* %84
%86 = add i64 %85, 32
store i64 %86, i64* %84
br label %87
87: ; preds = %81, %50
br label %26
88: ; preds = %26
%89 = load i8**, i8*** %9
%90 = load i8*, i8** %89
%91 = load i64*, i64** %10
%92 = load i64, i64* %91
%93 = add i64 %92, 1
store i64 %93, i64* %91
%94 = getelementptr inbounds i8, i8* %90, i64 %92
store i8 0, i8* %94
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Run out of memory!\00"
define void @setlyric(i8* nocapture %0, i64* nocapture %1, i8** nocapture %2, i64* nocapture %3, i64* nocapture %4, i64* nocapture %5) {
%7 = load i64, i64* %1
%8 = add i64 %7, 1
store i64 %8, i64* %1
%9 = load i64, i64* %5
%10 = load i8*, i8** %2
%11 = add i64 %9, 1
store i64 %11, i64* %3
%12 = getelementptr inbounds i8, i8* %10, i64 %9
store i8 10, i8* %12
br label %13
13: ; preds = %42, %6
%14 = load i64, i64* %1
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
switch i8 %16, label %17 [
i8 42, label %43
i8 124, label %18
]
17: ; preds = %13
br label %18
18: ; preds = %13, %17
%19 = phi i8 [ %16, %17 ], [ 0, %13 ]
%20 = load i8*, i8** %2
%21 = load i64, i64* %3
%22 = add i64 %21, 1
store i64 %22, i64* %3
%23 = getelementptr inbounds i8, i8* %20, i64 %21
store i8 %19, i8* %23
%24 = load i64, i64* %1
%25 = add i64 %24, 1
store i64 %25, i64* %1
%26 = load i64, i64* %3
%27 = load i64, i64* %4
%28 = add i64 %27, -3
%29 = icmp ult i64 %26, %28
br i1 %29, label %42, label %30
30: ; preds = %18
%31 = load i8*, i8** %2
%32 = add i64 %27, 32
%33 = tail call i8* @realloc(i8* %31, i64 %32)
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %39
35: ; preds = %30
%36 = load i32, i32* @stderr
%37 = tail call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %30
store i8* %33, i8** %2
%40 = load i64, i64* %4
%41 = add i64 %40, 32
store i64 %41, i64* %4
br label %42
42: ; preds = %39, %18
br label %13
43: ; preds = %13
%44 = load i8*, i8** %2
%45 = load i64, i64* %3
%46 = add i64 %45, 1
store i64 %46, i64* %3
%47 = getelementptr inbounds i8, i8* %44, i64 %45
store i8 0, i8* %47
ret void
}