// File: thierry7100[P]CutOptim/src/SvgDoc.cpp
// Function: SvgDoc::BreakLongerEdges(double, double)
void SvgDoc::BreakLongerEdges(double max_length, double Diff)
{
    int nShape, nPath;

    if ( debug_level > 0 )
    {
        OutDebug << "---------------- Entering BreakLongerEdges, elapsed time: " <<  1000.0*(clock() - StartClock)/CLOCKS_PER_SEC << "ms\n";
    }
    nShape = 0;
    if ( SvgData == NULL ) return;
	for (NSVGshape *shape = SvgData->shapes; shape != NULL; shape = shape->next, nShape++)
	{
        nPath = 0;
        //  Transform each large polygon to add vertices when edges are too long
		for (NSVGpath *path = shape->paths; path != NULL; path = path->next, nPath++)
		{
            if ( path->LargePolygon == NULL )
            {
                OutDebug << " Shape " << shape->id << " Index " << nShape << " Path " << nPath << " has no large polygon\n";
                continue;
            }
            path->LargePolygon->BreakLongerEdges(max_length, Diff);
            if ( debug_level > 1 )
            {
                OutDebug << " Shape " << shape->id << " Index " << nShape << " Path " << nPath << " Large polygon with " << path->LargePolygon->nVertices << " vertices and area " << path->LargePolygon->area() << "mm²\n";
            }
		}
	}
    if ( debug_level > 0 )
    {
        OutDebug << "---------------- Exit BreakLongerEdges, elapsed time: " <<  1000.0*(clock() - StartClock)/CLOCKS_PER_SEC << "ms\n\n\n" << std::flush;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0x60(%rax)
jle 0x6b191
movq -0x38(%rbp), %rdi
addq $0x68, %rdi
leaq 0x197b7(%rip), %rsi     # 0x848fa
callq 0x9530
movq %rax, -0x40(%rbp)
callq 0x93c0
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rdi
subq 0x268(%rcx), %rax
cvtsi2sd %rax, %xmm1
movsd 0x1900b(%rip), %xmm0    # 0x84178
mulsd %xmm1, %xmm0
movsd 0x18ff7(%rip), %xmm1    # 0x84170
divsd %xmm1, %xmm0
callq 0x9a30
movq %rax, %rdi
leaq 0x1967a(%rip), %rsi     # 0x84806
callq 0x9530
movq -0x38(%rbp), %rax
movl $0x0, -0x1c(%rbp)
cmpq $0x0, 0x8(%rax)
jne 0x6b1a8
jmp 0x6b3db
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6b365
movl $0x0, -0x20(%rbp)
movq -0x28(%rbp), %rax
movq 0xf0(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x6b346
movq -0x30(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jne 0x6b257
movq -0x38(%rbp), %rdi
addq $0x68, %rdi
leaq 0x19349(%rip), %rsi     # 0x84547
callq 0x9530
movq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x9530
movq %rax, %rdi
leaq 0x1971c(%rip), %rsi     # 0x84935
callq 0x9530
movq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0x9930
movq %rax, %rdi
leaq 0x1a02c(%rip), %rsi     # 0x8525f
callq 0x9530
movq %rax, %rdi
movl -0x20(%rbp), %esi
callq 0x9930
movq %rax, %rdi
leaq 0x196f0(%rip), %rsi     # 0x8493d
callq 0x9530
jmp 0x6b32c
movq -0x30(%rbp), %rax
movq 0x68(%rax), %rdi
movsd -0x10(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
callq 0x630f0
movq -0x38(%rbp), %rax
cmpl $0x1, 0x60(%rax)
jle 0x6b32a
movq -0x38(%rbp), %rdi
addq $0x68, %rdi
leaq 0x192bc(%rip), %rsi     # 0x84547
callq 0x9530
movq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x9530
movq %rax, %rdi
leaq 0x1968f(%rip), %rsi     # 0x84935
callq 0x9530
movq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0x9930
movq %rax, %rdi
leaq 0x19f9f(%rip), %rsi     # 0x8525f
callq 0x9530
movq %rax, %rdi
movl -0x20(%rbp), %esi
callq 0x9930
movq %rax, %rdi
leaq 0x1967a(%rip), %rsi     # 0x84954
callq 0x9530
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x68(%rax), %rax
movl 0x8(%rax), %esi
callq 0x9930
movq %rax, %rdi
leaq 0x19568(%rip), %rsi     # 0x84864
callq 0x9530
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x5ed10
movq -0x48(%rbp), %rdi
callq 0x9a30
movq %rax, %rdi
leaq 0x1936b(%rip), %rsi     # 0x84690
callq 0x9530
jmp 0x6b32c
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x6b1d9
jmp 0x6b348
movq -0x28(%rbp), %rax
movq 0xf8(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6b1b8
movq -0x38(%rbp), %rax
cmpl $0x0, 0x60(%rax)
jle 0x6b3db
movq -0x38(%rbp), %rdi
addq $0x68, %rdi
leaq 0x195eb(%rip), %rsi     # 0x84969
callq 0x9530
movq %rax, -0x50(%rbp)
callq 0x93c0
movq -0x38(%rbp), %rcx
movq -0x50(%rbp), %rdi
subq 0x268(%rcx), %rax
cvtsi2sd %rax, %xmm1
movsd 0x18dd0(%rip), %xmm0    # 0x84178
mulsd %xmm1, %xmm0
movsd 0x18dbc(%rip), %xmm1    # 0x84170
divsd %xmm1, %xmm0
callq 0x9a30
movq %rax, %rdi
leaq 0x1952d(%rip), %rsi     # 0x848f4
callq 0x9530
movq %rax, %rdi
movq 0x4cbc2(%rip), %rsi     # 0xb7f98
callq 0x9590
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)