// File: /workspace/github_c_makefile_star2_O0/gitluin[P]sara/src/sara.c
// Function: start
void
start(){
	int nbytes;
	char msg[MAXBUFF];
	fd_set desc;
	XEvent ev;
	int cfd, max_fd, sfd, xfd = ConnectionNumber(dis);
	struct sockaddr saddress = {AF_UNIX, INPUTSOCK};

	if ( (sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0 )
		die("couldn't create socket!");

	unlink(INPUTSOCK);

	if (bind(sfd, &saddress, sizeof(saddress)) < 0)
		die("couldn't bind socket!");

	if (listen(sfd, SOMAXCONN) < 0)
		die("couldn't listen to socket!");

	runconfig();

	while (running){
		XFlush(dis);

		FD_ZERO(&desc);
		FD_SET(sfd, &desc);
		FD_SET(xfd, &desc);
		max_fd = MAX(sfd, xfd);

		if (select(max_fd + 1, &desc, NULL, NULL, NULL) > 0){
			/* Check for socket connections */
			if (FD_ISSET(sfd, &desc)){
				cfd = accept(sfd, NULL, NULL);
				if (cfd > 0 && (nbytes = recv(cfd, msg, sizeof(msg)-1, 0)) > 0){
					msg[nbytes] = '\0';
					handlemsg(msg);
					close(cfd);
				}
			}

			/* Check for an X event manually - XNextEvent blocks until an event occurs */
			if (FD_ISSET(xfd, &desc)){
				while (XCheckMaskEvent(dis, ~0, &ev))
					if (events[ev.type])
						events[ev.type](&ev);
			}
		}
	}

	close(sfd);
	unlink(INPUTSOCK);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq 0x4a9e(%rip), %rax      # 0xb500
movl 0x10(%rax), %eax
movl %eax, -0x170(%rbp)
movq 0x17d8(%rip), %rax      # 0x824a
movq %rax, -0x180(%rbp)
movq 0x17d2(%rip), %rax      # 0x8252
movq %rax, -0x178(%rbp)
movl $0x1, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x22e0
movl %eax, -0x16c(%rbp)
cmpl $0x0, %eax
jge 0x6aae
leaq 0x16f0(%rip), %rdi      # 0x8197
movb $0x0, %al
callq 0x70a0
leaq 0x16fa(%rip), %rdi      # 0x81af
callq 0x2170
movl -0x16c(%rbp), %edi
leaq -0x180(%rbp), %rsi
movl $0x10, %edx
callq 0x2460
cmpl $0x0, %eax
jge 0x6ae4
leaq 0x16e1(%rip), %rdi      # 0x81be
movb $0x0, %al
callq 0x70a0
movl -0x16c(%rbp), %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0x21e0
cmpl $0x0, %eax
jge 0x6b07
leaq 0x16d4(%rip), %rdi      # 0x81d4
movb $0x0, %al
callq 0x70a0
callq 0x6e30
cmpl $0x0, 0x4af5(%rip)      # 0xb608
je 0x6d93
movq 0x49e0(%rip), %rdi      # 0xb500
callq 0x2320
leaq -0xa0(%rbp), %rax
movq %rax, -0x190(%rbp)
movl $0x0, -0x184(%rbp)
movl -0x184(%rbp), %eax
cmpq $0x10, %rax
jae 0x6b6f
movq -0x190(%rbp), %rax
movl -0x184(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x184(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x184(%rbp)
jmp 0x6b3d
jmp 0x6b71
movl -0x16c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x16c(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0xa0(%rbp,%rax,8), %rcx
movq %rcx, -0xa0(%rbp,%rax,8)
movl -0x170(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x170(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0xa0(%rbp,%rax,8), %rcx
movq %rcx, -0xa0(%rbp,%rax,8)
movl -0x16c(%rbp), %eax
cmpl -0x170(%rbp), %eax
jle 0x6c07
movl -0x16c(%rbp), %eax
movl %eax, -0x194(%rbp)
jmp 0x6c13
movl -0x170(%rbp), %eax
movl %eax, -0x194(%rbp)
movl -0x194(%rbp), %eax
movl %eax, -0x168(%rbp)
movl -0x168(%rbp), %edi
addl $0x1, %edi
leaq -0xa0(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x20d0
cmpl $0x0, %eax
jle 0x6d8e
movl -0x16c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0xa0(%rbp,%rax,8), %rax
movq %rax, -0x1a0(%rbp)
movl -0x16c(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x1a0(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x6cf0
movl -0x16c(%rbp), %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x24a0
movl %eax, -0x164(%rbp)
cmpl $0x0, -0x164(%rbp)
jle 0x6cee
movl -0x164(%rbp), %edi
leaq -0x20(%rbp), %rsi
movl $0x11, %edx
xorl %ecx, %ecx
callq 0x2150
movl %eax, -0x4(%rbp)
cmpl $0x0, %eax
jle 0x6cee
movslq -0x4(%rbp), %rax
movb $0x0, -0x20(%rbp,%rax)
leaq -0x20(%rbp), %rdi
callq 0x6dc0
movl -0x164(%rbp), %edi
callq 0x20a0
jmp 0x6cf0
movl -0x170(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0xa0(%rbp,%rax,8), %rax
movq %rax, -0x1a8(%rbp)
movl -0x170(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x1a8(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x6d8c
jmp 0x6d3c
movq 0x47bd(%rip), %rdi      # 0xb500
movq $-0x1, %rsi
leaq -0x160(%rbp), %rdx
callq 0x22c0
cmpl $0x0, %eax
je 0x6d8a
movslq -0x160(%rbp), %rcx
leaq 0x4527(%rip), %rax      # 0xb290
cmpq $0x0, (%rax,%rcx,8)
je 0x6d88
movslq -0x160(%rbp), %rcx
leaq -0x160(%rbp), %rdi
leaq 0x450b(%rip), %rax      # 0xb290
callq *(%rax,%rcx,8)
jmp 0x6d3c
jmp 0x6d8c
jmp 0x6d8e
jmp 0x6b0c
movl -0x16c(%rbp), %edi
callq 0x20a0
leaq 0x140a(%rip), %rdi      # 0x81af
callq 0x2170
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopw %cs:(%rax,%rax)