// File: /workspace/github_c_makefile_star2_O2/pipde[P]deos-songlib/utils/hiss/hiss.c
// Function: main
int
main(int argc,char **argv)
    {
    int argIndex = 1;

    int i,j;
    int amp;
    double size;
    FILE *in,*out;
    RRA *h;

    argIndex = processOptions(argc,argv);

    if (argc-argIndex == 0)
        {
        in = stdin;
        out = stdout;
        }
    else if (argc-argIndex == 1)
        {
        in = OpenFile(argv[argIndex],"r");
        out = stdout;
        }
    else if (argc-argIndex == 2)
        {
        in = OpenFile(argv[argIndex],"r");
        out = OpenFile(argv[argIndex+1],"w");
        }
    else
        {
        printf("usage: hiss -sM.N [<input rra file> [<output rra file>]]\n");
        exit(-1);
        }

    h = newRRAHeader();
    
    readRRAHeader(in,h,0);
    writeRRAHeader(out,h,"modifiedBy: hiss",0);

    size = randomness * (pow(2.0,h->bitsPerSample - 1) - 1.0);
    fprintf(stderr,"randomness is %f\n",randomness);
    fprintf(stderr,"size is %f\n",size);

    for (i = 0; !feof(in); ++i)
        for (j = 0; j < h->channels; ++j)
            {
            fscanf(in," %d",&amp);
            amp += uniform(2 * size) - size;
            fprintf(out,"%d\n",(int)(amp * attenuation));
            }

    if (i != h->samples + 1)
        fprintf(stderr,"WARNING: %d samples found, %d expected\n",i,h->samples);

    fclose(in);
    fclose(out);

    return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movl %edi, %ebx
pushq $0x1
popq %r12
movslq %r12d, %r15
cmpl %r12d, %ebx
jle 0x13fd
movq (%r14,%r15,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x13fd
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x13a6
leaq 0x2(%rsi), %rdi
jmp 0x13ab
movq 0x8(%r14,%r15,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x72, %eax
je 0x13d9
cmpl $0x68, %eax
je 0x15c6
cmpl $0x76, %eax
je 0x16b0
xorl %r15d, %r15d
leaq 0x2ce1(%rip), %rdi      # 0x40b1
xorl %eax, %eax
callq 0x16e8
jmp 0x13e9
callq 0x1090
movsd %xmm0, 0x5d72(%rip)     # 0x7158
movb $0x1, %r15b
testb %r13b, %r13b
sete %al
andb %r15b, %al
movzbl %al, %eax
addl %eax, %r12d
incl %r12d
jmp 0x1386
subl %r12d, %ebx
jne 0x140e
movq 0x5bcf(%rip), %rax      # 0x6fd8
movq (%rax), %r13
jmp 0x142f
cmpl $0x2, %ebx
je 0x143b
cmpl $0x1, %ebx
jne 0x16d3
movq (%r14,%r15,8), %rdi
leaq 0x2e55(%rip), %rsi      # 0x427c
callq 0x1818
movq %rax, %r13
movq 0x5b9a(%rip), %rax      # 0x6fd0
movq (%rax), %rbx
jmp 0x1462
movq (%r14,%r15,8), %rdi
leaq 0x2e36(%rip), %rsi      # 0x427c
callq 0x1818
movq %rax, %r13
movq 0x8(%r14,%r15,8), %rdi
leaq 0x2bd3(%rip), %rsi      # 0x402d
callq 0x1818
movq %rax, %rbx
callq 0x1a74
movq %rax, %r15
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x1dd9
leaq 0x2bb1(%rip), %rdx      # 0x402f
movq %rbx, %r12
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x27e8
movsd 0x5cc2(%rip), %xmm0     # 0x7158
movsd %xmm0, -0x30(%rbp)
movl 0x8(%r15), %edi
decl %edi
movsd 0x2b5f(%rip), %xmm0     # 0x4008
callq 0x1050
addsd 0x2b5a(%rip), %xmm0     # 0x4010
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq 0x5b31(%rip), %rbx      # 0x6ff8
movq (%rbx), %rdi
movsd 0x5c86(%rip), %xmm0     # 0x7158
leaq 0x2b67(%rip), %rsi      # 0x4040
movb $0x1, %al
callq 0x1150
movq (%rbx), %rdi
leaq 0x2b68(%rip), %rsi      # 0x4052
movsd -0x30(%rbp), %xmm0
movb $0x1, %al
callq 0x1150
movsd -0x30(%rbp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
leaq 0x2ea2(%rip), %rbx      # 0x43ad
movl $0x0, -0x34(%rbp)
movq %r13, %rdi
callq 0x1170
testl %eax, %eax
jne 0x157d
xorl %r14d, %r14d
cmpl (%r15), %r14d
jge 0x1578
movq %r13, %rdi
leaq 0x2b2e(%rip), %rsi      # 0x405e
leaq -0x38(%rbp), %rdx
xorl %eax, %eax
callq 0x1070
callq 0x1250
cvtsi2sd %eax, %xmm0
mulsd -0x40(%rbp), %xmm0
divsd 0x2ac7(%rip), %xmm0     # 0x4018
subsd -0x30(%rbp), %xmm0
cvtsi2sdl -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %edx
movl %edx, -0x38(%rbp)
movq %r12, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1150
incl %r14d
jmp 0x1521
incl -0x34(%rbp)
jmp 0x1512
movl 0xc(%r15), %ecx
leal 0x1(%rcx), %eax
movl -0x34(%rbp), %edx
cmpl %eax, %edx
jne 0x15ac
movq %r13, %rdi
callq 0x10a0
movq %r12, %rdi
callq 0x10a0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5a45(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x2aa5(%rip), %rsi      # 0x4062
xorl %eax, %eax
callq 0x1150
jmp 0x158b
leaq 0x2b37(%rip), %rdi      # 0x4104
callq 0x1080
leaq 0x2b39(%rip), %rdi      # 0x4112
callq 0x1080
leaq 0x2b51(%rip), %rdi      # 0x4136
callq 0x1080
leaq 0x2b6b(%rip), %rdi      # 0x415c
callq 0x1080
leaq 0x2a9c(%rip), %rbx      # 0x4099
movsd 0x2a03(%rip), %xmm0     # 0x4008
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x2b6c(%rip), %rdi      # 0x4182
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x2b7d(%rip), %rdi      # 0x41ac
callq 0x1080
movsd 0x29e4(%rip), %xmm0     # 0x4020
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x2b8b(%rip), %rdi      # 0x41d8
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x2b9c(%rip), %rdi      # 0x4202
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x2bae(%rip), %rdi      # 0x422d
callq 0x1080
movsd 0x5acc(%rip), %xmm0     # 0x7158
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x2bbd(%rip), %rdi      # 0x425a
callq 0x1080
leaq 0x2bd5(%rip), %rdi      # 0x427e
callq 0x1080
jmp 0x16cc
movq 0x5a91(%rip), %rsi      # 0x7148
movq 0x5a92(%rip), %rdx      # 0x7150
leaq 0x29c5(%rip), %rdi      # 0x408a
xorl %eax, %eax
callq 0x10c0
xorl %edi, %edi
callq 0x1210
leaq 0x29f1(%rip), %rdi      # 0x40cb
callq 0x1080
pushq $-0x1
popq %rdi
callq 0x1210
nop