// File: /workspace/github_c_makefile_star2_O0/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
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x15e0
movl %eax, -0x14(%rbp)
movl -0x8(%rbp), %eax
subl -0x14(%rbp), %eax
cmpl $0x0, %eax
jne 0x1388
movq 0x6c6a(%rip), %rax      # 0x7fd8
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq 0x6c54(%rip), %rax      # 0x7fd0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x1425
movl -0x8(%rbp), %eax
subl -0x14(%rbp), %eax
cmpl $0x1, %eax
jne 0x13bf
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4342(%rip), %rsi      # 0x56e8
callq 0x19f0
movq %rax, -0x30(%rbp)
movq 0x6c1a(%rip), %rax      # 0x7fd0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x1423
movl -0x8(%rbp), %eax
subl -0x14(%rbp), %eax
cmpl $0x2, %eax
jne 0x1409
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x430b(%rip), %rsi      # 0x56e8
callq 0x19f0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3c27(%rip), %rsi      # 0x5025
callq 0x19f0
movq %rax, -0x38(%rbp)
jmp 0x1421
leaq 0x3c17(%rip), %rdi      # 0x5027
movb $0x0, %al
callq 0x10a0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x11e0
jmp 0x1423
jmp 0x1425
callq 0x1ed0
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x23d0
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq 0x3c13(%rip), %rdx      # 0x5061
xorl %eax, %eax
movl %eax, %ecx
callq 0x3370
movsd 0x6cd9(%rip), %xmm0     # 0x8138
movsd %xmm0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movl 0x8(%rax), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
movsd 0x3b96(%rip), %xmm0     # 0x5010
callq 0x1070
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
movsd 0x3b79(%rip), %xmm2     # 0x5008
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movq 0x6b55(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
movsd 0x6c8a(%rip), %xmm0     # 0x8138
leaq 0x3bbd(%rip), %rsi      # 0x5072
movb $0x1, %al
callq 0x1120
movq 0x6b35(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
movsd -0x28(%rbp), %xmm0
leaq 0x3bb2(%rip), %rsi      # 0x5084
movb $0x1, %al
callq 0x1120
movl $0x0, -0x18(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1140
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x14fa
jmp 0x158a
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x157a
movq -0x30(%rbp), %rdi
leaq 0x3b79(%rip), %rsi      # 0x5090
leaq -0x20(%rbp), %rdx
movb $0x0, %al
callq 0x1050
movsd 0x3ae6(%rip), %xmm0     # 0x5010
mulsd -0x28(%rbp), %xmm0
callq 0x1860
movaps %xmm0, %xmm1
subsd -0x28(%rbp), %xmm1
cvtsi2sdl -0x20(%rbp), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x20(%rbp)
movq -0x38(%rbp), %rdi
cvtsi2sdl -0x20(%rbp), %xmm0
mulsd 0x6be3(%rip), %xmm0     # 0x8140
cvttsd2si %xmm0, %edx
leaq 0x3e15(%rip), %rsi      # 0x537d
movb $0x0, %al
callq 0x1120
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1501
jmp 0x157c
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x14e0
movl -0x18(%rbp), %eax
movq -0x40(%rbp), %rcx
movl 0xc(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
je 0x15bd
movq 0x6a56(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
movl -0x18(%rbp), %edx
movq -0x40(%rbp), %rax
movl 0xc(%rax), %ecx
leaq 0x3ade(%rip), %rsi      # 0x5094
movb $0x0, %al
callq 0x1120
movq -0x30(%rbp), %rdi
callq 0x1080
movq -0x38(%rbp), %rdi
callq 0x1080
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)