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

	heights=(short *) calloc(sizeof(short), DisplayWidth(dpy, screen));
	over=0;
	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[i]);
		}
		if (yloc == DisplayHeight(dpy, screen))
			continue;
		dist=rnd(yloc/10+MIN_DIST);
		size=rnd(max(yloc+MIN_SIZE, MAX_SIZE));

		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[i] < (DisplayHeight(dpy, screen)-MIN_SIZE)) && (yloc >= (DisplayHeight(dpy, screen)-MIN_SIZE)))
				finished++;
			heights[i]=max(heights[i], yloc);
		}
		if (finished >= (DisplayWidth(dpy, screen)-FINISHED)) {
			XSync(dpy, 0);
			over=1;
		}
		usleep(USLEEP);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x2877(%rip), %rax      # 0x40c0
movq 0xe8(%rax), %rax
movslq 0x2871(%rip), %rcx      # 0x40c8
shlq $0x7, %rcx
movslq 0x18(%rax,%rcx), %rsi
movl $0x2, %edi
callq 0x1110
movq %rax, %rbx
xorl %ebp, %ebp
movl $0x0, 0x8(%rsp)
callq 0x1130
movq 0x283d(%rip), %rcx      # 0x40c0
movq 0xe8(%rcx), %rcx
movslq 0x2837(%rip), %rdx      # 0x40c8
shlq $0x7, %rdx
movslq 0x38(%rcx,%rdx), %rcx
cqto
idivq %rcx
movl %edx, 0x2843(%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 0x27d2(%rip), %rcx      # 0x40c0
movq 0xe8(%rcx), %rcx
movslq 0x27cc(%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
cmovlel %ebp, %r12d
addl %r14d, %edx
addl $-0xa, %edx
cmpl %edi, %edx
cmovgl %eax, %r12d
movl 0x1c(%rcx,%rsi), %eax
leal (%r12,%r14), %edi
addl $0x14, %edi
movl %eax, %r13d
cmpq $-0x13, %r14
jl 0x1960
movslq %r12d, %rcx
movslq %edi, %rdx
movl %eax, %r13d
movswl (%rbx,%rcx,2), %esi
cmpl %esi, %r13d
cmovgel %esi, %r13d
incq %rcx
cmpq %rdx, %rcx
jl 0x194d
cmpl %eax, %r13d
je 0x1877
movl %edi, 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, 0x10(%rsp)
callq 0x1130
cmpl $0x5b, %r13d
movl $0x5a, %ecx
cmovgel %r13d, %ecx
addl $0xa, %ecx
cqto
idivq %rcx
movq %rdx, %rax
movq 0x2703(%rip), %rdi      # 0x40c0
movq 0x270c(%rip), %rdx      # 0x40d0
movq 0x270d(%rip), %rcx      # 0x40d8
movq 0x10(%rsp), %rsi
leal (%r13,%rsi), %ebp
movq %rdx, %rsi
movl %r12d, %r8d
movl %r13d, %r9d
pushq %rbp
pushq %r12
pushq %rax
pushq %r15
callq 0x10a0
addq $0x20, %rsp
movq 0x26cc(%rip), %rdi      # 0x40c0
movq 0x26d5(%rip), %rsi      # 0x40d0
movq 0x26de(%rip), %rdx      # 0x40e0
subq $0x8, %rsp
movl %r12d, %ecx
movl %r13d, %r8d
movl %r15d, %r9d
pushq 0x18(%rsp)
callq 0x10b0
addq $0x10, %rsp
movq 0x269d(%rip), %rdi      # 0x40c0
movq 0xe8(%rdi), %rax
movslq 0x2697(%rip), %rcx      # 0x40c8
cmpq $-0x13, %r14
jl 0x1a84
movq %rcx, %rdx
shlq $0x7, %rdx
movl 0x1c(%rax,%rdx), %edx
addl $-0xa, %edx
movslq %r12d, %rsi
movslq 0xc(%rsp), %r8
movl 0x8(%rsp), %r14d
cmpl %edx, %ebp
setge %r9b
movswl (%rbx,%rsi,2), %r10d
cmpl %r10d, %edx
setg %r11b
andb %r9b, %r11b
movzbl %r11b, %r9d
addl %r9d, %r14d
cmpl %r10d, %ebp
cmovgel %ebp, %r10d
movw %r10w, (%rbx,%rsi,2)
incq %rsi
cmpq %r8, %rsi
jl 0x1a52
jmp 0x1a89
movl 0x8(%rsp), %r14d
shlq $0x7, %rcx
movl 0x18(%rax,%rcx), %eax
addl $-0x32, %eax
cmpl %eax, %r14d
jge 0x1aaf
movl %r14d, 0x8(%rsp)
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x10d0
xorl %ebp, %ebp
jmp 0x1877
xorl %esi, %esi
callq 0x1100
movl $0x3e8, %edi            # imm = 0x3E8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10d0