// File: jamesliu516[P]amrdg2d/wall4amrdg2013.cpp
// Function: computeCL_Cd(int)
void computeCL_Cd(int ni)
{
    int i;
    ofstream clcd_f;
    string str_T;
    str_T=str0+"CL_CD.out";
    if(ni==0) clcd_f.open(str_T.c_str());
    else clcd_f.open(str_T.c_str(), ofstream::app);
    /*
       double sum_fx=0.0;
       double sum_fy=0.0;

       for(i=0;i<NPOINTCIRCLE;i++)
       {
       sum_fx += Company[i].normS[0] * Company[i].pre;
       sum_fy += Company[i].normS[1] * Company[i].pre;
       }

       CL = 2.0*sum_fy;
       Cd = 2.0*sum_fx;
       */

    double fn[N_BODY+1]={0.0};
    double ft[N_BODY+1]={0.0};
    //	double angleA=AOA*PI/180.0;
    for(int wy=0;wy<N_BODY;++wy){
        for(i=0;i<NWallPts[wy];i++)
        {
            ft[wy] -= MultiCompany[wy][i].normS[0]
                * MultiCompany[wy][i].cp;
            fn[wy] -= MultiCompany[wy][i].normS[1] * MultiCompany[wy][i].cp;
        }
        //	CL =(fn*cos(angleA)-ft*sin(angleA));
        //  Cd =(fn*sin(angleA)+ft*cos(angleA));
        //	CL=fn[wy];
        //	Cd=ft[wy];
        cout<<"CL= "<<fn[wy]<<", Cd= "
            <<ft[wy]<<"  "<<"vor_sum= "<<sumVorM;
        clcd_f<<setw(15)<<fn[wy]<<setw(15)<<ft[wy]<<setw(15)<<sumVorM;
    }
    cout<<"\n";
    clcd_f<<"\n";
    clcd_f.close();
}

