// File: /workspace/github_cpp_makefile_star2_O1/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, %r13d
movl %esi, %ebp
movq %rdi, %r15
leaq 0x40(%rsp), %rdi
movl $0x18, %esi
callq 0x3150
leaq 0x50(%rsp), %rdi
movl %ebp, %esi
callq 0x33d0
leaq 0x254f(%rip), %rsi      # 0x17633
movl $0x1, %edx
movq %rax, %rdi
callq 0x3250
cmpb $0x61, %bl
je 0x150fc
xorpd %xmm0, %xmm0
jmp 0x15104
movsd 0x216c(%rip), %xmm0     # 0x17270
movsd %xmm0, 0x10(%rsp)
cmpb $0x73, %bl
jne 0x1511d
movsd 0x2151(%rip), %xmm0     # 0x17268
movsd %xmm0, 0x10(%rsp)
cmpb $0x66, %bl
jne 0x151e1
movl 0x208(%rsp), %ebp
movl 0x200(%rsp), %ecx
cmpl %ebp, %r13d
jne 0x1536e
testl %ecx, %ecx
jle 0x15304
movl %ecx, %r13d
movl %ebp, %ebx
xorl %r12d, %r12d
xorpd %xmm1, %xmm1
testl %ebp, %ebp
jle 0x15178
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rax
xorl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm0
mulsd 0x8(%r15,%rcx,8), %xmm0
incq %rcx
addsd %xmm0, %xmm1
cmpq %rcx, %rbx
jne 0x15160
movsd %xmm1, (%rsp)
ucomisd 0xe8b(%rip), %xmm1      # 0x16010
jne 0x15189
jnp 0x151d0
leal 0x1(%r12), %esi
leaq 0x50(%rsp), %rdi
callq 0x33d0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x10fb(%rip), %rsi      # 0x162a5
callq 0x3250
movq %r14, %rdi
movsd (%rsp), %xmm0
callq 0x33a0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2468(%rip), %rsi      # 0x17633
callq 0x3250
incq %r12
cmpq %r13, %r12
jne 0x1514d
jmp 0x15304
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
leal 0x1(%r13), %r12d
mulsd 0x1edb(%rip), %xmm0     # 0x170d0
movsd %xmm0, 0x8(%rsp)
movl $0x1, %ebp
movsbl %bl, %ebx
cmpl $0x73, %ebx
je 0x1520d
cmpl $0x61, %ebx
jne 0x15203
movl %ebp, %eax
movl %r12d, %ecx
subl %ebp, %ecx
movslq %ecx, %rcx
movsd (%r15,%rcx,8), %xmm0
mulsd 0x10(%rsp), %xmm0
addsd (%r15,%rax,8), %xmm0
movsd %xmm0, (%rsp)
ucomisd 0xdda(%rip), %xmm0      # 0x16010
jne 0x1523a
jnp 0x1527e
leaq 0x50(%rsp), %rdi
movl %ebp, %esi
callq 0x33d0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x104d(%rip), %rsi      # 0x162a5
callq 0x3250
movq %r14, %rdi
movsd (%rsp), %xmm0
callq 0x33a0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x23ba(%rip), %rsi      # 0x17633
callq 0x3250
incl %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
testb $0x1, %r13b
jne 0x1529b
ucomisd 0x8(%rsp), %xmm0
jbe 0x15203
jmp 0x15304
ucomisd 0x8(%rsp), %xmm0
jbe 0x15203
movl %ebp, %eax
movsd (%r15,%rax,8), %xmm1
xorpd %xmm0, %xmm0
movsd %xmm1, (%rsp)
ucomisd %xmm0, %xmm1
jne 0x152c0
jnp 0x15304
leaq 0x50(%rsp), %rdi
movl %ebp, %esi
callq 0x33d0
movq %rax, %rbx
leaq 0xfcf(%rip), %rsi       # 0x162a5
movl $0x1, %edx
movq %rax, %rdi
callq 0x3250
movq %rbx, %rdi
movsd (%rsp), %xmm0
callq 0x33a0
leaq 0x233c(%rip), %rsi      # 0x17633
movl $0x1, %edx
movq %rax, %rdi
callq 0x3250
leaq 0x58(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x3390
leaq 0x30(%rsp), %r14
movq -0x10(%r14), %rbx
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x31e0
cmpq %r14, %rbx
je 0x1533e
movq 0x30(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x3210
movq 0x5c73(%rip), %rsi      # 0x1afb8
leaq 0x40(%rsp), %rdi
callq 0x3140
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 0x262b(%rip), %rdi      # 0x179a0
movl %r13d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3050
movl $0x1, %edi
callq 0x3290
jmp 0x15391
jmp 0x15391
jmp 0x15391
movq %rax, %rbx
movq 0x5c1d(%rip), %rsi      # 0x1afb8
leaq 0x40(%rsp), %rdi
callq 0x3140
leaq 0xc0(%rsp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x33e0