// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x430d
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x4312
jmp 0x4598
movl $0x14, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0xc(%rbp), %eax
jl 0x4331
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0xc(%rbp), %eax
jge 0x4336
jmp 0x4598
movq 0x71c3(%rip), %rdi      # 0xb500
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
movl $0x1, %r8d
callq 0x2470
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x436d
jmp 0x4598
movq 0x718c(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x22f0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x43ac
movq 0x716b(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
callq 0x2420
movq -0x20(%rbp), %rdi
callq 0x21b0
jmp 0x4598
movq 0x714d(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %r9d
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
xorl %r8d, %r8d
movl %r8d, %ecx
movl %eax, (%rsp)
callq 0x2200
movq 0x7121(%rip), %rdi      # 0xb500
movq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0x21f0
movq 0x710c(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0xc(%rbp), %r9d
movl -0xc(%rbp), %eax
xorl %r8d, %r8d
movl %r8d, %ecx
movl %eax, (%rsp)
movl $0x1680, 0x8(%rsp)      # imm = 0x1680
movl $0x1680, 0x10(%rsp)     # imm = 0x1680
callq 0x21d0
movq 0x70d8(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0xc(%rbp), %ecx
subl $0x1, %ecx
movl -0xc(%rbp), %r9d
movl -0xc(%rbp), %eax
xorl %r8d, %r8d
movl %eax, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x1680, 0x10(%rsp)     # imm = 0x1680
callq 0x21d0
movq 0x709a(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0xc(%rax), %r8d
subl -0xc(%rbp), %r8d
subl $0x1, %r8d
movl -0xc(%rbp), %r9d
movl -0xc(%rbp), %eax
xorl %ecx, %ecx
movl %eax, (%rsp)
movl $0xffffe980, 0x8(%rsp)  # imm = 0xFFFFE980
movl $0xffffe980, 0x10(%rsp) # imm = 0xFFFFE980
callq 0x21d0
movq 0x705a(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0xc(%rbp), %ecx
subl $0x1, %ecx
movq -0x8(%rbp), %rax
movl 0xc(%rax), %r8d
subl -0xc(%rbp), %r8d
subl $0x1, %r8d
movl -0xc(%rbp), %r9d
movl -0xc(%rbp), %eax
xorl %r10d, %r10d
movl %eax, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0xffffe980, 0x10(%rsp) # imm = 0xFFFFE980
callq 0x21d0
movq 0x700c(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %r9d
subl -0xc(%rbp), %r9d
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl $0xa, %ecx
xorl %r8d, %r8d
movl %eax, (%rsp)
callq 0x2200
movq 0x6fda(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %r9d
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
subl -0xc(%rbp), %eax
xorl %ecx, %ecx
movl $0xa, %r8d
movl %eax, (%rsp)
callq 0x2200
movq 0x6fa9(%rip), %rdi      # 0xb500
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x18(%rbp), %r9
xorl %r8d, %r8d
movl %r8d, %edx
movl %r8d, %ecx
movl $0x0, (%rsp)
callq 0x2380
movq 0x6f81(%rip), %rdi      # 0xb500
movq -0x18(%rbp), %rsi
callq 0x2420
movq 0x6f71(%rip), %rdi      # 0xb500
movq -0x20(%rbp), %rsi
callq 0x2230
addq $0x40, %rsp
popq %rbp
retq
nop