// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movl %edi, %ebx
leaq 0x78(%rsp), %rdi
callq 0x3340
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x15ac6(%rip), %rax     # 0x2a8a0
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x8c58
leaq 0x9b26(%rip), %rsi      # 0x1e91b
leaq 0x20(%rsp), %rdi
callq 0x3390
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %r14
movq %r14, %rsi
callq 0x3270
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x14e26
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3220
testl %ebx, %ebx
movq 0x40(%rsp), %rsi
movl $0x10, %eax
movl $0x1, %edx
cmovel %eax, %edx
leaq 0x78(%rsp), %rdi
callq 0x3050
leaq 0x103b5(%rip), %r14     # 0x25200
cmpl $0x0, (%r14)
jle 0x14ec7
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
leaq 0x15c2f(%rip), %rbx     # 0x2aa90
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xd506
movsd (%rax), %xmm0
movaps %xmm0, 0x60(%rsp)
movsd 0x20(%rbx), %xmm0
movapd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd506
movapd 0x60(%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 %r12
movslq (%r14), %rax
addq $0x38, %rbx
cmpq %rax, %r12
jl 0x14e64
jmp 0x14ed0
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq 0x100f1(%rip), %rdi     # 0x24fc8
leaq 0x9a47(%rip), %rsi      # 0x1e925
movl $0x4, %edx
callq 0x3250
movapd (%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movq 0x100d0(%rip), %rdi     # 0x24fc8
movapd %xmm0, 0x10(%rsp)
callq 0x3300
movq %rax, %rbx
leaq 0x9a1d(%rip), %rsi      # 0x1e92a
movl $0x6, %edx
movq %rax, %rdi
callq 0x3250
movq %rbx, %rdi
movapd (%rsp), %xmm0
callq 0x3300
movq %rax, %rbx
leaq 0x9ec4(%rip), %rsi      # 0x1edf5
movl $0x2, %edx
movq %rax, %rdi
callq 0x3250
leaq 0x99ec(%rip), %rsi      # 0x1e931
movl $0x9, %edx
movq %rbx, %rdi
callq 0x3250
leaq 0x159d7(%rip), %r14     # 0x2a930
movsd (%r14), %xmm0
movq %rbx, %rdi
callq 0x3300
leaq 0x78(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0xf, 0x88(%rsp,%rax)
movapd 0x10(%rsp), %xmm0
callq 0x3300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0xf, 0x10(%rax,%rcx)
movq %rax, %rdi
movapd (%rsp), %xmm0
callq 0x3300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0xf, 0x10(%rax,%rcx)
movsd (%r14), %xmm0
movq %rax, %rdi
callq 0x3300
movq 0xfffe(%rip), %rdi      # 0x24fc8
leaq 0x92e9(%rip), %rsi      # 0x1e2ba
movl $0x1, %edx
callq 0x3250
leaq 0x92d8(%rip), %rsi      # 0x1e2ba
leaq 0x78(%rsp), %rdi
movl $0x1, %edx
callq 0x3250
leaq 0x78(%rsp), %rdi
callq 0x32a0
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x15012
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0xff9f(%rip), %rax      # 0x24fb8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x80(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x78(%rsp,%rcx)
callq 0x31d0
leaq 0x170(%rsp), %rdi
callq 0x30b0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1507a
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x1507d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3220
jmp 0x1507d
jmp 0x1507a
jmp 0x1507a
jmp 0x1507a
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x15094
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0x78(%rsp), %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x3370