// Assembly:
subq $0x308, %rsp            # imm = 0x308
movl %edi, 0x304(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x3410
leaq 0xe0(%rsp), %rdi
callq 0x3380
leaq 0x23181(%rip), %rsi     # 0x50930
leaq 0x120d5(%rip), %rdx     # 0x3f88b
leaq 0xc0(%rsp), %rdi
callq 0x114c0
jmp 0x2d7c5
leaq 0xe0(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x3320
leaq 0xc0(%rsp), %rdi
callq 0x34d8
cmpl $0x0, 0x304(%rsp)
jne 0x2d84a
leaq 0xe0(%rsp), %rdi
callq 0x3110
movq %rax, %rsi
leaq 0x100(%rsp), %rdi
movl $0x10, %edx
callq 0x3050
jmp 0x2d815
jmp 0x2d870
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb8(%rsp)
movl %eax, 0xb4(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x34d8
leaq 0x100(%rsp), %rdi
callq 0x33b0
jmp 0x2dc3f
leaq 0xe0(%rsp), %rdi
callq 0x3110
movq %rax, %rsi
leaq 0x100(%rsp), %rdi
movl $0x1, %edx
callq 0x3050
jmp 0x2d86e
jmp 0x2d870
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3150
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3150
movl $0x0, 0x8c(%rsp)
cmpl $0x1, 0x8c(%rsp)
jge 0x2dbe3
movl $0x0, 0x300(%rsp)
movl 0x300(%rsp), %eax
movslq 0x8c(%rsp), %rdx
leaq 0x1d9be(%rip), %rcx     # 0x4b290
cmpl (%rcx,%rdx,4), %eax
jge 0x2da19
movslq 0x8c(%rsp), %rax
imulq $0x6d60, %rax, %rax     # imm = 0x6D60
leaq 0x2322f(%rip), %rdi     # 0x50b20
addq %rax, %rdi
movslq 0x300(%rsp), %rax
imulq $0x38, %rax, %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x1e9b0
movq %rax, 0x78(%rsp)
jmp 0x2d911
movq 0x78(%rsp), %rax
movsd (%rax), %xmm1
movslq 0x8c(%rsp), %rax
imulq $0x6d60, %rax, %rcx     # imm = 0x6D60
leaq 0x231f0(%rip), %rdi     # 0x50b20
movq %rdi, %rdx
addq %rcx, %rdx
movslq 0x300(%rsp), %rcx
imulq $0x38, %rcx, %rcx
movsd 0x20(%rcx,%rdx), %xmm2
movsd 0x90(%rsp,%rax,8), %xmm0
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rsp,%rax,8)
movslq 0x8c(%rsp), %rax
imulq $0x6d60, %rax, %rax     # imm = 0x6D60
addq %rax, %rdi
movslq 0x300(%rsp), %rax
imulq $0x38, %rax, %rax
addq %rax, %rdi
movl $0x1, %esi
callq 0x1e9b0
movq %rax, 0x70(%rsp)
jmp 0x2d994
movq 0x70(%rsp), %rax
movsd (%rax), %xmm0
movslq 0x8c(%rsp), %rcx
leaq 0x23174(%rip), %rax     # 0x50b20
imulq $0x6d60, %rcx, %rcx     # imm = 0x6D60
addq %rcx, %rax
movslq 0x300(%rsp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm2
movslq 0x8c(%rsp), %rax
movsd 0xa0(%rsp,%rax,8), %xmm1
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rsp,%rax,8)
movl 0x300(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x300(%rsp)
jmp 0x2d8bc
movq 0x1d5b0(%rip), %rdi     # 0x4afd0
leaq 0x11e6e(%rip), %rsi     # 0x3f895
callq 0x3240
movq %rax, 0x68(%rsp)
jmp 0x2da33
movq 0x68(%rsp), %rdi
movslq 0x8c(%rsp), %rax
movsd 0xa0(%rsp,%rax,8), %xmm0
callq 0x3480
movq %rax, 0x60(%rsp)
jmp 0x2da55
movq 0x60(%rsp), %rdi
leaq 0x11e39(%rip), %rsi     # 0x3f89a
callq 0x3240
movq %rax, 0x58(%rsp)
jmp 0x2da6d
movq 0x58(%rsp), %rdi
movslq 0x8c(%rsp), %rax
movsd 0x90(%rsp,%rax,8), %xmm0
callq 0x3480
movq %rax, 0x50(%rsp)
jmp 0x2da8f
movq 0x50(%rsp), %rdi
leaq 0x121f2(%rip), %rsi     # 0x3fc8d
callq 0x3240
movq %rax, 0x48(%rsp)
jmp 0x2daa7
movq 0x48(%rsp), %rdi
leaq 0x11dee(%rip), %rsi     # 0x3f8a1
callq 0x3240
movq %rax, 0x40(%rsp)
jmp 0x2dabf
movq 0x40(%rsp), %rdi
leaq 0x22ef5(%rip), %rax     # 0x509c0
movsd (%rax), %xmm0
callq 0x3480
jmp 0x2dad6
movl $0xf, %edi
callq 0x11460
movl %eax, 0x3c(%rsp)
jmp 0x2dae6
movl 0x3c(%rsp), %eax
movl %eax, 0x88(%rsp)
movl 0x88(%rsp), %esi
leaq 0x100(%rsp), %rdi
callq 0x32f0
movq %rax, 0x30(%rsp)
jmp 0x2db0c
movq 0x30(%rsp), %rdi
movslq 0x8c(%rsp), %rax
movsd 0xa0(%rsp,%rax,8), %xmm0
callq 0x3480
movq %rax, 0x28(%rsp)
jmp 0x2db2e
movl $0xf, %edi
callq 0x11460
movl %eax, 0x24(%rsp)
jmp 0x2db3e
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %eax
movl %eax, 0x84(%rsp)
movl 0x84(%rsp), %esi
callq 0x32f0
movq %rax, 0x18(%rsp)
jmp 0x2db61
movq 0x18(%rsp), %rdi
movslq 0x8c(%rsp), %rax
movsd 0x90(%rsp,%rax,8), %xmm0
callq 0x3480
movq %rax, 0x10(%rsp)
jmp 0x2db83
movl $0xf, %edi
callq 0x11460
movl %eax, 0xc(%rsp)
jmp 0x2db93
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %eax
movl %eax, 0x80(%rsp)
movl 0x80(%rsp), %esi
callq 0x32f0
movq %rax, (%rsp)
jmp 0x2dbb5
movq (%rsp), %rdi
leaq 0x22e00(%rip), %rax     # 0x509c0
movsd (%rax), %xmm0
callq 0x3480
jmp 0x2dbcb
jmp 0x2dbcd
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0x2d8a3
movq 0x1d3e6(%rip), %rdi     # 0x4afd0
leaq 0x116f9(%rip), %rsi     # 0x3f2ea
callq 0x3240
jmp 0x2dbf8
leaq 0x116eb(%rip), %rsi     # 0x3f2ea
leaq 0x100(%rsp), %rdi
callq 0x3240
jmp 0x2dc0e
leaq 0x100(%rsp), %rdi
callq 0x3390
jmp 0x2dc1d
leaq 0xe0(%rsp), %rdi
callq 0x34d8
leaq 0x100(%rsp), %rdi
callq 0x33b0
addq $0x308, %rsp            # imm = 0x308
retq
movq 0xb8(%rsp), %rdi
callq 0x3440
nopl (%rax)