// File: /workspace/github_c_makefile_star2_O3/gitluin[P]sara/src/sara.c
// Function: roundcorners
void
roundcorners(client *c)
{
	int diam;
	Pixmap mask;
	GC shapegc;

	if (corner_radius < 0)
		return;

	if (!c || c->isfull)
		return;

	diam = 2 * corner_radius;
	if (c->w < diam || c->h < diam)
		return;

	if (!(mask = XCreatePixmap(dis, c->win, c->w, c->h, 1)))
		return;
	
	if (!(shapegc = XCreateGC(dis, mask, 0, NULL))){
	    XFreePixmap(dis, mask);
	    free(shapegc);
	    return;
	}

	XFillRectangle(dis, mask, shapegc, 0, 0, c->w, c->h);
	XSetForeground(dis, shapegc, 1);

	/* topleft, topright, bottomleft, bottomright
	 * man XArc - positive is counterclockwise
	 */
	XFillArc(dis, mask, shapegc, 0, 		0, 			diam, diam, 90 * 64, 90 * 64);
	XFillArc(dis, mask, shapegc, c->w - diam - 1, 	0, 			diam, diam, 0 * 64, 90 * 64);
	XFillArc(dis, mask, shapegc, 0,			c->h - diam - 1,	diam, diam, -90 * 64, -90 * 64);
	XFillArc(dis, mask, shapegc, c->w - diam - 1,	c->h - diam - 1,	diam, diam, 0 * 64, -90 * 64);

	XFillRectangle(dis, mask, shapegc, corner_radius, 0, c->w - diam, c->h);
	XFillRectangle(dis, mask, shapegc, 0, corner_radius, c->w, c->h - diam);
	XShapeCombineMask(dis, c->win, ShapeBounding, 0, 0, mask, ShapeSet);
	XFreePixmap(dis, mask);
	XFreeGC(dis, shapegc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4148
movq %rdi, %rbx
cmpl $0x0, 0x18(%rdi)
jne 0x4148
movl 0x8(%rbx), %edx
cmpl $0x14, %edx
jl 0x4148
movl 0xc(%rbx), %ecx
cmpl $0x14, %ecx
jl 0x4148
movq 0x5563(%rip), %rdi      # 0x94c0
movq 0x38(%rbx), %rsi
movl $0x1, %r8d
callq 0x2480
testq %rax, %rax
je 0x4148
movq %rax, %r14
movq 0x5541(%rip), %rdi      # 0x94c0
xorl %r12d, %r12d
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x22f0
movq 0x552b(%rip), %rdi      # 0x94c0
testq %rax, %rax
je 0x4157
movq %rax, %r15
movl 0x8(%rbx), %r9d
movl 0xc(%rbx), %eax
subq $0x8, %rsp
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
pushq %rax
callq 0x2200
addq $0x10, %rsp
movq 0x54f8(%rip), %rdi      # 0x94c0
movl $0x1, %edx
movq %r15, %rsi
callq 0x21f0
movq 0x54e4(%rip), %rdi      # 0x94c0
subq $0x8, %rsp
movl $0x1680, %ebp           # imm = 0x1680
movl $0x14, %r13d
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl $0x14, %r9d
pushq %rbp
pushq %rbp
pushq %r13
callq 0x21d0
addq $0x20, %rsp
movq 0x54b0(%rip), %rdi      # 0x94c0
movl 0x8(%rbx), %ecx
addl $-0x15, %ecx
subq $0x8, %rsp
movq %r14, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
movl $0x14, %r9d
pushq %rbp
pushq %r12
pushq %r13
callq 0x21d0
addq $0x20, %rsp
movq 0x5482(%rip), %rdi      # 0x94c0
movl 0xc(%rbx), %r8d
addl $-0x15, %r8d
subq $0x8, %rsp
movl $0xffffe980, %ebp       # imm = 0xFFFFE980
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
movl $0x14, %r9d
pushq %rbp
pushq %rbp
pushq %r13
callq 0x21d0
addq $0x20, %rsp
movq 0x544f(%rip), %rdi      # 0x94c0
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %r8d
addl $-0x15, %ecx
addl $-0x15, %r8d
subq $0x8, %rsp
movq %r14, %rsi
movq %r15, %rdx
movl $0x14, %r9d
pushq %rbp
pushq %r12
pushq %r13
callq 0x21d0
addq $0x20, %rsp
movq 0x541c(%rip), %rdi      # 0x94c0
movl 0x8(%rbx), %r9d
movl 0xc(%rbx), %eax
addl $-0x14, %r9d
subq $0x8, %rsp
movq %r14, %rsi
movq %r15, %rdx
movl $0xa, %ecx
xorl %r8d, %r8d
pushq %rax
callq 0x2200
addq $0x10, %rsp
movq 0x53ee(%rip), %rdi      # 0x94c0
movl 0x8(%rbx), %r9d
movl 0xc(%rbx), %eax
addl $-0x14, %eax
subq $0x8, %rsp
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
movl $0xa, %r8d
pushq %rax
callq 0x2200
addq $0x10, %rsp
movq 0x53c1(%rip), %rdi      # 0x94c0
movq 0x38(%rbx), %rsi
subq $0x8, %rsp
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r14, %r9
pushq %r12
callq 0x2380
addq $0x10, %rsp
movq 0x539d(%rip), %rdi      # 0x94c0
movq %r14, %rsi
callq 0x2420
movq 0x538e(%rip), %rdi      # 0x94c0
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2230
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2420