// File: /workspace/github_cpp_makefile_star2_O3/qmmlib[P]QmmLibrary/transform_line.cpp
// Function: transform_line
void transform_line(double * read_line, int y, int max_idx, char * line, char structured_w, double ** tmx, int tmx_r, int tmx_c)
{
	int curr_idx=1;
	int print_idx=1;
	double curr_val;
	
	stringstream ss (stringstream::in | stringstream::out);

	ss<<y<<" ";
	
	while(1)
	{
		if(structured_w=='s' || structured_w=='a')
		{
			curr_val = read_line[curr_idx] + (read_line[max_idx+1-curr_idx] * (structured_w=='s'?1:(structured_w=='a'?-1:0)));
			
			if(curr_val!=0)
				ss<< print_idx<<":"<<curr_val<<" ";
			
			curr_idx++;
			print_idx++;
			
			if(max_idx%2==0 && curr_idx>((double)max_idx)/2.0f)
				break;
			else if(max_idx%2!=0 && curr_idx>((double)max_idx)/2.0f)
			{
				curr_val = read_line[curr_idx];
				if(curr_val!=0)
					ss<< print_idx<<":"<<curr_val<<" ";
				break;
			}
		}			
		else if(structured_w=='f')
		{
			if(max_idx!=tmx_c)
			{
				printf("\nmax_idx: %d ncols: %d nrows: %d\n",max_idx,tmx_c,tmx_r);
				exit(1);
			}
			
			for(int j = 0; j < tmx_r; j++)
			{
				curr_val = 0;
				for(int i = 0; i<tmx_c; i++)
					curr_val = curr_val + (tmx[j][i] * read_line[i+1]);
				if(curr_val!=0)
					ss<<j+1<<":"<<curr_val<<" ";
			}
			
			break;
		}
	}
	
	strcpy(line, ss.str().c_str());
	// printf("%s\n",line);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %r9, 0x8(%rsp)
movl %r8d, %ebx
movq %rcx, 0x18(%rsp)
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %r12
leaq 0x40(%rsp), %rdi
movl $0x18, %esi
callq 0x3160
leaq 0x50(%rsp), %rdi
movl %ebp, %esi
callq 0x33e0
leaq 0x28b1(%rip), %rsi      # 0x196a3
movl $0x1, %edx
movq %rax, %rdi
callq 0x3260
cmpb $0x61, %bl
je 0x16e0a
xorpd %xmm0, %xmm0
jmp 0x16e12
movsd 0x248e(%rip), %xmm0     # 0x192a0
movsd %xmm0, 0x10(%rsp)
cmpb $0x73, %bl
jne 0x16e2b
movsd 0x2473(%rip), %xmm0     # 0x19298
movsd %xmm0, 0x10(%rsp)
cmpb $0x66, %bl
jne 0x16ef5
movl 0x208(%rsp), %edx
movl 0x200(%rsp), %ecx
cmpl %edx, %r14d
jne 0x17082
testl %ecx, %ecx
jle 0x17018
movl %ecx, %ebx
movl %r14d, %r13d
xorl %ebp, %ebp
testl %r14d, %r14d
jle 0x16ee4
movq 0x8(%rsp), %rax
movq (%rax,%rbp,8), %rax
xorpd %xmm1, %xmm1
xorl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm0
mulsd 0x8(%r12,%rcx,8), %xmm0
incq %rcx
addsd %xmm0, %xmm1
cmpq %rcx, %r13
jne 0x16e72
movsd %xmm1, (%rsp)
ucomisd 0x11a9(%rip), %xmm1     # 0x18040
jne 0x16e9b
jnp 0x16ee4
incq %rbp
leaq 0x50(%rsp), %rdi
movl %ebp, %esi
callq 0x33e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1417(%rip), %rsi      # 0x182d3
callq 0x3260
movq %r15, %rdi
movsd (%rsp), %xmm0
callq 0x33b0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x27c6(%rip), %rsi      # 0x196a3
callq 0x3260
jmp 0x16ee7
incq %rbp
cmpq %rbx, %rbp
jne 0x16e5a
jmp 0x17018
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
leal 0x1(%r14), %r13d
mulsd 0x21f7(%rip), %xmm0     # 0x19100
movsd %xmm0, 0x8(%rsp)
movl $0x1, %ebp
movsbl %bl, %ebx
cmpl $0x73, %ebx
je 0x16f21
cmpl $0x61, %ebx
jne 0x16f17
movl %ebp, %eax
movl %r13d, %ecx
subl %ebp, %ecx
movslq %ecx, %rcx
movsd (%r12,%rcx,8), %xmm0
mulsd 0x10(%rsp), %xmm0
addsd (%r12,%rax,8), %xmm0
movsd %xmm0, (%rsp)
ucomisd 0x10f6(%rip), %xmm0     # 0x18040
jne 0x16f4e
jnp 0x16f92
leaq 0x50(%rsp), %rdi
movl %ebp, %esi
callq 0x33e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1367(%rip), %rsi      # 0x182d3
callq 0x3260
movq %r15, %rdi
movsd (%rsp), %xmm0
callq 0x33b0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2716(%rip), %rsi      # 0x196a3
callq 0x3260
incl %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
testb $0x1, %r14b
jne 0x16faf
ucomisd 0x8(%rsp), %xmm0
jbe 0x16f17
jmp 0x17018
ucomisd 0x8(%rsp), %xmm0
jbe 0x16f17
movl %ebp, %eax
movsd (%r12,%rax,8), %xmm1
xorpd %xmm0, %xmm0
movsd %xmm1, (%rsp)
ucomisd %xmm0, %xmm1
jne 0x16fd4
jnp 0x17018
leaq 0x50(%rsp), %rdi
movl %ebp, %esi
callq 0x33e0
movq %rax, %rbx
leaq 0x12e9(%rip), %rsi      # 0x182d3
movl $0x1, %edx
movq %rax, %rdi
callq 0x3260
movq %rbx, %rdi
movsd (%rsp), %xmm0
callq 0x33b0
leaq 0x2698(%rip), %rsi      # 0x196a3
movl $0x1, %edx
movq %rax, %rdi
callq 0x3260
leaq 0x58(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x33a0
leaq 0x30(%rsp), %r14
movq -0x10(%r14), %rbx
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x31f0
cmpq %r14, %rbx
je 0x17052
movq 0x30(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x3220
movq 0x6f5f(%rip), %rsi      # 0x1dfb8
leaq 0x40(%rsp), %rdi
callq 0x3150
leaq 0xc0(%rsp), %rdi
callq 0x30c0
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2987(%rip), %rdi      # 0x19a10
movl %r14d, %esi
xorl %eax, %eax
callq 0x3050
movl $0x1, %edi
callq 0x32a0
jmp 0x170a3
jmp 0x170a3
jmp 0x170a3
movq %rax, %rbx
movq 0x6f0b(%rip), %rsi      # 0x1dfb8
leaq 0x40(%rsp), %rdi
callq 0x3150
leaq 0xc0(%rsp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x33f0