// File: /workspace/github_c_makefile_star2_O1/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 0x1648
movl $0x1, %r12d
movslq %r12d, %rax
movq (%r14,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x1648
movb 0x2(%rsi), %r13b
testb %r13b, %r13b
je 0x15ee
leaq 0x2(%rsi), %rdi
jmp 0x15f3
movq 0x8(%r14,%rax,8), %rdi
movzbl 0x1(%rsi), %eax
cmpl $0x72, %eax
je 0x1621
cmpl $0x68, %eax
je 0x1877
cmpl $0x76, %eax
je 0x1856
xorl %r15d, %r15d
leaq 0x2a99(%rip), %rdi      # 0x40b1
xorl %eax, %eax
callq 0x197c
jmp 0x1631
callq 0x1090
movsd %xmm0, 0x5b2a(%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 0x15d3
subl %r12d, %ebx
jne 0x1659
movq 0x5984(%rip), %rax      # 0x6fd8
movq (%rax), %r13
jmp 0x167d
cmpl $0x2, %ebx
je 0x1689
cmpl $0x1, %ebx
jne 0x1966
movslq %r12d, %rax
movq (%r14,%rax,8), %rdi
leaq 0x2c07(%rip), %rsi      # 0x427c
callq 0x1a16
movq %rax, %r13
movq 0x594c(%rip), %rax      # 0x6fd0
movq (%rax), %r14
jmp 0x16b3
movslq %r12d, %rbx
movq (%r14,%rbx,8), %rdi
leaq 0x2be5(%rip), %rsi      # 0x427c
callq 0x1a16
movq %rax, %r13
movq 0x8(%r14,%rbx,8), %rdi
leaq 0x2982(%rip), %rsi      # 0x402d
callq 0x1a16
movq %rax, %r14
callq 0x1c93
movq %rax, %r12
xorl %r15d, %r15d
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x20a0
leaq 0x295d(%rip), %rdx      # 0x402f
movq %r14, -0x40(%rbp)
movq %r14, %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x2af1
movsd 0x5a6d(%rip), %xmm0     # 0x7158
movsd %xmm0, -0x30(%rbp)
movl 0x8(%r12), %edi
decl %edi
movsd 0x2909(%rip), %xmm0     # 0x4008
callq 0x1050
addsd 0x290c(%rip), %xmm0     # 0x4018
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq 0x58db(%rip), %r14      # 0x6ff8
movq (%r14), %rdi
movsd 0x5a30(%rip), %xmm0     # 0x7158
leaq 0x2911(%rip), %rsi      # 0x4040
movb $0x1, %al
callq 0x1150
movq (%r14), %rdi
leaq 0x2912(%rip), %rsi      # 0x4052
movsd -0x30(%rbp), %xmm0
movb $0x1, %al
callq 0x1150
movq %r13, %rdi
callq 0x1170
testl %eax, %eax
jne 0x180a
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 0x28d9(%rip), %rax      # 0x405e
leaq -0x34(%rbp), %r14
jle 0x17ef
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 0x2867(%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 0x2bd2(%rip), %rsi      # 0x43ad
xorl %eax, %eax
callq 0x1150
movq %r12, %rax
incl %ebx
movq -0x48(%rbp), %rcx
cmpl (%rcx), %ebx
jl 0x178d
movq -0x50(%rbp), %r15
incl %r15d
movq %r13, %rdi
callq 0x1170
testl %eax, %eax
movq -0x48(%rbp), %r12
je 0x1771
movl 0xc(%r12), %ecx
leal 0x1(%rcx), %eax
cmpl %eax, %r15d
jne 0x1839
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 0x57b8(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x2818(%rip), %rsi      # 0x4062
movl %r15d, %edx
xorl %eax, %eax
callq 0x1150
jmp 0x1817
movq 0x58eb(%rip), %rsi      # 0x7148
movq 0x58ec(%rip), %rdx      # 0x7150
leaq 0x281f(%rip), %rdi      # 0x408a
xorl %eax, %eax
callq 0x10c0
jmp 0x195f
leaq 0x2886(%rip), %rdi      # 0x4104
callq 0x1080
leaq 0x2888(%rip), %rdi      # 0x4112
callq 0x1080
leaq 0x28a0(%rip), %rdi      # 0x4136
callq 0x1080
leaq 0x28ba(%rip), %rdi      # 0x415c
callq 0x1080
leaq 0x27eb(%rip), %rbx      # 0x4099
movsd 0x2752(%rip), %xmm0     # 0x4008
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28bb(%rip), %rdi      # 0x4182
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28cc(%rip), %rdi      # 0x41ac
callq 0x1080
movsd 0x2723(%rip), %xmm0     # 0x4010
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28da(%rip), %rdi      # 0x41d8
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28eb(%rip), %rdi      # 0x4202
callq 0x1080
xorps %xmm0, %xmm0
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x28fd(%rip), %rdi      # 0x422d
callq 0x1080
movsd 0x581b(%rip), %xmm0     # 0x7158
movq %rbx, %rdi
movb $0x1, %al
callq 0x10c0
leaq 0x290c(%rip), %rdi      # 0x425a
callq 0x1080
leaq 0x2924(%rip), %rdi      # 0x427e
callq 0x1080
xorl %edi, %edi
callq 0x1210
leaq 0x275e(%rip), %rdi      # 0x40cb
callq 0x1080
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1210