// File: /workspace/github_c_makefile_star2_O0/GregorR[P]lstg/source/lst_socket_primitives.c
// Function: lstSocketPrimitive
struct object *
lstSocketPrimitive(int primitiveNumber, struct object *args, int *failed)
{
    struct object *returnedValue = nilObject;
    switch (integerValue(args->data[0])) {

        case 0:     /* constants */
            switch (integerValue(args->data[1])) {
            case 0:
                returnedValue = newInteger(AF_INET); break;
            case 1:
                returnedValue = newInteger(AF_INET6); break;
            case 2:
                returnedValue = newInteger(AF_LOCAL); break;
            case 10:
                returnedValue = newInteger(SOCK_STREAM); break;
            case 11:
                returnedValue = newInteger(SOCK_DGRAM); break;
            case 12:
                returnedValue = newInteger(SOCK_RAW); break;
            case 20:
                returnedValue = newInteger(IPPROTO_TCP); break;
            case 21:
                returnedValue = newInteger(IPPROTO_UDP); break;
#ifdef IPPROTO_SCTP
            case 22:
                returnedValue = newInteger(IPPROTO_SCTP); break;
#endif
            case 30:
                returnedValue = newInteger(SHUT_RD); break;
            case 31:
                returnedValue = newInteger(SHUT_WR); break;
            case 32:
                returnedValue = newInteger(SHUT_RDWR); break;
            }
            break;

        case 10: {   /* create socket */
            int family = integerValue(args->data[1]);
            int socketType = integerValue(args->data[2]);
            int protocol = integerValue(args->data[3]);
            int sockfd = socket(family, socketType, protocol);
            if (sockfd >= 0)
                returnedValue = newInteger(sockfd);
            break;
        }

        case 11: {   /* create TCP socket */
            int sockfd = socket(AF_INET, SOCK_STREAM, 0);
            if (sockfd >= 0)
                returnedValue = newInteger(sockfd);
            break;
        }

        case 12: {   /* create UDP socket */
            int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
            if (sockfd >= 0)
                returnedValue = newInteger(sockfd);
            break;
        }

        case 20: {   /* close */
            int sockfd = integerValue(args->data[1]);
            int rc = close(sockfd);
            returnedValue = newInteger(rc);
            break;
        }

        case 21: {   /* shutdown */
            int sockfd = integerValue(args->data[1]);
            int how = integerValue(args->data[2]);
            int rc = shutdown(sockfd, how);
            returnedValue = newInteger(rc);
            break;
        }

        case 30: {   /* bind */
            int sockfd = integerValue(args->data[1]);
            struct byteObject *addrObj = (struct byteObject *) args->data[2];
            int rc = bind(sockfd, (struct sockaddr *) addrObj->bytes, SIZE(addrObj));
            returnedValue = newInteger(rc);
            break;
        }

        case 40: {   /* listen */
            int sockfd = integerValue(args->data[1]);
            int backlog = integerValue(args->data[2]);
            int rc = listen(sockfd, backlog);
            returnedValue = newInteger(rc);
            break;
        }

        case 50: {   /* accept */
            int sockfd = integerValue(args->data[1]);
            int newsockfd = accept(sockfd, NULL, NULL);
            returnedValue = newInteger(newsockfd);
            break;
        }

        case 60: {   /* connect */
            int sockfd = integerValue(args->data[1]);
            struct byteObject *addrObj = (struct byteObject *) args->data[2];
#if defined(DEBUG) && defined(TRACE)
            struct sockaddr_in *p = (struct sockaddr_in*) addrObj->bytes;
printf("before connect()\n");
printf("    sockfd=%d\n", sockfd);
printf("    family=%d\n", p->sin_family);
printf("    port=%d\n", ntohs(p->sin_port));
printf("    addr=%s\n", inet_ntoa(p->sin_addr));
#endif
            int rc = connect(sockfd, (struct sockaddr *) addrObj->bytes, SIZE(addrObj));
#if defined(DEBUG) && defined(TRACE)
printf("connect() returns %d\n", rc);
#endif
            returnedValue = newInteger(rc);
            break;
        }

        case 70: {   /* send */
            int sockfd = integerValue(args->data[1]);
            struct byteObject *bufObj = (struct byteObject *) args->data[2];
            int n = integerValue(args->data[3]);
            if ((LstUInt) n > SIZE(bufObj)) {
                *failed = 1;
                break;
            }
            ssize_t sent = send(sockfd, bufObj->bytes, n, 0);
            returnedValue = newInteger(sent);
            break;
        }

        case 71: {   /* sendto */
            int sockfd = integerValue(args->data[1]);
            struct byteObject *bufObj = (struct byteObject *) args->data[2];
            int n = integerValue(args->data[3]);
            if ((LstUInt) n > SIZE(bufObj)) {
                *failed = 1;
                break;
            }
            struct byteObject *addrObj = (struct byteObject *) args->data[4];
            ssize_t sent = sendto(sockfd, bufObj->bytes, n, 0,
                    (struct sockaddr *) addrObj->bytes, SIZE(addrObj));
            returnedValue = newInteger(sent);
            break;
        }

        case 80: {   /* recv */
            int sockfd = integerValue(args->data[1]);
            struct byteObject *bufObj = (struct byteObject *) args->data[2];
            int n = integerValue(args->data[3]);
            if ((LstUInt) n > SIZE(bufObj)) {
                *failed = 1;
                break;
            }
            ssize_t got = recv(sockfd, bufObj->bytes, n, 0);
            returnedValue = newInteger(got);
            break;
        }

        case 81: {  /* recvfrom */
            int sockfd = integerValue(args->data[1]);
            struct byteObject *bufObj = (struct byteObject *) args->data[2];
            int n = integerValue(args->data[3]);
            if ((LstUInt) n > SIZE(bufObj)) {
                *failed = 1;
                break;
            }
            struct sockaddr_storage ss;
            socklen_t len = sizeof(ss);
            ssize_t got = recvfrom(sockfd, bufObj->bytes, n, 0,
                    (struct sockaddr *) &ss, &len);
            /* TODO , how to return both ssize_t and peer address? */
            returnedValue = newInteger(got);
            break;
        }

        case 90: {   /* getsockopt */
            /*
            int sockfd = integerValue(args->data[1]);
            int level = integerValue(args->data[2]);
            int optname = integerValue(args->data[3]);
            */
            // TODO
            break;
        }

        case 91: {   /* setsockopt */
            // TODO
            break;
        }

        case 92: {  /* select on a single fd */
#define LST_WAIT_R 1
#define LST_WAIT_W 2
            int fd = integerValue(args->data[1]);
            int waitfor = integerValue(args->data[2]);
            struct timeval timeout, *p = NULL;
            if (SIZE(args) > 3) {
                int timeout_in_milliseconds = integerValue(args->data[3]);
                timeout.tv_sec = (timeout_in_milliseconds) / 1000;
                timeout.tv_usec = (timeout_in_milliseconds) % 1000 * 1000;
                p = &timeout;
            }
            fd_set rfds, wfds, *rp = NULL, *wp = NULL;
            if (waitfor & LST_WAIT_R) { FD_ZERO(&rfds); FD_SET(fd, &rfds); rp = &rfds; }
            if (waitfor & LST_WAIT_W) { FD_ZERO(&wfds); FD_SET(fd, &wfds); wp = &wfds; }
            int rc = select(fd + 1, rp, wp, NULL, p);
            if (rc > 0) {
                rc = 0;
                if ((waitfor & LST_WAIT_R) && FD_ISSET(fd, &rfds)) rc |= LST_WAIT_R;
                if ((waitfor & LST_WAIT_W) && FD_ISSET(fd, &wfds)) rc |= LST_WAIT_W;
            }
#undef LST_WAIT_R
#undef LST_WAIT_W
            returnedValue = newInteger(rc);
            break;
        }

        case 93: {  /* getsockname */
            struct sockaddr_storage ss;
            socklen_t len = sizeof(ss);
            int sockfd = integerValue(args->data[1]);
            if (getsockname(sockfd, (struct sockaddr *) &ss, &len) >= 0)
                returnedValue = lstNewBinary(&ss, len);
            break;
        }

        case 94: {  /* getpeername */
            struct sockaddr_storage ss;
            socklen_t len = sizeof(ss);
            int sockfd = integerValue(args->data[1]);
            if (getpeername(sockfd, (struct sockaddr *) &ss, &len) >= 0)
                returnedValue = lstNewBinary(&ss, len);
            break;
        }

    }
    return returnedValue;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x4058b(%rip), %rax     # 0x48938
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
sarq %rax
movq %rax, -0x408(%rbp)
subq $0x5e, %rax
ja 0x8d23
movq -0x408(%rbp), %rax
leaq 0x2202(%rip), %rcx      # 0xa5e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movq %rax, -0x410(%rbp)
subq $0x20, %rax
ja 0x849c
movq -0x410(%rbp), %rax
leaq 0x234b(%rip), %rcx      # 0xa75c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x5, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x15, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x3, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x3, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x5, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x7, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0xd, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x23, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x109, %eax            # imm = 0x109
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x1, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x3, %eax
movq %rax, -0x20(%rbp)
jmp 0x849c
movl $0x5, %eax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
sarq %rax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
sarq %rax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %edi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
callq 0x2390
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jl 0x84f1
movslq -0x30(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2390
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x851f
movslq -0x34(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x2390
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jl 0x854a
movslq -0x38(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x2180
movl %eax, -0x40(%rbp)
movslq -0x40(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
sarq %rax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %edi
movl -0x48(%rbp), %esi
callq 0x20f0
movl %eax, -0x4c(%rbp)
movslq -0x4c(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movl -0x50(%rbp), %edi
movq -0x58(%rbp), %rsi
addq $0x10, %rsi
movq -0x58(%rbp), %rax
movl (%rax), %edx
shrl $0x2, %edx
callq 0x2290
movl %eax, -0x5c(%rbp)
movslq -0x5c(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
sarq %rax
movl %eax, -0x64(%rbp)
movl -0x60(%rbp), %edi
movl -0x64(%rbp), %esi
callq 0x2240
movl %eax, -0x68(%rbp)
movslq -0x68(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x22e0
movl %eax, -0x70(%rbp)
movslq -0x70(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x74(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x80(%rbp)
movl -0x74(%rbp), %edi
movq -0x80(%rbp), %rsi
addq $0x10, %rsi
movq -0x80(%rbp), %rax
movl (%rax), %edx
shrl $0x2, %edx
callq 0x2340
movl %eax, -0x84(%rbp)
movslq -0x84(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
sarq %rax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movq -0x90(%rbp), %rcx
movl (%rcx), %ecx
shrl $0x2, %ecx
cmpl %ecx, %eax
jbe 0x871c
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x8d23
movl -0x88(%rbp), %edi
movq -0x90(%rbp), %rsi
addq $0x10, %rsi
movslq -0x94(%rbp), %rdx
xorl %ecx, %ecx
callq 0x2130
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0xa4(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
sarq %rax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movq -0xb0(%rbp), %rcx
movl (%rcx), %ecx
shrl $0x2, %ecx
cmpl %ecx, %eax
jbe 0x87af
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xc0(%rbp)
movl -0xa4(%rbp), %edi
movq -0xb0(%rbp), %rsi
addq $0x10, %rsi
movslq -0xb4(%rbp), %rdx
movq -0xc0(%rbp), %r8
addq $0x10, %r8
movq -0xc0(%rbp), %rax
movl (%rax), %r9d
shrl $0x2, %r9d
xorl %ecx, %ecx
callq 0x2160
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0xcc(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
sarq %rax
movl %eax, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
movq -0xd8(%rbp), %rcx
movl (%rcx), %ecx
shrl $0x2, %ecx
cmpl %ecx, %eax
jbe 0x886a
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x8d23
movl -0xcc(%rbp), %edi
movq -0xd8(%rbp), %rsi
addq $0x10, %rsi
movslq -0xdc(%rbp), %rdx
xorl %ecx, %ecx
callq 0x2070
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0xec(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xf8(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
sarq %rax
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
movq -0xf8(%rbp), %rcx
movl (%rcx), %ecx
shrl $0x2, %ecx
cmpl %ecx, %eax
jbe 0x88fd
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x8d23
movl $0x80, -0x184(%rbp)
movl -0xec(%rbp), %edi
movq -0xf8(%rbp), %rsi
addq $0x10, %rsi
movslq -0xfc(%rbp), %rdx
xorl %ecx, %ecx
leaq -0x180(%rbp), %r8
leaq -0x184(%rbp), %r9
callq 0x2250
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
jmp 0x8d23
jmp 0x8d23
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x194(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
sarq %rax
movl %eax, -0x198(%rbp)
movq $0x0, -0x1b0(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
cmpl $0x3, %eax
jbe 0x89ea
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
sarq %rax
movl %eax, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
cltq
movq %rax, -0x1a8(%rbp)
movl -0x1b4(%rbp), %eax
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
imull $0x3e8, %edx, %eax      # imm = 0x3E8
cltq
movq %rax, -0x1a0(%rbp)
leaq -0x1a8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq $0x0, -0x2c0(%rbp)
movq $0x0, -0x2c8(%rbp)
movl -0x198(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8aab
jmp 0x8a14
leaq -0x238(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movl $0x0, -0x2cc(%rbp)
movl -0x2cc(%rbp), %eax
cmpq $0x10, %rax
jae 0x8a5e
movq -0x2d8(%rbp), %rax
movl -0x2cc(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x2cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2cc(%rbp)
jmp 0x8a2c
jmp 0x8a60
movl -0x194(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x194(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x238(%rbp,%rax,8), %rcx
movq %rcx, -0x238(%rbp,%rax,8)
leaq -0x238(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movl -0x198(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x8b56
jmp 0x8abf
leaq -0x2b8(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movl $0x0, -0x2dc(%rbp)
movl -0x2dc(%rbp), %eax
cmpq $0x10, %rax
jae 0x8b09
movq -0x2e8(%rbp), %rax
movl -0x2dc(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x2dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2dc(%rbp)
jmp 0x8ad7
jmp 0x8b0b
movl -0x194(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movl -0x194(%rbp), %eax
movl $0x40, %esi
cltd
idivl %esi
cltq
orq -0x2b8(%rbp,%rax,8), %rcx
movq %rcx, -0x2b8(%rbp,%rax,8)
leaq -0x2b8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
movl -0x194(%rbp), %edi
addl $0x1, %edi
movq -0x2c0(%rbp), %rsi
movq -0x2c8(%rbp), %rdx
movq -0x1b0(%rbp), %r8
xorl %eax, %eax
movl %eax, %ecx
callq 0x2210
movl %eax, -0x2ec(%rbp)
cmpl $0x0, -0x2ec(%rbp)
jle 0x8c6a
movl $0x0, -0x2ec(%rbp)
movl -0x198(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8c01
movl -0x194(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x238(%rbp,%rax,8), %rax
movq %rax, -0x418(%rbp)
movl -0x194(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x418(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x8c01
movl -0x2ec(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x2ec(%rbp)
movl -0x198(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x8c68
movl -0x194(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
cltq
movq -0x2b8(%rbp,%rax,8), %rax
movq %rax, -0x420(%rbp)
movl -0x194(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x420(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x8c68
movl -0x2ec(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x2ec(%rbp)
jmp 0x8c6a
movslq -0x2ec(%rbp), %rax
shlq %rax
orq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8d23
movl $0x80, -0x374(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x378(%rbp)
movl -0x378(%rbp), %edi
leaq -0x370(%rbp), %rsi
leaq -0x374(%rbp), %rdx
callq 0x22f0
cmpl $0x0, %eax
jl 0x8cd0
movl -0x374(%rbp), %esi
leaq -0x370(%rbp), %rdi
callq 0x7310
movq %rax, -0x20(%rbp)
jmp 0x8d23
movl $0x80, -0x3fc(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
sarq %rax
movl %eax, -0x400(%rbp)
movl -0x400(%rbp), %edi
leaq -0x3f8(%rbp), %rsi
leaq -0x3fc(%rbp), %rdx
callq 0x20d0
cmpl $0x0, %eax
jl 0x8d21
movl -0x3fc(%rbp), %esi
leaq -0x3f8(%rbp), %rdi
callq 0x7310
movq %rax, -0x20(%rbp)
jmp 0x8d23
movq -0x20(%rbp), %rax
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq