// File: /workspace/github_c_makefile_star2_O2/pipde[P]deos-songlib/utils/phrases/phrases.c
// Function: main
int
main(int argc,char **argv)
    {
    int i;
    int argIndex = 1;
    int phrase;
    FILE *out;
    char buffer[512];

    argIndex = processOptions(argc,argv);

    if (argc-argIndex < 1)
        Fatal("usage: %s BASENAME_1 BASENAME_2 ...\n",argv[0]);

    out = OpenFile("vocals-temp.c","w");

    banksize = argc - argIndex;
    if (banksize > BANK_CAPACITY)
        Fatal("a maximum of %d takes are allowed\n",BANK_CAPACITY);

    for (i = 0; i < banksize; ++i)
         {
         banks[i] = argv[i+argIndex];
         indices[i] = 0;
         }

    prelude(out,banks[0]);

    phrase = 0;
    while (1)
        {
        printf("Phrase %d choices:\n",phrase);
        for (i = 0; i < banksize; ++i)
            {
            if (!Silent)
                {
                printf("%d: playing %s%d.rra\n",i+1,banks[i],indices[i]);
                sprintf(buffer,"rplay %s%d.%s",banks[i],indices[i],Mode);
                system(buffer);
                }
            else
                printf("%d: %s%d.rra\n",i+1,banks[i],indices[i]);
            }
        char *command;
        printf("> ");
        command = readToken(stdin);
        if (*command == 'r' && command[1] == '\0')
            {
            printf("repeating...\n");
            }
        else if (*command == 'b' && command[1] == '\0')
            {
            if (phrase == 0)
                printf("already at the first phrase...\n");
            else
                {
                printf("backing up one phrase...\n");
                for (i = 0; i < banksize; ++i)
                    if (indices[i] > 0)
                        indices[i] -= 1;
                --phrase;
                }
            }
        else if (*command == 'f' && command[1] == '\0')
            {
            printf("skipping this phrase...\n");
            for (i = 0; i < banksize; ++i)
                if (indices[i] > 0)
                    indices[i] += 1;
            ++phrase;
            }
        else if (*command == '<' || command[1] == '<')
            {
            int i = *command == '<'? atoi(command+1) : atoi(command);
            if (i > 0 && i <= banksize && indices[i-1] > 0)
                {
                printf("shifting version %d back one phrase...\n",i);
                indices[i-1] -= 1;
                }
            else
                printf("command %s ignored...\n",command);
            }
        else if (*command == '>' || command[1] == '>')
            {
            int i = *command == '>'? atoi(command+1) : atoi(command);
            if (i > 0 && i <= banksize)
                {
                printf("shifting version %d forward one phrase...\n",i);
                indices[i-1] += 1;
                }
            else
                printf("command %s ignored...\n",command);
            }
        else if (isdigit(*command) && command[1] == '\0')
            {
            int take = atoi(command);
            if (take > 0 && take <= banksize)
                {
                printf("selecting version %d\n",take);
                /* clear the newline */
                readLine(stdin);
                if (Comments)
                    {
                    printf("enter a comment: ");
                    comments[phrase] = readLine(stdin);
                    }
                else
                    comments[phrase] = "a phrase";
                takes[phrase] = take;
                notes[phrase] = indices[take-1];
                }
            for (i = 0; i < banksize; ++i)
                indices[i] += 1;
            ++phrase;
            }
        else if (*command == 'q')
            break;
        else
            {
            printf("command %s not understood\n",command);
            printf("commands are:\n");
            printf("   q    quit\n");
            printf("   r    repeat the last phrase\n");
            printf("   b    go back to the previous phrase\n");
            printf("   f    skip forward to the next phrase\n");
            printf("   >N   shift version N forward one phrase\n");
            printf("   <N   shift version N backward one phrase\n");
            printf("   1    choose the first version\n");
            printf("   2    choose the second version\n");
            printf("   ...\n");
            }
        }

    readTimings(banks[0]);
    middle(out);
    coda(out);

    fclose(out);

    return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rsi, %r14
movl %edi, %ebx
pushq $0x1
popq %r12
movslq %r12d, %r15
cmpl %r12d, %ebx
jle 0x137b
movq (%r14,%r15,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x137b
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x1301
leaq 0x2(%rsi), %rdi
jmp 0x1306
movq 0x8(%r14,%r15,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x63, %eax
je 0x134a
cmpl $0x73, %eax
je 0x133e
cmpl $0x74, %eax
je 0x1356
cmpl $0x68, %eax
je 0x1c11
cmpl $0x76, %eax
je 0x1c73
xorl %r15d, %r15d
leaq 0x20bf(%rip), %rdi      # 0x33f4
xorl %eax, %eax
callq 0x22bc
jmp 0x1364
movl $0x1, 0x4ddc(%rip)      # 0x6124
jmp 0x1351
andl $0x0, 0x4daf(%rip)      # 0x6100
xorl %r15d, %r15d
jmp 0x1364
callq 0x1170
movl %eax, 0x4da3(%rip)      # 0x6104
movb $0x1, %r15b
testb %r13b, %r13b
sete %al
andb %r15b, %al
movzbl %al, %eax
addl %eax, %r12d
incl %r12d
jmp 0x12d9
subl %r12d, %ebx
jg 0x1391
movq (%r14), %rsi
leaq 0x1c87(%rip), %rdi      # 0x3011
xorl %eax, %eax
callq 0x22bc
leaq 0x1c9e(%rip), %rdi      # 0x3036
leaq 0x1ca5(%rip), %rsi      # 0x3044
callq 0x23ec
movq %rax, %r12
movl %ebx, 0x4d73(%rip)      # 0x6120
cmpl $0x6, %ebx
jl 0x13c9
leaq 0x1c8d(%rip), %rdi      # 0x3046
pushq $0x5
popq %rsi
xorl %eax, %eax
callq 0x22bc
movl 0x4d57(%rip), %ebx      # 0x6120
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
leaq (%r14,%r15,8), %rcx
shlq $0x3, %rbx
leaq 0x4d81(%rip), %rdx      # 0x6160
leaq 0x4d4a(%rip), %r15      # 0x6130
cmpq %rax, %rbx
je 0x1400
movq (%rcx,%rax), %rsi
andl $0x0, (%rdx)
movq %rsi, (%rax,%r15)
addq $0x8, %rax
addq $0x4, %rdx
jmp 0x13e6
leaq 0x1d95(%rip), %rdi      # 0x319c
pushq $0x13
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1d91(%rip), %rdi      # 0x31b0
pushq $0x14
popq %r14
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1d8d(%rip), %rdi      # 0x31c5
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1d8d(%rip), %rdi      # 0x31da
pushq $0x2d
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1da6(%rip), %rdi      # 0x3208
pushq $0x30
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
pushq $0xa
popq %r14
movl %r14d, %edi
movq %r12, %rsi
callq 0x10c0
leaq 0x1db3(%rip), %rdi      # 0x3239
pushq $0x3c
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1ddb(%rip), %rdi      # 0x3276
pushq $0x1f
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1de6(%rip), %rdi      # 0x3296
pushq $0x20
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
movl %r14d, %edi
movq %r12, %rsi
callq 0x10c0
leaq 0x1de7(%rip), %rdi      # 0x32b7
pushq $0x1b
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
movl %r14d, %edi
movq %r12, %rsi
callq 0x10c0
leaq 0x1de3(%rip), %rdi      # 0x32d3
pushq $0x4
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1dd3(%rip), %rdi      # 0x32d8
pushq $0x7
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1dc6(%rip), %rdi      # 0x32e0
pushq $0x6
popq %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x11a0
leaq 0x1db8(%rip), %rbx      # 0x32e7
xorl %r14d, %r14d
movslq 0x4be7(%rip), %rax      # 0x6120
cmpq %rax, %r14
jge 0x155a
incq %r14
movq (%r15), %rcx
movq %r12, %rdi
movq %rbx, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x10e0
addq $0x8, %r15
jmp 0x1532
pushq $0xa
popq %rbx
movl %ebx, %edi
movq %r12, %rsi
callq 0x10c0
leaq 0x1daa(%rip), %rdi      # 0x3318
pushq $0x10
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
movq %r12, %rcx
callq 0x11a0
movl %ebx, %edi
movq %r12, %rsi
callq 0x10c0
leaq 0x1d98(%rip), %rdi      # 0x3329
pushq $0x17
popq %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x11a0
movl %ebx, %edi
movq %r12, %rsi
callq 0x10c0
leaq 0x1d91(%rip), %rdi      # 0x3341
pushq $0x22
popq %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x11a0
movl %ebx, %edi
movq %r12, -0x38(%rbp)
movq %r12, %rsi
callq 0x10c0
leaq 0x4b8d(%rip), %r13      # 0x6160
leaq -0x240(%rbp), %rbx
leaq 0x1ac4(%rip), %r14      # 0x30a5
movl $0x0, -0x2c(%rbp)
leaq 0x1a7a(%rip), %rdi      # 0x3069
movl -0x2c(%rbp), %esi
xorl %eax, %eax
callq 0x1090
leaq 0x4b30(%rip), %r12      # 0x6130
xorl %r15d, %r15d
movslq 0x4b16(%rip), %rax      # 0x6120
cmpq %rax, %r15
jge 0x1675
incq %r15
cmpl $0x0, 0x4b0b(%rip)      # 0x6124
movq (%r12), %rdx
movl (%r13), %ecx
je 0x1632
movq %r14, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x1090
jmp 0x166b
leaq 0x1a44(%rip), %rdi      # 0x307d
movl %r15d, %esi
xorl %eax, %eax
callq 0x1090
movq (%r12), %rdx
movl (%r13), %ecx
movq %rbx, %rdi
leaq 0x1a3e(%rip), %rsi      # 0x3093
leaq 0x1a45(%rip), %r8       # 0x30a1
xorl %eax, %eax
callq 0x1180
movq %rbx, %rdi
callq 0x1080
addq $0x4, %r13
addq $0x8, %r12
jmp 0x1603
leaq 0x1a37(%rip), %rdi      # 0x30b3
xorl %eax, %eax
callq 0x1090
movq 0x494e(%rip), %rax      # 0x5fd8
movq (%rax), %rdi
callq 0x20d3
movq %rax, %r15
movzbl (%rax), %r12d
leaq 0x1(%rax), %rdi
cmpl $0x3c, %r12d
je 0x179b
cmpl $0x62, %r12d
je 0x16e5
cmpl $0x66, %r12d
je 0x1741
cmpl $0x72, %r12d
jne 0x178f
movb (%rdi), %r13b
testb %r13b, %r13b
jne 0x1792
leaq 0x1eb4(%rip), %rdi      # 0x3588
callq 0x1050
leaq 0x4a80(%rip), %r13      # 0x6160
jmp 0x15e8
movb (%rdi), %r13b
testb %r13b, %r13b
jne 0x1792
cmpl $0x0, -0x2c(%rbp)
je 0x1a01
leaq 0x1e4e(%rip), %rdi      # 0x3550
callq 0x1050
movl 0x4a13(%rip), %eax      # 0x6120
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
shlq $0x2, %rax
xorl %ecx, %ecx
leaq 0x4a3c(%rip), %r13      # 0x6160
cmpq %rcx, %rax
je 0x19f9
movl (%rcx,%r13), %edx
testl %edx, %edx
jle 0x173b
decl %edx
movl %edx, (%rcx,%r13)
addq $0x4, %rcx
jmp 0x1724
movb (%rdi), %r13b
testb %r13b, %r13b
jne 0x1792
leaq 0x1de8(%rip), %rdi      # 0x3538
callq 0x1050
movl 0x49c5(%rip), %eax      # 0x6120
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
shlq $0x2, %rax
xorl %ecx, %ecx
leaq 0x49ee(%rip), %r13      # 0x6160
cmpq %rcx, %rax
je 0x1935
movl (%rcx,%r13), %edx
testl %edx, %edx
jle 0x1789
incl %edx
movl %edx, (%rcx,%r13)
addq $0x4, %rcx
jmp 0x1772
movb (%rdi), %r13b
movq %r15, %rdi
cmpb $0x3c, %r13b
jne 0x17ef
callq 0x1170
testl %eax, %eax
leaq 0x49b7(%rip), %r13      # 0x6160
jle 0x17d9
cmpl 0x496f(%rip), %eax      # 0x6120
jg 0x17d9
leal -0x1(%rax), %r12d
cmpl $0x0, (%r13,%r12,4)
jle 0x17d9
leaq 0x18f0(%rip), %rdi      # 0x30b6
movl %eax, %esi
xorl %eax, %eax
callq 0x1090
decl (%r13,%r12,4)
jmp 0x15e8
leaq 0x18fe(%rip), %rdi      # 0x30de
movq %r15, %rsi
xorl %eax, %eax
callq 0x1090
jmp 0x15e8
cmpb $0x3e, %r12b
setne %al
cmpb $0x3e, %r13b
setne %cl
testb %cl, %al
jne 0x1851
xorl %eax, %eax
cmpb $0x3e, %r12b
sete %al
movq %r15, %rdi
addq %rax, %rdi
callq 0x1170
testl %eax, %eax
jle 0x193d
movl %eax, %r12d
cmpl 0x48fa(%rip), %eax      # 0x6120
jg 0x193d
leaq 0x18c2(%rip), %rdi      # 0x30f5
movl %r12d, %esi
xorl %eax, %eax
callq 0x1090
decl %r12d
leaq 0x4919(%rip), %r13      # 0x6160
incl (%r13,%r12,4)
jmp 0x15e8
callq 0x11b0
testb %r13b, %r13b
jne 0x195a
movsbq %r12b, %rcx
movq (%rax), %rax
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
je 0x195a
movq %r15, %rdi
callq 0x1170
movl %eax, %r15d
testl %eax, %eax
setle %cl
movl 0x4895(%rip), %eax      # 0x6120
cmpl %eax, %r15d
setg %dl
orb %cl, %dl
leaq 0x48c6(%rip), %r13      # 0x6160
jne 0x1916
leaq 0x187d(%rip), %rdi      # 0x3120
movl %r15d, %esi
xorl %eax, %eax
callq 0x1090
movq 0x4724(%rip), %r12      # 0x5fd8
movq (%r12), %rdi
callq 0x21aa
cmpl $0x0, 0x483c(%rip)      # 0x6100
leaq 0x187d(%rip), %rax      # 0x3148
je 0x18e4
leaq 0x1862(%rip), %rdi      # 0x3136
xorl %eax, %eax
callq 0x1090
movq (%r12), %rdi
callq 0x21aa
movslq -0x2c(%rbp), %rcx
leaq 0x5071(%rip), %rdx      # 0x6960
movq %rax, (%rdx,%rcx,8)
leaq 0x6066(%rip), %rax      # 0x7960
movl %r15d, (%rax,%rcx,4)
decl %r15d
movl (%r13,%r15,4), %eax
leaq 0x6853(%rip), %rdx      # 0x8160
movl %eax, (%rdx,%rcx,4)
movl 0x480a(%rip), %eax      # 0x6120
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
shlq $0x2, %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x1935
incl (%rcx,%r13)
addq $0x4, %rcx
jmp 0x1926
incl -0x2c(%rbp)
jmp 0x15e8
leaq 0x179a(%rip), %rdi      # 0x30de
movq %r15, %rsi
xorl %eax, %eax
callq 0x1090
leaq 0x480b(%rip), %r13      # 0x6160
jmp 0x15e8
cmpb $0x71, %r12b
leaq 0x47fb(%rip), %r13      # 0x6160
je 0x1a20
leaq 0x17df(%rip), %rdi      # 0x3151
movq %r15, %rsi
xorl %eax, %eax
callq 0x1090
leaq 0x1a8b(%rip), %rdi      # 0x340e
callq 0x1050
leaq 0x1a8d(%rip), %rdi      # 0x341c
callq 0x1050
leaq 0x1a8e(%rip), %rdi      # 0x3429
callq 0x1050
leaq 0x1aa1(%rip), %rdi      # 0x3448
callq 0x1050
leaq 0x1abc(%rip), %rdi      # 0x346f
callq 0x1050
leaq 0x1ad8(%rip), %rdi      # 0x3497
callq 0x1050
leaq 0x1af7(%rip), %rdi      # 0x34c2
callq 0x1050
leaq 0x1b17(%rip), %rdi      # 0x34ee
callq 0x1050
leaq 0x1b2c(%rip), %rdi      # 0x350f
callq 0x1050
leaq 0x1b42(%rip), %rdi      # 0x3531
callq 0x1050
jmp 0x15e8
decl -0x2c(%rbp)
jmp 0x15e8
leaq 0x1b61(%rip), %rdi      # 0x3569
callq 0x1050
movl $0x0, -0x2c(%rbp)
leaq 0x4745(%rip), %r13      # 0x6160
jmp 0x15e8
movq 0x4709(%rip), %rcx      # 0x6130
leaq 0x173e(%rip), %rdx      # 0x316c
leaq -0x440(%rbp), %rbx
movl $0x200, %esi            # imm = 0x200
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a0
leaq 0x172b(%rip), %rdi      # 0x3176
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1090
andl $0x0, 0x6f04(%rip)      # 0x8960
leaq 0x1c29(%rip), %rsi      # 0x368c
movq %rbx, %rdi
callq 0x1150
testq %rax, %rax
je 0x1acb
movq %rax, %rbx
leaq 0x1c73(%rip), %r14      # 0x36ed
leaq -0x40(%rbp), %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1040
leaq 0x6edb(%rip), %r12      # 0x8970
movq %rbx, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x1acb
movsd -0x40(%rbp), %xmm0
movslq 0x6eb3(%rip), %rax      # 0x8960
movsd %xmm0, (%r12,%rax,8)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1040
incl 0x6e97(%rip)            # 0x8960
jmp 0x1a95
pushq $0xa
popq %r12
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpq $0x200, %r15            # imm = 0x200
je 0x1ba4
leaq 0x4e75(%rip), %rax      # 0x6960
movq (%r14,%rax), %r13
testq %r13, %r13
je 0x1b94
movq %r13, %rdi
callq 0x1070
cmpq $0x2, %rax
jb 0x1b1b
movq -0x38(%rbp), %rdi
leaq 0x1853(%rip), %rsi      # 0x3364
movq %r13, %rdx
xorl %eax, %eax
callq 0x10e0
movslq 0x6e3e(%rip), %rax      # 0x8960
cmpq %rax, %r15
jge 0x1b4b
leaq 0x6e42(%rip), %rax      # 0x8970
movsd (%r14,%rax), %xmm0
movq -0x38(%rbp), %r13
movq %r13, %rdi
leaq 0x182c(%rip), %rsi      # 0x336e
movb $0x1, %al
callq 0x10e0
jmp 0x1b64
leaq 0x183c(%rip), %rdi      # 0x338e
pushq $0x13
popq %rsi
pushq $0x1
popq %rdx
movq -0x38(%rbp), %r13
movq %r13, %rcx
callq 0x11a0
leaq 0x5df5(%rip), %rax      # 0x7960
movl (%rbx,%rax), %edx
leaq 0x65eb(%rip), %rax      # 0x8160
movl (%rbx,%rax), %ecx
movq %r13, %rdi
leaq 0x1820(%rip), %rsi      # 0x33a2
xorl %eax, %eax
callq 0x10e0
movl %r12d, %edi
movq %r13, %rsi
callq 0x10c0
incq %r15
addq $0x8, %r14
addq $0x4, %rbx
jmp 0x1ad7
leaq 0x1810(%rip), %rdi      # 0x33bb
pushq $0x13
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq -0x38(%rbp), %r14
movq %r14, %rcx
callq 0x11a0
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x10c0
leaq 0x17fd(%rip), %rdi      # 0x33cf
pushq $0xe
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x11a0
leaq 0x17f7(%rip), %rdi      # 0x33de
pushq $0x6
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x11a0
movq %r14, %rdi
callq 0x1060
xorl %eax, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x197d(%rip), %rdi      # 0x3595
callq 0x1050
leaq 0x1980(%rip), %rdi      # 0x35a4
callq 0x1050
leaq 0x19a0(%rip), %rdi      # 0x35d0
callq 0x1050
leaq 0x19a5(%rip), %rdi      # 0x35e1
callq 0x1050
leaq 0x19bf(%rip), %rdi      # 0x3607
callq 0x1050
leaq 0x19f0(%rip), %rdi      # 0x3644
callq 0x1050
leaq 0x1a0a(%rip), %rdi      # 0x366a
callq 0x1050
leaq 0x1a22(%rip), %rdi      # 0x368e
callq 0x1050
jmp 0x1c8f
movq 0x4476(%rip), %rsi      # 0x60f0
movq 0x4477(%rip), %rdx      # 0x60f8
leaq 0x175d(%rip), %rdi      # 0x33e5
xorl %eax, %eax
callq 0x1090
xorl %edi, %edi
callq 0x1190
nop