// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rsi, %r14
movl %edi, %ebx
movl $0x1, %r12d
cmpl $0x2, %edi
jl 0x1678
movl $0x1, %r12d
movslq %r12d, %rax
movq (%r14,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x1678
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x161e
leaq 0x2(%rsi), %rdi
jmp 0x1623
movq 0x8(%r14,%rax,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x72, %eax
je 0x1651
cmpl $0x68, %eax
je 0x18a7
cmpl $0x76, %eax
je 0x1886
xorl %r15d, %r15d
leaq 0x2a69(%rip), %rdi      # 0x40b1
xorl %eax, %eax
callq 0x19ac
jmp 0x1661
callq 0x1090
movsd %xmm0, 0x5afa(%rip)     # 0x7158
movb $0x1, %r15b
testb %r13b, %r13b
sete %al
andb %r15b, %al
movzbl %al, %eax
addl %eax, %r12d
incl %r12d
cmpl %ebx, %r12d
jl 0x1603
subl %r12d, %ebx
jne 0x1689
movq 0x5954(%rip), %rax      # 0x6fd8
movq (%rax), %r13
jmp 0x16ad
cmpl $0x2, %ebx
je 0x16b9
cmpl $0x1, %ebx
jne 0x1996
movslq %r12d, %rax
movq (%r14,%rax,8), %rdi
leaq 0x2bd7(%rip), %rsi      # 0x427c
callq 0x1a46
movq %rax, %r13
movq 0x591c(%rip), %rax      # 0x6fd0
movq (%rax), %r14
jmp 0x16e3
movslq %r12d, %rbx
movq (%r14,%rbx,8), %rdi
leaq 0x2bb5(%rip), %rsi      # 0x427c
callq 0x1a46
movq %rax, %r13
movq 0x8(%r14,%rbx,8), %rdi
leaq 0x2952(%rip), %rsi      # 0x402d
callq 0x1a46
movq %rax, %r14
callq 0x1cb7
movq %rax, %r12
xorl %r15d, %r15d
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x20dd
leaq 0x292d(%rip), %rdx      # 0x402f
movq %r14, -0x40(%rbp)
movq %r14, %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x2b78
movsd 0x5a3d(%rip), %xmm0     # 0x7158
movsd %xmm0, -0x30(%rbp)
movl 0x8(%r12), %edi
decl %edi
movsd 0x28d9(%rip), %xmm0     # 0x4008
callq 0x1050
addsd 0x28dc(%rip), %xmm0     # 0x4018
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq 0x58ab(%rip), %r14      # 0x6ff8
movq (%r14), %rdi
movsd 0x5a00(%rip), %xmm0     # 0x7158
leaq 0x28e1(%rip), %rsi      # 0x4040
movb $0x1, %al
callq 0x1150
movq (%r14), %rdi
leaq 0x28e2(%rip), %rsi      # 0x4052
movsd -0x30(%rbp), %xmm0
movb $0x1, %al
callq 0x1150
movq %r13, %rdi
callq 0x1170
testl %eax, %eax
jne 0x183a
movsd -0x30(%rbp), %xmm0
addsd %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
xorl %r15d, %r15d
movq %r12, -0x48(%rbp)
movq %r15, -0x50(%rbp)
cmpl $0x0, (%r12)
movq -0x40(%rbp), %r15
leaq 0x28a9(%rip), %rax      # 0x405e
leaq -0x34(%rbp), %r14
jle 0x181f
xorl %ebx, %ebx
movq %r13, %rdi
movq %rax, %r12
movq %rax, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1070
callq 0x1250
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd -0x58(%rbp), %xmm0
divsd 0x2837(%rip), %xmm0     # 0x4020
subsd -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl -0x34(%rbp), %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %edx
movl %edx, -0x34(%rbp)
movq %r15, %rdi
leaq 0x2ba2(%rip), %rsi      # 0x43ad
xorl %eax, %eax
callq 0x1150
movq %r12, %rax
incl %ebx
movq -0x48(%rbp), %rcx
cmpl (%rcx), %ebx
jl 0x17bd
movq -0x50(%rbp), %r15
incl %r15d
movq %r13, %rdi
callq 0x1170
testl %eax, %eax
movq -0x48(%rbp), %r12
je 0x17a1
movl 0xc(%r12), %ecx
leal 0x1(%rcx), %eax
cmpl %eax, %r15d
jne 0x1869
movq %r13, %rdi
callq 0x10a0
movq -0x40(%rbp), %rdi
callq 0x10a0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5788(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x27e8(%rip), %rsi      # 0x4062
movl %r15d, %edx
xorl %eax, %eax
callq 0x1150
jmp 0x1847
movq 0x58bb(%rip), %rsi      # 0x7148
movq 0x58bc(%rip), %rdx      # 0x7150
leaq 0x27ef(%rip), %rdi      # 0x408a
xorl %eax, %eax
callq 0x10c0
jmp 0x198f
leaq 0x2856(%rip), %rdi      # 0x4104
callq 0x1080
leaq 0x2858(%rip), %rdi      # 0x4112
callq 0x1080
leaq 0x2870(%rip), %rdi      # 0x4136
callq 0x1080
leaq 0x288a(%rip), %rdi      # 0x415c
callq 0x1080
leaq 0x27bb(%rip), %rbx      # 0x4099
movsd 0x2722(%rip), %xmm0     # 0x4008
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x288b(%rip), %rdi      # 0x4182
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x289c(%rip), %rdi      # 0x41ac
callq 0x1080
movsd 0x26f3(%rip), %xmm0     # 0x4010
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28aa(%rip), %rdi      # 0x41d8
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28bb(%rip), %rdi      # 0x4202
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28cd(%rip), %rdi      # 0x422d
callq 0x1080
movsd 0x57eb(%rip), %xmm0     # 0x7158
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28dc(%rip), %rdi      # 0x425a
callq 0x1080
leaq 0x28f4(%rip), %rdi      # 0x427e
callq 0x1080
xorl %edi, %edi
callq 0x1210
leaq 0x272e(%rip), %rdi      # 0x40cb
callq 0x1080
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1210