// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movl %edi, %ebx
leaq 0x78(%rsp), %rdi
callq 0x3320
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x15b5f(%rip), %rsi     # 0x288a0
leaq 0x8be3(%rip), %rdx      # 0x1b92b
leaq 0x58(%rsp), %rdi
callq 0x844d
leaq 0x38(%rsp), %r14
leaq 0x58(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3240
movq %r15, %rdi
callq 0x33b8
testl %ebx, %ebx
movq (%r14), %rsi
pushq $0x10
popq %rax
pushq $0x1
popq %rdx
cmovel %eax, %edx
leaq 0x78(%rsp), %rdi
callq 0x3040
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
leaq 0x15cf9(%rip), %rbx     # 0x28a90
xorl %r14d, %r14d
leaq 0x1045f(%rip), %r15     # 0x23200
pushq $0x1
popq %rbp
movslq (%r15), %rax
cmpq %rax, %r14
jge 0x12e04
movq %rbx, %rdi
xorl %esi, %esi
callq 0xc3aa
movsd (%rax), %xmm0
movaps %xmm0, 0x20(%rsp)
movsd 0x20(%rbx), %xmm0
movapd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0xc3aa
movapd 0x20(%rsp), %xmm0
movhpd (%rax), %xmm0           # xmm0 = xmm0[0],mem[0]
movapd 0x10(%rsp), %xmm1
movhpd 0x20(%rbx), %xmm1       # xmm1 = xmm1[0],mem[0]
mulpd %xmm0, %xmm1
movapd (%rsp), %xmm0
subpd %xmm1, %xmm0
movapd %xmm0, (%rsp)
incq %r14
addq $0x38, %rbx
jmp 0x12da4
movq 0x101b5(%rip), %rdi     # 0x22fc0
leaq 0x8b23(%rip), %rsi      # 0x1b935
callq 0x31d0
movapd (%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movq %rax, %rdi
movapd %xmm0, 0x10(%rsp)
callq 0x32e0
leaq 0x8b05(%rip), %rsi      # 0x1b93a
movq %rax, %rdi
callq 0x31d0
movq %rax, %rdi
movapd (%rsp), %xmm0
callq 0x32e0
leaq 0x8f2c(%rip), %rsi      # 0x1bd7d
movq %rax, %rdi
callq 0x31d0
leaq 0x8ae1(%rip), %rsi      # 0x1b941
movq %rax, %rdi
callq 0x31d0
leaq 0x15ac1(%rip), %rbx     # 0x28930
movsd (%rbx), %xmm0
movq %rax, %rdi
callq 0x32e0
leaq 0x78(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x88(%rsp,%rax)
movapd 0x10(%rsp), %xmm0
callq 0x32e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0xf, 0x10(%rax,%rcx)
movq %rax, %rdi
movapd (%rsp), %xmm0
callq 0x32e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0xf, 0x10(%rax,%rcx)
movsd (%rbx), %xmm0
movq %rax, %rdi
callq 0x32e0
movq 0x100e2(%rip), %rdi     # 0x22fc0
leaq 0x8435(%rip), %rsi      # 0x1b31a
callq 0x31d0
leaq 0x8429(%rip), %rsi      # 0x1b31a
leaq 0x78(%rsp), %rdi
callq 0x31d0
leaq 0x78(%rsp), %rdi
callq 0x3280
leaq 0x38(%rsp), %rdi
callq 0x33b8
leaq 0x78(%rsp), %rdi
callq 0x32a0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x12f2f
jmp 0x12f2f
jmp 0x12f2f
jmp 0x12f2f
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x33b8
leaq 0x78(%rsp), %rdi
callq 0x32a0
movq %rbx, %rdi
callq 0x3350