// File: /workspace/github_c_makefile_star2_O2/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 0x3e90
movq %rdi, %rbx
cmpl $0x0, 0x18(%rdi)
jne 0x3e90
movl 0x8(%rbx), %edx
cmpl $0x14, %edx
jl 0x3e90
movl 0xc(%rbx), %ecx
cmpl $0x14, %ecx
jl 0x3e90
movq 0x5803(%rip), %rdi      # 0x94c0
movq 0x38(%rbx), %rsi
pushq $0x1
popq %r8
callq 0x2480
testq %rax, %rax
je 0x3e90
movq %rax, %r14
movq 0x57e3(%rip), %rdi      # 0x94c0
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x22f0
movq 0x57d0(%rip), %rdi      # 0x94c0
testq %rax, %rax
je 0x3e9f
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
popq %rcx
popq %rdx
movq 0x579f(%rip), %rdi      # 0x94c0
pushq $0x1
popq %rdx
movq %r15, %rsi
callq 0x21f0
movq 0x578d(%rip), %rdi      # 0x94c0
subq $0x8, %rsp
movl $0x1680, %r13d          # imm = 0x1680
pushq $0x14
popq %r12
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl %r12d, %r9d
pushq %r13
pushq %r13
pushq %r12
callq 0x21d0
addq $0x20, %rsp
movq 0x575b(%rip), %rdi      # 0x94c0
movl 0x8(%rbx), %ecx
addl $-0x15, %ecx
subq $0x8, %rsp
movq %r14, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
movl %r12d, %r9d
pushq %r13
pushq $0x0
pushq %r12
callq 0x21d0
addq $0x20, %rsp
movq 0x572f(%rip), %rdi      # 0x94c0
movl 0xc(%rbx), %r8d
addl $-0x15, %r8d
subq $0x8, %rsp
movl $0xffffe980, %r13d      # imm = 0xFFFFE980
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
movl %r12d, %r9d
pushq %r13
pushq %r13
pushq %r12
callq 0x21d0
addq $0x20, %rsp
movq 0x56fc(%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 %r12d, %r9d
pushq %r13
pushq $0x0
pushq %r12
callq 0x21d0
addq $0x20, %rsp
movq 0x56cb(%rip), %rdi      # 0x94c0
movl 0x8(%rbx), %r9d
movl 0xc(%rbx), %eax
addl $-0x14, %r9d
subq $0x8, %rsp
pushq $0xa
popq %rbp
movq %r14, %rsi
movq %r15, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
pushq %rax
callq 0x2200
popq %rcx
popq %rdx
movq 0x569f(%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 %ebp, %r8d
pushq %rax
callq 0x2200
popq %rcx
popq %rdx
movq 0x5677(%rip), %rdi      # 0x94c0
movq 0x38(%rbx), %rsi
subq $0x8, %rsp
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r14, %r9
pushq $0x0
callq 0x2380
popq %rax
popq %rcx
movq 0x5655(%rip), %rdi      # 0x94c0
movq %r14, %rsi
callq 0x2420
movq 0x5646(%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