// File: /workspace/github_c_makefile_star2_O1/veltzer[P]xmeltdown/src/xmeltdown.c
// Function: do_planes
void do_planes() {
	int over=0;
	int finished=0;
	int width, xloc, yloc, dist, size, i;
	short** heights;

	heights=(short **) malloc(DisplayPlanes(dpy, screen));
	for (i=0; i < DisplayPlanes(dpy, screen); i++) {
		heights[i]=(short *) calloc(sizeof(short),
			DisplayWidth(dpy, screen));
	}
	while (!over) {
		depth=rnd(DisplayPlanes(dpy, screen));
		width=rnd(MIN_WIDTH)+WIDTH_ADD;

		xloc=calc_xloc(width);

		yloc=DisplayHeight(dpy, screen);
		for (i=xloc; i < (xloc+width); i++) {
			yloc=min(yloc, heights[depth][i]);
		}
		if (yloc == DisplayHeight(dpy, screen))
			continue;
		dist=rnd(yloc/10+MIN_DIST);
		size=rnd(max(yloc+MIN_SIZE, MAX_SIZE));

		XSetPlaneMask(dpy, copygc, 1<<depth);
		XSetPlaneMask(dpy, fillgc, 1<<depth);
		XCopyArea(dpy, win, win, copygc,
			xloc, yloc,
			width, size,
			xloc, yloc+dist);
		XFillRectangle(dpy, win, fillgc,
			xloc, yloc,
			width, dist);
		yloc+=dist;
		for (i=xloc; i < (xloc+width); i++) {
			if ((heights[depth][i] < (DisplayHeight(dpy, screen)-MIN_SIZE)) && (yloc >= (DisplayHeight(dpy, screen)-MIN_SIZE)))
				finished++;
			heights[depth][i]=max(heights[depth][i], yloc);
		}
		if (finished >= (DisplayWidth(dpy, screen)-FINISHED)) {
			XSync(dpy, 0);
			over=1;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x2bd5(%rip), %rax      # 0x40c0
movq 0xe8(%rax), %r14
movslq 0x2bcf(%rip), %r15      # 0x40c8
shlq $0x7, %r15
movslq 0x38(%r14,%r15), %rdi
callq 0x1050
movq %rax, %r12
movslq 0x38(%r14,%r15), %rbx
testq %rbx, %rbx
jle 0x1537
addq %r15, %r14
movslq 0x18(%r14), %r14
xorl %r15d, %r15d
movl $0x2, %edi
movq %r14, %rsi
callq 0x1110
movq %rax, (%r12,%r15,8)
incq %r15
cmpq %r15, %rbx
jne 0x151e
movl $0x0, 0x8(%rsp)
xorl %ebp, %ebp
movq %r12, %rbx
movq %r12, 0x10(%rsp)
callq 0x1130
movq 0x2b6b(%rip), %rcx      # 0x40c0
movq 0xe8(%rcx), %rcx
movslq 0x2b65(%rip), %rdx      # 0x40c8
shlq $0x7, %rdx
movslq 0x38(%rcx,%rdx), %rcx
cqto
idivq %rcx
movl %edx, 0x2b71(%rip)      # 0x40e8
callq 0x1130
movq %rax, %rcx
movabsq $-0x7777777777777777, %rdx # imm = 0x8888888888888889
imulq %rdx
movq %rdx, %r14
addq %rcx, %r14
movq %r14, %rax
shrq $0x3f, %rax
sarq $0x4, %r14
addq %rax, %r14
movq %r14, %rax
shlq $0x5, %rax
addq %r14, %r14
subq %rax, %r14
addq %rcx, %r14
leal 0x14(%r14), %r15d
callq 0x1130
movq 0x2b00(%rip), %rcx      # 0x40c0
movq 0xe8(%rcx), %rcx
movslq 0x2afa(%rip), %rsi      # 0x40c8
shlq $0x7, %rsi
movslq 0x18(%rcx,%rsi), %rdi
movq %rdi, %r8
addq $0x1e, %r8
cqto
idivq %r8
movl %edx, %r12d
addl $-0x1e, %r12d
movl %edi, %eax
subl %r15d, %eax
testl %r12d, %r12d
movl $0x0, %r8d
cmovlel %r8d, %r12d
addl %r14d, %edx
addl $-0xa, %edx
cmpl %edi, %edx
cmovgl %eax, %r12d
movl 0x1c(%rcx,%rsi), %eax
leal (%r12,%r14), %r8d
addl $0x14, %r8d
movl %eax, %r13d
cmpq $-0x13, %r14
jl 0x1644
movslq 0x2ac4(%rip), %rcx      # 0x40e8
movq (%rbx,%rcx,8), %rcx
movslq %r12d, %rdx
movslq %r8d, %rsi
movl %eax, %r13d
movswl (%rcx,%rdx,2), %edi
cmpl %edi, %r13d
cmovgel %edi, %r13d
incq %rdx
cmpq %rsi, %rdx
jl 0x1631
cmpl %eax, %r13d
je 0x1549
movl %r8d, 0xc(%rsp)
callq 0x1130
movslq %r13d, %rcx
imulq $0x66666667, %rcx, %rcx # imm = 0x66666667
movq %rcx, %rdx
sarq $0x22, %rdx
shrq $0x3f, %rcx
addl %edx, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
cqto
idivq %rcx
movq %rdx, 0x18(%rsp)
callq 0x1130
cmpl $0x5b, %r13d
movl $0x5a, %ecx
cmovgel %r13d, %ecx
addl $0xa, %ecx
cqto
idivq %rcx
movq %rdx, 0x20(%rsp)
movb 0x2a45(%rip), %cl       # 0x40e8
movl $0x1, %eax
shll %cl, %eax
movq 0x2a0f(%rip), %rdi      # 0x40c0
movq 0x2a20(%rip), %rsi      # 0x40d8
movslq %eax, %rdx
callq 0x1120
movq 0x29f9(%rip), %rdi      # 0x40c0
movq 0x2a12(%rip), %rsi      # 0x40e0
movb 0x2a14(%rip), %cl       # 0x40e8
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rdx
callq 0x1120
movq 0x29d6(%rip), %rdi      # 0x40c0
movq 0x29df(%rip), %rdx      # 0x40d0
movq 0x29e0(%rip), %rcx      # 0x40d8
movq 0x18(%rsp), %rax
leal (%r13,%rax), %ebx
movq %rdx, %rsi
movl %r12d, %r8d
movl %r13d, %r9d
pushq %rbx
pushq %r12
pushq 0x30(%rsp)
pushq %r15
callq 0x10a0
addq $0x20, %rsp
movq 0x299c(%rip), %rdi      # 0x40c0
movq 0x29a5(%rip), %rsi      # 0x40d0
movq 0x29ae(%rip), %rdx      # 0x40e0
subq $0x8, %rsp
movl %r12d, %ecx
movl %r13d, %r8d
movl %r15d, %r9d
pushq 0x20(%rsp)
callq 0x10b0
addq $0x10, %rsp
cmpq $-0x13, %r14
jl 0x17b9
movslq 0x298f(%rip), %rax      # 0x40e8
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rax
movq 0x2957(%rip), %rcx      # 0x40c0
movq 0xe8(%rcx), %rcx
movslq 0x2951(%rip), %rdx      # 0x40c8
shlq $0x7, %rdx
movl 0x1c(%rcx,%rdx), %ecx
addl $-0xa, %ecx
movslq %r12d, %rdx
movslq 0xc(%rsp), %rsi
cmpl %ecx, %ebx
setge %dil
movswl (%rax,%rdx,2), %r8d
cmpl %r8d, %ecx
setg %r9b
andb %dil, %r9b
movzbl %r9b, %edi
addl %edi, %ebp
cmpl %r8d, %ebx
cmovgel %ebx, %r8d
movw %r8w, (%rax,%rdx,2)
incq %rdx
cmpq %rsi, %rdx
jl 0x178a
movq 0x2900(%rip), %rdi      # 0x40c0
movq 0xe8(%rdi), %rax
movslq 0x28fa(%rip), %rcx      # 0x40c8
shlq $0x7, %rcx
movl 0x18(%rax,%rcx), %eax
addl $-0x32, %eax
cmpl %eax, %ebp
jl 0x17ec
xorl %esi, %esi
callq 0x1100
movl $0x1, 0x8(%rsp)
cmpl $0x0, 0x8(%rsp)
movq 0x10(%rsp), %rbx
je 0x1549
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq