// File: /workspace/github_cpp_makefile_star2_O3/lioncedric[P]cimpressGridCoverage/src/squares.cc
// Function: use_squares(int*, int, int*)
void use_squares(int * puzzle, const int width, int * squares) {
    for (int* ptrSquares = squares; *ptrSquares >= 0; ptrSquares += 3) {
        const int row = *(ptrSquares + 1);
        const int col = *ptrSquares;
        const int square_size = *(ptrSquares + 2);
        const int id = (row) * width + col;
        const int * ptrLineMax = puzzle + col + (row + square_size) * width;
        for (int* ptrLine = puzzle + col + (row) * width; ptrLine < ptrLineMax; ptrLine += width) {
            const int * ptrColMax = ptrLine + square_size;
            for (int* ptrCol = ptrLine; ptrCol < ptrColMax; ++ptrCol) {
                *ptrCol = id;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, -0x2c(%rsp)
movq %rdi, -0x28(%rsp)
movl (%rdx), %ecx
testl %ecx, %ecx
js 0x411b
movslq -0x2c(%rsp), %rax
shlq $0x2, %rax
movq -0x28(%rsp), %rsi
leaq 0x4(%rsi), %rdi
movq %rdi, -0x18(%rsp)
notq %rsi
movq %rsi, -0x20(%rsp)
movq %rax, %rsi
negq %rsi
movq %rsi, -0x8(%rsp)
movdqa 0x114b(%rip), %xmm0     # 0x50a0
movdqa 0x1153(%rip), %xmm1     # 0x50b0
movdqa 0x115b(%rip), %xmm2     # 0x50c0
pcmpeqd %xmm3, %xmm3
movl 0x4(%rdx), %esi
movq %rdx, -0x10(%rsp)
movslq 0x8(%rdx), %r10
leal (%r10,%rsi), %edi
movl -0x2c(%rsp), %edx
imull %edx, %esi
imull %edx, %edi
cmpl %edi, %esi
jge 0x4107
leal (%rsi,%rcx), %r11d
movl %ecx, %ecx
movq -0x28(%rsp), %rdx
leaq (%rdx,%rcx,4), %r8
movslq %edi, %rdi
leaq (%r8,%rdi,4), %rbx
movslq %esi, %rsi
leaq (%r8,%rsi,4), %r14
leaq (%rdx,%r10,4), %rdi
leaq (,%rsi,4), %r13
leaq (%rdi,%rsi,4), %r8
leaq (%r8,%rcx,4), %r15
shlq $0x2, %rcx
leaq (%rcx,%rsi,4), %r12
movq -0x18(%rsp), %rdx
leaq (%r12,%rdx), %r9
movq -0x20(%rsp), %r8
movq %r8, %rbp
subq %r12, %rbp
addq %rdi, %r12
subq %r13, %r8
subq %rcx, %r8
movq %r9, %rcx
xorl %edi, %edi
cmpq %rcx, %r12
movq %rcx, %r13
cmovaq %r12, %r13
testl %r10d, %r10d
jle 0x40ef
addq %r8, %r13
shrq $0x2, %r13
addq $0x4, %r13
andq $-0x4, %r13
movq %rax, %rsi
imulq %rdi, %rsi
leaq (%r15,%rsi), %rdx
addq %r9, %rsi
cmpq %rsi, %rdx
cmovaq %rdx, %rsi
movq -0x8(%rsp), %rdx
imulq %rdi, %rdx
addq %rbp, %rdx
addq %rsi, %rdx
movq %rdx, %xmm4
pshufd $0x44, %xmm4, %xmm4     # xmm4 = xmm4[0,1,0,1]
psrlq $0x2, %xmm4
pxor %xmm2, %xmm4
xorl %esi, %esi
movq %rsi, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm1, %xmm6
pxor %xmm2, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm4, %xmm7
pcmpeqd %xmm4, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x4087
movl %r11d, (%r14,%rsi,4)
pxor %xmm3, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x409a
movl %r11d, 0x4(%r14,%rsi,4)
por %xmm0, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm4, %xmm6
pcmpeqd %xmm4, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm3, %xmm5
pextrw $0x0, %xmm5, %edx
testb $0x1, %dl
je 0x40d3
movl %r11d, 0x8(%r14,%rsi,4)
pextrw $0x4, %xmm5, %edx
testb $0x1, %dl
je 0x40e2
movl %r11d, 0xc(%r14,%rsi,4)
addq $0x4, %rsi
cmpq %rsi, %r13
jne 0x4041
addq %rax, %r14
incq %rdi
addq %rax, %r12
addq %rax, %rcx
subq %rax, %r8
cmpq %rbx, %r14
jb 0x3fe6
movq -0x10(%rsp), %rdx
movl 0xc(%rdx), %ecx
addq $0xc, %rdx
testl %ecx, %ecx
jns 0x3f69
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq