// File: /workspace/github_c_makefile_star2_O0/DrYerzinia[P]C_DigiMode/src/mixer/mixer.c
// Function: main
int main(int argc, char **argv){

	struct arguments arguments;
	argp_parse(&argp, argc, argv, 0, 0, &arguments);

	FILE *data_file1 = NULL;
	FILE *data_file2 = NULL;

	data_file1 = fopen(arguments.in_1_filename, "r");
	if(data_file1 == NULL){
		fprintf(stderr, "Error: couldn't open input file 1\n");
		return -1;
	}

	data_file2 = fopen(arguments.in_2_filename, "r");
	if(data_file2 == NULL){
		fprintf(stderr, "Error: couldn't open input file 2\n");
		fclose(data_file1);
		return -1;
	}

	FILE *output_file = fopen(arguments.out_filename, "w");
	if(output_file == NULL){
		fprintf(stderr, "Error: unable to create output file\n");
		fclose(data_file1);
		fclose(data_file2);
		return -1;
	}

	bool eof1 = false, eof2 = false;
	char byte1, byte2;

	while(!eof1 && !eof2){

		byte1 = getc(data_file1);
		byte2 = getc(data_file2);

		fputc(byte1*byte2/16384, output_file);

		eof1 = feof(data_file1);
		eof2 = feof(data_file2);

		if(eof1 != eof2){
			fprintf(stderr, "Error: input file sizes do not match!\n");
			return -1;
		}

	}

	fclose(data_file1);
	fclose(data_file2);
	fclose(output_file);

	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq 0x2eac(%rip), %rdi      # 0x4070
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x28(%rbp), %r9
callq 0x1050
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rdi
leaq 0xe36(%rip), %rsi       # 0x2025
callq 0x1080
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1223
movq 0x2df2(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xe17(%rip), %rsi       # 0x2027
movb $0x0, %al
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x139e
movq -0x20(%rbp), %rdi
leaq 0xdf7(%rip), %rsi       # 0x2025
callq 0x1080
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x126b
movq 0x2db3(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xdfb(%rip), %rsi       # 0x204a
movb $0x0, %al
callq 0x1060
movq -0x30(%rbp), %rdi
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x139e
movq -0x18(%rbp), %rdi
leaq 0xdf7(%rip), %rsi       # 0x206d
callq 0x1080
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x12bc
movq 0x2d6b(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xdd8(%rip), %rsi       # 0x206f
movb $0x0, %al
callq 0x1060
movq -0x30(%rbp), %rdi
callq 0x1030
movq -0x38(%rbp), %rdi
callq 0x1030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x139e
movb $0x0, -0x41(%rbp)
movb $0x0, -0x42(%rbp)
xorl %eax, %eax
testb $0x1, -0x41(%rbp)
movb %al, -0x45(%rbp)
jne 0x12d7
movb -0x42(%rbp), %al
xorb $-0x1, %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0x12e3
jmp 0x137c
movq -0x30(%rbp), %rdi
callq 0x1090
movb %al, -0x43(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1090
movb %al, -0x44(%rbp)
movsbl -0x43(%rbp), %eax
movsbl -0x44(%rbp), %ecx
imull %ecx, %eax
movl $0x4000, %ecx           # imm = 0x4000
cltd
idivl %ecx
movl %eax, %edi
movq -0x40(%rbp), %rsi
callq 0x1040
movq -0x30(%rbp), %rdi
callq 0x1070
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x41(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1070
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x42(%rbp)
movb -0x41(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movb -0x42(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x1377
movq 0x2c9b(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xd2d(%rip), %rsi       # 0x2094
movb $0x0, %al
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x139e
jmp 0x12c4
movq -0x30(%rbp), %rdi
callq 0x1030
movq -0x38(%rbp), %rdi
callq 0x1030
movq -0x40(%rbp), %rdi
callq 0x1030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)