LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_network.c
// Function: shoit_network_set_socket_buffer
void shoit_network_set_socket_buffer(int udpSockfd, int sockbufsize, int verbose )
{
    int oldsend = -1, oldrecv = -1;
    int newsend = -1, newrecv = -1;
    socklen_t olen = sizeof(int);

    if(getsockopt(udpSockfd,SOL_SOCKET,SO_SNDBUF,&oldsend,&olen) < 0)
        perror("getsockopt: SO_SNDBUF");

    if(getsockopt(udpSockfd,SOL_SOCKET,SO_RCVBUF,&oldrecv,&olen) < 0)
        perror("getsockopt: SO_RCVBUF");

    if(sockbufsize > 0) {
        if(setsockopt(udpSockfd,SOL_SOCKET,SO_SNDBUF,&sockbufsize,sizeof(sockbufsize)) < 0)
            perror("setsockopt: SO_SNDBUF");
        if(setsockopt(udpSockfd,SOL_SOCKET,SO_RCVBUF,&sockbufsize,sizeof(sockbufsize)) < 0)
            perror("setsockopt: SO_RCVBUF");
        if(getsockopt(udpSockfd,SOL_SOCKET,SO_SNDBUF,&newsend,&olen) < 0)
            perror("getsockopt: SO_SNDBUF");
        if(getsockopt(udpSockfd,SOL_SOCKET,SO_RCVBUF,&newrecv,&olen) < 0)
            perror("getsockopt: SO_RCVBUF");
    }
    if(verbose>1) 
        fprintf(stderr, "UDP sockbufsize was %d/%d now %d/%d (send/recv)\n",oldsend, oldrecv, newsend, newrecv);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
leaq 0x1c(%rsp), %rcx
orl $-0x1, (%rcx)
orl $-0x1, 0x14(%rsp)
movl %edx, %ebx
orl $-0x1, 0x10(%rsp)
movl %esi, %r14d
orl $-0x1, 0xc(%rsp)
movl %edi, %ebp
movl %esi, 0x18(%rsp)
leaq 0x8(%rsp), %r8
movl $0x4, (%r8)
pushq $0x1
popq %rsi
pushq $0x7
popq %rdx
callq 0x2210
testl %eax, %eax
js 0x2d28
pushq $0x1
popq %rsi
pushq $0x8
popq %rdx
leaq 0x14(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl %ebp, %edi
callq 0x2210
testl %eax, %eax
js 0x2d39
testl %r14d, %r14d
jle 0x2d1a
pushq $0x1
popq %rsi
pushq $0x7
popq %rdx
leaq 0x18(%rsp), %rcx
pushq $0x4
popq %r8
movl %ebp, %edi
callq 0x2090
testl %eax, %eax
js 0x2d76
pushq $0x1
popq %rsi
pushq $0x8
popq %rdx
leaq 0x18(%rsp), %rcx
pushq $0x4
popq %r8
movl %ebp, %edi
callq 0x2090
testl %eax, %eax
js 0x2d87
pushq $0x1
popq %rsi
pushq $0x7
popq %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl %ebp, %edi
callq 0x2210
testl %eax, %eax
js 0x2d98
pushq $0x1
popq %rsi
pushq $0x8
popq %rdx
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl %ebp, %edi
callq 0x2210
testl %eax, %eax
js 0x2da9
cmpl $0x2, %ebx
jge 0x2d4a
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x3680(%rip), %rdi      # 0x63af
callq 0x2390
jmp 0x2c7c
leaq 0x3685(%rip), %rdi      # 0x63c5
callq 0x2390
jmp 0x2c9b
movq 0x62a7(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movl 0x1c(%rsp), %edx
movl 0x14(%rsp), %ecx
movl 0x10(%rsp), %r8d
movl 0xc(%rsp), %r9d
leaq 0x369a(%rip), %rsi      # 0x6407
xorl %eax, %eax
callq 0x2250
jmp 0x2d1f
leaq 0x365e(%rip), %rdi      # 0x63db
callq 0x2390
jmp 0x2cbe
leaq 0x3663(%rip), %rdi      # 0x63f1
callq 0x2390
jmp 0x2cdc
leaq 0x3610(%rip), %rdi      # 0x63af
callq 0x2390
jmp 0x2cfb
leaq 0x3615(%rip), %rdi      # 0x63c5
callq 0x2390
jmp 0x2d1a
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_network.c
// Function: shoit_network_connect_udp
int shoit_network_connect_udp(struct sockaddr_in *udpServerAddr,int localPort,char *remoteHost,int remoteHostPort)
{
    static struct sockaddr_in udpClientAddr;
    struct hostent *phe;
    int udpSockfd;

    // Fill in the structure whith the address of the server that we want to send to
    // udpServerAddr is class global variable, will be used to send data

    bzero(udpServerAddr, sizeof(struct sockaddr_in));
    udpServerAddr->sin_family = AF_INET;

    if ((phe = gethostbyname(remoteHost)))
        memcpy(&udpServerAddr->sin_addr, phe->h_addr, phe->h_length);
    else if ((udpServerAddr->sin_addr.s_addr = inet_addr(remoteHost)) == INADDR_NONE)
    {   
        perror("can't get host entry");
        return -1;
    }
    udpServerAddr->sin_port = htons(remoteHostPort);

    /* Open a UDP socket */
    if ((udpSockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
    {
        perror("socket error");
        return -1;
    }

    // Allow the port to be reused.
    int yes = 1;
    if (setsockopt(udpSockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)) == -1) {
        perror("setsockopt");
        close(udpSockfd);
        return -1;
    } 

    /* Bind any local address for us */
    bzero(&udpClientAddr, sizeof(udpClientAddr));
    udpClientAddr.sin_family = AF_INET;
    udpClientAddr.sin_addr.s_addr = htonl(INADDR_ANY);
    udpClientAddr.sin_port = htons(localPort);
    if((bind(udpSockfd, (struct sockaddr *)&udpClientAddr, sizeof(udpClientAddr))) < 0) {
        perror("UDP client bind error");
        close(udpSockfd);
        return -1;
    }

    return udpSockfd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movw $0x2, (%rdi)
movq %rdx, %rdi
callq 0x2240
testq %rax, %rax
je 0x2df9
leaq 0x4(%r14), %rdi
movq 0x18(%rax), %rcx
movq (%rcx), %rsi
movslq 0x14(%rax), %rdx
callq 0x2280
jmp 0x2e0e
movq %r15, %rdi
callq 0x2220
movl %eax, 0x4(%r14)
cmpl $-0x1, %eax
je 0x2eb6
rolw $0x8, %bp
movw %bp, 0x2(%r14)
pushq $0x2
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x24c0
testl %eax, %eax
js 0x2e8f
movl %eax, %ebp
leaq 0x4(%rsp), %rcx
movl $0x1, (%rcx)
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x2090
cmpl $-0x1, %eax
je 0x2e98
andq $0x0, 0x6432(%rip)      # 0x9284
movw $0x2, 0x6421(%rip)      # 0x927c
andl $0x0, 0x641e(%rip)      # 0x9280
leaq 0x6413(%rip), %rsi      # 0x927c
rolw $0x8, %bx
movw %bx, 0x640a(%rip)       # 0x927e
pushq $0x10
popq %rdx
movl %ebp, %edi
callq 0x2330
testl %eax, %eax
js 0x2ea1
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x35b7(%rip), %rdi      # 0x644d
jmp 0x2ebd
leaq 0x35bb(%rip), %rdi      # 0x645a
jmp 0x2ea8
leaq 0x35bd(%rip), %rdi      # 0x6465
callq 0x2390
movl %ebp, %edi
callq 0x21b0
jmp 0x2ec2
leaq 0x357b(%rip), %rdi      # 0x6438
callq 0x2390
pushq $-0x1
popq %rbp
jmp 0x2e82
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_network.c
// Function: shoit_network_udp_server_init
int shoit_network_udp_server_init(struct sockaddr_in *udpLocalAddr,int udpLocalPort,char *remoteHost,int remoteUdpPort)
{
    struct sockaddr_in cliaddr;
    struct hostent *phe;
    int udpSockfd;
    

    // Create a UDP sink 
    if ((udpSockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0){
        perror("socket error");
        return udpSockfd;
    }
    bzero((char *)udpLocalAddr, sizeof(struct sockaddr_in));
    udpLocalAddr->sin_family = AF_INET;
    udpLocalAddr->sin_addr.s_addr = htonl(INADDR_ANY);
    udpLocalAddr->sin_port = htons(udpLocalPort);

    if((bind(udpSockfd, (struct sockaddr *)udpLocalAddr, sizeof(struct sockaddr_in))) < 0) {
        perror("UDP bind error");
        close(udpSockfd);
        return -1;
    }

    // Use connected UDP to receive only from a specific host and port.
    bzero(&cliaddr, sizeof(cliaddr));
    if ((phe = gethostbyname(remoteHost)))
        memcpy(&cliaddr.sin_addr, phe->h_addr, phe->h_length);
    else if ((cliaddr.sin_addr.s_addr = inet_addr(remoteHost)) == INADDR_NONE){
        perror("gethostbyname remotehost error");
        close(udpSockfd);
        return -1;
    }

    cliaddr.sin_family = AF_INET;
    cliaddr.sin_port = htons(remoteUdpPort);

    if (connect(udpSockfd, (struct sockaddr *) &cliaddr, sizeof(cliaddr)) < 0)
    {
        perror("connect() error");
        close(udpSockfd);
        return -1;
    }

    return udpSockfd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movl %esi, %r12d
movq %rdi, %r15
pushq $0x2
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x24c0
movl %eax, %ebx
testl %eax, %eax
js 0x2f8c
andq $0x0, 0x8(%r15)
movw $0x2, (%r15)
andl $0x0, 0x4(%r15)
rolw $0x8, %r12w
movw %r12w, 0x2(%r15)
pushq $0x10
popq %rdx
movl %ebx, %edi
movq %r15, %rsi
callq 0x2330
testl %eax, %eax
js 0x2f9a
andl $0x0, 0xc(%rsp)
andq $0x0, 0x4(%rsp)
movq %r14, %rdi
callq 0x2240
testq %rax, %rax
je 0x2f4e
leaq 0x4(%rsp), %rdi
movq 0x18(%rax), %rcx
movq (%rcx), %rsi
movslq 0x14(%rax), %rdx
callq 0x2280
jmp 0x2f5f
movq %r14, %rdi
callq 0x2220
movl %eax, 0x4(%rsp)
cmpl $-0x1, %eax
je 0x2fac
movq %rsp, %rsi
movw $0x2, (%rsi)
rolw $0x8, %bp
movw %bp, 0x2(%rsi)
pushq $0x10
popq %rdx
movl %ebx, %edi
callq 0x2400
testl %eax, %eax
js 0x2fa3
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x34ba(%rip), %rdi      # 0x644d
callq 0x2390
jmp 0x2f7d
leaq 0x34da(%rip), %rdi      # 0x647b
jmp 0x2fb3
leaq 0x34ff(%rip), %rdi      # 0x64a9
jmp 0x2fb3
leaq 0x34d7(%rip), %rdi      # 0x648a
callq 0x2390
movl %ebx, %edi
callq 0x21b0
pushq $-0x1
popq %rbx
jmp 0x2f7d
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_network.c
// Function: shoit_network_connect_tcp
int shoit_network_connect_tcp(char * remoteHost,int remoteHostPort)
{
    #define USEC(st, fi) (((fi)->tv_sec-(st)->tv_sec)*1000000+((fi)->tv_usec-(st)->tv_usec))
    static struct sockaddr_in tcpServerAddr;
    int retval = 0;
    struct hostent *phe;
    struct timeval start, now;
    int tcpSockfd;

    /*Create a TCP connection */
    bzero((char *)&tcpServerAddr, sizeof(tcpServerAddr));
    tcpServerAddr.sin_family = AF_INET;

    if ((phe = gethostbyname(remoteHost)))
        memcpy(&tcpServerAddr.sin_addr, phe->h_addr, phe->h_length);
    else if ((tcpServerAddr.sin_addr.s_addr = inet_addr(remoteHost)) == INADDR_NONE)
    {
        perror("can't get host entry");
        return -1;
    }
    tcpServerAddr.sin_port = htons(remoteHostPort);
    if((tcpSockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
    {
        perror("socket error");
        return -1;
    }
    gettimeofday(&start, NULL);
    do {
        retval = connect(tcpSockfd, (struct sockaddr *)&tcpServerAddr, sizeof(tcpServerAddr));
        gettimeofday(&now, NULL);
        if(retval<0) break;
    } while ((retval < 0) &&  (USEC(&start, &now) < 5000000));
    tcpSockfd = !retval ? tcpSockfd:-1;
    return tcpSockfd;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x62b1(%rip)     # 0x928c
movw $0x2, 0x62a8(%rip)      # 0x928c
callq 0x2240
testq %rax, %rax
je 0x3007
movq 0x18(%rax), %rcx
movq (%rcx), %rsi
movslq 0x14(%rax), %rdx
leaq 0x6290(%rip), %rdi      # 0x9290
callq 0x2280
jmp 0x301a
movq %r14, %rdi
callq 0x2220
movl %eax, 0x627b(%rip)      # 0x9290
cmpl $-0x1, %eax
je 0x307f
rolw $0x8, %bx
movw %bx, 0x6269(%rip)       # 0x928e
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %ebx, %ebx
xorl %edx, %edx
callq 0x24c0
testl %eax, %eax
js 0x3076
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x2170
leaq 0x623f(%rip), %rsi      # 0x928c
pushq $0x10
popq %rdx
movl %ebp, %edi
callq 0x2400
movl %eax, %r14d
movq %rsp, %rdi
xorl %esi, %esi
callq 0x2170
negl %r14d
sbbl %ebx, %ebx
orl %ebp, %ebx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x33d0(%rip), %rdi      # 0x644d
jmp 0x3086
leaq 0x33b2(%rip), %rdi      # 0x6438
callq 0x2390
pushq $-0x1
popq %rbx
jmp 0x306b
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_network.c
// Function: shoit_network_readn
ssize_t shoit_network_readn(int fd, void *vptr,ssize_t nbytes)
{
    ssize_t nleft, nread;
    char *ptr;

    ptr =(char*)vptr;
    nleft = nbytes;

    while(nleft > 0)
    {
        if ( (nread = read(fd, ptr, nleft)) < 0) {
            if (errno == EINTR)
                nread = 0;      /* and call read() again */
            else
                return (-1);
        } else if (nread == 0)
            break;              /* EOF */

        nleft -= nread;
        ptr += nread;
    }
    return (nbytes - nleft);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movl %edi, %ebp
pushq $-0x1
popq %r14
movq %rdx, %r12
testq %r12, %r12
jle 0x324c
movl %ebp, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2200
testq %rax, %rax
js 0x3238
jne 0x3244
jmp 0x324c
callq 0x2060
cmpl $0x4, (%rax)
jne 0x3252
xorl %eax, %eax
subq %rax, %r12
addq %rax, %r15
jmp 0x321d
subq %r12, %rbx
movq %rbx, %r14
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_network.c
// Function: shoit_network_writen
ssize_t shoit_network_writen(int fd,void *vptr,ssize_t nbytes)
{
    ssize_t nleft, nwritten;
    char *ptr;

    ptr = (char*)vptr;
    nleft = nbytes;
    while(nleft > 0)
    {
        if ( (nwritten = write(fd, ptr, nleft)) <= 0) {
            if (nwritten < 0 && errno == EINTR)
                nwritten = 0;   /* and call write() again */
            else
                return (-1);    /* error */
        }

        nleft -= nwritten;
        ptr += nwritten;
    }
    return (nbytes -nleft);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
pushq $-0x1
popq %rbx
movq %rdx, %r12
testq %r12, %r12
jle 0x32a1
movl %ebp, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x20b0
testq %rax, %rax
jg 0x3299
jns 0x32a7
callq 0x2060
cmpl $0x4, (%rax)
jne 0x32a7
xorl %eax, %eax
subq %rax, %r12
addq %rax, %r15
jmp 0x3274
subq %r12, %r14
movq %r14, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_misc.c
// Function: shoit_misc_nocr
char *shoit_misc_nocr(char *s)
{
    if(s==NULL) return s;
    char *pos = s;

    while(*pos){
        if(*pos==' ' || *pos == '\n' || *pos=='\r') break;
        pos++;
    }
    *pos='\0';

    return s;
}

// Assembly:
movq %rdi, %rax
testq %rdi, %rdi
je 0x32e0
movabsq $0x100002401, %rdx      # imm = 0x100002401
movq %rax, %rcx
movzbl (%rcx), %esi
cmpq $0x20, %rsi
ja 0x32d8
btq %rsi, %rdx
jb 0x32dd
incq %rcx
jmp 0x32c9
movb $0x0, (%rcx)
retq
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_misc.c
// Function: shoit_misc_sleepto
void shoit_misc_sleepto(uint64_t nexttime, pthread_mutex_t *tickLock,pthread_cond_t *tickCond)
{
    uint64_t schedTime = nexttime;
    uint64_t t = shoit_misc_get_timer();

    while (t < schedTime)
    {
        struct timeval now;
        struct timespec timeout;
        gettimeofday(&now, 0);

        if (now.tv_usec < 990000){
            timeout.tv_sec = now.tv_sec;
            timeout.tv_nsec = (now.tv_usec + 10000) * 1000;
        } else {
            timeout.tv_sec = now.tv_sec + 1;
            timeout.tv_nsec = (now.tv_usec + 10000 - 1000000) * 1000;
        }

        pthread_mutex_lock(tickLock);
        pthread_cond_timedwait(tickCond, tickLock,&timeout);
        pthread_mutex_unlock(tickLock);
        t = shoit_misc_get_timer();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x32e1
leaq 0x10(%rsp), %r12
movq %rsp, %r13
cmpq %r15, %rax
jae 0x3393
movq %r12, %rdi
xorl %esi, %esi
callq 0x2170
movq 0x18(%rsp), %rax
imulq $0x3e8, %rax, %rcx      # imm = 0x3E8
leaq 0x989680(%rcx), %rdx
addq $-0x3b023380, %rcx      # imm = 0xC4FDCC80
xorl %esi, %esi
cmpq $0xf1b30, %rax          # imm = 0xF1B30
setge %sil
cmovlq %rdx, %rcx
addq 0x10(%rsp), %rsi
movq %rsi, (%rsp)
movq %rcx, 0x8(%rsp)
movq %r14, %rdi
callq 0x2490
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2350
movq %r14, %rdi
callq 0x22c0
callq 0x32e1
jmp 0x3327
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_misc.c
// Function: shoit_misc_resolve_line
int shoit_misc_resolve_line(char *line,char *host,int *port)
{
    char *pos;
    if(line==NULL || strlen(line)==0) return -1;
    if( (pos =strchr(line,':'))==NULL) return -1;
    
    memcpy(host,line,(int)(pos-line));
    pos ++; //del ':'
    if(pos==NULL) return -1; /*port error*/

    char *endptr;
    errno = 0;    /* To distinguish success/failure after call */
    long val = strtol(pos, &endptr,10);
    if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
                   || (errno != 0 && val == 0)) {
        return -1;
    }
    if (endptr == pos) {
        fprintf(stderr, "No digits were found\n");
        return -1;
    }
   
    *port = (int)val; 

    return 0;
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
pushq $-0x1
popq %rbp
testq %rdi, %rdi
je 0x344d
movq %rdi, %r15
cmpb $0x0, (%rdi)
je 0x344d
movq %rdx, %rbx
movq %rsi, %r12
pushq $0x3a
popq %rsi
movq %r15, %rdi
callq 0x2100
testq %rax, %rax
je 0x344d
movq %rax, %r14
subl %r15d, %eax
movslq %eax, %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2280
incq %r14
callq 0x2060
movq %rax, %r15
andl $0x0, (%rax)
leaq 0x8(%rsp), %rsi
pushq $0xa
popq %rdx
movq %r14, %rdi
callq 0x2270
movl (%r15), %ecx
cmpl $0x22, %ecx
sete %dl
movabsq $-0x7fffffffffffffff, %rsi # imm = 0x8000000000000001
addq %rax, %rsi
cmpq $0x2, %rsi
setb %sil
pushq $-0x1
popq %rbp
testb %sil, %dl
jne 0x344d
testl %ecx, %ecx
setne %cl
testq %rax, %rax
sete %dl
testb %dl, %cl
jne 0x344d
cmpq %r14, 0x8(%rsp)
je 0x345c
movl %eax, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x5b95(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x307f(%rip), %rdi      # 0x64ec
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
jmp 0x344d
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_misc.c
// Function: shoit_misc_log
void shoit_misc_log(FILE *fp,char *format, ...)
{

    if(!fp) return;

    va_list arglist;
    va_start( arglist, format);
    vfprintf(fp, format, arglist);
    fprintf(fp, "\n");
    va_end(arglist);
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x3508
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
testq %rdi, %rdi
je 0x3545
movq %rdi, %rbx
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
callq 0x23c0
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x21f0
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_progress.c
// Function: shoit_progress_init
void shoit_progress_init(progress_t *progress, char *title, int max, int style)
{

    //fprintf(stderr,"call func:%s\n",__func__);
    progress->chr = '#';
    progress->title = title;
    progress->style = style;
    progress->max = max;
    progress->offset = 100 / (float)max;
    progress->pro = (char *) malloc(max+1);

    if ( style == PROGRESS_BGC_STYLE ){
        memset(progress->pro,0, max+1);
    }else {
        memset(progress->pro, 32, max);
        memset(progress->pro+max, 0, 1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rdi, %r12
movb $0x23, (%rdi)
movq %rsi, 0x8(%rdi)
movl %ecx, 0x10(%rdi)
movl %edx, 0x14(%rdi)
cvtsi2ss %edx, %xmm0
movss 0x2e94(%rip), %xmm1     # 0x6518
divss %xmm0, %xmm1
movss %xmm1, 0x18(%rdi)
leal 0x1(%rbx), %eax
movslq %eax, %r15
movq %r15, %rdi
callq 0x22e0
movq %rax, %r14
movq %rax, 0x20(%r12)
cmpl $0x2, %ebp
jne 0x36bd
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2190
movslq %ebx, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2190
movb $0x0, (%r14,%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/pencode-lab[P]Shoit/shoit_progress.c
// Function: shoit_progress_for_stream
void shoit_progress_for_stream(FILE *fp,progress_t *progress, float bit)
{
    char buffer[512]={0};

    memset(buffer,0,512);
    
    float mbps = 1e-6 * 8*progress->total / (progress->utime == 0 ? .01 : progress->utime);

    snprintf(buffer,sizeof(buffer)-1,"%gMbps    %ldK    %.2fs    ",mbps,progress->total>>10,progress->utime);

    fprintf(fp,"\033[?25l\033[31m\033[1m%s%%\033[?25h\033[0m\r", buffer);
    fflush(fp); 
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %r14
movl $0x200, %edx            # imm = 0x200
movq %r14, %rdi
xorl %esi, %esi
callq 0x2190
movq 0x28(%r15), %rcx
movss 0x30(%r15), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
cvtss2sd %xmm0, %xmm1
movaps %xmm1, %xmm0
jne 0x3923
movaps %xmm1, %xmm0
jp 0x3923
movsd 0x2bfd(%rip), %xmm0     # 0x6520
movq %rcx, %xmm2
punpckldq 0x2c00(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x2c08(%rip), %xmm2     # 0x6540
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
mulsd 0x2bdc(%rip), %xmm3     # 0x6528
divsd %xmm0, %xmm3
cvtsd2ss %xmm3, %xmm0
cvtss2sd %xmm0, %xmm0
shrq $0xa, %rcx
leaq 0x2c80(%rip), %rdx      # 0x65e3
movl $0x1ff, %esi            # imm = 0x1FF
movq %r14, %rdi
movb $0x2, %al
callq 0x2130
leaq 0x2c86(%rip), %rsi      # 0x65ff
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2250
movq %rbx, %rdi
callq 0x22f0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: tracestate
static void
tracestate(KD11A *cpu)
{
	(void)cpu;
	trace(" R0 %06o R1 %06o R2 %06o R3 %06o R4 %06o R5 %06o R6 %06o R7 %06o\n"
		" 10 %06o 11 %06o 12 %06o 13 %06o 14 %06o 15 %06o 16 %06o 17 %06o\n"
		" BA %06o IR %06o PSW %06o\n"
		,
		cpu->r[0], cpu->r[1], cpu->r[2], cpu->r[3],
		cpu->r[4], cpu->r[5], cpu->r[6], cpu->r[7],
		cpu->r[8], cpu->r[9], cpu->r[10], cpu->r[11],
		cpu->r[12], cpu->r[13], cpu->r[14], cpu->r[15],
		cpu->ba, cpu->ir, cpu->cur<<14 | cpu->prev<<12 | cpu->psw);
	trace(" SR0 %06o SR2 %06o\n",
		cpu->sr0, cpu->sr2);
	trace(" PAR %06o %06o %06o %06o %06o %06o %06o %06o\n"
	       "     %06o %06o %06o %06o %06o %06o %06o %06o\n",
		cpu->par[0], cpu->par[1], cpu->par[2], cpu->par[3],
		cpu->par[4], cpu->par[5], cpu->par[6], cpu->par[7],
		cpu->par[010], cpu->par[011], cpu->par[012], cpu->par[013],
		cpu->par[014], cpu->par[015], cpu->par[016], cpu->par[017]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpl $0x0, 0x445a3(%rip)     # 0x49d60
je 0x5983
movq %rdi, %rbx
movzwl (%rdi), %esi
movzwl 0x2(%rdi), %edx
movzwl 0x4(%rdi), %ecx
movzwl 0x6(%rdi), %r8d
movzwl 0x8(%rdi), %r9d
movzwl 0xa(%rdi), %eax
movq %rax, 0x10(%rsp)
movzwl 0xc(%rdi), %eax
movq %rax, 0x8(%rsp)
movzwl 0xe(%rdi), %eax
movq %rax, (%rsp)
movzwl 0x10(%rdi), %eax
movq %rax, 0x30(%rsp)
movzwl 0x12(%rdi), %eax
movq %rax, 0x28(%rsp)
movzwl 0x14(%rdi), %eax
movq %rax, 0x20(%rsp)
movzwl 0x16(%rdi), %eax
movq %rax, 0x18(%rsp)
movzwl 0x18(%rdi), %ebp
movzwl 0x86(%rdi), %eax
shll $0xe, %eax
movzwl 0x88(%rdi), %edi
shll $0xc, %edi
orl %eax, %edi
movzbl 0x30(%rbx), %r10d
orl %edi, %r10d
movzwl 0x1a(%rbx), %r13d
movzwl 0x1c(%rbx), %r11d
movzwl 0x1e(%rbx), %r14d
movzwl 0x24(%rbx), %r15d
movzwl 0x26(%rbx), %r12d
leaq 0x2dae(%rip), %rdi      # 0x8609
xorl %eax, %eax
pushq %r10
pushq %r12
pushq %r15
pushq %r14
pushq %r11
pushq %r13
pushq %rbp
pushq 0x50(%rsp)
pushq 0x60(%rsp)
pushq 0x70(%rsp)
pushq 0x80(%rsp)
pushq 0x58(%rsp)
pushq 0x68(%rsp)
pushq 0x78(%rsp)
callq 0x20a0
addq $0x70, %rsp
cmpl $0x0, 0x444c7(%rip)     # 0x49d60
je 0x5983
movzwl 0x138(%rbx), %esi
movzwl 0x13a(%rbx), %edx
leaq 0x2df2(%rip), %rdi      # 0x86a6
xorl %eax, %eax
callq 0x20a0
cmpl $0x0, 0x4449e(%rip)     # 0x49d60
je 0x5983
movzwl 0x8c(%rbx), %esi
movzwl 0x8e(%rbx), %edx
movzwl 0x90(%rbx), %ecx
movzwl 0x92(%rbx), %r8d
movzwl 0x94(%rbx), %r9d
movzwl 0x96(%rbx), %eax
movq %rax, 0x10(%rsp)
movzwl 0x98(%rbx), %eax
movq %rax, 0x8(%rsp)
movzwl 0x9a(%rbx), %eax
movq %rax, (%rsp)
movzwl 0x9c(%rbx), %r15d
movzwl 0x9e(%rbx), %r12d
movzwl 0xa0(%rbx), %r13d
movzwl 0xa2(%rbx), %ebp
movzwl 0xa4(%rbx), %r10d
movzwl 0xa6(%rbx), %r11d
movzwl 0xa8(%rbx), %r14d
movzwl 0xaa(%rbx), %ebx
subq $0x8, %rsp
leaq 0x2d61(%rip), %rdi      # 0x86ba
xorl %eax, %eax
pushq %rbx
pushq %r14
pushq %r11
pushq %r10
pushq %rbp
pushq %r13
pushq %r12
pushq %r15
pushq 0x48(%rsp)
pushq 0x58(%rsp)
pushq 0x68(%rsp)
callq 0x20a0
addq $0x98, %rsp
jmp 0x5987
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: setBA
static word
setBA(KD11A *cpu, word ba, int r, int ov, int oda)
{
	if(ov && r == SP && !(cpu->flags & FLAG_STALL))
		cpu->flags |= FLAG_CKOVF;
	else
		cpu->flags &= ~FLAG_CKOVF;
	if(oda)
		cpu->flags |= FLAG_CKODA;
	else
		cpu->flags &= ~FLAG_CKODA;
	return BA = ba;
}

// Assembly:
movl %esi, %eax
xorl %esi, %esi
testl %r8d, %r8d
setne %sil
testl %ecx, %ecx
setne %cl
xorl $0x6, %edx
movl 0x38(%rdi), %r8d
movl %r8d, %r9d
andl $0x8, %r9d
orl %edx, %r9d
sete %dl
andb %cl, %dl
andl $-0x61, %r8d
movzbl %dl, %ecx
shll $0x5, %ecx
orl %r8d, %ecx
shll $0x6, %esi
orl %ecx, %esi
movl %esi, 0x38(%rdi)
movw %ax, 0x24(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: setMM
static void
setMM(KD11A *cpu, int mm)
{
	if(cpu->flags & FLAG_STALL){
		cpu->mode = 0;
		cpu->relocate = 0;
		return;
	}
	switch(mm&014){
	case 00: cpu->mode = cpu->cur; break;
	case 04: cpu->mode = cpu->temp; break;
	case 010: cpu->mode = cpu->mtp ? cpu->prev : cpu->cur; break;
	case 014: cpu->mode = cpu->mfp ? cpu->prev : cpu->cur; break;
	}
	cpu->relocate = (cpu->sr0&1) || (cpu->sr0&0400 && mm&1);
}

// Assembly:
testb $0x8, 0x38(%rdi)
jne 0x59f7
movl %esi, %eax
shrl $0x2, %eax
andl $0x3, %eax
leaq 0x2795(%rip), %rcx      # 0x817c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x86, %eax
jmp 0x5a29
andw $0x0, 0x84(%rdi)
xorl %eax, %eax
jmp 0x5a4c
xorl %eax, %eax
cmpl $0x0, 0x144(%rdi)
jmp 0x5a17
xorl %eax, %eax
cmpl $0x0, 0x140(%rdi)
setne %al
leaq 0x86(,%rax,2), %rax
jmp 0x5a29
movl $0x8a, %eax
movzwl (%rdi,%rax), %eax
movw %ax, 0x84(%rdi)
movzwl 0x138(%rdi), %eax
testb $0x1, %al
jne 0x5a49
shrl $0x8, %eax
andl %esi, %eax
andl $0x1, %eax
jmp 0x5a4c
pushq $0x1
popq %rax
movl %eax, 0x13c(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: writedest
static int
writedest(KD11A *cpu, int b)
{
	int d;
	// TODO: can we make this nicer??
	if((cpu->ir & 070) == 0){
		codes(cpu);
		d = cpu->ir & 7;
		if(d == SP && USER) d = USP;	// KT11-SP
		if(b) SETMASK(cpu->r[d], D, 0377);
		else cpu->r[d] = D;
	}else{
		if(b) D = (D<<8) | D&0377;
		setMM(cpu, 1);
		if(dato(cpu, b)) return 1;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
testb $0x38, 0x26(%rdi)
je 0x6348
testl %ebp, %ebp
je 0x6329
movb 0x22(%rbx), %al
movb %al, 0x23(%rbx)
pushq $0x1
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0x59d2
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5d55
testl %eax, %eax
jne 0x638b
jmp 0x6388
movq %rbx, %rdi
callq 0x5d3e
movzwl 0x26(%rbx), %eax
andl $0x7, %eax
cmpl $0x6, %eax
jne 0x6370
movb 0x86(%rbx), %al
andb $0x2, %al
shrb %al
movzbl %al, %eax
leal 0x6(,%rax,8), %eax
testl %ebp, %ebp
je 0x637e
movl %eax, %eax
movb 0x22(%rbx), %cl
movb %cl, (%rbx,%rax,2)
jmp 0x6388
movzwl 0x22(%rbx), %ecx
movl %eax, %eax
movw %cx, (%rbx,%rax,2)
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: datix
static int
datix(KD11A *cpu, int pse)
{
trace("dati%s %o %06o ", pse ? "p" : "", cpu->flags, cpu->ba);
	if(remapBA(cpu, pse))
		return 1;
trace(" phys(%o) <- ", PBA);
	if(checkbus(cpu, 0, pse))
		return 1;

	if(dati_cpu(cpu))
		goto ok;

	if((pse ? datip_bus : dati_bus)(cpu->bus))
		return buserr(cpu);
ok:
	trace("%06o\n", UNIBUS_DATA);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x0, 0x433dd(%rip)     # 0x49d60
je 0x69af
testl %r14d, %r14d
leaq 0x1fb2(%rip), %rax      # 0x8941
leaq 0x1d8f(%rip), %rsi      # 0x8725
cmoveq %rax, %rsi
movl 0x38(%rbx), %edx
movzwl 0x24(%rbx), %ecx
leaq 0x1d6d(%rip), %rdi      # 0x8715
xorl %eax, %eax
callq 0x20a0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x6b6c
pushq $0x1
popq %rbp
testl %eax, %eax
jne 0x6b39
cmpl $0x0, 0x43394(%rip)     # 0x49d60
je 0x69e3
movq 0x28(%rbx), %rax
movl 0x8(%rax), %esi
leaq 0x1d4b(%rip), %rdi      # 0x8727
xorl %eax, %eax
callq 0x20a0
movq %rbx, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x6cf5
testl %eax, %eax
jne 0x6b39
movq 0x28(%rbx), %rdi
movl 0x8(%rdi), %eax
cmpq $0x3e001, %rax          # imm = 0x3E001
jb 0x6aef
movl %eax, %ecx
andl $0x3fff0, %ecx          # imm = 0x3FFF0
cmpl $0x3ffa0, %ecx          # imm = 0x3FFA0
je 0x6a6e
cmpl $0x3f4e0, %ecx          # imm = 0x3F4E0
je 0x6a4b
cmpl $0x3ff80, %ecx          # imm = 0x3FF80
je 0x6a58
cmpl $0x3f4c0, %ecx          # imm = 0x3F4C0
jne 0x6a82
addl %eax, %eax
andl $0x1c, %eax
movl 0x10c(%rbx,%rax), %ecx
shll $0x2, %ecx
orl 0xcc(%rbx,%rax), %ecx
jmp 0x6a79
andl $0xe, %eax
movzwl 0x9c(%rbx,%rax), %ecx
jmp 0x6a79
andl $0xe, %eax
movl 0xec(%rbx,%rax,2), %ecx
shll $0x2, %ecx
orl 0xac(%rbx,%rax,2), %ecx
jmp 0x6a79
andl $0xe, %eax
movzwl 0x8c(%rbx,%rax), %ecx
movw %cx, 0xc(%rdi)
jmp 0x6b14
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x3ff7e, %ecx          # imm = 0x3FF7E
je 0x6aac
cmpl $0x3ff7c, %ecx          # imm = 0x3FF7C
je 0x6aa8
cmpl $0x3ff7a, %ecx          # imm = 0x3FF7A
jne 0x6ab5
movzwl 0x138(%rbx), %ecx
jmp 0x6a79
xorl %ecx, %ecx
jmp 0x6a79
movzwl 0x13a(%rbx), %ecx
jmp 0x6a79
movl %eax, %ecx
notl %ecx
testl $0x3ff00, %ecx          # imm = 0x3FF00
jne 0x6aef
movzbl %al, %eax
leal -0xfe(%rax), %ecx
cmpl $0x2, %ecx
jb 0x6b40
leal -0xfc(%rax), %ecx
cmpl $0x2, %ecx
jb 0x6b60
addl $-0x78, %eax
cmpl $0x1, %eax
ja 0x6aef
movzwl 0x80(%rbx), %ecx
jmp 0x6a79
testl %r14d, %r14d
jne 0x6afd
leaq -0x479c(%rip), %rax     # 0x235f
jmp 0x6b04
leaq -0x4776(%rip), %rax     # 0x238e
callq *%rax
testl %eax, %eax
je 0x6b14
movq %rbx, %rdi
callq 0x6d98
jmp 0x6b39
cmpl $0x0, 0x43245(%rip)     # 0x49d60
je 0x6b37
movq 0x28(%rbx), %rax
movzwl 0xc(%rax), %esi
leaq 0x1b88(%rip), %rdi      # 0x86b4
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x20a0
jmp 0x6b39
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movzwl 0x86(%rbx), %eax
shll $0xe, %eax
movl 0x88(%rbx), %edx
shll $0xc, %edx
orl %eax, %edx
movzbl 0x30(%rbx), %ecx
orl %edx, %ecx
jmp 0x6a79
movzwl 0x82(%rbx), %ecx
jmp 0x6a79
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: remapBA
static int
remapBA(KD11A *cpu, int wr)
{
#ifdef KT11
	int i, pg, abrt;
	cpu->wrpg = nil;
	if(!cpu->relocate){
		PBA = ubxt(BA);
		cpu->flags &= ~FLAG_FAULT;
		return 0;
	}
	pg = BA>>13;
	i = (cpu->mode&2 ? 0 : 8) | pg;
	PBA = ((BA&017777) + (cpu->par[i]<<6)) & 0777777;

	abrt = 0;
	// not resident (or illegal mode)
	if((cpu->acf[i]&2)==0 || (6>>cpu->mode)&1)
		abrt |= 0100000;
	// page length
	if(cpu->acf[i]&010 ? ((BA&017700) < cpu->plf[i]) : ((BA&017700) > cpu->plf[i]))
		abrt |= 0040000;
	// read-only
	if(wr && (cpu->acf[i]&6)==2)
		abrt |= 0020000;
	abrt |= cpu->mode<<5 | pg<<1;
	if(!ABORT)
		SETMASK(cpu->sr0, abrt, 0160156);
	if((abrt&0160000) && !(cpu->flags & FLAG_STALL) && !(cpu->flags&FLAG_CKODA && BA&1)){
		cpu->flags |= FLAG_FAULT;
		return 1;
	}
	if(wr &&
	   !((PBA&0777770) == 0777570 && (PBA&0777776) != 0777570))	// ignore write to SR registers
		cpu->wrpg = &cpu->acf[i];
	cpu->flags &= ~FLAG_FAULT;
	return 0;
#else
	PBA = ubxt(BA);
	return 0;
#endif
}

// Assembly:
andq $0x0, 0x130(%rdi)
cmpl $0x0, 0x13c(%rdi)
movzwl 0x24(%rdi), %eax
je 0x6c09
pushq %rbp
pushq %rbx
movl %eax, %r8d
shrl $0xd, %r8d
movzwl 0x84(%rdi), %r9d
movl %r9d, %ecx
notl %ecx
andl $0x2, %ecx
leal (%r8,%rcx,4), %ecx
movl %eax, %r10d
andl $0x1fff, %r10d          # imm = 0x1FFF
movzwl 0x8c(%rdi,%rcx,2), %edx
shll $0x6, %edx
addl %r10d, %edx
movl %edx, %r10d
andl $0x3ffff, %r10d         # imm = 0x3FFFF
movq 0x28(%rdi), %r11
movl %r10d, 0x8(%r11)
movl 0xac(%rdi,%rcx,4), %r10d
testb $0x2, %r10b
je 0x6be8
xorl %r11d, %r11d
movl $0x6, %ebx
btl %r9d, %ebx
jae 0x6bee
movl $0x8000, %r11d          # imm = 0x8000
movl %eax, %ebx
andl $0x1fc0, %ebx           # imm = 0x1FC0
movl 0xec(%rdi,%rcx,4), %ebp
testb $0x8, %r10b
jne 0x6c27
cmpl %ebx, %ebp
jl 0x6c2b
jmp 0x6c32
movl %eax, %ecx
notl %ecx
leal 0x30000(%rax), %edx
testw $0xe000, %cx            # imm = 0xE000
cmovnel %eax, %edx
movq 0x28(%rdi), %rax
movl %edx, 0x8(%rax)
jmp 0x6cee
cmpl %ebx, %ebp
jle 0x6c32
orl $0x4000, %r11d          # imm = 0x4000
andl $0x6, %r10d
movl %r11d, %ebx
orl $0x2000, %ebx           # imm = 0x2000
cmpl $0x2, %r10d
cmovnel %r11d, %ebx
testl %esi, %esi
cmovel %r11d, %ebx
shll $0x5, %r9d
leal (%r9,%r8,2), %r8d
orl %ebx, %r8d
movzwl 0x138(%rdi), %r9d
cmpw $0x1fff, %r9w           # imm = 0x1FFF
popq %rbx
popq %rbp
ja 0x6c86
andl $0x1f91, %r9d           # imm = 0x1F91
movl %r8d, %r10d
andl $0x1fe06e, %r10d        # imm = 0x1FE06E
orl %r9d, %r10d
movw %r10w, 0x138(%rdi)
testw $0xe000, %r8w           # imm = 0xE000
je 0x6cb9
movl 0x38(%rdi), %r8d
testb $0x8, %r8b
jne 0x6cb9
movl %r8d, %r9d
andl $0x40, %r9d
shrl $0x6, %r9d
testl %r9d, %eax
jne 0x6cb9
orl $0x200, %r8d            # imm = 0x200
movl %r8d, 0x38(%rdi)
movl $0x1, %eax
retq
testl %esi, %esi
je 0x6cee
movl %edx, %eax
andl $0x3fff8, %eax          # imm = 0x3FFF8
movl $0x3ff78, %esi          # imm = 0x3FF78
cmpl %esi, %eax
sete %al
andl $0x3ff7e, %edx          # imm = 0x3FF7E
cmpl %esi, %edx
setne %dl
testb %dl, %al
jne 0x6cee
leaq (%rdi,%rcx,4), %rax
addq $0xac, %rax
movq %rax, 0x130(%rdi)
andb $-0x3, 0x39(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: checkbus
static int
checkbus(KD11A *cpu, int wr, int pse)
{
	int err = 0;
	int ba = BA&~1;
	if((wr|pse) && !(cpu->mode&2) && cpu->flags&FLAG_CKOVF){
		if(ba == 0177776 ||	// PSW
#ifdef KJ11
		   ba == 0177774 ||	// SLR
#endif
		   ba == 0177570){	// SR
			cpu->flags |= FLAG_OVFLW;	// proc address
			err = ovflwerr(cpu);
// TODO: what's going on here with KT11?
		}else if((BA&0177400) < SLR){
			cpu->flags |= FLAG_OVFLW;
			err = ovflwerr(cpu);
		}else if((BA&0177400) == SLR){
			cpu->flags |= FLAG_OVFLW;	// yellow zone
			if((BA&0340)!=0340)
				err = ovflwerr(cpu);
		}
	}
	if(cpu->flags&FLAG_CKODA && BA&1)
		err = buserr(cpu);
	return err;
}

// Assembly:
movzwl 0x24(%rdi), %ecx
xorl %eax, %eax
orl %edx, %esi
je 0x6d6f
testb $0x2, 0x84(%rdi)
jne 0x6d6f
movl 0x38(%rdi), %edx
testb $0x20, %dl
je 0x6d6f
movl %ecx, %r8d
andl $-0x2, %r8d
movl %ecx, %esi
notl %esi
testw $0xfffc, %si            # imm = 0xFFFC
setne %r9b
cmpl $0xff78, %r8d           # imm = 0xFF78
setne %r8b
testb %r8b, %r9b
je 0x6d4b
movl %ecx, %r8d
andl $0xff00, %r8d           # imm = 0xFF00
movzwl 0x82(%rdi), %r9d
cmpl %r9d, %r8d
jae 0x6d88
orl $0x10, %edx
andw $0x0, 0x84(%rdi)
andl $0x0, 0x13c(%rdi)
pushq $0x1
popq %rax
andl $0xffffff71, %edx       # imm = 0xFFFFFF71
orl $0x88, %edx
movl %edx, 0x38(%rdi)
testb $0x40, 0x38(%rdi)
je 0x6d87
andl $0x1, %ecx
je 0x6d87
pushq %rax
callq 0x6d98
pushq $0x1
popq %rax
addq $0x8, %rsp
retq
jne 0x6d6f
orl $0x10, %edx
movl %edx, 0x38(%rdi)
testb $-0x20, %sil
jne 0x6d4e
jmp 0x6d6f
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: wrpdr
static void
wrpdr(KD11A *cpu, int i, int b)
{
	if(!b || (BA&1)==0)
		cpu->acf[i] = UNIBUS_DATA & 016;
	if(!b || BA&1)
		cpu->plf[i] = UNIBUS_DATA>>2 & 017700;
	cpu->acf[i] &= ~0100;	// W bit
}

// Assembly:
testl %edx, %edx
je 0x6ddf
movq 0x28(%rdi), %rax
movzwl 0xc(%rax), %eax
testb $0x1, 0x24(%rdi)
jne 0x6df7
movzwl %ax, %eax
andl $0xe, %eax
movl %esi, %ecx
movl %eax, 0xac(%rdi,%rcx,4)
jmp 0x6e08
movq 0x28(%rdi), %rax
movzwl 0xc(%rax), %eax
movl %eax, %edx
andl $0xe, %edx
movl %esi, %ecx
movl %edx, 0xac(%rdi,%rcx,4)
jmp 0x6df9
movl %esi, %ecx
shrl $0x2, %eax
andl $0x1fc0, %eax           # imm = 0x1FC0
movl %eax, 0xec(%rdi,%rcx,4)
andb $-0x41, 0xac(%rdi,%rcx,4)
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/kd11a.c
// Function: wrpar
static void
wrpar(KD11A *cpu, int i, int b)
{
	if(!b || (BA&1)==0)
		cpu->par[i] = cpu->par[i]&07400 | UNIBUS_DATA&0377;
	if(!b || BA&1)
		cpu->par[i] = UNIBUS_DATA&07400 | cpu->par[i]&0377;
	cpu->acf[i] &= ~0100;	// W bit
}

// Assembly:
movl %esi, %eax
testl %edx, %edx
je 0x6e1d
testb $0x1, 0x24(%rdi)
jne 0x6e4b
movzwl 0x8c(%rdi,%rax,2), %r8d
andl $0xf00, %r8d            # imm = 0xF00
movq 0x28(%rdi), %rsi
movzbl 0xc(%rsi), %ecx
orl %ecx, %r8d
movw %r8w, 0x8c(%rdi,%rax,2)
testl %edx, %edx
je 0x6e57
testb $0x1, 0x24(%rdi)
je 0x6e6e
movq 0x28(%rdi), %rsi
movzbl 0x8c(%rdi,%rax,2), %ecx
movzwl 0xc(%rsi), %edx
andl $0xf00, %edx            # imm = 0xF00
movzwl %cx, %ecx
orl %edx, %ecx
movw %cx, 0x8c(%rdi,%rax,2)
andb $-0x41, 0xac(%rdi,%rax,4)
retq
nop
// File: /workspace/github_c_makefile_star2_O2/minkcv[P]vm/main.c
// Function: readRom
uint8_t* readRom(const char* filename, int print)
{
    FILE* romfile = fopen(filename, "rb");
    if (romfile == NULL)
    {
        printf("Error reading file %s\n", filename);
        exit(1);
    }
    uint8_t* rom = malloc(sizeof(uint8_t) * 128 * MEMORY_SEGMENT_SIZE);
    memset(rom, 0, sizeof(uint8_t) * 128 * MEMORY_SEGMENT_SIZE);
    size_t bytesRead = fread(rom, sizeof(uint8_t), 128 * MEMORY_SEGMENT_SIZE, romfile);
    printf("Read %Id bytes from the rom\n", bytesRead);
    if (print)
    {
        printf("Rom:\n");
        int i;
        for (i = 0; i < bytesRead; i++)
            printf("%2X\n", rom[i]);
    }
    fclose(romfile);
    return rom;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r15d
movq %rdi, %r14
leaq 0x19e3(%rip), %rsi      # 0x3004
callq 0x1160
testq %rax, %rax
je 0x16bb
movq %rax, %rbx
pushq $0x1
popq %r12
movl $0x8000, %esi           # imm = 0x8000
movq %r12, %rdi
callq 0x10c0
movq %rax, %r14
movl $0x8000, %edx           # imm = 0x8000
movq %rax, %rdi
movq %r12, %rsi
movq %rbx, %rcx
callq 0x11c0
movq %rax, %r12
leaq 0x1a04(%rip), %rdi      # 0x3067
movq %rax, %rsi
xorl %eax, %eax
callq 0x1040
testl %r15d, %r15d
je 0x16a1
leaq 0x1a3b(%rip), %rdi      # 0x30b4
callq 0x11d0
leaq 0x19dd(%rip), %r15      # 0x3062
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x16a1
movzbl (%r14,%r13), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1040
incq %r13
jmp 0x1688
movq %rbx, %rdi
callq 0x1130
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1945(%rip), %rdi      # 0x3007
movq %r14, %rsi
xorl %eax, %eax
callq 0x1040
pushq $0x1
popq %rdi
callq 0x1180
// File: /workspace/github_c_makefile_star2_O2/minkcv[P]vm/machine/vm.c
// Function: createVM
VM* createVM(uint16_t* code, uint8_t* rom, Display* display, int debugMode)
{
    VM* vm = (VM*)malloc(sizeof(VM));
    vm->cpu.code = code;
    vm->cpu.pc = code;
    vm->cpu.debugMode = debugMode;
    vm->cpu.breakState = 0;
    vm->cpu.step = 0;
    vm->display = display;
    vm->gpu = createGPU();
    vm->ipu = createIPU();
    memset(vm->memory, 0, sizeof(vm->memory[0][0]) * MEMORY_SEGMENT_COUNT * MEMORY_SEGMENT_SIZE);
    memset(vm->cpu.regs, 0, sizeof(vm->cpu.regs[0]) * REGISTER_COUNT);
    if (rom != NULL) // ROM is optional
        memcpy(vm->memory[128], rom, 128 * MEMORY_SEGMENT_SIZE);
    return vm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r13
movl $0x10048, %edi          # imm = 0x10048
callq 0x1190
movq %rax, %r14
movq %r13, 0x18(%rax)
movq %r13, 0x10(%rax)
movl %r15d, 0x20(%rax)
andq $0x0, 0x24(%rax)
movq %r12, 0x10040(%rax)
callq 0x1c64
movq %rax, 0x10030(%r14)
xorl %eax, %eax
callq 0x22fc
movq %rax, 0x10038(%r14)
leaq 0x30(%r14), %rdi
movl $0x10000, %edx          # imm = 0x10000
xorl %esi, %esi
callq 0x10a0
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
testq %rbx, %rbx
je 0x1760
movq %r14, %rdi
addq $0x8030, %rdi           # imm = 0x8030
movl $0x8000, %edx           # imm = 0x8000
movq %rbx, %rsi
callq 0x10f0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/minkcv[P]vm/machine/vm.c
// Function: destroyVM
void destroyVM(VM* vm)
{
    destroyGPU(vm->gpu);
    vm->gpu = NULL;
    destroyIPU(vm->ipu);
    vm->ipu = NULL;
    free(vm);
    vm = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10030(%rdi), %rdi
callq 0x1caa
andq $0x0, 0x10030(%rbx)
movq 0x10038(%rbx), %rdi
callq 0x236f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1170
// File: /workspace/github_c_makefile_star2_O2/minkcv[P]vm/machine/display.c
// Function: createDisplay
Display* createDisplay(int width, int height, int scale, int pitch)
{
    SDL_Init(SDL_INIT_VIDEO);

    Display* display = (Display*)malloc(sizeof(Display));
    display->width = width;
    display->height = height;
    display->scale = scale;
    display->pitch = pitch;
    display->window = SDL_CreateWindow("Vapor Spec", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 
            width * scale, height * scale, 0);
    display->renderer = SDL_CreateRenderer(display->window, -1, 0);
    display->back = SDL_CreateTexture(display->renderer, 
            SDL_PIXELFORMAT_RGB24, SDL_TEXTUREACCESS_STREAMING, width, height);
    SDL_Surface* splash = SDL_LoadBMP("title.bmp");
    SDL_Texture* splashTex = SDL_CreateTextureFromSurface(display->renderer, splash);
    SDL_RenderCopy(display->renderer, splashTex, NULL, NULL);
    SDL_RenderPresent(display->renderer);
    SDL_Delay(2000); // Show splash screen for 2 seconds
    return display;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r13d
movl %edx, %r12d
movl %esi, %r14d
movl %edi, %r15d
pushq $0x20
popq %rdi
callq 0x1100
pushq $0x28
popq %rdi
callq 0x1190
movq %rax, %rbx
movl %r15d, 0x18(%rax)
movl %r14d, 0x1c(%rax)
movl %r12d, 0x20(%rax)
movl %r13d, 0x24(%rax)
movl %r12d, %ecx
imull %r15d, %ecx
imull %r14d, %r12d
leaq 0x15e5(%rip), %rdi      # 0x3148
movl $0x2fff0000, %esi       # imm = 0x2FFF0000
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
movl %r12d, %r8d
xorl %r9d, %r9d
callq 0x1050
movq %rax, (%rbx)
pushq $-0x1
popq %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x1030
movq %rax, %r12
movq %rax, 0x8(%rbx)
pushq $0x1
popq %r13
movq %rax, %rdi
movl $0x17101803, %esi       # imm = 0x17101803
movl %r13d, %edx
movl %r15d, %ecx
movl %r14d, %r8d
callq 0x11f0
movq %rax, 0x10(%rbx)
leaq 0x159f(%rip), %rdi      # 0x3153
leaq 0x1449(%rip), %rsi      # 0x3004
callq 0x1090
movq %rax, %rdi
movl %r13d, %esi
callq 0x1110
movq %r12, %rdi
movq %rax, %rsi
callq 0x11a0
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1150
movq %r12, %rdi
callq 0x1070
movl $0x7d0, %edi            # imm = 0x7D0
callq 0x10d0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/minkcv[P]vm/machine/display.c
// Function: updateDisplay
void updateDisplay(Display* display, GPU* gpu)
{
    SDL_UpdateTexture(display->back, NULL, gpu->pixels, gpu->pitch);
    SDL_RenderClear(display->renderer);
    SDL_RenderCopy(display->renderer, display->back, NULL, NULL);
    SDL_RenderPresent(display->renderer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movq 0xc00(%rsi), %rdx
movl 0xc08(%rsi), %ecx
xorl %esi, %esi
callq 0x10e0
movq 0x8(%rbx), %rdi
callq 0x1120
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1150
movq 0x8(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1070
// File: /workspace/github_c_makefile_star2_O2/minkcv[P]vm/machine/gpu.c
// Function: createGPU
GPU* createGPU()
{
    GPU* gpu = (GPU*)malloc(sizeof(GPU));
    gpu->active = 1;
    gpu->bytesPerPixel = 3; // From SDL_PIXELFORMAT_RGB24 in display.c
    gpu->pitch = SCREEN_WIDTH * gpu->bytesPerPixel;
    gpu->pixels = (uint8_t *) malloc(sizeof(uint8_t) * gpu->bytesPerPixel * SCREEN_WIDTH * SCREEN_HEIGHT);
    return gpu;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0xc18, %edi            # imm = 0xC18
callq 0x1190
movq %rax, %rbx
movb $-0x1, 0xc10(%rax)
movabsq $0x300000300, %rax      # imm = 0x300000300
movq %rax, 0xc08(%rbx)
movl $0x24000, %edi          # imm = 0x24000
callq 0x1190
movq %rax, 0xc00(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/minkcv[P]vm/machine/gpu.c
// Function: readSpritesFromMem
void readSpritesFromMem(GPU* gpu, uint8_t memory[MEMORY_SEGMENT_COUNT][MEMORY_SEGMENT_SIZE])
{
    int i;
    for (i = 0; i < NUM_SPRITES; i++)
    {
        uint8_t flags = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH];
        gpu->sprAttrs[i].active = flags >> 7;
        gpu->sprAttrs[i].flipHor = flags >> 6 & 0x1;
        gpu->sprAttrs[i].flipVer = flags >> 5 & 0x1;
        gpu->sprAttrs[i].color4Alpha = flags >> 4 & 0x1;
        gpu->sprAttrs[i].fullWidth = flags >> 3 & 0x1;
        gpu->sprAttrs[i].fullHeight = flags >> 2 & 0x1;
        gpu->sprAttrs[i].x = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 1];
        gpu->sprAttrs[i].y = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 2];
        gpu->sprAttrs[i].width = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 3];
        gpu->sprAttrs[i].height = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 4];
        gpu->sprAttrs[i].segmentAddr = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 5];
        gpu->sprAttrs[i].byteAddr = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 6];
        gpu->sprAttrs[i].colors[0] = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 7];
        gpu->sprAttrs[i].colors[1] = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 8];
        gpu->sprAttrs[i].colors[2] = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 9];
        gpu->sprAttrs[i].colors[3] = memory[SPRITE_ATTR_SEG][i * SPRITE_ATTR_LENGTH + 10];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
cmpq $0x1000, %rax           # imm = 0x1000
je 0x1df2
movb 0x4000(%rsi,%rax), %cl
movl %ecx, %edx
shrb $0x7, %dl
movb (%rdi), %r8b
andb $-0x40, %r8b
orb %dl, %r8b
movl %ecx, %edx
shrb $0x5, %dl
andb $0x2, %dl
orb %r8b, %dl
movl %ecx, %r8d
shrb $0x3, %r8b
andb $0x4, %r8b
orb %dl, %r8b
movl %ecx, %edx
shrb %dl
andb $0x8, %dl
orb %r8b, %dl
leal (%rcx,%rcx), %r8d
andb $0x10, %r8b
orb %dl, %r8b
shlb $0x3, %cl
andb $0x20, %cl
orb %r8b, %cl
movb %cl, (%rdi)
movb 0x4001(%rsi,%rax), %cl
movb %cl, 0x1(%rdi)
movb 0x4002(%rsi,%rax), %cl
movb %cl, 0x2(%rdi)
movb 0x4003(%rsi,%rax), %cl
movb %cl, 0x3(%rdi)
movb 0x4004(%rsi,%rax), %cl
movb %cl, 0x4(%rdi)
movb 0x4005(%rsi,%rax), %cl
movb %cl, 0x5(%rdi)
movb 0x4006(%rsi,%rax), %cl
movb %cl, 0x6(%rdi)
movb 0x4007(%rsi,%rax), %cl
movb %cl, 0x7(%rdi)
movb 0x4008(%rsi,%rax), %cl
movb %cl, 0x8(%rdi)
movb 0x4009(%rsi,%rax), %cl
movb %cl, 0x9(%rdi)
movb 0x400a(%rsi,%rax), %cl
movb %cl, 0xa(%rdi)
addq $0x10, %rax
addq $0xc, %rdi
jmp 0x1d26
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/minkcv[P]vm/machine/ipu.c
// Function: createIPU
IPU* createIPU()
{
    IPU* ipu = (IPU*)malloc(sizeof(IPU));
    JOYSTICK* js1 = (JOYSTICK*)malloc(sizeof(JOYSTICK));
    js1->buttons[0] = SDLK_UP;
    js1->buttons[1] = SDLK_DOWN;
    js1->buttons[2] = SDLK_LEFT;
    js1->buttons[3] = SDLK_RIGHT;
    js1->buttons[4] = SDLK_o;
    js1->buttons[5] = SDLK_u;
    js1->buttons[6] = SDLK_y;
    js1->buttons[7] = SDLK_h;
    js1->keysAsBits = 0;
    ipu->js1 = js1;

    JOYSTICK* js2 = (JOYSTICK*)malloc(sizeof(JOYSTICK));
    js2->buttons[0] = SDLK_w;
    js2->buttons[1] = SDLK_s;
    js2->buttons[2] = SDLK_a;
    js2->buttons[3] = SDLK_d;
    js2->buttons[4] = SDLK_q;
    js2->buttons[5] = SDLK_e;
    js2->buttons[6] = SDLK_r;
    js2->buttons[7] = SDLK_f;
    js2->keysAsBits = 0;
    ipu->js2 = js2;

    return ipu;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $0x10
popq %rdi
callq 0x1190
movq %rax, %rbx
pushq $0x24
popq %r14
movq %r14, %rdi
callq 0x1190
movaps 0xe3c(%rip), %xmm0      # 0x3160
movups %xmm0, (%rax)
movaps 0xe42(%rip), %xmm0      # 0x3170
movups %xmm0, 0x10(%rax)
xorl %r15d, %r15d
movb %r15b, 0x20(%rax)
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x1190
movaps 0xe35(%rip), %xmm0      # 0x3180
movups %xmm0, (%rax)
movaps 0xe3b(%rip), %xmm0      # 0x3190
movups %xmm0, 0x10(%rax)
movb %r15b, 0x20(%rax)
movq %rax, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq