// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movl %edi, %r14d
movl $0x1, %r12d
cmpl $0x2, %edi
jl 0x16c1
movl $0x1, %r12d
movslq %r12d, %rax
movq (%rbx,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x16c1
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x163a
leaq 0x2(%rsi), %rdi
jmp 0x163f
movq 0x8(%rbx,%rax,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x72, %eax
jle 0x1662
cmpl $0x73, %eax
je 0x1673
cmpl $0x74, %eax
jne 0x168c
callq 0x1170
movl %eax, 0x4aa7(%rip)      # 0x6104
movb $0x1, %r15b
jmp 0x16a6
cmpl $0x63, %eax
jne 0x1682
movl $0x0, 0x4a8f(%rip)      # 0x6100
jmp 0x167d
movl $0x1, 0x4aa7(%rip)      # 0x6124
xorl %r15d, %r15d
jmp 0x16a6
cmpl $0x68, %eax
jne 0x1695
jmp 0x1fbd
cmpl $0x76, %eax
je 0x1f9f
xorl %r15d, %r15d
leaq 0x1d55(%rip), %rdi      # 0x33f4
xorl %eax, %eax
callq 0x2468
testb %r13b, %r13b
sete %al
andb %r15b, %al
movzbl %al, %eax
addl %eax, %r12d
incl %r12d
cmpl %r14d, %r12d
jl 0x161b
subl %r12d, %r14d
jg 0x16d7
movq (%rbx), %rsi
leaq 0x1941(%rip), %rdi      # 0x3011
xorl %eax, %eax
callq 0x2468
leaq 0x1958(%rip), %rdi      # 0x3036
leaq 0x195f(%rip), %rsi      # 0x3044
callq 0x2502
movq %rax, %r13
movl %r14d, 0x4a2c(%rip)     # 0x6120
cmpl $0x6, %r14d
jl 0x170d
leaq 0x1945(%rip), %rdi      # 0x3046
movl $0x5, %esi
xorl %eax, %eax
callq 0x2468
movslq 0x4a0c(%rip), %rax      # 0x6120
testq %rax, %rax
jle 0x174f
movslq %r12d, %rcx
leaq (%rbx,%rcx,8), %rcx
shlq $0x3, %rax
leaq 0x4a35(%rip), %rdx      # 0x6160
xorl %esi, %esi
leaq 0x49fc(%rip), %rdi      # 0x6130
movq (%rcx,%rsi), %r8
movq %r8, (%rsi,%rdi)
movl $0x0, (%rdx)
addq $0x8, %rsi
addq $0x4, %rdx
cmpq %rsi, %rax
jne 0x1734
leaq 0x1a46(%rip), %rdi      # 0x319c
movl $0x13, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
leaq 0x1a41(%rip), %rdi      # 0x31b0
movl $0x14, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
leaq 0x1a3d(%rip), %rdi      # 0x31c5
movl $0x14, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
leaq 0x1a39(%rip), %rdi      # 0x31da
movl $0x2d, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
leaq 0x1a4e(%rip), %rdi      # 0x3208
movl $0x30, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
movl $0xa, %edi
movq %r13, %rsi
callq 0x10c0
leaq 0x1a59(%rip), %rdi      # 0x3239
movl $0x3c, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
leaq 0x1a7d(%rip), %rdi      # 0x3276
movl $0x1f, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
leaq 0x1a84(%rip), %rdi      # 0x3296
movl $0x20, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
movl $0xa, %edi
movq %r13, %rsi
callq 0x10c0
leaq 0x1a7f(%rip), %rdi      # 0x32b7
movl $0x1b, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
movl $0xa, %edi
movq %r13, %rsi
callq 0x10c0
leaq 0x1a75(%rip), %rdi      # 0x32d3
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
leaq 0x1a61(%rip), %rdi      # 0x32d8
movl $0x7, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
leaq 0x1a50(%rip), %rdi      # 0x32e0
movl $0x6, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
cmpl $0x0, 0x4877(%rip)      # 0x6120
jle 0x18e2
leaq 0x487e(%rip), %r15      # 0x6130
leaq 0x1a2e(%rip), %rbx      # 0x32e7
xorl %r14d, %r14d
incq %r14
movq (%r15), %rcx
movq %r13, %rdi
movq %rbx, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x10e0
movslq 0x4847(%rip), %rax      # 0x6120
addq $0x8, %r15
cmpq %rax, %r14
jl 0x18bc
leaq 0x4877(%rip), %rbx      # 0x6160
movl $0xa, %edi
movq %r13, %rsi
callq 0x10c0
leaq 0x1a1b(%rip), %rdi      # 0x3318
movl $0x10, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
movl $0xa, %edi
movq %r13, %rsi
callq 0x10c0
leaq 0x1a06(%rip), %rdi      # 0x3329
movl $0x17, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
movl $0xa, %edi
movq %r13, %rsi
callq 0x10c0
leaq 0x19f8(%rip), %rdi      # 0x3341
movl $0x22, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x11a0
movl $0xa, %edi
movq %r13, %rsi
callq 0x10c0
leaq -0x240(%rbp), %r14
movl $0x0, -0x2c(%rbp)
movq %r13, -0x38(%rbp)
leaq 0x16e8(%rip), %rdi      # 0x3069
movl -0x2c(%rbp), %esi
xorl %eax, %eax
callq 0x1090
cmpl $0x0, 0x478e(%rip)      # 0x6120
jle 0x1a19
leaq 0x4791(%rip), %r12      # 0x6130
movq %rbx, %r13
xorl %r15d, %r15d
incq %r15
cmpl $0x0, 0x4775(%rip)      # 0x6124
movq (%r12), %rdx
movl (%r13), %ecx
je 0x19cc
leaq 0x16e5(%rip), %rdi      # 0x30a5
movl %r15d, %esi
xorl %eax, %eax
callq 0x1090
jmp 0x1a05
leaq 0x16aa(%rip), %rdi      # 0x307d
movl %r15d, %esi
xorl %eax, %eax
callq 0x1090
movq (%r12), %rdx
movl (%r13), %ecx
movq %r14, %rdi
leaq 0x16a4(%rip), %rsi      # 0x3093
leaq 0x16ab(%rip), %r8       # 0x30a1
xorl %eax, %eax
callq 0x1180
movq %r14, %rdi
callq 0x1080
movslq 0x4714(%rip), %rax      # 0x6120
addq $0x4, %r13
addq $0x8, %r12
cmpq %rax, %r15
jl 0x19a5
leaq 0x1693(%rip), %rdi      # 0x30b3
xorl %eax, %eax
callq 0x1090
movq 0x45aa(%rip), %rax      # 0x5fd8
movq (%rax), %rdi
callq 0x22ac
movq %rax, %r15
movsbq (%rax), %r12
movzbl %r12b, %r13d
cmpq $0x62, %r12
je 0x1a6a
cmpl $0x66, %r13d
je 0x1a7b
cmpl $0x72, %r13d
jne 0x1a86
cmpb $0x0, 0x1(%r15)
je 0x1bee
cmpl $0x66, %r13d
je 0x1a7b
cmpl $0x62, %r13d
jne 0x1a86
cmpb $0x0, 0x1(%r15)
je 0x1ba9
cmpl $0x66, %r13d
jne 0x1a86
cmpb $0x0, 0x1(%r15)
je 0x1b6d
cmpl $0x3c, %r13d
jne 0x1ae1
movq %r15, %rdi
incq %rdi
callq 0x1170
testl %eax, %eax
jle 0x1b4e
cmpl 0x467b(%rip), %eax      # 0x6120
jg 0x1b4e
leal -0x1(%rax), %ebx
leaq 0x46ab(%rip), %rcx      # 0x6160
cmpl $0x0, (%rcx,%rbx,4)
jle 0x1b4e
leaq 0x15f0(%rip), %rdi      # 0x30b6
movl %eax, %esi
xorl %eax, %eax
callq 0x1090
leaq 0x468a(%rip), %rax      # 0x6160
decl (%rax,%rbx,4)
movq %rax, %rbx
jmp 0x1cd1
movb 0x1(%r15), %bl
cmpb $0x3c, %bl
jne 0x1af5
movq %r15, %rdi
cmpb $0x3c, %r12b
je 0x1a8c
jmp 0x1a92
cmpb $0x3e, %r12b
setne %al
cmpb $0x3e, %bl
setne %cl
testb %cl, %al
jne 0x1bff
leaq 0x1(%r15), %rdi
cmpb $0x3e, %r12b
cmovneq %r15, %rdi
callq 0x1170
testl %eax, %eax
jle 0x1b4e
movl %eax, %r12d
cmpl 0x45f8(%rip), %eax      # 0x6120
jg 0x1b4e
leaq 0x15c4(%rip), %rdi      # 0x30f5
movl %r12d, %esi
xorl %eax, %eax
callq 0x1090
decl %r12d
leaq 0x461b(%rip), %rbx      # 0x6160
incl (%rbx,%r12,4)
jmp 0x1cd1
leaq 0x1589(%rip), %rdi      # 0x30de
movq %r15, %rsi
xorl %eax, %eax
callq 0x1090
movb $0x1, %al
leaq 0x45f8(%rip), %rbx      # 0x6160
jmp 0x1cd3
leaq 0x19c4(%rip), %rdi      # 0x3538
callq 0x1050
movslq 0x45a0(%rip), %rax      # 0x6120
testq %rax, %rax
jle 0x1cce
shlq $0x2, %rax
xorl %ecx, %ecx
movl (%rcx,%rbx), %edx
testl %edx, %edx
jle 0x1b9b
incl %edx
movl %edx, (%rcx,%rbx)
addq $0x4, %rcx
cmpq %rcx, %rax
jne 0x1b8f
jmp 0x1cce
cmpl $0x0, -0x2c(%rbp)
je 0x1ce0
leaq 0x1996(%rip), %rdi      # 0x3550
callq 0x1050
movslq 0x455a(%rip), %rax      # 0x6120
testq %rax, %rax
jle 0x1be6
shlq $0x2, %rax
xorl %ecx, %ecx
movl (%rcx,%rbx), %edx
testl %edx, %edx
jle 0x1bdd
decl %edx
movl %edx, (%rcx,%rbx)
addq $0x4, %rcx
cmpq %rcx, %rax
jne 0x1bd1
decl -0x2c(%rbp)
jmp 0x1cd1
leaq 0x1993(%rip), %rdi      # 0x3588
callq 0x1050
jmp 0x1cd1
callq 0x11b0
testb %bl, %bl
jne 0x1cf7
movq (%rax), %rax
movzwl (%rax,%r12,2), %eax
andl $0x800, %eax            # imm = 0x800
je 0x1cf7
movq %r15, %rdi
callq 0x1170
testl %eax, %eax
leaq 0x4530(%rip), %rbx      # 0x6160
movq 0x43a1(%rip), %r12      # 0x5fd8
jle 0x1cb0
movl %eax, %r15d
cmpl 0x44de(%rip), %eax      # 0x6120
jg 0x1cb0
leaq 0x14d5(%rip), %rdi      # 0x3120
movl %r15d, %esi
xorl %eax, %eax
callq 0x1090
movq (%r12), %rdi
callq 0x2394
cmpl $0x0, 0x449b(%rip)      # 0x6100
leaq 0x14dc(%rip), %rax      # 0x3148
je 0x1c85
leaq 0x14c1(%rip), %rdi      # 0x3136
xorl %eax, %eax
callq 0x1090
movq (%r12), %rdi
callq 0x2394
movslq -0x2c(%rbp), %rcx
leaq 0x4cd0(%rip), %rdx      # 0x6960
movq %rax, (%rdx,%rcx,8)
leaq 0x5cc5(%rip), %rax      # 0x7960
movl %r15d, (%rax,%rcx,4)
decl %r15d
movl (%rbx,%r15,4), %eax
leaq 0x64b3(%rip), %rdx      # 0x8160
movl %eax, (%rdx,%rcx,4)
movslq 0x4469(%rip), %rax      # 0x6120
testq %rax, %rax
jle 0x1cce
shlq $0x2, %rax
xorl %ecx, %ecx
incl (%rcx,%rbx)
addq $0x4, %rcx
cmpq %rcx, %rax
jne 0x1cc2
incl -0x2c(%rbp)
movb $0x1, %al
testb %al, %al
jne 0x197a
jmp 0x1d91
leaq 0x1882(%rip), %rdi      # 0x3569
callq 0x1050
movb $0x1, %al
movl $0x0, -0x2c(%rbp)
jmp 0x1cd3
cmpl $0x71, %r13d
leaq 0x445e(%rip), %rbx      # 0x6160
jne 0x1d08
xorl %eax, %eax
jmp 0x1cd3
leaq 0x1442(%rip), %rdi      # 0x3151
movq %r15, %rsi
xorl %eax, %eax
callq 0x1090
leaq 0x16ee(%rip), %rdi      # 0x340e
callq 0x1050
leaq 0x16f0(%rip), %rdi      # 0x341c
callq 0x1050
leaq 0x16f1(%rip), %rdi      # 0x3429
callq 0x1050
leaq 0x1704(%rip), %rdi      # 0x3448
callq 0x1050
leaq 0x171f(%rip), %rdi      # 0x346f
callq 0x1050
leaq 0x173b(%rip), %rdi      # 0x3497
callq 0x1050
leaq 0x175a(%rip), %rdi      # 0x34c2
callq 0x1050
leaq 0x177a(%rip), %rdi      # 0x34ee
callq 0x1050
leaq 0x178f(%rip), %rdi      # 0x350f
callq 0x1050
leaq 0x17a5(%rip), %rdi      # 0x3531
jmp 0x1bf5
movq 0x4398(%rip), %rcx      # 0x6130
leaq 0x13cd(%rip), %rdx      # 0x316c
leaq -0x440(%rbp), %rbx
movl $0x200, %esi            # imm = 0x200
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10a0
leaq 0x13ba(%rip), %rdi      # 0x3176
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1090
movl $0x0, 0x6b90(%rip)      # 0x8960
leaq 0x18b5(%rip), %rsi      # 0x368c
movq %rbx, %rdi
callq 0x1150
testq %rax, %rax
je 0x1e4e
movq %rax, %rbx
leaq 0x18ff(%rip), %rsi      # 0x36ed
leaq -0x40(%rbp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x1040
movq %rbx, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x1e4e
leaq 0x6b61(%rip), %r12      # 0x8970
leaq 0x18d7(%rip), %r14      # 0x36ed
leaq -0x40(%rbp), %r15
movsd -0x40(%rbp), %xmm0
movslq 0x6b3a(%rip), %rax      # 0x8960
movsd %xmm0, (%r12,%rax,8)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1040
incl 0x6b1e(%rip)            # 0x8960
movq %rbx, %rdi
callq 0x10f0
testl %eax, %eax
je 0x1e1a
leaq 0x154d(%rip), %r15      # 0x33a2
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r12d, %r12d
leaq 0x4afc(%rip), %rax      # 0x6960
movq (%r14,%rax), %r13
testq %r13, %r13
je 0x1f0f
movq %r13, %rdi
callq 0x1070
cmpq $0x2, %rax
jb 0x1e94
movq -0x38(%rbp), %rdi
leaq 0x14da(%rip), %rsi      # 0x3364
movq %r13, %rdx
xorl %eax, %eax
callq 0x10e0
movslq 0x6ac5(%rip), %rax      # 0x8960
cmpq %rax, %r12
jge 0x1ec4
leaq 0x6ac9(%rip), %rax      # 0x8970
movsd (%r14,%rax), %xmm0
movq -0x38(%rbp), %r13
movq %r13, %rdi
leaq 0x14b3(%rip), %rsi      # 0x336e
movb $0x1, %al
callq 0x10e0
jmp 0x1ee1
movl $0x13, %esi
movl $0x1, %edx
leaq 0x14b9(%rip), %rdi      # 0x338e
movq -0x38(%rbp), %r13
movq %r13, %rcx
callq 0x11a0
leaq 0x5a78(%rip), %rax      # 0x7960
movl (%rbx,%rax), %edx
leaq 0x626e(%rip), %rax      # 0x8160
movl (%rbx,%rax), %ecx
movq %r13, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x10e0
movl $0xa, %edi
movq %r13, %rsi
callq 0x10c0
incq %r12
addq $0x8, %r14
addq $0x4, %rbx
cmpq $0x1000, %r14           # imm = 0x1000
jne 0x1e5d
leaq 0x148d(%rip), %rdi      # 0x33bb
movl $0x13, %esi
movl $0x1, %edx
movq -0x38(%rbp), %rbx
movq %rbx, %rcx
callq 0x11a0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10c0
leaq 0x1477(%rip), %rdi      # 0x33cf
movl $0xe, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11a0
leaq 0x146d(%rip), %rdi      # 0x33de
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x11a0
movq %rbx, %rdi
callq 0x1060
xorl %eax, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x414a(%rip), %rsi      # 0x60f0
movq 0x414b(%rip), %rdx      # 0x60f8
leaq 0x1431(%rip), %rdi      # 0x33e5
xorl %eax, %eax
callq 0x1090
jmp 0x201d
leaq 0x15d1(%rip), %rdi      # 0x3595
callq 0x1050
leaq 0x15d4(%rip), %rdi      # 0x35a4
callq 0x1050
leaq 0x15f4(%rip), %rdi      # 0x35d0
callq 0x1050
leaq 0x15f9(%rip), %rdi      # 0x35e1
callq 0x1050
leaq 0x1613(%rip), %rdi      # 0x3607
callq 0x1050
leaq 0x1644(%rip), %rdi      # 0x3644
callq 0x1050
leaq 0x165e(%rip), %rdi      # 0x366a
callq 0x1050
leaq 0x1676(%rip), %rdi      # 0x368e
callq 0x1050
xorl %edi, %edi
callq 0x1190