LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/somethingnew2-0[P]CS537-P4/cs537.c
// Function: rio_read
static ssize_t rio_read(rio_t *rp, char *usrbuf, size_t n)
{
    int cnt;

    while (rp->rio_cnt <= 0) {  /* refill if buf is empty */
        rp->rio_cnt = read(rp->rio_fd, rp->rio_buf, 
                           sizeof(rp->rio_buf));
        if (rp->rio_cnt < 0) {
            if (errno != EINTR) /* interrupted by sig handler return */
                return -1;
        }
        else if (rp->rio_cnt == 0)  /* EOF */
            return 0;
        else 
            rp->rio_bufptr = rp->rio_buf; /* reset buffer ptr */
    }

    /* Copy min(n, rp->rio_cnt) bytes from internal buf to user buf */
    cnt = n;          
    if (rp->rio_cnt < n)   
        cnt = rp->rio_cnt;
    memcpy(usrbuf, rp->rio_bufptr, cnt);
    rp->rio_bufptr += cnt;
    rp->rio_cnt -= cnt;
    return cnt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %r13
movl 0x4(%rdi), %ebp
pushq $-0x1
popq %r14
testl %ebp, %ebp
jg 0x19e6
movl (%rbx), %edi
movl $0x2000, %edx           # imm = 0x2000
movq %r13, %rsi
callq 0x10e0
movq %rax, %rbp
movl %ebp, 0x4(%rbx)
testl %ebp, %ebp
js 0x19da
je 0x1a0b
movq %r13, 0x8(%rbx)
jmp 0x19b5
callq 0x1030
cmpl $0x4, (%rax)
je 0x19b5
jmp 0x1a0e
movl %ebp, %eax
cmpq %r12, %rax
cmovael %r12d, %ebp
movq 0x8(%rbx), %rsi
movslq %ebp, %r14
movq %r15, %rdi
movq %r14, %rdx
callq 0x1130
addq %r14, 0x8(%rbx)
subl %r14d, 0x4(%rbx)
jmp 0x1a0e
xorl %r14d, %r14d
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/somethingnew2-0[P]CS537-P4/cs537.c
// Function: rio_readlineb
ssize_t rio_readlineb(rio_t *rp, void *usrbuf, size_t maxlen) 
{
    int n, rc;
    char c, *bufp = usrbuf;

    for (n = 1; n < maxlen; n++) { 
        if ((rc = rio_read(rp, &c, 1)) == 1) {
            *bufp++ = c;
            if (c == '\n')
                break;
        } else if (rc == 0) {
            if (n == 1)
                return 0; /* EOF, no data read */
            else
                break;    /* EOF, some data was read */
        } else
            return -1;    /* error */
    }
    *bufp = 0;
    return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r14
cmpq $0x1, %rdx
movq %rdx, %rax
adcq $0x0, %rax
movq %rax, 0x10(%rsp)
movq %rdi, %r12
pushq $0x1
popq %r13
leaq 0xf(%rsp), %rbp
movq %r13, %rbx
cmpq %r15, %rbx
jae 0x1a8d
movq %r12, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x1996
cmpq $0x1, %rax
jne 0x1a7e
movb 0xf(%rsp), %al
movb %al, -0x1(%r14,%rbx)
cmpb $0xa, %al
je 0x1a9f
incq %rbx
jmp 0x1a53
testq %rax, %rax
jne 0x1a9a
cmpq $0x1, %rbx
jne 0x1aa4
xorl %ebx, %ebx
jmp 0x1aae
addq %rbx, %r14
decq %r14
movq 0x10(%rsp), %rbx
jmp 0x1aaa
pushq $-0x1
popq %rbx
jmp 0x1aae
addq %rbx, %r14
jmp 0x1aaa
addq %rbx, %r14
decq %r14
movb $0x0, (%r14)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/somethingnew2-0[P]CS537-P4/cs537.c
// Function: open_clientfd
int open_clientfd(char *hostname, int port) 
{
    int clientfd;
    struct hostent *hp;
    struct sockaddr_in serveraddr;

    if ((clientfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
        return -1; /* check errno for cause of error */

    /* Fill in the server's IP address and port */
    if ((hp = gethostbyname(hostname)) == NULL)
        return -2; /* check h_errno for cause of error */
    bzero((char *) &serveraddr, sizeof(serveraddr));
    serveraddr.sin_family = AF_INET;
    bcopy((char *)hp->h_addr, 
          (char *)&serveraddr.sin_addr.s_addr, hp->h_length);
    serveraddr.sin_port = htons(port);

    /* Establish a connection with the server */
    if (connect(clientfd, (SA *) &serveraddr, sizeof(serveraddr)) < 0)
        return -1;
    return clientfd;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %r14
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x1280
testl %eax, %eax
js 0x1bab
movl %eax, %ebx
movq %r14, %rdi
callq 0x1100
testq %rax, %rax
je 0x1baf
leaq 0x4(%rsp), %r14
andl $0x0, 0x8(%r14)
andq $0x0, (%r14)
movw $0x2, -0x4(%r14)
movq 0x18(%rax), %rcx
movq (%rcx), %rsi
movslq 0x14(%rax), %rdx
movq %r14, %rdi
callq 0x11a0
rolw $0x8, %bp
movw %bp, -0x2(%r14)
movq %rsp, %rsi
pushq $0x10
popq %rdx
movl %ebx, %edi
callq 0x1220
testl %eax, %eax
pushq $-0x1
popq %rax
cmovnsl %ebx, %eax
jmp 0x1bb2
pushq $-0x1
jmp 0x1bb1
pushq $-0x2
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/somethingnew2-0[P]CS537-P4/cs537.c
// Function: open_listenfd
int open_listenfd(int port) 
{
    int listenfd, optval=1;
    struct sockaddr_in serveraddr;
  
    /* Create a socket descriptor */
    if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
      fprintf(stderr, "socket failed\n");
      return -1;
    }
 
    /* Eliminates "Address already in use" error from bind. */
    if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, 
                   (const void *)&optval , sizeof(int)) < 0) {
      fprintf(stderr, "setsockopt failed\n");
      return -1;
    }

    /* Listenfd will be an endpoint for all requests to port
       on any IP address for this host */
    bzero((char *) &serveraddr, sizeof(serveraddr));
    serveraddr.sin_family = AF_INET; 
    serveraddr.sin_addr.s_addr = htonl(INADDR_ANY); 
    serveraddr.sin_port = htons((unsigned short)port); 
    if (bind(listenfd, (SA *)&serveraddr, sizeof(serveraddr)) < 0) {
      fprintf(stderr, "bind failed\n");
      return -1;
    }

    /* Make it a listening socket ready to accept connection requests */
    if (listen(listenfd, LISTENQ) < 0) {
      fprintf(stderr, "listen failed\n");
      return -1;
    }
    return listenfd;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebp
movl $0x1, 0x4(%rsp)
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x1280
testl %eax, %eax
js 0x1c44
movl %eax, %ebx
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq 0x4(%rsp), %rcx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x1040
testl %eax, %eax
js 0x1c59
leaq 0x8(%rsp), %rsi
andq $0x0, 0x8(%rsi)
movw $0x2, (%rsi)
andl $0x0, 0x4(%rsi)
rolw $0x8, %bp
movw %bp, 0x2(%rsi)
pushq $0x10
popq %rdx
movl %ebx, %edi
callq 0x1190
testl %eax, %eax
js 0x1c6e
movl %ebx, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x1160
testl %eax, %eax
jns 0x1c8d
movq 0x23c0(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x5ea(%rip), %rdi       # 0x222c
jmp 0x1c55
movq 0x23ad(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x5a8(%rip), %rdi       # 0x21fd
pushq $0xe
jmp 0x1c81
movq 0x2398(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x5a2(%rip), %rdi       # 0x220c
pushq $0x12
jmp 0x1c81
movq 0x2383(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x5a0(%rip), %rdi       # 0x221f
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
callq 0x1230
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/somethingnew2-0[P]CS537-P4/cs537.c
// Function: Open_clientfd
int Open_clientfd(char *hostname, int port) 
{
    int rc;

    if ((rc = open_clientfd(hostname, port)) < 0) {
        if (rc == -1)
            unix_error("Open_clientfd Unix error");
        else        
            dns_error("Open_clientfd DNS error");
    }
    return rc;
}

// Assembly:
pushq %rax
callq 0x1b36
testl %eax, %eax
js 0x1ca2
popq %rcx
retq
cmpl $-0x1, %eax
jne 0x1cb3
leaq 0x58d(%rip), %rdi       # 0x223b
callq 0x1574
leaq 0x59a(%rip), %rdi       # 0x2254
callq 0x15e3
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Quasi.c
// Function: Configure
void Configure(float* paramsIn, int* paletteIn)
{
    SetDuration(3.0);
    SetAspect(1.0 / 1.0);
    for(int i = 0; i < 256; i++) {
        palette[i] = RGBi(paletteIn[i * 3], paletteIn[i * 3 + 1], paletteIn[i * 3 + 2]);
    }
    
    for(int i = 0; i < 16; i++) {
        params[i] = paramsIn[i];
    }
    printf("Lin %f / Pol %f / OfLin %f / OfPol %f\n", params[0], params[1], params[2], params[3]);
    printf("Pal entry 0: %d %d %d\n", paletteIn[0], paletteIn[1], paletteIn[2]);
    printf("Pal entry 255: %d %d %d\n", paletteIn[768 - 3], paletteIn[768 - 2], paletteIn[768 - 1]);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movss 0xad0c(%rip), %xmm0     # 0xc004
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2a0f
movss 0xacfd(%rip), %xmm0     # 0xc008
callq 0x2a06
movq $-0xc00, %rax           # imm = 0xF400
leaq 0xfe22(%rip), %rcx      # 0x11140
movss 0xace6(%rip), %xmm0     # 0xc00c
testq %rax, %rax
je 0x13a3
movl 0xc00(%rbx,%rax), %edx
testl %edx, %edx
js 0x134d
cvtsi2ss %edx, %xmm1
minss %xmm0, %xmm1
cvttss2si %xmm1, %edx
shll $0x8, %edx
orl $0xff, %edx
jmp 0x1352
movl $0xff, %edx
movl 0xc04(%rbx,%rax), %r8d
xorl %esi, %esi
movl $0x0, %edi
testl %r8d, %r8d
js 0x1376
cvtsi2ss %r8d, %xmm1
minss %xmm0, %xmm1
cvttss2si %xmm1, %edi
shll $0x10, %edi
movl 0xc08(%rbx,%rax), %r8d
testl %r8d, %r8d
js 0x1393
cvtsi2ss %r8d, %xmm1
minss %xmm0, %xmm1
cvttss2si %xmm1, %esi
shll $0x18, %esi
orl %edx, %edi
addq $0xc, %rax
orl %esi, %edi
movl %edi, (%rcx)
addq $0x4, %rcx
jmp 0x1326
xorl %eax, %eax
leaq 0x10194(%rip), %rcx     # 0x11540
cmpq $0x40, %rax
je 0x13c3
movss (%r14,%rax), %xmm0
movss %xmm0, (%rax,%rcx)
addq $0x4, %rax
jmp 0x13ac
cvtss2sd 0x10175(%rip), %xmm0    # 0x11540
cvtss2sd 0x10171(%rip), %xmm1    # 0x11544
cvtss2sd 0x1016d(%rip), %xmm2    # 0x11548
cvtss2sd 0x10169(%rip), %xmm3    # 0x1154c
leaq 0xac86(%rip), %rdi      # 0xc070
movb $0x4, %al
callq 0x10b0
movl (%rbx), %esi
movl 0x4(%rbx), %edx
movl 0x8(%rbx), %ecx
leaq 0xac97(%rip), %rdi      # 0xc097
xorl %eax, %eax
callq 0x10b0
movl 0xbf4(%rbx), %esi
movl 0xbf8(%rbx), %edx
leaq 0xac94(%rip), %rdi      # 0xc0ae
movl 0xbfc(%rbx), %ecx
xorl %eax, %eax
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r14
jmp 0x10b0
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Quasi.c
// Function: PixelLoop
Pixel PixelLoop(float x, float y, float time)
{
    float crystal = quasi(vec2(x, y), time * 2.0f * M_PI);
    int crystal_quant = (int)(crystal*255.0);

    crystal_quant = crystal_quant < 0 ? 0 : crystal_quant;
    crystal_quant = crystal_quant > 255 ? 255 : crystal_quant;

    return(palette[crystal_quant]);
}

// Assembly:
pushq %rax
addss %xmm2, %xmm2
insertps $0x10, %xmm1, %xmm0     # xmm0 = xmm0[0],xmm1[0],xmm0[2,3]
cvtss2sd %xmm2, %xmm2
mulsd 0xa6a6(%rip), %xmm2     # 0xc060
cvtsd2ss %xmm2, %xmm2
movaps %xmm2, %xmm1
callq 0x143c
cvtss2sd %xmm0, %xmm0
xorl %ecx, %ecx
movl $0xff, %edx
mulsd 0xa68f(%rip), %xmm0     # 0xc068
cvttsd2si %xmm0, %eax
testl %eax, %eax
cmovgl %eax, %ecx
leaq 0xf757(%rip), %rax      # 0x11140
cmpl %edx, %ecx
cmovgel %edx, %ecx
movl (%rax,%rcx,4), %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/GIF.c
// Function: WriteGIFHeader
void WriteGIFHeader(FILE *fh,int width,int height,Palette palette,int numcolours,int background)
{
	uint8_t flags=0;

	int palettesize=0;
	if(palette && numcolours>0)
	{
		int exp;
		if(numcolours>128) exp=8;
		else if(numcolours>64) exp=7;
		else if(numcolours>32) exp=6;
		else if(numcolours>16) exp=5;
		else if(numcolours>8) exp=4;
		else if(numcolours>4) exp=3;
		else if(numcolours>2) exp=2;
		else exp=1;

		flags|=0x80|0x70|0x00|(exp-1); // GCT present, 8-bit entries, not sorted, number of entries.
		palettesize=1<<exp;
	}

	uint8_t header[]=
	{
		'G','I','F','8','9','a',
		width&0xff,width>>8,
		height&0xff,height>>8,
		flags,
		background,
		0, // Pixel Aspect Ratio
	};

	Write(fh,header,sizeof(header));
	for(int i=0;i<palettesize;i++)
	{
		uint8_t entry[3]={0,0,0};
		if(i<numcolours)
		{
			entry[0]=ExtractRed(palette[i]);
			entry[1]=ExtractGreen(palette[i]);
			entry[2]=ExtractBlue(palette[i]);
		}
		Write(fh,entry,3);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0x28(%rsp), %rsp
testq %rcx, %rcx
movq %rcx, 0x10(%rsp)
movl %r8d, %ebp
movq %rdi, %r14
sete %al
testl %r8d, %r8d
setle %cl
orb %al, %cl
movl %esi, %eax
jne 0x1dac
cmpl $0x80, %ebp
pushq $0x1
popq %r13
jbe 0x1db3
pushq $0x8
jmp 0x1de2
xorl %edi, %edi
xorl %r13d, %r13d
jmp 0x1ded
cmpl $0x40, %ebp
jbe 0x1dbc
pushq $0x7
jmp 0x1de2
cmpl $0x20, %ebp
jbe 0x1dc5
pushq $0x6
jmp 0x1de2
cmpl $0x10, %ebp
jbe 0x1dce
pushq $0x5
jmp 0x1de2
cmpl $0x8, %ebp
jbe 0x1dd7
pushq $0x4
jmp 0x1de2
cmpl $0x4, %ebp
jbe 0x1ec5
pushq $0x3
popq %rcx
leal -0x1(%rcx), %edi
shll %cl, %r13d
orb $-0x10, %dil
leaq 0x18(%rsp), %rsi
movl $0x38464947, (%rsi)     # imm = 0x38464947
movw $0x6139, 0x4(%rsi)      # imm = 0x6139
movb %al, 0x6(%rsi)
movb %ah, 0x1f(%rsp)
movb %dl, 0x8(%rsi)
movb %dh, 0x21(%rsp)
movb %dil, 0xa(%rsi)
movb %r9b, 0xb(%rsi)
movb $0x0, 0xc(%rsi)
pushq $0xd
popq %rdx
movq %r14, %rdi
callq 0x1ed3
movslq %ebp, %rbp
leaq 0xc(%rsp), %r15
pushq $0x3
popq %r12
xorl %ebx, %ebx
cmpq %rbx, %r13
je 0x1eb5
andw $0x0, 0xc(%rsp)
movb $0x0, 0xe(%rsp)
cmpq %rbp, %rbx
jge 0x1e9f
movq 0x10(%rsp), %rax
movl (%rax,%rbx,4), %ecx
movl %ecx, %esi
andl $0xff, %esi
je 0x1e99
movzbl %ch, %eax
xorl %edx, %edx
movl $0xff, %edi
imull $0xff, %eax, %eax
divw %si
movl %ecx, %edx
shrl $0x18, %ecx
shrl $0x10, %edx
imull $0xff, %ecx, %ecx
andl %edi, %edx
imull $0xff, %edx, %edx
movb %al, 0xc(%rsp)
movl %edx, %eax
xorl %edx, %edx
divw %si
xorl %edx, %edx
movb %al, 0xd(%rsp)
movl %ecx, %eax
divw %si
jmp 0x1e9b
xorl %eax, %eax
movb %al, 0xe(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1ed3
incq %rbx
jmp 0x1e31
leaq 0x28(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, %ebp
movl %r13d, %ecx
sbbl $-0x1, %ecx
jmp 0x1de3
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/GIF.c
// Function: WriteGIFGraphicControlExtension
void WriteGIFGraphicControlExtension(FILE *fh,int disposal,int delay,int transparent)
{
	int flags=(disposal<<2)|0x00; // Disposal Method, No User Input
	if(transparent>=0) flags|=0x01;

	uint8_t gce[]=
	{
		0x21,0xf9, // Extension Introducer, Graphic Control Label
		0x04, // Block size
		flags,
		delay&0xff,delay>>8,
		transparent>=0?transparent:0, // Transparent Color Index
		0x00, // Block Terminator
	};

	Write(fh,gce,sizeof(gce));
}

// Assembly:
pushq %rax
shll $0x2, %esi
xorl %r8d, %r8d
xorl %r9d, %r9d
leaq (%rsp), %rax
testl %ecx, %ecx
movw $0xf921, (%rax)         # imm = 0xF921
movb $0x4, 0x2(%rax)
setns %r9b
cmovnsl %ecx, %r8d
orl %esi, %r9d
movb %r9b, 0x3(%rax)
movb %dl, 0x4(%rax)
movb %dh, 0x5(%rsp)
movb %r8b, 0x6(%rax)
movb $0x0, 0x7(%rax)
pushq $0x8
popq %rdx
movq %rax, %rsi
callq 0x1ed3
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/GIF.c
// Function: WriteGIFApplicationExtension
void WriteGIFApplicationExtension(FILE *fh,char name[8],uint8_t authentication[3],uint8_t *content,int length)
{
	uint8_t appext[]=
	{
		0x21,0xff, // Extension Introducer, Application Label
		0x0b, // Block size
		name[0],name[1],name[2],name[3],name[4],name[5],name[6],name[7],
		authentication[0],authentication[1],authentication[2],
	};

	Write(fh,appext,sizeof(appext));

	while(length)
	{
		int blocklen=length;
		if(blocklen>255) blocklen=255;

		Write(fh,(uint8_t[1]){blocklen},1);
		Write(fh,content,blocklen);

		content+=blocklen;
		length-=blocklen;
	}
	Write(fh,(uint8_t[1]){0x00},1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0x18(%rsp), %rsp
leaq 0xa(%rsp), %rax
movl %r8d, %ebp
movq %rcx, %r14
movq %rdi, %rbx
movw $0xff21, (%rax)         # imm = 0xFF21
movb $0xb, 0x2(%rax)
movq (%rsi), %rsi
movq %rsi, 0x3(%rax)
movb (%rdx), %sil
movb %sil, 0xb(%rax)
movb 0x1(%rdx), %sil
movb %sil, 0xc(%rax)
movb 0x2(%rdx), %cl
movb %cl, 0xd(%rax)
pushq $0xe
popq %rdx
movq %rax, %rsi
callq 0x1ed3
leaq 0x8(%rsp), %r15
pushq $0x1
popq %r12
testl %ebp, %ebp
je 0x2001
movl $0xff, %eax
movl $0xff, %r13d
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
cmpl %eax, %ebp
cmovll %ebp, %r13d
movb %r13b, 0x8(%rsp)
callq 0x1ed3
movslq %r13d, %r13
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x1ed3
addq %r13, %r14
subl %r13d, %ebp
jmp 0x1fc0
leaq 0x9(%rsp), %rsi
movb $0x0, (%rsi)
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x1ed3
leaq 0x18(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/GIF.c
// Function: WriteLZWData
static void WriteLZWData(FILE *fh,uint8_t *pixels,int numpixels,int numbits)
{
	Write(fh,(uint8_t[1]){numbits},1);

	int numliterals=1<<numbits;
	int clearcode=numliterals;
	int endcode=numliterals+1;

	LZWEncoder *lzw=malloc(sizeof(LZWEncoder));
	InitializeLZWEncoder(lzw,numbits+1,12,numliterals,2,clearcode);

	uint8_t buffer[256]={0};

	for(int i=0;i<numpixels;i++)
	{
		EmitLZWByte(lzw,pixels[i]);
		DrainLZWToFile(fh,lzw,buffer,false);
	}

	EmitLZWEndCode(lzw,endcode);
	DrainLZWToFile(fh,lzw,buffer,true);

	free(lzw);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0x118(%rsp), %rsp
movq %rsi, %r15
movl %ecx, %r13d
leaq 0xf(%rsp), %rsi
movl %edx, %r14d
movq %rdi, %rbx
movb %r13b, (%rsi)
pushq $0x1
popq %rdx
callq 0x1ed3
pushq $0x1
popq %rbp
movl %r13d, %ecx
movl $0x200028, %edi         # imm = 0x200028
shll %cl, %ebp
callq 0x1150
movq %rax, %r12
incl %r13d
pushq $0xc
popq %rdx
pushq $0x2
popq %r8
movq %rax, %rdi
movl %r13d, %esi
movl %ebp, %ecx
movl %ebp, %r9d
callq 0x2368
leaq 0x10(%rsp), %r13
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
movq %r13, %rdi
callq 0x10d0
testl %r14d, %r14d
movl $0x0, %eax
cmovlel %eax, %r14d
subq $0x1, %r14
jb 0x229d
movzbl (%r15), %esi
movq %r12, %rdi
callq 0x23b5
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x22d6
incq %r15
jmp 0x2276
incl %ebp
movq %r12, %rdi
movl %ebp, %esi
callq 0x2460
leaq 0x10(%rsp), %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x22d6
movq %r12, %rdi
leaq 0x118(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/GIF.c
// Function: DrainLZWToFile
static void DrainLZWToFile(FILE *fh,LZWEncoder *lzw,uint8_t buffer[256],bool flush)
{
	for(;;)
	{
		int byte=NextLZWOutputByte(lzw,flush);
		if(byte<0) break;

		buffer[0]++;
		buffer[buffer[0]]=byte;

		if(buffer[0]==255)
		{
			Write(fh,buffer,256);
			buffer[0]=0;
		}
	}

	if(flush)
	{
		if(buffer[0]!=0) Write(fh,buffer,buffer[0]+1);
		Write(fh,(uint8_t[1]){0x00},1);
		buffer[0]=0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq -0x10(%rsp), %rsp
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movzbl %bpl, %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x248d
testl %eax, %eax
js 0x2327
movb (%rbx), %cl
incb %cl
movzbl %cl, %edx
movb %cl, (%rbx)
movb %al, (%rbx,%rdx)
cmpb $-0x1, (%rbx)
jne 0x22f2
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1ed3
movb $0x0, (%rbx)
jmp 0x22f2
testb %bpl, %bpl
je 0x235a
movzbl (%rbx), %edx
testq %rdx, %rdx
je 0x2342
incq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1ed3
xorl %ebp, %ebp
leaq 0xf(%rsp), %rsi
movb %bpl, (%rsi)
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x1ed3
movb %bpl, (%rbx)
leaq 0x10(%rsp), %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/LZW.c
// Function: EmitLZWByte
void EmitLZWByte(LZWEncoder *self,uint8_t byte)
{
	if(self->code<0)
	{
		self->code=byte;
		return;
	}

	uint16_t newcode=self->codes[self->code].next[byte];
	if(newcode)
	{
		self->code=newcode;
	}
	else
	{
		EmitLZWCode(self,self->code);
		self->codes[self->code].next[byte]=self->numcodes++;
		self->code=byte;

		if(self->numcodes>(1<<self->codelength))
		{
			if(self->codelength<self->maximumcodelength)
			{
				self->codelength++;
			}
			else
			{
				EmitLZWCode(self,self->resetcode);
				ResetLZWEncoder(self);
			}
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq 0xc(%rdi), %rax
movq %rdi, %rbx
testq %rax, %rax
js 0x23e4
movq %rax, %rcx
movzbl %sil, %r14d
shlq $0x9, %rcx
leaq 0x28(%rbx,%rcx), %rcx
movzwl (%rcx,%r14,2), %ecx
testl %ecx, %ecx
je 0x23ed
movl %ecx, 0xc(%rbx)
jmp 0x242f
movzbl %sil, %eax
movl %eax, 0xc(%rbx)
jmp 0x242f
movq %rbx, %rdi
movl %eax, %esi
leaq 0x28(%rbx), %r15
callq 0x244d
movl 0x14(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x14(%rbx)
movslq 0xc(%rbx), %rcx
shlq $0x9, %rcx
leaq (%rcx,%r15), %rcx
movw %ax, (%rcx,%r14,2)
movl %r14d, 0xc(%rbx)
movl 0x1c(%rbx), %ecx
pushq $0x1
popq %rdx
shll %cl, %edx
cmpl %edx, %eax
jl 0x242f
cmpl 0x20(%rbx), %ecx
jge 0x2435
incl %ecx
movl %ecx, 0x1c(%rbx)
popq %rbx
popq %r14
popq %r15
retq
movl 0x24(%rbx), %esi
movq %rbx, %rdi
callq 0x244d
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x238f
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/LZW.c
// Function: NextLZWOutputByte
int NextLZWOutputByte(LZWEncoder *self,bool flush)
{
	if(self->numbits>=8)
	{
		int output=self->bits&0xff;
		self->bits>>=8;
		self->numbits-=8;
		return output;
	}
	else if(flush && self->numbits>0)
	{
		int output=self->bits&0xff;
		self->bits=0;
		self->numbits=0;
		return output;
	}
	else
	{
		return -1;
	}
}

// Assembly:
movl 0x8(%rdi), %ecx
cmpl $0x8, %ecx
jl 0x24a7
movq (%rdi), %rax
addl $-0x8, %ecx
movq %rax, %rdx
shrq $0x8, %rdx
movq %rdx, (%rdi)
jmp 0x24be
testl %ecx, %ecx
setle %al
xorb $0x1, %sil
orb %al, %sil
jne 0x24c5
movq (%rdi), %rax
xorl %ecx, %ecx
andq $0x0, (%rdi)
movzbl %al, %eax
movl %ecx, 0x8(%rdi)
retq
pushq $-0x1
popq %rax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Main.c
// Function: ParseIntArgument
static int ParseIntArgument(int argc,const char **argv,int *index)
{
	if(argv[*index][2]!=0)
	{
		return atoi(&argv[*index][2]);
	}
	else
	{
		(*index)++;
		if(*index>=argc) PrintUsageAndExit(argv[0]);
		return atoi(argv[*index]);
	}
}

// Assembly:
movslq (%rdx), %rcx
movq (%rsi,%rcx,8), %rax
cmpb $0x0, 0x2(%rax)
je 0x2a92
addq $0x2, %rax
movq %rax, %rdi
jmp 0x11c0
leal 0x1(%rcx), %eax
cmpl %edi, %eax
movl %eax, (%rdx)
jge 0x2aa5
movq 0x8(%rsi,%rcx,8), %rdi
jmp 0x11c0
pushq %rax
movq (%rsi), %rdi
callq 0x2aae
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Main.c
// Function: PrintUsageAndExit
static void PrintUsageAndExit(const char *name)
{
	fprintf(stderr,"Usage: %s [options] [filename.gif]\n",name);
	fprintf(stderr,"(Filename defaults to \"%s\" if not explicitly specified.)\n",Filename);	
	fprintf(stderr,"Options:\n");
	fprintf(stderr,"  -s size      Size in pixels. (Default: %d)\n",Size);
	fprintf(stderr,"  -f framerate Framerate in frames per second. (Default: %.1f)\n",FPS);
	fprintf(stderr,"  -o factor    Oversampling factor. (Default: %d)\n",Oversampling);
	fprintf(stderr,"  -h           Print this help message.\n");
	exit(1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0xe53f(%rip), %r14      # 0x10ff8
movq %rdi, %rdx
leaq 0x96bb(%rip), %rsi      # 0xc17e
xorl %eax, %eax
movq (%r14), %rdi
callq 0x1120
movq (%r14), %rdi
movq 0xeac9(%rip), %rdx      # 0x115a0
leaq 0x96c4(%rip), %rsi      # 0xc1a2
xorl %eax, %eax
callq 0x1120
movq (%r14), %rcx
leaq 0x96ed(%rip), %rdi      # 0xc1dc
pushq $0x9
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11e0
movq (%r14), %rdi
movl 0xea8a(%rip), %edx      # 0x11590
leaq 0x96d9(%rip), %rsi      # 0xc1e6
xorl %eax, %eax
callq 0x1120
cvtss2sd 0xea78(%rip), %xmm0     # 0x11594
movq (%r14), %rdi
leaq 0x96ee(%rip), %rsi      # 0xc214
movb $0x1, %al
callq 0x1120
movq (%r14), %rdi
movl 0xea62(%rip), %edx      # 0x11598
leaq 0x9717(%rip), %rsi      # 0xc254
xorl %eax, %eax
callq 0x1120
movq (%r14), %rcx
leaq 0x9739(%rip), %rdi      # 0xc287
pushq $0x28
popq %rsi
movq %rbx, %rdx
callq 0x11e0
pushq $0x1
popq %rdi
callq 0x11d0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Neuquant.c
// Function: InitializeNeuquantNetwork
void InitializeNeuquantNetwork(Neuquant *self)
{
	for(int i=0;i<NeuquantNetworkSize;i++)
	{
		self->network[i][0]=self->network[i][1]=self->network[i][2]=(i<<(netbiasshift+8))/NeuquantNetworkSize;
		self->freq[i]=intbias/NeuquantNetworkSize;
		self->bias[i]=0;
	}
}

// Assembly:
xorl %eax, %eax
movq $-0x400, %rcx           # imm = 0xFC00
testq %rcx, %rcx
je 0x2ba3
movl %eax, 0x1008(%rdi,%rcx,4)
movl %eax, 0x1004(%rdi,%rcx,4)
movl %eax, 0x1000(%rdi,%rcx,4)
movl $0x100, 0x1c00(%rdi,%rcx) # imm = 0x100
andl $0x0, 0x1800(%rdi,%rcx)
addl $0x10, %eax
addq $0x4, %rcx
jmp 0x2b6d
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Neuquant.c
// Function: UnbiasNeuquantNetwork
void UnbiasNeuquantNetwork(Neuquant *self)
{
	int i,j,temp;

	for (i=0; i<NeuquantNetworkSize; i++) {
		for (j=0; j<3; j++) {
			/* OLD CODE: network[i][j] >>= netbiasshift; */
			/* Fix based on bug report by Juergen Weigert jw@suse.de */
			temp = (self->network[i][j] + (1 << (netbiasshift - 1))) >> netbiasshift;
			if (temp > 255) temp = 255;
			self->network[i][j] = temp;
		}
		self->network[i][3] = i;			/* record colour no */
	}
}

// Assembly:
xorl %eax, %eax
pushq $-0xc
popq %rcx
movl $0xff, %edx
movq %rdi, %rsi
cmpq $0x100, %rax            # imm = 0x100
je 0x2bf5
movq %rcx, %r8
testq %r8, %r8
je 0x2be0
movl 0xc(%rsi,%r8), %r9d
addl $0x8, %r9d
sarl $0x4, %r9d
cmpl %edx, %r9d
cmovgel %edx, %r9d
movl %r9d, 0xc(%rsi,%r8)
addq $0x4, %r8
jmp 0x2bbc
movq %rax, %r8
addq $0x10, %rsi
shlq $0x4, %r8
movl %eax, 0xc(%rdi,%r8)
incq %rax
jmp 0x2bb1
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Neuquant.c
// Function: BuildNeuquantIndex
void BuildNeuquantIndex(Neuquant *self)
{
	int i,j,smallpos,smallval;
	int *p,*q;
	int previouscol,startpos;

	previouscol = 0;
	startpos = 0;
	for (i=0; i<NeuquantNetworkSize; i++) {
		p = self->network[i];
		smallpos = i;
		smallval = p[1];			/* index on g */
		/* find smallest in i..NeuquantNetworkSize-1 */
		for (j=i+1; j<NeuquantNetworkSize; j++) {
			q = self->network[j];
			if (q[1] < smallval) {		/* index on g */
				smallpos = j;
				smallval = q[1];	/* index on g */
			}
		}
		q = self->network[smallpos];
		/* swap p (i) and q (smallpos) entries */
		if (i != smallpos) {
			j = q[0];   q[0] = p[0];   p[0] = j;
			j = q[1];   q[1] = p[1];   p[1] = j;
			j = q[2];   q[2] = p[2];   p[2] = j;
			j = q[3];   q[3] = p[3];   p[3] = j;
		}
		/* smallval entry is now in position i */
		if (smallval != previouscol) {
			self->netindex[previouscol] = (startpos+i)>>1;
			for (j=previouscol+1; j<smallval; j++) self->netindex[j] = i;
			previouscol = smallval;
			startpos = i;
		}
	}
	self->netindex[previouscol] = (startpos+maxnetpos)>>1;
	for (j=previouscol+1; j<256; j++) self->netindex[j] = maxnetpos; /* really 256 */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x14(%rdi), %rax
xorl %ecx, %ecx
movq $-0xff, %rdx
xorl %r8d, %r8d
xorl %esi, %esi
cmpq $0x100, %rcx            # imm = 0x100
je 0x2d02
movq %rcx, %r10
movslq %r8d, %r9
movq %rax, %r14
movq %rdx, %r15
movl %ecx, %ebp
shlq $0x4, %r10
movl 0x4(%rdi,%r10), %ebx
leaq (%rdi,%r10), %r11
movl %ebx, %r10d
testq %r15, %r15
je 0x2c97
movl (%r14), %r12d
leal 0x100(%r15), %r13d
cmpl %r10d, %r12d
cmovll %r13d, %ebp
cmovll %r12d, %r10d
incq %r15
addq $0x10, %r14
jmp 0x2c74
movl %ebp, %r14d
cmpq %r14, %rcx
je 0x2cc4
movslq %ebp, %r14
movl (%r11), %ebp
shlq $0x4, %r14
movups (%rdi,%r14), %xmm0
movl %ebp, (%rdi,%r14)
movl %ebx, 0x4(%rdi,%r14)
movq 0x8(%r11), %rbx
movq %rbx, 0x8(%rdi,%r14)
movups %xmm0, (%r11)
cmpl %r8d, %r10d
je 0x2cf3
addl %ecx, %esi
sarl %esi
movl %esi, 0x1000(%rdi,%r9,4)
movslq %r10d, %rsi
leaq 0x1(%r9), %r8
cmpq %rsi, %r8
jge 0x2cee
movl %ecx, 0x1004(%rdi,%r9,4)
movq %r8, %r9
jmp 0x2cd8
movl %ecx, %esi
movl %r10d, %r8d
incq %rcx
incq %rdx
addq $0x10, %rax
jmp 0x2c49
addl $0xff, %esi
movslq %r8d, %rax
sarl %esi
decq %rax
movl %esi, 0x1004(%rdi,%rax,4)
leaq 0x1(%rax), %rax
movl $0xff, %esi
cmpq $0xff, %rax
jl 0x2d10
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Neuquant.c
// Function: SearchNeuquantIndex
int SearchNeuquantIndex(Neuquant *self,int r,int g,int b)
{
	int i,j,dist,a,bestd;
	int *p;
	int best;

	bestd = 1000;		/* biggest possible dist is 256*3 */
	best = -1;
	i = self->netindex[g];	/* index on g */
	j = i-1;		/* start at netindex[g] and work outwards */

	while ((i<NeuquantNetworkSize) || (j>=0)) {
		if (i<NeuquantNetworkSize) {
			p = self->network[i];
			dist = p[1] - g;		/* inx key */
			if (dist >= bestd) i = NeuquantNetworkSize;	/* stop iter */
			else {
				i++;
				if (dist<0) dist = -dist;
				a = p[0] - b;   if (a<0) a = -a;
				dist += a;
				if (dist<bestd) {
					a = p[2] - r;   if (a<0) a = -a;
					dist += a;
					if (dist<bestd) {bestd=dist; best=p[3];}
				}
			}
		}
		if (j>=0) {
			p = self->network[j];
			dist = g - p[1]; /* inx key - reverse dif */
			if (dist >= bestd) j = -1; /* stop iter */
			else {
				j--;
				if (dist<0) dist = -dist;
				a = p[0] - b;   if (a<0) a = -a;
				dist += a;
				if (dist<bestd) {
					a = p[2] - r;   if (a<0) a = -a;
					dist += a;
					if (dist<bestd) {bestd=dist; best=p[3];}
				}
			}
		}
	}
	return(best);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movslq %edx, %rax
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl $0x3e8, %r10d           # imm = 0x3E8
movl 0x1000(%rdi,%rax,4), %r8d
movl %r9d, %eax
leal -0x1(%r8), %ebp
movl %ebp, %r11d
testl %r11d, %r11d
setns %bl
cmpl $0x100, %r8d            # imm = 0x100
setl %bpl
orb %bl, %bpl
cmpb $0x1, %bpl
jne 0x2e61
cmpl $0xff, %r8d
jle 0x2d88
testl %r11d, %r11d
js 0x2d5a
jmp 0x2deb
movslq %r8d, %rbx
shlq $0x4, %rbx
movl 0x4(%rdi,%rbx), %ebp
subl %edx, %ebp
cmpl %r10d, %ebp
jge 0x2de3
leaq (%rbx,%rdi), %rbx
incl %r8d
movl %ebp, %r14d
negl %r14d
movl (%rbx), %r15d
cmovsl %ebp, %r14d
subl %ecx, %r15d
movl %r15d, %ebp
negl %ebp
cmovsl %r15d, %ebp
addl %r14d, %ebp
cmpl %r10d, %ebp
jge 0x2d81
movl 0x8(%rbx), %r15d
subl %esi, %r15d
movl %r15d, %r14d
negl %r14d
cmovsl %r15d, %r14d
addl %ebp, %r14d
cmpl %r10d, %r14d
jae 0x2d81
movl 0xc(%rbx), %eax
movl %r14d, %r10d
jmp 0x2d81
movl $0x100, %r8d            # imm = 0x100
jmp 0x2d81
movl %r11d, %ebx
movl %edx, %r14d
movl %r9d, %ebp
shlq $0x4, %rbx
subl 0x4(%rdi,%rbx), %r14d
cmpl %r10d, %r14d
jge 0x2d57
leaq (%rbx,%rdi), %rbx
decl %r11d
movl %r14d, %ebp
negl %ebp
movl (%rbx), %r15d
cmovsl %r14d, %ebp
subl %ecx, %r15d
movl %r15d, %r14d
negl %r14d
cmovsl %r15d, %r14d
addl %ebp, %r14d
movl %r11d, %ebp
cmpl %r10d, %r14d
jge 0x2d57
movl 0x8(%rbx), %ebp
subl %esi, %ebp
movl %ebp, %r15d
negl %r15d
cmovsl %ebp, %r15d
movl %r11d, %ebp
addl %r14d, %r15d
cmpl %r10d, %r15d
jae 0x2d57
movl 0xc(%rbx), %eax
movl %r11d, %ebp
movl %r15d, %r10d
jmp 0x2d57
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/../Graphics/Tools/PNG.h
// Function: PNGInputCallback
static void PNGInputCallback(DeflateReader *reader,void *context)
{
	PNGLoader *self=context;
	const uint8_t *end=self->bytes+self->length;

	const uint8_t *ptr=self->idatstart+self->idatsize+4;
	if(ptr+12>end) return;

	uint32_t size=PNGGetUInt32BE(&ptr[0]);
	uint32_t type=PNGGetUInt32BE(&ptr[4]);

	if(ptr+12+size>end) return;

	if(type==PNGMakeID('I','D','A','T'))
	{
		self->idatstart=ptr+8;
		self->idatsize=size;
		ProvideDeflateInputBuffer(reader,self->idatstart,self->idatsize);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rsi), %r12
movq 0x48(%rsi), %r15
movl 0x50(%rsi), %eax
addq 0x8(%rsi), %r12
leaq 0x10(%r15,%rax), %r13
cmpq %r12, %r13
ja 0x3e27
leaq (%r15,%rax), %r15
movq %rdi, %r14
movq %rsi, %rbx
leaq 0x4(%r15), %rdi
callq 0x3db8
leaq 0x8(%r15), %rdi
movl %eax, %ebp
callq 0x3db8
movl %ebp, %ecx
addq %rcx, %r13
cmpq %r12, %r13
ja 0x3e27
cmpl $0x49444154, %eax       # imm = 0x49444154
jne 0x3e27
leaq 0xc(%r15), %rax
leaq 0xc(%r15,%rcx), %rcx
movq %rax, 0x48(%rbx)
movl %ebp, 0x50(%rbx)
movq %rax, 0x10(%r14)
movq %rcx, 0x18(%r14)
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/../Graphics/Tools/BitStreamReader.h
// Function: ReadBitString
static int ReadBitString(BitStreamReader *self,int length)
{
	if(length==0) return 0;

	FillBits(self,length);
	if(self->numbits<length) return -1;

	uint32_t bitstring=self->bits&((1<<length)-1);

	DiscardBits(self,length);

	return bitstring;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x4242
movl 0x24(%rbx), %edx
pushq $-0x1
popq %rax
subl %ebp, %edx
jl 0x3e61
movl %ebp, %ecx
movl 0x20(%rbx), %esi
shll %cl, %eax
notl %eax
andl %esi, %eax
shrl %cl, %esi
movl %esi, 0x20(%rbx)
movl %edx, 0x24(%rbx)
leaq 0x8(%rsp), %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/../Graphics/Tools/BitStreamReader.h
// Function: ReadHuffmanCode
static int ReadHuffmanCode(BitStreamReader *self,uint16_t *table,int maxlength)
{
	FillBits(self,maxlength);

	int index=self->bits&((1<<maxlength)-1);
	uint16_t entry=table[index];
	int value=ValueOfHuffmanTableEntry(entry);
	int length=LengthOfHuffmanTableEntry(entry);

	if(self->numbits<length) return -1;
	if(length==0) return -2;

	DiscardBits(self,length);

	return value;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edx, %esi
movl %edx, %ebp
movq %rdi, %rbx
callq 0x4242
pushq $-0x1
popq %rax
movl %eax, %esi
movl %ebp, %ecx
movl 0x20(%rbx), %edx
movl 0x24(%rbx), %edi
shll %cl, %esi
notl %esi
andl %edx, %esi
movzwl (%r14,%rsi,2), %esi
movl %esi, %ecx
shrl $0xc, %ecx
subl %ecx, %edi
jl 0x423d
cmpw $0x1000, %si            # imm = 0x1000
jae 0x422d
pushq $-0x2
popq %rax
jmp 0x423d
andl $0xfff, %esi            # imm = 0xFFF
shrl %cl, %edx
movl %esi, %eax
movl %edx, 0x20(%rbx)
movl %edi, 0x24(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/../Graphics/Tools/BitStreamReader.h
// Function: FillBits
static void FillBits(BitStreamReader *self,int required)
{
	while(self->numbits<required)
	{
		if(self->pos>=self->end)
		{
			if(self->callback) self->callback(self,self->context);
			else return;

			if(self->pos>=self->end) return;
		}

		uint32_t b=*self->pos++;

		self->bits|=b<<self->numbits;
		self->numbits+=8;
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %ebp
movl 0x24(%rdi), %ecx
cmpl %ebp, %ecx
jge 0x4291
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
jb 0x4279
movq (%rbx), %rax
testq %rax, %rax
je 0x4291
movq 0x8(%rbx), %rsi
movq %rbx, %rdi
callq *%rax
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
jae 0x4291
movl 0x24(%rbx), %ecx
leaq 0x1(%rax), %rdx
movq %rdx, 0x10(%rbx)
movzbl (%rax), %eax
shll %cl, %eax
addl $0x8, %ecx
orl %eax, 0x20(%rbx)
movl %ecx, 0x24(%rbx)
jmp 0x424d
leaq 0x8(%rsp), %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/../Graphics/Tools/BitStreamReader.h
// Function: BuildHuffmanTableFromLengths
static bool BuildHuffmanTableFromLengths(uint16_t *table,int maxlength,int *lengths,int numcodes)
{
	InitializeHuffmanTable(table,maxlength);

	uint32_t code=0;
	for(int len=1;len<=maxlength;len++)
	{
		for(int i=0;i<numcodes;i++)
		{
			if(lengths[i]!=len) continue;

			if(!AddHuffmanCodeToTable(table,maxlength,ReverseBits(code),len,i)) return false;
			code+=1<<(16-len);
		}
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movl %esi, %ebp
pushq $0x2
popq %rdx
movl %ebp, %ecx
xorl %esi, %esi
movq %rdi, %r15
xorl %r12d, %r12d
shll %cl, %edx
callq 0x10d0
testl %ebx, %ebx
movl $0x0, %eax
movl %ebp, (%rsp)
cmovlel %r12d, %ebx
testl %ebp, %ebp
cmovgl %ebp, %eax
incl %eax
movl %eax, 0x4(%rsp)
pushq $0x1
popq %rax
cmpl 0x4(%rsp), %eax
je 0x43a5
movl (%rsp), %ecx
subl %eax, %ecx
pushq $0x1
popq %rsi
movl %eax, %edi
movl %esi, %r10d
movl $0x0, %r13d
shll %cl, %r10d
shll $0xc, %edi
movb $0x10, %cl
testl %r10d, %r10d
cmovgl %r10d, %r13d
subb %al, %cl
xorl %ebp, %ebp
shll %cl, %esi
cmpq %rbx, %rbp
je 0x439e
cmpl %eax, (%r14,%rbp,4)
jne 0x4396
movl %r12d, %ecx
movl $0xf0f, %r8d            # imm = 0xF0F
movl %edi, %r11d
xorl %r9d, %r9d
rolw $0x8, %cx
orl %ebp, %r11d
movl %ecx, %edx
andl %r8d, %ecx
shrl $0x4, %edx
shll $0x4, %ecx
andl %r8d, %edx
movl $0x3333, %r8d           # imm = 0x3333
orl %edx, %ecx
movl %ecx, %edx
shrl $0x2, %ecx
andl %r8d, %edx
andl %r8d, %ecx
movl $0x5555, %r8d           # imm = 0x5555
leal (%rcx,%rdx,4), %ecx
movl %ecx, %edx
shrl %ecx
andl %r8d, %edx
andl %r8d, %ecx
leal (%rcx,%rdx,2), %edx
cmpl %r9d, %r13d
je 0x4393
movl %r9d, %r8d
movl %eax, %ecx
shll %cl, %r8d
addl %edx, %r8d
movslq %r8d, %rcx
cmpw $0x0, (%r15,%rcx,2)
jne 0x438e
movw %r11w, (%r15,%rcx,2)
incl %r9d
jmp 0x4369
cmpl %r10d, %r9d
jl 0x43a5
addl %esi, %r12d
incq %rbp
jmp 0x430d
incl %eax
jmp 0x42db
cmpl %eax, (%rsp)
setl %al
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Quantize.c
// Function: H
float H(float q) {
    float value;

    if ( q > 0.008856 ) {
        value = pow ( q, 0.333333 );
        return value;
    }
    else {
        value = 7.787*q + 0.137931;
        return value;
    }
}

// Assembly:
cvtss2sd %xmm0, %xmm0
ucomisd 0x8128(%rip), %xmm0     # 0xc4f0
jbe 0x43df
pushq %rax
movsd 0x8135(%rip), %xmm1     # 0xc508
callq 0x1080
leaq 0x8(%rsp), %rsp
jmp 0x43ef
mulsd 0x8111(%rip), %xmm0     # 0xc4f8
addsd 0x8111(%rip), %xmm0     # 0xc500
cvtsd2ss %xmm0, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Quantize.c
// Function: PixelDist
static inline const float PixelDist(Pixel a, Pixel b) {    
//     return(labDist(ExtractRed(a), ExtractGreen(a), ExtractBlue(a), ExtractRed(b), ExtractGreen(b), ExtractBlue(b)));
        
    int dr = ExtractRed(a) - ExtractRed(b);
    int dg = ExtractGreen(a) - ExtractGreen(b);
    int db = ExtractBlue(a) - ExtractBlue(b);
    
    return(sqrt(dr*dr+dg*dg+db*db));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
xorl %r15d, %r15d
movl %edi, %r8d
movl $0x0, %ecx
movl %edi, %ebx
movl %esi, -0x4(%rsp)
andl $0xff, %r8d
je 0x49a5
movzbl %bh, %eax
xorl %edx, %edx
movl %ebx, %edi
imull $0xff, %eax, %eax
divw %r8w
movl -0x4(%rsp), %esi
movzwl %ax, %ecx
movl %esi, %r14d
andl $0xff, %r14d
je 0x49ce
movl -0x4(%rsp), %eax
xorl %edx, %edx
movl %ebx, %edi
movzbl %ah, %eax
imull $0xff, %eax, %eax
divw %r14w
movl -0x4(%rsp), %esi
movzwl %ax, %r15d
xorl %r10d, %r10d
movl $0x0, %r9d
testl %r8d, %r8d
je 0x49fa
movl %ebx, %eax
xorl %edx, %edx
movl %ebx, %edi
shrl $0x10, %eax
movzbl %al, %eax
imull $0xff, %eax, %eax
divw %r8w
movl -0x4(%rsp), %esi
movzwl %ax, %r9d
testl %r14d, %r14d
je 0x4a1f
movl -0x4(%rsp), %eax
xorl %edx, %edx
movl %ebx, %edi
shrl $0x10, %eax
movzbl %al, %eax
imull $0xff, %eax, %eax
divw %r14w
movl -0x4(%rsp), %esi
movzwl %ax, %r10d
xorl %ebp, %ebp
movl $0x0, %r11d
testl %r8d, %r8d
je 0x4a43
shrl $0x18, %edi
xorl %edx, %edx
imull $0xff, %edi, %eax
divw %r8w
movl -0x4(%rsp), %esi
movzwl %ax, %r11d
testl %r14d, %r14d
je 0x4a5a
shrl $0x18, %esi
xorl %edx, %edx
imull $0xff, %esi, %eax
divw %r14w
movzwl %ax, %ebp
subl %r10d, %r9d
subl %r15d, %ecx
subl %ebp, %r11d
imull %ecx, %ecx
imull %r9d, %r9d
imull %r11d, %r11d
addl %ecx, %r9d
addl %r9d, %r11d
cvtsi2sd %r11d, %xmm0
sqrtsd %xmm0, %xmm0
cvtsd2ss %xmm0, %xmm0
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Random.c
// Function: SeedRandom64
void SeedRandom64(uint64_t seed)
{
	uint32_t a=seed>>32,b=(uint32_t)seed;

	s1=(a*1664525+1013904223)|0x10;
	s2=(b*1103515245+12345)|0x1000;
	s3=((a^b)*214013+2531011)|0x100000;
}

// Assembly:
movq %rdi, %rax
imull $0x41c64e6d, %edi, %edx # imm = 0x41C64E6D
shrq $0x20, %rax
imull $0x19660d, %eax, %ecx   # imm = 0x19660D
xorl %edi, %eax
imull $0x343fd, %eax, %eax    # imm = 0x343FD
addl $0x3039, %edx           # imm = 0x3039
orl $0x1000, %edx           # imm = 0x1000
addl $0x3c6ef35f, %ecx       # imm = 0x3C6EF35F
movl %edx, 0xc60c(%rip)      # 0x1110c
addl $0x269ec3, %eax         # imm = 0x269EC3
orl $0x10, %ecx
orl $0x100000, %eax         # imm = 0x100000
movl %ecx, 0xc5f5(%rip)      # 0x11108
movl %eax, 0xc5f7(%rip)      # 0x11110
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Engine/Random.c
// Function: RandomInteger
uint32_t RandomInteger()
{
	s1=((s1&0xfffffffe)<<12)^(((s1<<13)^s1)>>19);
	s2=((s2&0xfffffff8)<<4)^(((s2<<2)^s2)>>25);
	s3=((s3&0xfffffff0)<<17)^(((s3<<3)^s3)>>11);
	return s1^s2^s3;
}

// Assembly:
movl 0xc5e8(%rip), %eax      # 0x11108
movl 0xc5e6(%rip), %esi      # 0x1110c
movl %eax, %ecx
movl %eax, %edx
shll $0xd, %ecx
andl $-0x2, %edx
xorl %eax, %ecx
leal (,%rsi,4), %eax
shll $0xc, %edx
xorl %esi, %eax
shrl $0x13, %ecx
shll $0x4, %esi
orl %edx, %ecx
shrl $0x19, %eax
movl 0xc5c1(%rip), %edx      # 0x11110
andl $-0x80, %esi
movl %ecx, 0xc5b0(%rip)      # 0x11108
orl %esi, %eax
leal (,%rdx,8), %esi
xorl %edx, %esi
movl %eax, 0xc5a3(%rip)      # 0x1110c
xorl %ecx, %eax
andl $-0x10, %edx
shrl $0xb, %esi
shll $0x11, %edx
orl %edx, %esi
xorl %esi, %eax
movl %esi, 0xc592(%rip)      # 0x11110
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Graphics/Bitmap.c
// Function: InitializeSubBitmap
void InitializeSubBitmap(Bitmap *self,Bitmap *parent,int x,int y,int width,int height)
{
	if(ClipRectangle(&x,&y,&width,&height,parent->width,parent->height))
	{
		InitializeBitmap(self,width,height,parent->bytesperrow,
		BitmapPixelPointer(parent,x,y));
	}
	else
	{
		InitializeBitmap(self,0,0,0,NULL);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movswl (%rsi), %eax
leal (%r8,%rdx), %r11d
cmpl %edx, %eax
setle %r10b
testl %r11d, %r11d
setle %bl
orb %r10b, %bl
jne 0x4c47
movswl 0x2(%rsi), %r10d
leal (%r9,%rcx), %ebp
cmpl %ecx, %r10d
setle %bl
testl %ebp, %ebp
setle %r14b
orb %bl, %r14b
je 0x4c4f
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
jmp 0x4ca7
xorl %r14d, %r14d
movl %eax, %ebx
testl %edx, %edx
cmovlel %r14d, %edx
cmovsl %r11d, %r8d
movl %r10d, %r11d
subl %edx, %ebx
leal (%r8,%rdx), %r15d
testl %ecx, %ecx
cmovsl %ebp, %r9d
cmovgl %ecx, %r14d
movl 0x4(%rsi), %ebp
leal (%r9,%r14), %ecx
subl %r14d, %r11d
imull %ebp, %r14d
movslq %r14d, %r14
addq 0x8(%rsi), %r14
cmpl %eax, %r15d
leaq (%r14,%rdx,4), %rax
cmovlel %r8d, %ebx
cmpl %r10d, %ecx
cmovlel %r9d, %r11d
movw %bx, (%rdi)
movw %r11w, 0x2(%rdi)
movl %ebp, 0x4(%rdi)
movq %rax, 0x8(%rdi)
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Graphics/Bitmap.c
// Function: ScrollBitmap
void ScrollBitmap(Bitmap *self,int dx,int dy)
{
	if(dx==0 && dy==0) return;
	if(dx>=self->width || dx<=-self->width) return;
	if(dy>=self->height || dy<=-self->height) return;

	if(dx==0)
	{
		if(dy<=0) memmove(BitmapPixelPointer(self,0,0),BitmapPixelPointer(self,0,-dy),(self->height+dy)*self->bytesperrow);
		else memmove(BitmapPixelPointer(self,0,dy),BitmapPixelPointer(self,0,0),(self->height-dy)*self->bytesperrow);
	}
	else
	{
		if(dy<=0) for(int y=0;y<self->height+dy;y++) ScrollBitmapRow(self,dx,y,y-dy);
		else for(int y=self->height-1;y>=dy;y--) ScrollBitmapRow(self,dx,y,y-dy);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %eax
orl %esi, %eax
je 0x4dc2
movswl (%rdi), %eax
movl %esi, %ebp
movq %rdi, %r14
cmpl %esi, %eax
setg %cl
negl %eax
cmpl %esi, %eax
setl %al
andb %cl, %al
cmpb $0x1, %al
jne 0x4dc2
movzwl 0x2(%r14), %eax
movl %edx, %ebx
movswl %ax, %r15d
movl %r15d, %ecx
subl %edx, %ecx
movl %r15d, %edx
setg %sil
negl %edx
cmpl %ebx, %edx
setl %dl
andb %sil, %dl
cmpb $0x1, %dl
jne 0x4dc2
testl %ebp, %ebp
je 0x4d7d
movl %ebx, %r12d
testl %ebx, %ebx
jle 0x4d99
notl %r12d
cmpl %ebx, %r15d
jle 0x4dc2
leal (%r12,%r15), %ecx
decl %r15d
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x4def
jmp 0x4d62
movl 0x4(%r14), %edx
movq 0x8(%r14), %rsi
movl %edx, %eax
imull %ebx, %eax
testl %ebx, %ebx
jle 0x4dcb
imull %ecx, %edx
movslq %eax, %rdi
addq %rsi, %rdi
jmp 0x4ddf
negl %r12d
xorl %r15d, %r15d
cwtl
addl %ebx, %eax
cmpl %eax, %r15d
jge 0x4dc2
leal (%r12,%r15), %ecx
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x4def
incl %r15d
movzwl 0x2(%r14), %eax
jmp 0x4d9f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
addl %ebx, %r15d
negl %eax
movq %rsi, %rdi
imull %r15d, %edx
cltq
addq %rsi, %rax
movq %rax, %rsi
movslq %edx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x11a0
// File: /workspace/github_c_makefile_star2_O2/halcy[P]quasi_crystals_bot/Graphics/Bitmap.c
// Function: ScrollAndFillBitmap
void ScrollAndFillBitmap(Bitmap *self,int dx,int dy,Pixel c)
{
	if(dx==0 && dy==0) return;
	if(dx>=self->width || dx<=-self->width) { FillBitmap(self,c); return; }
	if(dy>=self->height || dy<=-self->height) { FillBitmap(self,c); return; }

	if(dy>0) for(int y=0;y<dy;y++) FillBitmapRow(self,y,c);

	if(dx==0)
	{
		if(dy<=0) memmove(BitmapPixelPointer(self,0,0),BitmapPixelPointer(self,0,-dy),(self->height+dy)*self->bytesperrow);
		else memmove(BitmapPixelPointer(self,0,dy),BitmapPixelPointer(self,0,0),(self->height-dy)*self->bytesperrow);
	}
	else
	{
		if(dy<=0) for(int y=0;y<self->height+dy;y++) ScrollAndFillBitmapRow(self,dx,y,y-dy,c);
		else for(int y=self->height-1;y>=dy;y--) ScrollAndFillBitmapRow(self,dx,y,y-dy,c);
	}

	if(dy<=0) for(int y=self->height+dy;y<self->height;y++) FillBitmapRow(self,y,c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %eax
orl %esi, %eax
je 0x4f71
movswl (%rdi), %eax
movl %ecx, %ebp
movl %esi, %r15d
movq %rdi, %r14
cmpl %esi, %eax
setg %cl
negl %eax
cmpl %esi, %eax
setl %al
testb %al, %cl
je 0x4eb7
movswl 0x2(%r14), %eax
movl %edx, %ebx
cmpl %edx, %eax
setg %cl
negl %eax
cmpl %edx, %eax
setl %al
testb %al, %cl
je 0x4eb7
testl %ebx, %ebx
jle 0x4ed0
xorl %r12d, %r12d
cmpl %r12d, %ebx
je 0x4ed0
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x4cef
incl %r12d
jmp 0x4ea0
movq %r14, %rdi
movl %ebp, %esi
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4cc6
testl %r15d, %r15d
je 0x4f08
movl %ebx, %r13d
testl %ebx, %ebx
jle 0x4f40
movswl 0x2(%r14), %r12d
notl %r13d
cmpl %ebx, %r12d
jle 0x4f6d
leal (%r13,%r12), %ecx
decl %r12d
movq %r14, %rdi
movl %r15d, %esi
movl %ebp, %r8d
movl %r12d, %edx
callq 0x4fc1
jmp 0x4ee4
movl 0x4(%r14), %ecx
movq 0x8(%r14), %rsi
movl %ecx, %eax
imull %ebx, %eax
testl %ebx, %ebx
jle 0x4f81
movswl 0x2(%r14), %edx
movslq %eax, %rdi
subl %ebx, %edx
addq %rsi, %rdi
imull %ecx, %edx
movslq %edx, %rdx
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0
negl %r13d
xorl %r12d, %r12d
movswl 0x2(%r14), %eax
addl %ebx, %eax
cmpl %eax, %r12d
jge 0x4f6d
leal (%r13,%r12), %ecx
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl %ebp, %r8d
callq 0x4fc1
incl %r12d
jmp 0x4f46
testl %ebx, %ebx
jle 0x4fa0
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movswl 0x2(%r14), %edx
negl %eax
movq %rsi, %rdi
addl %ebx, %edx
cltq
imull %ecx, %edx
addq %rsi, %rax
movq %rax, %rsi
movslq %edx, %rdx
callq 0x11a0
movswl 0x2(%r14), %eax
addl %eax, %ebx
cwtl
cmpl %eax, %ebx
jge 0x4f71
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x4cef
incl %ebx
movzwl 0x2(%r14), %eax
jmp 0x4fa7