LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/dropletzhu[P]msuite/tcpclient.c
// Function: long_lived_connection
void long_lived_connection(int sockfd)
{
	char buffer[1024];
	int retcode;

	memset(buffer, 0, 1024);
	while (1) {
		retcode = send(sockfd, buffer, 1024, 0);
		if (retcode < 0) {
			perror("send()");
			break;
		}
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movl %edi, %ebx
movq %rsp, %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1070
movl $0x400, %edx            # imm = 0x400
movl %ebx, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x1050
testl %eax, %eax
jns 0x1285
leaq 0xd81(%rip), %rdi       # 0x2022
callq 0x10a0
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/dropletzhu[P]msuite/tcpclient.c
// Function: usage
void usage()
{
	printf("Usage: ./tcpclient -s [server_ip] -p [port] -l\n");
	printf(" -s	server ip address\n");
	printf(" -p  server port\n");
	printf(" -l  long-lived connection, by default, it is short-lived echo connection\n");
}

// Assembly:
pushq %rax
leaq 0xd89(%rip), %rdi       # 0x2042
callq 0x1040
leaq 0xdac(%rip), %rdi       # 0x2071
callq 0x1040
leaq 0xdb6(%rip), %rdi       # 0x2087
callq 0x1040
leaq 0xdbb(%rip), %rdi       # 0x2098
popq %rax
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/dropletzhu[P]msuite/tcpclient.c
// Function: main
int main(int argc, char *argv[])
{
    int sockfd;
    struct sockaddr_in their_addr;
	struct in_addr server_ip;
	int port;
	char ch;
	int retcode;
	int long_lived = 0;

    if (argc < 2) {
        usage();
        return -1;
    }

    while ((ch = getopt (argc, argv, "s:p:l")) != -1) {
        switch (ch) {
		case 's':
			retcode = inet_aton(optarg, &server_ip);
			if (retcode == 0) {
				printf("wrong address format\n");
				return -1;
			}
        case 'p':
            port = atoi(optarg);
            break;
        case 'l':
            long_lived = 1;
            break;
        default:
            usage();
            return -1;
        }
    }

    if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
        perror("socket()");
        exit(-1);
    }

    their_addr.sin_family = AF_INET;
    their_addr.sin_port = htons(port);
    their_addr.sin_addr.s_addr = server_ip.s_addr;
    memset(&(their_addr.sin_zero), '\0', 8);

    if(connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1) {
        perror("connect()");
        exit(-1);
    }

	if (long_lived) {
		long_lived_connection(sockfd);
	} else {
		short_lived_connection(sockfd);
	}
 
    close(sockfd);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x2, %edi
jge 0x1303
callq 0x12b1
pushq $-0x1
popq %rax
jmp 0x13d6
movq %rsi, %rbx
movl %edi, %ebp
xorl %ecx, %ecx
leaq 0xd18(%rip), %r14       # 0x2029
pushq $0x1
popq %r15
movl %ecx, %r13d
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10b0
shll $0x18, %eax
cmpl $0xff000000, %eax       # imm = 0xFF000000
je 0x1377
sarl $0x18, %eax
movl %r15d, %ecx
cmpl $0x6c, %eax
je 0x1315
cmpl $0x70, %eax
je 0x1360
cmpl $0x73, %eax
jne 0x12f6
movq 0x2c95(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1090
testl %eax, %eax
je 0x13e5
movq 0x2c79(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
callq 0x10c0
movl %eax, %r12d
movl %r13d, %ecx
jmp 0x1315
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x10f0
cmpl $-0x1, %eax
je 0x13f6
movl %eax, %ebx
leaq 0x8(%rsp), %rsi
movw $0x2, (%rsi)
rolw $0x8, %r12w
movw %r12w, 0x2(%rsi)
movl 0x4(%rsp), %eax
movl %eax, 0x4(%rsi)
andq $0x0, 0x8(%rsi)
pushq $0x10
popq %rdx
movl %ebx, %edi
callq 0x10e0
cmpl $-0x1, %eax
je 0x13ff
movl %ebx, %edi
testl %r13d, %r13d
je 0x13c8
callq 0x1267
jmp 0x13cd
callq 0x11fc
movl %ebx, %edi
callq 0x1080
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xcf6(%rip), %rdi       # 0x20e2
callq 0x1040
jmp 0x12fb
leaq 0xc32(%rip), %rdi       # 0x202f
jmp 0x1406
leaq 0xc32(%rip), %rdi       # 0x2038
callq 0x10a0
pushq $-0x1
popq %rdi
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: get_gsa
int
get_gsa(KB11A *kb)
{
	int set1 = !kb->cnsl_act && kb->c.ps&PS_GPR && kb->sf<6 ||
		kb->c.ps&PS_CM0 && kb->sf==6;
	int gsa;
	switch(kb->c.rbr.pad){
	case 0:
	case 1: gsa = kb->sf | (kb->c.ps&PS_CM1 && kb->sf==6); break;
	case 4: gsa = kb->sf | 1; break;
	case 2:
	case 3: gsa = 5; break;
	case 6: gsa = 0; break;
	case 5: gsa = kb->df | (!kb->cnsl_act && kb->df==6 &&
		kb->dm0_mfp_mtp_cond ? kb->c.ps&PS_PM1 : kb->c.ps&PS_CM1);
		break;
	case 7: gsa = kb->c.ps&PS_CM1 ? 7 : 6; break;
	}
	return gsa|set1<<3;
}

// Assembly:
movl 0x23c(%rdi), %esi
testl %esi, %esi
sete %al
movzwl 0x98(%rdi), %edx
movl %edx, %ecx
shrl $0xb, %ecx
andl $0x1, %ecx
andb %al, %cl
cmpb $0x1, %cl
jne 0x2484
cmpl $0x6, 0x220(%rdi)
jge 0x2484
pushq $0x8
popq %rcx
jmp 0x249b
xorl %ecx, %ecx
btl $0xe, %edx
jae 0x249b
xorl %ecx, %ecx
cmpl $0x6, 0x220(%rdi)
sete %cl
shll $0x3, %ecx
movl 0x48(%rdi), %r8d
pushq $0x5
popq %rax
cmpq $0x7, %r8
ja 0x251a
leaq 0x1b75(%rip), %r9       # 0x4024
movslq (%r9,%r8,4), %r8
addq %r9, %r8
jmpq *%r8
movl 0x220(%rdi), %esi
testw %dx, %dx
sets %al
cmpl $0x6, %esi
sete %dl
andb %al, %dl
movzbl %dl, %eax
orl %esi, %eax
jmp 0x251a
movl 0x220(%rdi), %eax
orl $0x1, %eax
jmp 0x251a
xorl %eax, %eax
testw %dx, %dx
setns %al
xorl $0x7, %eax
jmp 0x251a
movl 0x224(%rdi), %eax
movl %eax, %r8d
xorl $0x6, %r8d
orl %r8d, %esi
jne 0x250b
movw $0x2000, %si            # imm = 0x2000
cmpl $0x0, 0x22c(%rdi)
jne 0x250f
movw $0x8000, %si            # imm = 0x8000
andl %esi, %edx
movzwl %dx, %edx
orl %edx, %eax
jmp 0x251a
xorl %eax, %eax
orl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: get_gda
int
get_gda(KB11A *kb)
{
	int set1 = !kb->cnsl_act && kb->c.ps&PS_GPR && kb->df<6 ||
		kb->c.ps&PS_CM0 && kb->df==6 && !kb->dm0_mfp_mtp_cond;
	int gda;
	switch(kb->c.rbr.pad){
	case 0: gda = kb->sf | (kb->c.ps&PS_CM1 && kb->sf==6); break;
	case 4: gda = kb->sf | 1; break;
	case 1:
	case 5: gda = kb->df | (!kb->cnsl_act && kb->df==6 &&
		kb->dm0_mfp_mtp_cond ? kb->c.ps&PS_PM1 : kb->c.ps&PS_CM1);
		break;
	case 2: gda = 5; break;
	case 6: gda = 0; break;
	case 3:
	case 7: gda = kb->c.ps&PS_CM1 ? 7 : 6; break;
	}
	return gda|set1<<3;
}

// Assembly:
movl 0x23c(%rdi), %esi
testl %esi, %esi
sete %al
movzwl 0x98(%rdi), %edx
movl %edx, %ecx
shrl $0xb, %ecx
andl $0x1, %ecx
andb %al, %cl
cmpb $0x1, %cl
jne 0x254c
cmpl $0x6, 0x224(%rdi)
jge 0x254c
pushq $0x8
popq %rcx
jmp 0x256c
xorl %ecx, %ecx
btl $0xe, %edx
jae 0x256c
cmpl $0x6, 0x224(%rdi)
jne 0x256c
xorl %ecx, %ecx
cmpl $0x0, 0x22c(%rdi)
sete %cl
shll $0x3, %ecx
movl 0x48(%rdi), %r8d
pushq $0x5
popq %rax
cmpq $0x7, %r8
ja 0x25eb
leaq 0x1ac4(%rip), %r9       # 0x4044
movslq (%r9,%r8,4), %r8
addq %r9, %r8
jmpq *%r8
movl 0x224(%rdi), %eax
movl %eax, %r8d
xorl $0x6, %r8d
orl %r8d, %esi
jne 0x25a9
movw $0x2000, %si            # imm = 0x2000
cmpl $0x0, 0x22c(%rdi)
jne 0x25ad
movw $0x8000, %si            # imm = 0x8000
andl %esi, %edx
movzwl %dx, %edx
orl %edx, %eax
jmp 0x25eb
xorl %eax, %eax
testw %dx, %dx
setns %al
xorl $0x7, %eax
jmp 0x25eb
movl 0x220(%rdi), %eax
orl $0x1, %eax
jmp 0x25eb
xorl %eax, %eax
jmp 0x25eb
movl 0x220(%rdi), %esi
testw %dx, %dx
sets %al
cmpl $0x6, %esi
sete %dl
andb %al, %dl
movzbl %dl, %eax
orl %esi, %eax
orl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: load_sr
void
load_sr(KB11A *kb)
{
	if(kb->c.rbr.srk){
		// TODO: don't set here
		kb->sf = kb->c.ir>>6 & 7;
		int srsel = kb->c.rbr.srx == 1 || kb->c.rbr.srx&2 && kb->sf!=7;
		kb->n.sr = srsel ? kb->gs[get_gsa(kb)] : kb->shfr;
	}
}

// Assembly:
cmpl $0x0, 0x28(%rdi)
je 0x2642
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %eax
movl 0x20(%rdi), %ecx
shrl $0x6, %eax
andl $0x7, %eax
movl %eax, 0x220(%rdi)
cmpl $0x1, %ecx
je 0x261a
testb $0x2, %cl
je 0x2630
cmpw $0x7, %ax
je 0x2630
movq %rbx, %rdi
callq 0x2455
cltq
leaq (%rbx,%rax,2), %rax
addq $0x140, %rax            # imm = 0x140
jmp 0x2637
leaq 0x216(%rbx), %rax
movzwl (%rax), %eax
movw %ax, 0xa6(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: load_dr
void
load_dr(KB11A *kb)
{
	switch(kb->c.rbr.drk){
	case 0:	break;
	case 1: kb->n.dr = kb->c.dr>>1 | kb->alu<<15; break;
	case 2: kb->n.dr = kb->c.dr<<1; break;	// TODO
	case 3:
		if(kb->c.rbr.drx == 3)
			// TODO: this his held low until 5 even, do we need that?
			kb->n.dr = 0;
		else{
			// TODO: don't set here, wrong too
			kb->df = kb->c.ir & 7;
			int drsel = kb->c.rbr.drx == 1 || kb->c.rbr.drx&2 && kb->df!=7;
			kb->n.dr = drsel ? kb->gd[get_gda(kb)] : kb->shfr;
		}
		break;
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x2c(%rdi), %eax
cmpl $0x3, %eax
je 0x2672
cmpl $0x2, %eax
je 0x266b
cmpl $0x1, %eax
jne 0x26c2
movzwl 0x8(%rbx), %ecx
movzwl 0x21c(%rbx), %eax
shldw $0xf, %cx, %ax
jmp 0x26bb
movl 0x8(%rbx), %eax
addl %eax, %eax
jmp 0x26bb
movl 0x24(%rbx), %ecx
cmpl $0x3, %ecx
jne 0x267e
xorl %eax, %eax
jmp 0x26bb
movzwl 0xc(%rbx), %eax
andl $0x7, %eax
movl %eax, 0x224(%rbx)
cmpl $0x1, %ecx
je 0x269b
testb $0x2, %cl
je 0x26b1
cmpw $0x7, %ax
je 0x26b1
movq %rbx, %rdi
callq 0x251d
cltq
leaq (%rbx,%rax,2), %rax
addq $0x160, %rax            # imm = 0x160
jmp 0x26b8
leaq 0x216(%rbx), %rax
movzwl (%rax), %eax
movw %ax, 0xa8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: update_radr
void
update_radr(KB11A *kb)
{
	byte af = kb->c.rbr.fen & 1 ? get_afork(kb) : M8;
	byte bf = kb->c.rbr.fen & 2 ? get_bfork(kb) : M8;
	byte cf = kb->c.rbr.fen & 4 ? get_cfork(kb) : M8;
	kb->radr = (kb->rom.adr | get_brcab(kb)) & cf & bf & af;
	printf("getting new address %o\n", kb->radr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x78(%rdi), %ebp
xorl %r14d, %r14d
testb $0x1, %bpl
movl $0xff, %r15d
movl $0x0, %r12d
cmovel %r15d, %r12d
movl 0x1f0(%rdi), %r13d
testb $0x4, %bpl
cmovnel %r14d, %r15d
callq 0x2ac8
movzbl %al, %esi
orl %r13d, %esi
andl %r15d, %esi
testb $0x2, %bpl
cmovnel %r14d, %esi
andl %r12d, %esi
movw %si, 0x180(%rbx)
leaq 0x1c22(%rip), %rdi      # 0x492e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: t1
void
t1(KB11A *kb)
{
	printf("T1\n");

	kb->n.rbr.bsd = kb->rom.bsd;
	kb->n.rbr.bax = kb->rom.bax;
	kb->n.rbr.ibs = kb->rom.ibs;
	kb->n.rbr.shc = kb->rom.shc;
	kb->n.rbr.bct = kb->rom.bct;
	kb->n.rbr.msc = kb->rom.msc;
	kb->n.rbr.bsc = kb->rom.bsc;
	kb->n.rbr.amx = kb->rom.amx;
	kb->n.rbr.bmx = kb->rom.bmx;
	kb->n.rbr.kmx = kb->rom.kmx;
	kb->n.rbr.alu = kb->rom.alu;

	load_sr(kb);
	load_dr(kb);
	if(kb->c.rbr.drk == 3)
		/* not quite correct, but should be ok */
		kb->grab_obd = kb->n.dr & 1;
	if(kb->c.rbr.brk)
printf("load BR %o %o\n", kb->c.rbr.brx<<2 | kb->sel_int<<1 | kb->sel_mem, kb->brmx);
		kb->n.br = kb->brmx;

	/* falling edge */
	kb->n.rbr.pwe = kb->rom.pwe;
	kb->n.rbr.pad = kb->rom.pad;

	kb->c = kb->n;
	update_state(kb);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x1c29(%rip), %rdi      # 0x4955
callq 0x2030
movups 0x1bc(%rbx), %xmm0
movups 0x1cc(%rbx), %xmm1
movups %xmm0, 0xec(%rbx)
movups %xmm1, 0xfc(%rbx)
movq 0x1dc(%rbx), %rax
movq %rax, 0x10c(%rbx)
movl 0x1e4(%rbx), %eax
movl %eax, 0x114(%rbx)
movq %rbx, %rdi
callq 0x25ee
movq %rbx, %rdi
callq 0x2643
cmpl $0x3, 0x2c(%rbx)
jne 0x2d8d
movzwl 0xa8(%rbx), %eax
andl $0x1, %eax
movl %eax, 0x230(%rbx)
cmpl $0x0, 0x18(%rbx)
je 0x2dbe
movl 0x1c(%rbx), %eax
shll $0x2, %eax
movl 0x240(%rbx), %esi
addl %esi, %esi
orl %eax, %esi
orl 0x244(%rbx), %esi
movzwl 0x218(%rbx), %edx
leaq 0x1b8f(%rip), %rdi      # 0x4946
xorl %eax, %eax
callq 0x2040
leaq 0xa0(%rbx), %rsi
movzwl 0x218(%rbx), %eax
movw %ax, 0xa0(%rbx)
movq 0x1b4(%rbx), %rax
movq %rax, 0xe4(%rbx)
movl $0xa0, %edx
movq %rbx, %rdi
callq 0x2070
movq %rbx, %rdi
popq %rbx
jmp 0x26c4
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: t2
void
t2(KB11A *kb)
{
	printf("T2\n");

	kb->n.rbr.brk = kb->rom.brk;
	kb->n.rbr.brx = kb->rom.brx;
	kb->n.rbr.srx = kb->rom.srx;
	kb->n.rbr.drx = kb->rom.drx;
	kb->n.rbr.srk = kb->rom.srk;
	kb->n.rbr.drk = kb->rom.drk;
	kb->n.rbr.ccl = kb->rom.ccl;
	kb->n.rbr.pca = kb->rom.pca;
	kb->n.rbr.pcb = kb->rom.pcb;
	kb->n.rbr.shf = kb->rom.shf;
	kb->n.rbr.irk = kb->rom.irk;

	kb->c = kb->n;
	update_state(kb);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x1b56(%rip), %rdi      # 0x4958
callq 0x2030
leaq 0xa0(%rbx), %rsi
movups 0x188(%rbx), %xmm0
movups 0x198(%rbx), %xmm1
movups %xmm0, 0xb8(%rbx)
movups %xmm1, 0xc8(%rbx)
movq 0x1a8(%rbx), %rax
movq %rax, 0xd8(%rbx)
movl 0x1b0(%rbx), %eax
movl %eax, 0xe0(%rbx)
movl $0xa0, %edx
movq %rbx, %rdi
callq 0x2070
movq %rbx, %rdi
popq %rbx
jmp 0x26c4
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: t3
void
t3(KB11A *kb)
{
	printf("T3\n");

	update_radr(kb);
	kb->n.rar = kb->radr;
	if(kb->c.rbr.bct == 7){	// TODO: or
		// TODO: BEND, see UBCB CLR UNI
		printf("	BEND (TODO)\n");
	}
	if(kb->c.rbr.msc == 6){
		// TODO: BRQ strobe, TMCE
		printf("	BRQ STROBE (TODO)\n");
		// CLK CONF
		// if(ubcf_s_inst) tmca_conf = 1;
		// BRQ CLK
	}

	kb->c = kb->n;
	update_state(kb);
	update_rom(kb);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x1af6(%rip), %rdi      # 0x495b
callq 0x2030
movq %rbx, %rdi
callq 0x2cae
movb 0x180(%rbx), %al
movb %al, 0xb6(%rbx)
cmpl $0x7, 0x5c(%rbx)
jne 0x2e90
leaq 0x1ad3(%rip), %rdi      # 0x495e
callq 0x2030
cmpl $0x6, 0x60(%rbx)
jne 0x2ea2
leaq 0x1ace(%rip), %rdi      # 0x496b
callq 0x2030
leaq 0xa0(%rbx), %rsi
movl $0xa0, %edx
movq %rbx, %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x26c4
movq %rbx, %rdi
popq %rbx
jmp 0x2a7b
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: power
void
power(KB11A *kb)
{
	// TODO: don't do this
	memset(kb, 0, sizeof(KB11A));

	kb->ps_restore = 0;
	// eh?
	kb->conf = 1;

	memset(&kb->n.rbr, 0, sizeof(Uword));
	zap(kb);

	kb->c = kb->n;
	update_rom(kb);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x258, %edx            # imm = 0x258
xorl %esi, %esi
callq 0x2060
movl $0x1, 0x234(%rbx)
leaq 0xa0(%rbx), %rsi
xorps %xmm0, %xmm0
movups %xmm0, 0xb8(%rbx)
movups %xmm0, 0xc8(%rbx)
movups %xmm0, 0xd8(%rbx)
movups %xmm0, 0xe8(%rbx)
movups %xmm0, 0xf8(%rbx)
movups %xmm0, 0x108(%rbx)
movups %xmm0, 0x118(%rbx)
movups %xmm0, 0x128(%rbx)
movb $-0x80, 0xb6(%rbx)
movl $0xa0, %edx
movq %rbx, %rdi
callq 0x2070
movq %rbx, %rdi
popq %rbx
jmp 0x2a7b
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: test
void
test(KB11A *kb)
{
	kb->n.pcb = 01234;
	kb->n.dr = 04321;
	kb->sw = 0112233;
	kb->unibusd = 0123321;

	int i;
	for(i = 0; i < 3; i++){
		t1(kb);
		dumpstate(kb);
		t2(kb);
		dumpstate(kb);
		if(kb->c.rbr.bsd == INTR_PAUSE)
			printf("	INTR PAUSE\n");
		t3(kb);
		dumpstate(kb);
		t4(kb);
		dumpstate(kb);
		t5(kb);
		dumpstate(kb);
		printf("----------\n");
	}
	t1(kb);
	dumpstate(kb);

/*
	kb->c.ir = 0012701;
	kb->c.ir = 0066700;
	ir_decode(kb);
	update_state(kb);
*/
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movw $0x29c, 0xa4(%rdi)      # imm = 0x29C
movw $0x8d1, 0xa8(%rdi)      # imm = 0x8D1
movl $0x949b, 0x254(%rdi)    # imm = 0x949B
movw $0xa6d1, 0x24c(%rdi)    # imm = 0xA6D1
pushq $0x3
popq %rbp
leaq 0x19a9(%rip), %r14      # 0x4984
leaq 0x19ae(%rip), %r15      # 0x4990
movq %rbx, %rdi
callq 0x2d21
movq %rbx, %rdi
callq 0x2329
subl $0x1, %ebp
jb 0x304f
movq %rbx, %rdi
callq 0x2df7
movq %rbx, %rdi
callq 0x2329
cmpl $0x1, 0x4c(%rbx)
jne 0x3015
movq %r14, %rdi
callq 0x2030
movq %rbx, %rdi
callq 0x2e5a
movq %rbx, %rdi
callq 0x2329
movq %rbx, %rdi
callq 0x2ec7
movq %rbx, %rdi
callq 0x2329
movq %rbx, %rdi
callq 0x2ef4
movq %rbx, %rdi
callq 0x2329
movq %r15, %rdi
callq 0x2030
jmp 0x2fe2
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]pdp11/u_kb11a.c
// Function: main
int
main()
{
	KB11A *kb;
	kb = malloc(sizeof(KB11A));

	power(kb);
	test(kb);

	return 0;
}

// Assembly:
pushq %rbx
movl $0x258, %edi            # imm = 0x258
callq 0x2080
movq %rax, %rbx
movq %rax, %rdi
callq 0x2f29
movq %rbx, %rdi
callq 0x2fa2
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/CSerxzm[P]WindowstoLinuxInterface/src/TYPE.c
// Function: main
int main(int argc, char** argv){
    char lines[argc+1][255];
    predealLine(argc, argv, lines);
    struct stat dir_stat;
    if(access(lines[1], F_OK)==0){
        if(stat(lines[1], &dir_stat)>=0){
            if(S_ISREG(dir_stat.st_mode)){
                FILE *fp=fopen(lines[1],"r");
                copy_file(fp,stdout);
            }
            else{
                perror("Not reg\n");
            }
        }
        else{
            perror("stat error!\n");
        }
    }
    else{
        perror("Don't exist\n");
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
leal 0x1(%rdi), %eax
movq %rsp, %rbx
imulq $0xff, %rax, %rax
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
movq %rbx, %rdx
callq 0x11bc
addq $0xff, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1060
testl %eax, %eax
jne 0x134f
leaq -0x98(%rbp), %rsi
movq %rbx, %rdi
callq 0x1050
testl %eax, %eax
js 0x1358
movl $0xf000, %eax           # imm = 0xF000
andl -0x80(%rbp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x1361
leaq 0xcd8(%rip), %rsi       # 0x2004
movq %rbx, %rdi
callq 0x1070
movq 0x2ca5(%rip), %rcx      # 0x3fe0
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x1294
xorl %eax, %eax
leaq -0x8(%rbp), %rsp
popq %rbx
popq %rbp
retq
leaq 0xcc6(%rip), %rdi       # 0x201c
jmp 0x1368
leaq 0xcb0(%rip), %rdi       # 0x200f
jmp 0x1368
leaq 0xc9e(%rip), %rdi       # 0x2006
callq 0x1080
jmp 0x1346
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/unifi-motion.c
// Function: mac
bool mac(char *buf, int len)
{
  struct ifreq s;
  int fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
  struct if_nameindex *if_nidxs, *intf;

  if_nidxs = if_nameindex();
  if (if_nidxs != NULL)
  {
    for (intf = if_nidxs; intf->if_index != 0 || intf->if_name != NULL; intf++)
    {
      strcpy(s.ifr_name, intf->if_name);
      if (0 == ioctl(fd, SIOCGIFHWADDR, &s))
      {
        int i;
        if ( s.ifr_addr.sa_data[0] == 0 &&
             s.ifr_addr.sa_data[1] == 0 &&
             s.ifr_addr.sa_data[2] == 0 &&
             s.ifr_addr.sa_data[3] == 0 &&
             s.ifr_addr.sa_data[4] == 0 &&
             s.ifr_addr.sa_data[5] == 0 ) {
          continue;
        }
        for (i = 0; i < 6 && i * 2 < len; ++i)
        {
          sprintf(&buf[i * 2], "%02x", (unsigned char)s.ifr_addr.sa_data[i]);
        }
        return true;
      }
    }
  }

  return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %r12d
movq %rdi, %rbx
pushq $0x2
popq %rdi
xorl %r15d, %r15d
movl %edi, %esi
xorl %edx, %edx
callq 0x3670
movl %eax, %ebp
callq 0x3430
testq %rax, %rax
je 0x389c
movq %rax, %r14
movslq %r12d, %r12
movq %rsp, %r15
cmpl $0x0, (%r14)
sete %al
movq 0x8(%r14), %rsi
testq %rsi, %rsi
sete %cl
testb %cl, %al
jne 0x3899
movq %r15, %rdi
callq 0x30e0
movl $0x8927, %esi           # imm = 0x8927
movl %ebp, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3250
testl %eax, %eax
jne 0x3893
cmpl $0x0, 0x12(%rsp)
jne 0x38ae
cmpb $0x0, 0x16(%rsp)
jne 0x38ae
cmpb $0x0, 0x17(%rsp)
jne 0x38ae
addq $0x10, %r14
jmp 0x384c
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12d51(%rip), %r14     # 0x16606
xorl %r13d, %r13d
xorl %ebp, %ebp
movb $0x1, %r15b
cmpq $0x5, %rbp
ja 0x389c
cmpq %r12, %r13
jge 0x389c
leaq (%rbx,%r13), %rdi
movzbl 0x12(%rsp,%rbp), %edx
movq %r14, %rsi
xorl %eax, %eax
callq 0x35a0
incq %rbp
addq $0x2, %r13
jmp 0x38ba
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/unifi-motion.c
// Function: generate_mqtt_id
char *generate_mqtt_id(char *buf, int len) {
  extern char *__progname; // glibc populates this
  int i;
  strncpy(buf, basename(__progname), len);
  i = strlen(buf);

  if (i < len) {
    buf[i++] = '_';
    // If we can't get MAC to pad mqtt id then use PID
    if (!mac(&buf[i], len - i)) {
      sprintf(&buf[i], "%.*d", (len-i), getpid());
    }
  }
  buf[len] = '\0';

  return buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x1a6c0(%rip), %rax     # 0x1dfb8
movq (%rax), %rdi
callq 0x33b0
movslq %ebp, %r14
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x30b0
movq %rbx, %rdi
callq 0x3180
movq %rax, %r15
cmpl %r14d, %r15d
jge 0x3962
movslq %r15d, %rax
movb $0x5f, (%rbx,%rax)
movslq %r15d, %rax
leaq (%rax,%rbx), %r12
incq %r12
notl %r15d
addl %ebp, %r15d
movq %r12, %rdi
movl %r15d, %esi
callq 0x3814
testb %al, %al
jne 0x3962
callq 0x3130
leaq 0x106b1(%rip), %rsi     # 0x14004
movq %r12, %rdi
movl %r15d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x35a0
movb $0x0, (%rbx,%r14)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/unifi-motion.c
// Function: send_mqtt_msg
void send_mqtt_msg(struct mg_connection *nc, char *message) {
  static uint16_t msg_id = 0;

  if ( _mqtt_status == mqttstopped || _mqtt_connection == NULL) {
  //if ( _mqtt_exit_flag == true || _mqtt_connection == NULL) {
    fprintf(stderr, "ERROR: No mqtt connection, can't send message '%s'\n", message);
    return;
  }
  // basic counter to give each message a unique ID.
  if (msg_id >= 65535) {
    msg_id = 1;
  } else {
    msg_id++;
  }

  mg_mqtt_publish(nc, _config.mqtt_pub_topic, msg_id, MG_MQTT_QOS(0), message, strlen(message));

  LOG("MQTT: Published: '%s' with id %d\n", message, msg_id);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpl $0x2, 0x1a9cc(%rip)     # 0x1e350
je 0x39d9
cmpq $0x0, 0x1aa1a(%rip)     # 0x1e3a8
je 0x39d9
movq %rdi, %r14
movzwl 0x1aa06(%rip), %eax     # 0x1e3a0
incw %ax
pushq $0x1
popq %rbp
cmovnel %eax, %ebp
movw %bp, 0x1a9f6(%rip)      # 0x1e3a0
movq 0x1aa17(%rip), %r15     # 0x1e3c8
movq %rbx, %rdi
callq 0x3180
movzwl %bp, %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
movq %rbx, %r8
movq %rax, %r9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x10c8e
movq 0x1a610(%rip), %rax     # 0x1dff0
movq (%rax), %rdi
leaq 0x1061f(%rip), %rsi     # 0x14009
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3340
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/unifi-motion.c
// Function: start_mqtt
void start_mqtt (struct mg_mgr *mgr) {
  LOG("Starting MQTT service\n");

  if (mg_connect(mgr, _config.mqtt_address, ev_handler) == NULL) {
    fprintf(stderr, "mg_connect(%s) failed\n", _config.mqtt_address);
    exit(EXIT_FAILURE);
  }
  _mqtt_status = mqttstarting;
}

// Assembly:
pushq %rax
movq 0x1a9aa(%rip), %rsi     # 0x1e3b0
leaq 0x3a(%rip), %rdx        # 0x3a47
callq 0x842d
testq %rax, %rax
je 0x3a20
andl $0x0, 0x1a932(%rip)     # 0x1e350
popq %rax
retq
movq 0x1a5c9(%rip), %rax     # 0x1dff0
movq (%rax), %rdi
movq 0x1a97f(%rip), %rdx     # 0x1e3b0
leaq 0x10605(%rip), %rsi     # 0x1403d
xorl %eax, %eax
callq 0x3340
pushq $0x1
popq %rdi
callq 0x35b0
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/unifi-motion.c
// Function: ev_handler
static void ev_handler(struct mg_connection *nc, int ev, void *p) {
  struct mg_mqtt_message *msg = (struct mg_mqtt_message *)p;
  (void)nc;

  //if (ev != MG_EV_POLL) LOG("MQTT handler got event %d\n", ev);
  switch (ev) {
    case MG_EV_CONNECT: {
      struct mg_send_mqtt_handshake_opts opts;
      memset(&opts, 0, sizeof(opts));
      opts.user_name = _config.mqtt_user;
      opts.password = _config.mqtt_passwd;
      opts.keep_alive = 5;
      opts.flags |= MG_MQTT_CLEAN_SESSION; // NFS Need to readup on this
      mg_set_protocol_mqtt(nc);
      mg_send_mqtt_handshake_opt(nc, _config.mqtt_ID, opts);
      fprintf(stderr, "Connected to mqtt %s with id of: %s\n", _config.mqtt_address, _config.mqtt_ID);
      _mqtt_status = mqttrunning;
      _mqtt_connection = nc;
    } break;
    case MG_EV_MQTT_CONNACK:
      if (msg->connack_ret_code != MG_EV_MQTT_CONNACK_ACCEPTED) {
        LOG("Got mqtt connection error: %d\n", msg->connack_ret_code);
        _mqtt_status = mqttstopped;
        _mqtt_connection = NULL;
      }
    break;
    case MG_EV_MQTT_PUBACK:
      LOG("Message publishing acknowledged (msg_id: %d)\n", msg->message_id);
    break;
    case MG_EV_CLOSE:
      fprintf( stderr, "MQTT Connection closed\n");
      _mqtt_status = mqttstopped;
      _mqtt_connection = NULL;
    break;
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
cmpl $0xca, %esi
je 0x3afe
cmpl $0x5, %esi
je 0x3b1e
cmpl $0x2, %esi
jne 0x3b16
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movups 0x1a934(%rip), %xmm0    # 0x1e3b8
movups %xmm0, 0x48(%rsp)
movw $0x5, 0x32(%rsp)
movb $0x2, 0x30(%rsp)
callq 0x104eb
movq 0x50(%rsp), %rax
movq %rax, 0x20(%rsp)
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x1a922(%rip), %r14     # 0x1e3e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10a02
movq 0x1a520(%rip), %rax     # 0x1dff0
movq (%rax), %rdi
movq 0x1a8d6(%rip), %rdx     # 0x1e3b0
leaq 0x107cc(%rip), %rsi     # 0x142ad
movq %r14, %rcx
xorl %eax, %eax
callq 0x3340
movl $0x1, 0x1a85b(%rip)     # 0x1e350
movq %rbx, 0x1a8ac(%rip)     # 0x1e3a8
jmp 0x3b16
cmpb $0x0, 0x30(%rdx)
je 0x3b16
movl $0x2, 0x1a842(%rip)     # 0x1e350
andq $0x0, 0x1a892(%rip)     # 0x1e3a8
addq $0x58, %rsp
popq %rbx
popq %r14
retq
movq 0x1a4cb(%rip), %rax     # 0x1dff0
movq (%rax), %rcx
leaq 0x107a3(%rip), %rdi     # 0x142d2
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x35e0
jmp 0x3b04
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/unifi-motion.c
// Function: cleanup
void cleanup() {
  close_log(_umHandles.logfile);
  inotify_rm_watch(_umHandles.trigger, _umHandles.descriptor);

  if (_mqtt_status == mqttrunning && _mqtt_connection != NULL)
    mg_mqtt_disconnect(_mqtt_connection);

  free_config(&_config);
}

// Assembly:
pushq %rax
movq 0x1a8c0(%rip), %rdi     # 0x1e590
callq 0x3b3c
movl 0x1a8bd(%rip), %edi     # 0x1e598
movl 0x1a8bf(%rip), %esi     # 0x1e5a0
callq 0x3610
cmpl $0x1, 0x1a663(%rip)     # 0x1e350
sete %al
movq 0x1a6b1(%rip), %rdi     # 0x1e3a8
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3d09
callq 0x11011
leaq 0x1a6a0(%rip), %rdi     # 0x1e3b0
popq %rax
jmp 0x13110
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/unifi-motion.c
// Function: action_log_changes
int action_log_changes(FILE *fp, bool logMotion) {
  char *line = NULL;
  size_t len = 0;
  ssize_t read_size;
  size_t maxGroups = 3;
  regmatch_t groupArray[maxGroups];
  static char buf[LABEL_LEN];
  int lc = 0;

  while ((read_size = getline(&line, &len, fp)) != -1) {
    DLOG("Read from log:-\n  %s", line);
    lc++;
    if (regexec(&_config.regexCompiled, line, maxGroups, groupArray, 0) == 0) {
      if (groupArray[2].rm_so == (size_t)-1) {
        DLOG("No regexp from log file\n");
      } else {
        sprintf(buf, "%.*s:%.*s", (groupArray[1].rm_eo - groupArray[1].rm_so), (line + groupArray[1].rm_so), (groupArray[2].rm_eo - groupArray[2].rm_so),
                (line + groupArray[2].rm_so));
        LOG("regexp from log file '%s'\n", buf);
        int i;
        for (i = 0; i < _config.numMotions; i++) {
          if (strcmp(_config.motions[i]->name, buf) == 0) {
            DLOG("Motion match found\n");
            send_mqtt_msg(_mqtt_connection, _config.motions[i]->action);
            if (logMotion)
              fprintf(stderr, "Motion seen %s\n", buf);
            break;
          }
        }
      }
    }
  }

  return lc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, 0x14(%rsp)
leaq 0x8(%rsp), %r14
andq $0x0, (%r14)
leaq 0x20(%rsp), %r15
andq $0x0, (%r15)
movq %rdi, %r12
movq %rsp, 0x28(%rsp)
leaq 0x1a83e(%rip), %r13     # 0x1e5b0
leaq 0x1a637(%rip), %rbx     # 0x1e3b0
xorl %ebp, %ebp
movq %rdi, 0x18(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3590
cmpq $-0x1, %rax
je 0x3e8a
incl %ebp
movq 0x8(%rsp), %rsi
leaq 0x1a662(%rip), %rdi     # 0x1e408
pushq $0x3
popq %rdx
leaq 0x30(%rsp), %rcx
xorl %r8d, %r8d
callq 0x3460
testl %eax, %eax
jne 0x3d80
movslq 0x40(%rsp), %rax
cmpq $-0x1, %rax
je 0x3d80
movslq 0x38(%rsp), %rcx
movl 0x3c(%rsp), %edx
movl 0x44(%rsp), %r8d
subl %ecx, %edx
movq 0x8(%rsp), %r9
addq %r9, %rcx
subl %eax, %r8d
addq %rax, %r9
movq %r13, %rdi
leaq 0x102eb(%rip), %rsi     # 0x140d8
xorl %eax, %eax
callq 0x35a0
movl 0x1a78d(%rip), %r15d    # 0x1e588
testl %r15d, %r15d
movl $0x0, %eax
cmovlel %eax, %r15d
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x3e76
movq 0x98(%rbx,%r12,8), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x3310
incq %r12
testl %eax, %eax
jne 0x3e0a
movq 0x1a578(%rip), %rdi     # 0x1e3a8
addq $0x28, %r14
movq %r14, %rsi
callq 0x3973
cmpb $0x0, 0x14(%rsp)
leaq 0x8(%rsp), %r14
leaq 0x20(%rsp), %r15
movq 0x18(%rsp), %r12
je 0x3d80
movq 0x1a193(%rip), %rax     # 0x1dff0
movq (%rax), %rdi
leaq 0x1027b(%rip), %rsi     # 0x140e2
movq %r13, %rdx
xorl %eax, %eax
callq 0x3340
jmp 0x3d80
leaq 0x8(%rsp), %r14
leaq 0x20(%rsp), %r15
movq 0x18(%rsp), %r12
jmp 0x3d80
movq 0x28(%rsp), %rsp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_log_set_filter
void cs_log_set_filter(const char *str) {
  free(s_filter_pattern);
  if (str != NULL) {
    s_filter_pattern = strdup(str);
    s_filter_pattern_len = strlen(str);
  } else {
    s_filter_pattern = NULL;
    s_filter_pattern_len = 0;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x1a3fa(%rip), %rdi     # 0x1e5e8
callq 0x3060
testq %r14, %r14
je 0x420d
movq %r14, %rdi
callq 0x35f0
movq %rax, %rbx
movq %r14, %rdi
callq 0x3180
jmp 0x4211
xorl %ebx, %ebx
xorl %eax, %eax
movq %rbx, 0x1a3d0(%rip)     # 0x1e5e8
movq %rax, 0x1a3d1(%rip)     # 0x1e5f0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_log_print_prefix
int cs_log_print_prefix(enum cs_log_level level, const char *func,
                        const char *filename) {
  char prefix[21];

  if (level > cs_log_threshold) return 0;
  if (s_filter_pattern != NULL &&
      mg_match_prefix(s_filter_pattern, s_filter_pattern_len, func) < 0 &&
      mg_match_prefix(s_filter_pattern, s_filter_pattern_len, filename) < 0) {
    return 0;
  }

  strncpy(prefix, func, 20);
  prefix[20] = '\0';
  if (cs_log_file == NULL) cs_log_file = stderr;
  cs_log_cur_msg_level = level;
  fprintf(cs_log_file, "%-20s ", prefix);
#if CS_LOG_ENABLE_TS_DIFF
  {
    double now = cs_time();
    fprintf(cs_log_file, "%7u ", (unsigned int) ((now - cs_log_ts) * 1000000));
    cs_log_ts = now;
  }
#endif
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
xorl %ebp, %ebp
cmpl %edi, 0x1a39f(%rip)     # 0x1e5d8
jl 0x42cb
movq %rsi, %r14
movl %edi, %ebx
movq 0x1a39d(%rip), %rdi     # 0x1e5e8
testq %rdi, %rdi
je 0x427e
movq %rdx, %r15
movl 0x1a397(%rip), %esi     # 0x1e5f0
movq %r14, %rdx
callq 0x42d8
testl %eax, %eax
jns 0x427e
movq 0x1a37c(%rip), %rdi     # 0x1e5e8
movl 0x1a37e(%rip), %esi     # 0x1e5f0
movq %r15, %rdx
callq 0x42d8
testl %eax, %eax
js 0x42cb
movq %rsp, %r15
pushq $0x14
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x30b0
movb $0x0, 0x14(%r15)
movq 0x1a345(%rip), %rdi     # 0x1e5e0
testq %rdi, %rdi
jne 0x42b1
movq 0x19d49(%rip), %rax     # 0x1dff0
movq (%rax), %rdi
movq %rdi, 0x1a32f(%rip)     # 0x1e5e0
movl %ebx, 0x1a0a9(%rip)     # 0x1e360
leaq 0x1029e(%rip), %rsi     # 0x1455c
movq %rsp, %rdx
xorl %eax, %eax
callq 0x3340
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_match_prefix
int mg_match_prefix(const char *pattern, int pattern_len, const char *str) {
  const struct mg_str pstr = {pattern, (size_t) pattern_len};
  struct mg_str s = {str, 0};
  if (str != NULL) s.len = strlen(str);
  return mg_match_prefix_n(pstr, s);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
testq %rdx, %rdx
je 0x42f6
movq %rbx, %rdi
callq 0x3180
movq %rax, %rcx
jmp 0x42f8
xorl %ecx, %ecx
movslq %ebp, %rsi
movq %r14, %rdi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x740c
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_log_printf
void cs_log_printf(const char *fmt, ...) {
  va_list ap;
  va_start(ap, fmt);
  vfprintf(cs_log_file, fmt, ap);
  va_end(ap);
  fputc('\n', cs_log_file);
  fflush(cs_log_file);
  cs_log_cur_msg_level = LL_NONE;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x4368
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)
movq %rsp, %rdx
movq %rdi, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq 0x1a251(%rip), %rdi     # 0x1e5e0
movq %r10, %rsi
callq 0x3540
movq 0x1a242(%rip), %rsi     # 0x1e5e0
pushq $0xa
popq %rdi
callq 0x32b0
movq 0x1a233(%rip), %rdi     # 0x1e5e0
callq 0x3400
orl $-0x1, 0x19fa7(%rip)    # 0x1e360
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_base64_update
void cs_base64_update(struct cs_base64_ctx *ctx, const char *str, size_t len) {
  const unsigned char *src = (const unsigned char *) str;
  size_t i;
  for (i = 0; i < len; i++) {
    ctx->chunk[ctx->chunk_size++] = src[i];
    if (ctx->chunk_size == 3) {
      cs_base64_emit_chunk(ctx);
      ctx->chunk_size = 0;
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x4422
movb (%r14,%r12), %al
movslq 0xc(%r15), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0xc(%r15)
movb %al, 0x8(%r15,%rcx)
cmpl $0x3, 0xc(%r15)
jne 0x441d
movq %r15, %rdi
callq 0x442e
andl $0x0, 0xc(%r15)
incq %r12
jmp 0x43f0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_base64_emit_chunk
static void cs_base64_emit_chunk(struct cs_base64_ctx *ctx) {
  int a, b, c;

  a = ctx->chunk[0];
  b = ctx->chunk[1];
  c = ctx->chunk[2];

  cs_base64_emit_code(ctx, a >> 2);
  cs_base64_emit_code(ctx, ((a & 3) << 4) | (b >> 4));
  if (ctx->chunk_size > 1) {
    cs_base64_emit_code(ctx, (b & 15) << 2 | (c >> 6));
  }
  if (ctx->chunk_size > 2) {
    cs_base64_emit_code(ctx, c & 63);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzbl 0x8(%rdi), %r15d
movzbl 0x9(%rdi), %r14d
movzbl 0xa(%rdi), %ebp
movl %r15d, %esi
shrl $0x2, %esi
callq 0x11d31
shll $0x4, %r15d
andl $0x30, %r15d
movl %r14d, %esi
shrl $0x4, %esi
orl %r15d, %esi
movq %rbx, %rdi
callq 0x11d31
cmpl $0x2, 0xc(%rbx)
jl 0x44a2
andl $0xf, %r14d
movl %ebp, %eax
shrl $0x6, %eax
leal (%rax,%r14,4), %esi
movq %rbx, %rdi
callq 0x11d31
cmpl $0x3, 0xc(%rbx)
jl 0x44a2
andl $0x3f, %ebp
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x11d31
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_base64_finish
void cs_base64_finish(struct cs_base64_ctx *ctx) {
  if (ctx->chunk_size > 0) {
    int i;
    memset(&ctx->chunk[ctx->chunk_size], 0, 3 - ctx->chunk_size);
    cs_base64_emit_chunk(ctx);
    for (i = 0; i < (3 - ctx->chunk_size); i++) {
      ctx->b64_putc('=', ctx->user_data);
    }
  }
}

// Assembly:
movslq 0xc(%rdi), %rax
testq %rax, %rax
jle 0x4508
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8(%rdi,%rax), %rdi
pushq $0x3
popq %r14
movl %r14d, %ecx
subl %eax, %ecx
movslq %ecx, %rdx
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x3240
movq %rbx, %rdi
callq 0x442e
pushq $0x3d
popq %rbp
movl %r14d, %eax
subl 0xc(%rbx), %eax
cmpl %eax, %r15d
jge 0x44fe
movq 0x10(%rbx), %rsi
movl %ebp, %edi
callq *(%rbx)
incl %r15d
jmp 0x44e6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_base64_decode
int cs_base64_decode(const unsigned char *s, int len, char *dst, int *dec_len) {
  unsigned char a, b, c, d;
  int orig_len = len;
  char *orig_dst = dst;
  while (len >= 4 && (a = from_b64(s[0])) != 255 &&
         (b = from_b64(s[1])) != 255 && (c = from_b64(s[2])) != 255 &&
         (d = from_b64(s[3])) != 255) {
    s += 4;
    len -= 4;
    if (a == 200 || b == 200) break; /* '=' can't be there */
    *dst++ = a << 2 | b >> 4;
    if (c == 200) break;
    *dst++ = b << 4 | c >> 2;
    if (d == 200) break;
    *dst++ = c << 6 | d;
  }
  *dst = 0;
  if (dec_len != NULL) *dec_len = (dst - orig_dst);
  return orig_len - len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, -0x8(%rsp)
movq %rdx, %rcx
movl %esi, %eax
leaq 0x2(%rdx), %r8
leaq 0xfcf4(%rip), %r10      # 0x14450
cmpl $0x4, %esi
jl 0x4831
movzbl (%rdi), %r15d
andl $0x7f, %r15d
movb (%r15,%r10), %bpl
cmpb $-0x1, %bpl
je 0x480d
movzbl 0x1(%rdi), %r9d
andl $0x7f, %r9d
movb (%r9,%r10), %r11b
cmpb $-0x1, %r11b
je 0x480d
movzbl 0x2(%rdi), %r13d
andl $0x7f, %r13d
movb (%r13,%r10), %bl
cmpb $-0x1, %bl
je 0x480d
movzbl 0x3(%rdi), %r12d
andl $0x7f, %r12d
movb (%r12,%r10), %r14b
cmpb $-0x1, %r14b
je 0x480d
addl $-0x4, %esi
cmpb $0x3d, %r15b
je 0x480d
cmpb $0x3d, %r9b
je 0x480d
shlb $0x2, %bpl
movl %r11d, %r9d
shrb $0x4, %r9b
orb %bpl, %r9b
movb %r9b, -0x2(%r8)
cmpb $0x3d, %r13b
je 0x4837
shlb $0x4, %r11b
movl %ebx, %r9d
shrb $0x2, %r9b
orb %r11b, %r9b
movb %r9b, -0x1(%r8)
cmpb $0x3d, %r12b
je 0x4810
shlb $0x6, %bl
orb %bl, %r14b
addq $0x3, %rdx
movb %r14b, (%r8)
addq $0x3, %r8
addq $0x4, %rdi
jmp 0x475c
movq %rdx, %r8
movb $0x0, (%r8)
movq -0x8(%rsp), %rdx
testq %rdx, %rdx
je 0x4824
subl %ecx, %r8d
movl %r8d, (%rdx)
subl %esi, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $-0x2, %r8
jmp 0x4810
decq %r8
jmp 0x4810
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_timegm
double cs_timegm(const struct tm *tm) {
  /* Month-to-day offset for non-leap-years. */
  static const int month_day[12] = {0,   31,  59,  90,  120, 151,
                                    181, 212, 243, 273, 304, 334};

  /* Most of the calculation is easy; leap years are the main difficulty. */
  int month = tm->tm_mon % 12;
  int year = tm->tm_year + tm->tm_mon / 12;
  int year_for_leap;
  int64_t rt;

  if (month < 0) { /* Negative values % 12 are still negative. */
    month += 12;
    --year;
  }

  /* This is the number of Februaries since 1900. */
  year_for_leap = (month > 1) ? year + 1 : year;

  rt =
      tm->tm_sec /* Seconds */
      +
      60 *
          (tm->tm_min /* Minute = 60 seconds */
           +
           60 * (tm->tm_hour /* Hour = 60 minutes */
                 +
                 24 * (month_day[month] + tm->tm_mday - 1 /* Day = 24 hours */
                       + 365 * (year - 70)                /* Year = 365 days */
                       + (year_for_leap - 69) / 4 /* Every 4 years is leap... */
                       - (year_for_leap - 1) / 100 /* Except centuries... */
                       + (year_for_leap + 299) / 400))); /* Except 400s. */
  return rt < 0 ? -1 : (double) rt;
}

// Assembly:
pushq %r14
pushq %rbx
movl (%rdi), %r8d
movl 0x10(%rdi), %eax
movl $0xc, %ecx
cltd
idivl %ecx
addl 0x14(%rdi), %eax
leal 0xc(%rdx), %r9d
movl %edx, %r11d
sarl $0x1f, %r11d
addl %eax, %r11d
testl %edx, %edx
cmovnsl %edx, %r9d
xorl %ebx, %ebx
cmpl $0x2, %r9d
setge %bl
leaq 0xfb45(%rip), %r14      # 0x143f0
imull $0x16d, %r11d, %r10d    # imm = 0x16D
leal (%rbx,%r11), %eax
addl $-0x45, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %ecx
leal (%rbx,%r11), %eax
decl %eax
movl $0xffffff9c, %esi       # imm = 0xFFFFFF9C
cltd
idivl %esi
movl %eax, %esi
leal (%rbx,%r11), %eax
addl $0x12b, %eax            # imm = 0x12B
movl $0x190, %r11d           # imm = 0x190
cltd
idivl %r11d
addl (%r14,%r9,4), %r10d
addl 0xc(%rdi), %r10d
addl %ecx, %r10d
addl %esi, %eax
addl %r10d, %eax
imull $0x18, %eax, %eax
addl 0x8(%rdi), %eax
imull $0x3c, %eax, %eax
addl 0x4(%rdi), %eax
imull $0x3c, %eax, %eax
addl %r8d, %eax
addl $0x7c6a9980, %eax       # imm = 0x7C6A9980
testl %eax, %eax
js 0x4917
cvtsi2sd %eax, %xmm0
jmp 0x491f
movsd 0xf9d9(%rip), %xmm0     # 0x142f8
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_md5_update
void cs_md5_update(cs_md5_ctx *ctx, const unsigned char *buf, size_t len) {
  uint32_t t;

  t = ctx->bits[0];
  if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) ctx->bits[1]++;
  ctx->bits[1] += (uint32_t) len >> 29;

  t = (t >> 3) & 0x3f;

  if (t) {
    unsigned char *p = (unsigned char *) ctx->in + t;

    t = 64 - t;
    if (len < t) {
      memcpy(p, buf, len);
      return;
    }
    memcpy(p, buf, t);
    byteReverse(ctx->in, 16);
    cs_md5_transform(ctx->buf, (uint32_t *) ctx->in);
    buf += t;
    len -= t;
  }

  while (len >= 64) {
    memcpy(ctx->in, buf, 64);
    byteReverse(ctx->in, 16);
    cs_md5_transform(ctx->buf, (uint32_t *) ctx->in);
    buf += 64;
    len -= 64;
  }

  memcpy(ctx->in, buf, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10(%rdi), %eax
leal (,%rdx,8), %ecx
movl %edx, %edi
shrl $0x1d, %edi
addl %eax, %ecx
movl %ecx, 0x10(%rbx)
adcl %edi, 0x14(%rbx)
movq %rsi, %r14
shrl $0x3, %eax
andl $0x3f, %eax
je 0x4982
leaq (%rbx,%rax), %rdi
addq $0x18, %rdi
pushq $0x40
popq %r12
subl %eax, %r12d
movq %rdx, %r15
subq %r12, %r15
jae 0x4987
movq %r14, %rsi
jmp 0x4a0e
movq %rdx, %r15
jmp 0x49af
leaq 0x18(%rbx), %r13
movq %r14, %rsi
movq %r12, %rdx
callq 0x3380
pushq $0x10
popq %rsi
movq %r13, %rdi
callq 0x4a21
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4a2d
addq %r12, %r14
leaq 0x18(%rbx), %r12
pushq $0x10
popq %rbp
cmpq $0x40, %r15
jb 0x4a05
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups 0x30(%r14), %xmm3
movups %xmm3, 0x30(%r12)
movups %xmm2, 0x20(%r12)
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq %r12, %rdi
movl %ebp, %esi
callq 0x4a21
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4a2d
addq $0x40, %r14
addq $-0x40, %r15
jmp 0x49b6
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3380
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_md5_final
void cs_md5_final(unsigned char digest[16], cs_md5_ctx *ctx) {
  unsigned count;
  unsigned char *p;
  uint32_t *a;

  count = (ctx->bits[0] >> 3) & 0x3F;

  p = ctx->in + count;
  *p++ = 0x80;
  count = 64 - 1 - count;
  if (count < 8) {
    memset(p, 0, count);
    byteReverse(ctx->in, 16);
    cs_md5_transform(ctx->buf, (uint32_t *) ctx->in);
    memset(ctx->in, 0, 56);
  } else {
    memset(p, 0, count - 8);
  }
  byteReverse(ctx->in, 14);

  a = (uint32_t *) ctx->in;
  a[14] = ctx->bits[0];
  a[15] = ctx->bits[1];

  cs_md5_transform(ctx->buf, (uint32_t *) ctx->in);
  byteReverse((unsigned char *) ctx->buf, 4);
  memcpy(digest, ctx->buf, 16);
  memset((char *) ctx, 0, sizeof(*ctx));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x10(%rsi), %eax
shrl $0x3, %eax
andl $0x3f, %eax
leaq 0x18(%rsi), %r15
leaq (%rsi,%rax), %rdi
addq $0x19, %rdi
movb $-0x80, -0x1(%rdi)
movl %eax, %ecx
xorl $0x3f, %ecx
cmpl $0x7, %ecx
ja 0x51e5
movl %ecx, %edx
xorl %esi, %esi
callq 0x3240
pushq $0x10
popq %rsi
movq %r15, %rdi
callq 0x4a21
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4a2d
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
andq $0x0, 0x30(%r15)
jmp 0x51f1
pushq $0x37
popq %rdx
subl %eax, %edx
xorl %esi, %esi
callq 0x3240
pushq $0xe
popq %rsi
movq %r15, %rdi
callq 0x4a21
movq 0x10(%rbx), %rax
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4a2d
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x4a21
movups (%rbx), %xmm0
movups %xmm0, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, (%rbx)
andq $0x0, 0x50(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sfeakes[P]unifi-motion/mongoose.c
// Function: cs_sha1_update
void cs_sha1_update(cs_sha1_ctx *context, const unsigned char *data,
                    uint32_t len) {
  uint32_t i, j;

  j = context->count[0];
  if ((context->count[0] += len << 3) < j) context->count[1]++;
  context->count[1] += (len >> 29);
  j = (j >> 3) & 63;
  if ((j + len) > 63) {
    memcpy(&context->buffer[j], data, (i = 64 - j));
    cs_sha1_transform(context->state, context->buffer);
    for (; i + 63 < len; i += 64) {
      cs_sha1_transform(context->state, &data[i]);
    }
    j = 0;
  } else
    i = 0;
  memcpy(&context->buffer[j], &data[i], len - i);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl 0x14(%rdi), %eax
leal (,%rbx,8), %ecx
shrl $0x1d, %edx
addl %eax, %ecx
movl %ecx, 0x14(%rdi)
adcl %edx, 0x18(%rdi)
shrl $0x3, %eax
andl $0x3f, %eax
leal (%rax,%rbx), %ecx
cmpl $0x40, %ecx
jb 0x63c4
leaq 0x1c(%r15), %r13
leaq (%r15,%rax), %rdi
addq $0x1c, %rdi
pushq $0x40
popq %r12
subl %eax, %r12d
movq %r14, %rsi
movq %r12, %rdx
callq 0x3380
movq %r15, %rdi
movq %r13, %rsi
callq 0x5242
xorl %r13d, %r13d
leal 0x3f(%r12), %eax
cmpl %ebx, %eax
jae 0x63ca
movl %r12d, %esi
addq %r14, %rsi
movq %r15, %rdi
callq 0x5242
addl $0x40, %r12d
jmp 0x63a7
movl %eax, %r13d
xorl %r12d, %r12d
leaq (%r15,%r13), %rdi
addq $0x1c, %rdi
movl %r12d, %eax
addq %rax, %r14
subl %r12d, %ebx
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3380