// File: /workspace/github_c_makefile_star2_O0/pipde[P]deos-songlib/lib/rra.c
// Function: readRRAAmplitude
int
readRRAAmplitude(FILE *in,FILE *out,int bps,void (*handler)(FILE *, FILE *))
    {
    int ch;
    char s[512] = "";
    int count;
    int first;
    int decimal;
    int floater;
    int exponent;
    static int storedBPS = -1;
    static double storedMax;

    if (storedBPS != bps)
        {
        storedBPS = bps;
        storedMax = pow(2,bps - 1) - 1;
        }

    if (feof(in)) return -1;

    first = 1;
    decimal = 0;
    floater = 0;
    exponent = 0;

    skipWhiteSpace(in,out,handler);

    count = 0;
    ch = fgetc(in);
    while (isdigit(ch) || (first && ch == '-') || (!decimal && ch == '.')
        || (!exponent && (ch == 'E' || ch == 'e')))
        {
        first = 0;
        if (ch == '.')
            {
            decimal = 1;
            floater = 1;
            }
        if (ch == 'E' || ch == 'e')
            {
            decimal = 1;
            floater = 1;
            exponent = 1;
            first = 1;
            }
        s[count++] = ch;
        if (count >= sizeof(s) - 1)
            Fatal("RRA FORMAT ERROR, line %d: number is too large\n",
                LineNumber);
        ch = fgetc(in);
        }

    s[count] = '\0';

    ungetc(ch, in);

    //printf("number is %s\n", s);

    if (strcmp(s,"-") == 0)
        Fatal("RRA FORMAT ERROR, line %d: lonely dash found\n", LineNumber);
    else if (strcmp(s,".") == 0)
        Fatal("RRA FORMAT ERROR, line %d: lonely dot found\n", LineNumber);

    if (floater)
        {
        //printf("!floater is %s (a fraction of 2^%d)\n",s,bps); 
        //printf("!%d\n", (int) (atof(s) * storedMax));
        return (int) (atof(s) * storedMax);
        }
    else
        return atoi(s);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
leaq -0x230(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x10b0
movl 0x4919(%rip), %eax      # 0x712c
cmpl -0x1c(%rbp), %eax
je 0x284c
movl -0x1c(%rbp), %eax
movl %eax, 0x490b(%rip)      # 0x712c
movl -0x1c(%rbp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
movsd 0x1905(%rip), %xmm0     # 0x4138
callq 0x1060
movsd 0x1848(%rip), %xmm1     # 0x4088
subsd %xmm1, %xmm0
movsd %xmm0, 0x48f4(%rip)     # 0x7140
movq -0x10(%rbp), %rdi
callq 0x1130
cmpl $0x0, %eax
je 0x2866
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2ab0
movl $0x1, -0x238(%rbp)
movl $0x0, -0x23c(%rbp)
movl $0x0, -0x240(%rbp)
movl $0x0, -0x244(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x2550
movl $0x0, -0x234(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10c0
movl %eax, -0x2c(%rbp)
callq 0x1200
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x800, %ecx            # imm = 0x800
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x245(%rbp)
jne 0x294a
cmpl $0x0, -0x238(%rbp)
je 0x28ef
movb $0x1, %al
cmpl $0x2d, -0x2c(%rbp)
movb %al, -0x245(%rbp)
je 0x294a
cmpl $0x0, -0x23c(%rbp)
jne 0x2906
movb $0x1, %al
cmpl $0x2e, -0x2c(%rbp)
movb %al, -0x245(%rbp)
je 0x294a
xorl %eax, %eax
cmpl $0x0, -0x244(%rbp)
movb %al, -0x246(%rbp)
jne 0x293e
movb $0x1, %al
cmpl $0x45, -0x2c(%rbp)
movb %al, -0x247(%rbp)
je 0x2932
cmpl $0x65, -0x2c(%rbp)
sete %al
movb %al, -0x247(%rbp)
movb -0x247(%rbp), %al
movb %al, -0x246(%rbp)
movb -0x246(%rbp), %al
movb %al, -0x245(%rbp)
movb -0x245(%rbp), %al
testb $0x1, %al
jne 0x2959
jmp 0x2a04
movl $0x0, -0x238(%rbp)
cmpl $0x2e, -0x2c(%rbp)
jne 0x297d
movl $0x1, -0x23c(%rbp)
movl $0x1, -0x240(%rbp)
cmpl $0x45, -0x2c(%rbp)
je 0x2989
cmpl $0x65, -0x2c(%rbp)
jne 0x29b1
movl $0x1, -0x23c(%rbp)
movl $0x1, -0x240(%rbp)
movl $0x1, -0x244(%rbp)
movl $0x1, -0x238(%rbp)
movl -0x2c(%rbp), %eax
movb %al, %cl
movl -0x234(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x234(%rbp)
cltq
movb %cl, -0x230(%rbp,%rax)
movslq -0x234(%rbp), %rax
cmpq $0x1ff, %rax            # imm = 0x1FF
jb 0x29f3
movl 0x4743(%rip), %esi      # 0x7128
leaq 0x1991(%rip), %rdi      # 0x437d
movb $0x0, %al
callq 0x1580
movq -0x10(%rbp), %rdi
callq 0x10c0
movl %eax, -0x2c(%rbp)
jmp 0x28b5
movslq -0x234(%rbp), %rax
movb $0x0, -0x230(%rbp,%rax)
movl -0x2c(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1160
leaq -0x230(%rbp), %rdi
leaq 0x1980(%rip), %rsi      # 0x43ad
callq 0x10f0
cmpl $0x0, %eax
jne 0x2a4d
movl 0x46eb(%rip), %esi      # 0x7128
leaq 0x196b(%rip), %rdi      # 0x43af
movb $0x0, %al
callq 0x1580
jmp 0x2a7b
leaq -0x230(%rbp), %rdi
leaq 0x1982(%rip), %rsi      # 0x43dd
callq 0x10f0
cmpl $0x0, %eax
jne 0x2a79
movl 0x46bd(%rip), %esi      # 0x7128
leaq 0x196d(%rip), %rdi      # 0x43df
movb $0x0, %al
callq 0x1580
jmp 0x2a7b
cmpl $0x0, -0x240(%rbp)
je 0x2aa1
leaq -0x230(%rbp), %rdi
callq 0x1050
mulsd 0x46a8(%rip), %xmm0     # 0x7140
cvttsd2si %xmm0, %eax
movl %eax, -0x4(%rbp)
jmp 0x2ab0
leaq -0x230(%rbp), %rdi
callq 0x11c0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
nopl (%rax)