// File: /workspace/github_cpp_makefile_star2_O3/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 0x15169(%rip), %rax     # 0x298a0
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x8b04
leaq 0x91a9(%rip), %rsi      # 0x1d8fb
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 0x14783
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 0xfa58(%rip), %r14      # 0x24200
cmpl $0x0, (%r14)
jle 0x14824
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
leaq 0x152d2(%rip), %rbx     # 0x29a90
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xd1c0
movsd (%rax), %xmm0
movaps %xmm0, 0x60(%rsp)
movsd 0x20(%rbx), %xmm0
movapd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd1c0
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 0x147c1
jmp 0x1482d
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
movq 0xf794(%rip), %rdi      # 0x23fc8
leaq 0x90ca(%rip), %rsi      # 0x1d905
movl $0x4, %edx
callq 0x3250
movapd (%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movq 0xf773(%rip), %rdi      # 0x23fc8
movapd %xmm0, 0x10(%rsp)
callq 0x3300
movq %rax, %rbx
leaq 0x90a0(%rip), %rsi      # 0x1d90a
movl $0x6, %edx
movq %rax, %rdi
callq 0x3250
movq %rbx, %rdi
movapd (%rsp), %xmm0
callq 0x3300
movq %rax, %rbx
leaq 0x956f(%rip), %rsi      # 0x1ddfd
movl $0x2, %edx
movq %rax, %rdi
callq 0x3250
leaq 0x906f(%rip), %rsi      # 0x1d911
movl $0x9, %edx
movq %rbx, %rdi
callq 0x3250
leaq 0x1507a(%rip), %r14     # 0x29930
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 0xf6a1(%rip), %rdi      # 0x23fc8
leaq 0x896c(%rip), %rsi      # 0x1d29a
movl $0x1, %edx
callq 0x3250
leaq 0x895b(%rip), %rsi      # 0x1d29a
leaq 0x78(%rsp), %rdi
movl $0x1, %edx
callq 0x3250
leaq 0x78(%rsp), %rdi
callq 0x32a0
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x1496f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0xf642(%rip), %rax      # 0x23fb8
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 0x149d7
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x149da
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3220
jmp 0x149da
jmp 0x149d7
jmp 0x149d7
jmp 0x149d7
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x149f1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0x78(%rsp), %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x3370